@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.
- package/dist/components/feedback/nmorph-guide/NmorphGuide.vue2.js +48 -46
- package/dist/components/feedback/nmorph-guide/NmorphGuideStep.css +1 -1
- package/dist/components/feedback/nmorph-guide/NmorphGuideStep.vue.js +79 -72
- package/dist/index.umd.js +28 -28
- package/dist/package.json.js +1 -1
- package/dist/src/components/feedback/nmorph-guide/NmorphGuide.vue.d.ts +1 -0
- package/dist/src/components/feedback/nmorph-guide/types.d.ts +2 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './NmorphGuide.css';
|
|
2
|
-
import { defineComponent as j, ref as
|
|
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(
|
|
27
|
-
const
|
|
28
|
-
let
|
|
29
|
-
const d = (e) => String(e),
|
|
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
|
|
32
|
-
e.set(d(
|
|
33
|
-
...
|
|
34
|
-
order:
|
|
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
|
-
...
|
|
41
|
+
...b.value.get(d(e.name)),
|
|
41
42
|
registrationOrder: e.registrationOrder
|
|
42
|
-
})).filter((e) => !e.disabled).sort((e,
|
|
43
|
-
const o = e.order ?? e.registrationOrder, P =
|
|
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(() =>
|
|
47
|
-
const
|
|
48
|
-
|
|
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
|
|
51
|
-
|
|
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),
|
|
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
|
-
|
|
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
|
-
|
|
68
|
+
t.loop ? c(0) : m();
|
|
68
69
|
return;
|
|
69
70
|
}
|
|
70
71
|
c(l.value + 1);
|
|
71
72
|
}
|
|
72
73
|
}, y = (e) => {
|
|
73
|
-
|
|
74
|
+
p(e);
|
|
74
75
|
}, _ = (e) => {
|
|
75
|
-
const
|
|
76
|
+
const r = d(e.name), o = u.value[r];
|
|
76
77
|
u.value = {
|
|
77
78
|
...u.value,
|
|
78
|
-
[
|
|
79
|
+
[r]: {
|
|
79
80
|
...o,
|
|
80
81
|
...e,
|
|
81
|
-
registrationOrder: o?.registrationOrder ??
|
|
82
|
+
registrationOrder: o?.registrationOrder ?? f
|
|
82
83
|
}
|
|
83
|
-
}, o || (
|
|
84
|
+
}, o || (f += 1);
|
|
84
85
|
}, k = (e) => {
|
|
85
|
-
const
|
|
86
|
-
delete o[
|
|
86
|
+
const r = d(e), o = { ...u.value };
|
|
87
|
+
delete o[r], u.value = o;
|
|
87
88
|
};
|
|
88
89
|
z(
|
|
89
|
-
[() =>
|
|
90
|
-
([e,
|
|
91
|
-
!e || o ||
|
|
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(() =>
|
|
100
|
-
showClose: a(() =>
|
|
101
|
-
showProgress: a(() =>
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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:
|
|
120
|
-
return
|
|
121
|
+
const I = { props: t, emit: i, registeredSteps: u, internalActiveStep: x, get registrationCursor() {
|
|
122
|
+
return f;
|
|
121
123
|
}, set registrationCursor(e) {
|
|
122
|
-
|
|
123
|
-
}, getStepKey: d, stepOverrides:
|
|
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
|
|
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
|
|
6
|
-
const
|
|
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
|
|
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(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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(
|
|
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__ */
|
|
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
|
};
|