hys-ui 0.5.0 → 0.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 (66) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/components/HysDrawer/HysDrawer.vue.js +1 -1
  3. package/dist/components/HysDrawer/HysDrawer2.vue.js +2 -2
  4. package/dist/components/HysModal/HysModal.vue.js +2 -2
  5. package/dist/components/HysModal/HysModal2.vue.js +38 -38
  6. package/dist/components/HysSearch/HysSearch.vue.js +2 -2
  7. package/dist/components/HysSortableList/HysSortableList.vue.js +2 -2
  8. package/dist/components/HysSortableList/HysSortableList2.vue.js +498 -129
  9. package/dist/components/HysSortableList/SortableGhost/SortableGhost.vue.js +7 -0
  10. package/dist/components/HysSortableList/SortableGhost/SortableGhost2.vue.js +43 -0
  11. package/dist/components/HysSortableList/SortableGhost/useSortGhost.js +54 -0
  12. package/dist/components/HysSortableList/geometry.js +230 -0
  13. package/dist/components/HysSortableList/model.js +254 -0
  14. package/dist/components/HysSortableList/transactions.js +281 -0
  15. package/dist/components/HysSortableList/useSortDrag.js +270 -0
  16. package/dist/components/HysSortableList/useSortKeyboard.js +72 -0
  17. package/dist/components/HysSortableList/useSortWindow.js +144 -0
  18. package/dist/components/HysToast/HysToast.vue.js +3 -3
  19. package/dist/components/HysToast/HysToast2.vue.js +379 -107
  20. package/dist/components/HysToast/ToastViewport/ToastViewport.vue.js +7 -0
  21. package/dist/components/HysToast/ToastViewport/ToastViewport2.vue.js +211 -0
  22. package/dist/components/HysToast/ToastViewport/useToastStackDisclosure.js +71 -0
  23. package/dist/components/HysToast/toastPresentation.js +98 -0
  24. package/dist/components/HysToast/useToastActions.js +62 -0
  25. package/dist/components/HysToast/useToastSwipe.js +48 -0
  26. package/dist/components/HysToast/useToastTimer.js +90 -0
  27. package/dist/composables/popupReferenceBinding.js +41 -0
  28. package/dist/composables/toastEscape.js +18 -10
  29. package/dist/composables/toastQueue.js +276 -0
  30. package/dist/composables/toastQueueModel.js +86 -0
  31. package/dist/composables/toastTasks.js +58 -0
  32. package/dist/composables/useHysToast.js +117 -135
  33. package/dist/composables/usePopupSurface.js +190 -356
  34. package/dist/composables/usePopupSurfaceInteractions.js +172 -0
  35. package/dist/index.js +59 -57
  36. package/dist/style.css +1 -1
  37. package/dist/types/components/HysGantt/HysGantt.vue.d.ts +1 -1
  38. package/dist/types/components/HysModal/HysModal.vue.d.ts +1 -1
  39. package/dist/types/components/HysSortableList/HysSortableList.vue.d.ts +48 -25
  40. package/dist/types/components/HysSortableList/SortableGhost/SortableGhost.vue.d.ts +31 -0
  41. package/dist/types/components/HysSortableList/SortableGhost/useSortGhost.d.ts +23 -0
  42. package/dist/types/components/HysSortableList/geometry.d.ts +35 -0
  43. package/dist/types/components/HysSortableList/model.d.ts +61 -0
  44. package/dist/types/components/HysSortableList/sortableList.d.ts +151 -0
  45. package/dist/types/components/HysSortableList/transactions.d.ts +10 -0
  46. package/dist/types/components/HysSortableList/useSortDrag.d.ts +25 -0
  47. package/dist/types/components/HysSortableList/useSortKeyboard.d.ts +17 -0
  48. package/dist/types/components/HysSortableList/useSortWindow.d.ts +16 -0
  49. package/dist/types/components/HysToast/HysToast.vue.d.ts +44 -46
  50. package/dist/types/components/HysToast/ToastViewport/ToastViewport.vue.d.ts +25 -0
  51. package/dist/types/components/HysToast/ToastViewport/useToastStackDisclosure.d.ts +16 -0
  52. package/dist/types/components/HysToast/toastPresentation.d.ts +8 -0
  53. package/dist/types/components/HysToast/toastTypes.d.ts +212 -0
  54. package/dist/types/components/HysToast/useToastActions.d.ts +18 -0
  55. package/dist/types/components/HysToast/useToastSwipe.d.ts +11 -0
  56. package/dist/types/components/HysToast/useToastTimer.d.ts +22 -0
  57. package/dist/types/composables/popupReferenceBinding.d.ts +9 -0
  58. package/dist/types/composables/toastEscape.d.ts +1 -1
  59. package/dist/types/composables/toastQueue.d.ts +121 -0
  60. package/dist/types/composables/toastQueueModel.d.ts +116 -0
  61. package/dist/types/composables/toastTasks.d.ts +2 -0
  62. package/dist/types/composables/useHysToast.d.ts +4 -48
  63. package/dist/types/composables/usePopupSurface.d.ts +20 -20
  64. package/dist/types/composables/usePopupSurfaceInteractions.d.ts +33 -0
  65. package/dist/types/index.d.ts +3 -4
  66. package/package.json +1 -1
@@ -1,57 +1,59 @@
1
- import { ref as D, shallowRef as Pe, useId as qe, inject as Be, computed as f, watch as x, onMounted as Ve, onActivated as Ne, onDeactivated as $e, onBeforeUnmount as Ue, nextTick as Te } from "vue";
2
- import { useHysControlState as Ge } from "./formContext.js";
3
- import { useChoiceModel as Je } from "./choiceModel.js";
4
- import { overlayOwnerKey as Qe } from "./overlayManager.js";
5
- import { useFloating as Xe } from "./useFloating.js";
6
- const ee = (a) => typeof a == "number" ? Number.isFinite(a) ? Math.max(0, a) + "px" : void 0 : a, te = (a) => Number.isFinite(a) ? Math.max(0, Math.min(3e4, a)) : 0, P = 'button,a[href],input,select,textarea,[tabindex]:not([tabindex="-1"]),[contenteditable="true"]';
7
- function at(a, v, A) {
8
- const E = D(), F = Pe(), s = D(), R = qe() + "-popup", Oe = R + "-title", { disabled: Q } = Ge(a), y = Be(Qe, void 0), d = D(!0), j = D(!1), X = D(!1), q = Je(
1
+ import { ref as C, shallowRef as le, useId as ce, inject as re, computed as u, watch as f, onMounted as ie, onActivated as se, onDeactivated as ve, onBeforeUnmount as fe, nextTick as G } from "vue";
2
+ import { useHysControlState as de } from "./formContext.js";
3
+ import { useChoiceModel as he } from "./choiceModel.js";
4
+ import { overlayOwnerKey as me } from "./overlayManager.js";
5
+ import { useFloating as ye } from "./useFloating.js";
6
+ import { popupFocusControls as L, usePopupSurfaceInteractions as ge } from "./usePopupSurfaceInteractions.js";
7
+ import { createPopupReferenceBinding as xe } from "./popupReferenceBinding.js";
8
+ const q = (t) => typeof t == "number" ? Number.isFinite(t) ? Math.max(0, t) + "px" : void 0 : t;
9
+ function Se(t, i, y) {
10
+ const g = C(), p = le(), b = C(), E = ce() + "-popup", J = E + "-title", { disabled: k } = de(t), s = re(me, void 0), l = C(!0), w = C(!1), z = C(!1), M = he(
9
11
  {
10
12
  get modelValue() {
11
- return a.open ?? a.modelValue;
13
+ return t.open ?? t.modelValue;
12
14
  }
13
15
  },
14
- () => a.defaultOpen ?? !1
15
- ), p = f(
16
- () => d.value && !Q.value && (y == null ? void 0 : y.value) !== !1
17
- ), w = f(
18
- () => typeof a.reference == "function" ? a.reference() : a.reference
19
- ), h = f(() => {
20
- const e = w.value;
21
- return e instanceof HTMLElement ? e : (e == null ? void 0 : e.contextElement) ?? F.value ?? E.value;
22
- }), H = f(
23
- () => !!F.value && (F.value.matches(P) || !!F.value.querySelector(P))
16
+ () => t.defaultOpen ?? !1
17
+ ), R = u(
18
+ () => l.value && !k.value && (s == null ? void 0 : s.value) !== !1
19
+ ), d = u(
20
+ () => typeof t.reference == "function" ? t.reference() : t.reference
21
+ ), c = u(() => {
22
+ const e = d.value;
23
+ return e instanceof HTMLElement ? e : (e == null ? void 0 : e.contextElement) ?? p.value ?? g.value;
24
+ }), S = u(
25
+ () => !!p.value && (p.value.matches(L) || !!p.value.querySelector(L))
24
26
  );
25
- function ae() {
26
- var t;
27
- const e = h.value;
28
- (t = e != null && e.matches(P) ? e : (e == null ? void 0 : e.querySelector(P)) ?? E.value) == null || t.focus({ preventScroll: !0 });
27
+ function B() {
28
+ var a;
29
+ const e = c.value;
30
+ (a = e != null && e.matches(L) ? e : (e == null ? void 0 : e.querySelector(L)) ?? g.value) == null || a.focus({ preventScroll: !0 });
29
31
  }
30
- function Y() {
32
+ function V() {
31
33
  n.restoringFocus.value = !0;
32
34
  try {
33
- ae();
35
+ B();
34
36
  } finally {
35
37
  n.restoringFocus.value = !1;
36
38
  }
37
39
  }
38
- const T = f(() => {
39
- const e = w.value ?? F.value ?? E.value;
40
+ const O = u(() => {
41
+ const e = d.value ?? p.value ?? g.value;
40
42
  if (e)
41
43
  return {
42
44
  getBoundingClientRect: () => e.getBoundingClientRect(),
43
- contains: (t) => {
44
- var u, o;
45
- return !!((u = h.value) != null && u.contains(t)) || !!((o = E.value) != null && o.contains(t));
45
+ contains: (a) => {
46
+ var r, m;
47
+ return !!((r = c.value) != null && r.contains(a)) || !!((m = g.value) != null && m.contains(a));
46
48
  },
47
- focus: ae,
49
+ focus: B,
48
50
  get isConnected() {
49
- var t;
50
- return ((t = h.value) == null ? void 0 : t.isConnected) ?? !!w.value;
51
+ var a;
52
+ return ((a = c.value) == null ? void 0 : a.isConnected) ?? !!d.value;
51
53
  }
52
54
  };
53
- }), ne = f(() => {
54
- const e = a.appendTo;
55
+ }), D = u(() => {
56
+ const e = t.appendTo;
55
57
  if (e instanceof HTMLElement) return e;
56
58
  if (typeof e == "string")
57
59
  try {
@@ -60,399 +62,231 @@ function at(a, v, A) {
60
62
  return document.body;
61
63
  }
62
64
  return document.body;
63
- }), ue = D({});
64
- function Ae(e) {
65
- const t = e.placement.startsWith("left") || e.placement.startsWith("right"), u = t ? e.height : e.width, o = Number.isFinite(a.arrowOffset) ? Math.max(6, a.arrowOffset) : 10, r = t ? e.anchor.top + e.anchor.height / 2 - e.y : e.anchor.left + e.anchor.width / 2 - e.x;
66
- ue.value = {
67
- [t ? "top" : "left"]: Math.max(Math.min(o, u / 2), Math.min(r, u - o)) + "px"
65
+ }), N = C({});
66
+ function Q(e) {
67
+ const a = e.placement.startsWith("left") || e.placement.startsWith("right"), r = a ? e.height : e.width, m = Number.isFinite(t.arrowOffset) ? Math.max(6, t.arrowOffset) : 10, W = a ? e.anchor.top + e.anchor.height / 2 - e.y : e.anchor.left + e.anchor.width / 2 - e.x;
68
+ N.value = {
69
+ [a ? "top" : "left"]: Math.max(Math.min(m, r / 2), Math.min(W, r - m)) + "px"
68
70
  };
69
71
  }
70
- const n = Xe(T, s, {
72
+ const n = ye(O, b, {
71
73
  get placement() {
72
- return a.placement;
74
+ return t.placement;
73
75
  },
74
76
  get gap() {
75
- return a.offset ?? (v === "tooltip" ? 7 : 8);
77
+ return t.offset ?? (i === "tooltip" ? 7 : 8);
76
78
  },
77
79
  get autoAdjustOverflow() {
78
- return a.autoAdjustOverflow;
80
+ return t.autoAdjustOverflow;
79
81
  },
80
82
  get closeOnEscape() {
81
- return a.closeOnEscape;
83
+ return t.closeOnEscape;
82
84
  },
83
85
  get closeOnOutside() {
84
- return a.closeOnOutside;
86
+ return t.closeOnOutside;
85
87
  },
86
- closeOnTab: v === "tooltip",
88
+ closeOnTab: i === "tooltip",
87
89
  get strategy() {
88
- return a.appendTo === !1 || ne.value !== document.body ? "absolute" : "fixed";
90
+ return t.appendTo === !1 || D.value !== document.body ? "absolute" : "fixed";
89
91
  },
90
- width: () => a.width,
91
- maxWidth: () => ee(a.maxWidth) ?? (v === "tooltip" ? "320px" : "360px"),
92
- zIndex: () => a.zIndex,
93
- onPosition: Ae,
94
- requestOpen(e, t) {
95
- return l(e, t), !1;
92
+ width: () => t.width,
93
+ maxWidth: () => q(t.maxWidth) ?? (i === "tooltip" ? "320px" : "360px"),
94
+ zIndex: () => t.zIndex,
95
+ onPosition: Q,
96
+ requestOpen(e, a) {
97
+ return v(e, a), !1;
96
98
  }
99
+ }), o = ge(t, i, {
100
+ available: R,
101
+ anchor: O,
102
+ actualReference: c,
103
+ panel: b,
104
+ floating: n,
105
+ restoreReferenceFocus: V,
106
+ request: v
107
+ }), { handlers: h, tab: I } = o, P = xe(i, E, {
108
+ pointerenter: h.pointerEnter,
109
+ pointerleave: h.pointerLeave,
110
+ focusin: h.focusIn,
111
+ focusout: h.focusOut,
112
+ click: h.click,
113
+ contextmenu: h.contextmenu,
114
+ keydown: h.key
97
115
  });
98
- let S, m, B, C, i, I = 0, oe = -1, ie = -1, W = !1, V = !1, M = !1, z = !1, g = !1;
99
- const c = f(() => {
100
- const e = a.trigger ?? (v === "tooltip" ? ["hover", "focus"] : ["click"]), t = Array.isArray(e) ? e : [e];
101
- return new Set(t.includes("manual") ? [] : t);
102
- });
103
- function k() {
104
- clearTimeout(S), clearTimeout(m), S = m = void 0;
105
- }
106
- function N() {
107
- clearTimeout(B), B = void 0;
108
- }
109
- function L() {
110
- W = V = M = z = g = !1;
116
+ function T() {
117
+ var a;
118
+ const e = l.value && d.value ? c.value : void 0;
119
+ P.attach(
120
+ e && !((a = g.value) != null && a.contains(e)) ? e : void 0,
121
+ n.open.value
122
+ );
111
123
  }
112
- function $() {
124
+ let x, A = 0, $ = -1, K = -1;
125
+ function F() {
113
126
  var e;
114
- p.value && !j.value && q.current.value && ((e = T.value) != null && e.isConnected) ? (X.value = !0, n.show(!0)) : n.close(!1, !0);
127
+ R.value && !w.value && M.current.value && ((e = O.value) != null && e.isConnected) ? (z.value = !0, n.show(!0)) : n.close(!1, !0);
115
128
  }
116
- async function l(e, t = !1) {
117
- var o, r;
118
- if (k(), !d.value || e && (!p.value || n.restoringFocus.value || !((o = T.value) != null && o.isConnected)))
129
+ async function v(e, a = !1) {
130
+ var m, W;
131
+ if (o.clearDelays(), !l.value || e && (!R.value || n.restoringFocus.value || !((m = O.value) != null && m.isConnected)))
119
132
  return !1;
120
- e || L(), j.value = !1;
121
- let u = Object.is(q.current.value, e);
122
- return u || (u = await q.commit(
133
+ e || o.resetReasons(), w.value = !1;
134
+ let r = Object.is(M.current.value, e);
135
+ return r || (r = await M.commit(
123
136
  e,
124
- (O) => {
125
- A("update:open", O), A("update:modelValue", O);
137
+ (U) => {
138
+ y("update:open", U), y("update:modelValue", U);
126
139
  },
127
140
  () => {
128
141
  }
129
- )), d.value ? (u && (e ? $() : (n.close(!1, !0), t && ((r = T.value) != null && r.isConnected) && Y())), u) : !1;
130
- }
131
- function re() {
132
- if (clearTimeout(m), m = void 0, !p.value || n.restoringFocus.value || n.open.value || S)
133
- return;
134
- const e = te(a.showDelay);
135
- e ? S = setTimeout(() => {
136
- S = void 0, l(!0);
137
- }, e) : l(!0);
138
- }
139
- function le() {
140
- return g || W || a.enterable !== !1 && V || c.value.has("focus") && M || a.enterable !== !1 && z;
142
+ )), l.value ? (r && (e ? F() : (n.close(!1, !0), a && ((W = O.value) != null && W.isConnected) && V())), r) : !1;
141
143
  }
142
- function U() {
143
- if (clearTimeout(S), S = void 0, clearTimeout(m), m = void 0, le() || !n.open.value) return;
144
- const e = () => {
145
- m = void 0, !le() && n.isTop() && l(!1);
146
- }, t = te(a.hideDelay);
147
- t ? m = setTimeout(e, t) : e();
144
+ function j() {
145
+ x == null || x.disconnect(), x = void 0;
148
146
  }
149
- function se() {
150
- c.value.has("hover") && (W = !0, re());
147
+ function X() {
148
+ j(), !(!n.open.value || !b.value || typeof ResizeObserver > "u") && (x = new ResizeObserver(n.schedule), x.observe(b.value), c.value && x.observe(c.value));
151
149
  }
152
- function ce() {
153
- c.value.has("hover") && (W = !1, U());
154
- }
155
- function Ee() {
156
- a.enterable !== !1 && (V = !0, clearTimeout(m), m = void 0);
157
- }
158
- function Se() {
159
- V = !1, c.value.has("hover") && U();
160
- }
161
- function fe(e) {
162
- var t;
163
- (t = s.value) != null && t.contains(e.target) || n.restoringFocus.value || (M = !0, c.value.has("focus") && re());
164
- }
165
- function ve(e) {
166
- var u, o, r;
167
- if ((u = s.value) != null && u.contains(e.target)) return;
168
- const t = e.relatedTarget;
169
- if (!((o = T.value) != null && o.contains(t))) {
170
- if (M = !1, (r = s.value) != null && r.contains(t) && a.enterable !== !1) {
171
- z = !0;
172
- return;
173
- }
174
- (c.value.has("focus") || c.value.has("hover")) && U();
175
- }
176
- }
177
- function Ce() {
178
- a.enterable !== !1 && (z = !0);
179
- }
180
- function Fe(e) {
181
- var u, o;
182
- const t = e.relatedTarget;
183
- if (!((u = s.value) != null && u.contains(t))) {
184
- if (z = !1, (o = T.value) != null && o.contains(t)) {
185
- M = !0;
186
- return;
187
- }
188
- (c.value.has("focus") || c.value.has("hover")) && U();
189
- }
190
- }
191
- function de(e) {
192
- var t;
193
- (t = s.value) != null && t.contains(e.target) || !c.value.has("click") || !p.value || (g = n.open.value ? !g && (W && c.value.has("hover") || M && c.value.has("focus")) : !0, l(g));
194
- }
195
- function he(e) {
196
- var t;
197
- (t = s.value) != null && t.contains(e.target) || !c.value.has("contextmenu") || !p.value || (e.preventDefault(), g = !0, l(!0));
198
- }
199
- function me(e) {
200
- var u;
201
- if ((u = s.value) != null && u.contains(e.target) || !c.value.size || !p.value || e.defaultPrevented)
202
- return;
203
- const t = e.target;
204
- if (!t.closest('input,textarea,select,[contenteditable="true"]')) {
205
- if (e.key === "F10" && e.shiftKey && c.value.has("contextmenu")) {
206
- e.preventDefault(), g = !0, l(!0);
207
- return;
208
- }
209
- (a.triggerKeys ?? ["Enter", " "]).some(
210
- (o) => o === e.key || o === "Space" && e.key === " "
211
- ) && (c.value.has("click") && t.closest("button,a[href],input") || (e.preventDefault(), g = !n.open.value, l(g)));
212
- }
150
+ function H() {
151
+ o.reset(), o.clearAuto(), P.detach(), j(), document.removeEventListener("keydown", I, !0), n.close(!1, !0);
213
152
  }
214
- function ye(e) {
215
- return [...e.querySelectorAll(P)].filter(
216
- (t) => t.tabIndex >= 0 && !t.matches(":disabled") && !t.closest('[inert],[aria-hidden="true"]') && !!t.getClientRects().length && getComputedStyle(t).visibility !== "hidden"
217
- );
218
- }
219
- function Re(e) {
220
- const t = h.value, u = ye(document).filter((O) => {
221
- var K;
222
- return !((K = s.value) != null && K.contains(O));
223
- }), o = u.findIndex((O) => O === t || (t == null ? void 0 : t.contains(O))), r = o < 0 ? void 0 : u[o + (e ? -1 : 1)];
224
- return r == null || r.focus(), !!r;
225
- }
226
- async function Z(e) {
227
- var K, we;
228
- if (e.key !== "Tab" || v !== "popover" || !n.open.value || !n.isTop())
229
- return;
230
- const t = e.target, u = (K = s.value) == null ? void 0 : K.contains(t), o = (we = T.value) == null ? void 0 : we.contains(t);
231
- if (!u && !o) return;
232
- const r = s.value ? ye(s.value) : [];
233
- if (o && !e.shiftKey && a.enterable !== !1 && r.length) {
234
- e.preventDefault(), r[0].focus();
235
- return;
236
- }
237
- if (u && t !== (e.shiftKey ? r[0] : r.at(-1)) && r.length)
238
- return;
239
- e.preventDefault(), await l(!1) && (u && e.shiftKey ? Y() : Re(e.shiftKey) || Y());
240
- }
241
- function ge() {
242
- N();
243
- const e = te(a.autoClose);
244
- n.open.value && e && (B = setTimeout(() => {
245
- B = void 0, l(!1);
246
- }, e));
247
- }
248
- function _() {
249
- C == null || C.disconnect(), C = void 0;
250
- }
251
- function je() {
252
- _(), !(!n.open.value || !s.value || typeof ResizeObserver > "u") && (C = new ResizeObserver(n.schedule), C.observe(s.value), h.value && C.observe(h.value));
253
- }
254
- const be = {
255
- pointerenter: se,
256
- pointerleave: ce,
257
- focusin: fe,
258
- focusout: ve,
259
- click: de,
260
- contextmenu: he,
261
- keydown: me
262
- };
263
- let b;
264
- function xe() {
265
- if (!(!i || !b))
266
- if (v === "tooltip") {
267
- const e = n.open.value ? [b["aria-describedby"], R].filter(Boolean).join(" ") : b["aria-describedby"];
268
- e ? i.setAttribute("aria-describedby", e) : i.removeAttribute("aria-describedby");
269
- } else {
270
- i.setAttribute(
271
- "aria-haspopup",
272
- b["aria-haspopup"] ?? "dialog"
273
- ), i.setAttribute("aria-expanded", String(n.open.value));
274
- const e = n.open.value ? R : b["aria-controls"];
275
- e ? i.setAttribute("aria-controls", e) : i.removeAttribute("aria-controls");
276
- }
277
- }
278
- function pe() {
279
- if (i)
280
- for (const [e, t] of Object.entries(be))
281
- i.removeEventListener(e, t);
282
- if (i && b)
283
- for (const [e, t] of Object.entries(b))
284
- t === null ? i.removeAttribute(e) : i.setAttribute(e, t);
285
- b = void 0, i = void 0;
286
- }
287
- function G() {
288
- var e;
289
- if (pe(), !(!d.value || !w.value)) {
290
- if (i = h.value, i && ((e = E.value) != null && e.contains(i))) {
291
- i = void 0;
292
- return;
293
- }
294
- i && (b = Object.fromEntries(
295
- [
296
- "aria-describedby",
297
- "aria-controls",
298
- "aria-expanded",
299
- "aria-haspopup"
300
- ].map((t) => [t, i.getAttribute(t)])
301
- ), xe());
302
- for (const [t, u] of Object.entries(be))
303
- i == null || i.addEventListener(t, u);
304
- }
305
- }
306
- function J() {
307
- k(), N(), L(), pe(), _(), document.removeEventListener("keydown", Z, !0), n.close(!1, !0);
308
- }
309
- x(
310
- q.current,
153
+ f(
154
+ M.current,
311
155
  () => {
312
- j.value = !1, $();
156
+ w.value = !1, F();
313
157
  },
314
158
  { flush: "post" }
315
- ), x(
316
- [p, E, w],
159
+ ), f(
160
+ [R, g, d],
317
161
  () => {
318
- p.value || (k(), N(), L()), $(), G();
162
+ R.value || (o.reset(), o.clearAuto()), F(), T();
319
163
  },
320
164
  { flush: "post", immediate: !0 }
321
- ), x(
322
- () => y == null ? void 0 : y.value,
165
+ ), f(
166
+ () => s == null ? void 0 : s.value,
323
167
  (e) => {
324
- e === !1 && (j.value = !0, J());
168
+ e === !1 && (w.value = !0, H());
325
169
  },
326
170
  { flush: "sync" }
327
- ), x(() => a.autoClose, ge), x(
328
- [h, w],
171
+ ), f(() => t.autoClose, o.startAuto), f(
172
+ [c, d],
329
173
  () => {
330
- k(), L(), n.schedule(), G();
174
+ o.reset(), n.schedule(), T();
331
175
  },
332
176
  { flush: "post" }
333
- ), x(
334
- () => a.trigger,
177
+ ), f(
178
+ () => t.trigger,
335
179
  () => {
336
- k(), L();
180
+ o.reset();
337
181
  }
338
- ), x(
182
+ ), f(
339
183
  () => [
340
- a.placement,
341
- a.offset,
342
- a.autoAdjustOverflow,
343
- a.width,
344
- a.maxWidth,
345
- a.maxHeight,
346
- a.appendTo,
347
- a.arrowOffset
184
+ t.placement,
185
+ t.offset,
186
+ t.autoAdjustOverflow,
187
+ t.width,
188
+ t.maxWidth,
189
+ t.maxHeight,
190
+ t.appendTo,
191
+ t.arrowOffset
348
192
  ],
349
193
  n.schedule,
350
194
  { flush: "post" }
351
- ), x([n.open, s, h], je, { flush: "post" }), x(
195
+ ), f([n.open, b, c], X, { flush: "post" }), f(
352
196
  n.open,
353
197
  (e) => {
354
- I++, xe(), A("visibleChange", e), A("openChange", e), A(e ? "show" : "hide"), document.removeEventListener("keydown", Z, !0), e ? (X.value = !0, document.addEventListener("keydown", Z, !0), ge()) : (k(), N(), L(), _());
198
+ A++, P.syncAria(e), y("visibleChange", e), y("openChange", e), y(e ? "show" : "hide"), document.removeEventListener("keydown", I, !0), e ? (z.value = !0, document.addEventListener("keydown", I, !0), o.startAuto()) : (o.reset(), o.clearAuto(), j());
355
199
  },
356
200
  { flush: "sync" }
357
201
  );
358
- async function Me() {
359
- const e = I;
360
- await Te(), d.value && n.open.value && e === I && oe !== e && (oe = e, A("opened"));
202
+ async function Y() {
203
+ const e = A;
204
+ await G(), l.value && n.open.value && e === A && $ !== e && ($ = e, y("opened"));
361
205
  }
362
- async function ke() {
363
- const e = I;
364
- await Te(), d.value && !n.open.value && e === I && ie !== e && (ie = e, A("closed"));
206
+ async function Z() {
207
+ const e = A;
208
+ await G(), l.value && !n.open.value && e === A && K !== e && (K = e, y("closed"));
365
209
  }
366
- function Le() {
367
- j.value = !0, J();
368
- }
369
- Ve(() => {
370
- $(), G();
371
- }), Ne(() => {
372
- d.value = !0, G();
373
- }), $e(() => {
374
- d.value = !1, j.value = !0, J();
375
- }), Ue(() => {
376
- d.value = !1, J();
210
+ function _() {
211
+ w.value = !0, H();
212
+ }
213
+ ie(() => {
214
+ F(), T();
215
+ }), se(() => {
216
+ l.value = !0, T();
217
+ }), ve(() => {
218
+ l.value = !1, w.value = !0, H();
219
+ }), fe(() => {
220
+ l.value = !1, H();
377
221
  });
378
- const De = f(
379
- () => n.open.value || a.forceRender || a.destroyOnHide === !1 && X.value
380
- ), He = f(() => {
381
- const e = (a.effect ?? (v === "tooltip" ? "dark" : "light")) === "dark";
222
+ const ee = u(
223
+ () => n.open.value || t.forceRender || t.destroyOnHide === !1 && z.value
224
+ ), te = u(() => {
225
+ const e = (t.effect ?? (i === "tooltip" ? "dark" : "light")) === "dark";
382
226
  return {
383
- "--hys-ui-popup-surface": a.color || (e ? "#172744" : "var(--hys-ui-surface,var(--hys-ui-theme-surface))"),
384
- "--hys-ui-popup-color": a.textColor || (e ? "#fff" : "var(--hys-ui-text,var(--hys-ui-theme-text))"),
385
- "--hys-ui-popup-border": a.color || (e ? "#172744" : "var(--hys-ui-border,var(--hys-ui-theme-border))")
227
+ "--hys-ui-popup-surface": t.color || (e ? "#172744" : "var(--hys-ui-surface,var(--hys-ui-theme-surface))"),
228
+ "--hys-ui-popup-color": t.textColor || (e ? "#fff" : "var(--hys-ui-text,var(--hys-ui-theme-text))"),
229
+ "--hys-ui-popup-border": t.color || (e ? "#172744" : "var(--hys-ui-border,var(--hys-ui-theme-border))")
386
230
  };
387
- }), Ie = f(() => ({
388
- ...a.overlayStyle,
231
+ }), ne = u(() => ({
232
+ ...t.overlayStyle,
389
233
  ...n.style.value,
390
- ...He.value,
234
+ ...te.value,
391
235
  overflow: "visible",
392
- maxWidth: `min(${ee(a.maxWidth) ?? (v === "tooltip" ? "320px" : "360px")},calc(100vw - 20px))`,
393
- minWidth: a.width !== void 0 ? "0" : void 0
394
- })), We = f(() => ({
395
- ...a.contentStyle,
396
- maxHeight: a.maxHeight !== void 0 ? `min(${ee(a.maxHeight)},calc(100vh - 20px))` : "calc(100vh - 20px)"
397
- })), ze = f(() => ({
236
+ maxWidth: `min(${q(t.maxWidth) ?? (i === "tooltip" ? "320px" : "360px")},calc(100vw - 20px))`,
237
+ minWidth: t.width !== void 0 ? "0" : void 0
238
+ })), ae = u(() => ({
239
+ ...t.contentStyle,
240
+ maxHeight: t.maxHeight !== void 0 ? `min(${q(t.maxHeight)},calc(100vh - 20px))` : "calc(100vh - 20px)"
241
+ })), oe = u(() => ({
398
242
  open: n.open.value,
399
- show: () => l(!0),
400
- close: () => l(!1),
401
- toggle: () => l(!n.open.value),
243
+ show: () => v(!0),
244
+ close: () => v(!1),
245
+ toggle: () => v(!n.open.value),
402
246
  updatePosition: n.schedule
403
- })), Ke = f(() => ({
404
- tabindex: w.value ? -1 : H.value ? void 0 : Q.value ? -1 : a.triggerTabindex ?? 0,
405
- role: v === "popover" && !H.value && !w.value ? "button" : void 0,
406
- "aria-disabled": !H.value && Q.value || void 0,
407
- ...H.value ? {} : v === "tooltip" ? { "aria-describedby": n.open.value ? R : void 0 } : {
408
- "aria-controls": n.open.value ? R : void 0,
247
+ })), ue = u(() => ({
248
+ tabindex: d.value ? -1 : S.value ? void 0 : k.value ? -1 : t.triggerTabindex ?? 0,
249
+ role: i === "popover" && !S.value && !d.value ? "button" : void 0,
250
+ "aria-disabled": !S.value && k.value || void 0,
251
+ ...S.value ? {} : i === "tooltip" ? { "aria-describedby": n.open.value ? E : void 0 } : {
252
+ "aria-controls": n.open.value ? E : void 0,
409
253
  "aria-expanded": n.open.value,
410
254
  "aria-haspopup": "dialog"
411
255
  }
412
256
  }));
413
257
  return {
414
- wrapper: E,
415
- referenceElement: F,
416
- panel: s,
417
- actualReference: h,
418
- nativeReference: H,
419
- id: R,
420
- titleId: Oe,
258
+ wrapper: g,
259
+ referenceElement: p,
260
+ panel: b,
261
+ actualReference: c,
262
+ nativeReference: S,
263
+ id: E,
264
+ titleId: J,
421
265
  open: n.open,
422
266
  placement: n.placement,
423
- active: f(() => d.value && (y == null ? void 0 : y.value) !== !1),
424
- mounted: De,
425
- teleportTo: ne,
426
- arrowStyle: ue,
427
- style: Ie,
428
- contentStyle: We,
429
- scope: ze,
430
- wrapperAttrs: Ke,
431
- pointerEnter: se,
432
- pointerLeave: ce,
433
- panelEnter: Ee,
434
- panelLeave: Se,
435
- focusIn: fe,
436
- focusOut: ve,
437
- panelFocusIn: Ce,
438
- panelFocusOut: Fe,
439
- click: de,
440
- contextmenu: he,
441
- key: me,
442
- afterEnter: Me,
443
- afterLeave: ke,
444
- inactive: Le,
445
- request: l,
446
- show: () => l(!0),
447
- hide: () => l(!1),
448
- toggle: () => l(!n.open.value),
267
+ active: u(() => l.value && (s == null ? void 0 : s.value) !== !1),
268
+ mounted: ee,
269
+ teleportTo: D,
270
+ arrowStyle: N,
271
+ style: ne,
272
+ contentStyle: ae,
273
+ scope: oe,
274
+ wrapperAttrs: ue,
275
+ ...h,
276
+ afterEnter: Y,
277
+ afterLeave: Z,
278
+ inactive: _,
279
+ request: v,
280
+ show: () => v(!0),
281
+ hide: () => v(!1),
282
+ toggle: () => v(!n.open.value),
449
283
  updatePosition: n.schedule,
450
284
  focus: () => {
451
285
  var e;
452
- return (e = T.value) == null ? void 0 : e.focus();
286
+ return (e = O.value) == null ? void 0 : e.focus();
453
287
  }
454
288
  };
455
289
  }
456
290
  export {
457
- at as usePopupSurface
291
+ Se as usePopupSurface
458
292
  };