@ulu/frontend-vue 0.6.24 → 0.6.25

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.
@@ -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').Ref<boolean, boolean>;
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;wBA2XqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAbjC;IAhLI;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;;OAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAoLi4e,GAAG,8CAA8C,GAAG,yBAAyB,GAAG,6DAAmC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAT3/e;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCASq4e,GAAG"}
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 x, ref as n, resolveDirective as T, createElementBlock as p, openBlock as m, Fragment as j, withDirectives as z, createVNode as I, unref as s, normalizeClass as O, renderSlot as r, createTextVNode as h, toDisplayString as w, createSlots as D, withCtx as b } from "vue";
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 V from "./defaults.js";
5
- import { newId as C } from "../../utils/dom.js";
6
- import A from "./UluPopoverBase.vue.js";
7
- const R = ["id", "disabled", "aria-expanded", "aria-controls", "aria-label"], L = {
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: y, emit: k }) {
41
- const S = k, c = e, d = C(), g = C(), u = E(N), B = u ? u.popover : V.popover, $ = x(() => ({ ...B, ...c.config })), t = n(c.startOpen || !1), f = n(null), F = n(null), a = () => {
42
- i(!t.value);
43
- }, i = (o) => {
44
- t.value = o, S("toggle", { isOpen: o });
45
- }, l = () => i(!1);
46
- return y({
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: t,
64
+ isOpen: o,
51
65
  /**
52
66
  * Method to toggle the popover open/closed
53
67
  */
54
- toggle: a,
68
+ toggle: n,
55
69
  /**
56
70
  * Method to force the popover closed
57
71
  */
58
- close: l,
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
- }), (o, v) => {
65
- const P = T("ulu-tooltip");
66
- return m(), p(j, null, [
67
- z((m(), p("button", {
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: f,
71
- onClick: a,
72
- id: s(g),
84
+ ref: p,
85
+ onClick: n,
86
+ id: a(g),
73
87
  disabled: e.disabled,
74
- class: O([
75
- { [e.activeClass]: t.value },
88
+ class: C([
89
+ { [e.activeClass]: o.value },
76
90
  e.classes.trigger
77
91
  ]),
78
- "aria-expanded": t.value ? "true" : "false",
79
- "aria-controls": s(d),
92
+ "aria-expanded": o.value ? "true" : "false",
93
+ "aria-controls": a(u),
80
94
  "aria-label": e.triggerAlt
81
95
  }, [
82
- r(o.$slots, "trigger", {
83
- isOpen: t.value,
84
- close: l
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, R)), [
89
- [P, e.tooltip ? e.tooltip : null]
102
+ ], 10, q)), [
103
+ [x, e.tooltip ? e.tooltip : null]
90
104
  ]),
91
- I(A, {
105
+ z(R, {
92
106
  ref_key: "popoverBase",
93
- ref: F,
94
- trigger: f.value,
95
- config: $.value,
96
- isOpen: t.value,
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: O([
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": s(g),
107
- id: s(d),
108
- onClose: v[0] || (v[0] = (q) => i(!1))
120
+ "aria-labelledby": a(g),
121
+ id: a(u),
122
+ onClose: v[0] || (v[0] = (K) => i(!1))
109
123
  }, D({
110
- default: b(() => [
111
- r(o.$slots, "default", {
112
- isOpen: t.value,
113
- toggle: a,
114
- close: l
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
- o.$slots.footer ? {
133
+ t.$slots.footer ? {
120
134
  name: "footer",
121
- fn: b(() => [
122
- r(o.$slots, "footer", { close: l })
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
- L as default
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;wBAkeqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAdjC;IAzHI;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;;;;;;;;;;;;;;;;;;;;;oBA0HJ"}
1
+ {"version":3,"file":"UluPopoverBase.vue.d.ts","sourceRoot":"","sources":["../../../lib/plugins/popovers/UluPopoverBase.vue"],"names":[],"mappings":"AA+BA;wBAoeqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAdjC;IAzHI;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;;;;;;;;;;;;;;;;;;;;;oBA0HJ"}
@@ -1,4 +1,4 @@
1
- import { ref as B, computed as m, watch as x, nextTick as g, onUnmounted as L, createElementBlock as u, openBlock as d, withKeys as M, unref as l, normalizeStyle as y, normalizeClass as T, createElementVNode as j, createCommentVNode as v, renderSlot as O } from "vue";
1
+ import { ref as B, computed as g, watch as x, nextTick as y, onUnmounted as L, createElementBlock as u, openBlock as p, withKeys as M, unref as l, normalizeStyle as v, normalizeClass as T, createElementVNode as j, createCommentVNode as O, renderSlot as k } from "vue";
2
2
  import { useUluFloating as A } from "../../composables/useUluFloating.js";
3
3
  import { useModifiers as H } from "../../composables/useModifiers.js";
4
4
  import { wasClickOutside as U } from "@ulu/utils/browser/dom.js";
@@ -57,14 +57,14 @@ 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 k = c, e = s, o = B(null), { resolvedModifiers: C } = H({ props: e, baseClass: "popover" }), f = m(() => e.config || {}), { floatingStyles: _, placement: w, arrowStyles: E, update: p, isFixedStrategy: F, contentArrow: S } = A(
63
- m(() => e.trigger),
62
+ const d = c, e = s, o = B(null), { resolvedModifiers: C } = H({ props: e, baseClass: "popover" }), f = g(() => e.config || {}), { floatingStyles: _, placement: w, arrowStyles: E, update: m, isFixedStrategy: F, contentArrow: S } = A(
63
+ g(() => e.trigger),
64
64
  o,
65
65
  f
66
66
  ), i = () => {
67
- k("close");
67
+ d("close"), d("update:isOpen", !1);
68
68
  }, h = (t) => {
69
69
  e.isOpen && e.escapeCloses && (t.preventDefault(), i());
70
70
  };
@@ -83,9 +83,9 @@ const $ = ["data-placement"], z = { class: "popover__inner" }, K = {
83
83
  }, 0));
84
84
  };
85
85
  return x(() => e.isOpen, (t) => {
86
- t ? (p(), b(), e.directFocus && g(() => {
86
+ t ? (m(), b(), e.directFocus && y(() => {
87
87
  e.directFocus({ isOpen: !0, trigger: e.trigger, content: o.value });
88
- })) : (a(), e.directFocus && g(() => {
88
+ })) : (a(), e.directFocus && y(() => {
89
89
  e.directFocus({ isOpen: !1, trigger: e.trigger, content: o.value });
90
90
  }));
91
91
  }, { immediate: !0 }), L(() => {
@@ -98,12 +98,12 @@ const $ = ["data-placement"], z = { class: "popover__inner" }, K = {
98
98
  /**
99
99
  * Manually trigger a floating UI position update
100
100
  */
101
- update: p,
101
+ update: m,
102
102
  /**
103
103
  * The internal root popover element reference
104
104
  */
105
105
  content: o
106
- }), (t, N) => (d(), u("span", {
106
+ }), (t, N) => (p(), u("span", {
107
107
  class: T(["popover", [
108
108
  {
109
109
  "popover--fixed": l(F),
@@ -113,31 +113,31 @@ const $ = ["data-placement"], z = { class: "popover__inner" }, K = {
113
113
  ]]),
114
114
  ref_key: "contentEl",
115
115
  ref: o,
116
- style: y(l(_)),
116
+ style: v(l(_)),
117
117
  "data-placement": l(w),
118
118
  onKeydown: M(h, ["esc"]),
119
119
  tabindex: "-1"
120
120
  }, [
121
121
  j("span", z, [
122
- O(t.$slots, "default", {
122
+ k(t.$slots, "default", {
123
123
  isOpen: s.isOpen,
124
124
  close: i
125
125
  })
126
126
  ]),
127
- t.$slots.footer ? (d(), u("span", K, [
128
- O(t.$slots, "footer", {
127
+ t.$slots.footer ? (p(), u("span", K, [
128
+ k(t.$slots, "footer", {
129
129
  isOpen: s.isOpen,
130
130
  close: i
131
131
  })
132
- ])) : v("", !0),
133
- f.value.arrow ? (d(), u("span", {
132
+ ])) : O("", !0),
133
+ f.value.arrow ? (p(), u("span", {
134
134
  key: 1,
135
135
  class: "popover__arrow",
136
136
  ref_key: "contentArrow",
137
137
  ref: S,
138
- style: y(l(E)),
138
+ style: v(l(E)),
139
139
  "data-ulu-popover-arrow": ""
140
- }, null, 4)) : v("", !0)
140
+ }, null, 4)) : O("", !0)
141
141
  ], 46, $));
142
142
  }
143
143
  };
@@ -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 isOpen = ref(props.startOpen || false);
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) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ulu/frontend-vue",
3
- "version": "0.6.24",
3
+ "version": "0.6.25",
4
4
  "description": "A modular, tree-shakeable Vue 3 component library for the Ulu Frontend theming system, plus general utilities for Vue development",
5
5
  "type": "module",
6
6
  "files": [