@7pmlabs/design-system 0.6.2 → 0.6.3
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 +1 -0
- package/dist/design-system104.mjs +1 -1
- package/dist/design-system107.mjs +1 -1
- package/dist/design-system110.mjs +1 -1
- package/dist/design-system111.mjs +1 -1
- package/dist/design-system112.mjs +1 -1
- package/dist/design-system115.mjs +1 -1
- package/dist/design-system27.mjs +3 -3
- package/dist/design-system28.mjs +4 -4
- package/dist/design-system29.mjs +3 -3
- package/dist/design-system30.mjs +1 -1
- package/dist/design-system31.mjs +3 -3
- package/dist/design-system32.mjs +3 -3
- package/dist/design-system33.mjs +1 -1
- package/dist/design-system34.mjs +1 -1
- package/dist/design-system35.mjs +1 -1
- package/dist/design-system36.mjs +1 -1
- package/dist/design-system37.mjs +3 -3
- package/dist/design-system38.mjs +2 -2
- package/dist/design-system39.mjs +3 -3
- package/dist/design-system40.mjs +3 -3
- package/dist/design-system42.mjs +3 -3
- package/dist/design-system43.mjs +1 -1
- package/dist/design-system44.mjs +1 -1
- package/dist/design-system45.mjs +3 -3
- package/dist/design-system47.mjs +3 -3
- package/dist/design-system48.mjs +3 -3
- package/dist/design-system50.mjs +3 -3
- package/dist/design-system51.mjs +140 -2
- package/dist/design-system51.mjs.map +1 -1
- package/dist/design-system52.mjs +1090 -126
- package/dist/design-system52.mjs.map +1 -1
- package/dist/design-system53.mjs +1002 -2
- package/dist/design-system53.mjs.map +1 -1
- package/dist/design-system54.mjs +2 -7
- package/dist/design-system54.mjs.map +1 -1
- package/dist/design-system55.mjs +124 -20
- package/dist/design-system55.mjs.map +1 -1
- package/dist/design-system57.mjs +7 -2
- package/dist/design-system57.mjs.map +1 -1
- package/dist/design-system58.mjs +19 -61
- package/dist/design-system58.mjs.map +1 -1
- package/dist/design-system60.mjs +2 -2
- package/dist/design-system61.mjs +65 -2
- package/dist/design-system61.mjs.map +1 -1
- package/dist/design-system62.mjs +2 -2
- package/dist/design-system63.mjs +1 -1
- package/dist/design-system64.mjs +1 -1
- package/dist/design-system65.mjs +2 -28
- package/dist/design-system65.mjs.map +1 -1
- package/dist/design-system66.mjs +2 -2
- package/dist/design-system67.mjs +2 -58
- package/dist/design-system67.mjs.map +1 -1
- package/dist/design-system68.mjs +28 -2
- package/dist/design-system68.mjs.map +1 -1
- package/dist/design-system69.mjs +2 -2
- package/dist/design-system70.mjs +58 -2
- package/dist/design-system70.mjs.map +1 -1
- package/dist/design-system71.mjs +2 -2
- package/dist/design-system72.mjs +1 -1
- package/dist/design-system73.mjs +2 -79
- package/dist/design-system73.mjs.map +1 -1
- package/dist/design-system74.mjs +2 -2
- package/dist/design-system75.mjs +1 -1
- package/dist/design-system76.mjs +79 -2
- package/dist/design-system76.mjs.map +1 -1
- package/dist/design-system77.mjs +2 -81
- package/dist/design-system77.mjs.map +1 -1
- package/dist/design-system78.mjs +2 -2
- package/dist/design-system79.mjs +2 -2
- package/dist/design-system80.mjs +71 -109
- package/dist/design-system80.mjs.map +1 -1
- package/dist/design-system82.mjs +1 -1
- package/dist/design-system83.mjs +119 -2
- package/dist/design-system83.mjs.map +1 -1
- package/dist/design-system84.mjs +2 -102
- package/dist/design-system84.mjs.map +1 -1
- package/dist/design-system85.mjs +2 -2
- package/dist/design-system86.mjs +2 -190
- package/dist/design-system86.mjs.map +1 -1
- package/dist/design-system87.mjs +102 -2
- package/dist/design-system87.mjs.map +1 -1
- package/dist/design-system88.mjs +2 -2
- package/dist/design-system89.mjs +170 -122
- package/dist/design-system89.mjs.map +1 -1
- package/dist/design-system91.mjs +2 -49
- package/dist/design-system91.mjs.map +1 -1
- package/dist/design-system92.mjs +142 -2
- package/dist/design-system92.mjs.map +1 -1
- package/dist/design-system93.mjs +2 -2
- package/dist/design-system94.mjs +49 -2
- package/dist/design-system94.mjs.map +1 -1
- package/dist/design-system95.mjs +2 -2
- package/dist/design-system96.mjs +2 -140
- package/dist/design-system96.mjs.map +1 -1
- package/dist/design-system97.mjs +2 -1091
- package/dist/design-system97.mjs.map +1 -1
- package/dist/design-system98.mjs +2 -1002
- package/dist/design-system98.mjs.map +1 -1
- package/package.json +14 -13
package/dist/design-system84.mjs
CHANGED
|
@@ -1,105 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { BTooltipPosition as c, BTooltipOpenEvent as i } from "./design-system5.mjs";
|
|
3
|
-
const D = (a) => ($("data-v-78f7c276"), a = a(), z(), a), M = { class: "ds-relative" }, N = /* @__PURE__ */ D(() => /* @__PURE__ */ d("div", {
|
|
4
|
-
class: "tooltip-arrow",
|
|
5
|
-
"data-popper-arrow": ""
|
|
6
|
-
}, null, -1)), q = /* @__PURE__ */ C({
|
|
7
|
-
__name: "BTooltip",
|
|
8
|
-
props: {
|
|
9
|
-
modelValue: { type: Boolean, default: !1 },
|
|
10
|
-
position: { default: c.Top },
|
|
11
|
-
openEvent: { default: i.Hover }
|
|
12
|
-
},
|
|
13
|
-
emits: ["update:modelValue"],
|
|
14
|
-
setup(a, { emit: w }) {
|
|
15
|
-
const s = a, B = w, t = v(null), o = v(null), p = v(!1), n = S({
|
|
16
|
-
get() {
|
|
17
|
-
return s.modelValue !== void 0 ? s.modelValue : p.value;
|
|
18
|
-
},
|
|
19
|
-
set(e) {
|
|
20
|
-
s.modelValue !== void 0 ? B("update:modelValue", e) : p.value = e;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
L(
|
|
24
|
-
() => s.position,
|
|
25
|
-
() => {
|
|
26
|
-
x(), h();
|
|
27
|
-
}
|
|
28
|
-
), L(
|
|
29
|
-
() => s.openEvent,
|
|
30
|
-
() => {
|
|
31
|
-
g(), b();
|
|
32
|
-
}
|
|
33
|
-
);
|
|
34
|
-
const m = () => {
|
|
35
|
-
n.value = !n.value;
|
|
36
|
-
}, f = () => {
|
|
37
|
-
n.value = !0;
|
|
38
|
-
}, V = () => {
|
|
39
|
-
n.value = !1;
|
|
40
|
-
}, E = () => {
|
|
41
|
-
n.value = !0;
|
|
42
|
-
}, k = () => {
|
|
43
|
-
n.value = !1;
|
|
44
|
-
}, x = () => {
|
|
45
|
-
o.value && (o.value.style.top = "", o.value.style.right = "", o.value.style.bottom = "", o.value.style.left = "");
|
|
46
|
-
}, h = () => {
|
|
47
|
-
if (o.value)
|
|
48
|
-
switch (s.position) {
|
|
49
|
-
case c.Bottom:
|
|
50
|
-
o.value.style.top = "4px";
|
|
51
|
-
break;
|
|
52
|
-
case c.Top:
|
|
53
|
-
default:
|
|
54
|
-
o.value.style.bottom = "24px";
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
}, b = () => {
|
|
58
|
-
var e, l, u, r, y;
|
|
59
|
-
switch (s.openEvent) {
|
|
60
|
-
case i.Click:
|
|
61
|
-
(e = t.value) == null || e.addEventListener("click", m);
|
|
62
|
-
break;
|
|
63
|
-
case i.Focus:
|
|
64
|
-
(l = t.value) == null || l.addEventListener("focus", f), (u = t.value) == null || u.addEventListener("focusout", V);
|
|
65
|
-
break;
|
|
66
|
-
case i.Hover:
|
|
67
|
-
default:
|
|
68
|
-
(r = t.value) == null || r.addEventListener("mouseover", E), (y = t.value) == null || y.addEventListener("mouseleave", k);
|
|
69
|
-
break;
|
|
70
|
-
}
|
|
71
|
-
}, g = () => {
|
|
72
|
-
var e, l, u, r;
|
|
73
|
-
(e = t.value) == null || e.removeEventListener("click", m), (l = t.value) == null || l.removeEventListener("focus", f), (u = t.value) == null || u.removeEventListener("mouseover", E), (r = t.value) == null || r.removeEventListener("mouseleave", k);
|
|
74
|
-
};
|
|
75
|
-
return T(() => {
|
|
76
|
-
b(), h();
|
|
77
|
-
}), F(() => {
|
|
78
|
-
g();
|
|
79
|
-
}), (e, l) => (H(), R(I, null, [
|
|
80
|
-
d("div", {
|
|
81
|
-
ref_key: "toggleRef",
|
|
82
|
-
ref: t,
|
|
83
|
-
class: "ds-inline"
|
|
84
|
-
}, [
|
|
85
|
-
_(e.$slots, "toggle", {}, void 0, !0)
|
|
86
|
-
], 512),
|
|
87
|
-
O(d("div", M, [
|
|
88
|
-
d("div", {
|
|
89
|
-
ref_key: "contentRef",
|
|
90
|
-
ref: o,
|
|
91
|
-
class: "ds-absolute ds-z-10 ds-inline-block ds-rounded-lg ds-bg-black/65 ds-px-3 ds-py-2 ds-text-sm ds-font-medium ds-text-white ds-shadow-sm ds-transition-opacity ds-duration-300"
|
|
92
|
-
}, [
|
|
93
|
-
_(e.$slots, "default", {}, void 0, !0),
|
|
94
|
-
N
|
|
95
|
-
], 512)
|
|
96
|
-
], 512), [
|
|
97
|
-
[P, n.value]
|
|
98
|
-
])
|
|
99
|
-
], 64));
|
|
100
|
-
}
|
|
101
|
-
});
|
|
1
|
+
const e = "";
|
|
102
2
|
export {
|
|
103
|
-
|
|
3
|
+
e as default
|
|
104
4
|
};
|
|
105
5
|
//# sourceMappingURL=design-system84.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"design-system84.mjs","sources":[
|
|
1
|
+
{"version":3,"file":"design-system84.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/design-system85.mjs
CHANGED
package/dist/design-system86.mjs
CHANGED
|
@@ -1,193 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { FileImageTypes as S } from "./design-system4.mjs";
|
|
3
|
-
import { useI18n as se } from "./design-system50.mjs";
|
|
4
|
-
import F from "./design-system104.mjs";
|
|
5
|
-
import re from "./design-system46.mjs";
|
|
6
|
-
import { useValidationField as oe } from "./design-system3.mjs";
|
|
7
|
-
import ie from "./design-system16.mjs";
|
|
8
|
-
import de from "./design-system11.mjs";
|
|
9
|
-
import ne from "./design-system15.mjs";
|
|
10
|
-
import ue from "./design-system100.mjs";
|
|
11
|
-
import ce from "./design-system105.mjs";
|
|
12
|
-
const ge = (u) => (ae("data-v-8033e228"), u = u(), le(), u), pe = { class: "b-image-picker ds-w-full" }, me = { class: "ds-gap-2 ds-space-y-4 ds-rounded-lg ds-bg-white ds-p-4 ds-drop-shadow" }, ve = {
|
|
13
|
-
key: 0,
|
|
14
|
-
class: "ds-flex ds-flex-wrap ds-justify-center ds-gap-1"
|
|
15
|
-
}, fe = ["onClick", "onDragenter", "onDragstart", "onDrop"], he = ["src"], _e = ["src"], ye = { class: "ds-flex ds-flex-wrap ds-justify-center" }, ke = /* @__PURE__ */ ge(() => /* @__PURE__ */ i("svg", {
|
|
16
|
-
class: "ds-h-4 ds-w-4 ds-fill-primary-t",
|
|
17
|
-
viewBox: "0 0 512 512",
|
|
18
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
19
|
-
}, [
|
|
20
|
-
/* @__PURE__ */ i("path", { d: "M447.1 32h-384C28.64 32-.0091 60.65-.0091 96v320c0 35.35 28.65 64 63.1 64h384c35.35 0 64-28.65 64-64V96C511.1 60.65 483.3 32 447.1 32zM111.1 96c26.51 0 48 21.49 48 48S138.5 192 111.1 192s-48-21.49-48-48S85.48 96 111.1 96zM446.1 407.6C443.3 412.8 437.9 416 432 416H82.01c-6.021 0-11.53-3.379-14.26-8.75c-2.73-5.367-2.215-11.81 1.334-16.68l70-96C142.1 290.4 146.9 288 152 288s9.916 2.441 12.93 6.574l32.46 44.51l93.3-139.1C293.7 194.7 298.7 192 304 192s10.35 2.672 13.31 7.125l128 192C448.6 396 448.9 402.3 446.1 407.6z" })
|
|
21
|
-
], -1)), De = ["accept", "multiple"], Me = /* @__PURE__ */ W({
|
|
22
|
-
__name: "BImagePicker",
|
|
23
|
-
props: {
|
|
24
|
-
inputId: { default: "" },
|
|
25
|
-
modelValue: {},
|
|
26
|
-
label: { default: "" },
|
|
27
|
-
multiple: { type: Boolean, default: !1 },
|
|
28
|
-
maxFileSize: { default: 20 },
|
|
29
|
-
hideDetails: { type: Boolean, default: !1 },
|
|
30
|
-
required: { type: Boolean, default: !1 },
|
|
31
|
-
requiredErrorMessage: { default: "" },
|
|
32
|
-
validationRules: { default: void 0 }
|
|
33
|
-
},
|
|
34
|
-
emits: ["change", "update:modelValue"],
|
|
35
|
-
setup(u, { expose: R, emit: z }) {
|
|
36
|
-
const a = u, c = z, { t: f } = se(), h = p(null), w = p(0), s = _({
|
|
37
|
-
get() {
|
|
38
|
-
return a.modelValue;
|
|
39
|
-
},
|
|
40
|
-
set(e) {
|
|
41
|
-
c("update:modelValue", e);
|
|
42
|
-
}
|
|
43
|
-
}), y = p(!0), k = p(!0), g = p({
|
|
44
|
-
visible: !1,
|
|
45
|
-
url: ""
|
|
46
|
-
}), b = _(() => S.join(", ")), B = _(() => a.inputId || `id-${ue()}`), M = {
|
|
47
|
-
validateRule: (e) => !!e && e.length > 0,
|
|
48
|
-
errorMessage: () => a.requiredErrorMessage || f("ds.global.field_required")
|
|
49
|
-
}, T = {
|
|
50
|
-
validateRule: () => y.value,
|
|
51
|
-
errorMessage: () => f("ds.components.base.image_picker.file_types_valid", {
|
|
52
|
-
types: b.value
|
|
53
|
-
})
|
|
54
|
-
}, E = {
|
|
55
|
-
validateRule: () => k.value,
|
|
56
|
-
errorMessage: () => f("ds.components.base.image_picker.file_size_valid", {
|
|
57
|
-
size: a.maxFileSize
|
|
58
|
-
})
|
|
59
|
-
}, L = _(() => {
|
|
60
|
-
let e = [];
|
|
61
|
-
return a.required && e.push(M), a.validationRules && (e = e.concat(a.validationRules)), e.push(T), e.push(E), e.length ? e : void 0;
|
|
62
|
-
}), { validate: d, validationResult: $ } = oe(
|
|
63
|
-
B.value,
|
|
64
|
-
s,
|
|
65
|
-
L.value
|
|
66
|
-
), q = (e, t) => {
|
|
67
|
-
w.value = e, t.target.classList.add("dragging"), t.dataTransfer.effectAllowed = "move", t.dataTransfer.setData("index", e.toString());
|
|
68
|
-
}, N = (e) => {
|
|
69
|
-
e.target.classList.remove("dragging");
|
|
70
|
-
}, j = (e, t) => {
|
|
71
|
-
const l = t.target;
|
|
72
|
-
w.value !== e && l.classList.add("dropped-target");
|
|
73
|
-
}, A = (e) => {
|
|
74
|
-
e.preventDefault(), e.dataTransfer.dropEffect = "move";
|
|
75
|
-
}, P = (e) => {
|
|
76
|
-
e.target.classList.remove("dropped-target");
|
|
77
|
-
}, U = (e, t) => {
|
|
78
|
-
t.preventDefault(), t.target.classList.remove("dropped-target");
|
|
79
|
-
const r = parseInt(t.dataTransfer.getData("index")), o = s.value[r];
|
|
80
|
-
s.value.splice(r, 1), s.value.splice(e, 0, o), c("change"), d();
|
|
81
|
-
}, H = () => {
|
|
82
|
-
var e;
|
|
83
|
-
(e = h.value) == null || e.click();
|
|
84
|
-
}, O = (e) => {
|
|
85
|
-
let t = e.target.files || e.dataTransfer.files;
|
|
86
|
-
t.length && (G(t), h.value && (h.value.value = null));
|
|
87
|
-
}, G = (e) => {
|
|
88
|
-
Array.from(e).forEach((t) => {
|
|
89
|
-
if (y.value = S.includes(t.type), k.value = Q(t.size) <= a.maxFileSize, y.value && k.value) {
|
|
90
|
-
let l = new FileReader();
|
|
91
|
-
l.onload = (r) => {
|
|
92
|
-
a.multiple ? s.value.push({
|
|
93
|
-
url: r.target.result,
|
|
94
|
-
file: t,
|
|
95
|
-
type: t.type
|
|
96
|
-
}) : s.value = {
|
|
97
|
-
url: r.target.result,
|
|
98
|
-
file: t,
|
|
99
|
-
type: t.type
|
|
100
|
-
}, c("change"), d();
|
|
101
|
-
}, l.readAsDataURL(t);
|
|
102
|
-
} else
|
|
103
|
-
d();
|
|
104
|
-
});
|
|
105
|
-
}, J = (e) => {
|
|
106
|
-
s.value.splice(e, 1), c("change"), d();
|
|
107
|
-
}, K = () => {
|
|
108
|
-
s.value = {}, c("change"), d();
|
|
109
|
-
}, Q = (e) => e / 1024 ** 2, C = (e) => {
|
|
110
|
-
g.value.url = e.url || "", g.value.visible = !0;
|
|
111
|
-
};
|
|
112
|
-
return R({ validate: d }), (e, t) => (n(), m("div", pe, [
|
|
113
|
-
v(ie, {
|
|
114
|
-
label: a.label
|
|
115
|
-
}, null, 8, ["label"]),
|
|
116
|
-
i("div", me, [
|
|
117
|
-
D(ce)(s.value) ? V("", !0) : (n(), m("div", ve, [
|
|
118
|
-
a.multiple ? (n(!0), m(X, { key: 0 }, Y(s.value, (l, r) => (n(), m("div", {
|
|
119
|
-
key: l.url,
|
|
120
|
-
class: "b-image-picker__draggable ds-h-full ds-cursor-pointer ds-rounded-lg ds-transition-all hover:ds-ring-2 hover:ds-ring-primary-t",
|
|
121
|
-
draggable: "true",
|
|
122
|
-
onClick: (o) => C(l),
|
|
123
|
-
onDragend: N,
|
|
124
|
-
onDragenter: (o) => j(r, o),
|
|
125
|
-
onDragleave: P,
|
|
126
|
-
onDragover: A,
|
|
127
|
-
onDragstart: (o) => q(r, o),
|
|
128
|
-
onDrop: (o) => U(r, o)
|
|
129
|
-
}, [
|
|
130
|
-
i("img", {
|
|
131
|
-
src: l.url,
|
|
132
|
-
alt: "image",
|
|
133
|
-
class: "ds-h-full ds-w-full ds-rounded-lg"
|
|
134
|
-
}, null, 8, he),
|
|
135
|
-
v(F, {
|
|
136
|
-
class: "ds-right-1 ds-top-1 ds-h-8 ds-w-8",
|
|
137
|
-
onClick: I((o) => J(r), ["stop"])
|
|
138
|
-
}, null, 8, ["onClick"])
|
|
139
|
-
], 40, fe))), 128)) : (n(), m("div", {
|
|
140
|
-
key: 1,
|
|
141
|
-
class: "b-image-picker__draggable ds-h-full ds-cursor-pointer ds-rounded-lg ds-transition-all hover:ds-ring-2 hover:ds-ring-primary-t",
|
|
142
|
-
draggable: "true",
|
|
143
|
-
onClick: t[0] || (t[0] = (l) => C(s.value))
|
|
144
|
-
}, [
|
|
145
|
-
i("img", {
|
|
146
|
-
src: s.value.url,
|
|
147
|
-
alt: "image",
|
|
148
|
-
class: "ds-h-full ds-w-full ds-rounded-lg"
|
|
149
|
-
}, null, 8, _e),
|
|
150
|
-
v(F, {
|
|
151
|
-
class: "ds-right-1 ds-top-1 ds-h-8 ds-w-8",
|
|
152
|
-
onClick: I(K, ["stop"])
|
|
153
|
-
})
|
|
154
|
-
]))
|
|
155
|
-
])),
|
|
156
|
-
i("div", ye, [
|
|
157
|
-
v(de, { onClick: H }, {
|
|
158
|
-
default: x(() => [
|
|
159
|
-
Z(ee(D(f)("ds.components.base.image_picker.select_image")), 1)
|
|
160
|
-
]),
|
|
161
|
-
appendIcon: x(() => [
|
|
162
|
-
ke
|
|
163
|
-
]),
|
|
164
|
-
_: 1
|
|
165
|
-
}),
|
|
166
|
-
i("input", {
|
|
167
|
-
ref_key: "inputRef",
|
|
168
|
-
ref: h,
|
|
169
|
-
accept: b.value,
|
|
170
|
-
multiple: a.multiple,
|
|
171
|
-
class: "ds-hidden",
|
|
172
|
-
type: "file",
|
|
173
|
-
onChange: O
|
|
174
|
-
}, null, 40, De)
|
|
175
|
-
])
|
|
176
|
-
]),
|
|
177
|
-
a.hideDetails ? V("", !0) : (n(), te(ne, {
|
|
178
|
-
key: 0,
|
|
179
|
-
"error-message": D($).errorMessage(),
|
|
180
|
-
class: "ds-mt-1"
|
|
181
|
-
}, null, 8, ["error-message"])),
|
|
182
|
-
v(re, {
|
|
183
|
-
modelValue: g.value.visible,
|
|
184
|
-
"onUpdate:modelValue": t[1] || (t[1] = (l) => g.value.visible = l),
|
|
185
|
-
url: g.value.url
|
|
186
|
-
}, null, 8, ["modelValue", "url"])
|
|
187
|
-
]));
|
|
188
|
-
}
|
|
189
|
-
});
|
|
1
|
+
import f from "./design-system41.mjs";
|
|
190
2
|
export {
|
|
191
|
-
|
|
3
|
+
f as default
|
|
192
4
|
};
|
|
193
5
|
//# sourceMappingURL=design-system86.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"design-system86.mjs","sources":["../src/components/BImagePicker/BImagePicker.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { createVNode as _createVNode, unref as _unref, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createElementVNode as _createElementVNode, withModifiers as _withModifiers, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, withCtx as _withCtx, createBlock as _createBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \"vue\"\n\nconst _withScopeId = n => (_pushScopeId(\"data-v-8033e228\"),n=n(),_popScopeId(),n)\nconst _hoisted_1 = { class: \"b-image-picker ds-w-full\" }\nconst _hoisted_2 = { class: \"ds-gap-2 ds-space-y-4 ds-rounded-lg ds-bg-white ds-p-4 ds-drop-shadow\" }\nconst _hoisted_3 = {\n key: 0,\n class: \"ds-flex ds-flex-wrap ds-justify-center ds-gap-1\"\n}\nconst _hoisted_4 = [\"onClick\", \"onDragenter\", \"onDragstart\", \"onDrop\"]\nconst _hoisted_5 = [\"src\"]\nconst _hoisted_6 = [\"src\"]\nconst _hoisted_7 = { class: \"ds-flex ds-flex-wrap ds-justify-center\" }\nconst _hoisted_8 = /*#__PURE__*/ _withScopeId(() => /*#__PURE__*/_createElementVNode(\"svg\", {\n class: \"ds-h-4 ds-w-4 ds-fill-primary-t\",\n viewBox: \"0 0 512 512\",\n xmlns: \"http://www.w3.org/2000/svg\"\n}, [\n /*#__PURE__*/_createElementVNode(\"path\", { d: \"M447.1 32h-384C28.64 32-.0091 60.65-.0091 96v320c0 35.35 28.65 64 63.1 64h384c35.35 0 64-28.65 64-64V96C511.1 60.65 483.3 32 447.1 32zM111.1 96c26.51 0 48 21.49 48 48S138.5 192 111.1 192s-48-21.49-48-48S85.48 96 111.1 96zM446.1 407.6C443.3 412.8 437.9 416 432 416H82.01c-6.021 0-11.53-3.379-14.26-8.75c-2.73-5.367-2.215-11.81 1.334-16.68l70-96C142.1 290.4 146.9 288 152 288s9.916 2.441 12.93 6.574l32.46 44.51l93.3-139.1C293.7 194.7 298.7 192 304 192s10.35 2.672 13.31 7.125l128 192C448.6 396 448.9 402.3 446.1 407.6z\" })\n], -1))\nconst _hoisted_9 = [\"accept\", \"multiple\"]\n\nimport { FileImageTypes } from '@/constants/Common';\nimport type { FileItemRead } from '@/types';\nimport { isEmpty } from 'lodash-es';\nimport { v4 as uuid } from 'uuid';\nimport { computed, ref } from 'vue';\nimport { useI18n } from 'vue-i18n';\nimport BImagePickerCloseButton from './BImagePickerCloseButton.vue';\nimport ImagePreview from './BImagePreview.vue';\nimport type { ValidationRule } from '@/composables/Validation';\nimport { useValidationField } from '@/composables/Validation';\nimport BLabel from '../BLabel.vue';\nimport BButton from '../BButton.vue';\nimport BErrorMessage from '../BErrorMessage.vue';\n\n//#region Props\nexport interface Props {\n inputId?: string;\n /**\n * Empty object <code>multiple: false</code> or empty array <code>multiple: true</code>.\n */\n modelValue: FileItemRead | FileItemRead[];\n label?: string;\n /**\n * Allow to pick multiple images, v-model expects an array.\n */\n multiple?: boolean;\n /**\n * Maximum file size in MB.\n */\n maxFileSize?: number;\n hideDetails?: boolean;\n required?: boolean;\n requiredErrorMessage?: string;\n validationRules?: ValidationRule[];\n}\n\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BImagePicker',\n props: {\n inputId: { default: '' },\n modelValue: {},\n label: { default: '' },\n multiple: { type: Boolean, default: false },\n maxFileSize: { default: 20 },\n hideDetails: { type: Boolean, default: false },\n required: { type: Boolean, default: false },\n requiredErrorMessage: { default: '' },\n validationRules: { default: undefined }\n },\n emits: [\"change\", \"update:modelValue\"],\n setup(__props: any, { expose: __expose, emit: __emit }) {\n\n// Drag & Drop: https://www.w3schools.com/jsref/event_ondragover.asp\nconst props = __props;\n//#endregion\n\n//#region Events\nconst emit = __emit;\n//#endregion\n\n//#region Data\nconst { t } = useI18n();\nconst inputRef = ref<HTMLInputElement | null>(null);\nconst draggedIndex = ref(0);\nconst value = computed({\n get() {\n return props.modelValue;\n },\n set(val) {\n emit('update:modelValue', val);\n },\n});\nconst fileTypesValid = ref(true);\nconst fileSizeValid = ref(true);\nconst previewImage = ref({\n visible: false,\n url: '',\n});\nconst allowedTypes = computed(() => FileImageTypes.join(', '));\nconst id = computed(() => props.inputId || `id-${uuid()}`);\nconst validateRequired: ValidationRule = {\n validateRule: (val: FileItemRead[]) => !!val && val.length > 0,\n errorMessage: () =>\n props.requiredErrorMessage || t('ds.global.field_required'),\n};\nconst validateFileTypesValid: ValidationRule = {\n validateRule: () => fileTypesValid.value,\n errorMessage: () =>\n t('ds.components.base.image_picker.file_types_valid', {\n types: allowedTypes.value,\n }),\n};\nconst validateFileSizeValid: ValidationRule = {\n validateRule: () => fileSizeValid.value,\n errorMessage: () =>\n t('ds.components.base.image_picker.file_size_valid', {\n size: props.maxFileSize,\n }),\n};\nconst vRules = computed(() => {\n let result: ValidationRule[] = [];\n\n if (props.required) {\n result.push(validateRequired);\n }\n if (props.validationRules) {\n result = result.concat(props.validationRules);\n }\n result.push(validateFileTypesValid);\n result.push(validateFileSizeValid);\n\n return result.length ? result : undefined;\n});\nconst { validate, validationResult } = useValidationField(\n id.value,\n value,\n vRules.value,\n);\n//#endregion\n\n//#region Methods\n/* Events fired on the drag target */\nconst handleDragStart = (index: number, e: DragEvent) => {\n draggedIndex.value = index;\n const target = e.target as HTMLDivElement;\n target.classList.add('dragging');\n e.dataTransfer!.effectAllowed = 'move';\n e.dataTransfer!.setData('index', index.toString());\n};\nconst handleDragEnd = (e: DragEvent) => {\n const target = e.target as HTMLDivElement;\n target.classList.remove('dragging');\n};\n/* Events fired on the drop target */\nconst handleDragEnter = (index: number, e: DragEvent) => {\n const target = e.target as HTMLDivElement;\n if (draggedIndex.value !== index) {\n target.classList.add('dropped-target');\n }\n};\nconst handleDragOver = (e: DragEvent) => {\n // By default, data/elements cannot be dropped in other elements. To allow a drop, we must prevent the default handling of the element\n e.preventDefault();\n e.dataTransfer!.dropEffect = 'move';\n};\nconst handleDragLeave = (e: DragEvent) => {\n // When the draggable p element leaves the droptarget, reset the style\n const target = e.target as HTMLDivElement;\n target.classList.remove('dropped-target');\n};\nconst handleDrop = (index: number, e: DragEvent) => {\n e.preventDefault();\n const target = e.target as HTMLDivElement;\n target.classList.remove('dropped-target');\n const draggedIndex = parseInt(e.dataTransfer!.getData('index'));\n const draggedImg = (value.value as FileItemRead[])[draggedIndex];\n (value.value as FileItemRead[]).splice(draggedIndex, 1);\n (value.value as FileItemRead[]).splice(index, 0, draggedImg);\n\n emit('change');\n validate();\n};\nconst openFileDialog = () => {\n inputRef.value?.click();\n};\nconst handleChangeInput = (e: any) => {\n let fileList: FileList = e.target.files || e.dataTransfer.files;\n if (!fileList.length) {\n return;\n }\n createFileImages(fileList);\n\n // Clear input's value so onChange event can work for the same files next picks\n if (inputRef.value) {\n inputRef.value.value = null as any;\n }\n};\nconst createFileImages = (fileList: FileList) => {\n Array.from(fileList).forEach((file) => {\n fileTypesValid.value = FileImageTypes.includes(file.type);\n fileSizeValid.value = convertToMB(file.size) <= props.maxFileSize;\n\n if (fileTypesValid.value && fileSizeValid.value) {\n let reader: any = new FileReader();\n\n reader.onload = (f: any) => {\n if (props.multiple) {\n (value.value as FileItemRead[]).push({\n url: f.target.result,\n file,\n type: file.type,\n });\n } else {\n // splice(index, how-many, item1, item2,...);\n value.value = {\n url: f.target.result,\n file,\n type: file.type,\n };\n }\n\n emit('change');\n validate();\n };\n\n reader.readAsDataURL(file);\n } else {\n validate();\n }\n });\n};\nconst removeFileImage = (index: number) => {\n (value.value as FileItemRead[]).splice(index, 1);\n emit('change');\n validate();\n};\nconst removeFileImageSingle = () => {\n value.value = {};\n emit('change');\n validate();\n};\nconst convertToMB = (numberOfBytes: number) => numberOfBytes / 1024 ** 2;\nconst preview = (item: FileItemRead) => {\n previewImage.value.url = item.url || '';\n previewImage.value.visible = true;\n};\n//#endregion\n\n__expose({ validate });\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"div\", _hoisted_1, [\n _createVNode(BLabel, {\n label: props.label\n }, null, 8, [\"label\"]),\n _createElementVNode(\"div\", _hoisted_2, [\n (!_unref(isEmpty)(value.value))\n ? (_openBlock(), _createElementBlock(\"div\", _hoisted_3, [\n (props.multiple)\n ? (_openBlock(true), _createElementBlock(_Fragment, { key: 0 }, _renderList(value.value as FileItemRead[], (item, index) => {\n return (_openBlock(), _createElementBlock(\"div\", {\n key: item.url,\n class: \"b-image-picker__draggable ds-h-full ds-cursor-pointer ds-rounded-lg ds-transition-all hover:ds-ring-2 hover:ds-ring-primary-t\",\n draggable: \"true\",\n onClick: ($event: any) => (preview(item)),\n onDragend: handleDragEnd,\n onDragenter: ($event: any) => (handleDragEnter(index, $event)),\n onDragleave: handleDragLeave,\n onDragover: handleDragOver,\n onDragstart: ($event: any) => (handleDragStart(index, $event)),\n onDrop: ($event: any) => (handleDrop(index, $event))\n }, [\n _createElementVNode(\"img\", {\n src: item.url,\n alt: \"image\",\n class: \"ds-h-full ds-w-full ds-rounded-lg\"\n }, null, 8, _hoisted_5),\n _createVNode(BImagePickerCloseButton, {\n class: \"ds-right-1 ds-top-1 ds-h-8 ds-w-8\",\n onClick: _withModifiers(($event: any) => (removeFileImage(index)), [\"stop\"])\n }, null, 8, [\"onClick\"])\n ], 40, _hoisted_4))\n }), 128))\n : (_openBlock(), _createElementBlock(\"div\", {\n key: 1,\n class: \"b-image-picker__draggable ds-h-full ds-cursor-pointer ds-rounded-lg ds-transition-all hover:ds-ring-2 hover:ds-ring-primary-t\",\n draggable: \"true\",\n onClick: _cache[0] || (_cache[0] = ($event: any) => (preview(value.value as FileItemRead)))\n }, [\n _createElementVNode(\"img\", {\n src: (value.value as FileItemRead).url,\n alt: \"image\",\n class: \"ds-h-full ds-w-full ds-rounded-lg\"\n }, null, 8, _hoisted_6),\n _createVNode(BImagePickerCloseButton, {\n class: \"ds-right-1 ds-top-1 ds-h-8 ds-w-8\",\n onClick: _withModifiers(removeFileImageSingle, [\"stop\"])\n })\n ]))\n ]))\n : _createCommentVNode(\"\", true),\n _createElementVNode(\"div\", _hoisted_7, [\n _createVNode(BButton, { onClick: openFileDialog }, {\n default: _withCtx(() => [\n _createTextVNode(_toDisplayString(_unref(t)('ds.components.base.image_picker.select_image')), 1)\n ]),\n appendIcon: _withCtx(() => [\n _hoisted_8\n ]),\n _: 1\n }),\n _createElementVNode(\"input\", {\n ref_key: \"inputRef\",\n ref: inputRef,\n accept: allowedTypes.value,\n multiple: props.multiple,\n class: \"ds-hidden\",\n type: \"file\",\n onChange: handleChangeInput\n }, null, 40, _hoisted_9)\n ])\n ]),\n (!props.hideDetails)\n ? (_openBlock(), _createBlock(BErrorMessage, {\n key: 0,\n \"error-message\": _unref(validationResult).errorMessage(),\n class: \"ds-mt-1\"\n }, null, 8, [\"error-message\"]))\n : _createCommentVNode(\"\", true),\n _createVNode(ImagePreview, {\n modelValue: previewImage.value.visible,\n \"onUpdate:modelValue\": _cache[1] || (_cache[1] = ($event: any) => ((previewImage.value.visible) = $event)),\n url: previewImage.value.url\n }, null, 8, [\"modelValue\", \"url\"])\n ]))\n}\n}\n\n})"],"names":["_withScopeId","_pushScopeId","n","_popScopeId","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_createElementVNode","_hoisted_9","_sfc_main","_defineComponent","__props","__expose","__emit","props","emit","t","useI18n","inputRef","ref","draggedIndex","value","computed","val","fileTypesValid","fileSizeValid","previewImage","allowedTypes","FileImageTypes","id","uuid","validateRequired","validateFileTypesValid","validateFileSizeValid","vRules","result","validate","validationResult","useValidationField","handleDragStart","index","e","handleDragEnd","handleDragEnter","target","handleDragOver","handleDragLeave","handleDrop","draggedImg","openFileDialog","_a","handleChangeInput","fileList","createFileImages","file","convertToMB","reader","f","removeFileImage","removeFileImageSingle","numberOfBytes","preview","item","_ctx","_cache","_openBlock","_createElementBlock","_createVNode","BLabel","_unref","isEmpty","_createCommentVNode","_Fragment","_renderList","$event","BImagePickerCloseButton","_withModifiers","BButton","_withCtx","_createTextVNode","_toDisplayString","_createBlock","BErrorMessage","ImagePreview"],"mappings":";;;;;;;;;;;AAGA,MAAMA,KAAe,QAAMC,GAAa,iBAAiB,GAAEC,IAAEA,KAAIC,MAAcD,IACzEE,KAAa,EAAE,OAAO,8BACtBC,KAAa,EAAE,OAAO,2EACtBC,KAAa;AAAA,E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ACjD,SAAS6B,EAAS,MAAM;AAAA,cACtBC,EAAiBC,GAAiBX,EAAOrD,CAAC,EAAE,8CAA8C,CAAC,GAAG,CAAC;AAAA,YAAA,CAChG;AAAA,YACD,YAAY8D,EAAS,MAAM;AAAA,cACzBxE;AAAA,YAAA,CACD;AAAA,YACD,GAAG;AAAA,UAAA,CACJ;AAAA,UACDC,EAAoB,SAAS;AAAA,YAC3B,SAAS;AAAA,YACT,KAAKW;AAAA,YACL,QAAQS,EAAa;AAAA,YACrB,UAAUb,EAAM;AAAA,YAChB,OAAO;AAAA,YACP,MAAM;AAAA,YACN,UAAUqC;AAAA,UAAA,GACT,MAAM,IAAI3C,EAAU;AAAA,QAAA,CACxB;AAAA,MAAA,CACF;AAAA,MACCM,EAAM,cAMJyD,EAAoB,IAAI,EAAI,KAL3BN,EAAW,GAAGgB,GAAaC,IAAe;AAAA,QACzC,KAAK;AAAA,QACL,iBAAiBb,EAAOhC,CAAgB,EAAE,aAAa;AAAA,QACvD,OAAO;AAAA,MAAA,GACN,MAAM,GAAG,CAAC,eAAe,CAAC;AAAA,MAEjC8B,EAAagB,IAAc;AAAA,QACzB,YAAYzD,EAAa,MAAM;AAAA,QAC/B,uBAAuBsC,EAAO,CAAC,MAAMA,EAAO,CAAC,IAAI,CAACU,MAAkBhD,EAAa,MAAM,UAAWgD;AAAA,QAClG,KAAKhD,EAAa,MAAM;AAAA,SACvB,MAAM,GAAG,CAAC,cAAc,KAAK,CAAC;AAAA,IAAA,CAClC;AAAA,EAEH;AAEA,CAAC;"}
|
|
1
|
+
{"version":3,"file":"design-system86.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/design-system87.mjs
CHANGED
|
@@ -1,5 +1,105 @@
|
|
|
1
|
-
|
|
1
|
+
import { defineComponent as C, ref as v, computed as S, watch as L, onMounted as T, onBeforeUnmount as F, openBlock as H, createElementBlock as R, Fragment as I, createElementVNode as d, renderSlot as _, withDirectives as O, vShow as P, pushScopeId as $, popScopeId as z } from "vue";
|
|
2
|
+
import { BTooltipPosition as c, BTooltipOpenEvent as i } from "./design-system5.mjs";
|
|
3
|
+
const D = (a) => ($("data-v-78f7c276"), a = a(), z(), a), M = { class: "ds-relative" }, N = /* @__PURE__ */ D(() => /* @__PURE__ */ d("div", {
|
|
4
|
+
class: "tooltip-arrow",
|
|
5
|
+
"data-popper-arrow": ""
|
|
6
|
+
}, null, -1)), q = /* @__PURE__ */ C({
|
|
7
|
+
__name: "BTooltip",
|
|
8
|
+
props: {
|
|
9
|
+
modelValue: { type: Boolean, default: !1 },
|
|
10
|
+
position: { default: c.Top },
|
|
11
|
+
openEvent: { default: i.Hover }
|
|
12
|
+
},
|
|
13
|
+
emits: ["update:modelValue"],
|
|
14
|
+
setup(a, { emit: w }) {
|
|
15
|
+
const s = a, B = w, t = v(null), o = v(null), p = v(!1), n = S({
|
|
16
|
+
get() {
|
|
17
|
+
return s.modelValue !== void 0 ? s.modelValue : p.value;
|
|
18
|
+
},
|
|
19
|
+
set(e) {
|
|
20
|
+
s.modelValue !== void 0 ? B("update:modelValue", e) : p.value = e;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
L(
|
|
24
|
+
() => s.position,
|
|
25
|
+
() => {
|
|
26
|
+
x(), h();
|
|
27
|
+
}
|
|
28
|
+
), L(
|
|
29
|
+
() => s.openEvent,
|
|
30
|
+
() => {
|
|
31
|
+
g(), b();
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
const m = () => {
|
|
35
|
+
n.value = !n.value;
|
|
36
|
+
}, f = () => {
|
|
37
|
+
n.value = !0;
|
|
38
|
+
}, V = () => {
|
|
39
|
+
n.value = !1;
|
|
40
|
+
}, E = () => {
|
|
41
|
+
n.value = !0;
|
|
42
|
+
}, k = () => {
|
|
43
|
+
n.value = !1;
|
|
44
|
+
}, x = () => {
|
|
45
|
+
o.value && (o.value.style.top = "", o.value.style.right = "", o.value.style.bottom = "", o.value.style.left = "");
|
|
46
|
+
}, h = () => {
|
|
47
|
+
if (o.value)
|
|
48
|
+
switch (s.position) {
|
|
49
|
+
case c.Bottom:
|
|
50
|
+
o.value.style.top = "4px";
|
|
51
|
+
break;
|
|
52
|
+
case c.Top:
|
|
53
|
+
default:
|
|
54
|
+
o.value.style.bottom = "24px";
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
}, b = () => {
|
|
58
|
+
var e, l, u, r, y;
|
|
59
|
+
switch (s.openEvent) {
|
|
60
|
+
case i.Click:
|
|
61
|
+
(e = t.value) == null || e.addEventListener("click", m);
|
|
62
|
+
break;
|
|
63
|
+
case i.Focus:
|
|
64
|
+
(l = t.value) == null || l.addEventListener("focus", f), (u = t.value) == null || u.addEventListener("focusout", V);
|
|
65
|
+
break;
|
|
66
|
+
case i.Hover:
|
|
67
|
+
default:
|
|
68
|
+
(r = t.value) == null || r.addEventListener("mouseover", E), (y = t.value) == null || y.addEventListener("mouseleave", k);
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
}, g = () => {
|
|
72
|
+
var e, l, u, r;
|
|
73
|
+
(e = t.value) == null || e.removeEventListener("click", m), (l = t.value) == null || l.removeEventListener("focus", f), (u = t.value) == null || u.removeEventListener("mouseover", E), (r = t.value) == null || r.removeEventListener("mouseleave", k);
|
|
74
|
+
};
|
|
75
|
+
return T(() => {
|
|
76
|
+
b(), h();
|
|
77
|
+
}), F(() => {
|
|
78
|
+
g();
|
|
79
|
+
}), (e, l) => (H(), R(I, null, [
|
|
80
|
+
d("div", {
|
|
81
|
+
ref_key: "toggleRef",
|
|
82
|
+
ref: t,
|
|
83
|
+
class: "ds-inline"
|
|
84
|
+
}, [
|
|
85
|
+
_(e.$slots, "toggle", {}, void 0, !0)
|
|
86
|
+
], 512),
|
|
87
|
+
O(d("div", M, [
|
|
88
|
+
d("div", {
|
|
89
|
+
ref_key: "contentRef",
|
|
90
|
+
ref: o,
|
|
91
|
+
class: "ds-absolute ds-z-10 ds-inline-block ds-rounded-lg ds-bg-black/65 ds-px-3 ds-py-2 ds-text-sm ds-font-medium ds-text-white ds-shadow-sm ds-transition-opacity ds-duration-300"
|
|
92
|
+
}, [
|
|
93
|
+
_(e.$slots, "default", {}, void 0, !0),
|
|
94
|
+
N
|
|
95
|
+
], 512)
|
|
96
|
+
], 512), [
|
|
97
|
+
[P, n.value]
|
|
98
|
+
])
|
|
99
|
+
], 64));
|
|
100
|
+
}
|
|
101
|
+
});
|
|
2
102
|
export {
|
|
3
|
-
|
|
103
|
+
q as default
|
|
4
104
|
};
|
|
5
105
|
//# sourceMappingURL=design-system87.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"design-system87.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
1
|
+
{"version":3,"file":"design-system87.mjs","sources":["../src/components/BTooltip.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { renderSlot as _renderSlot, createElementVNode as _createElementVNode, vShow as _vShow, withDirectives as _withDirectives, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \"vue\"\n\nconst _withScopeId = n => (_pushScopeId(\"data-v-78f7c276\"),n=n(),_popScopeId(),n)\nconst _hoisted_1 = { class: \"ds-relative\" }\nconst _hoisted_2 = /*#__PURE__*/ _withScopeId(() => /*#__PURE__*/_createElementVNode(\"div\", {\n class: \"tooltip-arrow\",\n \"data-popper-arrow\": \"\"\n}, null, -1))\n\nimport { BTooltipOpenEvent, BTooltipPosition } from '@/constants/Enums';\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';\n\n//#region Props\nexport interface BTooltipProps {\n modelValue?: boolean;\n /**\n * Position of opened tooltip compare to its toggle.\n */\n position?: `${BTooltipPosition}`;\n /**\n * Event to open tooltip.\n */\n openEvent?: `${BTooltipOpenEvent}`;\n}\n\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BTooltip',\n props: {\n modelValue: { type: Boolean, default: false },\n position: { default: BTooltipPosition.Top },\n openEvent: { default: BTooltipOpenEvent.Hover }\n },\n emits: [\"update:modelValue\"],\n setup(__props: any, { emit: __emit }) {\n\nconst props = __props;\n//#endregion\n\n//#region Events\nconst emit = __emit;\n//#endregion\n\n//region Data\nconst toggleRef = ref<HTMLDivElement | null>(null);\nconst contentRef = ref<HTMLDivElement | null>(null);\nconst mValue = ref(false);\nconst value = computed({\n get() {\n return props.modelValue !== undefined ? props.modelValue : mValue.value;\n },\n set(val: boolean) {\n if (props.modelValue !== undefined) {\n emit('update:modelValue', val);\n } else {\n mValue.value = val;\n }\n },\n});\n//endregion\n\n//region Watchers\nwatch(\n () => props.position,\n () => {\n resetContentPosition();\n ensureContentPosition();\n },\n);\nwatch(\n () => props.openEvent,\n () => {\n clearEventListeners();\n ensureEventListeners();\n },\n);\n//#endregion\n\n//region Methods\nconst onClick = () => {\n value.value = !value.value;\n};\nconst onFocus = () => {\n value.value = true;\n};\nconst onFocusOut = () => {\n value.value = false;\n};\nconst onHover = () => {\n value.value = true;\n};\nconst onHoverOut = () => {\n value.value = false;\n};\nconst resetContentPosition = () => {\n if (!contentRef.value) {\n return;\n }\n contentRef.value.style.top = '';\n contentRef.value.style.right = '';\n contentRef.value.style.bottom = '';\n contentRef.value.style.left = '';\n};\nconst ensureContentPosition = () => {\n if (!contentRef.value) {\n return;\n }\n\n switch (props.position) {\n case BTooltipPosition.Bottom:\n contentRef.value.style.top = '4px';\n break;\n case BTooltipPosition.Top:\n default:\n contentRef.value.style.bottom = '24px';\n break;\n }\n};\nconst ensureEventListeners = () => {\n switch (props.openEvent) {\n case BTooltipOpenEvent.Click:\n toggleRef.value?.addEventListener('click', onClick);\n break;\n case BTooltipOpenEvent.Focus:\n toggleRef.value?.addEventListener('focus', onFocus);\n toggleRef.value?.addEventListener('focusout', onFocusOut);\n break;\n case BTooltipOpenEvent.Hover:\n default:\n toggleRef.value?.addEventListener('mouseover', onHover);\n toggleRef.value?.addEventListener('mouseleave', onHoverOut);\n break;\n }\n};\nconst clearEventListeners = () => {\n toggleRef.value?.removeEventListener('click', onClick);\n toggleRef.value?.removeEventListener('focus', onFocus);\n toggleRef.value?.removeEventListener('mouseover', onHover);\n toggleRef.value?.removeEventListener('mouseleave', onHoverOut);\n};\n//#endregion\n\n//#region Lifecycle Hooks\nonMounted(() => {\n ensureEventListeners();\n ensureContentPosition();\n});\nonBeforeUnmount(() => {\n clearEventListeners();\n});\n//#endregion\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(_Fragment, null, [\n _createElementVNode(\"div\", {\n ref_key: \"toggleRef\",\n ref: toggleRef,\n class: \"ds-inline\"\n }, [\n _renderSlot(_ctx.$slots, \"toggle\", {}, undefined, true)\n ], 512),\n _withDirectives(_createElementVNode(\"div\", _hoisted_1, [\n _createElementVNode(\"div\", {\n ref_key: \"contentRef\",\n ref: contentRef,\n class: \"ds-absolute ds-z-10 ds-inline-block ds-rounded-lg ds-bg-black/65 ds-px-3 ds-py-2 ds-text-sm ds-font-medium ds-text-white ds-shadow-sm ds-transition-opacity ds-duration-300\"\n }, [\n _renderSlot(_ctx.$slots, \"default\", {}, undefined, true),\n _hoisted_2\n ], 512)\n ], 512), [\n [_vShow, value.value]\n ])\n ], 64))\n}\n}\n\n})"],"names":["_withScopeId","_pushScopeId","n","_popScopeId","_hoisted_1","_hoisted_2","_createElementVNode","_sfc_main","_defineComponent","BTooltipPosition","BTooltipOpenEvent","__props","__emit","props","emit","toggleRef","ref","contentRef","mValue","value","computed","val","watch","resetContentPosition","ensureContentPosition","clearEventListeners","ensureEventListeners","onClick","onFocus","onFocusOut","onHover","onHoverOut","_a","_b","_c","_d","_e","onMounted","onBeforeUnmount","_ctx","_cache","_openBlock","_createElementBlock","_Fragment","_renderSlot","_withDirectives","_vShow"],"mappings":";;AAGA,MAAMA,IAAe,QAAMC,EAAa,iBAAiB,GAAEC,IAAEA,KAAIC,KAAcD,IACzEE,IAAa,EAAE,O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