@nmorph/nmorph-ui-kit 3.0.9 → 3.0.10

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,5 +1,5 @@
1
1
  import './NmorphGuide.css';
2
- import { defineComponent as j, ref as C, computed as a, watch as z, provide as A } from "vue";
2
+ import { defineComponent as j, ref as B, computed as a, watch as z, provide as A } from "vue";
3
3
  import { useZIndex as V } from "../../../hooks/use-z-index.js";
4
4
  import { nmorphGuideInjectionKey as W } from "./types.js";
5
5
  const E = /* @__PURE__ */ j({
@@ -12,6 +12,7 @@ const E = /* @__PURE__ */ j({
12
12
  closeOnFinish: { type: Boolean, required: !1, default: !0 },
13
13
  showClose: { type: Boolean, required: !1, default: !0 },
14
14
  showProgress: { type: Boolean, required: !1, default: !0 },
15
+ bordered: { type: Boolean, required: !1, default: !1 },
15
16
  backText: { type: String, required: !1, default: "Back" },
16
17
  nextText: { type: String, required: !1, default: "Next" },
17
18
  finishText: { type: String, required: !1, default: "Finish" },
@@ -23,40 +24,40 @@ const E = /* @__PURE__ */ j({
23
24
  maxWidth: { type: [Number, String], required: !1, default: "280px" }
24
25
  },
25
26
  emits: ["update:model-value", "update:active-step", "change", "back", "next", "finish", "close"],
26
- setup(B, { expose: N, emit: F }) {
27
- const r = B, i = F, u = C({}), x = C(void 0);
28
- let p = 0;
29
- const d = (e) => String(e), T = a(() => {
27
+ setup(C, { expose: N, emit: F }) {
28
+ const t = C, i = F, u = B({}), x = B(void 0);
29
+ let f = 0;
30
+ const d = (e) => String(e), b = a(() => {
30
31
  const e = /* @__PURE__ */ new Map();
31
- return r.steps.forEach((t, o) => {
32
- e.set(d(t.name), {
33
- ...t,
34
- order: t.order ?? o
32
+ return t.steps.forEach((r, o) => {
33
+ e.set(d(r.name), {
34
+ ...r,
35
+ order: r.order ?? o
35
36
  });
36
37
  }), e;
37
38
  }), s = a(
38
39
  () => Object.values(u.value).map((e) => ({
39
40
  ...e,
40
- ...T.value.get(d(e.name)),
41
+ ...b.value.get(d(e.name)),
41
42
  registrationOrder: e.registrationOrder
42
- })).filter((e) => !e.disabled).sort((e, t) => {
43
- const o = e.order ?? e.registrationOrder, P = t.order ?? t.registrationOrder;
43
+ })).filter((e) => !e.disabled).sort((e, r) => {
44
+ const o = e.order ?? e.registrationOrder, P = r.order ?? r.registrationOrder;
44
45
  return o - P;
45
46
  })
46
- ), g = a(() => r.modelValue && s.value.length > 0), b = V(g, () => r.zIndex), q = a(() => r.activeStep ?? x.value), l = a(() => s.value.findIndex((e) => e.name === q.value)), n = a(() => s.value[l.value] ?? null), O = a(() => l.value <= 0), w = a(() => l.value >= s.value.length - 1), f = (e) => {
47
- const t = s.value.find((o) => o.name === e);
48
- t && (x.value = e, i("update:active-step", e), i("change", t, s.value.indexOf(t)));
47
+ ), g = a(() => t.modelValue && s.value.length > 0), T = V(g, () => t.zIndex), q = a(() => t.activeStep ?? x.value), l = a(() => s.value.findIndex((e) => e.name === q.value)), n = a(() => s.value[l.value] ?? null), O = a(() => l.value <= 0), w = a(() => l.value >= s.value.length - 1), p = (e) => {
48
+ const r = s.value.find((o) => o.name === e);
49
+ r && (x.value = e, i("update:active-step", e), i("change", r, s.value.indexOf(r)));
49
50
  }, c = (e) => {
50
- const t = s.value[e];
51
- t && f(t.name);
51
+ const r = s.value[e];
52
+ r && p(r.name);
52
53
  }, v = () => {
53
54
  i("update:model-value", !1), i("close", n.value, l.value);
54
55
  }, m = () => {
55
- i("finish", n.value, l.value), r.closeOnFinish && v();
56
+ i("finish", n.value, l.value), t.closeOnFinish && v();
56
57
  }, h = () => {
57
58
  if (n.value) {
58
59
  if (i("back", n.value, l.value), O.value) {
59
- r.loop && c(s.value.length - 1);
60
+ t.loop && c(s.value.length - 1);
60
61
  return;
61
62
  }
62
63
  c(l.value - 1);
@@ -64,31 +65,31 @@ const E = /* @__PURE__ */ j({
64
65
  }, S = () => {
65
66
  if (n.value) {
66
67
  if (i("next", n.value, l.value), w.value) {
67
- r.loop ? c(0) : m();
68
+ t.loop ? c(0) : m();
68
69
  return;
69
70
  }
70
71
  c(l.value + 1);
71
72
  }
72
73
  }, y = (e) => {
73
- f(e);
74
+ p(e);
74
75
  }, _ = (e) => {
75
- const t = d(e.name), o = u.value[t];
76
+ const r = d(e.name), o = u.value[r];
76
77
  u.value = {
77
78
  ...u.value,
78
- [t]: {
79
+ [r]: {
79
80
  ...o,
80
81
  ...e,
81
- registrationOrder: o?.registrationOrder ?? p
82
+ registrationOrder: o?.registrationOrder ?? f
82
83
  }
83
- }, o || (p += 1);
84
+ }, o || (f += 1);
84
85
  }, k = (e) => {
85
- const t = d(e), o = { ...u.value };
86
- delete o[t], u.value = o;
86
+ const r = d(e), o = { ...u.value };
87
+ delete o[r], u.value = o;
87
88
  };
88
89
  z(
89
- [() => r.modelValue, s, n],
90
- ([e, t, o]) => {
91
- !e || o || t.length === 0 || f(t[0].name);
90
+ [() => t.modelValue, s, n],
91
+ ([e, r, o]) => {
92
+ !e || o || r.length === 0 || p(r[0].name);
92
93
  },
93
94
  { immediate: !0 }
94
95
  ), A(W, {
@@ -96,18 +97,19 @@ const E = /* @__PURE__ */ j({
96
97
  activeStep: n,
97
98
  activeIndex: l,
98
99
  steps: s,
99
- loop: a(() => r.loop),
100
- showClose: a(() => r.showClose),
101
- showProgress: a(() => r.showProgress),
102
- backText: a(() => r.backText),
103
- nextText: a(() => r.nextText),
104
- finishText: a(() => r.finishText),
105
- closeText: a(() => r.closeText),
106
- zIndex: b,
107
- teleportTo: a(() => r.teleportTo),
108
- disabledTeleport: a(() => r.disabledTeleport),
109
- width: a(() => r.width),
110
- maxWidth: a(() => r.maxWidth),
100
+ loop: a(() => t.loop),
101
+ showClose: a(() => t.showClose),
102
+ showProgress: a(() => t.showProgress),
103
+ bordered: a(() => t.bordered),
104
+ backText: a(() => t.backText),
105
+ nextText: a(() => t.nextText),
106
+ finishText: a(() => t.finishText),
107
+ closeText: a(() => t.closeText),
108
+ zIndex: T,
109
+ teleportTo: a(() => t.teleportTo),
110
+ disabledTeleport: a(() => t.disabledTeleport),
111
+ width: a(() => t.width),
112
+ maxWidth: a(() => t.maxWidth),
111
113
  registerStep: _,
112
114
  unregisterStep: k,
113
115
  goToStep: y,
@@ -116,11 +118,11 @@ const E = /* @__PURE__ */ j({
116
118
  finish: m,
117
119
  close: v
118
120
  }), N({ back: h, next: S, finish: m, close: v, goToStep: y });
119
- const I = { props: r, emit: i, registeredSteps: u, internalActiveStep: x, get registrationCursor() {
120
- return p;
121
+ const I = { props: t, emit: i, registeredSteps: u, internalActiveStep: x, get registrationCursor() {
122
+ return f;
121
123
  }, set registrationCursor(e) {
122
- p = e;
123
- }, getStepKey: d, stepOverrides: T, steps: s, active: g, guideZIndex: b, activeStepName: q, activeIndex: l, activeStep: n, isFirstStep: O, isLastStep: w, setActiveStep: f, goToIndex: c, close: v, finish: m, back: h, next: S, goToStep: y, registerStep: _, unregisterStep: k };
124
+ f = e;
125
+ }, getStepKey: d, stepOverrides: b, steps: s, active: g, guideZIndex: T, activeStepName: q, activeIndex: l, activeStep: n, isFirstStep: O, isLastStep: w, setActiveStep: p, goToIndex: c, close: v, finish: m, back: h, next: S, goToStep: y, registerStep: _, unregisterStep: k };
124
126
  return Object.defineProperty(I, "__isScriptSetup", { enumerable: !1, value: !0 }), I;
125
127
  }
126
128
  });
@@ -1 +1 @@
1
- .nmorph-guide-step__card{display:grid;gap:var(--indentation-03);min-width:min(240px,100vw - 48px)}.nmorph-guide-step__image{display:block;width:100%;max-height:140px;border-radius:var(--default-border-radius);object-fit:cover}.nmorph-guide-step__body{display:grid;gap:var(--indentation-02)}.nmorph-guide-step__progress{color:var(--nmorph-placeholder-text-color);font-size:var(--nmorph-typography-body-small-font-size);line-height:var(--nmorph-typography-body-small-line-height)}.nmorph-guide-step__title{margin:0;color:var(--nmorph-text-color);font-size:var(--nmorph-typography-title-small-font-size);line-height:var(--nmorph-typography-title-small-line-height)}.nmorph-guide-step__text{margin:0;color:var(--nmorph-text-color);font-size:var(--nmorph-typography-body-font-size);line-height:var(--nmorph-typography-body-line-height)}.nmorph-guide-step__actions{display:flex;gap:var(--indentation-02);align-items:center}.nmorph-guide-step__spacer{flex:1 1 auto}
1
+ .nmorph-guide-step__card{display:grid;gap:var(--indentation-03);box-sizing:border-box;min-width:min(240px,100vw - 48px);padding:var(--indentation-02);border-radius:var(--default-border-radius)}.nmorph-guide-step__card--bordered{border:var(--nmorph-plain-border)}.nmorph-guide-step__image{display:block;width:100%;max-height:140px;border-radius:var(--default-border-radius);object-fit:cover}.nmorph-guide-step__body{display:grid;gap:var(--indentation-02)}.nmorph-guide-step__progress{color:var(--nmorph-placeholder-text-color);font-size:var(--nmorph-typography-body-small-font-size);line-height:var(--nmorph-typography-body-small-line-height)}.nmorph-guide-step__title{margin:0;color:var(--nmorph-text-color);font-size:var(--nmorph-typography-title-small-font-size);line-height:var(--nmorph-typography-title-small-line-height)}.nmorph-guide-step__text{margin:0;color:var(--nmorph-text-color);font-size:var(--nmorph-typography-body-font-size);line-height:var(--nmorph-typography-body-line-height)}.nmorph-guide-step__actions{display:flex;gap:var(--indentation-02);align-items:center}.nmorph-guide-step__spacer{flex:1 1 auto}
@@ -1,14 +1,9 @@
1
1
  import './NmorphGuideStep.css';
2
2
  import g from "./NmorphGuideStep.vue2.js";
3
- import { openBlock as t, createBlock as s, withCtx as a, renderSlot as c, normalizeProps as h, mergeProps as m, createElementBlock as i, createCommentVNode as o, createElementVNode as n, toDisplayString as l, createVNode as p } from "vue";
3
+ import { openBlock as t, createBlock as s, withCtx as a, renderSlot as c, normalizeProps as m, mergeProps as h, createElementBlock as o, normalizeClass as _, createCommentVNode as i, createElementVNode as d, toDisplayString as l, createVNode as p } from "vue";
4
4
  /* empty css */
5
- import _ from "../../../_virtual/_plugin-vue_export-helper.js";
6
- const u = {
7
- key: 1,
8
- class: "nmorph-guide-step__card",
9
- role: "dialog",
10
- "aria-live": "polite"
11
- }, v = ["src", "alt"], x = { class: "nmorph-guide-step__body" }, k = {
5
+ import u from "../../../_virtual/_plugin-vue_export-helper.js";
6
+ const v = ["src", "alt"], x = { class: "nmorph-guide-step__body" }, k = {
12
7
  key: 0,
13
8
  class: "nmorph-guide-step__progress"
14
9
  }, S = {
@@ -18,7 +13,7 @@ const u = {
18
13
  key: 2,
19
14
  class: "nmorph-guide-step__text"
20
15
  }, b = { class: "nmorph-guide-step__actions" };
21
- function w(d, r, y, e, C, N) {
16
+ function C(n, r, w, e, y, N) {
22
17
  return t(), s(e.NmorphTooltip, {
23
18
  "force-show": e.isActive,
24
19
  position: e.tooltipPosition,
@@ -31,77 +26,89 @@ function w(d, r, y, e, C, N) {
31
26
  disabled: !e.guide || e.props.disabled
32
27
  }, {
33
28
  content: a(() => [
34
- e.hasCustomContent && e.stepSlotProps ? c(d.$slots, "content", h(m({ key: 0 }, e.stepSlotProps))) : e.currentStep && e.stepSlotProps ? (t(), i("div", u, [
35
- e.currentStep.imageSrc ? (t(), i("img", {
36
- key: 0,
37
- class: "nmorph-guide-step__image",
38
- src: e.currentStep.imageSrc,
39
- alt: e.currentStep.imageAlt || e.currentStep.title || ""
40
- }, null, 8, v)) : o("v-if", !0),
41
- n("div", x, [
42
- e.guide?.showProgress.value ? (t(), i(
43
- "div",
44
- k,
45
- l(e.stepSlotProps.index + 1) + " / " + l(e.stepSlotProps.total),
46
- 1
47
- /* TEXT */
48
- )) : o("v-if", !0),
49
- e.currentStep.title ? (t(), i(
50
- "h3",
51
- S,
52
- l(e.currentStep.title),
53
- 1
54
- /* TEXT */
55
- )) : o("v-if", !0),
56
- e.currentStep.text ? (t(), i(
57
- "p",
58
- f,
59
- l(e.currentStep.text),
60
- 1
61
- /* TEXT */
62
- )) : o("v-if", !0)
63
- ]),
64
- n("div", b, [
65
- e.guide?.showClose.value ? (t(), s(e.NmorphButton, {
29
+ e.hasCustomContent && e.stepSlotProps ? c(n.$slots, "content", m(h({ key: 0 }, e.stepSlotProps))) : e.currentStep && e.stepSlotProps ? (t(), o(
30
+ "div",
31
+ {
32
+ key: 1,
33
+ class: _(["nmorph-guide-step__card", e.guide?.bordered.value && "nmorph-guide-step__card--bordered"]),
34
+ role: "dialog",
35
+ "aria-live": "polite"
36
+ },
37
+ [
38
+ e.currentStep.imageSrc ? (t(), o("img", {
66
39
  key: 0,
67
- class: "nmorph-guide-step__close",
68
- text: e.guide.closeText.value,
69
- design: "plain",
70
- thickness: "thin",
71
- onClick: e.guide.close
72
- }, null, 8, ["text", "onClick"])) : o("v-if", !0),
73
- r[1] || (r[1] = n(
74
- "span",
75
- { class: "nmorph-guide-step__spacer" },
76
- null,
77
- -1
78
- /* CACHED */
79
- )),
80
- p(e.NmorphButton, {
81
- class: "nmorph-guide-step__back",
82
- text: e.guide?.backText.value,
83
- design: "plain",
84
- thickness: "thin",
85
- disabled: e.isFirstStep && !e.guide?.loop.value,
86
- onClick: e.guide?.back
87
- }, null, 8, ["text", "disabled", "onClick"]),
88
- p(e.NmorphButton, {
89
- class: "nmorph-guide-step__next",
90
- text: e.isLastStep && !e.guide?.loop.value ? e.guide?.finishText.value : e.guide?.nextText.value,
91
- thickness: "thin",
92
- onClick: r[0] || (r[0] = (P) => e.isLastStep && !e.guide?.loop.value ? e.guide?.finish() : e.guide?.next())
93
- }, null, 8, ["text"])
94
- ])
95
- ])) : o("v-if", !0)
40
+ class: "nmorph-guide-step__image",
41
+ src: e.currentStep.imageSrc,
42
+ alt: e.currentStep.imageAlt || e.currentStep.title || ""
43
+ }, null, 8, v)) : i("v-if", !0),
44
+ d("div", x, [
45
+ e.guide?.showProgress.value ? (t(), o(
46
+ "div",
47
+ k,
48
+ l(e.stepSlotProps.index + 1) + " / " + l(e.stepSlotProps.total),
49
+ 1
50
+ /* TEXT */
51
+ )) : i("v-if", !0),
52
+ e.currentStep.title ? (t(), o(
53
+ "h3",
54
+ S,
55
+ l(e.currentStep.title),
56
+ 1
57
+ /* TEXT */
58
+ )) : i("v-if", !0),
59
+ e.currentStep.text ? (t(), o(
60
+ "p",
61
+ f,
62
+ l(e.currentStep.text),
63
+ 1
64
+ /* TEXT */
65
+ )) : i("v-if", !0)
66
+ ]),
67
+ d("div", b, [
68
+ e.guide?.showClose.value ? (t(), s(e.NmorphButton, {
69
+ key: 0,
70
+ class: "nmorph-guide-step__close",
71
+ text: e.guide.closeText.value,
72
+ design: "plain",
73
+ thickness: "thin",
74
+ onClick: e.guide.close
75
+ }, null, 8, ["text", "onClick"])) : i("v-if", !0),
76
+ r[1] || (r[1] = d(
77
+ "span",
78
+ { class: "nmorph-guide-step__spacer" },
79
+ null,
80
+ -1
81
+ /* CACHED */
82
+ )),
83
+ p(e.NmorphButton, {
84
+ class: "nmorph-guide-step__back",
85
+ text: e.guide?.backText.value,
86
+ design: "plain",
87
+ thickness: "thin",
88
+ disabled: e.isFirstStep && !e.guide?.loop.value,
89
+ onClick: e.guide?.back
90
+ }, null, 8, ["text", "disabled", "onClick"]),
91
+ p(e.NmorphButton, {
92
+ class: "nmorph-guide-step__next",
93
+ text: e.isLastStep && !e.guide?.loop.value ? e.guide?.finishText.value : e.guide?.nextText.value,
94
+ design: "plain",
95
+ thickness: "thin",
96
+ onClick: r[0] || (r[0] = (P) => e.isLastStep && !e.guide?.loop.value ? e.guide?.finish() : e.guide?.next())
97
+ }, null, 8, ["text"])
98
+ ])
99
+ ],
100
+ 2
101
+ /* CLASS */
102
+ )) : i("v-if", !0)
96
103
  ]),
97
104
  default: a(() => [
98
- c(d.$slots, "default")
105
+ c(n.$slots, "default")
99
106
  ]),
100
107
  _: 3
101
108
  /* FORWARDED */
102
109
  }, 8, ["force-show", "position", "z-index", "teleport-to", "disabled-teleport", "width", "max-width", "disabled"]);
103
110
  }
104
- const A = /* @__PURE__ */ _(g, [["render", w], ["__file", "/builds/ketjo/nmorph/library/src/components/feedback/nmorph-guide/NmorphGuideStep.vue"]]);
111
+ const A = /* @__PURE__ */ u(g, [["render", C], ["__file", "/builds/ketjo/nmorph/library/src/components/feedback/nmorph-guide/NmorphGuideStep.vue"]]);
105
112
  export {
106
113
  A as default
107
114
  };