@pgcorp/ui-kit 0.14.0 → 0.15.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/README.md +330 -12
- package/dist/assets/src/components/layout/{SResizeHandle.vue_vue_type_style_index_0_scoped_13b9b27a_lang.css → SResizeHandle.vue_vue_type_style_index_0_scoped_dc65aba1_lang.css} +1 -1
- package/dist/assets/src/components/shared/_internal/SDialogSurface.css_vue_type_style_index_0_src_a108e8f1_scoped_a108e8f1_lang.css +2 -0
- package/dist/assets/src/components/shared/containers/{SCollapsiblePanel.css_vue_type_style_index_0_src_71824088_scoped_71824088_lang.css → SCollapsiblePanel.css_vue_type_style_index_0_src_db85261d_scoped_db85261d_lang.css} +1 -1
- package/dist/assets/src/components/shared/containers/{SOverlayHost.css_vue_type_style_index_0_src_8f9be94e_scoped_8f9be94e_lang.css → SOverlayHost.css_vue_type_style_index_0_src_09215628_scoped_09215628_lang.css} +1 -1
- package/dist/assets/src/components/shared/containers/{SPopover.css_vue_type_style_index_0_src_4091d007_scoped_4091d007_lang.css → SPopover.css_vue_type_style_index_0_src_a4f1f64a_scoped_a4f1f64a_lang.css} +1 -1
- package/dist/assets/src/components/shared/containers/SSidebarSection.css_vue_type_style_index_0_src_52396e42_scoped_52396e42_lang.css +2 -0
- package/dist/assets/src/components/shared/controls/SButton.css_vue_type_style_index_0_src_7a5acda9_scoped_7a5acda9_lang.css +1 -1
- package/dist/assets/src/components/shared/controls/SCheckbox.css_vue_type_style_index_0_src_2562f916_scoped_2562f916_lang.css +2 -0
- package/dist/assets/src/components/shared/controls/SCombobox.css_vue_type_style_index_0_src_d630c922_scoped_d630c922_lang.css +2 -0
- package/dist/assets/src/components/shared/controls/SContextMenu.css_vue_type_style_index_0_src_43b6e378_scoped_43b6e378_lang.css +1 -0
- package/dist/assets/src/components/shared/controls/{SDropdownMenu.css_vue_type_style_index_0_src_857e2649_scoped_857e2649_lang.css → SDropdownMenu.css_vue_type_style_index_0_src_40040ae5_scoped_40040ae5_lang.css} +1 -1
- package/dist/assets/src/components/shared/controls/{SMenuSurface.css_vue_type_style_index_0_src_84109ad9_scoped_84109ad9_lang.css → SMenuSurface.css_vue_type_style_index_0_src_d2b7d71b_scoped_d2b7d71b_lang.css} +1 -1
- package/dist/assets/src/components/shared/controls/SSelect.css_vue_type_style_index_0_src_d1ead6c0_scoped_d1ead6c0_lang.css +2 -0
- package/dist/assets/src/components/shared/data-display/SControlledToastViewport.css_vue_type_style_index_0_src_a69aa84b_scoped_a69aa84b_lang.css +2 -0
- package/dist/assets/src/components/shared/data-display/SScrollViewport.css_vue_type_style_index_0_src_d94fcf8c_scoped_d94fcf8c_lang.css +2 -0
- package/dist/assets/src/components/shared/data-display/STooltip.css_vue_type_style_index_0_src_true_lang.css +1 -1
- package/dist/assets/src/components/shared/data-display/_internal/STableFrame.css_vue_type_style_index_0_src_914bad28_scoped_914bad28_lang.css +2 -0
- package/dist/assets/src/components/shared/navigation/{SBottomNav.vue_vue_type_style_index_0_scoped_24be0f2b_lang.css → SBottomNav.vue_vue_type_style_index_0_scoped_68cf84b3_lang.css} +1 -1
- package/dist/src/components/layout/SResizeHandle.vue.js +2 -2
- package/dist/src/components/layout/SResizeHandle.vue_vue_type_script_setup_true_lang.js +4 -2
- package/dist/src/components/shared/_internal/SDialogSurface.vue.d.ts +9 -1
- package/dist/src/components/shared/_internal/SDialogSurface.vue.js +2 -2
- package/dist/src/components/shared/_internal/SDialogSurface.vue_vue_type_script_setup_true_lang.js +174 -82
- package/dist/src/components/shared/_internal/dialogSurface.d.ts +2 -0
- package/dist/src/components/shared/_internal/dialogSurface.js +30 -27
- package/dist/src/components/shared/_internal/dialogSurfaceMotion.d.ts +14 -0
- package/dist/src/components/shared/_internal/dialogSurfaceMotion.js +84 -0
- package/dist/src/components/shared/_internal/focusTrap.js +15 -13
- package/dist/src/components/shared/containers/SCollapsiblePanel.vue.d.ts +5 -0
- package/dist/src/components/shared/containers/SCollapsiblePanel.vue.js +2 -2
- package/dist/src/components/shared/containers/SCollapsiblePanel.vue_vue_type_script_setup_true_lang.js +123 -121
- package/dist/src/components/shared/containers/SDrawer.vue.d.ts +4 -4
- package/dist/src/components/shared/containers/SDrawer.vue.js +3 -6
- package/dist/src/components/shared/containers/SDrawer.vue_vue_type_script_setup_true_lang.js +104 -128
- package/dist/src/components/shared/containers/SModal.vue.d.ts +8 -8
- package/dist/src/components/shared/containers/SModal.vue.js +3 -6
- package/dist/src/components/shared/containers/SModal.vue_vue_type_script_setup_true_lang.js +87 -103
- package/dist/src/components/shared/containers/SOverlayHost.vue.js +2 -2
- package/dist/src/components/shared/containers/SOverlayHost.vue_vue_type_script_setup_true_lang.js +32 -31
- package/dist/src/components/shared/containers/SPanel.vue.d.ts +1 -1
- package/dist/src/components/shared/containers/SPopover.vue.js +2 -2
- package/dist/src/components/shared/containers/SPopover.vue_vue_type_script_setup_true_lang.js +225 -200
- package/dist/src/components/shared/containers/SSidebarSection.vue.js +2 -2
- package/dist/src/components/shared/containers/SSidebarSection.vue_vue_type_script_setup_true_lang.js +4 -3
- package/dist/src/components/shared/controls/SCheckbox.vue.js +2 -2
- package/dist/src/components/shared/controls/SCheckbox.vue_vue_type_script_setup_true_lang.js +13 -7
- package/dist/src/components/shared/controls/SCombobox.vue.js +2 -2
- package/dist/src/components/shared/controls/SCombobox.vue_vue_type_script_setup_true_lang.js +104 -94
- package/dist/src/components/shared/controls/SContextMenu.vue.js +2 -2
- package/dist/src/components/shared/controls/SContextMenu.vue_vue_type_script_setup_true_lang.js +86 -81
- package/dist/src/components/shared/controls/SDropdownMenu.vue.js +2 -2
- package/dist/src/components/shared/controls/SDropdownMenu.vue_vue_type_script_setup_true_lang.js +77 -72
- package/dist/src/components/shared/controls/SMenuSurface.vue.js +2 -2
- package/dist/src/components/shared/controls/SMenuSurface.vue_vue_type_script_setup_true_lang.js +81 -77
- package/dist/src/components/shared/controls/SSelect.vue.js +2 -2
- package/dist/src/components/shared/controls/SSelect.vue_vue_type_script_setup_true_lang.js +85 -77
- package/dist/src/components/shared/data-display/SControlledToastViewport.vue.js +2 -2
- package/dist/src/components/shared/data-display/SControlledToastViewport.vue_vue_type_script_setup_true_lang.js +58 -49
- package/dist/src/components/shared/data-display/SScrollViewport.vue.d.ts +10 -5
- package/dist/src/components/shared/data-display/SScrollViewport.vue.js +2 -2
- package/dist/src/components/shared/data-display/SScrollViewport.vue_vue_type_script_setup_true_lang.js +162 -111
- package/dist/src/components/shared/data-display/STooltip.vue_vue_type_script_setup_true_lang.js +276 -224
- package/dist/src/components/shared/data-display/_internal/STableFrame.vue.d.ts +3 -3
- package/dist/src/components/shared/data-display/_internal/STableFrame.vue.js +2 -2
- package/dist/src/components/shared/data-display/_internal/STableFrame.vue_vue_type_script_setup_true_lang.js +62 -46
- package/dist/src/components/shared/data-display/scrollViewport.d.ts +2 -0
- package/dist/src/components/shared/navigation/SBottomNav.vue.js +2 -2
- package/dist/src/components/shared/navigation/SBottomNav.vue_vue_type_script_setup_true_lang.js +3 -1
- package/dist/src/components/shared/navigation/STabList.vue.d.ts +1 -1
- package/dist/src/composables/useDialogOverlay.d.ts +12 -2
- package/dist/src/composables/useDialogOverlay.js +192 -119
- package/dist/src/internal/flatTree.d.ts +8 -0
- package/dist/src/internal/flatTree.js +23 -0
- package/dist/src/internal/focusNavigation.d.ts +3 -0
- package/dist/src/internal/focusNavigation.js +28 -15
- package/dist/src/internal/inertLease.d.ts +8 -0
- package/dist/src/internal/inertLease.js +33 -0
- package/dist/src/internal/layerStack.d.ts +40 -0
- package/dist/src/internal/layerStack.js +301 -94
- package/dist/src/internal/nativeFocus.d.ts +4 -0
- package/dist/src/internal/nativeFocus.js +12 -0
- package/dist/src/internal/overlayPortal.d.ts +17 -0
- package/dist/src/internal/overlayPortal.js +23 -0
- package/dist/src/internal/semanticSizing.d.ts +2 -2
- package/dist/src/internal/semanticSizing.js +2 -1
- package/dist/src/internal/useMenuLayer.d.ts +1 -0
- package/dist/src/internal/useMenuLayer.js +63 -57
- package/dist/src/internal/viewportModality.d.ts +27 -0
- package/dist/src/internal/viewportModality.js +132 -0
- package/dist/typography.js +17 -62
- package/docs/overlay-lifecycle.md +195 -0
- package/docs/public-api.md +141 -4
- package/docs/resize.md +34 -5
- package/docs/scroll-viewport.md +30 -10
- package/docs/theming.md +42 -8
- package/package.json +1 -1
- package/src/components/shared/_internal/SDialogSurface.css +185 -40
- package/src/components/shared/controls/SButton.css +0 -3
- package/src/components/shared/controls/SCheckbox.css +19 -7
- package/src/components/shared/data-display/SControlledToastViewport.css +2 -10
- package/src/components/shared/data-display/SScrollViewport.css +17 -1
- package/src/components/shared/data-display/STooltip.css +1 -1
- package/src/components/shared/data-display/_internal/STableFrame.css +1 -5
- package/dist/assets/src/components/shared/_internal/SDialogSurface.css_vue_type_style_index_0_src_0e58afdc_scoped_0e58afdc_lang.css +0 -2
- package/dist/assets/src/components/shared/containers/SDrawer.css_vue_type_style_index_0_src_61cf20dd_scoped_61cf20dd_lang.css +0 -2
- package/dist/assets/src/components/shared/containers/SModal.css_vue_type_style_index_0_src_42e1bd5f_scoped_42e1bd5f_lang.css +0 -2
- package/dist/assets/src/components/shared/containers/SSidebarSection.css_vue_type_style_index_0_src_21f71ae8_scoped_21f71ae8_lang.css +0 -2
- package/dist/assets/src/components/shared/controls/SCheckbox.css_vue_type_style_index_0_src_55d4826e_scoped_55d4826e_lang.css +0 -2
- package/dist/assets/src/components/shared/controls/SCombobox.css_vue_type_style_index_0_src_537f5744_scoped_537f5744_lang.css +0 -2
- package/dist/assets/src/components/shared/controls/SContextMenu.css_vue_type_style_index_0_src_03921269_scoped_03921269_lang.css +0 -1
- package/dist/assets/src/components/shared/controls/SSelect.css_vue_type_style_index_0_src_df3d6688_scoped_df3d6688_lang.css +0 -2
- package/dist/assets/src/components/shared/data-display/SControlledToastViewport.css_vue_type_style_index_0_src_5864b6c6_scoped_5864b6c6_lang.css +0 -2
- package/dist/assets/src/components/shared/data-display/SScrollViewport.css_vue_type_style_index_0_src_e5d11342_scoped_e5d11342_lang.css +0 -2
- package/dist/assets/src/components/shared/data-display/_internal/STableFrame.css_vue_type_style_index_0_src_52b5825e_scoped_52b5825e_lang.css +0 -2
- package/src/components/shared/containers/SDrawer.css +0 -87
- package/src/components/shared/containers/SModal.css +0 -27
package/dist/src/components/shared/controls/SContextMenu.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -6,9 +6,9 @@ import { useMenuLayer as i } from "../../../internal/useMenuLayer.js";
|
|
|
6
6
|
import a from "../_internal/SMenuLayer.vue.js";
|
|
7
7
|
import { validateSMenuEntries as o } from "./menu.js";
|
|
8
8
|
import s from "./SMenuSurface.vue.js";
|
|
9
|
-
import { Teleport as c, Transition as
|
|
9
|
+
import { Teleport as c, Transition as l, computed as u, createBlock as d, createCommentVNode as f, createElementBlock as ee, createVNode as p, defineComponent as m, mergeProps as te, nextTick as h, onBeforeUnmount as g, onUpdated as ne, openBlock as _, ref as v, renderSlot as re, unref as y, useId as ie, watch as b, watchEffect as x, withCtx as S } from "vue";
|
|
10
10
|
//#region src/components/shared/controls/SContextMenu.vue?vue&type=script&setup=true&lang.ts
|
|
11
|
-
var
|
|
11
|
+
var ae = ["data-layout"], C = /*@__PURE__*/ m({
|
|
12
12
|
inheritAttrs: !1,
|
|
13
13
|
__name: "SContextMenu",
|
|
14
14
|
props: {
|
|
@@ -21,57 +21,57 @@ var w = ["data-layout"], T = /*@__PURE__*/ m({
|
|
|
21
21
|
boundaryLayout: { default: "block" }
|
|
22
22
|
},
|
|
23
23
|
emits: ["before-open", "select"],
|
|
24
|
-
setup(m, { emit:
|
|
25
|
-
let
|
|
24
|
+
setup(m, { emit: C }) {
|
|
25
|
+
let w = m, T = C, E = n({
|
|
26
26
|
component: "SContextMenu",
|
|
27
27
|
owner: "interaction boundary root"
|
|
28
|
-
}),
|
|
28
|
+
}), D = t();
|
|
29
29
|
r({
|
|
30
30
|
owner: "SContextMenu",
|
|
31
|
-
active: () =>
|
|
31
|
+
active: () => w.enabled
|
|
32
32
|
});
|
|
33
|
-
let
|
|
33
|
+
let O = `s-context-menu-${ie()}`, k = v("first"), A = v(null), j = v(null), M = v(null), N = v(!1), P = u(() => j.value?.getElement() ?? null), F = null, { isOpen: I, portalTarget: L, position: R, availableSize: z, zIndex: B, open: V, close: H, closeForTab: U } = i(j, { onRequestDismiss: (e) => q(e) }), W = u(() => I.value && N.value ? O : void 0), G = u(() => w.enabled ? {
|
|
34
34
|
"aria-haspopup": "menu",
|
|
35
|
-
"aria-expanded":
|
|
35
|
+
"aria-expanded": I.value,
|
|
36
36
|
"aria-controls": W.value,
|
|
37
|
-
onKeydown:
|
|
38
|
-
} : {}), K =
|
|
37
|
+
onKeydown: ce
|
|
38
|
+
} : {}), K = u(() => w.enabled ? {
|
|
39
39
|
"aria-haspopup": "menu",
|
|
40
40
|
"aria-controls": W.value,
|
|
41
|
-
onKeydown:
|
|
41
|
+
onKeydown: se
|
|
42
42
|
} : {});
|
|
43
43
|
function q(e = "programmatic") {
|
|
44
|
-
let t =
|
|
45
|
-
|
|
44
|
+
let t = F;
|
|
45
|
+
F = null, t?.release(), N.value = !1, H(e);
|
|
46
46
|
}
|
|
47
|
-
let J = (t) =>
|
|
48
|
-
let e =
|
|
47
|
+
let J = (t) => F === t && w.enabled && D.value && L.value !== null && A.value === t.boundary && t.boundary.isConnected && t.target.isConnected && t.boundary.contains(t.target) && (!t.focusOwner || t.focusOwner.isConnected && e(t.focusOwner) === t.focusOwner), Y = () => {
|
|
48
|
+
let e = F;
|
|
49
49
|
e && !J(e) && q("outside");
|
|
50
|
-
},
|
|
51
|
-
if (await h(),
|
|
50
|
+
}, oe = async (e) => {
|
|
51
|
+
if (await h(), F !== e) return;
|
|
52
52
|
if (!J(e)) {
|
|
53
53
|
q("outside");
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
|
-
if (e.phase = "mounting",
|
|
57
|
-
if (!J(e) || !
|
|
56
|
+
if (e.phase = "mounting", k.value = e.initialFocus, await V(e.anchor, e.focusOwner), F !== e) return;
|
|
57
|
+
if (!J(e) || !I.value || !P.value?.isConnected) {
|
|
58
58
|
q("outside");
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
|
-
if (
|
|
62
|
-
if (!J(e) || !
|
|
61
|
+
if (N.value = !0, await h(), F !== e) return;
|
|
62
|
+
if (!J(e) || !I.value || !P.value?.isConnected) {
|
|
63
63
|
q("outside");
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
|
-
let t =
|
|
66
|
+
let t = M.value;
|
|
67
67
|
if (!t) throw q("outside"), Error("SContextMenu: current menu surface is unavailable after opening");
|
|
68
68
|
e.phase = "open", e.initialFocus === "last" ? t.focusLast() : t.focusFirst();
|
|
69
69
|
}, X = (e, t, n, r) => {
|
|
70
|
-
let i =
|
|
71
|
-
if (!
|
|
70
|
+
let i = A.value, a = e.target;
|
|
71
|
+
if (!D.value || L.value === null || !w.enabled || e.defaultPrevented || !i?.isConnected || !(a instanceof Node) || !a.isConnected || !i.contains(a) || P.value?.contains(a)) return;
|
|
72
72
|
q("outside");
|
|
73
73
|
let o = (e) => {
|
|
74
|
-
e.key === "Escape" &&
|
|
74
|
+
e.key === "Escape" && F === c && c.phase !== "open" && q("outside");
|
|
75
75
|
}, s = new MutationObserver(Y), c = {
|
|
76
76
|
boundary: i,
|
|
77
77
|
target: n && i.contains(n) ? n : a,
|
|
@@ -86,13 +86,13 @@ var w = ["data-layout"], T = /*@__PURE__*/ m({
|
|
|
86
86
|
if (s.observe(document.documentElement, {
|
|
87
87
|
childList: !0,
|
|
88
88
|
subtree: !0
|
|
89
|
-
}), window.addEventListener("keydown", o, !0),
|
|
90
|
-
|
|
89
|
+
}), window.addEventListener("keydown", o, !0), F = c, T("before-open", e), e.defaultPrevented) {
|
|
90
|
+
F === c && q("outside");
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
|
-
e.preventDefault(), e.stopPropagation(),
|
|
93
|
+
e.preventDefault(), e.stopPropagation(), F === c && oe(c);
|
|
94
94
|
}, Z = (e, t, n) => {
|
|
95
|
-
if (!
|
|
95
|
+
if (!w.enabled || e.defaultPrevented || e.isComposing) return;
|
|
96
96
|
let r = n ?? e.currentTarget;
|
|
97
97
|
if (!(r instanceof HTMLElement)) throw TypeError("SContextMenu: trigger keydown currentTarget must be an HTMLElement");
|
|
98
98
|
X(e, {
|
|
@@ -100,21 +100,21 @@ var w = ["data-layout"], T = /*@__PURE__*/ m({
|
|
|
100
100
|
element: r,
|
|
101
101
|
align: "left"
|
|
102
102
|
}, r, t);
|
|
103
|
-
}, Q = (e) => !e.altKey && !e.ctrlKey && !e.metaKey && (e.key === "ContextMenu" || e.key === "F10" && e.shiftKey),
|
|
103
|
+
}, Q = (e) => !e.altKey && !e.ctrlKey && !e.metaKey && (e.key === "ContextMenu" || e.key === "F10" && e.shiftKey), se = (e) => {
|
|
104
104
|
Q(e) && Z(e, "first");
|
|
105
|
-
},
|
|
105
|
+
}, ce = (e) => {
|
|
106
106
|
if (Q(e)) {
|
|
107
107
|
Z(e, "first");
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
|
-
(
|
|
111
|
-
},
|
|
112
|
-
if (!Q(t) || !
|
|
113
|
-
let n =
|
|
110
|
+
(w.trigger === "click" || w.trigger === "both") && (e.key === "ArrowDown" || e.key === "ArrowUp") && Z(e, e.key === "ArrowUp" ? "last" : "first");
|
|
111
|
+
}, le = (t) => {
|
|
112
|
+
if (!Q(t) || !w.enabled || t.defaultPrevented || t.isComposing) return;
|
|
113
|
+
let n = A.value, r = document.activeElement;
|
|
114
114
|
r instanceof HTMLElement && t.target === r && n?.contains(r) && r !== n && e(r, n) === r && Z(t, "first", r);
|
|
115
115
|
}, $ = (t) => {
|
|
116
|
-
if (!
|
|
117
|
-
let n = e(t.target,
|
|
116
|
+
if (!w.enabled || t.defaultPrevented) return;
|
|
117
|
+
let n = e(t.target, A.value), r = e(document.activeElement), i = n ?? (r && P.value?.contains(r) ? F?.focusOwner ?? null : r), a = t.clientX === 0 && t.clientY === 0 && t.detail === 0;
|
|
118
118
|
X(t, a && i ? {
|
|
119
119
|
type: "element",
|
|
120
120
|
element: i,
|
|
@@ -124,77 +124,82 @@ var w = ["data-layout"], T = /*@__PURE__*/ m({
|
|
|
124
124
|
x: t.clientX,
|
|
125
125
|
y: t.clientY
|
|
126
126
|
}, i, "first");
|
|
127
|
-
}, le = (e) => {
|
|
128
|
-
(E.trigger === "click" || E.trigger === "both") && $(e);
|
|
129
127
|
}, ue = (e) => {
|
|
130
|
-
(
|
|
128
|
+
(w.trigger === "click" || w.trigger === "both") && $(e);
|
|
129
|
+
}, de = (e) => {
|
|
130
|
+
(w.trigger === "contextmenu" || w.trigger === "both") && $(e);
|
|
131
131
|
};
|
|
132
|
-
|
|
132
|
+
b(() => w.enabled, (e) => {
|
|
133
133
|
e || q("programmatic");
|
|
134
|
-
}, { flush: "sync" }),
|
|
134
|
+
}, { flush: "sync" }), b(D, (e) => {
|
|
135
135
|
e || q("outside");
|
|
136
|
-
}, { flush: "sync" }),
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
136
|
+
}, { flush: "sync" }), b(L, (e) => {
|
|
137
|
+
e === null && q("outside");
|
|
138
|
+
}, { flush: "sync" }), b(I, (e) => {
|
|
139
|
+
if (e || (N.value = !1), e || !F || F.phase === "preparing") return;
|
|
140
|
+
let t = F;
|
|
141
|
+
F = null, t.release();
|
|
142
|
+
}, { flush: "sync" }), ne(Y), g(() => q("outside"));
|
|
143
|
+
let fe = (e, t) => {
|
|
144
|
+
e.disabled || (q("selection"), T("select", e, t));
|
|
143
145
|
};
|
|
144
|
-
return
|
|
145
|
-
if (o(
|
|
146
|
+
return x(() => {
|
|
147
|
+
if (o(w.items), typeof w.enabled != "boolean") throw TypeError("SContextMenu: enabled must be a boolean");
|
|
146
148
|
if (![
|
|
147
149
|
"contextmenu",
|
|
148
150
|
"click",
|
|
149
151
|
"both"
|
|
150
|
-
].includes(
|
|
152
|
+
].includes(w.trigger)) throw TypeError("SContextMenu: trigger must be 'contextmenu', 'click', or 'both'");
|
|
151
153
|
if (![
|
|
152
154
|
"block",
|
|
153
155
|
"inline",
|
|
154
156
|
"contents"
|
|
155
|
-
].includes(
|
|
156
|
-
}), (e, t) => (
|
|
157
|
+
].includes(w.boundaryLayout)) throw TypeError("SContextMenu: boundaryLayout must be 'block', 'inline', or 'contents'");
|
|
158
|
+
}), (e, t) => (_(), ee("div", te({
|
|
157
159
|
ref_key: "boundaryRef",
|
|
158
|
-
ref:
|
|
159
|
-
},
|
|
160
|
+
ref: A
|
|
161
|
+
}, y(E).bindings(), {
|
|
160
162
|
class: "s-context-menu-boundary",
|
|
161
163
|
"data-layout": m.boundaryLayout,
|
|
162
|
-
onClick:
|
|
163
|
-
onContextmenu:
|
|
164
|
-
onKeydown:
|
|
165
|
-
}), [
|
|
164
|
+
onClick: ue,
|
|
165
|
+
onContextmenu: de,
|
|
166
|
+
onKeydown: le
|
|
167
|
+
}), [re(e.$slots, "default", {
|
|
166
168
|
triggerProps: G.value,
|
|
167
169
|
textInputTriggerProps: K.value
|
|
168
|
-
}, void 0, !0), (
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
"
|
|
173
|
-
"
|
|
174
|
-
"
|
|
170
|
+
}, void 0, !0), y(L) ? (_(), d(c, {
|
|
171
|
+
key: 0,
|
|
172
|
+
to: y(L)
|
|
173
|
+
}, [p(l, {
|
|
174
|
+
"enter-active-class": "transition-transform ease-out duration-[var(--s-motion-fast)]",
|
|
175
|
+
"enter-from-class": "transform scale-95",
|
|
176
|
+
"enter-to-class": "transform scale-100",
|
|
177
|
+
"leave-active-class": "transition-transform ease-in duration-[var(--s-motion-instant)]",
|
|
178
|
+
"leave-from-class": "transform scale-100",
|
|
179
|
+
"leave-to-class": "transform scale-95"
|
|
175
180
|
}, {
|
|
176
|
-
default:
|
|
181
|
+
default: S(() => [y(I) ? (_(), d(a, {
|
|
177
182
|
key: 0,
|
|
178
183
|
ref_key: "layerRef",
|
|
179
|
-
ref:
|
|
184
|
+
ref: j,
|
|
180
185
|
kind: "context",
|
|
181
186
|
"landmark-label": "Контекстные действия",
|
|
182
|
-
position:
|
|
183
|
-
"available-size":
|
|
184
|
-
"z-index":
|
|
187
|
+
position: y(R),
|
|
188
|
+
"available-size": y(z),
|
|
189
|
+
"z-index": y(B)
|
|
185
190
|
}, {
|
|
186
|
-
default:
|
|
191
|
+
default: S(() => [p(s, {
|
|
187
192
|
ref_key: "menuSurfaceRef",
|
|
188
|
-
ref:
|
|
189
|
-
id:
|
|
193
|
+
ref: M,
|
|
194
|
+
id: O,
|
|
190
195
|
label: "Контекстные действия",
|
|
191
|
-
"initial-focus":
|
|
196
|
+
"initial-focus": k.value,
|
|
192
197
|
items: m.items,
|
|
193
198
|
onDismissTree: t[0] ||= (e) => q("outside"),
|
|
194
199
|
onEscape: t[1] ||= (e) => q("escape"),
|
|
195
200
|
onFocusExit: t[2] ||= (e) => q("outside"),
|
|
196
|
-
onSelect:
|
|
197
|
-
onTab:
|
|
201
|
+
onSelect: fe,
|
|
202
|
+
onTab: y(U)
|
|
198
203
|
}, null, 8, [
|
|
199
204
|
"initial-focus",
|
|
200
205
|
"items",
|
|
@@ -205,10 +210,10 @@ var w = ["data-layout"], T = /*@__PURE__*/ m({
|
|
|
205
210
|
"position",
|
|
206
211
|
"available-size",
|
|
207
212
|
"z-index"
|
|
208
|
-
])) :
|
|
213
|
+
])) : f("", !0)]),
|
|
209
214
|
_: 1
|
|
210
|
-
})]))], 16,
|
|
215
|
+
})], 8, ["to"])) : f("", !0)], 16, ae));
|
|
211
216
|
}
|
|
212
217
|
});
|
|
213
218
|
//#endregion
|
|
214
|
-
export {
|
|
219
|
+
export { C as default };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "../../../../assets/src/components/shared/controls/SDropdownMenu.
|
|
1
|
+
import "../../../../assets/src/components/shared/controls/SDropdownMenu.css_vue_type_style_index_0_src_40040ae5_scoped_40040ae5_lang.css";
|
|
2
2
|
import e from "../../../../_virtual/_plugin-vue_export-helper.js";
|
|
3
3
|
import t from "./SDropdownMenu.vue_vue_type_script_setup_true_lang.js";
|
|
4
4
|
/* empty css */
|
|
5
5
|
//#region src/components/shared/controls/SDropdownMenu.vue
|
|
6
|
-
var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-
|
|
6
|
+
var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-40040ae5"]]);
|
|
7
7
|
//#endregion
|
|
8
8
|
export { n as default };
|
package/dist/src/components/shared/controls/SDropdownMenu.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { validateBoolean as e, validateExactString as t } from "../../../internal/runtimeContract.js";
|
|
2
2
|
import { useUiKitLocale as n } from "../../../composables/useUiKitLocale.js";
|
|
3
|
-
import { useOwnedAttrs as
|
|
4
|
-
import
|
|
3
|
+
import { useOwnedAttrs as ee } from "../../../internal/ownedAttrs.js";
|
|
4
|
+
import r from "./SButton.vue.js";
|
|
5
5
|
import { useMenuLayer as i } from "../../../internal/useMenuLayer.js";
|
|
6
6
|
import a from "../_internal/SMenuLayer.vue.js";
|
|
7
7
|
import { validateSMenuEntries as o } from "./menu.js";
|
|
8
8
|
import s from "./SMenuSurface.vue.js";
|
|
9
|
-
import { Teleport as
|
|
9
|
+
import { Teleport as te, computed as c, createBlock as l, createCommentVNode as u, createElementBlock as d, createVNode as f, defineComponent as p, mergeProps as m, nextTick as h, onMounted as g, openBlock as _, ref as v, renderSlot as y, unref as b, useId as x, useSlots as ne, watch as S, watchEffect as re, withCtx as C } from "vue";
|
|
10
10
|
//#region src/components/shared/controls/SDropdownMenu.vue?vue&type=script&setup=true&lang.ts
|
|
11
|
-
var
|
|
11
|
+
var w = { class: "s-dropdown-menu" }, T = /*@__PURE__*/ p({
|
|
12
12
|
inheritAttrs: !1,
|
|
13
13
|
__name: "SDropdownMenu",
|
|
14
14
|
props: {
|
|
@@ -30,17 +30,17 @@ var ae = { class: "s-dropdown-menu" }, C = /*@__PURE__*/ p({
|
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
emits: ["select", "update:open"],
|
|
33
|
-
setup(p, { emit:
|
|
34
|
-
let
|
|
33
|
+
setup(p, { emit: T }) {
|
|
34
|
+
let E = p, { t: D } = n(), O = c(() => E.menuLabel ?? D("dialog.moreActions")), k = T, ie = ne(), A = ee({
|
|
35
35
|
component: "SDropdownMenu",
|
|
36
36
|
owner: "menu trigger"
|
|
37
|
-
}),
|
|
38
|
-
onRequestDismiss:
|
|
37
|
+
}), j = v(null), M = v(null), N = null, P = v(!1), F = !1, { isOpen: I, portalTarget: L, position: R, availableSize: z, zIndex: B, close: V, closeForTab: H, open: U } = i(j, {
|
|
38
|
+
onRequestDismiss: $,
|
|
39
39
|
onRetire: () => {
|
|
40
|
-
|
|
40
|
+
P.value = !0, k("update:open", !1);
|
|
41
41
|
}
|
|
42
|
-
}),
|
|
43
|
-
function
|
|
42
|
+
}), W = `s-dropdown-menu-${x()}`, G = v("first"), K = !!ie.default, q = c(() => E.open !== void 0), J = c(() => L.value !== null && !P.value && (q.value ? E.open === !0 : I.value));
|
|
43
|
+
function ae(e) {
|
|
44
44
|
if (e === null) return null;
|
|
45
45
|
if (e instanceof HTMLElement) return e;
|
|
46
46
|
let t = Reflect.get(e, "getElement");
|
|
@@ -49,110 +49,115 @@ var ae = { class: "s-dropdown-menu" }, C = /*@__PURE__*/ p({
|
|
|
49
49
|
if (!(n instanceof HTMLElement)) throw Error("SDropdownMenu: trigger leaf getElement() must return an HTMLElement");
|
|
50
50
|
return n;
|
|
51
51
|
}
|
|
52
|
-
let
|
|
53
|
-
if (e !== null &&
|
|
54
|
-
|
|
55
|
-
},
|
|
56
|
-
let e =
|
|
52
|
+
let oe = (e) => {
|
|
53
|
+
if (e !== null && N !== null && e !== N) throw Error("SDropdownMenu: trigger binding must belong to exactly one UI-kit leaf");
|
|
54
|
+
N = e;
|
|
55
|
+
}, Y = () => {
|
|
56
|
+
let e = A.bindings();
|
|
57
57
|
if (Object.prototype.hasOwnProperty.call(e, "onClick")) throw Error("SDropdownMenu: @click belongs to the typed triggerAttrs activation contract");
|
|
58
58
|
return {
|
|
59
59
|
...e,
|
|
60
|
-
ref:
|
|
60
|
+
ref: oe,
|
|
61
61
|
"aria-haspopup": "menu",
|
|
62
|
-
"aria-expanded":
|
|
63
|
-
"aria-controls":
|
|
64
|
-
onClick:
|
|
65
|
-
onKeydown:
|
|
62
|
+
"aria-expanded": J.value,
|
|
63
|
+
"aria-controls": W,
|
|
64
|
+
onClick: ce,
|
|
65
|
+
onKeydown: le
|
|
66
66
|
};
|
|
67
67
|
};
|
|
68
|
-
function
|
|
69
|
-
let t =
|
|
68
|
+
function X(e) {
|
|
69
|
+
let t = ae(N);
|
|
70
70
|
if (!t) throw Error("SDropdownMenu: expected exactly one trigger, received 0");
|
|
71
71
|
if (e?.currentTarget instanceof HTMLElement && e.currentTarget !== t) throw Error("SDropdownMenu: activation target does not match the registered trigger");
|
|
72
72
|
return t;
|
|
73
73
|
}
|
|
74
74
|
g(() => {
|
|
75
|
-
let e =
|
|
76
|
-
if (e.getAttribute("aria-haspopup") !== "menu" || e.getAttribute("aria-controls") !==
|
|
77
|
-
(
|
|
75
|
+
let e = X();
|
|
76
|
+
if (e.getAttribute("aria-haspopup") !== "menu" || e.getAttribute("aria-controls") !== W) throw Error("SDropdownMenu: expected exactly one trigger, received 0");
|
|
77
|
+
(q.value && E.open || !q.value && E.defaultOpen) && (L.value === null ? F = !0 : Z());
|
|
78
78
|
});
|
|
79
|
-
function
|
|
80
|
-
let t =
|
|
79
|
+
function se(e) {
|
|
80
|
+
let t = X(e), n = E.placement === "auto" ? void 0 : E.placement;
|
|
81
81
|
return {
|
|
82
82
|
anchor: {
|
|
83
83
|
type: "element",
|
|
84
84
|
element: t,
|
|
85
|
-
align:
|
|
85
|
+
align: E.align,
|
|
86
86
|
...n === void 0 ? {} : { placement: n }
|
|
87
87
|
},
|
|
88
88
|
trigger: t
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
|
-
async function
|
|
92
|
-
if (
|
|
93
|
-
let { anchor: t, trigger: n } =
|
|
94
|
-
await
|
|
95
|
-
}
|
|
96
|
-
function Z(e) {
|
|
97
|
-
N.value && W.value || (N.value = !1, !G.value && (D("update:open", !0), W.value || X(e)));
|
|
91
|
+
async function Z(e) {
|
|
92
|
+
if (P.value || L.value === null || (F = !1, I.value)) return;
|
|
93
|
+
let { anchor: t, trigger: n } = se(e);
|
|
94
|
+
await U(t, n);
|
|
98
95
|
}
|
|
99
96
|
function Q(e) {
|
|
100
|
-
(
|
|
97
|
+
L.value !== null && (P.value && q.value || (P.value = !1, !J.value && (k("update:open", !0), q.value || Z(e))));
|
|
101
98
|
}
|
|
102
99
|
function $(e) {
|
|
103
|
-
|
|
100
|
+
(J.value || I.value) && (k("update:open", !1), q.value || V(e));
|
|
101
|
+
}
|
|
102
|
+
function ce(e) {
|
|
103
|
+
J.value ? $("trigger") : (G.value = "first", Q(e));
|
|
104
104
|
}
|
|
105
|
-
async function
|
|
106
|
-
(e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), e.stopPropagation(),
|
|
105
|
+
async function le(e) {
|
|
106
|
+
(e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), e.stopPropagation(), G.value = e.key === "ArrowUp" ? "last" : "first", J.value || Q(e), await h(), await h(), I.value && (G.value === "last" ? M.value?.focusLast() : M.value?.focusFirst()));
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
e.disabled || (
|
|
108
|
+
function ue(e, t) {
|
|
109
|
+
e.disabled || (k("select", e, t), E.closeOnSelect && $("selection"));
|
|
110
110
|
}
|
|
111
|
-
function
|
|
112
|
-
|
|
111
|
+
function de(e) {
|
|
112
|
+
H(e);
|
|
113
113
|
}
|
|
114
|
-
return S(() =>
|
|
115
|
-
e !== void 0 && (e || (
|
|
116
|
-
}), S(
|
|
117
|
-
P.value &&
|
|
114
|
+
return S(() => E.open, (e) => {
|
|
115
|
+
e !== void 0 && (e || (F = !1), e || (P.value = !1), e && !I.value ? Z() : !e && I.value && V("programmatic"));
|
|
116
|
+
}), S(L, (e) => {
|
|
117
|
+
e === null || P.value || (F || q.value && E.open) && Z();
|
|
118
|
+
}, { flush: "post" }), S(() => [E.align, E.placement], () => {
|
|
119
|
+
I.value && (V("programmatic"), Z());
|
|
118
120
|
}), re(() => {
|
|
119
|
-
if (o(
|
|
120
|
-
t("SDropdownMenu", "align",
|
|
121
|
+
if (o(E.items), !O.value.trim()) throw TypeError("SDropdownMenu: menuLabel must be a non-empty string");
|
|
122
|
+
t("SDropdownMenu", "align", E.align, ["left", "right"]), t("SDropdownMenu", "placement", E.placement, [
|
|
121
123
|
"auto",
|
|
122
124
|
"bottom",
|
|
123
125
|
"top"
|
|
124
|
-
]), e("SDropdownMenu", "defaultOpen",
|
|
125
|
-
}), (e, t) => (_(), d("div",
|
|
126
|
+
]), e("SDropdownMenu", "defaultOpen", E.defaultOpen), e("SDropdownMenu", "closeOnSelect", E.closeOnSelect), E.open !== void 0 && e("SDropdownMenu", "open", E.open);
|
|
127
|
+
}), (e, t) => (_(), d("div", w, [b(K) ? y(e.$slots, "default", { triggerAttrs: Y() }, void 0, !0, 0) : (_(), l(r, m({ key: 1 }, Y(), {
|
|
126
128
|
label: "Опции",
|
|
127
129
|
disclosure: {
|
|
128
|
-
expanded:
|
|
129
|
-
controls:
|
|
130
|
+
expanded: J.value,
|
|
131
|
+
controls: W
|
|
130
132
|
},
|
|
131
133
|
severity: "secondary"
|
|
132
|
-
}), null, 16, ["disclosure"])), (
|
|
134
|
+
}), null, 16, ["disclosure"])), b(L) ? (_(), l(te, {
|
|
135
|
+
key: 2,
|
|
136
|
+
to: b(L)
|
|
137
|
+
}, [b(I) ? (_(), l(a, {
|
|
133
138
|
key: 0,
|
|
134
139
|
ref_key: "layerRef",
|
|
135
|
-
ref:
|
|
140
|
+
ref: j,
|
|
136
141
|
kind: "dropdown",
|
|
137
|
-
"landmark-label":
|
|
138
|
-
position:
|
|
139
|
-
"available-size":
|
|
140
|
-
"z-index":
|
|
142
|
+
"landmark-label": O.value,
|
|
143
|
+
position: b(R),
|
|
144
|
+
"available-size": b(z),
|
|
145
|
+
"z-index": b(B)
|
|
141
146
|
}, {
|
|
142
|
-
default:
|
|
147
|
+
default: C(() => [f(s, {
|
|
143
148
|
ref_key: "menuSurfaceRef",
|
|
144
|
-
ref:
|
|
145
|
-
id:
|
|
146
|
-
label:
|
|
149
|
+
ref: M,
|
|
150
|
+
id: W,
|
|
151
|
+
label: O.value,
|
|
147
152
|
density: "compact",
|
|
148
153
|
autofocus: "",
|
|
149
|
-
"initial-focus":
|
|
154
|
+
"initial-focus": G.value,
|
|
150
155
|
items: p.items,
|
|
151
|
-
onDismissTree: t[0] ||= (e) =>
|
|
152
|
-
onEscape: t[1] ||= (e) =>
|
|
153
|
-
onFocusExit: t[2] ||= (e) =>
|
|
154
|
-
onSelect:
|
|
155
|
-
onTab:
|
|
156
|
+
onDismissTree: t[0] ||= (e) => $("outside"),
|
|
157
|
+
onEscape: t[1] ||= (e) => $("escape"),
|
|
158
|
+
onFocusExit: t[2] ||= (e) => $("outside"),
|
|
159
|
+
onSelect: ue,
|
|
160
|
+
onTab: de
|
|
156
161
|
}, null, 8, [
|
|
157
162
|
"label",
|
|
158
163
|
"initial-focus",
|
|
@@ -164,8 +169,8 @@ var ae = { class: "s-dropdown-menu" }, C = /*@__PURE__*/ p({
|
|
|
164
169
|
"position",
|
|
165
170
|
"available-size",
|
|
166
171
|
"z-index"
|
|
167
|
-
])) :
|
|
172
|
+
])) : u("", !0)], 8, ["to"])) : u("", !0)]));
|
|
168
173
|
}
|
|
169
174
|
});
|
|
170
175
|
//#endregion
|
|
171
|
-
export {
|
|
176
|
+
export { T as default };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "../../../../assets/src/components/shared/controls/SMenuSurface.
|
|
1
|
+
import "../../../../assets/src/components/shared/controls/SMenuSurface.css_vue_type_style_index_0_src_d2b7d71b_scoped_d2b7d71b_lang.css";
|
|
2
2
|
import e from "../../../../_virtual/_plugin-vue_export-helper.js";
|
|
3
3
|
import t from "./SMenuSurface.vue_vue_type_script_setup_true_lang.js";
|
|
4
4
|
/* empty css */
|
|
5
5
|
//#region src/components/shared/controls/SMenuSurface.vue
|
|
6
|
-
var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-
|
|
6
|
+
var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-d2b7d71b"]]);
|
|
7
7
|
//#endregion
|
|
8
8
|
export { n as default };
|