@ulu/frontend-vue 0.6.25 → 0.6.27

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 {
@@ -1 +1 @@
1
- {"version":3,"file":"UluTourContent.vue.d.ts","sourceRoot":"","sources":["../../../lib/plugins/tour/UluTourContent.vue"],"names":[],"mappings":"AAgBA;"}
1
+ {"version":3,"file":"UluTourContent.vue.d.ts","sourceRoot":"","sources":["../../../lib/plugins/tour/UluTourContent.vue"],"names":[],"mappings":"AAkBA;"}
@@ -1,6 +1,7 @@
1
- import { createElementBlock as o, openBlock as t, createBlock as s, createCommentVNode as n, createVNode as c, resolveDynamicComponent as l, normalizeClass as r, withCtx as i, createTextVNode as m, toDisplayString as a } from "vue";
2
- import d from "../../components/elements/UluRule.vue.js";
3
- const u = { class: "tour-content crop-margins" }, p = { key: 1 }, C = {
1
+ import { computed as c, createElementBlock as a, openBlock as o, createBlock as i, createCommentVNode as l, createVNode as u, resolveDynamicComponent as m, normalizeClass as d, withCtx as p, createTextVNode as f, toDisplayString as r } from "vue";
2
+ import C from "../../components/elements/UluRule.vue.js";
3
+ import { useTour as h } from "./useTour.js";
4
+ const v = { class: "tour-content crop-margins" }, y = { key: 1 }, M = {
4
5
  __name: "UluTourContent",
5
6
  props: {
6
7
  /**
@@ -19,21 +20,25 @@ const u = { class: "tour-content crop-margins" }, p = { key: 1 }, C = {
19
20
  }
20
21
  },
21
22
  setup(e) {
22
- return (f, h) => (t(), o("div", u, [
23
- e.step?.title ? (t(), s(l(e.isModal ? "h2" : "strong"), {
23
+ const { state: s } = h(), t = e, n = c(() => t.step.titleClass ? t.step.titleClass : t.isModal ? s.active?.modalTitleClass || "h3" : s.active?.popoverTitleClass || "h4");
24
+ return (k, T) => (o(), a("div", v, [
25
+ e.step?.title ? (o(), i(m(e.isModal ? "h2" : "strong"), {
24
26
  key: 0,
25
- class: r([e.isModal ? "h3" : "h4", "display-block no-margin"])
27
+ class: d([
28
+ "display-block no-margin",
29
+ n.value
30
+ ])
26
31
  }, {
27
- default: i(() => [
28
- m(a(e.step.title), 1)
32
+ default: p(() => [
33
+ f(r(e.step.title), 1)
29
34
  ]),
30
35
  _: 1
31
- }, 8, ["class"])) : n("", !0),
32
- c(d),
33
- e.step?.content ? (t(), o("p", p, a(e.step.content), 1)) : n("", !0)
36
+ }, 8, ["class"])) : l("", !0),
37
+ u(C),
38
+ e.step?.content ? (o(), a("p", y, r(e.step.content), 1)) : l("", !0)
34
39
  ]));
35
40
  }
36
41
  };
37
42
  export {
38
- C as default
43
+ M as default
39
44
  };
@@ -1 +1 @@
1
- {"version":3,"file":"UluTourPager.vue.d.ts","sourceRoot":"","sources":["../../../lib/plugins/tour/UluTourPager.vue"],"names":[],"mappings":"AAqBA;"}
1
+ {"version":3,"file":"UluTourPager.vue.d.ts","sourceRoot":"","sources":["../../../lib/plugins/tour/UluTourPager.vue"],"names":[],"mappings":"AAyBA;"}
@@ -1,29 +1,35 @@
1
- import { computed as s, createElementBlock as p, openBlock as u, createVNode as i, unref as n } from "vue";
2
- import { useTour as c } from "./useTour.js";
1
+ import { computed as a, createElementBlock as u, openBlock as c, normalizeClass as m, unref as s, createVNode as o } from "vue";
2
+ import { useTour as d } from "./useTour.js";
3
3
  import l from "../../components/elements/UluButton.vue.js";
4
- const d = { class: "tour-pager layout-flex-justified" }, y = {
4
+ const y = {
5
5
  __name: "UluTourPager",
6
- setup(m) {
7
- const { api: r, state: e } = c(), o = s(() => e.active && e.stepIndex === e.active.steps.length - 1);
8
- return s(() => e.active && e.stepIndex === 0), (x, t) => (u(), p("div", d, [
9
- i(l, {
10
- onClick: t[0] || (t[0] = (a) => n(r).prev()),
6
+ setup(v) {
7
+ const { api: n, state: e } = d(), i = a(() => e.active?.steps[e.stepIndex]), r = a(() => e.active && e.stepIndex === e.active.steps.length - 1);
8
+ return (x, t) => (c(), u("div", {
9
+ class: m([
10
+ "tour-pager layout-flex-justified",
11
+ s(e).active?.pagerClass,
12
+ i.value?.pagerClass
13
+ ])
14
+ }, [
15
+ o(l, {
16
+ onClick: t[0] || (t[0] = (p) => s(n).prev()),
11
17
  text: "Previous",
12
- disabled: n(e).stepIndex === 0,
18
+ disabled: s(e).stepIndex === 0,
13
19
  icon: "type:previous",
14
20
  iconBefore: "",
15
21
  small: "",
16
22
  secondary: "",
17
23
  transparent: ""
18
24
  }, null, 8, ["disabled"]),
19
- i(l, {
25
+ o(l, {
20
26
  primary: "",
21
- icon: o.value ? null : "type:next",
22
- onClick: t[1] || (t[1] = (a) => n(r).next()),
23
- text: o.value ? "Finish" : "Next",
27
+ icon: r.value ? null : "type:next",
28
+ onClick: t[1] || (t[1] = (p) => s(n).next()),
29
+ text: r.value ? "Finish" : "Next",
24
30
  small: ""
25
31
  }, null, 8, ["icon", "text"])
26
- ]));
32
+ ], 2));
27
33
  }
28
34
  };
29
35
  export {
@@ -8,6 +8,14 @@ export type TourStep = {
8
8
  * - The title text for the step.
9
9
  */
10
10
  title?: string | undefined;
11
+ /**
12
+ * - Class to apply to the title.
13
+ */
14
+ titleClass?: string | Object | any[] | undefined;
15
+ /**
16
+ * - Class to apply to the pager footer.
17
+ */
18
+ pagerClass?: string | Object | any[] | undefined;
11
19
  /**
12
20
  * - The content text for the step.
13
21
  */
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../lib/plugins/tour/api.js"],"names":[],"mappings":"AAuBO,iCAHI,MAAM,GACJ,MAAM,CA6DjB"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../lib/plugins/tour/api.js"],"names":[],"mappings":"AAyBO,iCAHI,MAAM,GACJ,MAAM,CAgEjB"}
@@ -7,6 +7,9 @@ const o = (e) => ({
7
7
  * @param {String} [tour.name] - Optional name for the tour
8
8
  * @param {Object} [tour.modalProps] - Global props applied to all modal steps in this tour (can be overridden by step)
9
9
  * @param {Object} [tour.popoverProps] - Global props applied to all popover steps in this tour (can be overridden by step)
10
+ * @param {String|Array|Object} [tour.modalTitleClass] - Global class applied to the title of modal steps.
11
+ * @param {String|Array|Object} [tour.popoverTitleClass] - Global class applied to the title of popover steps.
12
+ * @param {String|Array|Object} [tour.pagerClass] - Global class applied to the pager.
10
13
  */
11
14
  async start(n) {
12
15
  n?.steps?.length && (await this._runHooks(n.steps[0]), e.active = t(n), e.stepIndex = 0);
@@ -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
  });
@@ -3,8 +3,10 @@
3
3
  <component
4
4
  v-if="step?.title"
5
5
  :is="isModal ? 'h2' : 'strong'"
6
- :class="isModal ? 'h3' : 'h4'"
7
- class="display-block no-margin"
6
+ :class="[
7
+ 'display-block no-margin',
8
+ resolvedTitleClass
9
+ ]"
8
10
  >
9
11
  {{ step.title }}
10
12
  </component>
@@ -16,9 +18,13 @@
16
18
  </template>
17
19
 
18
20
  <script setup>
21
+ import { computed } from "vue";
19
22
  import UluRule from "../../components/elements/UluRule.vue";
23
+ import { useTour } from "./useTour.js";
20
24
 
21
- defineProps({
25
+ const { state: tourState } = useTour();
26
+
27
+ const props = defineProps({
22
28
  /**
23
29
  * The tour step configuration object
24
30
  */
@@ -34,4 +40,14 @@
34
40
  default: false
35
41
  }
36
42
  });
43
+
44
+ const resolvedTitleClass = computed(() => {
45
+ if (props.step.titleClass) return props.step.titleClass;
46
+
47
+ if (props.isModal) {
48
+ return tourState.active?.modalTitleClass || 'h3';
49
+ } else {
50
+ return tourState.active?.popoverTitleClass || 'h4';
51
+ }
52
+ });
37
53
  </script>
@@ -1,5 +1,9 @@
1
1
  <template>
2
- <div class="tour-pager layout-flex-justified">
2
+ <div :class="[
3
+ 'tour-pager layout-flex-justified',
4
+ state.active?.pagerClass,
5
+ currentStep?.pagerClass
6
+ ]">
3
7
  <UluButton
4
8
  @click="api.prev()"
5
9
  text="Previous"
@@ -27,10 +31,9 @@
27
31
 
28
32
  const { api, state } = useTour();
29
33
 
34
+ const currentStep = computed(() => state.active?.steps[state.stepIndex]);
35
+
30
36
  const isLastStep = computed(() => {
31
37
  return state.active && state.stepIndex === state.active.steps.length - 1;
32
38
  });
33
- const isFirstStep = computed(() => {
34
- return state.active && state.stepIndex === 0;
35
- });
36
39
  </script>
@@ -4,6 +4,8 @@ import { markRaw } from "vue";
4
4
  * @typedef {Object} TourStep
5
5
  * @property {String} [target] - The CSS selector for the target element. If omitted, step renders as a modal.
6
6
  * @property {String} [title] - The title text for the step.
7
+ * @property {String|Array|Object} [titleClass] - Class to apply to the title.
8
+ * @property {String|Array|Object} [pagerClass] - Class to apply to the pager footer.
7
9
  * @property {String} [content] - The content text for the step.
8
10
  * @property {Object} [component] - A Vue component to completely replace the modal/popover wrapper and layout.
9
11
  * @property {Object} [contentComponent] - A Vue component to replace the step text content, keeping the modal/popover wrappers and default footer.
@@ -29,6 +31,9 @@ export const createApi = (state) => ({
29
31
  * @param {String} [tour.name] - Optional name for the tour
30
32
  * @param {Object} [tour.modalProps] - Global props applied to all modal steps in this tour (can be overridden by step)
31
33
  * @param {Object} [tour.popoverProps] - Global props applied to all popover steps in this tour (can be overridden by step)
34
+ * @param {String|Array|Object} [tour.modalTitleClass] - Global class applied to the title of modal steps.
35
+ * @param {String|Array|Object} [tour.popoverTitleClass] - Global class applied to the title of popover steps.
36
+ * @param {String|Array|Object} [tour.pagerClass] - Global class applied to the pager.
32
37
  */
33
38
  async start(tour) {
34
39
  if (!tour?.steps?.length) return;
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.27",
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": [