hys-ui 0.2.0 → 0.3.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 +38 -0
- package/README.md +15 -1
- package/dist/components/HysAlert/HysAlert.vue.js +5 -54
- package/dist/components/HysAlert/HysAlert2.vue.js +159 -2
- package/dist/components/HysAutocomplete/HysAutocomplete.vue.js +2 -2
- package/dist/components/HysAutocomplete/HysAutocomplete2.vue.js +285 -273
- package/dist/components/HysAvatarGroup/HysAvatarGroup.vue.js +1 -1
- package/dist/components/HysAvatarGroup/HysAvatarGroup2.vue.js +102 -98
- package/dist/components/HysBreadcrumb/HysBreadcrumb.vue.js +1 -1
- package/dist/components/HysBreadcrumb/HysBreadcrumb2.vue.js +273 -59
- package/dist/components/HysCalendar/HysCalendar.vue.js +3 -3
- package/dist/components/HysCalendar/HysCalendar2.vue.js +237 -225
- package/dist/components/HysCascader/HysCascader.vue.js +2 -2
- package/dist/components/HysCascader/HysCascader2.vue.js +337 -324
- package/dist/components/HysColorPicker/HysColorPanel.vue.js +7 -0
- package/dist/components/HysColorPicker/HysColorPanel2.vue.js +238 -0
- package/dist/components/HysColorPicker/HysColorPicker.vue.js +2 -2
- package/dist/components/HysColorPicker/HysColorPicker2.vue.js +239 -217
- package/dist/components/HysCommandPalette/HysCommandPalette.vue.js +90 -76
- package/dist/components/HysContextMenu/HysContextMenu.vue.js +5 -89
- package/dist/components/HysContextMenu/HysContextMenu2.vue.js +247 -2
- package/dist/components/HysContextMenu/HysMenuPanel.vue.js +7 -0
- package/dist/components/HysContextMenu/HysMenuPanel2.vue.js +208 -0
- package/dist/components/HysContextMenu/HysMenuSlot.js +10 -0
- package/dist/components/HysDataGrid/HysDataGrid.vue.js +1 -1
- package/dist/components/HysDataGrid/HysDataGrid2.vue.js +1008 -559
- package/dist/components/HysDatePicker/HysDatePicker.vue.js +2 -0
- package/dist/components/HysDatePicker/HysDatePickerControl.vue.js +2 -2
- package/dist/components/HysDatePicker/HysDatePickerControl2.vue.js +539 -526
- package/dist/components/HysDateRangePicker/HysDateRangePicker.vue.js +5 -3
- package/dist/components/HysDrawer/HysDrawer.vue.js +1 -1
- package/dist/components/HysDrawer/HysDrawer2.vue.js +434 -84
- package/dist/components/HysEmpty/HysEmpty.vue.js +5 -41
- package/dist/components/HysEmpty/HysEmpty2.vue.js +181 -2
- package/dist/components/HysFormItem/HysFormItem.vue.js +2 -2
- package/dist/components/HysFormItem/HysFormItem2.vue.js +171 -164
- package/dist/components/HysGantt/HysGantt.vue.js +1 -1
- package/dist/components/HysGantt/HysGantt2.vue.js +810 -795
- package/dist/components/HysMention/HysMention.vue.js +1 -1
- package/dist/components/HysMention/HysMention2.vue.js +112 -100
- package/dist/components/HysModal/HysModal.vue.js +2 -2
- package/dist/components/HysModal/HysModal2.vue.js +490 -85
- package/dist/components/HysPopover/HysPopover.vue.js +5 -91
- package/dist/components/HysPopover/HysPopover2.vue.js +120 -2
- package/dist/components/HysProgress/HysProgress.vue.js +2 -2
- package/dist/components/HysProgress/HysProgress2.vue.js +319 -52
- package/dist/components/HysSelect/HysSelect.vue.js +2 -2
- package/dist/components/HysSelect/HysSelect2.vue.js +730 -594
- package/dist/components/HysSlider/HysSlider.vue.js +2 -2
- package/dist/components/HysSlider/HysSlider2.vue.js +192 -188
- package/dist/components/HysSlider/SliderTooltip.vue.js +2 -2
- package/dist/components/HysSlider/SliderTooltip2.vue.js +103 -89
- package/dist/components/HysTable/HysTable.vue.js +2 -2
- package/dist/components/HysTable/HysTable2.vue.js +389 -368
- package/dist/components/HysTagInput/HysTagInput.vue.js +5 -82
- package/dist/components/HysTagInput/HysTagInput2.vue.js +396 -2
- package/dist/components/HysTimeline/HysTimeline.vue.js +2 -2
- package/dist/components/HysTimeline/HysTimeline2.vue.js +243 -24
- package/dist/components/HysTooltip/HysTooltip.vue.js +5 -64
- package/dist/components/HysTooltip/HysTooltip2.vue.js +110 -2
- package/dist/components/HysTour/HysTour.vue.js +46 -42
- package/dist/components/HysTransfer/HysTransfer.vue.js +2 -2
- package/dist/components/HysTransfer/HysTransfer2.vue.js +237 -207
- package/dist/components/HysTransfer/HysTransferPanel.vue.js +1 -1
- package/dist/components/HysTransfer/HysTransferPanel2.vue.js +320 -271
- package/dist/components/HysTree/HysTree.vue.js +2 -2
- package/dist/components/HysTree/HysTree2.vue.js +195 -184
- package/dist/components/HysTreeSelect/HysTreeSelect.vue.js +4 -4
- package/dist/components/HysTreeSelect/HysTreeSelect2.vue.js +389 -377
- package/dist/components/HysUpload/HysUpload.vue.js +2 -2
- package/dist/components/HysUpload/HysUpload2.vue.js +459 -125
- package/dist/components/HysVirtualTable/HysVirtualTable.vue.js +5 -94
- package/dist/components/HysVirtualTable/HysVirtualTable2.vue.js +656 -2
- package/dist/composables/color.js +97 -0
- package/dist/composables/dataGrid.js +68 -0
- package/dist/composables/drawer.js +17 -0
- package/dist/composables/feedback.js +14 -0
- package/dist/composables/menu.js +96 -0
- package/dist/composables/modal.js +14 -0
- package/dist/composables/overlayManager.js +48 -18
- package/dist/composables/progress.js +94 -0
- package/dist/composables/tagInput.js +16 -0
- package/dist/composables/timeline.js +19 -0
- package/dist/composables/transfer.js +19 -17
- package/dist/composables/upload.js +55 -0
- package/dist/composables/uploadRequest.js +58 -0
- package/dist/composables/useAlert.js +124 -0
- package/dist/composables/useColorPicker.js +402 -0
- package/dist/composables/useContextMenu.js +514 -0
- package/dist/composables/useDataGridRemote.js +67 -0
- package/dist/composables/useDialog.js +86 -43
- package/dist/composables/useDrawerPush.js +33 -0
- package/dist/composables/useDrawerResize.js +221 -0
- package/dist/composables/useFloating.js +110 -76
- package/dist/composables/useHysModal.js +185 -0
- package/dist/composables/useModal.js +295 -0
- package/dist/composables/useModalInteraction.js +394 -0
- package/dist/composables/usePopupSurface.js +458 -0
- package/dist/composables/useTagInput.js +313 -0
- package/dist/composables/useTransferMotion.js +185 -0
- package/dist/composables/useUpload.js +472 -0
- package/dist/composables/useUploadModel.js +65 -0
- package/dist/composables/useUploadRequests.js +266 -0
- package/dist/composables/useVirtualTableLayout.js +277 -0
- package/dist/composables/virtualTable.js +43 -0
- package/dist/index.js +27 -24
- package/dist/internal/PopupReference.js +39 -0
- package/dist/internal/PopupSurfacePanel.vue.js +7 -0
- package/dist/internal/PopupSurfacePanel2.vue.js +92 -0
- package/dist/motion/PopupMotion.js +105 -0
- package/dist/motion/popup.js +10 -0
- package/dist/style.css +1 -1
- package/dist/types/components/HysAlert/HysAlert.vue.d.ts +32 -22
- package/dist/types/components/HysAutocomplete/HysAutocomplete.vue.d.ts +7 -7
- package/dist/types/components/HysAvatarGroup/HysAvatarGroup.vue.d.ts +6 -1
- package/dist/types/components/HysBadge/HysBadge.vue.d.ts +3 -3
- package/dist/types/components/HysBreadcrumb/HysBreadcrumb.vue.d.ts +54 -31
- package/dist/types/components/HysCalendar/HysCalendar.vue.d.ts +3 -2
- package/dist/types/components/HysCascader/HysCascader.vue.d.ts +7 -7
- package/dist/types/components/HysCascader/HysCascaderColumn.vue.d.ts +2 -2
- package/dist/types/components/HysColorPicker/HysColorPanel.vue.d.ts +58 -0
- package/dist/types/components/HysColorPicker/HysColorPicker.vue.d.ts +63 -10
- package/dist/types/components/HysCommandPalette/HysCommandPalette.vue.d.ts +2 -1
- package/dist/types/components/HysContextMenu/HysContextMenu.vue.d.ts +50 -34
- package/dist/types/components/HysContextMenu/HysMenuPanel.vue.d.ts +79 -0
- package/dist/types/components/HysContextMenu/HysMenuSlot.d.ts +8 -0
- package/dist/types/components/HysDataGrid/HysDataGrid.vue.d.ts +65 -118
- package/dist/types/components/HysDatePicker/HysDatePickerControl.vue.d.ts +1 -1
- package/dist/types/components/HysDrawer/HysDrawer.vue.d.ts +92 -35
- package/dist/types/components/HysEmpty/HysEmpty.vue.d.ts +24 -20
- package/dist/types/components/HysFileManager/HysFileManager.vue.d.ts +2 -2
- package/dist/types/components/HysGantt/HysGantt.vue.d.ts +2 -1
- package/dist/types/components/HysMention/HysMention.vue.d.ts +2 -1
- package/dist/types/components/HysModal/HysModal.vue.d.ts +111 -34
- package/dist/types/components/HysPopover/HysPopover.vue.d.ts +41 -29
- package/dist/types/components/HysProgress/HysProgress.vue.d.ts +18 -24
- package/dist/types/components/HysResizablePanel/HysResizablePanel.vue.d.ts +2 -2
- package/dist/types/components/HysSelect/HysSelect.vue.d.ts +13 -4
- package/dist/types/components/HysSlider/HysSlider.vue.d.ts +5 -4
- package/dist/types/components/HysSlider/SliderTooltip.vue.d.ts +3 -1
- package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +2 -2
- package/dist/types/components/HysTable/HysTable.vue.d.ts +4 -4
- package/dist/types/components/HysTabs/HysTabs.vue.d.ts +2 -2
- package/dist/types/components/HysTagInput/HysTagInput.vue.d.ts +47 -25
- package/dist/types/components/HysTimeline/HysTimeline.vue.d.ts +19 -32
- package/dist/types/components/HysTooltip/HysTooltip.vue.d.ts +39 -19
- package/dist/types/components/HysTour/HysTour.vue.d.ts +2 -1
- package/dist/types/components/HysTransfer/HysTransfer.vue.d.ts +2 -2
- package/dist/types/components/HysTransfer/HysTransferPanel.vue.d.ts +5 -3
- package/dist/types/components/HysTree/HysTree.vue.d.ts +2 -2
- package/dist/types/components/HysUpload/HysUpload.vue.d.ts +55 -67
- package/dist/types/components/HysVirtualTable/HysVirtualTable.vue.d.ts +71 -40
- package/dist/types/composables/autocomplete.d.ts +3 -0
- package/dist/types/composables/avatar.d.ts +3 -0
- package/dist/types/composables/cascader.d.ts +3 -0
- package/dist/types/composables/color.d.ts +97 -0
- package/dist/types/composables/dataGrid.d.ts +100 -0
- package/dist/types/composables/datePicker.d.ts +3 -0
- package/dist/types/composables/drawer.d.ts +102 -0
- package/dist/types/composables/feedback.d.ts +98 -0
- package/dist/types/composables/formContext.d.ts +2 -0
- package/dist/types/composables/menu.d.ts +183 -0
- package/dist/types/composables/modal.d.ts +183 -0
- package/dist/types/composables/overlayManager.d.ts +7 -3
- package/dist/types/composables/popupSurface.d.ts +83 -0
- package/dist/types/composables/progress.d.ts +92 -0
- package/dist/types/composables/selectOptions.d.ts +2 -0
- package/dist/types/composables/table.d.ts +3 -0
- package/dist/types/composables/tagInput.d.ts +96 -0
- package/dist/types/composables/timeline.d.ts +82 -0
- package/dist/types/composables/transfer.d.ts +7 -0
- package/dist/types/composables/tree.d.ts +3 -0
- package/dist/types/composables/treeSelect.d.ts +3 -0
- package/dist/types/composables/upload.d.ts +202 -0
- package/dist/types/composables/uploadRequest.d.ts +3 -0
- package/dist/types/composables/useAlert.d.ts +21 -0
- package/dist/types/composables/useCascader.d.ts +1 -1
- package/dist/types/composables/useColorPicker.d.ts +101 -0
- package/dist/types/composables/useContextMenu.d.ts +81 -0
- package/dist/types/composables/useDataGridRemote.d.ts +15 -0
- package/dist/types/composables/useDialog.d.ts +16 -3
- package/dist/types/composables/useDrawerPush.d.ts +6 -0
- package/dist/types/composables/useDrawerResize.d.ts +27 -0
- package/dist/types/composables/useFloating.d.ts +21 -2
- package/dist/types/composables/useHysModal.d.ts +44 -0
- package/dist/types/composables/useModal.d.ts +62 -0
- package/dist/types/composables/useModalInteraction.d.ts +27 -0
- package/dist/types/composables/usePopupSurface.d.ts +3341 -0
- package/dist/types/composables/useTagInput.d.ts +66 -0
- package/dist/types/composables/useTransferMotion.d.ts +36 -0
- package/dist/types/composables/useUpload.d.ts +94 -0
- package/dist/types/composables/useUploadModel.d.ts +14 -0
- package/dist/types/composables/useUploadRequests.d.ts +38 -0
- package/dist/types/composables/useVirtualTableLayout.d.ts +51 -0
- package/dist/types/composables/virtualTable.d.ts +126 -0
- package/dist/types/index.d.ts +17 -2
- package/dist/types/internal/PopupReference.d.ts +18 -0
- package/dist/types/internal/PopupSurfacePanel.vue.d.ts +37 -0
- package/dist/types/motion/PopupMotion.d.ts +59 -0
- package/dist/types/motion/popup.d.ts +12 -0
- package/package.json +1 -1
|
@@ -0,0 +1,458 @@
|
|
|
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(
|
|
9
|
+
{
|
|
10
|
+
get modelValue() {
|
|
11
|
+
return a.open ?? a.modelValue;
|
|
12
|
+
}
|
|
13
|
+
},
|
|
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))
|
|
24
|
+
);
|
|
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 });
|
|
29
|
+
}
|
|
30
|
+
function Y() {
|
|
31
|
+
n.restoringFocus.value = !0;
|
|
32
|
+
try {
|
|
33
|
+
ae();
|
|
34
|
+
} finally {
|
|
35
|
+
n.restoringFocus.value = !1;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const T = f(() => {
|
|
39
|
+
const e = w.value ?? F.value ?? E.value;
|
|
40
|
+
if (e)
|
|
41
|
+
return {
|
|
42
|
+
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));
|
|
46
|
+
},
|
|
47
|
+
focus: ae,
|
|
48
|
+
get isConnected() {
|
|
49
|
+
var t;
|
|
50
|
+
return ((t = h.value) == null ? void 0 : t.isConnected) ?? !!w.value;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}), ne = f(() => {
|
|
54
|
+
const e = a.appendTo;
|
|
55
|
+
if (e instanceof HTMLElement) return e;
|
|
56
|
+
if (typeof e == "string")
|
|
57
|
+
try {
|
|
58
|
+
return document.querySelector(e) ?? document.body;
|
|
59
|
+
} catch {
|
|
60
|
+
return document.body;
|
|
61
|
+
}
|
|
62
|
+
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"
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
const n = Xe(T, s, {
|
|
71
|
+
get placement() {
|
|
72
|
+
return a.placement;
|
|
73
|
+
},
|
|
74
|
+
get gap() {
|
|
75
|
+
return a.offset ?? (v === "tooltip" ? 7 : 8);
|
|
76
|
+
},
|
|
77
|
+
get autoAdjustOverflow() {
|
|
78
|
+
return a.autoAdjustOverflow;
|
|
79
|
+
},
|
|
80
|
+
get closeOnEscape() {
|
|
81
|
+
return a.closeOnEscape;
|
|
82
|
+
},
|
|
83
|
+
get closeOnOutside() {
|
|
84
|
+
return a.closeOnOutside;
|
|
85
|
+
},
|
|
86
|
+
closeOnTab: v === "tooltip",
|
|
87
|
+
get strategy() {
|
|
88
|
+
return a.appendTo === !1 || ne.value !== document.body ? "absolute" : "fixed";
|
|
89
|
+
},
|
|
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;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
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;
|
|
111
|
+
}
|
|
112
|
+
function $() {
|
|
113
|
+
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);
|
|
115
|
+
}
|
|
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)))
|
|
119
|
+
return !1;
|
|
120
|
+
e || L(), j.value = !1;
|
|
121
|
+
let u = Object.is(q.current.value, e);
|
|
122
|
+
return u || (u = await q.commit(
|
|
123
|
+
e,
|
|
124
|
+
(O) => {
|
|
125
|
+
A("update:open", O), A("update:modelValue", O);
|
|
126
|
+
},
|
|
127
|
+
() => {
|
|
128
|
+
}
|
|
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;
|
|
141
|
+
}
|
|
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();
|
|
148
|
+
}
|
|
149
|
+
function se() {
|
|
150
|
+
c.value.has("hover") && (W = !0, re());
|
|
151
|
+
}
|
|
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
|
+
}
|
|
213
|
+
}
|
|
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,
|
|
311
|
+
() => {
|
|
312
|
+
j.value = !1, $();
|
|
313
|
+
},
|
|
314
|
+
{ flush: "post" }
|
|
315
|
+
), x(
|
|
316
|
+
[p, E, w],
|
|
317
|
+
() => {
|
|
318
|
+
p.value || (k(), N(), L()), $(), G();
|
|
319
|
+
},
|
|
320
|
+
{ flush: "post", immediate: !0 }
|
|
321
|
+
), x(
|
|
322
|
+
() => y == null ? void 0 : y.value,
|
|
323
|
+
(e) => {
|
|
324
|
+
e === !1 && (j.value = !0, J());
|
|
325
|
+
},
|
|
326
|
+
{ flush: "sync" }
|
|
327
|
+
), x(() => a.autoClose, ge), x(
|
|
328
|
+
[h, w],
|
|
329
|
+
() => {
|
|
330
|
+
k(), L(), n.schedule(), G();
|
|
331
|
+
},
|
|
332
|
+
{ flush: "post" }
|
|
333
|
+
), x(
|
|
334
|
+
() => a.trigger,
|
|
335
|
+
() => {
|
|
336
|
+
k(), L();
|
|
337
|
+
}
|
|
338
|
+
), x(
|
|
339
|
+
() => [
|
|
340
|
+
a.placement,
|
|
341
|
+
a.offset,
|
|
342
|
+
a.autoAdjustOverflow,
|
|
343
|
+
a.width,
|
|
344
|
+
a.maxWidth,
|
|
345
|
+
a.maxHeight,
|
|
346
|
+
a.appendTo,
|
|
347
|
+
a.arrowOffset
|
|
348
|
+
],
|
|
349
|
+
n.schedule,
|
|
350
|
+
{ flush: "post" }
|
|
351
|
+
), x([n.open, s, h], je, { flush: "post" }), x(
|
|
352
|
+
n.open,
|
|
353
|
+
(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(), _());
|
|
355
|
+
},
|
|
356
|
+
{ flush: "sync" }
|
|
357
|
+
);
|
|
358
|
+
async function Me() {
|
|
359
|
+
const e = I;
|
|
360
|
+
await Te(), d.value && n.open.value && e === I && oe !== e && (oe = e, A("opened"));
|
|
361
|
+
}
|
|
362
|
+
async function ke() {
|
|
363
|
+
const e = I;
|
|
364
|
+
await Te(), d.value && !n.open.value && e === I && ie !== e && (ie = e, A("closed"));
|
|
365
|
+
}
|
|
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();
|
|
377
|
+
});
|
|
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";
|
|
382
|
+
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))")
|
|
386
|
+
};
|
|
387
|
+
}), Ie = f(() => ({
|
|
388
|
+
...a.overlayStyle,
|
|
389
|
+
...n.style.value,
|
|
390
|
+
...He.value,
|
|
391
|
+
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(() => ({
|
|
398
|
+
open: n.open.value,
|
|
399
|
+
show: () => l(!0),
|
|
400
|
+
close: () => l(!1),
|
|
401
|
+
toggle: () => l(!n.open.value),
|
|
402
|
+
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,
|
|
409
|
+
"aria-expanded": n.open.value,
|
|
410
|
+
"aria-haspopup": "dialog"
|
|
411
|
+
}
|
|
412
|
+
}));
|
|
413
|
+
return {
|
|
414
|
+
wrapper: E,
|
|
415
|
+
referenceElement: F,
|
|
416
|
+
panel: s,
|
|
417
|
+
actualReference: h,
|
|
418
|
+
nativeReference: H,
|
|
419
|
+
id: R,
|
|
420
|
+
titleId: Oe,
|
|
421
|
+
open: n.open,
|
|
422
|
+
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),
|
|
449
|
+
updatePosition: n.schedule,
|
|
450
|
+
focus: () => {
|
|
451
|
+
var e;
|
|
452
|
+
return (e = T.value) == null ? void 0 : e.focus();
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
export {
|
|
457
|
+
at as usePopupSurface
|
|
458
|
+
};
|