@hotelinking/ui 1.2.5 → 1.5.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.
Files changed (63) hide show
  1. package/README.md +7 -5
  2. package/dist/index.css +287 -2
  3. package/dist/ui.cjs10.js +1 -0
  4. package/dist/ui.cjs11.js +1 -0
  5. package/dist/ui.cjs12.js +1 -0
  6. package/dist/ui.cjs13.js +1 -0
  7. package/dist/ui.cjs14.js +4 -0
  8. package/dist/ui.cjs15.js +1 -0
  9. package/dist/ui.cjs16.js +1 -0
  10. package/dist/ui.cjs17.js +1 -0
  11. package/dist/ui.cjs18.js +1 -0
  12. package/dist/ui.cjs19.js +1 -0
  13. package/dist/ui.cjs2.js +1 -1
  14. package/dist/ui.cjs20.js +1 -0
  15. package/dist/ui.cjs21.js +1 -0
  16. package/dist/ui.cjs22.js +1 -0
  17. package/dist/ui.cjs23.js +1 -0
  18. package/dist/ui.cjs24.js +1 -0
  19. package/dist/ui.cjs25.js +1 -0
  20. package/dist/ui.cjs26.js +1 -0
  21. package/dist/ui.cjs27.js +1 -0
  22. package/dist/ui.cjs28.js +1 -0
  23. package/dist/ui.cjs29.js +1 -0
  24. package/dist/ui.cjs3.js +1 -1
  25. package/dist/ui.cjs30.js +1 -0
  26. package/dist/ui.cjs31.js +1 -0
  27. package/dist/ui.cjs4.js +1 -1
  28. package/dist/ui.cjs5.js +1 -0
  29. package/dist/ui.cjs6.js +1 -0
  30. package/dist/ui.cjs7.js +1 -0
  31. package/dist/ui.cjs8.js +1 -0
  32. package/dist/ui.cjs9.js +1 -0
  33. package/dist/ui.es10.js +20 -0
  34. package/dist/ui.es11.js +20 -0
  35. package/dist/ui.es12.js +20 -0
  36. package/dist/ui.es13.js +20 -0
  37. package/dist/ui.es14.js +84 -0
  38. package/dist/ui.es15.js +10 -0
  39. package/dist/ui.es16.js +4 -0
  40. package/dist/ui.es17.js +36 -0
  41. package/dist/ui.es18.js +7 -0
  42. package/dist/ui.es19.js +18 -0
  43. package/dist/ui.es2.js +9 -3
  44. package/dist/ui.es20.js +14 -0
  45. package/dist/ui.es21.js +11 -0
  46. package/dist/ui.es22.js +21 -0
  47. package/dist/ui.es23.js +104 -0
  48. package/dist/ui.es24.js +35 -0
  49. package/dist/ui.es25.js +16 -0
  50. package/dist/ui.es26.js +19 -0
  51. package/dist/ui.es27.js +17 -0
  52. package/dist/ui.es28.js +10 -0
  53. package/dist/ui.es29.js +10 -0
  54. package/dist/ui.es3.js +30 -8
  55. package/dist/ui.es30.js +28 -0
  56. package/dist/ui.es31.js +34 -0
  57. package/dist/ui.es4.js +26 -8
  58. package/dist/ui.es5.js +56 -0
  59. package/dist/ui.es6.js +100 -0
  60. package/dist/ui.es7.js +168 -0
  61. package/dist/ui.es8.js +205 -0
  62. package/dist/ui.es9.js +20 -0
  63. package/package.json +27 -4
@@ -0,0 +1,20 @@
1
+ import { openBlock as e, createElementBlock as r, createElementVNode as o } from "vue";
2
+ function a(t, n) {
3
+ return e(), r("svg", {
4
+ xmlns: "http://www.w3.org/2000/svg",
5
+ fill: "none",
6
+ viewBox: "0 0 24 24",
7
+ "stroke-width": "1.5",
8
+ stroke: "currentColor",
9
+ "aria-hidden": "true"
10
+ }, [
11
+ o("path", {
12
+ "stroke-linecap": "round",
13
+ "stroke-linejoin": "round",
14
+ 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"
15
+ })
16
+ ]);
17
+ }
18
+ export {
19
+ a as default
20
+ };
@@ -0,0 +1,84 @@
1
+ import { cloneVNode as v, h as w, Fragment as S } from "vue";
2
+ import { match as k } from "./ui.es21.js";
3
+ var H = ((e) => (e[e.None = 0] = "None", e[e.RenderStrategy = 1] = "RenderStrategy", e[e.Static = 2] = "Static", e))(H || {}), N = ((e) => (e[e.Unmount = 0] = "Unmount", e[e.Hidden = 1] = "Hidden", e))(N || {});
4
+ function E({ visible: e = !0, features: t = 0, ourProps: o, theirProps: n, ...r }) {
5
+ var i;
6
+ let s = j(n, o), u = Object.assign(r, { props: s });
7
+ if (e || t & 2 && s.static)
8
+ return y(u);
9
+ if (t & 1) {
10
+ let f = (i = s.unmount) == null || i ? 0 : 1;
11
+ return k(f, { [0]() {
12
+ return null;
13
+ }, [1]() {
14
+ return y({ ...r, props: { ...s, hidden: !0, style: { display: "none" } } });
15
+ } });
16
+ }
17
+ return y(u);
18
+ }
19
+ function y({ props: e, attrs: t, slots: o, slot: n, name: r }) {
20
+ var i, s;
21
+ let { as: u, ...f } = P(e, ["unmount", "static"]), l = (i = o.default) == null ? void 0 : i.call(o, n), g = {};
22
+ if (n) {
23
+ let c = !1, h = [];
24
+ for (let [d, p] of Object.entries(n))
25
+ typeof p == "boolean" && (c = !0), p === !0 && h.push(d);
26
+ c && (g["data-headlessui-state"] = h.join(" "));
27
+ }
28
+ if (u === "template") {
29
+ if (l = b(l ?? []), Object.keys(f).length > 0 || Object.keys(t).length > 0) {
30
+ let [c, ...h] = l ?? [];
31
+ if (!R(c) || h.length > 0)
32
+ throw new Error(['Passing props on "template"!', "", `The current component <${r} /> is rendering a "template".`, "However we need to passthrough the following props:", Object.keys(f).concat(Object.keys(t)).map((a) => a.trim()).filter((a, m, O) => O.indexOf(a) === m).sort((a, m) => a.localeCompare(m)).map((a) => ` - ${a}`).join(`
33
+ `), "", "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((a) => ` - ${a}`).join(`
34
+ `)].join(`
35
+ `));
36
+ let d = j((s = c.props) != null ? s : {}, f), p = v(c, d);
37
+ for (let a in d)
38
+ a.startsWith("on") && (p.props || (p.props = {}), p.props[a] = d[a]);
39
+ return p;
40
+ }
41
+ return Array.isArray(l) && l.length === 1 ? l[0] : l;
42
+ }
43
+ return w(u, Object.assign({}, f, g), { default: () => l });
44
+ }
45
+ function b(e) {
46
+ return e.flatMap((t) => t.type === S ? b(t.children) : [t]);
47
+ }
48
+ function j(...e) {
49
+ if (e.length === 0)
50
+ return {};
51
+ if (e.length === 1)
52
+ return e[0];
53
+ let t = {}, o = {};
54
+ for (let n of e)
55
+ for (let r in n)
56
+ r.startsWith("on") && typeof n[r] == "function" ? (o[r] != null || (o[r] = []), o[r].push(n[r])) : t[r] = n[r];
57
+ if (t.disabled || t["aria-disabled"])
58
+ return Object.assign(t, Object.fromEntries(Object.keys(o).map((n) => [n, void 0])));
59
+ for (let n in o)
60
+ Object.assign(t, { [n](r, ...i) {
61
+ let s = o[n];
62
+ for (let u of s) {
63
+ if (r instanceof Event && r.defaultPrevented)
64
+ return;
65
+ u(r, ...i);
66
+ }
67
+ } });
68
+ return t;
69
+ }
70
+ function P(e, t = []) {
71
+ let o = Object.assign({}, e);
72
+ for (let n of t)
73
+ n in o && delete o[n];
74
+ return o;
75
+ }
76
+ function R(e) {
77
+ return e == null ? !1 : typeof e.type == "string" || typeof e.type == "object" || typeof e.type == "function";
78
+ }
79
+ export {
80
+ H as Features,
81
+ N as RenderStrategy,
82
+ P as omit,
83
+ E as render
84
+ };
@@ -0,0 +1,10 @@
1
+ let n = 0;
2
+ function t() {
3
+ return ++n;
4
+ }
5
+ function e() {
6
+ return t();
7
+ }
8
+ export {
9
+ e as useId
10
+ };
@@ -0,0 +1,4 @@
1
+ var o = ((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))(o || {});
2
+ export {
3
+ o as Keys
4
+ };
@@ -0,0 +1,36 @@
1
+ function o(e) {
2
+ throw new Error("Unexpected object: " + e);
3
+ }
4
+ var u = ((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))(u || {});
5
+ function v(e, s) {
6
+ let r = s.resolveItems();
7
+ if (r.length <= 0)
8
+ return null;
9
+ let n = s.resolveActiveIndex(), i = n ?? -1, c = (() => {
10
+ switch (e.focus) {
11
+ case 0:
12
+ return r.findIndex((t) => !s.resolveDisabled(t));
13
+ case 1: {
14
+ let t = r.slice().reverse().findIndex((l, d, a) => i !== -1 && a.length - d - 1 >= i ? !1 : !s.resolveDisabled(l));
15
+ return t === -1 ? t : r.length - 1 - t;
16
+ }
17
+ case 2:
18
+ return r.findIndex((t, l) => l <= i ? !1 : !s.resolveDisabled(t));
19
+ case 3: {
20
+ let t = r.slice().reverse().findIndex((l) => !s.resolveDisabled(l));
21
+ return t === -1 ? t : r.length - 1 - t;
22
+ }
23
+ case 4:
24
+ return r.findIndex((t) => s.resolveId(t) === e.id);
25
+ case 5:
26
+ return null;
27
+ default:
28
+ o(e);
29
+ }
30
+ })();
31
+ return c === -1 ? n : c;
32
+ }
33
+ export {
34
+ u as Focus,
35
+ v as calculateActiveIndex
36
+ };
@@ -0,0 +1,7 @@
1
+ function e(l) {
2
+ var u;
3
+ return l == null || l.value == null ? null : (u = l.value.$el) != null ? u : l.value;
4
+ }
5
+ export {
6
+ e as dom
7
+ };
@@ -0,0 +1,18 @@
1
+ import { watchEffect as f } from "vue";
2
+ import { getOwnerDocument as u } from "./ui.es27.js";
3
+ function p({ container: e, accept: r, walk: o, enabled: t }) {
4
+ f(() => {
5
+ let a = e.value;
6
+ if (!a || t !== void 0 && !t.value)
7
+ return;
8
+ let c = u(e);
9
+ if (!c)
10
+ return;
11
+ let l = Object.assign((i) => r(i), { acceptNode: r }), n = c.createTreeWalker(a, NodeFilter.SHOW_ELEMENT, l, !1);
12
+ for (; n.nextNode(); )
13
+ o(n.currentNode);
14
+ });
15
+ }
16
+ export {
17
+ p as useTreeWalker
18
+ };
package/dist/ui.es2.js CHANGED
@@ -1,9 +1,15 @@
1
1
  import o from "./ui.es3.js";
2
2
  import i from "./ui.es4.js";
3
- const n = {
3
+ import m from "./ui.es5.js";
4
+ import r from "./ui.es6.js";
5
+ import f from "./ui.es7.js";
6
+ const u = {
4
7
  uiButton: o,
5
- uiIcon: i
8
+ uiIcon: i,
9
+ uiCheckbox: m,
10
+ uiDropdown: r,
11
+ uiInput: f
6
12
  };
7
13
  export {
8
- n as default
14
+ u as default
9
15
  };
@@ -0,0 +1,14 @@
1
+ import { inject as e, provide as l } from "vue";
2
+ let o = Symbol("Context");
3
+ var s = ((n) => (n[n.Open = 1] = "Open", n[n.Closed = 2] = "Closed", n[n.Closing = 4] = "Closing", n[n.Opening = 8] = "Opening", n))(s || {});
4
+ function i() {
5
+ return e(o, null);
6
+ }
7
+ function p(n) {
8
+ l(o, n);
9
+ }
10
+ export {
11
+ s as State,
12
+ i as useOpenClosed,
13
+ p as useOpenClosedProvider
14
+ };
@@ -0,0 +1,11 @@
1
+ function o(r, t, ...n) {
2
+ if (r in t) {
3
+ let e = t[r];
4
+ return typeof e == "function" ? e(...n) : e;
5
+ }
6
+ let a = new Error(`Tried to handle "${r}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map((e) => `"${e}"`).join(", ")}.`);
7
+ throw Error.captureStackTrace && Error.captureStackTrace(a, o), a;
8
+ }
9
+ export {
10
+ o as match
11
+ };
@@ -0,0 +1,21 @@
1
+ import { ref as a, onMounted as l, watchEffect as f } from "vue";
2
+ import { dom as o } from "./ui.es18.js";
3
+ function r(t, n) {
4
+ if (t)
5
+ return t;
6
+ let e = n ?? "button";
7
+ if (typeof e == "string" && e.toLowerCase() === "button")
8
+ return "button";
9
+ }
10
+ function v(t, n) {
11
+ let e = a(r(t.value.type, t.value.as));
12
+ return l(() => {
13
+ e.value = r(t.value.type, t.value.as);
14
+ }), f(() => {
15
+ var u;
16
+ e.value || o(n) && o(n) instanceof HTMLButtonElement && !((u = o(n)) != null && u.hasAttribute("type")) && (e.value = "button");
17
+ }), e;
18
+ }
19
+ export {
20
+ v as useResolveButtonType
21
+ };
@@ -0,0 +1,104 @@
1
+ import { nextTick as b } from "vue";
2
+ import { match as h } from "./ui.es21.js";
3
+ import { getOwnerDocument as f } from "./ui.es27.js";
4
+ let m = ["[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(",");
5
+ var x = ((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))(x || {}), y = ((e) => (e[e.Error = 0] = "Error", e[e.Overflow = 1] = "Overflow", e[e.Success = 2] = "Success", e[e.Underflow = 3] = "Underflow", e))(y || {}), p = ((e) => (e[e.Previous = -1] = "Previous", e[e.Next = 1] = "Next", e))(p || {});
6
+ function E(e = document.body) {
7
+ return e == null ? [] : Array.from(e.querySelectorAll(m)).sort((t, r) => Math.sign((t.tabIndex || Number.MAX_SAFE_INTEGER) - (r.tabIndex || Number.MAX_SAFE_INTEGER)));
8
+ }
9
+ var w = ((e) => (e[e.Strict = 0] = "Strict", e[e.Loose = 1] = "Loose", e))(w || {});
10
+ function O(e, t = 0) {
11
+ var r;
12
+ return e === ((r = f(e)) == null ? void 0 : r.body) ? !1 : h(t, { [0]() {
13
+ return e.matches(m);
14
+ }, [1]() {
15
+ let o = e;
16
+ for (; o !== null; ) {
17
+ if (o.matches(m))
18
+ return !0;
19
+ o = o.parentElement;
20
+ }
21
+ return !1;
22
+ } });
23
+ }
24
+ function D(e) {
25
+ let t = f(e);
26
+ b(() => {
27
+ t && !O(t.activeElement, 0) && I(e);
28
+ });
29
+ }
30
+ var S = ((e) => (e[e.Keyboard = 0] = "Keyboard", e[e.Mouse = 1] = "Mouse", e))(S || {});
31
+ typeof window < "u" && typeof document < "u" && (document.addEventListener("keydown", (e) => {
32
+ e.metaKey || e.altKey || e.ctrlKey || (document.documentElement.dataset.headlessuiFocusVisible = "");
33
+ }, !0), document.addEventListener("click", (e) => {
34
+ e.detail === 1 ? delete document.documentElement.dataset.headlessuiFocusVisible : e.detail === 0 && (document.documentElement.dataset.headlessuiFocusVisible = "");
35
+ }, !0));
36
+ function I(e) {
37
+ e == null || e.focus({ preventScroll: !0 });
38
+ }
39
+ let A = ["textarea", "input"].join(",");
40
+ function M(e) {
41
+ var t, r;
42
+ return (r = (t = e == null ? void 0 : e.matches) == null ? void 0 : t.call(e, A)) != null ? r : !1;
43
+ }
44
+ function L(e, t = (r) => r) {
45
+ return e.slice().sort((r, o) => {
46
+ let l = t(r), i = t(o);
47
+ if (l === null || i === null)
48
+ return 0;
49
+ let a = l.compareDocumentPosition(i);
50
+ return a & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : a & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
51
+ });
52
+ }
53
+ function K(e, t) {
54
+ return P(E(), t, { relativeTo: e });
55
+ }
56
+ function P(e, t, { sorted: r = !0, relativeTo: o = null, skipElements: l = [] } = {}) {
57
+ var i;
58
+ let a = (i = Array.isArray(e) ? e.length > 0 ? e[0].ownerDocument : document : e == null ? void 0 : e.ownerDocument) != null ? i : document, n = Array.isArray(e) ? r ? L(e) : e : E(e);
59
+ l.length > 0 && n.length > 1 && (n = n.filter((u) => !l.includes(u))), o = o ?? a.activeElement;
60
+ let v = (() => {
61
+ if (t & 5)
62
+ return 1;
63
+ if (t & 10)
64
+ return -1;
65
+ throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
66
+ })(), F = (() => {
67
+ if (t & 1)
68
+ return 0;
69
+ if (t & 2)
70
+ return Math.max(0, n.indexOf(o)) - 1;
71
+ if (t & 4)
72
+ return Math.max(0, n.indexOf(o)) + 1;
73
+ if (t & 8)
74
+ return n.length - 1;
75
+ throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
76
+ })(), N = t & 32 ? { preventScroll: !0 } : {}, d = 0, c = n.length, s;
77
+ do {
78
+ if (d >= c || d + c <= 0)
79
+ return 0;
80
+ let u = F + d;
81
+ if (t & 16)
82
+ u = (u + c) % c;
83
+ else {
84
+ if (u < 0)
85
+ return 3;
86
+ if (u >= c)
87
+ return 1;
88
+ }
89
+ s = n[u], s == null || s.focus(N), d += v;
90
+ } while (s !== a.activeElement);
91
+ return t & 6 && M(s) && s.select(), 2;
92
+ }
93
+ export {
94
+ x as Focus,
95
+ y as FocusResult,
96
+ w as FocusableMode,
97
+ I as focusElement,
98
+ K as focusFrom,
99
+ P as focusIn,
100
+ E as getFocusableElements,
101
+ O as isFocusableElement,
102
+ D as restoreFocusIfNecessary,
103
+ L as sortByDomNode
104
+ };
@@ -0,0 +1,35 @@
1
+ import { ref as f, computed as d } from "vue";
2
+ import { isFocusableElement as v, FocusableMode as p } from "./ui.es23.js";
3
+ import { dom as w } from "./ui.es18.js";
4
+ import { useDocumentEvent as a } from "./ui.es28.js";
5
+ import { useWindowEvent as E } from "./ui.es29.js";
6
+ function M(c, m, r = d(() => !0)) {
7
+ function i(e, u) {
8
+ if (!r.value || e.defaultPrevented)
9
+ return;
10
+ let n = u(e);
11
+ if (n === null || !n.getRootNode().contains(n))
12
+ return;
13
+ let s = function t(o) {
14
+ return typeof o == "function" ? t(o()) : Array.isArray(o) || o instanceof Set ? o : [o];
15
+ }(c);
16
+ for (let t of s) {
17
+ if (t === null)
18
+ continue;
19
+ let o = t instanceof HTMLElement ? t : w(t);
20
+ if (o != null && o.contains(n) || e.composed && e.composedPath().includes(o))
21
+ return;
22
+ }
23
+ return !v(n, p.Loose) && n.tabIndex !== -1 && e.preventDefault(), m(e, n);
24
+ }
25
+ let l = f(null);
26
+ a("mousedown", (e) => {
27
+ var u, n;
28
+ r.value && (l.value = ((n = (u = e.composedPath) == null ? void 0 : u.call(e)) == null ? void 0 : n[0]) || e.target);
29
+ }, !0), a("click", (e) => {
30
+ l.value && (i(e, () => l.value), l.value = null);
31
+ }, !0), E("blur", (e) => i(e, () => window.document.activeElement instanceof HTMLIFrameElement ? window.document.activeElement : null), !0);
32
+ }
33
+ export {
34
+ M as useOutsideClick
35
+ };
@@ -0,0 +1,16 @@
1
+ import { ref as n } from "vue";
2
+ function u(e) {
3
+ return [e.screenX, e.screenY];
4
+ }
5
+ function o() {
6
+ let e = n([-1, -1]);
7
+ return { wasMoved(r) {
8
+ let t = u(r);
9
+ return e.value[0] === t[0] && e.value[1] === t[1] ? !1 : (e.value = t, !0);
10
+ }, update(r) {
11
+ e.value = u(r);
12
+ } };
13
+ }
14
+ export {
15
+ o as useTrackedPointer
16
+ };
@@ -0,0 +1,19 @@
1
+ import { ref as l } from "vue";
2
+ import { getTextValue as i } from "./ui.es31.js";
3
+ import { dom as m } from "./ui.es18.js";
4
+ function s(a) {
5
+ let r = l(""), t = l("");
6
+ return () => {
7
+ let e = m(a);
8
+ if (!e)
9
+ return "";
10
+ let u = e.innerText;
11
+ if (r.value === u)
12
+ return t.value;
13
+ let o = i(e).trim().toLowerCase();
14
+ return r.value = u, t.value = o, o;
15
+ };
16
+ }
17
+ export {
18
+ s as useTextValue
19
+ };
@@ -0,0 +1,17 @@
1
+ import { dom as o } from "./ui.es18.js";
2
+ import { env as r } from "./ui.es30.js";
3
+ function m(e) {
4
+ if (r.isServer)
5
+ return null;
6
+ if (e instanceof Node)
7
+ return e.ownerDocument;
8
+ if (e != null && e.hasOwnProperty("value")) {
9
+ let n = o(e);
10
+ if (n)
11
+ return n.ownerDocument;
12
+ }
13
+ return document;
14
+ }
15
+ export {
16
+ m as getOwnerDocument
17
+ };
@@ -0,0 +1,10 @@
1
+ import { watchEffect as r } from "vue";
2
+ import { env as m } from "./ui.es30.js";
3
+ function s(e, t, n) {
4
+ m.isServer || r((o) => {
5
+ document.addEventListener(e, t, n), o(() => document.removeEventListener(e, t, n));
6
+ });
7
+ }
8
+ export {
9
+ s as useDocumentEvent
10
+ };
@@ -0,0 +1,10 @@
1
+ import { watchEffect as t } from "vue";
2
+ import { env as i } from "./ui.es30.js";
3
+ function v(e, n, o) {
4
+ i.isServer || t((r) => {
5
+ window.addEventListener(e, n, o), r(() => window.removeEventListener(e, n, o));
6
+ });
7
+ }
8
+ export {
9
+ v as useWindowEvent
10
+ };
package/dist/ui.es3.js CHANGED
@@ -1,28 +1,45 @@
1
- import { openBlock as t, createElementBlock as n, normalizeClass as r, renderSlot as l } from "vue";
2
- const d = ["disabled"], a = { name: "uiButton" }, c = /* @__PURE__ */ Object.assign(a, {
1
+ import { openBlock as n, createElementBlock as t, normalizeClass as l, createVNode as r, renderSlot as i } from "vue";
2
+ import a from "./ui.es4.js";
3
+ const d = ["disabled"], c = {
4
+ name: "uiButton"
5
+ }, g = /* @__PURE__ */ Object.assign(c, {
3
6
  props: {
7
+ /**
8
+ * Color del botón
9
+ */
4
10
  color: {
5
11
  type: String,
6
12
  default: "primary"
7
13
  },
14
+ /**
15
+ * Tamaño del botón
16
+ */
8
17
  size: {
9
18
  type: String,
10
19
  default: "normal"
11
20
  },
21
+ /**
22
+ * Icono del botón (acepta directamente el componente del icono)
23
+ */
12
24
  icon: {
13
- type: String
25
+ type: Function,
26
+ default: () => {
27
+ }
14
28
  },
29
+ /**
30
+ * Estado del botón
31
+ */
15
32
  disabled: {
16
33
  type: Boolean,
17
34
  default: !1
18
35
  }
19
36
  },
20
37
  setup(e) {
21
- return (o, i) => (t(), n("button", {
38
+ return (o, s) => (n(), t("button", {
22
39
  disabled: e.disabled,
23
- class: r([{
40
+ class: l([{
24
41
  "bg-indigo-600 hover:bg-indigo-800": e.color === "primary",
25
- "bg-secondary hover:bg-cyan-300": e.color === "secondary",
42
+ "bg-cyan-300 hover:bg-cyan-500": e.color === "secondary",
26
43
  "bg-red-400 hover:bg-red-600": e.color === "red",
27
44
  "bg-yellow-400 hover:bg-yellow-600": e.color === "yellow",
28
45
  "bg-green-400 hover:bg-green-600": e.color === "green",
@@ -32,10 +49,15 @@ const d = ["disabled"], a = { name: "uiButton" }, c = /* @__PURE__ */ Object.ass
32
49
  }, "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"]),
33
50
  type: "button"
34
51
  }, [
35
- l(o.$slots, "default")
52
+ r(a, {
53
+ icon: e.icon,
54
+ color: "white",
55
+ class: "-ml-0.5 mr-2"
56
+ }, null, 8, ["icon"]),
57
+ i(o.$slots, "default")
36
58
  ], 10, d));
37
59
  }
38
60
  });
39
61
  export {
40
- c as default
62
+ g as default
41
63
  };
@@ -0,0 +1,28 @@
1
+ var i = Object.defineProperty, s = (t, e, r) => e in t ? i(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, n = (t, e, r) => (s(t, typeof e != "symbol" ? e + "" : e, r), r);
2
+ class c {
3
+ constructor() {
4
+ n(this, "current", this.detect()), n(this, "currentId", 0);
5
+ }
6
+ set(e) {
7
+ this.current !== e && (this.currentId = 0, this.current = e);
8
+ }
9
+ reset() {
10
+ this.set(this.detect());
11
+ }
12
+ nextId() {
13
+ return ++this.currentId;
14
+ }
15
+ get isServer() {
16
+ return this.current === "server";
17
+ }
18
+ get isClient() {
19
+ return this.current === "client";
20
+ }
21
+ detect() {
22
+ return typeof window > "u" || typeof document > "u" ? "server" : "client";
23
+ }
24
+ }
25
+ let u = new c();
26
+ export {
27
+ u as env
28
+ };
@@ -0,0 +1,34 @@
1
+ let a = /([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;
2
+ function o(t) {
3
+ var l, u;
4
+ let n = (l = t.innerText) != null ? l : "", i = t.cloneNode(!0);
5
+ if (!(i instanceof HTMLElement))
6
+ return n;
7
+ let r = !1;
8
+ for (let f of i.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))
9
+ f.remove(), r = !0;
10
+ let e = r ? (u = i.innerText) != null ? u : "" : n;
11
+ return a.test(e) && (e = e.replace(a, "")), e;
12
+ }
13
+ function F(t) {
14
+ let l = t.getAttribute("aria-label");
15
+ if (typeof l == "string")
16
+ return l.trim();
17
+ let u = t.getAttribute("aria-labelledby");
18
+ if (u) {
19
+ let n = u.split(" ").map((i) => {
20
+ let r = document.getElementById(i);
21
+ if (r) {
22
+ let e = r.getAttribute("aria-label");
23
+ return typeof e == "string" ? e.trim() : o(r).trim();
24
+ }
25
+ return null;
26
+ }).filter(Boolean);
27
+ if (n.length > 0)
28
+ return n.join(", ");
29
+ }
30
+ return o(t).trim();
31
+ }
32
+ export {
33
+ F as getTextValue
34
+ };
package/dist/ui.es4.js CHANGED
@@ -1,20 +1,38 @@
1
- import { openBlock as n, createBlock as a, resolveDynamicComponent as t, normalizeClass as s } from "vue";
2
- const i = { name: "uiIcon" }, r = /* @__PURE__ */ Object.assign(i, {
1
+ import { openBlock as t, createBlock as c, resolveDynamicComponent as l, normalizeClass as o } from "vue";
2
+ const n = { name: "uiIcon" }, u = /* @__PURE__ */ Object.assign(n, {
3
3
  props: {
4
- name: { type: Function, required: !0 },
5
- size: { type: String, default: "normal" }
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" }
6
16
  },
7
17
  setup(e) {
8
- return (c, l) => (n(), a(t(e.name), {
9
- class: s({
18
+ return (a, r) => (t(), c(l(e.icon), {
19
+ class: o({
10
20
  "h-4 w-4": e.size === "normal",
11
21
  "h-6 w-6": e.size === "big",
12
22
  "h-12 w-12": e.size === "huge",
13
- "h-20 w-20": e.size === "massive"
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"
14
32
  })
15
33
  }, null, 8, ["class"]));
16
34
  }
17
35
  });
18
36
  export {
19
- r as default
37
+ u as default
20
38
  };