@hotelinking/ui 1.2.5 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -5
- package/dist/index.css +381 -2
- package/dist/ui.cjs.js +4 -1
- package/dist/ui.es.js +1162 -5
- package/package.json +27 -4
- package/dist/ui.cjs2.js +0 -1
- package/dist/ui.cjs3.js +0 -1
- package/dist/ui.cjs4.js +0 -1
- package/dist/ui.es2.js +0 -9
- package/dist/ui.es3.js +0 -41
- package/dist/ui.es4.js +0 -20
package/dist/ui.es.js
CHANGED
|
@@ -1,11 +1,1168 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
1
|
+
import { openBlock as b, createBlock as L, resolveDynamicComponent as we, normalizeClass as O, createElementBlock as S, createVNode as E, renderSlot as ie, ref as w, createElementVNode as g, cloneVNode as Se, h as ke, Fragment as ue, inject as se, provide as ce, onMounted as de, watchEffect as R, nextTick as A, computed as D, defineComponent as B, onUnmounted as Ie, unref as $, withCtx as N, createTextVNode as G, toDisplayString as k, Transition as Ee, renderList as $e, createCommentVNode as T, withDirectives as P, vModelDynamic as De, vShow as j, withModifiers as _ } from "vue";
|
|
2
|
+
const Me = { name: "uiIcon" }, M = /* @__PURE__ */ Object.assign(Me, {
|
|
3
|
+
props: {
|
|
4
|
+
/**
|
|
5
|
+
* COMPONENTE del icono
|
|
6
|
+
*/
|
|
7
|
+
icon: { type: Function, required: !0 },
|
|
8
|
+
/**
|
|
9
|
+
* Tamaño
|
|
10
|
+
*/
|
|
11
|
+
size: { type: String, default: "normal" },
|
|
12
|
+
/**
|
|
13
|
+
* Color
|
|
14
|
+
*/
|
|
15
|
+
color: { type: String, default: "primary" }
|
|
16
|
+
},
|
|
17
|
+
setup(e) {
|
|
18
|
+
return (t, r) => (b(), L(we(e.icon), {
|
|
19
|
+
class: O({
|
|
20
|
+
"h-4 w-4": e.size === "normal",
|
|
21
|
+
"h-6 w-6": e.size === "big",
|
|
22
|
+
"h-12 w-12": e.size === "huge",
|
|
23
|
+
"h-20 w-20": e.size === "massive",
|
|
24
|
+
"text-indigo-600": e.color === "primary",
|
|
25
|
+
"text-cyan-300": e.color === "secondary",
|
|
26
|
+
"text-red-400": e.color === "red",
|
|
27
|
+
"text-yellow-400": e.color === "yellow",
|
|
28
|
+
"text-green-400": e.color === "green",
|
|
29
|
+
"text-white": e.color === "white",
|
|
30
|
+
"text-gray-300": e.color === "gray",
|
|
31
|
+
"text-black": e.color === "black"
|
|
32
|
+
})
|
|
33
|
+
}, null, 8, ["class"]));
|
|
34
|
+
}
|
|
35
|
+
}), Oe = ["disabled"], Fe = {
|
|
36
|
+
name: "uiButton"
|
|
37
|
+
}, Pe = /* @__PURE__ */ Object.assign(Fe, {
|
|
38
|
+
props: {
|
|
39
|
+
/**
|
|
40
|
+
* Color del botón
|
|
41
|
+
*/
|
|
42
|
+
color: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: "primary"
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* Tamaño del botón
|
|
48
|
+
*/
|
|
49
|
+
size: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: "normal"
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* Icono del botón (acepta directamente el componente del icono)
|
|
55
|
+
*/
|
|
56
|
+
icon: {
|
|
57
|
+
type: Function,
|
|
58
|
+
default: () => {
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
/**
|
|
62
|
+
* Estado del botón
|
|
63
|
+
*/
|
|
64
|
+
disabled: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
default: !1
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
setup(e) {
|
|
70
|
+
return (t, r) => (b(), S("button", {
|
|
71
|
+
disabled: e.disabled,
|
|
72
|
+
class: O([{
|
|
73
|
+
"bg-indigo-600 hover:bg-indigo-800": e.color === "primary",
|
|
74
|
+
"bg-cyan-300 hover:bg-cyan-500": e.color === "secondary",
|
|
75
|
+
"bg-red-400 hover:bg-red-600": e.color === "red",
|
|
76
|
+
"bg-yellow-400 hover:bg-yellow-600": e.color === "yellow",
|
|
77
|
+
"bg-green-400 hover:bg-green-600": e.color === "green",
|
|
78
|
+
"px-4 py-2 text-sm rounded-md": e.size === "normal",
|
|
79
|
+
"px-2.5 py-1.5 text-xs rounded leading-none": e.size === "small",
|
|
80
|
+
"px-6 py-3 text-base rounded-md": e.size === "large"
|
|
81
|
+
}, "inline-flex items-center border border-transparent font-medium shadow-sm text-white focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-25"]),
|
|
82
|
+
type: "button"
|
|
83
|
+
}, [
|
|
84
|
+
E(M, {
|
|
85
|
+
icon: e.icon,
|
|
86
|
+
color: "white",
|
|
87
|
+
class: "-ml-0.5 mr-2"
|
|
88
|
+
}, null, 8, ["icon"]),
|
|
89
|
+
ie(t.$slots, "default")
|
|
90
|
+
], 10, Oe));
|
|
91
|
+
}
|
|
92
|
+
}), Te = { class: "relative flex items-start" }, Ae = { class: "flex items-center h-5" }, je = ["checked", "value", "disabled"], Ne = { class: "ml-3 text-sm" }, Ce = { class: "text-gray-500" }, Re = {
|
|
93
|
+
name: "uiCheckbox"
|
|
94
|
+
}, Le = /* @__PURE__ */ Object.assign(Re, {
|
|
95
|
+
props: {
|
|
96
|
+
/**
|
|
97
|
+
* Checkbox desactivado
|
|
98
|
+
*/
|
|
99
|
+
disabled: {
|
|
100
|
+
type: Boolean,
|
|
101
|
+
default: !1
|
|
102
|
+
},
|
|
103
|
+
/**
|
|
104
|
+
* Valor del Checkbox
|
|
105
|
+
*/
|
|
106
|
+
value: {
|
|
107
|
+
type: String
|
|
108
|
+
},
|
|
109
|
+
/**
|
|
110
|
+
* Checkbox seleccionado
|
|
111
|
+
*/
|
|
112
|
+
check: {
|
|
113
|
+
type: Boolean,
|
|
114
|
+
default: !1
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
emits: ["checkboxChanged"],
|
|
118
|
+
setup(e, { emit: t }) {
|
|
119
|
+
const r = e, l = w(r.check), n = () => {
|
|
120
|
+
r.disabled || (l.value = !l.value, t("checkboxChanged", {
|
|
121
|
+
checked: l.value,
|
|
122
|
+
value: r.value
|
|
123
|
+
}));
|
|
124
|
+
};
|
|
125
|
+
return (a, o) => (b(), S("div", Te, [
|
|
126
|
+
g("div", Ae, [
|
|
127
|
+
g("input", {
|
|
128
|
+
checked: e.check,
|
|
129
|
+
value: e.value,
|
|
130
|
+
disabled: e.disabled,
|
|
131
|
+
class: "focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded disabled:opacity-25",
|
|
132
|
+
type: "checkbox",
|
|
133
|
+
onChange: o[0] || (o[0] = (u) => n())
|
|
134
|
+
}, null, 40, je)
|
|
135
|
+
]),
|
|
136
|
+
g("div", Ne, [
|
|
137
|
+
g("span", Ce, [
|
|
138
|
+
ie(a.$slots, "default")
|
|
139
|
+
])
|
|
140
|
+
])
|
|
141
|
+
]));
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
function z(e, t, ...r) {
|
|
145
|
+
if (e in t) {
|
|
146
|
+
let n = t[e];
|
|
147
|
+
return typeof n == "function" ? n(...r) : n;
|
|
148
|
+
}
|
|
149
|
+
let l = new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map((n) => `"${n}"`).join(", ")}.`);
|
|
150
|
+
throw Error.captureStackTrace && Error.captureStackTrace(l, z), l;
|
|
151
|
+
}
|
|
152
|
+
var K = ((e) => (e[e.None = 0] = "None", e[e.RenderStrategy = 1] = "RenderStrategy", e[e.Static = 2] = "Static", e))(K || {}), Be = ((e) => (e[e.Unmount = 0] = "Unmount", e[e.Hidden = 1] = "Hidden", e))(Be || {});
|
|
153
|
+
function U({ visible: e = !0, features: t = 0, ourProps: r, theirProps: l, ...n }) {
|
|
154
|
+
var a;
|
|
155
|
+
let o = ve(l, r), u = Object.assign(n, { props: o });
|
|
156
|
+
if (e || t & 2 && o.static)
|
|
157
|
+
return V(u);
|
|
158
|
+
if (t & 1) {
|
|
159
|
+
let d = (a = o.unmount) == null || a ? 0 : 1;
|
|
160
|
+
return z(d, { [0]() {
|
|
161
|
+
return null;
|
|
162
|
+
}, [1]() {
|
|
163
|
+
return V({ ...n, props: { ...o, hidden: !0, style: { display: "none" } } });
|
|
164
|
+
} });
|
|
165
|
+
}
|
|
166
|
+
return V(u);
|
|
167
|
+
}
|
|
168
|
+
function V({ props: e, attrs: t, slots: r, slot: l, name: n }) {
|
|
169
|
+
var a, o;
|
|
170
|
+
let { as: u, ...d } = ze(e, ["unmount", "static"]), c = (a = r.default) == null ? void 0 : a.call(r, l), i = {};
|
|
171
|
+
if (l) {
|
|
172
|
+
let p = !1, v = [];
|
|
173
|
+
for (let [m, f] of Object.entries(l))
|
|
174
|
+
typeof f == "boolean" && (p = !0), f === !0 && v.push(m);
|
|
175
|
+
p && (i["data-headlessui-state"] = v.join(" "));
|
|
176
|
+
}
|
|
177
|
+
if (u === "template") {
|
|
178
|
+
if (c = fe(c ?? []), Object.keys(d).length > 0 || Object.keys(t).length > 0) {
|
|
179
|
+
let [p, ...v] = c ?? [];
|
|
180
|
+
if (!Ue(p) || v.length > 0)
|
|
181
|
+
throw new Error(['Passing props on "template"!', "", `The current component <${n} /> is rendering a "template".`, "However we need to passthrough the following props:", Object.keys(d).concat(Object.keys(t)).map((s) => s.trim()).filter((s, y, F) => F.indexOf(s) === y).sort((s, y) => s.localeCompare(y)).map((s) => ` - ${s}`).join(`
|
|
182
|
+
`), "", "You can apply a few solutions:", ['Add an `as="..."` prop, to ensure that we render an actual element instead of a "template".', "Render a single element as the child so that we can forward the props onto that element."].map((s) => ` - ${s}`).join(`
|
|
183
|
+
`)].join(`
|
|
184
|
+
`));
|
|
185
|
+
let m = ve((o = p.props) != null ? o : {}, d), f = Se(p, m);
|
|
186
|
+
for (let s in m)
|
|
187
|
+
s.startsWith("on") && (f.props || (f.props = {}), f.props[s] = m[s]);
|
|
188
|
+
return f;
|
|
189
|
+
}
|
|
190
|
+
return Array.isArray(c) && c.length === 1 ? c[0] : c;
|
|
191
|
+
}
|
|
192
|
+
return ke(u, Object.assign({}, d, i), { default: () => c });
|
|
193
|
+
}
|
|
194
|
+
function fe(e) {
|
|
195
|
+
return e.flatMap((t) => t.type === ue ? fe(t.children) : [t]);
|
|
196
|
+
}
|
|
197
|
+
function ve(...e) {
|
|
198
|
+
if (e.length === 0)
|
|
199
|
+
return {};
|
|
200
|
+
if (e.length === 1)
|
|
201
|
+
return e[0];
|
|
202
|
+
let t = {}, r = {};
|
|
203
|
+
for (let l of e)
|
|
204
|
+
for (let n in l)
|
|
205
|
+
n.startsWith("on") && typeof l[n] == "function" ? (r[n] != null || (r[n] = []), r[n].push(l[n])) : t[n] = l[n];
|
|
206
|
+
if (t.disabled || t["aria-disabled"])
|
|
207
|
+
return Object.assign(t, Object.fromEntries(Object.keys(r).map((l) => [l, void 0])));
|
|
208
|
+
for (let l in r)
|
|
209
|
+
Object.assign(t, { [l](n, ...a) {
|
|
210
|
+
let o = r[l];
|
|
211
|
+
for (let u of o) {
|
|
212
|
+
if (n instanceof Event && n.defaultPrevented)
|
|
213
|
+
return;
|
|
214
|
+
u(n, ...a);
|
|
215
|
+
}
|
|
216
|
+
} });
|
|
217
|
+
return t;
|
|
218
|
+
}
|
|
219
|
+
function ze(e, t = []) {
|
|
220
|
+
let r = Object.assign({}, e);
|
|
221
|
+
for (let l of t)
|
|
222
|
+
l in r && delete r[l];
|
|
223
|
+
return r;
|
|
224
|
+
}
|
|
225
|
+
function Ue(e) {
|
|
226
|
+
return e == null ? !1 : typeof e.type == "string" || typeof e.type == "object" || typeof e.type == "function";
|
|
227
|
+
}
|
|
228
|
+
let He = 0;
|
|
229
|
+
function Ve() {
|
|
230
|
+
return ++He;
|
|
231
|
+
}
|
|
232
|
+
function X() {
|
|
233
|
+
return Ve();
|
|
234
|
+
}
|
|
235
|
+
var x = ((e) => (e.Space = " ", e.Enter = "Enter", e.Escape = "Escape", e.Backspace = "Backspace", e.Delete = "Delete", e.ArrowLeft = "ArrowLeft", e.ArrowUp = "ArrowUp", e.ArrowRight = "ArrowRight", e.ArrowDown = "ArrowDown", e.Home = "Home", e.End = "End", e.PageUp = "PageUp", e.PageDown = "PageDown", e.Tab = "Tab", e))(x || {});
|
|
236
|
+
function Ke(e) {
|
|
237
|
+
throw new Error("Unexpected object: " + e);
|
|
238
|
+
}
|
|
239
|
+
var I = ((e) => (e[e.First = 0] = "First", e[e.Previous = 1] = "Previous", e[e.Next = 2] = "Next", e[e.Last = 3] = "Last", e[e.Specific = 4] = "Specific", e[e.Nothing = 5] = "Nothing", e))(I || {});
|
|
240
|
+
function We(e, t) {
|
|
241
|
+
let r = t.resolveItems();
|
|
242
|
+
if (r.length <= 0)
|
|
243
|
+
return null;
|
|
244
|
+
let l = t.resolveActiveIndex(), n = l ?? -1, a = (() => {
|
|
245
|
+
switch (e.focus) {
|
|
246
|
+
case 0:
|
|
247
|
+
return r.findIndex((o) => !t.resolveDisabled(o));
|
|
248
|
+
case 1: {
|
|
249
|
+
let o = r.slice().reverse().findIndex((u, d, c) => n !== -1 && c.length - d - 1 >= n ? !1 : !t.resolveDisabled(u));
|
|
250
|
+
return o === -1 ? o : r.length - 1 - o;
|
|
251
|
+
}
|
|
252
|
+
case 2:
|
|
253
|
+
return r.findIndex((o, u) => u <= n ? !1 : !t.resolveDisabled(o));
|
|
254
|
+
case 3: {
|
|
255
|
+
let o = r.slice().reverse().findIndex((u) => !t.resolveDisabled(u));
|
|
256
|
+
return o === -1 ? o : r.length - 1 - o;
|
|
257
|
+
}
|
|
258
|
+
case 4:
|
|
259
|
+
return r.findIndex((o) => t.resolveId(o) === e.id);
|
|
260
|
+
case 5:
|
|
261
|
+
return null;
|
|
262
|
+
default:
|
|
263
|
+
Ke(e);
|
|
264
|
+
}
|
|
265
|
+
})();
|
|
266
|
+
return a === -1 ? l : a;
|
|
267
|
+
}
|
|
268
|
+
function h(e) {
|
|
269
|
+
var t;
|
|
270
|
+
return e == null || e.value == null ? null : (t = e.value.$el) != null ? t : e.value;
|
|
271
|
+
}
|
|
272
|
+
let me = Symbol("Context");
|
|
273
|
+
var C = ((e) => (e[e.Open = 1] = "Open", e[e.Closed = 2] = "Closed", e[e.Closing = 4] = "Closing", e[e.Opening = 8] = "Opening", e))(C || {});
|
|
274
|
+
function qe() {
|
|
275
|
+
return se(me, null);
|
|
276
|
+
}
|
|
277
|
+
function Ge(e) {
|
|
278
|
+
ce(me, e);
|
|
279
|
+
}
|
|
280
|
+
function ee(e, t) {
|
|
281
|
+
if (e)
|
|
282
|
+
return e;
|
|
283
|
+
let r = t ?? "button";
|
|
284
|
+
if (typeof r == "string" && r.toLowerCase() === "button")
|
|
285
|
+
return "button";
|
|
286
|
+
}
|
|
287
|
+
function Xe(e, t) {
|
|
288
|
+
let r = w(ee(e.value.type, e.value.as));
|
|
289
|
+
return de(() => {
|
|
290
|
+
r.value = ee(e.value.type, e.value.as);
|
|
291
|
+
}), R(() => {
|
|
292
|
+
var l;
|
|
293
|
+
r.value || h(t) && h(t) instanceof HTMLButtonElement && !((l = h(t)) != null && l.hasAttribute("type")) && (r.value = "button");
|
|
294
|
+
}), r;
|
|
295
|
+
}
|
|
296
|
+
var Ye = Object.defineProperty, Qe = (e, t, r) => t in e ? Ye(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, te = (e, t, r) => (Qe(e, typeof t != "symbol" ? t + "" : t, r), r);
|
|
297
|
+
class Je {
|
|
298
|
+
constructor() {
|
|
299
|
+
te(this, "current", this.detect()), te(this, "currentId", 0);
|
|
300
|
+
}
|
|
301
|
+
set(t) {
|
|
302
|
+
this.current !== t && (this.currentId = 0, this.current = t);
|
|
303
|
+
}
|
|
304
|
+
reset() {
|
|
305
|
+
this.set(this.detect());
|
|
306
|
+
}
|
|
307
|
+
nextId() {
|
|
308
|
+
return ++this.currentId;
|
|
309
|
+
}
|
|
310
|
+
get isServer() {
|
|
311
|
+
return this.current === "server";
|
|
312
|
+
}
|
|
313
|
+
get isClient() {
|
|
314
|
+
return this.current === "client";
|
|
315
|
+
}
|
|
316
|
+
detect() {
|
|
317
|
+
return typeof window > "u" || typeof document > "u" ? "server" : "client";
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
let Y = new Je();
|
|
321
|
+
function Q(e) {
|
|
322
|
+
if (Y.isServer)
|
|
323
|
+
return null;
|
|
324
|
+
if (e instanceof Node)
|
|
325
|
+
return e.ownerDocument;
|
|
326
|
+
if (e != null && e.hasOwnProperty("value")) {
|
|
327
|
+
let t = h(e);
|
|
328
|
+
if (t)
|
|
329
|
+
return t.ownerDocument;
|
|
330
|
+
}
|
|
331
|
+
return document;
|
|
332
|
+
}
|
|
333
|
+
function Ze({ container: e, accept: t, walk: r, enabled: l }) {
|
|
334
|
+
R(() => {
|
|
335
|
+
let n = e.value;
|
|
336
|
+
if (!n || l !== void 0 && !l.value)
|
|
337
|
+
return;
|
|
338
|
+
let a = Q(e);
|
|
339
|
+
if (!a)
|
|
340
|
+
return;
|
|
341
|
+
let o = Object.assign((d) => t(d), { acceptNode: t }), u = a.createTreeWalker(n, NodeFilter.SHOW_ELEMENT, o, !1);
|
|
342
|
+
for (; u.nextNode(); )
|
|
343
|
+
r(u.currentNode);
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
let W = ["[contentEditable=true]", "[tabindex]", "a[href]", "area[href]", "button:not([disabled])", "iframe", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])"].map((e) => `${e}:not([tabindex='-1'])`).join(",");
|
|
347
|
+
var q = ((e) => (e[e.First = 1] = "First", e[e.Previous = 2] = "Previous", e[e.Next = 4] = "Next", e[e.Last = 8] = "Last", e[e.WrapAround = 16] = "WrapAround", e[e.NoScroll = 32] = "NoScroll", e))(q || {}), _e = ((e) => (e[e.Error = 0] = "Error", e[e.Overflow = 1] = "Overflow", e[e.Success = 2] = "Success", e[e.Underflow = 3] = "Underflow", e))(_e || {}), et = ((e) => (e[e.Previous = -1] = "Previous", e[e.Next = 1] = "Next", e))(et || {});
|
|
348
|
+
function ge(e = document.body) {
|
|
349
|
+
return e == null ? [] : Array.from(e.querySelectorAll(W)).sort((t, r) => Math.sign((t.tabIndex || Number.MAX_SAFE_INTEGER) - (r.tabIndex || Number.MAX_SAFE_INTEGER)));
|
|
350
|
+
}
|
|
351
|
+
var J = ((e) => (e[e.Strict = 0] = "Strict", e[e.Loose = 1] = "Loose", e))(J || {});
|
|
352
|
+
function Z(e, t = 0) {
|
|
353
|
+
var r;
|
|
354
|
+
return e === ((r = Q(e)) == null ? void 0 : r.body) ? !1 : z(t, { [0]() {
|
|
355
|
+
return e.matches(W);
|
|
356
|
+
}, [1]() {
|
|
357
|
+
let l = e;
|
|
358
|
+
for (; l !== null; ) {
|
|
359
|
+
if (l.matches(W))
|
|
360
|
+
return !0;
|
|
361
|
+
l = l.parentElement;
|
|
362
|
+
}
|
|
363
|
+
return !1;
|
|
364
|
+
} });
|
|
365
|
+
}
|
|
366
|
+
function pe(e) {
|
|
367
|
+
let t = Q(e);
|
|
368
|
+
A(() => {
|
|
369
|
+
t && !Z(t.activeElement, 0) && nt(e);
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
var tt = ((e) => (e[e.Keyboard = 0] = "Keyboard", e[e.Mouse = 1] = "Mouse", e))(tt || {});
|
|
373
|
+
typeof window < "u" && typeof document < "u" && (document.addEventListener("keydown", (e) => {
|
|
374
|
+
e.metaKey || e.altKey || e.ctrlKey || (document.documentElement.dataset.headlessuiFocusVisible = "");
|
|
375
|
+
}, !0), document.addEventListener("click", (e) => {
|
|
376
|
+
e.detail === 1 ? delete document.documentElement.dataset.headlessuiFocusVisible : e.detail === 0 && (document.documentElement.dataset.headlessuiFocusVisible = "");
|
|
377
|
+
}, !0));
|
|
378
|
+
function nt(e) {
|
|
379
|
+
e == null || e.focus({ preventScroll: !0 });
|
|
380
|
+
}
|
|
381
|
+
let rt = ["textarea", "input"].join(",");
|
|
382
|
+
function lt(e) {
|
|
383
|
+
var t, r;
|
|
384
|
+
return (r = (t = e == null ? void 0 : e.matches) == null ? void 0 : t.call(e, rt)) != null ? r : !1;
|
|
385
|
+
}
|
|
386
|
+
function he(e, t = (r) => r) {
|
|
387
|
+
return e.slice().sort((r, l) => {
|
|
388
|
+
let n = t(r), a = t(l);
|
|
389
|
+
if (n === null || a === null)
|
|
390
|
+
return 0;
|
|
391
|
+
let o = n.compareDocumentPosition(a);
|
|
392
|
+
return o & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : o & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
function ot(e, t) {
|
|
396
|
+
return at(ge(), t, { relativeTo: e });
|
|
397
|
+
}
|
|
398
|
+
function at(e, t, { sorted: r = !0, relativeTo: l = null, skipElements: n = [] } = {}) {
|
|
399
|
+
var a;
|
|
400
|
+
let o = (a = Array.isArray(e) ? e.length > 0 ? e[0].ownerDocument : document : e == null ? void 0 : e.ownerDocument) != null ? a : document, u = Array.isArray(e) ? r ? he(e) : e : ge(e);
|
|
401
|
+
n.length > 0 && u.length > 1 && (u = u.filter((f) => !n.includes(f))), l = l ?? o.activeElement;
|
|
402
|
+
let d = (() => {
|
|
403
|
+
if (t & 5)
|
|
404
|
+
return 1;
|
|
405
|
+
if (t & 10)
|
|
406
|
+
return -1;
|
|
407
|
+
throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
|
|
408
|
+
})(), c = (() => {
|
|
409
|
+
if (t & 1)
|
|
410
|
+
return 0;
|
|
411
|
+
if (t & 2)
|
|
412
|
+
return Math.max(0, u.indexOf(l)) - 1;
|
|
413
|
+
if (t & 4)
|
|
414
|
+
return Math.max(0, u.indexOf(l)) + 1;
|
|
415
|
+
if (t & 8)
|
|
416
|
+
return u.length - 1;
|
|
417
|
+
throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
|
|
418
|
+
})(), i = t & 32 ? { preventScroll: !0 } : {}, p = 0, v = u.length, m;
|
|
419
|
+
do {
|
|
420
|
+
if (p >= v || p + v <= 0)
|
|
421
|
+
return 0;
|
|
422
|
+
let f = c + p;
|
|
423
|
+
if (t & 16)
|
|
424
|
+
f = (f + v) % v;
|
|
425
|
+
else {
|
|
426
|
+
if (f < 0)
|
|
427
|
+
return 3;
|
|
428
|
+
if (f >= v)
|
|
429
|
+
return 1;
|
|
430
|
+
}
|
|
431
|
+
m = u[f], m == null || m.focus(i), p += d;
|
|
432
|
+
} while (m !== o.activeElement);
|
|
433
|
+
return t & 6 && lt(m) && m.select(), 2;
|
|
434
|
+
}
|
|
435
|
+
function ne(e, t, r) {
|
|
436
|
+
Y.isServer || R((l) => {
|
|
437
|
+
document.addEventListener(e, t, r), l(() => document.removeEventListener(e, t, r));
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
function it(e, t, r) {
|
|
441
|
+
Y.isServer || R((l) => {
|
|
442
|
+
window.addEventListener(e, t, r), l(() => window.removeEventListener(e, t, r));
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
function ut(e, t, r = D(() => !0)) {
|
|
446
|
+
function l(a, o) {
|
|
447
|
+
if (!r.value || a.defaultPrevented)
|
|
448
|
+
return;
|
|
449
|
+
let u = o(a);
|
|
450
|
+
if (u === null || !u.getRootNode().contains(u))
|
|
451
|
+
return;
|
|
452
|
+
let d = function c(i) {
|
|
453
|
+
return typeof i == "function" ? c(i()) : Array.isArray(i) || i instanceof Set ? i : [i];
|
|
454
|
+
}(e);
|
|
455
|
+
for (let c of d) {
|
|
456
|
+
if (c === null)
|
|
457
|
+
continue;
|
|
458
|
+
let i = c instanceof HTMLElement ? c : h(c);
|
|
459
|
+
if (i != null && i.contains(u) || a.composed && a.composedPath().includes(i))
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
return !Z(u, J.Loose) && u.tabIndex !== -1 && a.preventDefault(), t(a, u);
|
|
463
|
+
}
|
|
464
|
+
let n = w(null);
|
|
465
|
+
ne("mousedown", (a) => {
|
|
466
|
+
var o, u;
|
|
467
|
+
r.value && (n.value = ((u = (o = a.composedPath) == null ? void 0 : o.call(a)) == null ? void 0 : u[0]) || a.target);
|
|
468
|
+
}, !0), ne("click", (a) => {
|
|
469
|
+
n.value && (l(a, () => n.value), n.value = null);
|
|
470
|
+
}, !0), it("blur", (a) => l(a, () => window.document.activeElement instanceof HTMLIFrameElement ? window.document.activeElement : null), !0);
|
|
471
|
+
}
|
|
472
|
+
function re(e) {
|
|
473
|
+
return [e.screenX, e.screenY];
|
|
474
|
+
}
|
|
475
|
+
function st() {
|
|
476
|
+
let e = w([-1, -1]);
|
|
477
|
+
return { wasMoved(t) {
|
|
478
|
+
let r = re(t);
|
|
479
|
+
return e.value[0] === r[0] && e.value[1] === r[1] ? !1 : (e.value = r, !0);
|
|
480
|
+
}, update(t) {
|
|
481
|
+
e.value = re(t);
|
|
482
|
+
} };
|
|
483
|
+
}
|
|
484
|
+
let le = /([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;
|
|
485
|
+
function oe(e) {
|
|
486
|
+
var t, r;
|
|
487
|
+
let l = (t = e.innerText) != null ? t : "", n = e.cloneNode(!0);
|
|
488
|
+
if (!(n instanceof HTMLElement))
|
|
489
|
+
return l;
|
|
490
|
+
let a = !1;
|
|
491
|
+
for (let u of n.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))
|
|
492
|
+
u.remove(), a = !0;
|
|
493
|
+
let o = a ? (r = n.innerText) != null ? r : "" : l;
|
|
494
|
+
return le.test(o) && (o = o.replace(le, "")), o;
|
|
495
|
+
}
|
|
496
|
+
function ct(e) {
|
|
497
|
+
let t = e.getAttribute("aria-label");
|
|
498
|
+
if (typeof t == "string")
|
|
499
|
+
return t.trim();
|
|
500
|
+
let r = e.getAttribute("aria-labelledby");
|
|
501
|
+
if (r) {
|
|
502
|
+
let l = r.split(" ").map((n) => {
|
|
503
|
+
let a = document.getElementById(n);
|
|
504
|
+
if (a) {
|
|
505
|
+
let o = a.getAttribute("aria-label");
|
|
506
|
+
return typeof o == "string" ? o.trim() : oe(a).trim();
|
|
507
|
+
}
|
|
508
|
+
return null;
|
|
509
|
+
}).filter(Boolean);
|
|
510
|
+
if (l.length > 0)
|
|
511
|
+
return l.join(", ");
|
|
512
|
+
}
|
|
513
|
+
return oe(e).trim();
|
|
514
|
+
}
|
|
515
|
+
function dt(e) {
|
|
516
|
+
let t = w(""), r = w("");
|
|
517
|
+
return () => {
|
|
518
|
+
let l = h(e);
|
|
519
|
+
if (!l)
|
|
520
|
+
return "";
|
|
521
|
+
let n = l.innerText;
|
|
522
|
+
if (t.value === n)
|
|
523
|
+
return r.value;
|
|
524
|
+
let a = ct(l).trim().toLowerCase();
|
|
525
|
+
return t.value = n, r.value = a, a;
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
var ft = ((e) => (e[e.Open = 0] = "Open", e[e.Closed = 1] = "Closed", e))(ft || {}), vt = ((e) => (e[e.Pointer = 0] = "Pointer", e[e.Other = 1] = "Other", e))(vt || {});
|
|
529
|
+
function mt(e) {
|
|
530
|
+
requestAnimationFrame(() => requestAnimationFrame(e));
|
|
531
|
+
}
|
|
532
|
+
let be = Symbol("MenuContext");
|
|
533
|
+
function H(e) {
|
|
534
|
+
let t = se(be, null);
|
|
535
|
+
if (t === null) {
|
|
536
|
+
let r = new Error(`<${e} /> is missing a parent <Menu /> component.`);
|
|
537
|
+
throw Error.captureStackTrace && Error.captureStackTrace(r, H), r;
|
|
538
|
+
}
|
|
539
|
+
return t;
|
|
540
|
+
}
|
|
541
|
+
let gt = B({ name: "Menu", props: { as: { type: [Object, String], default: "template" } }, setup(e, { slots: t, attrs: r }) {
|
|
542
|
+
let l = w(1), n = w(null), a = w(null), o = w([]), u = w(""), d = w(null), c = w(1);
|
|
543
|
+
function i(v = (m) => m) {
|
|
544
|
+
let m = d.value !== null ? o.value[d.value] : null, f = he(v(o.value.slice()), (y) => h(y.dataRef.domRef)), s = m ? f.indexOf(m) : null;
|
|
545
|
+
return s === -1 && (s = null), { items: f, activeItemIndex: s };
|
|
546
|
+
}
|
|
547
|
+
let p = { menuState: l, buttonRef: n, itemsRef: a, items: o, searchQuery: u, activeItemIndex: d, activationTrigger: c, closeMenu: () => {
|
|
548
|
+
l.value = 1, d.value = null;
|
|
549
|
+
}, openMenu: () => l.value = 0, goToItem(v, m, f) {
|
|
550
|
+
let s = i(), y = We(v === I.Specific ? { focus: I.Specific, id: m } : { focus: v }, { resolveItems: () => s.items, resolveActiveIndex: () => s.activeItemIndex, resolveId: (F) => F.id, resolveDisabled: (F) => F.dataRef.disabled });
|
|
551
|
+
u.value = "", d.value = y, c.value = f ?? 1, o.value = s.items;
|
|
552
|
+
}, search(v) {
|
|
553
|
+
let m = u.value !== "" ? 0 : 1;
|
|
554
|
+
u.value += v.toLowerCase();
|
|
555
|
+
let f = (d.value !== null ? o.value.slice(d.value + m).concat(o.value.slice(0, d.value + m)) : o.value).find((y) => y.dataRef.textValue.startsWith(u.value) && !y.dataRef.disabled), s = f ? o.value.indexOf(f) : -1;
|
|
556
|
+
s === -1 || s === d.value || (d.value = s, c.value = 1);
|
|
557
|
+
}, clearSearch() {
|
|
558
|
+
u.value = "";
|
|
559
|
+
}, registerItem(v, m) {
|
|
560
|
+
let f = i((s) => [...s, { id: v, dataRef: m }]);
|
|
561
|
+
o.value = f.items, d.value = f.activeItemIndex, c.value = 1;
|
|
562
|
+
}, unregisterItem(v) {
|
|
563
|
+
let m = i((f) => {
|
|
564
|
+
let s = f.findIndex((y) => y.id === v);
|
|
565
|
+
return s !== -1 && f.splice(s, 1), f;
|
|
566
|
+
});
|
|
567
|
+
o.value = m.items, d.value = m.activeItemIndex, c.value = 1;
|
|
568
|
+
} };
|
|
569
|
+
return ut([n, a], (v, m) => {
|
|
570
|
+
var f;
|
|
571
|
+
p.closeMenu(), Z(m, J.Loose) || (v.preventDefault(), (f = h(n)) == null || f.focus());
|
|
572
|
+
}, D(() => l.value === 0)), ce(be, p), Ge(D(() => z(l.value, { [0]: C.Open, [1]: C.Closed }))), () => {
|
|
573
|
+
let v = { open: l.value === 0, close: p.closeMenu };
|
|
574
|
+
return U({ ourProps: {}, theirProps: e, slot: v, slots: t, attrs: r, name: "Menu" });
|
|
575
|
+
};
|
|
576
|
+
} }), pt = B({ name: "MenuButton", props: { disabled: { type: Boolean, default: !1 }, as: { type: [Object, String], default: "button" }, id: { type: String, default: () => `headlessui-menu-button-${X()}` } }, setup(e, { attrs: t, slots: r, expose: l }) {
|
|
577
|
+
let n = H("MenuButton");
|
|
578
|
+
l({ el: n.buttonRef, $el: n.buttonRef });
|
|
579
|
+
function a(c) {
|
|
580
|
+
switch (c.key) {
|
|
581
|
+
case x.Space:
|
|
582
|
+
case x.Enter:
|
|
583
|
+
case x.ArrowDown:
|
|
584
|
+
c.preventDefault(), c.stopPropagation(), n.openMenu(), A(() => {
|
|
585
|
+
var i;
|
|
586
|
+
(i = h(n.itemsRef)) == null || i.focus({ preventScroll: !0 }), n.goToItem(I.First);
|
|
587
|
+
});
|
|
588
|
+
break;
|
|
589
|
+
case x.ArrowUp:
|
|
590
|
+
c.preventDefault(), c.stopPropagation(), n.openMenu(), A(() => {
|
|
591
|
+
var i;
|
|
592
|
+
(i = h(n.itemsRef)) == null || i.focus({ preventScroll: !0 }), n.goToItem(I.Last);
|
|
593
|
+
});
|
|
594
|
+
break;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
function o(c) {
|
|
598
|
+
switch (c.key) {
|
|
599
|
+
case x.Space:
|
|
600
|
+
c.preventDefault();
|
|
601
|
+
break;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
function u(c) {
|
|
605
|
+
e.disabled || (n.menuState.value === 0 ? (n.closeMenu(), A(() => {
|
|
606
|
+
var i;
|
|
607
|
+
return (i = h(n.buttonRef)) == null ? void 0 : i.focus({ preventScroll: !0 });
|
|
608
|
+
})) : (c.preventDefault(), n.openMenu(), mt(() => {
|
|
609
|
+
var i;
|
|
610
|
+
return (i = h(n.itemsRef)) == null ? void 0 : i.focus({ preventScroll: !0 });
|
|
611
|
+
})));
|
|
612
|
+
}
|
|
613
|
+
let d = Xe(D(() => ({ as: e.as, type: t.type })), n.buttonRef);
|
|
614
|
+
return () => {
|
|
615
|
+
var c;
|
|
616
|
+
let i = { open: n.menuState.value === 0 }, { id: p, ...v } = e, m = { ref: n.buttonRef, id: p, type: d.value, "aria-haspopup": "menu", "aria-controls": (c = h(n.itemsRef)) == null ? void 0 : c.id, "aria-expanded": e.disabled ? void 0 : n.menuState.value === 0, onKeydown: a, onKeyup: o, onClick: u };
|
|
617
|
+
return U({ ourProps: m, theirProps: v, slot: i, attrs: t, slots: r, name: "MenuButton" });
|
|
618
|
+
};
|
|
619
|
+
} }), ht = B({ name: "MenuItems", props: { as: { type: [Object, String], default: "div" }, static: { type: Boolean, default: !1 }, unmount: { type: Boolean, default: !0 }, id: { type: String, default: () => `headlessui-menu-items-${X()}` } }, setup(e, { attrs: t, slots: r, expose: l }) {
|
|
620
|
+
let n = H("MenuItems"), a = w(null);
|
|
621
|
+
l({ el: n.itemsRef, $el: n.itemsRef }), Ze({ container: D(() => h(n.itemsRef)), enabled: D(() => n.menuState.value === 0), accept(i) {
|
|
622
|
+
return i.getAttribute("role") === "menuitem" ? NodeFilter.FILTER_REJECT : i.hasAttribute("role") ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
|
|
623
|
+
}, walk(i) {
|
|
624
|
+
i.setAttribute("role", "none");
|
|
625
|
+
} });
|
|
626
|
+
function o(i) {
|
|
627
|
+
var p;
|
|
628
|
+
switch (a.value && clearTimeout(a.value), i.key) {
|
|
629
|
+
case x.Space:
|
|
630
|
+
if (n.searchQuery.value !== "")
|
|
631
|
+
return i.preventDefault(), i.stopPropagation(), n.search(i.key);
|
|
632
|
+
case x.Enter:
|
|
633
|
+
if (i.preventDefault(), i.stopPropagation(), n.activeItemIndex.value !== null) {
|
|
634
|
+
let v = n.items.value[n.activeItemIndex.value];
|
|
635
|
+
(p = h(v.dataRef.domRef)) == null || p.click();
|
|
636
|
+
}
|
|
637
|
+
n.closeMenu(), pe(h(n.buttonRef));
|
|
638
|
+
break;
|
|
639
|
+
case x.ArrowDown:
|
|
640
|
+
return i.preventDefault(), i.stopPropagation(), n.goToItem(I.Next);
|
|
641
|
+
case x.ArrowUp:
|
|
642
|
+
return i.preventDefault(), i.stopPropagation(), n.goToItem(I.Previous);
|
|
643
|
+
case x.Home:
|
|
644
|
+
case x.PageUp:
|
|
645
|
+
return i.preventDefault(), i.stopPropagation(), n.goToItem(I.First);
|
|
646
|
+
case x.End:
|
|
647
|
+
case x.PageDown:
|
|
648
|
+
return i.preventDefault(), i.stopPropagation(), n.goToItem(I.Last);
|
|
649
|
+
case x.Escape:
|
|
650
|
+
i.preventDefault(), i.stopPropagation(), n.closeMenu(), A(() => {
|
|
651
|
+
var v;
|
|
652
|
+
return (v = h(n.buttonRef)) == null ? void 0 : v.focus({ preventScroll: !0 });
|
|
653
|
+
});
|
|
654
|
+
break;
|
|
655
|
+
case x.Tab:
|
|
656
|
+
i.preventDefault(), i.stopPropagation(), n.closeMenu(), A(() => ot(h(n.buttonRef), i.shiftKey ? q.Previous : q.Next));
|
|
657
|
+
break;
|
|
658
|
+
default:
|
|
659
|
+
i.key.length === 1 && (n.search(i.key), a.value = setTimeout(() => n.clearSearch(), 350));
|
|
660
|
+
break;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
function u(i) {
|
|
664
|
+
switch (i.key) {
|
|
665
|
+
case x.Space:
|
|
666
|
+
i.preventDefault();
|
|
667
|
+
break;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
let d = qe(), c = D(() => d !== null ? (d.value & C.Open) === C.Open : n.menuState.value === 0);
|
|
671
|
+
return () => {
|
|
672
|
+
var i, p;
|
|
673
|
+
let v = { open: n.menuState.value === 0 }, { id: m, ...f } = e, s = { "aria-activedescendant": n.activeItemIndex.value === null || (i = n.items.value[n.activeItemIndex.value]) == null ? void 0 : i.id, "aria-labelledby": (p = h(n.buttonRef)) == null ? void 0 : p.id, id: m, onKeydown: o, onKeyup: u, role: "menu", tabIndex: 0, ref: n.itemsRef };
|
|
674
|
+
return U({ ourProps: s, theirProps: f, slot: v, attrs: t, slots: r, features: K.RenderStrategy | K.Static, visible: c.value, name: "MenuItems" });
|
|
675
|
+
};
|
|
676
|
+
} }), bt = B({ name: "MenuItem", inheritAttrs: !1, props: { as: { type: [Object, String], default: "template" }, disabled: { type: Boolean, default: !1 }, id: { type: String, default: () => `headlessui-menu-item-${X()}` } }, setup(e, { slots: t, attrs: r, expose: l }) {
|
|
677
|
+
let n = H("MenuItem"), a = w(null);
|
|
678
|
+
l({ el: a, $el: a });
|
|
679
|
+
let o = D(() => n.activeItemIndex.value !== null ? n.items.value[n.activeItemIndex.value].id === e.id : !1), u = dt(a), d = D(() => ({ disabled: e.disabled, get textValue() {
|
|
680
|
+
return u();
|
|
681
|
+
}, domRef: a }));
|
|
682
|
+
de(() => n.registerItem(e.id, d)), Ie(() => n.unregisterItem(e.id)), R(() => {
|
|
683
|
+
n.menuState.value === 0 && o.value && n.activationTrigger.value !== 0 && A(() => {
|
|
684
|
+
var s, y;
|
|
685
|
+
return (y = (s = h(a)) == null ? void 0 : s.scrollIntoView) == null ? void 0 : y.call(s, { block: "nearest" });
|
|
686
|
+
});
|
|
687
|
+
});
|
|
688
|
+
function c(s) {
|
|
689
|
+
if (e.disabled)
|
|
690
|
+
return s.preventDefault();
|
|
691
|
+
n.closeMenu(), pe(h(n.buttonRef));
|
|
692
|
+
}
|
|
693
|
+
function i() {
|
|
694
|
+
if (e.disabled)
|
|
695
|
+
return n.goToItem(I.Nothing);
|
|
696
|
+
n.goToItem(I.Specific, e.id);
|
|
697
|
+
}
|
|
698
|
+
let p = st();
|
|
699
|
+
function v(s) {
|
|
700
|
+
p.update(s);
|
|
701
|
+
}
|
|
702
|
+
function m(s) {
|
|
703
|
+
p.wasMoved(s) && (e.disabled || o.value || n.goToItem(I.Specific, e.id, 0));
|
|
704
|
+
}
|
|
705
|
+
function f(s) {
|
|
706
|
+
p.wasMoved(s) && (e.disabled || o.value && n.goToItem(I.Nothing));
|
|
707
|
+
}
|
|
708
|
+
return () => {
|
|
709
|
+
let { disabled: s } = e, y = { active: o.value, disabled: s, close: n.closeMenu }, { id: F, ...xe } = e;
|
|
710
|
+
return U({ ourProps: { id: F, ref: a, role: "menuitem", tabIndex: s === !0 ? void 0 : -1, "aria-disabled": s === !0 ? !0 : void 0, disabled: void 0, onClick: c, onFocus: i, onPointerenter: v, onMouseenter: v, onPointermove: m, onMousemove: m, onPointerleave: f, onMouseleave: f }, theirProps: { ...r, ...xe }, slot: y, attrs: r, slots: t, name: "MenuItem" });
|
|
711
|
+
};
|
|
712
|
+
} });
|
|
713
|
+
function yt(e, t) {
|
|
714
|
+
return b(), S("svg", {
|
|
715
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
716
|
+
fill: "none",
|
|
717
|
+
viewBox: "0 0 24 24",
|
|
718
|
+
"stroke-width": "1.5",
|
|
719
|
+
stroke: "currentColor",
|
|
720
|
+
"aria-hidden": "true"
|
|
721
|
+
}, [
|
|
722
|
+
g("path", {
|
|
723
|
+
"stroke-linecap": "round",
|
|
724
|
+
"stroke-linejoin": "round",
|
|
725
|
+
d: "M7.5 7.5h-.75A2.25 2.25 0 004.5 9.75v7.5a2.25 2.25 0 002.25 2.25h7.5a2.25 2.25 0 002.25-2.25v-7.5a2.25 2.25 0 00-2.25-2.25h-.75m0-3l-3-3m0 0l-3 3m3-3v11.25m6-2.25h.75a2.25 2.25 0 012.25 2.25v7.5a2.25 2.25 0 01-2.25 2.25h-7.5a2.25 2.25 0 01-2.25-2.25v-.75"
|
|
726
|
+
})
|
|
727
|
+
]);
|
|
728
|
+
}
|
|
729
|
+
function xt(e, t) {
|
|
730
|
+
return b(), S("svg", {
|
|
731
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
732
|
+
fill: "none",
|
|
733
|
+
viewBox: "0 0 24 24",
|
|
734
|
+
"stroke-width": "1.5",
|
|
735
|
+
stroke: "currentColor",
|
|
736
|
+
"aria-hidden": "true"
|
|
737
|
+
}, [
|
|
738
|
+
g("path", {
|
|
739
|
+
"stroke-linecap": "round",
|
|
740
|
+
"stroke-linejoin": "round",
|
|
741
|
+
d: "M4.5 12.75l6 6 9-13.5"
|
|
742
|
+
})
|
|
743
|
+
]);
|
|
744
|
+
}
|
|
745
|
+
function wt(e, t) {
|
|
746
|
+
return b(), S("svg", {
|
|
747
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
748
|
+
fill: "none",
|
|
749
|
+
viewBox: "0 0 24 24",
|
|
750
|
+
"stroke-width": "1.5",
|
|
751
|
+
stroke: "currentColor",
|
|
752
|
+
"aria-hidden": "true"
|
|
753
|
+
}, [
|
|
754
|
+
g("path", {
|
|
755
|
+
"stroke-linecap": "round",
|
|
756
|
+
"stroke-linejoin": "round",
|
|
757
|
+
d: "M19.5 8.25l-7.5 7.5-7.5-7.5"
|
|
758
|
+
})
|
|
759
|
+
]);
|
|
760
|
+
}
|
|
761
|
+
function St(e, t) {
|
|
762
|
+
return b(), S("svg", {
|
|
763
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
764
|
+
fill: "none",
|
|
765
|
+
viewBox: "0 0 24 24",
|
|
766
|
+
"stroke-width": "1.5",
|
|
767
|
+
stroke: "currentColor",
|
|
768
|
+
"aria-hidden": "true"
|
|
769
|
+
}, [
|
|
770
|
+
g("path", {
|
|
771
|
+
"stroke-linecap": "round",
|
|
772
|
+
"stroke-linejoin": "round",
|
|
773
|
+
d: "M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"
|
|
774
|
+
})
|
|
775
|
+
]);
|
|
776
|
+
}
|
|
777
|
+
function kt(e, t) {
|
|
778
|
+
return b(), S("svg", {
|
|
779
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
780
|
+
fill: "none",
|
|
781
|
+
viewBox: "0 0 24 24",
|
|
782
|
+
"stroke-width": "1.5",
|
|
783
|
+
stroke: "currentColor",
|
|
784
|
+
"aria-hidden": "true"
|
|
785
|
+
}, [
|
|
786
|
+
g("path", {
|
|
787
|
+
"stroke-linecap": "round",
|
|
788
|
+
"stroke-linejoin": "round",
|
|
789
|
+
d: "M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"
|
|
790
|
+
})
|
|
791
|
+
]);
|
|
792
|
+
}
|
|
793
|
+
function ye(e, t) {
|
|
794
|
+
return b(), S("svg", {
|
|
795
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
796
|
+
fill: "none",
|
|
797
|
+
viewBox: "0 0 24 24",
|
|
798
|
+
"stroke-width": "1.5",
|
|
799
|
+
stroke: "currentColor",
|
|
800
|
+
"aria-hidden": "true"
|
|
801
|
+
}, [
|
|
802
|
+
g("path", {
|
|
803
|
+
"stroke-linecap": "round",
|
|
804
|
+
"stroke-linejoin": "round",
|
|
805
|
+
d: "M9.75 9.75l4.5 4.5m0-4.5l-4.5 4.5M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
806
|
+
})
|
|
807
|
+
]);
|
|
808
|
+
}
|
|
809
|
+
const It = { class: "py-1" }, Et = ["onClick"], $t = {
|
|
810
|
+
name: "uiDropdown"
|
|
811
|
+
}, Dt = /* @__PURE__ */ Object.assign($t, {
|
|
812
|
+
props: {
|
|
813
|
+
/**
|
|
814
|
+
* Array de elementos que componen el dropdown
|
|
815
|
+
*/
|
|
816
|
+
items: {
|
|
817
|
+
type: Array,
|
|
818
|
+
required: !0
|
|
819
|
+
},
|
|
820
|
+
/**
|
|
821
|
+
* La posición del menú emergente
|
|
822
|
+
*/
|
|
823
|
+
position: {
|
|
824
|
+
type: String,
|
|
825
|
+
default: "left"
|
|
826
|
+
},
|
|
827
|
+
/**
|
|
828
|
+
* Dropdown desactivado
|
|
829
|
+
*/
|
|
830
|
+
disabled: Boolean,
|
|
831
|
+
/**
|
|
832
|
+
* label del Dropdown
|
|
833
|
+
*/
|
|
834
|
+
label: {
|
|
835
|
+
type: String,
|
|
836
|
+
required: !0
|
|
837
|
+
}
|
|
838
|
+
},
|
|
839
|
+
emits: ["optionSelected"],
|
|
840
|
+
setup(e, { emit: t }) {
|
|
841
|
+
const r = e, l = D(() => {
|
|
842
|
+
let a = r.items.find((o) => o.active === !0);
|
|
843
|
+
return a ? a.name : r.label;
|
|
844
|
+
}), n = (a) => {
|
|
845
|
+
r.disabled || t("optionSelected", a.value);
|
|
846
|
+
};
|
|
847
|
+
return (a, o) => (b(), L($(gt), {
|
|
848
|
+
as: "div",
|
|
849
|
+
class: O(["relative inline-block text-left", { "opacity-25": e.disabled }])
|
|
850
|
+
}, {
|
|
851
|
+
default: N(() => [
|
|
852
|
+
g("div", null, [
|
|
853
|
+
E($(pt), { class: "inline-flex justify-center w-full rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-100 focus:ring-indigo-500" }, {
|
|
854
|
+
default: N(() => [
|
|
855
|
+
G(k(l.value) + " ", 1),
|
|
856
|
+
E($(wt), {
|
|
857
|
+
"aria-hidden": "true",
|
|
858
|
+
class: "-mr-1 ml-2 h-5 w-5"
|
|
859
|
+
})
|
|
860
|
+
]),
|
|
861
|
+
_: 1
|
|
862
|
+
})
|
|
863
|
+
]),
|
|
864
|
+
E(Ee, {
|
|
865
|
+
"enter-active-class": "transition ease-out duration-100",
|
|
866
|
+
"enter-from-class": "transform opacity-0 scale-95",
|
|
867
|
+
"enter-to-class": "transform opacity-100 scale-100",
|
|
868
|
+
"leave-active-class": "transition ease-in duration-75",
|
|
869
|
+
"leave-from-class": "transform opacity-100 scale-100",
|
|
870
|
+
"leave-to-class": "transform opacity-0 scale-95"
|
|
871
|
+
}, {
|
|
872
|
+
default: N(() => [
|
|
873
|
+
e.disabled ? T("", !0) : (b(), L($(ht), {
|
|
874
|
+
key: 0,
|
|
875
|
+
class: O([{ "right-0": e.position === "right", "left-0": e.position === "left" }, "origin-top-right absolute mt-2 w-56 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none z-10"])
|
|
876
|
+
}, {
|
|
877
|
+
default: N(() => [
|
|
878
|
+
g("div", It, [
|
|
879
|
+
(b(!0), S(ue, null, $e(e.items, (u, d) => (b(), L($(bt), { key: d }, {
|
|
880
|
+
default: N(() => [
|
|
881
|
+
g("a", {
|
|
882
|
+
onClick: (c) => n(u),
|
|
883
|
+
class: O([
|
|
884
|
+
u.active ? "bg-gray-100 text-gray-900" : "text-gray-700",
|
|
885
|
+
"block px-4 py-2 text-sm cursor-pointer"
|
|
886
|
+
])
|
|
887
|
+
}, k(u.name), 11, Et)
|
|
888
|
+
]),
|
|
889
|
+
_: 2
|
|
890
|
+
}, 1024))), 128))
|
|
891
|
+
])
|
|
892
|
+
]),
|
|
893
|
+
_: 1
|
|
894
|
+
}, 8, ["class"]))
|
|
895
|
+
]),
|
|
896
|
+
_: 1
|
|
897
|
+
})
|
|
898
|
+
]),
|
|
899
|
+
_: 1
|
|
900
|
+
}, 8, ["class"]));
|
|
901
|
+
}
|
|
902
|
+
}), Mt = { class: "flex justify-between" }, Ot = {
|
|
903
|
+
key: 0,
|
|
904
|
+
class: "block text-sm font-medium text-gray-700"
|
|
905
|
+
}, Ft = {
|
|
906
|
+
key: 1,
|
|
907
|
+
class: "text-[10px] text-gray-500 uppercase justify-self-end"
|
|
908
|
+
}, Pt = {
|
|
909
|
+
key: 0,
|
|
910
|
+
class: "inline-flex items-center px-3 rounded-l-md border border-r-0 border-gray-300 bg-gray-50 text-gray-500 sm:text-sm"
|
|
911
|
+
}, Tt = ["disabled", "name", "placeholder", "type"], At = {
|
|
912
|
+
key: 1,
|
|
913
|
+
class: "absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none"
|
|
914
|
+
}, jt = {
|
|
915
|
+
name: "uiInput"
|
|
916
|
+
}, Nt = /* @__PURE__ */ Object.assign(jt, {
|
|
917
|
+
props: {
|
|
918
|
+
/**
|
|
919
|
+
* Texto sobre el campo
|
|
920
|
+
*/
|
|
921
|
+
label: String,
|
|
922
|
+
/**
|
|
923
|
+
* Tipo de input
|
|
924
|
+
*/
|
|
925
|
+
type: {
|
|
926
|
+
type: String,
|
|
927
|
+
default: "text"
|
|
928
|
+
},
|
|
929
|
+
/**
|
|
930
|
+
* Nombre interno del campo
|
|
931
|
+
*/
|
|
932
|
+
name: String,
|
|
933
|
+
/**
|
|
934
|
+
* Placeholder cuando el campo está vacio
|
|
935
|
+
*/
|
|
936
|
+
placeholder: {
|
|
937
|
+
type: String,
|
|
938
|
+
default: "..."
|
|
939
|
+
},
|
|
940
|
+
/**
|
|
941
|
+
* Icono del campo
|
|
942
|
+
*/
|
|
943
|
+
icon: {
|
|
944
|
+
type: Function,
|
|
945
|
+
default: () => {
|
|
946
|
+
}
|
|
947
|
+
},
|
|
948
|
+
/**
|
|
949
|
+
* Campo desactivado
|
|
950
|
+
*/
|
|
951
|
+
disabled: Boolean,
|
|
952
|
+
/**
|
|
953
|
+
* Color del campo
|
|
954
|
+
*/
|
|
955
|
+
color: {
|
|
956
|
+
type: String,
|
|
957
|
+
default: "gray"
|
|
958
|
+
},
|
|
959
|
+
/**
|
|
960
|
+
* Valor del campo
|
|
961
|
+
*/
|
|
962
|
+
value: {
|
|
963
|
+
type: String,
|
|
964
|
+
default: ""
|
|
965
|
+
},
|
|
966
|
+
/**
|
|
967
|
+
* Define el texto de error en el campo
|
|
968
|
+
*/
|
|
969
|
+
error: String,
|
|
970
|
+
/**
|
|
971
|
+
* El texto aparece en el lado derecho del campo, marcándolo como opcional
|
|
972
|
+
*/
|
|
973
|
+
optional: String,
|
|
974
|
+
/**
|
|
975
|
+
* Texto y activación del Addon del campo
|
|
976
|
+
*/
|
|
977
|
+
addOn: String
|
|
978
|
+
},
|
|
979
|
+
emits: ["inputChanged"],
|
|
980
|
+
setup(e, { emit: t }) {
|
|
981
|
+
const r = e, l = (a) => {
|
|
982
|
+
t("inputChanged", { value: a.target.value, name: a.target.name });
|
|
983
|
+
}, n = w(r.value);
|
|
984
|
+
return (a, o) => (b(), S("div", null, [
|
|
985
|
+
g("div", Mt, [
|
|
986
|
+
e.label ? (b(), S("label", Ot, k(e.label), 1)) : T("", !0),
|
|
987
|
+
e.optional ? (b(), S("span", Ft, k(e.optional), 1)) : T("", !0)
|
|
988
|
+
]),
|
|
989
|
+
g("div", {
|
|
990
|
+
class: O([{ "mt-1": e.label }, "relative flex"])
|
|
991
|
+
}, [
|
|
992
|
+
e.addOn ? (b(), S("span", Pt, k(e.addOn), 1)) : T("", !0),
|
|
993
|
+
P(g("input", {
|
|
994
|
+
"onUpdate:modelValue": o[0] || (o[0] = (u) => n.value = u),
|
|
995
|
+
class: O([{
|
|
996
|
+
"border-gray-300": e.color !== "danger" || e.color !== "warning" || e.color !== "success",
|
|
997
|
+
"border-red-300": e.color === "danger",
|
|
998
|
+
"border-yellow-400": e.color === "warning",
|
|
999
|
+
"border-green-400": e.color === "success",
|
|
1000
|
+
"bg-gray-100": e.disabled,
|
|
1001
|
+
"text-black": e.color !== "danger" || e.color !== "warning" || e.color !== "success",
|
|
1002
|
+
"text-red-300": e.color === "danger",
|
|
1003
|
+
"text-yellow-400": e.color === "warning",
|
|
1004
|
+
"text-green-400": e.color === "success",
|
|
1005
|
+
"rounded-md": !e.addOn,
|
|
1006
|
+
"rounded-r-md": e.addOn
|
|
1007
|
+
}, "shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 placeholder-gray-300"]),
|
|
1008
|
+
disabled: e.disabled,
|
|
1009
|
+
name: e.name,
|
|
1010
|
+
placeholder: e.placeholder,
|
|
1011
|
+
type: e.type,
|
|
1012
|
+
onInput: l
|
|
1013
|
+
}, null, 42, Tt), [
|
|
1014
|
+
[De, n.value]
|
|
1015
|
+
]),
|
|
1016
|
+
e.icon ? (b(), S("div", At, [
|
|
1017
|
+
E(M, {
|
|
1018
|
+
icon: e.icon,
|
|
1019
|
+
color: e.color
|
|
1020
|
+
}, null, 8, ["icon", "color"]),
|
|
1021
|
+
P(E(M, {
|
|
1022
|
+
icon: $(xt),
|
|
1023
|
+
color: "green"
|
|
1024
|
+
}, null, 8, ["icon"]), [
|
|
1025
|
+
[j, e.color === "success"]
|
|
1026
|
+
]),
|
|
1027
|
+
P(E(M, {
|
|
1028
|
+
icon: $(kt),
|
|
1029
|
+
color: "yellow"
|
|
1030
|
+
}, null, 8, ["icon"]), [
|
|
1031
|
+
[j, e.color === "warning"]
|
|
1032
|
+
]),
|
|
1033
|
+
P(E(M, {
|
|
1034
|
+
icon: $(St),
|
|
1035
|
+
color: "red"
|
|
1036
|
+
}, null, 8, ["icon"]), [
|
|
1037
|
+
[j, e.color === "danger"]
|
|
1038
|
+
])
|
|
1039
|
+
])) : T("", !0)
|
|
1040
|
+
], 2),
|
|
1041
|
+
P(g("p", {
|
|
1042
|
+
class: O([{
|
|
1043
|
+
"text-gray-300": e.color !== "danger" || e.color !== "warning" || e.color !== "success",
|
|
1044
|
+
"text-red-300": e.color === "danger",
|
|
1045
|
+
"text-yellow-400": e.color === "warning",
|
|
1046
|
+
"text-green-400": e.color === "success"
|
|
1047
|
+
}, "mt-2 text-xs flex flex-row items-center"])
|
|
1048
|
+
}, [
|
|
1049
|
+
E(M, {
|
|
1050
|
+
icon: $(ye),
|
|
1051
|
+
color: "red",
|
|
1052
|
+
class: "mr-2"
|
|
1053
|
+
}, null, 8, ["icon"]),
|
|
1054
|
+
G(k(e.error), 1)
|
|
1055
|
+
], 2), [
|
|
1056
|
+
[j, e.error]
|
|
1057
|
+
])
|
|
1058
|
+
]));
|
|
1059
|
+
}
|
|
1060
|
+
}), Ct = { class: "flex justify-between" }, Rt = {
|
|
1061
|
+
key: 0,
|
|
1062
|
+
class: "block text-sm font-medium text-gray-700"
|
|
1063
|
+
}, Lt = {
|
|
1064
|
+
key: 1,
|
|
1065
|
+
class: "text-[10px] text-gray-500 uppercase"
|
|
1066
|
+
}, Bt = ["onDrop"], zt = { class: "space-y-1 flex flex-col items-center justify-center" }, Ut = { class: "flex text-sm text-gray-600 flex flex-col sm:flex-row text-center" }, Ht = {
|
|
1067
|
+
for: "file-upload",
|
|
1068
|
+
class: "relative cursor-pointer rounded-md font-medium text-indigo-600 focus-within:outline-none focus-within:ring-2 focus-within:ring-indigo-500 focus-within:ring-offset-2 hover:text-indigo-500"
|
|
1069
|
+
}, Vt = ["accept"], Kt = { class: "pl-1" }, Wt = { class: "text-xs text-gray-500 pb-4" }, qt = { class: "mt-2 text-xs flex flex-row items-center text-red-300" }, Gt = {
|
|
1070
|
+
name: "uiInputFile"
|
|
1071
|
+
}, Xt = /* @__PURE__ */ Object.assign(Gt, {
|
|
1072
|
+
props: {
|
|
1073
|
+
name: String,
|
|
1074
|
+
label: String,
|
|
1075
|
+
optional: String,
|
|
1076
|
+
placeholder: String,
|
|
1077
|
+
dragAndDrop: String,
|
|
1078
|
+
fileTypesAndSizes: String,
|
|
1079
|
+
error: String,
|
|
1080
|
+
accept: String,
|
|
1081
|
+
icon: {
|
|
1082
|
+
type: Function,
|
|
1083
|
+
default: yt
|
|
1084
|
+
}
|
|
1085
|
+
},
|
|
1086
|
+
emits: ["filesUploaded"],
|
|
1087
|
+
setup(e, { emit: t }) {
|
|
1088
|
+
const r = e, l = w(""), n = (o) => {
|
|
1089
|
+
let d = o.dataTransfer.files;
|
|
1090
|
+
t("filesUploaded", d), r.filename = d[0].name;
|
|
1091
|
+
}, a = (o) => {
|
|
1092
|
+
t("filesUploaded", o.target.files), r.filename = o.target.files[0].name;
|
|
1093
|
+
};
|
|
1094
|
+
return (o, u) => (b(), S("div", null, [
|
|
1095
|
+
g("div", Ct, [
|
|
1096
|
+
e.label ? (b(), S("label", Rt, k(e.label), 1)) : T("", !0),
|
|
1097
|
+
e.optional ? (b(), S("span", Lt, k(e.optional), 1)) : T("", !0)
|
|
1098
|
+
]),
|
|
1099
|
+
g("div", {
|
|
1100
|
+
class: O([
|
|
1101
|
+
[
|
|
1102
|
+
{ "mt-1": e.label },
|
|
1103
|
+
{ "border-gray-300 hover:border-gray-400": !e.error },
|
|
1104
|
+
{ "border-red-300 hover:border-red-400": e.error }
|
|
1105
|
+
],
|
|
1106
|
+
"dropArea flex justify-center rounded-md border-2 border-dashed px-6 pt-5 pb-6"
|
|
1107
|
+
]),
|
|
1108
|
+
onDragover: u[0] || (u[0] = _(() => {
|
|
1109
|
+
}, ["prevent"])),
|
|
1110
|
+
onDrop: _(n, ["prevent"])
|
|
1111
|
+
}, [
|
|
1112
|
+
g("div", zt, [
|
|
1113
|
+
E(M, {
|
|
1114
|
+
icon: e.icon,
|
|
1115
|
+
size: "massive",
|
|
1116
|
+
color: "gray",
|
|
1117
|
+
"aria-hidden": "true",
|
|
1118
|
+
class: "mb-4"
|
|
1119
|
+
}, null, 8, ["icon"]),
|
|
1120
|
+
g("div", Ut, [
|
|
1121
|
+
g("label", Ht, [
|
|
1122
|
+
g("span", null, k(e.placeholder), 1),
|
|
1123
|
+
g("input", {
|
|
1124
|
+
id: "file-upload",
|
|
1125
|
+
name: "file-upload",
|
|
1126
|
+
type: "file",
|
|
1127
|
+
class: "sr-only",
|
|
1128
|
+
accept: e.accept,
|
|
1129
|
+
onChange: a
|
|
1130
|
+
}, null, 40, Vt)
|
|
1131
|
+
]),
|
|
1132
|
+
g("p", Kt, k(e.dragAndDrop), 1)
|
|
1133
|
+
]),
|
|
1134
|
+
g("p", Wt, k(e.fileTypesAndSizes), 1),
|
|
1135
|
+
P(g("p", { class: "font-bold text-xs uppercase block p-2 bg-gray-200 rounded" }, k(l.value), 513), [
|
|
1136
|
+
[j, l.value !== ""]
|
|
1137
|
+
])
|
|
1138
|
+
])
|
|
1139
|
+
], 42, Bt),
|
|
1140
|
+
P(g("p", qt, [
|
|
1141
|
+
E(M, {
|
|
1142
|
+
icon: $(ye),
|
|
1143
|
+
color: "red",
|
|
1144
|
+
class: "mr-2"
|
|
1145
|
+
}, null, 8, ["icon"]),
|
|
1146
|
+
G(k(e.error), 1)
|
|
1147
|
+
], 512), [
|
|
1148
|
+
[j, e.error]
|
|
1149
|
+
])
|
|
1150
|
+
]));
|
|
1151
|
+
}
|
|
1152
|
+
}), Yt = {
|
|
1153
|
+
uiButton: Pe,
|
|
1154
|
+
uiIcon: M,
|
|
1155
|
+
uiCheckbox: Le,
|
|
1156
|
+
uiDropdown: Dt,
|
|
1157
|
+
uiInput: Nt,
|
|
1158
|
+
uiInputFile: Xt
|
|
1159
|
+
}, ae = Yt, Jt = {
|
|
3
1160
|
install(e) {
|
|
4
|
-
Object.keys(
|
|
5
|
-
e.component(
|
|
1161
|
+
Object.keys(ae).forEach((t) => {
|
|
1162
|
+
e.component(t, ae[t]);
|
|
6
1163
|
});
|
|
7
1164
|
}
|
|
8
1165
|
};
|
|
9
1166
|
export {
|
|
10
|
-
|
|
1167
|
+
Jt as default
|
|
11
1168
|
};
|