@pgcorp/ui-kit 0.12.0 → 0.13.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 +62 -0
- package/dist/assets/src/components/shared/_internal/SDialogSurface.css_vue_type_style_index_0_src_d1b65adf_scoped_d1b65adf_lang.css +1 -1
- package/dist/assets/src/components/shared/_internal/SMenuItem.css_vue_type_style_index_0_src_af485607_scoped_af485607_lang.css +2 -0
- package/dist/assets/src/components/shared/containers/{SCollapsiblePanel.css_vue_type_style_index_0_src_4882f962_scoped_4882f962_lang.css → SCollapsiblePanel.css_vue_type_style_index_0_src_71824088_scoped_71824088_lang.css} +1 -1
- package/dist/assets/src/components/shared/containers/{SModal.css_vue_type_style_index_0_src_23373daf_scoped_23373daf_lang.css → SModal.css_vue_type_style_index_0_src_0dc51b74_scoped_0dc51b74_lang.css} +1 -1
- package/dist/assets/src/components/shared/controls/{SDropdownMenu.css_vue_type_style_index_0_src_b854a89e_scoped_b854a89e_lang.css → SDropdownMenu.css_vue_type_style_index_0_src_1ccb9efc_scoped_1ccb9efc_lang.css} +1 -1
- package/dist/assets/src/components/shared/controls/{SInputText.css_vue_type_style_index_0_src_a9c5f1aa_scoped_a9c5f1aa_lang.css → SInputText.css_vue_type_style_index_0_src_023c25d0_scoped_023c25d0_lang.css} +1 -1
- package/dist/assets/src/components/shared/controls/SMenuSurface.css_vue_type_style_index_0_src_ddcc5fbb_scoped_ddcc5fbb_lang.css +2 -0
- package/dist/src/components/shared/_internal/SMenuItem.vue.js +2 -2
- package/dist/src/components/shared/_internal/SMenuItem.vue_vue_type_script_setup_true_lang.js +88 -76
- package/dist/src/components/shared/_internal/dialogSurface.d.ts +1 -1
- package/dist/src/components/shared/_internal/dialogSurface.js +1 -0
- package/dist/src/components/shared/containers/SCollapsiblePanel.vue.d.ts +1 -1
- 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 +60 -58
- package/dist/src/components/shared/containers/SModal.vue.js +2 -2
- package/dist/src/components/shared/containers/SModal.vue_vue_type_script_setup_true_lang.js +43 -37
- package/dist/src/components/shared/controls/SDropdownMenu.vue.d.ts +15 -4
- 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 +98 -62
- package/dist/src/components/shared/controls/SInputText.vue.d.ts +2 -2
- package/dist/src/components/shared/controls/SInputText.vue.js +2 -2
- package/dist/src/components/shared/controls/SInputText.vue_vue_type_script_setup_true_lang.js +16 -25
- 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 +132 -110
- package/dist/src/components/shared/controls/STextarea.vue.d.ts +4 -0
- package/dist/src/components/shared/controls/STextarea.vue_vue_type_script_setup_true_lang.js +154 -147
- package/dist/src/components/shared/controls/menu.d.ts +9 -1
- package/dist/src/components/shared/controls/menu.js +43 -28
- package/dist/src/composables/useDialogOverlay.d.ts +1 -0
- package/dist/src/composables/useDialogOverlay.js +5 -2
- package/dist/src/internal/textLengthConstraints.d.ts +9 -0
- package/dist/src/internal/textLengthConstraints.js +18 -0
- package/dist/src/internal/useMenuLayer.d.ts +2 -1
- package/dist/src/internal/useMenuLayer.js +20 -14
- package/docs/public-api.md +14 -2
- package/package.json +1 -1
- package/src/components/shared/_internal/SDialogSurface.css +4 -0
- package/src/components/shared/_internal/SMenuItem.css +22 -1
- package/src/components/shared/controls/SMenuSurface.css +20 -0
- package/dist/assets/src/components/shared/_internal/SMenuItem.css_vue_type_style_index_0_src_e5bd192e_scoped_e5bd192e_lang.css +0 -2
- package/dist/assets/src/components/shared/controls/SMenuSurface.css_vue_type_style_index_0_src_bc7c7be4_scoped_bc7c7be4_lang.css +0 -2
|
@@ -2,7 +2,7 @@ import { useDisclosure as e } from "../../../composables/useDisclosure.js";
|
|
|
2
2
|
import { useOwnedAttrs as t } from "../../../internal/ownedAttrs.js";
|
|
3
3
|
import n from "../controls/SButton.vue.js";
|
|
4
4
|
import r from "../_internal/SDisclosureSummary.vue.js";
|
|
5
|
-
import { computed as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createVNode as c, defineComponent as l, mergeProps as u, nextTick as d, normalizeClass as f, normalizeStyle as ee, onBeforeUnmount as
|
|
5
|
+
import { computed as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createVNode as c, defineComponent as l, mergeProps as u, nextTick as d, normalizeClass as f, normalizeStyle as ee, onBeforeUnmount as te, onMounted as p, openBlock as m, ref as h, renderSlot as g, unref as _, useSlots as v, vShow as y, watch as b, withCtx as x, withDirectives as S } from "vue";
|
|
6
6
|
//#region src/components/shared/containers/SCollapsiblePanel.vue?vue&type=script&setup=true&lang.ts
|
|
7
7
|
var C = [
|
|
8
8
|
"data-density",
|
|
@@ -58,117 +58,118 @@ var C = [
|
|
|
58
58
|
},
|
|
59
59
|
emits: ["update:open"],
|
|
60
60
|
setup(l, { emit: O }) {
|
|
61
|
-
let k = l, ne =
|
|
61
|
+
let k = l, ne = v(), A = O, j = i(() => !!ne.actions), M = t({
|
|
62
62
|
component: "SCollapsiblePanel",
|
|
63
63
|
owner: "collapsible panel root"
|
|
64
|
-
}), N = i(() => k.density === "comfortable" ? "md" : "sm"), P = i(() => k.open ?? !1),
|
|
64
|
+
}), N = i(() => k.density === "comfortable" ? "md" : "sm"), P = i(() => k.density === "comfortable" ? "default" : "compact"), F = i(() => k.open ?? !1), I = e({
|
|
65
65
|
id: k.id,
|
|
66
|
-
open: k.open === void 0 ? void 0 :
|
|
66
|
+
open: k.open === void 0 ? void 0 : F,
|
|
67
67
|
defaultOpen: k.open === void 0 ? k.defaultOpen : void 0,
|
|
68
68
|
disabled: () => k.disabled,
|
|
69
69
|
onUpdate: (e) => A("update:open", e)
|
|
70
|
-
}), { isOpen:
|
|
70
|
+
}), { isOpen: L, triggerId: R, panelId: z } = I, B = h(!1), V = i(() => L.value || B.value), H = h(!k.lazy || k.defaultOpen || k.open === !0);
|
|
71
71
|
b(() => k.open, (e) => {
|
|
72
|
-
e && (
|
|
72
|
+
e && (H.value = !0);
|
|
73
73
|
});
|
|
74
|
-
function
|
|
74
|
+
function U() {
|
|
75
75
|
if (k.disabled) return;
|
|
76
76
|
if (k.noAnimation) {
|
|
77
|
-
|
|
77
|
+
I.toggle();
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
|
-
let e =
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
let U = g(null), W = g(null), G = g(null), K = null, q = null;
|
|
84
|
-
function J() {
|
|
85
|
-
q !== null && (window.cancelAnimationFrame(q), q = null);
|
|
80
|
+
let e = K.value, t = W.value;
|
|
81
|
+
B.value = !0, e?.classList.add("is-animating"), e?.classList.remove("is-opened"), t?.classList.add("is-animating"), t?.classList.remove("is-opened"), I.toggle();
|
|
86
82
|
}
|
|
83
|
+
let W = h(null), G = h(null), K = h(null), q = null, J = null;
|
|
87
84
|
function Y() {
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
J !== null && (window.cancelAnimationFrame(J), J = null);
|
|
86
|
+
}
|
|
87
|
+
function X() {
|
|
88
|
+
let e = W.value, t = G.value;
|
|
89
|
+
if (!e || !t || !L.value || !B.value) return;
|
|
90
90
|
let n = `${t.scrollHeight}px`;
|
|
91
91
|
e.style.maxHeight !== n && (e.style.maxHeight = n);
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
function re() {
|
|
94
|
+
Y(), J = window.requestAnimationFrame(() => {
|
|
95
|
+
J = null, X();
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
function Z() {
|
|
99
|
-
let e =
|
|
99
|
+
let e = W.value;
|
|
100
100
|
if (!e) return;
|
|
101
101
|
e.classList.remove("is-animating"), e.classList.add("is-opened"), e.style.overflow = "", e.style.maxHeight = "";
|
|
102
|
-
let t =
|
|
102
|
+
let t = K.value;
|
|
103
103
|
t && (t.classList.remove("is-animating"), t.classList.add("is-opened"));
|
|
104
104
|
}
|
|
105
105
|
function Q() {
|
|
106
|
-
let e =
|
|
106
|
+
let e = W.value;
|
|
107
107
|
if (!e) return;
|
|
108
108
|
e.classList.remove("is-animating"), e.classList.remove("is-opened"), e.style.maxHeight = "0px", e.style.overflow = "hidden";
|
|
109
|
-
let t =
|
|
109
|
+
let t = K.value;
|
|
110
110
|
t && (t.classList.remove("is-animating"), t.classList.remove("is-opened"));
|
|
111
111
|
}
|
|
112
112
|
async function $(e) {
|
|
113
|
-
e ? (await d(),
|
|
113
|
+
e ? (await d(), H.value = !0, Z()) : Q(), B.value = !1;
|
|
114
114
|
}
|
|
115
|
-
async function
|
|
116
|
-
let e =
|
|
115
|
+
async function ie() {
|
|
116
|
+
let e = W.value;
|
|
117
117
|
if (!e) return;
|
|
118
|
-
let t =
|
|
118
|
+
let t = K.value;
|
|
119
119
|
await d(), e.classList.remove("is-opened"), e.classList.add("is-animating"), t && (t.classList.add("is-animating"), t.classList.remove("is-opened")), e.style.overflow = "hidden", e.style.maxHeight = "0px", e.offsetHeight, e.style.maxHeight = e.scrollHeight + "px";
|
|
120
120
|
let n = () => {
|
|
121
|
-
e.removeEventListener("transitionend", n),
|
|
121
|
+
e.removeEventListener("transitionend", n), L.value && (Y(), e.style.maxHeight = "", e.style.overflow = "", e.classList.remove("is-animating"), e.classList.add("is-opened"), t && (t.classList.remove("is-animating"), t.classList.add("is-opened")), B.value = !1);
|
|
122
122
|
};
|
|
123
123
|
e.addEventListener("transitionend", n);
|
|
124
124
|
}
|
|
125
|
-
function
|
|
126
|
-
let e =
|
|
125
|
+
function ae() {
|
|
126
|
+
let e = W.value;
|
|
127
127
|
if (!e) return;
|
|
128
|
-
let t =
|
|
129
|
-
|
|
128
|
+
let t = K.value;
|
|
129
|
+
B.value = !0, e.classList.add("is-animating"), e.classList.remove("is-opened"), t && (t.classList.add("is-animating"), t.classList.remove("is-opened")), (e.style.maxHeight === "" || e.style.maxHeight === "none") && (e.style.maxHeight = e.scrollHeight + "px", e.offsetHeight), e.style.overflow = "hidden", e.style.maxHeight = "0px";
|
|
130
130
|
let n = () => {
|
|
131
|
-
e.removeEventListener("transitionend", n), !
|
|
131
|
+
e.removeEventListener("transitionend", n), !L.value && (Y(), e.classList.remove("is-animating"), t && t.classList.remove("is-animating"), B.value = !1);
|
|
132
132
|
};
|
|
133
133
|
e.addEventListener("transitionend", n);
|
|
134
134
|
}
|
|
135
|
-
return
|
|
136
|
-
let e =
|
|
135
|
+
return p(() => {
|
|
136
|
+
let e = W.value;
|
|
137
137
|
if (!e) return;
|
|
138
|
-
e.style.willChange = "max-height", k.noAnimation ? $(
|
|
139
|
-
let t =
|
|
140
|
-
!k.noAnimation && "ResizeObserver" in window && t && (
|
|
141
|
-
|
|
142
|
-
}),
|
|
143
|
-
}),
|
|
144
|
-
|
|
145
|
-
}), b(
|
|
138
|
+
e.style.willChange = "max-height", k.noAnimation ? $(L.value) : L.value ? Z() : Q();
|
|
139
|
+
let t = G.value;
|
|
140
|
+
!k.noAnimation && "ResizeObserver" in window && t && (q = new ResizeObserver(() => {
|
|
141
|
+
re();
|
|
142
|
+
}), q.observe(t));
|
|
143
|
+
}), te(() => {
|
|
144
|
+
Y(), q &&= (q.disconnect(), null);
|
|
145
|
+
}), b(L, (e) => {
|
|
146
146
|
if (k.noAnimation) {
|
|
147
147
|
$(e);
|
|
148
148
|
return;
|
|
149
149
|
}
|
|
150
|
-
e ?
|
|
151
|
-
}), (e, t) => (
|
|
150
|
+
e ? ie() : ae();
|
|
151
|
+
}), (e, t) => (m(), o("div", u({
|
|
152
152
|
class: "s-collapsible-panel",
|
|
153
153
|
ref_key: "rootEl",
|
|
154
|
-
ref:
|
|
154
|
+
ref: K,
|
|
155
155
|
"data-density": l.density,
|
|
156
156
|
"data-surface": l.surface,
|
|
157
157
|
"data-content-padding": l.contentPadding
|
|
158
|
-
},
|
|
159
|
-
id:
|
|
158
|
+
}, _(M).bindings()), [s("div", w, [s("div", T, [c(n, {
|
|
159
|
+
id: _(R),
|
|
160
160
|
appearance: l.headerVariant === "minimal" ? "ghost" : "soft",
|
|
161
161
|
severity: "secondary",
|
|
162
162
|
shape: "row",
|
|
163
163
|
size: N.value,
|
|
164
|
+
density: P.value,
|
|
164
165
|
width: "full",
|
|
165
166
|
"content-align": "between",
|
|
166
167
|
disabled: l.disabled,
|
|
167
168
|
disclosure: {
|
|
168
|
-
expanded:
|
|
169
|
-
controls:
|
|
169
|
+
expanded: _(L),
|
|
170
|
+
controls: _(z)
|
|
170
171
|
},
|
|
171
|
-
onClick:
|
|
172
|
+
onClick: U
|
|
172
173
|
}, {
|
|
173
174
|
default: x(() => [c(r, {
|
|
174
175
|
title: l.summary,
|
|
@@ -192,22 +193,23 @@ var C = [
|
|
|
192
193
|
"id",
|
|
193
194
|
"appearance",
|
|
194
195
|
"size",
|
|
196
|
+
"density",
|
|
195
197
|
"disabled",
|
|
196
198
|
"disclosure"
|
|
197
|
-
])]), j.value ? (
|
|
198
|
-
id:
|
|
199
|
-
"aria-labelledby":
|
|
199
|
+
])]), j.value ? (m(), o("div", E, [g(e.$slots, "actions", {}, void 0, !0)])) : a("", !0)]), S(s("div", {
|
|
200
|
+
id: _(z),
|
|
201
|
+
"aria-labelledby": _(R),
|
|
200
202
|
role: "region",
|
|
201
203
|
ref_key: "contentWrapEl",
|
|
202
|
-
ref:
|
|
204
|
+
ref: W,
|
|
203
205
|
class: f(["s-collapsible-panel-content w-full min-w-0", [{ "min-h-0 flex flex-col grow overflow-y-auto overflow-x-hidden": l.fill }, { "no-transition": l.noAnimation }]]),
|
|
204
|
-
"data-open":
|
|
206
|
+
"data-open": _(L),
|
|
205
207
|
style: ee({ ...l.noAnimation ? { transition: "none" } : {} })
|
|
206
208
|
}, [s("div", {
|
|
207
209
|
ref_key: "contentInnerEl",
|
|
208
|
-
ref:
|
|
210
|
+
ref: G,
|
|
209
211
|
class: "s-collapsible-panel-inner"
|
|
210
|
-
}, [
|
|
212
|
+
}, [H.value ? g(e.$slots, "default", {}, void 0, !0, 0) : a("", !0)], 512)], 14, D), [[y, V.value]])], 16, C));
|
|
211
213
|
}
|
|
212
214
|
});
|
|
213
215
|
//#endregion
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "../../../../assets/src/components/shared/containers/SModal.
|
|
1
|
+
import "../../../../assets/src/components/shared/containers/SModal.css_vue_type_style_index_0_src_0dc51b74_scoped_0dc51b74_lang.css";
|
|
2
2
|
import e from "../../../../_virtual/_plugin-vue_export-helper.js";
|
|
3
3
|
import t from "./SModal.vue_vue_type_script_setup_true_lang.js";
|
|
4
4
|
/* empty css */
|
|
5
5
|
//#region src/components/shared/containers/SModal.vue
|
|
6
|
-
var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-
|
|
6
|
+
var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-0dc51b74"]]);
|
|
7
7
|
//#endregion
|
|
8
8
|
export { n as default };
|
|
@@ -3,9 +3,9 @@ import { useUiKitLocale as t } from "../../../composables/useUiKitLocale.js";
|
|
|
3
3
|
import { useOwnedAttrs as n } from "../../../internal/ownedAttrs.js";
|
|
4
4
|
import { validateDialogSurfaceHeadingLevel as r } from "../_internal/dialogSurface.js";
|
|
5
5
|
import i from "../_internal/SDialogSurface.vue.js";
|
|
6
|
-
import { Teleport as a, Transition as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createSlots as f, createVNode as p, defineComponent as m, mergeProps as h, normalizeClass as g, normalizeStyle as _,
|
|
6
|
+
import { Teleport as a, Transition as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createSlots as f, createVNode as p, defineComponent as m, mergeProps as h, normalizeClass as g, normalizeStyle as _, onErrorCaptured as v, openBlock as y, renderSlot as b, toRef as x, unref as S, useId as C, withCtx as w } from "vue";
|
|
7
7
|
//#region src/components/shared/containers/SModal.vue?vue&type=script&setup=true&lang.ts
|
|
8
|
-
var
|
|
8
|
+
var T = /*@__PURE__*/ m({
|
|
9
9
|
inheritAttrs: !1,
|
|
10
10
|
__name: "SModal",
|
|
11
11
|
props: {
|
|
@@ -27,71 +27,77 @@ var C = /*@__PURE__*/ m({
|
|
|
27
27
|
headingLevel: { default: 2 }
|
|
28
28
|
},
|
|
29
29
|
emits: ["update:open", "opened"],
|
|
30
|
-
setup(m, { emit:
|
|
31
|
-
let
|
|
32
|
-
function
|
|
33
|
-
|
|
30
|
+
setup(m, { emit: T }) {
|
|
31
|
+
let E = m, { t: D } = t(), O = `s-modal-${C()}`, k = T;
|
|
32
|
+
function A() {
|
|
33
|
+
k("update:open", !1);
|
|
34
34
|
}
|
|
35
|
-
let
|
|
35
|
+
let j = s(() => E.fullScreen || E.layout === "mobile-fullscreen"), M = n({
|
|
36
36
|
component: "SModal",
|
|
37
37
|
owner: "modal dialog surface"
|
|
38
|
-
}),
|
|
39
|
-
|
|
40
|
-
let
|
|
38
|
+
}), N = s(() => E.ariaLabel ?? D("dialog.modal")), P = s(() => r("SModal", E.headingLevel));
|
|
39
|
+
P.value;
|
|
40
|
+
let F = s(() => ({
|
|
41
41
|
kind: "modal",
|
|
42
|
-
size:
|
|
43
|
-
fullscreen:
|
|
44
|
-
surface:
|
|
45
|
-
scrollBehavior:
|
|
46
|
-
})), { setPanelElement:
|
|
47
|
-
open:
|
|
48
|
-
closable:
|
|
49
|
-
requestClose:
|
|
50
|
-
opened: () =>
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
|
|
42
|
+
size: E.size,
|
|
43
|
+
fullscreen: j.value,
|
|
44
|
+
surface: E.surface,
|
|
45
|
+
scrollBehavior: E.scrollBehavior
|
|
46
|
+
})), { setPanelElement: I, backdropStyle: L, surfaceStyle: R, dispose: z } = e({
|
|
47
|
+
open: x(E, "open"),
|
|
48
|
+
closable: x(E, "closable"),
|
|
49
|
+
requestClose: A,
|
|
50
|
+
opened: () => k("opened")
|
|
51
|
+
}), B = () => {
|
|
52
|
+
if (typeof document < "u") for (let e of document.querySelectorAll("[data-s-modal-owner]")) e.dataset.sModalOwner === O && e.remove();
|
|
53
|
+
};
|
|
54
|
+
return v(() => {
|
|
55
|
+
z(), B(), queueMicrotask(B);
|
|
56
|
+
}), (e, t) => (y(), c(a, { to: "body" }, [p(o, { name: "s-modal-backdrop" }, {
|
|
57
|
+
default: w(() => [m.open ? (y(), u("div", {
|
|
54
58
|
key: 0,
|
|
55
59
|
class: "s-modal-backdrop",
|
|
56
|
-
|
|
60
|
+
"data-s-modal-owner": O,
|
|
61
|
+
style: _(S(L)),
|
|
57
62
|
"aria-hidden": "true"
|
|
58
63
|
}, null, 4)) : l("", !0)]),
|
|
59
64
|
_: 1
|
|
60
65
|
}), p(o, { name: "s-modal-panel" }, {
|
|
61
|
-
default:
|
|
66
|
+
default: w(() => [m.open ? (y(), u("div", {
|
|
62
67
|
key: 0,
|
|
63
68
|
class: "s-modal-container",
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
69
|
+
"data-s-modal-owner": O,
|
|
70
|
+
style: _(S(R))
|
|
71
|
+
}, [d("div", { class: g(["s-modal-panel-container", { "s-modal-panel-container--fullscreen": j.value }]) }, [p(i, h(S(M).bindings(), {
|
|
72
|
+
presentation: F.value,
|
|
67
73
|
title: m.title,
|
|
68
|
-
"accessible-name":
|
|
69
|
-
"heading-level":
|
|
74
|
+
"accessible-name": N.value,
|
|
75
|
+
"heading-level": P.value,
|
|
70
76
|
closable: m.closable,
|
|
71
|
-
"set-surface-element":
|
|
72
|
-
onRequestClose:
|
|
77
|
+
"set-surface-element": S(I),
|
|
78
|
+
onRequestClose: A
|
|
73
79
|
}), f({
|
|
74
|
-
default:
|
|
80
|
+
default: w(() => [b(e.$slots, "default", {}, void 0, !0)]),
|
|
75
81
|
_: 2
|
|
76
82
|
}, [
|
|
77
83
|
e.$slots.header ? {
|
|
78
84
|
name: "header",
|
|
79
|
-
fn:
|
|
85
|
+
fn: w(() => [b(e.$slots, "header", {}, void 0, !0)]),
|
|
80
86
|
key: "0"
|
|
81
87
|
} : void 0,
|
|
82
88
|
e.$slots.footer ? {
|
|
83
89
|
name: "footer",
|
|
84
|
-
fn:
|
|
90
|
+
fn: w(({ close: t }) => [b(e.$slots, "footer", { close: t }, void 0, !0)]),
|
|
85
91
|
key: "1"
|
|
86
92
|
} : void 0,
|
|
87
93
|
e.$slots["footer-start"] ? {
|
|
88
94
|
name: "footer-start",
|
|
89
|
-
fn:
|
|
95
|
+
fn: w(({ close: t }) => [b(e.$slots, "footer-start", { close: t }, void 0, !0)]),
|
|
90
96
|
key: "2"
|
|
91
97
|
} : void 0,
|
|
92
98
|
e.$slots["footer-end"] ? {
|
|
93
99
|
name: "footer-end",
|
|
94
|
-
fn:
|
|
100
|
+
fn: w(({ close: t }) => [b(e.$slots, "footer-end", { close: t }, void 0, !0)]),
|
|
95
101
|
key: "3"
|
|
96
102
|
} : void 0
|
|
97
103
|
]), 1040, [
|
|
@@ -107,4 +113,4 @@ var C = /*@__PURE__*/ m({
|
|
|
107
113
|
}
|
|
108
114
|
});
|
|
109
115
|
//#endregion
|
|
110
|
-
export {
|
|
116
|
+
export { T as default };
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { VNodeChild, VNodeRef } from 'vue';
|
|
2
2
|
import { OwnedAttributeBindings } from '../../../internal/ownedAttrs';
|
|
3
3
|
import { SMenuActivationEvent, SMenuEntry, SMenuSelectableEntry } from './menu';
|
|
4
|
-
type
|
|
4
|
+
export type SDropdownMenuPlacement = 'auto' | 'bottom' | 'top';
|
|
5
|
+
export interface Props {
|
|
5
6
|
items: readonly SMenuEntry[];
|
|
6
7
|
align?: 'left' | 'right';
|
|
7
8
|
menuLabel?: string;
|
|
8
|
-
|
|
9
|
+
open?: boolean;
|
|
10
|
+
defaultOpen?: boolean;
|
|
11
|
+
placement?: SDropdownMenuPlacement;
|
|
12
|
+
closeOnSelect?: boolean;
|
|
13
|
+
}
|
|
9
14
|
export type SDropdownMenuTriggerAttrs = OwnedAttributeBindings<'SDropdownMenu'> & {
|
|
10
15
|
readonly ref: VNodeRef;
|
|
11
16
|
readonly 'aria-haspopup': 'menu';
|
|
@@ -20,13 +25,19 @@ type __VLS_Slots = {
|
|
|
20
25
|
triggerAttrs: SDropdownMenuTriggerAttrs;
|
|
21
26
|
}) => VNodeChild;
|
|
22
27
|
};
|
|
23
|
-
declare const __VLS_base: import('vue').DefineComponent<
|
|
28
|
+
declare const __VLS_base: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
24
29
|
select: (entry: SMenuSelectableEntry, event: SMenuActivationEvent) => any;
|
|
25
|
-
|
|
30
|
+
"update:open": (value: boolean) => any;
|
|
31
|
+
}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
|
|
26
32
|
onSelect?: ((entry: SMenuSelectableEntry, event: SMenuActivationEvent) => any) | undefined;
|
|
33
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
27
34
|
}>, {
|
|
35
|
+
open: boolean;
|
|
28
36
|
align: "left" | "right";
|
|
37
|
+
placement: SDropdownMenuPlacement;
|
|
29
38
|
menuLabel: string;
|
|
39
|
+
defaultOpen: boolean;
|
|
40
|
+
closeOnSelect: boolean;
|
|
30
41
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
31
42
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
32
43
|
declare const _default: typeof __VLS_export;
|
|
@@ -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_1ccb9efc_scoped_1ccb9efc_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-1ccb9efc"]]);
|
|
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,11 +1,12 @@
|
|
|
1
1
|
import { useUiKitLocale as e } from "../../../composables/useUiKitLocale.js";
|
|
2
2
|
import { useOwnedAttrs as t } from "../../../internal/ownedAttrs.js";
|
|
3
|
-
import n from "
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
3
|
+
import { validateBoolean as n, validateExactString as r } from "../../../internal/runtimeContract.js";
|
|
4
|
+
import i from "./SButton.vue.js";
|
|
5
|
+
import { useMenuLayer as a } from "../../../internal/useMenuLayer.js";
|
|
6
|
+
import o from "../_internal/SMenuLayer.vue.js";
|
|
7
|
+
import { validateSMenuEntries as ee } from "./menu.js";
|
|
8
|
+
import s from "./SMenuSurface.vue.js";
|
|
9
|
+
import { Teleport as c, computed as l, createBlock as u, createCommentVNode as d, createElementBlock as f, createVNode as te, defineComponent as p, mergeProps as m, nextTick as h, onMounted as ne, openBlock as g, ref as _, renderSlot as v, unref as y, useId as b, useSlots as x, watch as S, watchEffect as C, withCtx as w } from "vue";
|
|
9
10
|
//#region src/components/shared/controls/SDropdownMenu.vue?vue&type=script&setup=true&lang.ts
|
|
10
11
|
var T = { class: "s-dropdown-menu" }, E = /*@__PURE__*/ p({
|
|
11
12
|
inheritAttrs: !1,
|
|
@@ -13,14 +14,27 @@ var T = { class: "s-dropdown-menu" }, E = /*@__PURE__*/ p({
|
|
|
13
14
|
props: {
|
|
14
15
|
items: {},
|
|
15
16
|
align: { default: "right" },
|
|
16
|
-
menuLabel: { default: void 0 }
|
|
17
|
+
menuLabel: { default: void 0 },
|
|
18
|
+
open: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: void 0
|
|
21
|
+
},
|
|
22
|
+
defaultOpen: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: !1
|
|
25
|
+
},
|
|
26
|
+
placement: { default: "auto" },
|
|
27
|
+
closeOnSelect: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: !0
|
|
30
|
+
}
|
|
17
31
|
},
|
|
18
|
-
emits: ["select"],
|
|
32
|
+
emits: ["select", "update:open"],
|
|
19
33
|
setup(p, { emit: E }) {
|
|
20
|
-
let D = p, { t:
|
|
34
|
+
let D = p, { t: re } = e(), O = l(() => D.menuLabel ?? re("dialog.moreActions")), k = E, A = x(), j = t({
|
|
21
35
|
component: "SDropdownMenu",
|
|
22
36
|
owner: "menu trigger"
|
|
23
|
-
}),
|
|
37
|
+
}), M = _(null), N = _(null), P = null, F = l(() => M.value?.getElement() ?? null), { isOpen: I, position: L, zIndex: R, close: z, closeForTab: B, open: V } = a(F, { onRequestDismiss: $ }), H = `s-dropdown-menu-${b()}`, U = _("first"), W = !!A.default, G = l(() => D.open !== void 0), K = l(() => G.value ? D.open === !0 : I.value);
|
|
24
38
|
function q(e) {
|
|
25
39
|
if (e === null) return null;
|
|
26
40
|
if (e instanceof HTMLElement) return e;
|
|
@@ -31,97 +45,119 @@ var T = { class: "s-dropdown-menu" }, E = /*@__PURE__*/ p({
|
|
|
31
45
|
return n;
|
|
32
46
|
}
|
|
33
47
|
let J = (e) => {
|
|
34
|
-
if (e !== null &&
|
|
35
|
-
|
|
48
|
+
if (e !== null && P !== null && e !== P) throw Error("SDropdownMenu: trigger binding must belong to exactly one UI-kit leaf");
|
|
49
|
+
P = e;
|
|
36
50
|
}, Y = () => {
|
|
37
|
-
let e =
|
|
51
|
+
let e = j.bindings();
|
|
38
52
|
if (Object.prototype.hasOwnProperty.call(e, "onClick")) throw Error("SDropdownMenu: @click belongs to the typed triggerAttrs activation contract");
|
|
39
53
|
return {
|
|
40
54
|
...e,
|
|
41
55
|
ref: J,
|
|
42
56
|
"aria-haspopup": "menu",
|
|
43
|
-
"aria-expanded":
|
|
44
|
-
"aria-controls":
|
|
45
|
-
onClick:
|
|
46
|
-
onKeydown:
|
|
57
|
+
"aria-expanded": K.value,
|
|
58
|
+
"aria-controls": H,
|
|
59
|
+
onClick: ae,
|
|
60
|
+
onKeydown: oe
|
|
47
61
|
};
|
|
48
62
|
};
|
|
49
63
|
function X(e) {
|
|
50
|
-
let t = q(
|
|
64
|
+
let t = q(P);
|
|
51
65
|
if (!t) throw Error("SDropdownMenu: expected exactly one trigger, received 0");
|
|
52
66
|
if (e?.currentTarget instanceof HTMLElement && e.currentTarget !== t) throw Error("SDropdownMenu: activation target does not match the registered trigger");
|
|
53
67
|
return t;
|
|
54
68
|
}
|
|
55
|
-
|
|
69
|
+
ne(() => {
|
|
56
70
|
let e = X();
|
|
57
|
-
if (e.getAttribute("aria-haspopup") !== "menu" || e.getAttribute("aria-controls") !==
|
|
71
|
+
if (e.getAttribute("aria-haspopup") !== "menu" || e.getAttribute("aria-controls") !== H) throw Error("SDropdownMenu: expected exactly one trigger, received 0");
|
|
72
|
+
(G.value && D.open || !G.value && D.defaultOpen) && Z();
|
|
58
73
|
});
|
|
59
|
-
function
|
|
60
|
-
let t = X(e);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
74
|
+
function ie(e) {
|
|
75
|
+
let t = X(e), n = D.placement === "auto" ? void 0 : D.placement;
|
|
76
|
+
return {
|
|
77
|
+
anchor: {
|
|
78
|
+
type: "element",
|
|
79
|
+
element: t,
|
|
80
|
+
align: D.align,
|
|
81
|
+
...n === void 0 ? {} : { placement: n }
|
|
82
|
+
},
|
|
83
|
+
trigger: t
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
async function Z(e) {
|
|
87
|
+
if (I.value) return;
|
|
88
|
+
let { anchor: t, trigger: n } = ie(e);
|
|
89
|
+
await V(t, n);
|
|
90
|
+
}
|
|
91
|
+
function Q(e) {
|
|
92
|
+
K.value || (k("update:open", !0), G.value || Z(e));
|
|
93
|
+
}
|
|
94
|
+
function $(e) {
|
|
95
|
+
(K.value || I.value) && (k("update:open", !1), G.value || z(e));
|
|
96
|
+
}
|
|
97
|
+
function ae(e) {
|
|
98
|
+
K.value ? $("trigger") : (U.value = "first", Q(e));
|
|
99
|
+
}
|
|
100
|
+
async function oe(e) {
|
|
101
|
+
(e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), e.stopPropagation(), U.value = e.key === "ArrowUp" ? "last" : "first", K.value || Q(e), await h(), await h(), I.value && (U.value === "last" ? N.value?.focusLast() : N.value?.focusFirst()));
|
|
66
102
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
e.preventDefault(), e.stopPropagation();
|
|
70
|
-
let t = X(e);
|
|
71
|
-
G.value = e.key === "ArrowUp" ? "last" : "first", L.value || await H({
|
|
72
|
-
type: "element",
|
|
73
|
-
element: t,
|
|
74
|
-
align: D.align
|
|
75
|
-
}, t), await h(), G.value === "last" ? P.value?.focusLast() : P.value?.focusFirst();
|
|
103
|
+
function se(e, t) {
|
|
104
|
+
e.disabled || (k("select", e, t), D.closeOnSelect && $("selection"));
|
|
76
105
|
}
|
|
77
|
-
function
|
|
78
|
-
|
|
106
|
+
function ce(e) {
|
|
107
|
+
B(e);
|
|
79
108
|
}
|
|
80
|
-
return
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
109
|
+
return S(() => D.open, (e) => {
|
|
110
|
+
e !== void 0 && (e && !I.value ? Z() : !e && I.value && z("programmatic"));
|
|
111
|
+
}), S(() => [D.align, D.placement], () => {
|
|
112
|
+
I.value && (z("programmatic"), Z());
|
|
113
|
+
}), C(() => {
|
|
114
|
+
if (ee(D.items), !O.value.trim()) throw TypeError("SDropdownMenu: menuLabel must be a non-empty string");
|
|
115
|
+
r("SDropdownMenu", "align", D.align, ["left", "right"]), r("SDropdownMenu", "placement", D.placement, [
|
|
116
|
+
"auto",
|
|
117
|
+
"bottom",
|
|
118
|
+
"top"
|
|
119
|
+
]), n("SDropdownMenu", "defaultOpen", D.defaultOpen), n("SDropdownMenu", "closeOnSelect", D.closeOnSelect), D.open !== void 0 && n("SDropdownMenu", "open", D.open);
|
|
120
|
+
}), (e, t) => (g(), f("div", T, [y(W) ? v(e.$slots, "default", { triggerAttrs: Y() }, void 0, !0, 0) : (g(), u(i, m({ key: 1 }, Y(), {
|
|
84
121
|
label: "Опции",
|
|
85
122
|
disclosure: {
|
|
86
|
-
expanded:
|
|
87
|
-
controls:
|
|
123
|
+
expanded: K.value,
|
|
124
|
+
controls: H
|
|
88
125
|
},
|
|
89
126
|
severity: "secondary"
|
|
90
|
-
}), null, 16, ["disclosure"])), (
|
|
127
|
+
}), null, 16, ["disclosure"])), (g(), u(c, { to: "body" }, [y(I) ? (g(), u(o, {
|
|
91
128
|
key: 0,
|
|
92
129
|
ref_key: "layerRef",
|
|
93
|
-
ref:
|
|
130
|
+
ref: M,
|
|
94
131
|
kind: "dropdown",
|
|
95
|
-
"landmark-label":
|
|
96
|
-
position:
|
|
97
|
-
"z-index":
|
|
132
|
+
"landmark-label": O.value,
|
|
133
|
+
position: y(L),
|
|
134
|
+
"z-index": y(R)
|
|
98
135
|
}, {
|
|
99
|
-
default: w(() => [
|
|
136
|
+
default: w(() => [te(s, {
|
|
100
137
|
ref_key: "menuSurfaceRef",
|
|
101
|
-
ref:
|
|
102
|
-
id:
|
|
103
|
-
label:
|
|
138
|
+
ref: N,
|
|
139
|
+
id: H,
|
|
140
|
+
label: O.value,
|
|
104
141
|
density: "compact",
|
|
105
142
|
autofocus: "",
|
|
106
|
-
"initial-focus":
|
|
143
|
+
"initial-focus": U.value,
|
|
107
144
|
items: p.items,
|
|
108
|
-
onDismissTree: t[0] ||= (e) =>
|
|
109
|
-
onEscape: t[1] ||= (e) =>
|
|
110
|
-
onFocusExit: t[2] ||= (e) =>
|
|
111
|
-
onSelect:
|
|
112
|
-
onTab:
|
|
145
|
+
onDismissTree: t[0] ||= (e) => $("outside"),
|
|
146
|
+
onEscape: t[1] ||= (e) => $("escape"),
|
|
147
|
+
onFocusExit: t[2] ||= (e) => $("outside"),
|
|
148
|
+
onSelect: se,
|
|
149
|
+
onTab: ce
|
|
113
150
|
}, null, 8, [
|
|
114
151
|
"label",
|
|
115
152
|
"initial-focus",
|
|
116
|
-
"items"
|
|
117
|
-
"onTab"
|
|
153
|
+
"items"
|
|
118
154
|
])]),
|
|
119
155
|
_: 1
|
|
120
156
|
}, 8, [
|
|
121
157
|
"landmark-label",
|
|
122
158
|
"position",
|
|
123
159
|
"z-index"
|
|
124
|
-
])) :
|
|
160
|
+
])) : d("", !0)]))]));
|
|
125
161
|
}
|
|
126
162
|
});
|
|
127
163
|
//#endregion
|