@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;wBAoeqB,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;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 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
- import { useUluFloating as A } from "../../composables/useUluFloating.js";
3
- import { useModifiers as H } from "../../composables/useModifiers.js";
4
- import { wasClickOutside as U } from "@ulu/utils/browser/dom.js";
5
- const $ = ["data-placement"], z = { class: "popover__inner" }, K = {
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 = 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),
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
- }, h = (t) => {
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
- }, b = () => {
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) && U(o.value, t)) {
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 x(() => e.isOpen, (t) => {
86
- t ? (m(), b(), e.directFocus && y(() => {
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 && y(() => {
88
+ })) : (a(), e.directFocus && g === !0 && v(() => {
89
89
  e.directFocus({ isOpen: !1, trigger: e.trigger, content: o.value });
90
90
  }));
91
- }, { immediate: !0 }), L(() => {
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, N) => (p(), u("span", {
107
- class: T(["popover", [
106
+ }), (t, g) => (p(), u("span", {
107
+ class: j(["popover", [
108
108
  {
109
- "popover--fixed": l(F),
109
+ "popover--fixed": l(S),
110
110
  "is-active": s.isOpen
111
111
  },
112
- l(C)
112
+ l(_)
113
113
  ]]),
114
114
  ref_key: "contentEl",
115
115
  ref: o,
116
- style: v(l(_)),
117
- "data-placement": l(w),
118
- onKeydown: M(h, ["esc"]),
116
+ style: O(l(w)),
117
+ "data-placement": l(E),
118
+ onKeydown: T(b, ["esc"]),
119
119
  tabindex: "-1"
120
120
  }, [
121
- j("span", z, [
122
- k(t.$slots, "default", {
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", K, [
128
- k(t.$slots, "footer", {
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
- ])) : O("", !0),
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: S,
138
- style: v(l(E)),
137
+ ref: h,
138
+ style: O(l(F)),
139
139
  "data-ulu-popover-arrow": ""
140
- }, null, 4)) : O("", !0)
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 (props.directFocus) {
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ulu/frontend-vue",
3
- "version": "0.6.25",
3
+ "version": "0.6.26",
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": [