@profitliga/ui 2.0.6 → 2.0.7
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/dist/components/v2/AlertDialog/AlertDialog.css +1 -1
- package/dist/components/v2/AlertDialog/AlertDialog.vue.d.ts +2 -0
- package/dist/components/v2/AlertDialog/AlertDialog.vue.js +2 -2
- package/dist/components/v2/AlertDialog/AlertDialog.vue2.js +79 -77
- package/dist/components/v2/BottomSheet/BottomSheet.css +1 -1
- package/dist/components/v2/BottomSheet/BottomSheet.vue.d.ts +2 -0
- package/dist/components/v2/BottomSheet/BottomSheet.vue.js +2 -2
- package/dist/components/v2/BottomSheet/BottomSheet.vue2.js +62 -59
- package/dist/components/v2/Dialog/Dialog.css +1 -1
- package/dist/components/v2/Dialog/Dialog.vue.d.ts +2 -0
- package/dist/components/v2/Dialog/Dialog.vue.js +1 -1
- package/dist/components/v2/Dialog/Dialog.vue2.js +102 -99
- package/dist/components/v2/Drawer/Drawer.css +1 -1
- package/dist/components/v2/Drawer/Drawer.vue.d.ts +2 -0
- package/dist/components/v2/Drawer/Drawer.vue.js +2 -2
- package/dist/components/v2/Drawer/Drawer.vue2.js +95 -92
- package/dist/utils/onClickOutside.util.js +27 -21
- package/package.json +1 -1
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { X as
|
|
3
|
-
import { breakpoints as
|
|
4
|
-
import { onClickOutside as
|
|
5
|
-
import { useBodyScroll as
|
|
6
|
-
import { useFocusTrap as
|
|
1
|
+
import { defineComponent as Y, useModel as ee, useId as te, computed as g, useTemplateRef as E, ref as oe, watch as N, onBeforeUnmount as ie, unref as t, openBlock as s, createBlock as w, createSlots as se, withCtx as m, createElementVNode as d, createElementBlock as u, mergeProps as r, toDisplayString as x, createCommentVNode as c, renderSlot as f, normalizeProps as ae, guardReactiveProps as re, Fragment as ne, normalizeStyle as le, resolveDynamicComponent as K, createTextVNode as de, createVNode as ue, mergeModels as V } from "vue";
|
|
2
|
+
import { X as ce } from "@lucide/vue";
|
|
3
|
+
import { breakpoints as fe } from "../../../utils/breakpoints.util.js";
|
|
4
|
+
import { onClickOutside as ve } from "../../../utils/onClickOutside.util.js";
|
|
5
|
+
import { useBodyScroll as me } from "../../../utils/useBodyScroll.util.js";
|
|
6
|
+
import { useFocusTrap as ye } from "../../../utils/useFocusTrap.util.js";
|
|
7
7
|
import pe from "../BottomSheet/BottomSheet.vue.js";
|
|
8
|
-
import { ANIMATION_DURATION_MS as
|
|
9
|
-
import
|
|
10
|
-
import { useDelayedVisibility as
|
|
11
|
-
import { useLayerZIndex as
|
|
12
|
-
import { useTestId as
|
|
13
|
-
import { useTriggerAria as
|
|
14
|
-
import
|
|
15
|
-
const
|
|
8
|
+
import { ANIMATION_DURATION_MS as q } from "../shared/animation.const.js";
|
|
9
|
+
import be from "../shared/Portal.vue.js";
|
|
10
|
+
import { useDelayedVisibility as ge } from "../shared/useDelayedVisibility.util.js";
|
|
11
|
+
import { useLayerZIndex as we } from "../shared/useLayerZIndex.util.js";
|
|
12
|
+
import { useTestId as ke } from "../shared/useTestId.util.js";
|
|
13
|
+
import { useTriggerAria as he } from "../shared/useTriggerAria.util.js";
|
|
14
|
+
import $e from "../shared/VisuallyHidden.vue.js";
|
|
15
|
+
const Ie = { class: "drawer-mobile" }, Ce = {
|
|
16
16
|
key: 1,
|
|
17
17
|
class: "drawer-mobile__divider"
|
|
18
|
-
},
|
|
18
|
+
}, Oe = ["data-state"], Pe = ["aria-describedby", "data-state"], De = { class: "drawer-content__header" }, Ee = ["aria-label"], Se = {
|
|
19
19
|
key: 0,
|
|
20
20
|
class: "drawer-content__divider"
|
|
21
|
-
},
|
|
21
|
+
}, Ze = /* @__PURE__ */ Y({
|
|
22
22
|
inheritAttrs: !1,
|
|
23
23
|
__name: "Drawer",
|
|
24
|
-
props: /* @__PURE__ */
|
|
24
|
+
props: /* @__PURE__ */ V({
|
|
25
25
|
position: { default: "right" },
|
|
26
26
|
title: { default: void 0 },
|
|
27
27
|
closeButton: { default: () => ({ enabled: !0 }) },
|
|
@@ -37,102 +37,103 @@ const $e = { class: "drawer-mobile" }, Ie = {
|
|
|
37
37
|
open: { type: Boolean, default: !1 },
|
|
38
38
|
openModifiers: {}
|
|
39
39
|
}),
|
|
40
|
-
emits: /* @__PURE__ */
|
|
41
|
-
setup(o, { expose:
|
|
42
|
-
const i = o, k =
|
|
40
|
+
emits: /* @__PURE__ */ V(["escapeKeyDown", "pointerDownOutside"], ["update:open"]),
|
|
41
|
+
setup(o, { expose: L, emit: F }) {
|
|
42
|
+
const i = o, k = F, n = ee(o, "open"), S = fe.smaller(i.breakpointMobile), h = te(), v = `drawer-title-${h}`, $ = `drawer-content-${h}`, B = `drawer-body-${h}`, a = ke(() => i.testId), U = g(() => ({
|
|
43
43
|
"aria-haspopup": "dialog",
|
|
44
|
-
"aria-expanded":
|
|
45
|
-
"aria-controls":
|
|
46
|
-
})),
|
|
44
|
+
"aria-expanded": n.value,
|
|
45
|
+
"aria-controls": n.value ? $ : void 0
|
|
46
|
+
})), R = g(() => i.title?.as ?? "h2"), Z = g(
|
|
47
47
|
() => i.position === "left" || i.position === "right" ? { width: `${i.width}px` } : { height: `${i.height}px` }
|
|
48
|
-
), z =
|
|
49
|
-
|
|
48
|
+
), z = E("triggerRef"), I = E("contentRef"), M = E("layerRef");
|
|
49
|
+
he({
|
|
50
50
|
host: () => z.value,
|
|
51
|
-
isOpen: () =>
|
|
51
|
+
isOpen: () => n.value,
|
|
52
52
|
contentId: () => $,
|
|
53
53
|
hasPopup: () => "dialog"
|
|
54
54
|
});
|
|
55
|
-
const { lockScroll:
|
|
56
|
-
() => i.zIndex === "auto" ?
|
|
57
|
-
), O =
|
|
58
|
-
async function
|
|
55
|
+
const { lockScroll: H, unlockScroll: X } = me(), C = ye(() => I.value), y = we(), _ = g(
|
|
56
|
+
() => i.zIndex === "auto" ? y.zIndex.value : i.zIndex
|
|
57
|
+
), O = oe(!1);
|
|
58
|
+
async function p(e) {
|
|
59
59
|
if (!i.beforeClose) {
|
|
60
|
-
|
|
60
|
+
n.value = !1;
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
63
|
if (!O.value) {
|
|
64
64
|
O.value = !0;
|
|
65
65
|
try {
|
|
66
|
-
await i.beforeClose(e) && (
|
|
66
|
+
await i.beforeClose(e) && (n.value = !1);
|
|
67
67
|
} finally {
|
|
68
68
|
O.value = !1;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
function P(e) {
|
|
73
|
-
e.key === "Escape" && (k("escapeKeyDown", e), e.defaultPrevented ||
|
|
74
|
-
}
|
|
75
|
-
function X(e) {
|
|
76
|
-
k("pointerDownOutside", e), !i.disableOutsidePointerEvents && !e.defaultPrevented && y("outsidePointer");
|
|
77
|
-
}
|
|
78
|
-
function R(e, l) {
|
|
79
|
-
e.defaultPrevented || !i.beforeClose || (e.preventDefault(), y(l));
|
|
73
|
+
e.key === "Escape" && (k("escapeKeyDown", e), e.defaultPrevented || p("escapeKey"));
|
|
80
74
|
}
|
|
81
75
|
function j(e) {
|
|
82
|
-
k("
|
|
76
|
+
k("pointerDownOutside", e), !i.disableOutsidePointerEvents && !e.defaultPrevented && p("outsidePointer");
|
|
77
|
+
}
|
|
78
|
+
function T(e, l) {
|
|
79
|
+
e.defaultPrevented || !i.beforeClose || (e.preventDefault(), p(l));
|
|
83
80
|
}
|
|
84
81
|
function G(e) {
|
|
85
|
-
k("
|
|
82
|
+
k("escapeKeyDown", e), T(e, "escapeKey");
|
|
83
|
+
}
|
|
84
|
+
function J(e) {
|
|
85
|
+
k("pointerDownOutside", e), !i.disableOutsidePointerEvents && T(e, "outsidePointer");
|
|
86
86
|
}
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
const Q = g(() => n.value && !S.value), { visible: W, dataState: A } = ge(
|
|
88
|
+
Q,
|
|
89
|
+
q,
|
|
90
90
|
{
|
|
91
91
|
onOpen: () => {
|
|
92
|
-
|
|
92
|
+
y.acquire(), H(), C.activate({ focusDelayMs: q }), document.addEventListener("keydown", P);
|
|
93
93
|
},
|
|
94
94
|
onCloseStart: () => {
|
|
95
95
|
C.deactivate(), document.removeEventListener("keydown", P);
|
|
96
96
|
},
|
|
97
97
|
onCloseEnd: () => {
|
|
98
|
-
|
|
98
|
+
X(), y.release();
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
);
|
|
102
|
+
N(M, (e) => y.registerElement(e));
|
|
102
103
|
let D;
|
|
103
|
-
return
|
|
104
|
-
|
|
105
|
-
ignore: () =>
|
|
104
|
+
return N(I, (e) => {
|
|
105
|
+
D?.(), D = e ? ve(e, j, {
|
|
106
|
+
ignore: () => y.elementsAbove()
|
|
106
107
|
}) : void 0;
|
|
107
|
-
}),
|
|
108
|
+
}), ie(() => {
|
|
108
109
|
D?.(), document.removeEventListener("keydown", P), C.deactivate();
|
|
109
|
-
}),
|
|
110
|
-
requestClose: (e = "programmatic") =>
|
|
111
|
-
}), (e, l) => t(
|
|
110
|
+
}), L({
|
|
111
|
+
requestClose: (e = "programmatic") => p(e)
|
|
112
|
+
}), (e, l) => t(S) ? (s(), w(t(pe), {
|
|
112
113
|
key: 0,
|
|
113
|
-
open:
|
|
114
|
-
"onUpdate:open": l[0] || (l[0] = (b) =>
|
|
114
|
+
open: n.value,
|
|
115
|
+
"onUpdate:open": l[0] || (l[0] = (b) => n.value = b),
|
|
115
116
|
"z-index": o.zIndex,
|
|
116
117
|
"disable-outside-pointer-events": o.disableOutsidePointerEvents,
|
|
117
118
|
"disable-swipe-to-close": !!o.beforeClose,
|
|
118
119
|
"labelled-by": o.title?.text && !e.$slots.title ? v : void 0,
|
|
119
120
|
"test-id": o.testId,
|
|
120
|
-
onEscapeKeyDown:
|
|
121
|
-
onPointerDownOutside:
|
|
122
|
-
},
|
|
121
|
+
onEscapeKeyDown: G,
|
|
122
|
+
onPointerDownOutside: J
|
|
123
|
+
}, se({
|
|
123
124
|
default: m(() => [
|
|
124
|
-
d("div",
|
|
125
|
-
o.title?.text && !e.$slots.title ? (s(), u("div",
|
|
125
|
+
d("div", Ie, [
|
|
126
|
+
o.title?.text && !e.$slots.title ? (s(), u("div", r({
|
|
126
127
|
key: 0,
|
|
127
128
|
id: v,
|
|
128
129
|
class: "drawer-mobile__title"
|
|
129
|
-
}, t(a)("title")),
|
|
130
|
-
o.divider ? (s(), u("div",
|
|
131
|
-
d("div",
|
|
130
|
+
}, t(a)("title")), x(o.title.text), 17)) : c("", !0),
|
|
131
|
+
o.divider ? (s(), u("div", Ce)) : c("", !0),
|
|
132
|
+
d("div", r({ class: "drawer-mobile__content" }, t(a)("body")), [
|
|
132
133
|
f(e.$slots, "title", {}, void 0, !0),
|
|
133
134
|
f(e.$slots, "default", {}, void 0, !0)
|
|
134
135
|
], 16),
|
|
135
|
-
e.$slots.actions ? (s(), u("div",
|
|
136
|
+
e.$slots.actions ? (s(), u("div", r({
|
|
136
137
|
key: 2,
|
|
137
138
|
class: "drawer-mobile__actions"
|
|
138
139
|
}, t(a)("actions")), [
|
|
@@ -145,54 +146,56 @@ const $e = { class: "drawer-mobile" }, Ie = {
|
|
|
145
146
|
e.$slots.trigger ? {
|
|
146
147
|
name: "trigger",
|
|
147
148
|
fn: m((b) => [
|
|
148
|
-
f(e.$slots, "trigger",
|
|
149
|
+
f(e.$slots, "trigger", ae(re(b)), void 0, !0)
|
|
149
150
|
]),
|
|
150
151
|
key: "0"
|
|
151
152
|
} : void 0
|
|
152
153
|
]), 1032, ["open", "z-index", "disable-outside-pointer-events", "disable-swipe-to-close", "labelled-by", "test-id"])) : (s(), u(ne, { key: 1 }, [
|
|
153
|
-
e.$slots.trigger ? (s(), u("span",
|
|
154
|
+
e.$slots.trigger ? (s(), u("span", r({
|
|
154
155
|
key: 0,
|
|
155
156
|
ref_key: "triggerRef",
|
|
156
157
|
ref: z,
|
|
157
158
|
class: "drawer-trigger"
|
|
158
159
|
}, t(a)("trigger"), {
|
|
159
|
-
onClick: l[1] || (l[1] = (b) =>
|
|
160
|
+
onClick: l[1] || (l[1] = (b) => n.value = !0)
|
|
160
161
|
}), [
|
|
161
|
-
f(e.$slots, "trigger", { props:
|
|
162
|
+
f(e.$slots, "trigger", { props: U.value }, void 0, !0)
|
|
162
163
|
], 16)) : c("", !0),
|
|
163
|
-
t(
|
|
164
|
+
t(W) ? (s(), w(be, { key: 1 }, {
|
|
164
165
|
default: m(() => [
|
|
165
166
|
d("div", {
|
|
167
|
+
ref_key: "layerRef",
|
|
168
|
+
ref: M,
|
|
166
169
|
class: "drawer-layer",
|
|
167
|
-
style:
|
|
170
|
+
style: le({ zIndex: _.value })
|
|
168
171
|
}, [
|
|
169
|
-
d("div",
|
|
172
|
+
d("div", r({
|
|
170
173
|
class: "overlay drawer-overlay",
|
|
171
|
-
"data-state": t(
|
|
172
|
-
}, t(a)("overlay")), null, 16,
|
|
173
|
-
d("div",
|
|
174
|
+
"data-state": t(A)
|
|
175
|
+
}, t(a)("overlay")), null, 16, Oe),
|
|
176
|
+
d("div", r({
|
|
174
177
|
id: $,
|
|
175
178
|
ref_key: "contentRef",
|
|
176
179
|
ref: I,
|
|
177
180
|
role: "dialog",
|
|
178
181
|
"aria-modal": "true",
|
|
179
182
|
"aria-labelledby": v,
|
|
180
|
-
"aria-describedby": e.$slots.default ?
|
|
183
|
+
"aria-describedby": e.$slots.default ? B : void 0,
|
|
181
184
|
class: ["drawer-content", `drawer-content--${o.position}`],
|
|
182
|
-
"data-state": t(
|
|
183
|
-
style:
|
|
185
|
+
"data-state": t(A),
|
|
186
|
+
style: Z.value
|
|
184
187
|
}, { ...e.$attrs, ...t(a)("content") }), [
|
|
185
|
-
d("div",
|
|
186
|
-
o.title?.text ? (s(), w(
|
|
188
|
+
d("div", De, [
|
|
189
|
+
o.title?.text ? (s(), w(K(R.value), r({
|
|
187
190
|
key: 0,
|
|
188
191
|
id: v,
|
|
189
192
|
class: "drawer-content__title"
|
|
190
193
|
}, t(a)("title")), {
|
|
191
194
|
default: m(() => [
|
|
192
|
-
|
|
195
|
+
de(x(o.title.text), 1)
|
|
193
196
|
]),
|
|
194
197
|
_: 1
|
|
195
|
-
}, 16)) : e.$slots.title ? (s(), w(
|
|
198
|
+
}, 16)) : e.$slots.title ? (s(), w(K(R.value), r({
|
|
196
199
|
key: 1,
|
|
197
200
|
id: v,
|
|
198
201
|
class: "drawer-content__title"
|
|
@@ -201,37 +204,37 @@ const $e = { class: "drawer-mobile" }, Ie = {
|
|
|
201
204
|
f(e.$slots, "title", {}, void 0, !0)
|
|
202
205
|
]),
|
|
203
206
|
_: 3
|
|
204
|
-
}, 16)) : (s(), w(
|
|
207
|
+
}, 16)) : (s(), w($e, { key: 2 }, {
|
|
205
208
|
default: m(() => [
|
|
206
209
|
d("h2", { id: v }, "Боковая панель")
|
|
207
210
|
]),
|
|
208
211
|
_: 1
|
|
209
212
|
})),
|
|
210
|
-
o.closeButton?.enabled ? (s(), u("button",
|
|
213
|
+
o.closeButton?.enabled ? (s(), u("button", r({
|
|
211
214
|
key: 3,
|
|
212
215
|
type: "button",
|
|
213
216
|
class: "drawer-content__close",
|
|
214
217
|
"aria-label": o.closeButton.label ?? "Закрыть"
|
|
215
218
|
}, t(a)("close"), {
|
|
216
|
-
onClick: l[2] || (l[2] = (b) =>
|
|
219
|
+
onClick: l[2] || (l[2] = (b) => p("closeButton"))
|
|
217
220
|
}), [
|
|
218
|
-
|
|
219
|
-
], 16,
|
|
221
|
+
ue(t(ce), { size: 20 })
|
|
222
|
+
], 16, Ee)) : c("", !0)
|
|
220
223
|
]),
|
|
221
|
-
o.divider ? (s(), u("div",
|
|
222
|
-
d("div",
|
|
223
|
-
id:
|
|
224
|
+
o.divider ? (s(), u("div", Se)) : c("", !0),
|
|
225
|
+
d("div", r({
|
|
226
|
+
id: B,
|
|
224
227
|
class: "drawer-content__wrapper"
|
|
225
228
|
}, t(a)("body")), [
|
|
226
229
|
f(e.$slots, "default", {}, void 0, !0)
|
|
227
230
|
], 16),
|
|
228
|
-
e.$slots.actions ? (s(), u("div",
|
|
231
|
+
e.$slots.actions ? (s(), u("div", r({
|
|
229
232
|
key: 1,
|
|
230
233
|
class: "drawer-content__actions"
|
|
231
234
|
}, t(a)("actions")), [
|
|
232
235
|
f(e.$slots, "actions", {}, void 0, !0)
|
|
233
236
|
], 16)) : c("", !0)
|
|
234
|
-
], 16,
|
|
237
|
+
], 16, Pe)
|
|
235
238
|
], 4)
|
|
236
239
|
]),
|
|
237
240
|
_: 3
|
|
@@ -240,5 +243,5 @@ const $e = { class: "drawer-mobile" }, Ie = {
|
|
|
240
243
|
}
|
|
241
244
|
});
|
|
242
245
|
export {
|
|
243
|
-
|
|
246
|
+
Ze as default
|
|
244
247
|
};
|
|
@@ -1,30 +1,36 @@
|
|
|
1
|
-
import { toValue as
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { toValue as p, unref as g } from "vue";
|
|
2
|
+
const s = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
let c = 0;
|
|
4
|
+
const E = 500;
|
|
5
|
+
function l(t) {
|
|
6
|
+
const o = g(t);
|
|
7
|
+
return o?.$el ?? o;
|
|
6
8
|
}
|
|
7
|
-
function
|
|
8
|
-
return typeof t == "string" ? document.querySelector(t) :
|
|
9
|
+
function L(t) {
|
|
10
|
+
return typeof t == "string" ? document.querySelector(t) : l(t);
|
|
9
11
|
}
|
|
10
|
-
function
|
|
11
|
-
const n =
|
|
12
|
+
function y(t, o, d = {}) {
|
|
13
|
+
const n = L(t);
|
|
12
14
|
if (!n) return () => {
|
|
13
15
|
};
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
const a = s.get(n);
|
|
17
|
+
a && (a(), s.delete(n));
|
|
18
|
+
const u = (r) => {
|
|
19
|
+
if (r.type === "touchstart")
|
|
20
|
+
c = r.timeStamp;
|
|
21
|
+
else if (c > 0 && r.timeStamp - c < E)
|
|
22
|
+
return;
|
|
23
|
+
const i = r.target instanceof Node ? r.target : null;
|
|
24
|
+
if (!i) return;
|
|
25
|
+
const f = (p(d.ignore) ?? []).map((e) => typeof e == "string" ? document.querySelector(e) : l(e)).filter((e) => e != null);
|
|
26
|
+
n.contains(i) || f.some((e) => e.contains(i)) || o(r);
|
|
21
27
|
};
|
|
22
|
-
document.addEventListener("mousedown",
|
|
23
|
-
const
|
|
24
|
-
document.removeEventListener("mousedown",
|
|
28
|
+
document.addEventListener("mousedown", u, { capture: !0 }), document.addEventListener("touchstart", u, { capture: !0 });
|
|
29
|
+
const m = () => {
|
|
30
|
+
document.removeEventListener("mousedown", u, { capture: !0 }), document.removeEventListener("touchstart", u, { capture: !0 }), s.delete(n);
|
|
25
31
|
};
|
|
26
|
-
return
|
|
32
|
+
return s.set(n, m), m;
|
|
27
33
|
}
|
|
28
34
|
export {
|
|
29
|
-
|
|
35
|
+
y as onClickOutside
|
|
30
36
|
};
|