@ulu/frontend-vue 0.6.25 → 0.6.26
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UluPopoverBase.vue.d.ts","sourceRoot":"","sources":["../../../lib/plugins/popovers/UluPopoverBase.vue"],"names":[],"mappings":"AA+BA;
|
|
1
|
+
{"version":3,"file":"UluPopoverBase.vue.d.ts","sourceRoot":"","sources":["../../../lib/plugins/popovers/UluPopoverBase.vue"],"names":[],"mappings":"AA+BA;wBAweqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAdjC;IAzHI;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;;;;;;;;;;;;;;;;;;;;;oBA0HJ"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { useUluFloating as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import { wasClickOutside as
|
|
5
|
-
const
|
|
1
|
+
import { ref as x, computed as y, watch as L, nextTick as v, onUnmounted as M, createElementBlock as u, openBlock as p, withKeys as T, unref as l, normalizeStyle as O, normalizeClass as j, createElementVNode as A, createCommentVNode as k, renderSlot as C } from "vue";
|
|
2
|
+
import { useUluFloating as H } from "../../composables/useUluFloating.js";
|
|
3
|
+
import { useModifiers as U } from "../../composables/useModifiers.js";
|
|
4
|
+
import { wasClickOutside as $ } from "@ulu/utils/browser/dom.js";
|
|
5
|
+
const z = ["data-placement"], K = { class: "popover__inner" }, N = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "popover__footer"
|
|
8
8
|
}, G = {
|
|
@@ -59,21 +59,21 @@ const $ = ["data-placement"], z = { class: "popover__inner" }, K = {
|
|
|
59
59
|
},
|
|
60
60
|
emits: ["close", "update:isOpen"],
|
|
61
61
|
setup(s, { expose: r, emit: c }) {
|
|
62
|
-
const d = c, e = s, o =
|
|
63
|
-
|
|
62
|
+
const d = c, e = s, o = x(null), { resolvedModifiers: _ } = U({ props: e, baseClass: "popover" }), f = y(() => e.config || {}), { floatingStyles: w, placement: E, arrowStyles: F, update: m, isFixedStrategy: S, contentArrow: h } = H(
|
|
63
|
+
y(() => e.trigger),
|
|
64
64
|
o,
|
|
65
65
|
f
|
|
66
66
|
), i = () => {
|
|
67
67
|
d("close"), d("update:isOpen", !1);
|
|
68
|
-
},
|
|
68
|
+
}, b = (t) => {
|
|
69
69
|
e.isOpen && e.escapeCloses && (t.preventDefault(), i());
|
|
70
70
|
};
|
|
71
71
|
let n = null;
|
|
72
72
|
const a = () => {
|
|
73
73
|
n && (document.removeEventListener("click", n), n = null);
|
|
74
|
-
},
|
|
74
|
+
}, B = () => {
|
|
75
75
|
a(), e.clickOutsideCloses && (n = (t) => {
|
|
76
|
-
if (!(!e.isOpen || !o.value) && document.body.contains(t.target) && !o.value.contains(t.target) &&
|
|
76
|
+
if (!(!e.isOpen || !o.value) && document.body.contains(t.target) && !o.value.contains(t.target) && $(o.value, t)) {
|
|
77
77
|
if (e.trigger instanceof HTMLElement && e.trigger.contains(t.target))
|
|
78
78
|
return;
|
|
79
79
|
i();
|
|
@@ -82,13 +82,13 @@ const $ = ["data-placement"], z = { class: "popover__inner" }, K = {
|
|
|
82
82
|
n && document.addEventListener("click", n);
|
|
83
83
|
}, 0));
|
|
84
84
|
};
|
|
85
|
-
return
|
|
86
|
-
t ? (m(),
|
|
85
|
+
return L(() => e.isOpen, (t, g) => {
|
|
86
|
+
t ? (m(), B(), e.directFocus && v(() => {
|
|
87
87
|
e.directFocus({ isOpen: !0, trigger: e.trigger, content: o.value });
|
|
88
|
-
})) : (a(), e.directFocus &&
|
|
88
|
+
})) : (a(), e.directFocus && g === !0 && v(() => {
|
|
89
89
|
e.directFocus({ isOpen: !1, trigger: e.trigger, content: o.value });
|
|
90
90
|
}));
|
|
91
|
-
}, { immediate: !0 }),
|
|
91
|
+
}, { immediate: !0 }), M(() => {
|
|
92
92
|
a();
|
|
93
93
|
}), r({
|
|
94
94
|
/**
|
|
@@ -103,42 +103,42 @@ const $ = ["data-placement"], z = { class: "popover__inner" }, K = {
|
|
|
103
103
|
* The internal root popover element reference
|
|
104
104
|
*/
|
|
105
105
|
content: o
|
|
106
|
-
}), (t,
|
|
107
|
-
class:
|
|
106
|
+
}), (t, g) => (p(), u("span", {
|
|
107
|
+
class: j(["popover", [
|
|
108
108
|
{
|
|
109
|
-
"popover--fixed": l(
|
|
109
|
+
"popover--fixed": l(S),
|
|
110
110
|
"is-active": s.isOpen
|
|
111
111
|
},
|
|
112
|
-
l(
|
|
112
|
+
l(_)
|
|
113
113
|
]]),
|
|
114
114
|
ref_key: "contentEl",
|
|
115
115
|
ref: o,
|
|
116
|
-
style:
|
|
117
|
-
"data-placement": l(
|
|
118
|
-
onKeydown:
|
|
116
|
+
style: O(l(w)),
|
|
117
|
+
"data-placement": l(E),
|
|
118
|
+
onKeydown: T(b, ["esc"]),
|
|
119
119
|
tabindex: "-1"
|
|
120
120
|
}, [
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
A("span", K, [
|
|
122
|
+
C(t.$slots, "default", {
|
|
123
123
|
isOpen: s.isOpen,
|
|
124
124
|
close: i
|
|
125
125
|
})
|
|
126
126
|
]),
|
|
127
|
-
t.$slots.footer ? (p(), u("span",
|
|
128
|
-
|
|
127
|
+
t.$slots.footer ? (p(), u("span", N, [
|
|
128
|
+
C(t.$slots, "footer", {
|
|
129
129
|
isOpen: s.isOpen,
|
|
130
130
|
close: i
|
|
131
131
|
})
|
|
132
|
-
])) :
|
|
132
|
+
])) : k("", !0),
|
|
133
133
|
f.value.arrow ? (p(), u("span", {
|
|
134
134
|
key: 1,
|
|
135
135
|
class: "popover__arrow",
|
|
136
136
|
ref_key: "contentArrow",
|
|
137
|
-
ref:
|
|
138
|
-
style:
|
|
137
|
+
ref: h,
|
|
138
|
+
style: O(l(F)),
|
|
139
139
|
"data-ulu-popover-arrow": ""
|
|
140
|
-
}, null, 4)) :
|
|
141
|
-
], 46,
|
|
140
|
+
}, null, 4)) : k("", !0)
|
|
141
|
+
], 46, z));
|
|
142
142
|
}
|
|
143
143
|
};
|
|
144
144
|
export {
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
}
|
|
159
159
|
};
|
|
160
160
|
|
|
161
|
-
watch(() => props.isOpen, (newVal) => {
|
|
161
|
+
watch(() => props.isOpen, (newVal, oldVal) => {
|
|
162
162
|
if (newVal) {
|
|
163
163
|
update();
|
|
164
164
|
addOutsideClick();
|
|
@@ -169,7 +169,9 @@
|
|
|
169
169
|
}
|
|
170
170
|
} else {
|
|
171
171
|
destroyOutsideClick();
|
|
172
|
-
if
|
|
172
|
+
// Only return focus if we are actually transitioning from open to closed
|
|
173
|
+
// This prevents stealing focus on initial mount when oldVal is undefined
|
|
174
|
+
if (props.directFocus && oldVal === true) {
|
|
173
175
|
nextTick(() => {
|
|
174
176
|
props.directFocus({ isOpen: false, trigger: props.trigger, content: contentEl.value });
|
|
175
177
|
});
|
package/package.json
CHANGED