hys-ui 0.4.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.
- package/CHANGELOG.md +13 -0
- package/dist/components/HysAnimatedNumber/HysAnimatedNumber.vue.js +3 -3
- package/dist/components/HysAnimatedNumber/HysAnimatedNumber2.vue.js +440 -119
- package/dist/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas.vue.js +7 -0
- package/dist/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas2.vue.js +166 -0
- package/dist/components/HysAnimatedNumber/NumberDigits/NumberDigits.vue.js +7 -0
- package/dist/components/HysAnimatedNumber/NumberDigits/NumberDigits2.vue.js +105 -0
- package/dist/components/HysAnimatedNumber/animation/digital.js +186 -0
- package/dist/components/HysAnimatedNumber/animation/morph.js +110 -0
- package/dist/components/HysAnimatedNumber/animation/paint.js +34 -0
- package/dist/components/HysAnimatedNumber/animation/particles.js +51 -0
- package/dist/components/HysAnimatedNumber/animation/paths.js +165 -0
- package/dist/components/HysAnimatedNumber/animation/physics.js +66 -0
- package/dist/components/HysAnimatedNumber/animation/render.js +89 -0
- package/dist/components/HysAnimatedNumber/animation/reveal.js +125 -0
- package/dist/components/HysAnimatedNumber/animation/rolling.js +66 -0
- package/dist/components/HysAnimatedNumber/animation/scenarios.js +217 -0
- package/dist/components/HysAnimatedNumber/animation/spatial.js +112 -0
- package/dist/components/HysAnimatedNumber/useNumberCountdown.js +58 -0
- package/dist/components/HysAnimatedNumber/useNumberVisuals.js +60 -0
- package/dist/components/HysDrawer/HysDrawer.vue.js +1 -1
- package/dist/components/HysDrawer/HysDrawer2.vue.js +2 -2
- package/dist/components/HysFormItem/HysFormItem.vue.js +1 -1
- package/dist/components/HysFormItem/HysFormItem2.vue.js +231 -229
- package/dist/components/HysInput/HysInput.vue.js +2 -2
- package/dist/components/HysInput/HysInput2.vue.js +327 -274
- package/dist/components/HysModal/HysModal.vue.js +2 -2
- package/dist/components/HysModal/HysModal2.vue.js +38 -38
- package/dist/components/HysSearch/HysSearch.vue.js +2 -2
- package/dist/components/HysSortableList/HysSortableList.vue.js +2 -2
- package/dist/components/HysSortableList/HysSortableList2.vue.js +498 -129
- package/dist/components/HysSortableList/SortableGhost/SortableGhost.vue.js +7 -0
- package/dist/components/HysSortableList/SortableGhost/SortableGhost2.vue.js +43 -0
- package/dist/components/HysSortableList/SortableGhost/useSortGhost.js +54 -0
- package/dist/components/HysSortableList/geometry.js +230 -0
- package/dist/components/HysSortableList/model.js +254 -0
- package/dist/components/HysSortableList/transactions.js +281 -0
- package/dist/components/HysSortableList/useSortDrag.js +270 -0
- package/dist/components/HysSortableList/useSortKeyboard.js +72 -0
- package/dist/components/HysSortableList/useSortWindow.js +144 -0
- package/dist/components/HysTextarea/HysTextarea.vue.js +56 -32
- package/dist/components/HysToast/HysToast.vue.js +3 -3
- package/dist/components/HysToast/HysToast2.vue.js +379 -107
- package/dist/components/HysToast/ToastViewport/ToastViewport.vue.js +7 -0
- package/dist/components/HysToast/ToastViewport/ToastViewport2.vue.js +211 -0
- package/dist/components/HysToast/ToastViewport/useToastStackDisclosure.js +71 -0
- package/dist/components/HysToast/toastPresentation.js +98 -0
- package/dist/components/HysToast/useToastActions.js +62 -0
- package/dist/components/HysToast/useToastSwipe.js +48 -0
- package/dist/components/HysToast/useToastTimer.js +90 -0
- package/dist/composables/animatedNumberDigits.js +106 -0
- package/dist/composables/animatedNumberFormat.js +222 -0
- package/dist/composables/animatedNumberTiming.js +66 -0
- package/dist/composables/numberAnimation.js +72 -0
- package/dist/composables/numberAnimationCatalog.js +301 -0
- package/dist/composables/numberAnimationSequence.js +45 -0
- package/dist/composables/popupReferenceBinding.js +41 -0
- package/dist/composables/textInput.js +23 -14
- package/dist/composables/toastEscape.js +18 -10
- package/dist/composables/toastQueue.js +276 -0
- package/dist/composables/toastQueueModel.js +86 -0
- package/dist/composables/toastTasks.js +58 -0
- package/dist/composables/useHysAnimatedNumber.js +264 -0
- package/dist/composables/useHysNumberAnimationGroup.js +23 -0
- package/dist/composables/useHysToast.js +117 -135
- package/dist/composables/usePopupSurface.js +190 -356
- package/dist/composables/usePopupSurfaceInteractions.js +172 -0
- package/dist/composables/useTextareaSize.js +62 -46
- package/dist/index.js +125 -111
- package/dist/style.css +1 -1
- package/dist/types/components/HysAnimatedNumber/HysAnimatedNumber.vue.d.ts +88 -49
- package/dist/types/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas.vue.d.ts +19 -0
- package/dist/types/components/HysAnimatedNumber/NumberDigits/NumberDigits.vue.d.ts +31 -0
- package/dist/types/components/HysAnimatedNumber/animation/digital.d.ts +3 -0
- package/dist/types/components/HysAnimatedNumber/animation/morph.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/animation/paint.d.ts +44 -0
- package/dist/types/components/HysAnimatedNumber/animation/particles.d.ts +5 -0
- package/dist/types/components/HysAnimatedNumber/animation/paths.d.ts +12 -0
- package/dist/types/components/HysAnimatedNumber/animation/physics.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/animation/render.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/animation/reveal.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/animation/rolling.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/animation/scenarios.d.ts +4 -0
- package/dist/types/components/HysAnimatedNumber/animation/spatial.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/useNumberCountdown.d.ts +8 -0
- package/dist/types/components/HysAnimatedNumber/useNumberVisuals.d.ts +12 -0
- package/dist/types/components/HysAutocomplete/HysAutocomplete.vue.d.ts +11 -2
- package/dist/types/components/HysAvatarGroup/HysAvatarGroup.vue.d.ts +2 -2
- package/dist/types/components/HysCard/HysCard.vue.d.ts +1 -1
- package/dist/types/components/HysCascader/HysCascader.vue.d.ts +3 -3
- package/dist/types/components/HysCascader/HysCascaderColumn.vue.d.ts +2 -2
- package/dist/types/components/HysColorPicker/HysColorPicker.vue.d.ts +2 -2
- package/dist/types/components/HysDatePicker/HysDatePicker.vue.d.ts +3 -3
- package/dist/types/components/HysDatePicker/HysDatePickerControl.vue.d.ts +5 -5
- package/dist/types/components/HysDateRangePicker/HysDateRangePicker.vue.d.ts +3 -3
- package/dist/types/components/HysDrawer/HysDrawer.vue.d.ts +1 -1
- package/dist/types/components/HysFormItem/HysFormItem.vue.d.ts +1 -1
- package/dist/types/components/HysGantt/HysGantt.vue.d.ts +1 -1
- package/dist/types/components/HysInput/HysInput.vue.d.ts +13 -1
- package/dist/types/components/HysModal/HysModal.vue.d.ts +1 -1
- package/dist/types/components/HysNumberInput/HysNumberInput.vue.d.ts +2 -2
- package/dist/types/components/HysPopover/HysPopover.vue.d.ts +1 -1
- package/dist/types/components/HysSearch/HysSearch.vue.d.ts +1 -1
- package/dist/types/components/HysSkeleton/HysSkeleton.vue.d.ts +2 -2
- package/dist/types/components/HysSortableList/HysSortableList.vue.d.ts +48 -25
- package/dist/types/components/HysSortableList/SortableGhost/SortableGhost.vue.d.ts +31 -0
- package/dist/types/components/HysSortableList/SortableGhost/useSortGhost.d.ts +23 -0
- package/dist/types/components/HysSortableList/geometry.d.ts +35 -0
- package/dist/types/components/HysSortableList/model.d.ts +61 -0
- package/dist/types/components/HysSortableList/sortableList.d.ts +151 -0
- package/dist/types/components/HysSortableList/transactions.d.ts +10 -0
- package/dist/types/components/HysSortableList/useSortDrag.d.ts +25 -0
- package/dist/types/components/HysSortableList/useSortKeyboard.d.ts +17 -0
- package/dist/types/components/HysSortableList/useSortWindow.d.ts +16 -0
- package/dist/types/components/HysSteps/HysSteps.vue.d.ts +1 -1
- package/dist/types/components/HysTabs/HysTabs.vue.d.ts +1 -1
- package/dist/types/components/HysTagInput/HysTagInput.vue.d.ts +1 -1
- package/dist/types/components/HysTextarea/HysTextarea.vue.d.ts +13 -2
- package/dist/types/components/HysToast/HysToast.vue.d.ts +44 -46
- package/dist/types/components/HysToast/ToastViewport/ToastViewport.vue.d.ts +25 -0
- package/dist/types/components/HysToast/ToastViewport/useToastStackDisclosure.d.ts +16 -0
- package/dist/types/components/HysToast/toastPresentation.d.ts +8 -0
- package/dist/types/components/HysToast/toastTypes.d.ts +212 -0
- package/dist/types/components/HysToast/useToastActions.d.ts +18 -0
- package/dist/types/components/HysToast/useToastSwipe.d.ts +11 -0
- package/dist/types/components/HysToast/useToastTimer.d.ts +22 -0
- package/dist/types/components/HysTooltip/HysTooltip.vue.d.ts +1 -1
- package/dist/types/components/HysTour/HysTour.vue.d.ts +1 -1
- package/dist/types/components/HysTreeSelect/HysTreeSelect.vue.d.ts +3 -3
- package/dist/types/components/HysUpload/HysUpload.vue.d.ts +2 -2
- package/dist/types/composables/animatedNumber.d.ts +220 -0
- package/dist/types/composables/animatedNumberDigits.d.ts +32 -0
- package/dist/types/composables/animatedNumberFormat.d.ts +16 -0
- package/dist/types/composables/animatedNumberTiming.d.ts +21 -0
- package/dist/types/composables/drawer.d.ts +1 -1
- package/dist/types/composables/numberAnimation.d.ts +29 -0
- package/dist/types/composables/numberAnimationCatalog.d.ts +58 -0
- package/dist/types/composables/numberAnimationSequence.d.ts +13 -0
- package/dist/types/composables/popupReferenceBinding.d.ts +9 -0
- package/dist/types/composables/textInput.d.ts +39 -4
- package/dist/types/composables/toastEscape.d.ts +1 -1
- package/dist/types/composables/toastQueue.d.ts +121 -0
- package/dist/types/composables/toastQueueModel.d.ts +116 -0
- package/dist/types/composables/toastTasks.d.ts +2 -0
- package/dist/types/composables/useHysAnimatedNumber.d.ts +37 -0
- package/dist/types/composables/useHysNumberAnimationGroup.d.ts +4 -0
- package/dist/types/composables/useHysToast.d.ts +4 -48
- package/dist/types/composables/usePopupSurface.d.ts +20 -20
- package/dist/types/composables/usePopupSurfaceInteractions.d.ts +33 -0
- package/dist/types/composables/useTextareaSize.d.ts +5 -2
- package/dist/types/index.d.ts +15 -6
- package/package.json +1 -1
|
@@ -1,57 +1,59 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { useHysControlState as
|
|
3
|
-
import { useChoiceModel as
|
|
4
|
-
import { overlayOwnerKey as
|
|
5
|
-
import { useFloating as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
|
13
|
+
return t.open ?? t.modelValue;
|
|
12
14
|
}
|
|
13
15
|
},
|
|
14
|
-
() =>
|
|
15
|
-
),
|
|
16
|
-
() =>
|
|
17
|
-
),
|
|
18
|
-
() => typeof
|
|
19
|
-
),
|
|
20
|
-
const e =
|
|
21
|
-
return e instanceof HTMLElement ? e : (e == null ? void 0 : e.contextElement) ??
|
|
22
|
-
}),
|
|
23
|
-
() => !!
|
|
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
|
|
26
|
-
var
|
|
27
|
-
const e =
|
|
28
|
-
(
|
|
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
|
|
32
|
+
function V() {
|
|
31
33
|
n.restoringFocus.value = !0;
|
|
32
34
|
try {
|
|
33
|
-
|
|
35
|
+
B();
|
|
34
36
|
} finally {
|
|
35
37
|
n.restoringFocus.value = !1;
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
|
-
const
|
|
39
|
-
const e =
|
|
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: (
|
|
44
|
-
var
|
|
45
|
-
return !!((
|
|
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:
|
|
49
|
+
focus: B,
|
|
48
50
|
get isConnected() {
|
|
49
|
-
var
|
|
50
|
-
return ((
|
|
51
|
+
var a;
|
|
52
|
+
return ((a = c.value) == null ? void 0 : a.isConnected) ?? !!d.value;
|
|
51
53
|
}
|
|
52
54
|
};
|
|
53
|
-
}),
|
|
54
|
-
const e =
|
|
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
|
-
}),
|
|
64
|
-
function
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
[
|
|
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 =
|
|
72
|
+
const n = ye(O, b, {
|
|
71
73
|
get placement() {
|
|
72
|
-
return
|
|
74
|
+
return t.placement;
|
|
73
75
|
},
|
|
74
76
|
get gap() {
|
|
75
|
-
return
|
|
77
|
+
return t.offset ?? (i === "tooltip" ? 7 : 8);
|
|
76
78
|
},
|
|
77
79
|
get autoAdjustOverflow() {
|
|
78
|
-
return
|
|
80
|
+
return t.autoAdjustOverflow;
|
|
79
81
|
},
|
|
80
82
|
get closeOnEscape() {
|
|
81
|
-
return
|
|
83
|
+
return t.closeOnEscape;
|
|
82
84
|
},
|
|
83
85
|
get closeOnOutside() {
|
|
84
|
-
return
|
|
86
|
+
return t.closeOnOutside;
|
|
85
87
|
},
|
|
86
|
-
closeOnTab:
|
|
88
|
+
closeOnTab: i === "tooltip",
|
|
87
89
|
get strategy() {
|
|
88
|
-
return
|
|
90
|
+
return t.appendTo === !1 || D.value !== document.body ? "absolute" : "fixed";
|
|
89
91
|
},
|
|
90
|
-
width: () =>
|
|
91
|
-
maxWidth: () =>
|
|
92
|
-
zIndex: () =>
|
|
93
|
-
onPosition:
|
|
94
|
-
requestOpen(e,
|
|
95
|
-
return
|
|
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
|
-
|
|
99
|
-
|
|
100
|
-
const e =
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
-
|
|
124
|
+
let x, A = 0, $ = -1, K = -1;
|
|
125
|
+
function F() {
|
|
113
126
|
var e;
|
|
114
|
-
|
|
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
|
|
117
|
-
var
|
|
118
|
-
if (
|
|
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 ||
|
|
121
|
-
let
|
|
122
|
-
return
|
|
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
|
-
(
|
|
125
|
-
|
|
137
|
+
(U) => {
|
|
138
|
+
y("update:open", U), y("update:modelValue", U);
|
|
126
139
|
},
|
|
127
140
|
() => {
|
|
128
141
|
}
|
|
129
|
-
)),
|
|
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
|
|
143
|
-
|
|
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
|
|
150
|
-
|
|
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
|
|
153
|
-
|
|
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
|
-
|
|
215
|
-
|
|
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
|
-
|
|
156
|
+
w.value = !1, F();
|
|
313
157
|
},
|
|
314
158
|
{ flush: "post" }
|
|
315
|
-
),
|
|
316
|
-
[
|
|
159
|
+
), f(
|
|
160
|
+
[R, g, d],
|
|
317
161
|
() => {
|
|
318
|
-
|
|
162
|
+
R.value || (o.reset(), o.clearAuto()), F(), T();
|
|
319
163
|
},
|
|
320
164
|
{ flush: "post", immediate: !0 }
|
|
321
|
-
),
|
|
322
|
-
() =>
|
|
165
|
+
), f(
|
|
166
|
+
() => s == null ? void 0 : s.value,
|
|
323
167
|
(e) => {
|
|
324
|
-
e === !1 && (
|
|
168
|
+
e === !1 && (w.value = !0, H());
|
|
325
169
|
},
|
|
326
170
|
{ flush: "sync" }
|
|
327
|
-
),
|
|
328
|
-
[
|
|
171
|
+
), f(() => t.autoClose, o.startAuto), f(
|
|
172
|
+
[c, d],
|
|
329
173
|
() => {
|
|
330
|
-
|
|
174
|
+
o.reset(), n.schedule(), T();
|
|
331
175
|
},
|
|
332
176
|
{ flush: "post" }
|
|
333
|
-
),
|
|
334
|
-
() =>
|
|
177
|
+
), f(
|
|
178
|
+
() => t.trigger,
|
|
335
179
|
() => {
|
|
336
|
-
|
|
180
|
+
o.reset();
|
|
337
181
|
}
|
|
338
|
-
),
|
|
182
|
+
), f(
|
|
339
183
|
() => [
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
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
|
-
),
|
|
195
|
+
), f([n.open, b, c], X, { flush: "post" }), f(
|
|
352
196
|
n.open,
|
|
353
197
|
(e) => {
|
|
354
|
-
|
|
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
|
|
359
|
-
const e =
|
|
360
|
-
await
|
|
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
|
|
363
|
-
const e =
|
|
364
|
-
await
|
|
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
|
|
367
|
-
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
}),
|
|
372
|
-
|
|
373
|
-
}),
|
|
374
|
-
|
|
375
|
-
}),
|
|
376
|
-
|
|
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
|
|
379
|
-
() => n.open.value ||
|
|
380
|
-
),
|
|
381
|
-
const e = (
|
|
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":
|
|
384
|
-
"--hys-ui-popup-color":
|
|
385
|
-
"--hys-ui-popup-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
|
-
}),
|
|
388
|
-
...
|
|
231
|
+
}), ne = u(() => ({
|
|
232
|
+
...t.overlayStyle,
|
|
389
233
|
...n.style.value,
|
|
390
|
-
...
|
|
234
|
+
...te.value,
|
|
391
235
|
overflow: "visible",
|
|
392
|
-
maxWidth: `min(${
|
|
393
|
-
minWidth:
|
|
394
|
-
})),
|
|
395
|
-
...
|
|
396
|
-
maxHeight:
|
|
397
|
-
})),
|
|
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: () =>
|
|
400
|
-
close: () =>
|
|
401
|
-
toggle: () =>
|
|
243
|
+
show: () => v(!0),
|
|
244
|
+
close: () => v(!1),
|
|
245
|
+
toggle: () => v(!n.open.value),
|
|
402
246
|
updatePosition: n.schedule
|
|
403
|
-
})),
|
|
404
|
-
tabindex:
|
|
405
|
-
role:
|
|
406
|
-
"aria-disabled": !
|
|
407
|
-
...
|
|
408
|
-
"aria-controls": n.open.value ?
|
|
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:
|
|
415
|
-
referenceElement:
|
|
416
|
-
panel:
|
|
417
|
-
actualReference:
|
|
418
|
-
nativeReference:
|
|
419
|
-
id:
|
|
420
|
-
titleId:
|
|
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:
|
|
424
|
-
mounted:
|
|
425
|
-
teleportTo:
|
|
426
|
-
arrowStyle:
|
|
427
|
-
style:
|
|
428
|
-
contentStyle:
|
|
429
|
-
scope:
|
|
430
|
-
wrapperAttrs:
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
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 =
|
|
286
|
+
return (e = O.value) == null ? void 0 : e.focus();
|
|
453
287
|
}
|
|
454
288
|
};
|
|
455
289
|
}
|
|
456
290
|
export {
|
|
457
|
-
|
|
291
|
+
Se as usePopupSurface
|
|
458
292
|
};
|