@ulu/frontend-vue 0.6.24 → 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.
- package/dist/components/collapsible/UluAccordion.vue.d.ts +2 -2
- package/dist/components/collapsible/UluCollapsible.vue.d.ts +2 -2
- package/dist/components/collapsible/UluModal.vue.d.ts +2 -2
- package/dist/components/systems/facets/UluFacetsSort.vue.d.ts +2 -2
- package/dist/mcp-data.json +3545 -3514
- package/dist/plugins/popovers/UluPopover.vue.d.ts +8 -6
- package/dist/plugins/popovers/UluPopover.vue.d.ts.map +1 -1
- package/dist/plugins/popovers/UluPopover.vue.js +64 -50
- package/dist/plugins/popovers/UluPopoverBase.vue.d.ts +1 -1
- package/dist/plugins/popovers/UluPopoverBase.vue.d.ts.map +1 -1
- package/dist/plugins/popovers/UluPopoverBase.vue.js +34 -34
- package/dist/plugins/tour/UluTourDisplay.vue.d.ts +2 -2
- package/lib/plugins/popovers/UluPopover.vue +22 -2
- package/lib/plugins/popovers/UluPopoverBase.vue +6 -3
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ declare const __VLS_component: import('vue').DefineComponent<{}, {
|
|
|
7
7
|
/**
|
|
8
8
|
* The reactive internal open/closed state of the popover
|
|
9
9
|
*/
|
|
10
|
-
isOpen: import('vue').
|
|
10
|
+
isOpen: import('vue').WritableComputedRef<boolean, boolean>;
|
|
11
11
|
/**
|
|
12
12
|
* Method to toggle the popover open/closed
|
|
13
13
|
*/
|
|
@@ -21,7 +21,7 @@ declare const __VLS_component: import('vue').DefineComponent<{}, {
|
|
|
21
21
|
* @param {Boolean} toOpen - The desired state
|
|
22
22
|
*/
|
|
23
23
|
changeTo: (toOpen: any) => void;
|
|
24
|
-
$emit: (event: "toggle", ...args: any[]) => void;
|
|
24
|
+
$emit: (event: "toggle" | "update:modelValue", ...args: any[]) => void;
|
|
25
25
|
clickOutsideCloses: boolean;
|
|
26
26
|
config: Record<string, any>;
|
|
27
27
|
disabled: boolean;
|
|
@@ -30,6 +30,7 @@ declare const __VLS_component: import('vue').DefineComponent<{}, {
|
|
|
30
30
|
activeClass: string;
|
|
31
31
|
classes: Record<string, any>;
|
|
32
32
|
directFocus?: Function | undefined;
|
|
33
|
+
modelValue?: boolean | undefined;
|
|
33
34
|
triggerText?: string | undefined;
|
|
34
35
|
triggerAlt?: string | undefined;
|
|
35
36
|
tooltip?: string | undefined;
|
|
@@ -43,6 +44,7 @@ declare const __VLS_component: import('vue').DefineComponent<{}, {
|
|
|
43
44
|
readonly activeClass?: string | undefined;
|
|
44
45
|
readonly classes?: Record<string, any> | undefined;
|
|
45
46
|
readonly directFocus?: Function | undefined;
|
|
47
|
+
readonly modelValue?: boolean | undefined;
|
|
46
48
|
readonly triggerText?: string | undefined;
|
|
47
49
|
readonly triggerAlt?: string | undefined;
|
|
48
50
|
readonly tooltip?: string | undefined;
|
|
@@ -75,7 +77,7 @@ declare const __VLS_component: import('vue').DefineComponent<{}, {
|
|
|
75
77
|
close: () => void;
|
|
76
78
|
update: Function;
|
|
77
79
|
content: import('vue').Ref<null, null>;
|
|
78
|
-
$emit: (event: "close", ...args: any[]) => void;
|
|
80
|
+
$emit: (event: "close" | "update:isOpen", ...args: any[]) => void;
|
|
79
81
|
isOpen: boolean;
|
|
80
82
|
clickOutsideCloses: boolean;
|
|
81
83
|
escapeCloses: boolean;
|
|
@@ -116,7 +118,7 @@ declare const __VLS_component: import('vue').DefineComponent<{}, {
|
|
|
116
118
|
close: () => void;
|
|
117
119
|
update: Function;
|
|
118
120
|
content: import('vue').Ref<null, null>;
|
|
119
|
-
$emit: (event: "close", ...args: any[]) => void;
|
|
121
|
+
$emit: (event: "close" | "update:isOpen", ...args: any[]) => void;
|
|
120
122
|
isOpen: boolean;
|
|
121
123
|
clickOutsideCloses: boolean;
|
|
122
124
|
escapeCloses: boolean;
|
|
@@ -183,7 +185,7 @@ type __VLS_TemplateResult = {
|
|
|
183
185
|
close: () => void;
|
|
184
186
|
update: Function;
|
|
185
187
|
content: Ref<null, null>;
|
|
186
|
-
$emit: (event: "close", ...args: any[]) => void;
|
|
188
|
+
$emit: (event: "close" | "update:isOpen", ...args: any[]) => void;
|
|
187
189
|
isOpen: boolean;
|
|
188
190
|
clickOutsideCloses: boolean;
|
|
189
191
|
escapeCloses: boolean;
|
|
@@ -208,7 +210,7 @@ type __VLS_TemplateResult = {
|
|
|
208
210
|
close: () => void;
|
|
209
211
|
update: Function;
|
|
210
212
|
content: Ref<null, null>;
|
|
211
|
-
$emit: (event: "close", ...args: any[]) => void;
|
|
213
|
+
$emit: (event: "close" | "update:isOpen", ...args: any[]) => void;
|
|
212
214
|
isOpen: boolean;
|
|
213
215
|
clickOutsideCloses: boolean;
|
|
214
216
|
escapeCloses: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UluPopover.vue.d.ts","sourceRoot":"","sources":["../../../lib/plugins/popovers/UluPopover.vue"],"names":[],"mappings":"AA8CA;
|
|
1
|
+
{"version":3,"file":"UluPopover.vue.d.ts","sourceRoot":"","sources":["../../../lib/plugins/popovers/UluPopover.vue"],"names":[],"mappings":"AA8CA;wBAmaqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAbjC;IAhLI;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;;OAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAoLy8c,GAAG,8CAA8C,GAAG,yBAAyB,GAAG,6DAAmC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QATnkd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCAS68c,GAAG"}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
import { computed as
|
|
1
|
+
import { computed as O, ref as r, resolveDirective as I, createElementBlock as b, openBlock as y, Fragment as T, withDirectives as j, createVNode as z, unref as a, normalizeClass as C, renderSlot as d, createTextVNode as h, toDisplayString as w, createSlots as D, withCtx as k } from "vue";
|
|
2
2
|
import { useRequiredInject as E } from "../../composables/useRequiredInject.js";
|
|
3
3
|
import { POPOVER_OPTIONS_KEY as N } from "./index.js";
|
|
4
|
-
import
|
|
5
|
-
import { newId as
|
|
6
|
-
import
|
|
7
|
-
const
|
|
4
|
+
import A from "./defaults.js";
|
|
5
|
+
import { newId as B } from "../../utils/dom.js";
|
|
6
|
+
import R from "./UluPopoverBase.vue.js";
|
|
7
|
+
const q = ["id", "disabled", "aria-expanded", "aria-controls", "aria-label"], M = {
|
|
8
8
|
__name: "UluPopover",
|
|
9
9
|
props: {
|
|
10
|
+
/**
|
|
11
|
+
* V-model state to control the popover externally
|
|
12
|
+
*/
|
|
13
|
+
modelValue: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: void 0
|
|
16
|
+
},
|
|
10
17
|
triggerText: String,
|
|
11
18
|
triggerAlt: String,
|
|
12
19
|
disabled: Boolean,
|
|
@@ -36,90 +43,97 @@ const R = ["id", "disabled", "aria-expanded", "aria-controls", "aria-label"], L
|
|
|
36
43
|
*/
|
|
37
44
|
directFocus: Function
|
|
38
45
|
},
|
|
39
|
-
emits: ["toggle"],
|
|
40
|
-
setup(e, { expose:
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
emits: ["toggle", "update:modelValue"],
|
|
47
|
+
setup(e, { expose: S, emit: V }) {
|
|
48
|
+
const c = V, l = e, u = B(), g = B(), f = E(N), $ = f ? f.popover : A.popover, F = O(() => ({ ...$, ...l.config })), m = r(l.startOpen || !1), p = r(null), P = r(null), o = O({
|
|
49
|
+
get() {
|
|
50
|
+
return l.modelValue !== void 0 ? l.modelValue : m.value;
|
|
51
|
+
},
|
|
52
|
+
set(t) {
|
|
53
|
+
l.modelValue !== void 0 ? c("update:modelValue", t) : m.value = t;
|
|
54
|
+
}
|
|
55
|
+
}), n = () => {
|
|
56
|
+
i(!o.value);
|
|
57
|
+
}, i = (t) => {
|
|
58
|
+
o.value = t, c("toggle", { isOpen: t });
|
|
59
|
+
}, s = () => i(!1);
|
|
60
|
+
return S({
|
|
47
61
|
/**
|
|
48
62
|
* The reactive internal open/closed state of the popover
|
|
49
63
|
*/
|
|
50
|
-
isOpen:
|
|
64
|
+
isOpen: o,
|
|
51
65
|
/**
|
|
52
66
|
* Method to toggle the popover open/closed
|
|
53
67
|
*/
|
|
54
|
-
toggle:
|
|
68
|
+
toggle: n,
|
|
55
69
|
/**
|
|
56
70
|
* Method to force the popover closed
|
|
57
71
|
*/
|
|
58
|
-
close:
|
|
72
|
+
close: s,
|
|
59
73
|
/**
|
|
60
74
|
* Method to explicitly set the open state
|
|
61
75
|
* @param {Boolean} toOpen - The desired state
|
|
62
76
|
*/
|
|
63
77
|
changeTo: i
|
|
64
|
-
}), (
|
|
65
|
-
const
|
|
66
|
-
return
|
|
67
|
-
|
|
78
|
+
}), (t, v) => {
|
|
79
|
+
const x = I("ulu-tooltip");
|
|
80
|
+
return y(), b(T, null, [
|
|
81
|
+
j((y(), b("button", {
|
|
68
82
|
type: "button",
|
|
69
83
|
ref_key: "trigger",
|
|
70
|
-
ref:
|
|
71
|
-
onClick:
|
|
72
|
-
id:
|
|
84
|
+
ref: p,
|
|
85
|
+
onClick: n,
|
|
86
|
+
id: a(g),
|
|
73
87
|
disabled: e.disabled,
|
|
74
|
-
class:
|
|
75
|
-
{ [e.activeClass]:
|
|
88
|
+
class: C([
|
|
89
|
+
{ [e.activeClass]: o.value },
|
|
76
90
|
e.classes.trigger
|
|
77
91
|
]),
|
|
78
|
-
"aria-expanded":
|
|
79
|
-
"aria-controls":
|
|
92
|
+
"aria-expanded": o.value ? "true" : "false",
|
|
93
|
+
"aria-controls": a(u),
|
|
80
94
|
"aria-label": e.triggerAlt
|
|
81
95
|
}, [
|
|
82
|
-
|
|
83
|
-
isOpen:
|
|
84
|
-
close:
|
|
96
|
+
d(t.$slots, "trigger", {
|
|
97
|
+
isOpen: o.value,
|
|
98
|
+
close: s
|
|
85
99
|
}, () => [
|
|
86
100
|
h(w(e.triggerText), 1)
|
|
87
101
|
])
|
|
88
|
-
], 10,
|
|
89
|
-
[
|
|
102
|
+
], 10, q)), [
|
|
103
|
+
[x, e.tooltip ? e.tooltip : null]
|
|
90
104
|
]),
|
|
91
|
-
|
|
105
|
+
z(R, {
|
|
92
106
|
ref_key: "popoverBase",
|
|
93
|
-
ref:
|
|
94
|
-
trigger:
|
|
95
|
-
config:
|
|
96
|
-
isOpen:
|
|
107
|
+
ref: P,
|
|
108
|
+
trigger: p.value,
|
|
109
|
+
config: F.value,
|
|
110
|
+
isOpen: o.value,
|
|
97
111
|
clickOutsideCloses: e.clickOutsideCloses,
|
|
98
112
|
directFocus: e.directFocus,
|
|
99
|
-
class:
|
|
113
|
+
class: C([
|
|
100
114
|
e.size ? `popover--${e.size}` : "",
|
|
101
115
|
{
|
|
102
116
|
"popover--no-padding": e.noPadding
|
|
103
117
|
},
|
|
104
118
|
e.classes.content
|
|
105
119
|
]),
|
|
106
|
-
"aria-labelledby":
|
|
107
|
-
id:
|
|
108
|
-
onClose: v[0] || (v[0] = (
|
|
120
|
+
"aria-labelledby": a(g),
|
|
121
|
+
id: a(u),
|
|
122
|
+
onClose: v[0] || (v[0] = (K) => i(!1))
|
|
109
123
|
}, D({
|
|
110
|
-
default:
|
|
111
|
-
|
|
112
|
-
isOpen:
|
|
113
|
-
toggle:
|
|
114
|
-
close:
|
|
124
|
+
default: k(() => [
|
|
125
|
+
d(t.$slots, "default", {
|
|
126
|
+
isOpen: o.value,
|
|
127
|
+
toggle: n,
|
|
128
|
+
close: s
|
|
115
129
|
})
|
|
116
130
|
]),
|
|
117
131
|
_: 2
|
|
118
132
|
}, [
|
|
119
|
-
|
|
133
|
+
t.$slots.footer ? {
|
|
120
134
|
name: "footer",
|
|
121
|
-
fn:
|
|
122
|
-
|
|
135
|
+
fn: k(() => [
|
|
136
|
+
d(t.$slots, "footer", { close: s })
|
|
123
137
|
]),
|
|
124
138
|
key: "0"
|
|
125
139
|
} : void 0
|
|
@@ -129,5 +143,5 @@ const R = ["id", "disabled", "aria-expanded", "aria-controls", "aria-label"], L
|
|
|
129
143
|
}
|
|
130
144
|
};
|
|
131
145
|
export {
|
|
132
|
-
|
|
146
|
+
M as default
|
|
133
147
|
};
|
|
@@ -16,7 +16,7 @@ declare const __VLS_component: import('vue').DefineComponent<{}, {
|
|
|
16
16
|
* The internal root popover element reference
|
|
17
17
|
*/
|
|
18
18
|
content: import('vue').Ref<null, null>;
|
|
19
|
-
$emit: (event: "close", ...args: any[]) => void;
|
|
19
|
+
$emit: (event: "close" | "update:isOpen", ...args: any[]) => void;
|
|
20
20
|
isOpen: boolean;
|
|
21
21
|
clickOutsideCloses: boolean;
|
|
22
22
|
escapeCloses: boolean;
|
|
@@ -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 = {
|
|
@@ -57,23 +57,23 @@ const $ = ["data-placement"], z = { class: "popover__inner" }, K = {
|
|
|
57
57
|
*/
|
|
58
58
|
modifiers: [String, Array, Object]
|
|
59
59
|
},
|
|
60
|
-
emits: ["close"],
|
|
60
|
+
emits: ["close", "update:isOpen"],
|
|
61
61
|
setup(s, { expose: r, emit: c }) {
|
|
62
|
-
const
|
|
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
|
-
|
|
68
|
-
},
|
|
67
|
+
d("close"), d("update:isOpen", !1);
|
|
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 ? (
|
|
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 && g(() => {
|
|
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
|
/**
|
|
@@ -98,47 +98,47 @@ const $ = ["data-placement"], z = { class: "popover__inner" }, K = {
|
|
|
98
98
|
/**
|
|
99
99
|
* Manually trigger a floating UI position update
|
|
100
100
|
*/
|
|
101
|
-
update:
|
|
101
|
+
update: m,
|
|
102
102
|
/**
|
|
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 ? (
|
|
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
|
-
])) :
|
|
133
|
-
f.value.arrow ? (
|
|
132
|
+
])) : k("", !0),
|
|
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 {
|
|
@@ -25,7 +25,7 @@ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import
|
|
|
25
25
|
close: () => void;
|
|
26
26
|
update: Function;
|
|
27
27
|
content: import('vue').Ref<null, null>;
|
|
28
|
-
$emit: (event: "close", ...args: any[]) => void;
|
|
28
|
+
$emit: (event: "close" | "update:isOpen", ...args: any[]) => void;
|
|
29
29
|
isOpen: boolean;
|
|
30
30
|
clickOutsideCloses: boolean;
|
|
31
31
|
escapeCloses: boolean;
|
|
@@ -66,7 +66,7 @@ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import
|
|
|
66
66
|
close: () => void;
|
|
67
67
|
update: Function;
|
|
68
68
|
content: import('vue').Ref<null, null>;
|
|
69
|
-
$emit: (event: "close", ...args: any[]) => void;
|
|
69
|
+
$emit: (event: "close" | "update:isOpen", ...args: any[]) => void;
|
|
70
70
|
isOpen: boolean;
|
|
71
71
|
clickOutsideCloses: boolean;
|
|
72
72
|
escapeCloses: boolean;
|
|
@@ -52,8 +52,15 @@
|
|
|
52
52
|
import { newId } from "../../utils/dom.js";
|
|
53
53
|
import UluPopoverBase from "./UluPopoverBase.vue";
|
|
54
54
|
|
|
55
|
-
const emit = defineEmits(["toggle"]);
|
|
55
|
+
const emit = defineEmits(["toggle", "update:modelValue"]);
|
|
56
56
|
const props = defineProps({
|
|
57
|
+
/**
|
|
58
|
+
* V-model state to control the popover externally
|
|
59
|
+
*/
|
|
60
|
+
modelValue: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: undefined
|
|
63
|
+
},
|
|
57
64
|
triggerText: String,
|
|
58
65
|
triggerAlt: String,
|
|
59
66
|
disabled: Boolean,
|
|
@@ -91,10 +98,23 @@
|
|
|
91
98
|
const baseConfig = injectedOptions ? injectedOptions.popover : defaults.popover;
|
|
92
99
|
const resolvedConfig = computed(() => ({ ...baseConfig, ...props.config }));
|
|
93
100
|
|
|
94
|
-
const
|
|
101
|
+
const internalIsOpen = ref(props.startOpen || false);
|
|
95
102
|
const trigger = ref(null);
|
|
96
103
|
const popoverBase = ref(null);
|
|
97
104
|
|
|
105
|
+
const isOpen = computed({
|
|
106
|
+
get() {
|
|
107
|
+
return props.modelValue !== undefined ? props.modelValue : internalIsOpen.value;
|
|
108
|
+
},
|
|
109
|
+
set(val) {
|
|
110
|
+
if (props.modelValue !== undefined) {
|
|
111
|
+
emit("update:modelValue", val);
|
|
112
|
+
} else {
|
|
113
|
+
internalIsOpen.value = val;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
|
|
98
118
|
const toggle = () => {
|
|
99
119
|
changeTo(!isOpen.value);
|
|
100
120
|
};
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
import { useModifiers } from '../../composables/useModifiers.js';
|
|
37
37
|
import { wasClickOutside } from '@ulu/utils/browser/dom.js';
|
|
38
38
|
|
|
39
|
-
const emit = defineEmits(['close']);
|
|
39
|
+
const emit = defineEmits(['close', 'update:isOpen']);
|
|
40
40
|
|
|
41
41
|
const props = defineProps({
|
|
42
42
|
/**
|
|
@@ -108,6 +108,7 @@
|
|
|
108
108
|
|
|
109
109
|
const close = () => {
|
|
110
110
|
emit('close');
|
|
111
|
+
emit('update:isOpen', false);
|
|
111
112
|
};
|
|
112
113
|
|
|
113
114
|
const handleEsc = (event) => {
|
|
@@ -157,7 +158,7 @@
|
|
|
157
158
|
}
|
|
158
159
|
};
|
|
159
160
|
|
|
160
|
-
watch(() => props.isOpen, (newVal) => {
|
|
161
|
+
watch(() => props.isOpen, (newVal, oldVal) => {
|
|
161
162
|
if (newVal) {
|
|
162
163
|
update();
|
|
163
164
|
addOutsideClick();
|
|
@@ -168,7 +169,9 @@
|
|
|
168
169
|
}
|
|
169
170
|
} else {
|
|
170
171
|
destroyOutsideClick();
|
|
171
|
-
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) {
|
|
172
175
|
nextTick(() => {
|
|
173
176
|
props.directFocus({ isOpen: false, trigger: props.trigger, content: contentEl.value });
|
|
174
177
|
});
|
package/package.json
CHANGED