@hotelinking/ui 1.5.0 → 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.
Files changed (64) hide show
  1. package/dist/index.css +94 -0
  2. package/dist/ui.cjs.js +4 -1
  3. package/dist/ui.es.js +1162 -5
  4. package/package.json +1 -1
  5. package/dist/ui.cjs10.js +0 -1
  6. package/dist/ui.cjs11.js +0 -1
  7. package/dist/ui.cjs12.js +0 -1
  8. package/dist/ui.cjs13.js +0 -1
  9. package/dist/ui.cjs14.js +0 -4
  10. package/dist/ui.cjs15.js +0 -1
  11. package/dist/ui.cjs16.js +0 -1
  12. package/dist/ui.cjs17.js +0 -1
  13. package/dist/ui.cjs18.js +0 -1
  14. package/dist/ui.cjs19.js +0 -1
  15. package/dist/ui.cjs2.js +0 -1
  16. package/dist/ui.cjs20.js +0 -1
  17. package/dist/ui.cjs21.js +0 -1
  18. package/dist/ui.cjs22.js +0 -1
  19. package/dist/ui.cjs23.js +0 -1
  20. package/dist/ui.cjs24.js +0 -1
  21. package/dist/ui.cjs25.js +0 -1
  22. package/dist/ui.cjs26.js +0 -1
  23. package/dist/ui.cjs27.js +0 -1
  24. package/dist/ui.cjs28.js +0 -1
  25. package/dist/ui.cjs29.js +0 -1
  26. package/dist/ui.cjs3.js +0 -1
  27. package/dist/ui.cjs30.js +0 -1
  28. package/dist/ui.cjs31.js +0 -1
  29. package/dist/ui.cjs4.js +0 -1
  30. package/dist/ui.cjs5.js +0 -1
  31. package/dist/ui.cjs6.js +0 -1
  32. package/dist/ui.cjs7.js +0 -1
  33. package/dist/ui.cjs8.js +0 -1
  34. package/dist/ui.cjs9.js +0 -1
  35. package/dist/ui.es10.js +0 -20
  36. package/dist/ui.es11.js +0 -20
  37. package/dist/ui.es12.js +0 -20
  38. package/dist/ui.es13.js +0 -20
  39. package/dist/ui.es14.js +0 -84
  40. package/dist/ui.es15.js +0 -10
  41. package/dist/ui.es16.js +0 -4
  42. package/dist/ui.es17.js +0 -36
  43. package/dist/ui.es18.js +0 -7
  44. package/dist/ui.es19.js +0 -18
  45. package/dist/ui.es2.js +0 -15
  46. package/dist/ui.es20.js +0 -14
  47. package/dist/ui.es21.js +0 -11
  48. package/dist/ui.es22.js +0 -21
  49. package/dist/ui.es23.js +0 -104
  50. package/dist/ui.es24.js +0 -35
  51. package/dist/ui.es25.js +0 -16
  52. package/dist/ui.es26.js +0 -19
  53. package/dist/ui.es27.js +0 -17
  54. package/dist/ui.es28.js +0 -10
  55. package/dist/ui.es29.js +0 -10
  56. package/dist/ui.es3.js +0 -63
  57. package/dist/ui.es30.js +0 -28
  58. package/dist/ui.es31.js +0 -34
  59. package/dist/ui.es4.js +0 -38
  60. package/dist/ui.es5.js +0 -56
  61. package/dist/ui.es6.js +0 -100
  62. package/dist/ui.es7.js +0 -168
  63. package/dist/ui.es8.js +0 -205
  64. package/dist/ui.es9.js +0 -20
package/dist/ui.es8.js DELETED
@@ -1,205 +0,0 @@
1
- import { defineComponent as P, ref as S, computed as y, provide as C, onMounted as N, onUnmounted as B, watchEffect as K, nextTick as R, inject as L } from "vue";
2
- import { render as T, Features as D } from "./ui.es14.js";
3
- import { useId as w } from "./ui.es15.js";
4
- import { Keys as d } from "./ui.es16.js";
5
- import { calculateActiveIndex as j, Focus as b } from "./ui.es17.js";
6
- import { dom as v } from "./ui.es18.js";
7
- import { useTreeWalker as U } from "./ui.es19.js";
8
- import { useOpenClosedProvider as V, State as x, useOpenClosed as _ } from "./ui.es20.js";
9
- import { match as q } from "./ui.es21.js";
10
- import { useResolveButtonType as H } from "./ui.es22.js";
11
- import { isFocusableElement as Q, FocusableMode as W, focusFrom as J, Focus as F, restoreFocusIfNecessary as O, sortByDomNode as Y } from "./ui.es23.js";
12
- import { useOutsideClick as Z } from "./ui.es24.js";
13
- import { useTrackedPointer as z } from "./ui.es25.js";
14
- import { useTextValue as G } from "./ui.es26.js";
15
- var X = ((a) => (a[a.Open = 0] = "Open", a[a.Closed = 1] = "Closed", a))(X || {}), $ = ((a) => (a[a.Pointer = 0] = "Pointer", a[a.Other = 1] = "Other", a))($ || {});
16
- function ee(a) {
17
- requestAnimationFrame(() => requestAnimationFrame(a));
18
- }
19
- let E = Symbol("MenuContext");
20
- function k(a) {
21
- let g = L(E, null);
22
- if (g === null) {
23
- let M = new Error(`<${a} /> is missing a parent <Menu /> component.`);
24
- throw Error.captureStackTrace && Error.captureStackTrace(M, k), M;
25
- }
26
- return g;
27
- }
28
- let fe = P({ name: "Menu", props: { as: { type: [Object, String], default: "template" } }, setup(a, { slots: g, attrs: M }) {
29
- let f = S(1), e = S(null), c = S(null), s = S([]), I = S(""), i = S(null), u = S(1);
30
- function t(n = (l) => l) {
31
- let l = i.value !== null ? s.value[i.value] : null, r = Y(n(s.value.slice()), (m) => v(m.dataRef.domRef)), o = l ? r.indexOf(l) : null;
32
- return o === -1 && (o = null), { items: r, activeItemIndex: o };
33
- }
34
- let p = { menuState: f, buttonRef: e, itemsRef: c, items: s, searchQuery: I, activeItemIndex: i, activationTrigger: u, closeMenu: () => {
35
- f.value = 1, i.value = null;
36
- }, openMenu: () => f.value = 0, goToItem(n, l, r) {
37
- let o = t(), m = j(n === b.Specific ? { focus: b.Specific, id: l } : { focus: n }, { resolveItems: () => o.items, resolveActiveIndex: () => o.activeItemIndex, resolveId: (h) => h.id, resolveDisabled: (h) => h.dataRef.disabled });
38
- I.value = "", i.value = m, u.value = r ?? 1, s.value = o.items;
39
- }, search(n) {
40
- let l = I.value !== "" ? 0 : 1;
41
- I.value += n.toLowerCase();
42
- let r = (i.value !== null ? s.value.slice(i.value + l).concat(s.value.slice(0, i.value + l)) : s.value).find((m) => m.dataRef.textValue.startsWith(I.value) && !m.dataRef.disabled), o = r ? s.value.indexOf(r) : -1;
43
- o === -1 || o === i.value || (i.value = o, u.value = 1);
44
- }, clearSearch() {
45
- I.value = "";
46
- }, registerItem(n, l) {
47
- let r = t((o) => [...o, { id: n, dataRef: l }]);
48
- s.value = r.items, i.value = r.activeItemIndex, u.value = 1;
49
- }, unregisterItem(n) {
50
- let l = t((r) => {
51
- let o = r.findIndex((m) => m.id === n);
52
- return o !== -1 && r.splice(o, 1), r;
53
- });
54
- s.value = l.items, i.value = l.activeItemIndex, u.value = 1;
55
- } };
56
- return Z([e, c], (n, l) => {
57
- var r;
58
- p.closeMenu(), Q(l, W.Loose) || (n.preventDefault(), (r = v(e)) == null || r.focus());
59
- }, y(() => f.value === 0)), C(E, p), V(y(() => q(f.value, { [0]: x.Open, [1]: x.Closed }))), () => {
60
- let n = { open: f.value === 0, close: p.closeMenu };
61
- return T({ ourProps: {}, theirProps: a, slot: n, slots: g, attrs: M, name: "Menu" });
62
- };
63
- } }), Ie = P({ name: "MenuButton", props: { disabled: { type: Boolean, default: !1 }, as: { type: [Object, String], default: "button" }, id: { type: String, default: () => `headlessui-menu-button-${w()}` } }, setup(a, { attrs: g, slots: M, expose: f }) {
64
- let e = k("MenuButton");
65
- f({ el: e.buttonRef, $el: e.buttonRef });
66
- function c(u) {
67
- switch (u.key) {
68
- case d.Space:
69
- case d.Enter:
70
- case d.ArrowDown:
71
- u.preventDefault(), u.stopPropagation(), e.openMenu(), R(() => {
72
- var t;
73
- (t = v(e.itemsRef)) == null || t.focus({ preventScroll: !0 }), e.goToItem(b.First);
74
- });
75
- break;
76
- case d.ArrowUp:
77
- u.preventDefault(), u.stopPropagation(), e.openMenu(), R(() => {
78
- var t;
79
- (t = v(e.itemsRef)) == null || t.focus({ preventScroll: !0 }), e.goToItem(b.Last);
80
- });
81
- break;
82
- }
83
- }
84
- function s(u) {
85
- switch (u.key) {
86
- case d.Space:
87
- u.preventDefault();
88
- break;
89
- }
90
- }
91
- function I(u) {
92
- a.disabled || (e.menuState.value === 0 ? (e.closeMenu(), R(() => {
93
- var t;
94
- return (t = v(e.buttonRef)) == null ? void 0 : t.focus({ preventScroll: !0 });
95
- })) : (u.preventDefault(), e.openMenu(), ee(() => {
96
- var t;
97
- return (t = v(e.itemsRef)) == null ? void 0 : t.focus({ preventScroll: !0 });
98
- })));
99
- }
100
- let i = H(y(() => ({ as: a.as, type: g.type })), e.buttonRef);
101
- return () => {
102
- var u;
103
- let t = { open: e.menuState.value === 0 }, { id: p, ...n } = a, l = { ref: e.buttonRef, id: p, type: i.value, "aria-haspopup": "menu", "aria-controls": (u = v(e.itemsRef)) == null ? void 0 : u.id, "aria-expanded": a.disabled ? void 0 : e.menuState.value === 0, onKeydown: c, onKeyup: s, onClick: I };
104
- return T({ ourProps: l, theirProps: n, slot: t, attrs: g, slots: M, name: "MenuButton" });
105
- };
106
- } }), be = P({ 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-${w()}` } }, setup(a, { attrs: g, slots: M, expose: f }) {
107
- let e = k("MenuItems"), c = S(null);
108
- f({ el: e.itemsRef, $el: e.itemsRef }), U({ container: y(() => v(e.itemsRef)), enabled: y(() => e.menuState.value === 0), accept(t) {
109
- return t.getAttribute("role") === "menuitem" ? NodeFilter.FILTER_REJECT : t.hasAttribute("role") ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
110
- }, walk(t) {
111
- t.setAttribute("role", "none");
112
- } });
113
- function s(t) {
114
- var p;
115
- switch (c.value && clearTimeout(c.value), t.key) {
116
- case d.Space:
117
- if (e.searchQuery.value !== "")
118
- return t.preventDefault(), t.stopPropagation(), e.search(t.key);
119
- case d.Enter:
120
- if (t.preventDefault(), t.stopPropagation(), e.activeItemIndex.value !== null) {
121
- let n = e.items.value[e.activeItemIndex.value];
122
- (p = v(n.dataRef.domRef)) == null || p.click();
123
- }
124
- e.closeMenu(), O(v(e.buttonRef));
125
- break;
126
- case d.ArrowDown:
127
- return t.preventDefault(), t.stopPropagation(), e.goToItem(b.Next);
128
- case d.ArrowUp:
129
- return t.preventDefault(), t.stopPropagation(), e.goToItem(b.Previous);
130
- case d.Home:
131
- case d.PageUp:
132
- return t.preventDefault(), t.stopPropagation(), e.goToItem(b.First);
133
- case d.End:
134
- case d.PageDown:
135
- return t.preventDefault(), t.stopPropagation(), e.goToItem(b.Last);
136
- case d.Escape:
137
- t.preventDefault(), t.stopPropagation(), e.closeMenu(), R(() => {
138
- var n;
139
- return (n = v(e.buttonRef)) == null ? void 0 : n.focus({ preventScroll: !0 });
140
- });
141
- break;
142
- case d.Tab:
143
- t.preventDefault(), t.stopPropagation(), e.closeMenu(), R(() => J(v(e.buttonRef), t.shiftKey ? F.Previous : F.Next));
144
- break;
145
- default:
146
- t.key.length === 1 && (e.search(t.key), c.value = setTimeout(() => e.clearSearch(), 350));
147
- break;
148
- }
149
- }
150
- function I(t) {
151
- switch (t.key) {
152
- case d.Space:
153
- t.preventDefault();
154
- break;
155
- }
156
- }
157
- let i = _(), u = y(() => i !== null ? (i.value & x.Open) === x.Open : e.menuState.value === 0);
158
- return () => {
159
- var t, p;
160
- let n = { open: e.menuState.value === 0 }, { id: l, ...r } = a, o = { "aria-activedescendant": e.activeItemIndex.value === null || (t = e.items.value[e.activeItemIndex.value]) == null ? void 0 : t.id, "aria-labelledby": (p = v(e.buttonRef)) == null ? void 0 : p.id, id: l, onKeydown: s, onKeyup: I, role: "menu", tabIndex: 0, ref: e.itemsRef };
161
- return T({ ourProps: o, theirProps: r, slot: n, attrs: g, slots: M, features: D.RenderStrategy | D.Static, visible: u.value, name: "MenuItems" });
162
- };
163
- } }), ge = P({ name: "MenuItem", inheritAttrs: !1, props: { as: { type: [Object, String], default: "template" }, disabled: { type: Boolean, default: !1 }, id: { type: String, default: () => `headlessui-menu-item-${w()}` } }, setup(a, { slots: g, attrs: M, expose: f }) {
164
- let e = k("MenuItem"), c = S(null);
165
- f({ el: c, $el: c });
166
- let s = y(() => e.activeItemIndex.value !== null ? e.items.value[e.activeItemIndex.value].id === a.id : !1), I = G(c), i = y(() => ({ disabled: a.disabled, get textValue() {
167
- return I();
168
- }, domRef: c }));
169
- N(() => e.registerItem(a.id, i)), B(() => e.unregisterItem(a.id)), K(() => {
170
- e.menuState.value === 0 && s.value && e.activationTrigger.value !== 0 && R(() => {
171
- var o, m;
172
- return (m = (o = v(c)) == null ? void 0 : o.scrollIntoView) == null ? void 0 : m.call(o, { block: "nearest" });
173
- });
174
- });
175
- function u(o) {
176
- if (a.disabled)
177
- return o.preventDefault();
178
- e.closeMenu(), O(v(e.buttonRef));
179
- }
180
- function t() {
181
- if (a.disabled)
182
- return e.goToItem(b.Nothing);
183
- e.goToItem(b.Specific, a.id);
184
- }
185
- let p = z();
186
- function n(o) {
187
- p.update(o);
188
- }
189
- function l(o) {
190
- p.wasMoved(o) && (a.disabled || s.value || e.goToItem(b.Specific, a.id, 0));
191
- }
192
- function r(o) {
193
- p.wasMoved(o) && (a.disabled || s.value && e.goToItem(b.Nothing));
194
- }
195
- return () => {
196
- let { disabled: o } = a, m = { active: s.value, disabled: o, close: e.closeMenu }, { id: h, ...A } = a;
197
- return T({ ourProps: { id: h, ref: c, role: "menuitem", tabIndex: o === !0 ? void 0 : -1, "aria-disabled": o === !0 ? !0 : void 0, disabled: void 0, onClick: u, onFocus: t, onPointerenter: n, onMouseenter: n, onPointermove: l, onMousemove: l, onPointerleave: r, onMouseleave: r }, theirProps: { ...M, ...A }, slot: m, attrs: M, slots: g, name: "MenuItem" });
198
- };
199
- } });
200
- export {
201
- fe as Menu,
202
- Ie as MenuButton,
203
- ge as MenuItem,
204
- be as MenuItems
205
- };
package/dist/ui.es9.js DELETED
@@ -1,20 +0,0 @@
1
- import { openBlock as e, createElementBlock as r, createElementVNode as o } from "vue";
2
- function c(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: "M19.5 8.25l-7.5 7.5-7.5-7.5"
15
- })
16
- ]);
17
- }
18
- export {
19
- c as default
20
- };