@nmorph/nmorph-ui-kit 3.0.7 → 3.0.8

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.
Files changed (22) hide show
  1. package/dist/components/basic/nmorph-icon/NmorphIcon.css +1 -1
  2. package/dist/components/data/nmorph-carousel/NmorphCarousel.css +1 -1
  3. package/dist/components/data/nmorph-carousel/NmorphCarousel.vue.js +26 -24
  4. package/dist/components/data/nmorph-carousel/NmorphCarousel.vue2.js +80 -30
  5. package/dist/components/data/nmorph-carousel/components/nmorph-carousel-item/NmorphCarouselItem.vue.js +21 -14
  6. package/dist/components/data/nmorph-carousel/components/nmorph-carousel-item/NmorphCarouselItem.vue2.js +20 -16
  7. package/dist/components/data/nmorph-media-tile/NmorphMediaTile.css +1 -1
  8. package/dist/components/data/nmorph-media-tile/NmorphMediaTile.vue2.js +17 -13
  9. package/dist/components/navigation/nmorph-stepper/NmorphStepper.css +1 -1
  10. package/dist/components/providers/nmorph-notification-provider/NmorphNotificationProvider.vue.js +101 -96
  11. package/dist/components/providers/nmorph-notification-provider/NmorphNotificationProvider.vue2.js +84 -60
  12. package/dist/hooks/use-z-index.js +10 -10
  13. package/dist/index.umd.js +10 -10
  14. package/dist/package.json.js +1 -1
  15. package/dist/src/components/data/nmorph-carousel/NmorphCarousel.vue.d.ts +3 -1
  16. package/dist/src/components/data/nmorph-carousel/types.d.ts +1 -0
  17. package/dist/src/components/data/nmorph-media-tile/NmorphMediaTile.vue.d.ts +3 -1
  18. package/dist/src/components/data/nmorph-media-tile/types.d.ts +4 -0
  19. package/dist/src/components/providers/nmorph-notification-provider/NmorphNotificationProvider.vue.d.ts +3 -1
  20. package/dist/src/components/providers/nmorph-notification-provider/types.d.ts +2 -0
  21. package/dist/style.css +1 -1
  22. package/package.json +1 -1
@@ -1,105 +1,110 @@
1
1
  import './NmorphNotificationProvider.css';
2
- import m from "./NmorphNotificationProvider.vue2.js";
3
- import { openBlock as e, createElementBlock as i, normalizeStyle as n, Fragment as a, renderList as d, createBlock as h, TransitionGroup as _, normalizeClass as s, withCtx as v, createVNode as u, createElementVNode as c, toDisplayString as f, createCommentVNode as p } from "vue";
2
+ import h from "./NmorphNotificationProvider.vue2.js";
3
+ import { openBlock as e, createBlock as d, Teleport as _, createElementVNode as l, normalizeStyle as n, createElementBlock as i, Fragment as s, renderList as c, TransitionGroup as v, normalizeClass as p, withCtx as u, createVNode as b, toDisplayString as f, createCommentVNode as m } from "vue";
4
4
  /* empty css */
5
5
  import y from "../../../_virtual/_plugin-vue_export-helper.js";
6
- const b = ["title"], k = {
6
+ const k = ["title"], N = {
7
7
  key: 0,
8
8
  class: "nmorph-notification-provider__duration-value"
9
9
  };
10
- function N(g, l, D, r, w, I) {
11
- return e(), i(
12
- "div",
13
- {
14
- class: "nmorph-notification-provider",
15
- style: n({ zIndex: r.zIndex })
16
- },
17
- [
18
- (e(!0), i(
19
- a,
20
- null,
21
- d(r.notificationGroups, (t) => (e(), h(_, {
22
- key: t.placement,
23
- appear: "",
24
- name: "nmorph-notification",
25
- tag: "div",
26
- class: s(`nmorph-notification-provider__list nmorph-notification-provider__list--${t.placement}`)
27
- }, {
28
- default: v(() => [
29
- (e(!0), i(
30
- a,
31
- null,
32
- d(t.notifications, (o) => (e(), i(
33
- "div",
34
- {
35
- key: o.id,
36
- style: n(r.getNotificationStyle(o)),
37
- class: s([
38
- "nmorph-notification-provider__notification",
39
- r.hasDurationIndicator(o) && "nmorph-notification-provider__notification--with-duration",
40
- r.closingIds.includes(o.id) && "nmorph-notification-provider__notification--closing"
41
- ])
42
- },
43
- [
44
- u(r.NmorphAlert, {
45
- id: o.id,
46
- class: "nmorph-notification-provider__alert",
47
- style: n({ width: o.width }),
48
- type: o.type,
49
- closable: o.closable,
50
- title: o.title,
51
- content: o.content,
52
- fill: o.fill,
53
- "show-icon": o.showIcon,
54
- bordered: o.bordered,
55
- html: o.html,
56
- "close-icon-position": o.closeIconPosition,
57
- "background-color": o.backgroundColor,
58
- onClose: () => r.closeHandler(o.id)
59
- }, null, 8, ["id", "style", "type", "closable", "title", "content", "fill", "show-icon", "bordered", "html", "close-icon-position", "background-color", "onClose"]),
60
- r.hasDurationIndicator(o) ? (e(), i("div", {
61
- key: `${o.id}-${r.getNotificationDuration(o)}`,
62
- class: "nmorph-notification-provider__duration",
63
- title: r.hasDurationValue(o) ? r.getNotificationDurationLabel(o) : void 0,
64
- "aria-hidden": "true"
65
- }, [
66
- l[0] || (l[0] = c(
67
- "span",
68
- { class: "nmorph-notification-provider__duration-track" },
69
- [
70
- c("span", { class: "nmorph-notification-provider__duration-bar" })
71
- ],
72
- -1
73
- /* CACHED */
74
- )),
75
- r.hasDurationValue(o) ? (e(), i(
76
- "span",
77
- k,
78
- f(r.getNotificationDurationLabel(o)),
79
- 1
80
- /* TEXT */
81
- )) : p("v-if", !0)
82
- ], 8, b)) : p("v-if", !0)
83
- ],
84
- 6
85
- /* CLASS, STYLE */
86
- ))),
87
- 128
88
- /* KEYED_FRAGMENT */
89
- ))
90
- ]),
91
- _: 2
92
- /* DYNAMIC */
93
- }, 1032, ["class"]))),
94
- 128
95
- /* KEYED_FRAGMENT */
96
- ))
97
- ],
98
- 4
99
- /* STYLE */
100
- );
10
+ function g(D, a, w, r, I, x) {
11
+ return e(), d(_, {
12
+ to: r.props.teleportTo,
13
+ disabled: r.teleportDisabled
14
+ }, [
15
+ l(
16
+ "div",
17
+ {
18
+ class: "nmorph-notification-provider",
19
+ style: n({ zIndex: r.zIndex })
20
+ },
21
+ [
22
+ (e(!0), i(
23
+ s,
24
+ null,
25
+ c(r.notificationGroups, (t) => (e(), d(v, {
26
+ key: t.placement,
27
+ appear: "",
28
+ name: "nmorph-notification",
29
+ tag: "div",
30
+ class: p(`nmorph-notification-provider__list nmorph-notification-provider__list--${t.placement}`)
31
+ }, {
32
+ default: u(() => [
33
+ (e(!0), i(
34
+ s,
35
+ null,
36
+ c(t.notifications, (o) => (e(), i(
37
+ "div",
38
+ {
39
+ key: o.id,
40
+ style: n(r.getNotificationStyle(o)),
41
+ class: p([
42
+ "nmorph-notification-provider__notification",
43
+ r.hasDurationIndicator(o) && "nmorph-notification-provider__notification--with-duration",
44
+ r.closingIds.includes(o.id) && "nmorph-notification-provider__notification--closing"
45
+ ])
46
+ },
47
+ [
48
+ b(r.NmorphAlert, {
49
+ id: o.id,
50
+ class: "nmorph-notification-provider__alert",
51
+ style: n({ width: o.width }),
52
+ type: o.type,
53
+ closable: o.closable,
54
+ title: o.title,
55
+ content: o.content,
56
+ fill: o.fill,
57
+ "show-icon": o.showIcon,
58
+ bordered: o.bordered,
59
+ html: o.html,
60
+ "close-icon-position": o.closeIconPosition,
61
+ "background-color": o.backgroundColor,
62
+ onClose: () => r.closeHandler(o.id)
63
+ }, null, 8, ["id", "style", "type", "closable", "title", "content", "fill", "show-icon", "bordered", "html", "close-icon-position", "background-color", "onClose"]),
64
+ r.hasDurationIndicator(o) ? (e(), i("div", {
65
+ key: `${o.id}-${r.getNotificationDuration(o)}`,
66
+ class: "nmorph-notification-provider__duration",
67
+ title: r.hasDurationValue(o) ? r.getNotificationDurationLabel(o) : void 0,
68
+ "aria-hidden": "true"
69
+ }, [
70
+ a[0] || (a[0] = l(
71
+ "span",
72
+ { class: "nmorph-notification-provider__duration-track" },
73
+ [
74
+ l("span", { class: "nmorph-notification-provider__duration-bar" })
75
+ ],
76
+ -1
77
+ /* CACHED */
78
+ )),
79
+ r.hasDurationValue(o) ? (e(), i(
80
+ "span",
81
+ N,
82
+ f(r.getNotificationDurationLabel(o)),
83
+ 1
84
+ /* TEXT */
85
+ )) : m("v-if", !0)
86
+ ], 8, k)) : m("v-if", !0)
87
+ ],
88
+ 6
89
+ /* CLASS, STYLE */
90
+ ))),
91
+ 128
92
+ /* KEYED_FRAGMENT */
93
+ ))
94
+ ]),
95
+ _: 2
96
+ /* DYNAMIC */
97
+ }, 1032, ["class"]))),
98
+ 128
99
+ /* KEYED_FRAGMENT */
100
+ ))
101
+ ],
102
+ 4
103
+ /* STYLE */
104
+ )
105
+ ], 8, ["to", "disabled"]);
101
106
  }
102
- const B = /* @__PURE__ */ y(m, [["render", N], ["__file", "/builds/ketjo/nmorph/library/src/components/providers/nmorph-notification-provider/NmorphNotificationProvider.vue"]]);
107
+ const L = /* @__PURE__ */ y(h, [["render", g], ["__file", "/builds/ketjo/nmorph/library/src/components/providers/nmorph-notification-provider/NmorphNotificationProvider.vue"]]);
103
108
  export {
104
- B as default
109
+ L as default
105
110
  };
@@ -1,97 +1,121 @@
1
1
  import './NmorphNotificationProvider.css';
2
- import { defineComponent as U, ref as v, inject as V, computed as D, watch as q, onBeforeUnmount as $ } from "vue";
3
- import { NmorphNotificationPlacement as C } from "./types.js";
4
- import F from "../../feedback/nmorph-alert/NmorphAlert.vue.js";
5
- const k = 500, E = 250, J = /* @__PURE__ */ U({
2
+ import { defineComponent as H, ref as s, inject as K, computed as f, watch as T, onMounted as J, onBeforeUnmount as Q } from "vue";
3
+ import { NmorphNotificationPlacement as W } from "./types.js";
4
+ import X from "../../feedback/nmorph-alert/NmorphAlert.vue.js";
5
+ const j = 500, L = 250, re = /* @__PURE__ */ H({
6
6
  __name: "NmorphNotificationProvider",
7
7
  props: {
8
8
  notifications: { type: Array, required: !0 },
9
9
  placement: { type: null, required: !1, default: "top-right" },
10
10
  zIndex: { type: Number, required: !1, default: void 0 },
11
- quantity: { type: Number, required: !1, default: 100 }
11
+ quantity: { type: Number, required: !1, default: 100 },
12
+ teleportTo: { type: null, required: !1, default: "body" },
13
+ disabledTeleport: { type: Boolean, required: !1, default: !1 }
12
14
  },
13
- setup(O, { expose: z }) {
14
- z();
15
- const T = (e) => typeof e.id == "string" && e.id.length > 0, l = v([]), o = v([]), n = v([]), u = v(Date.now()), s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map();
16
- let a;
17
- const g = Object.values(C), m = (e) => typeof e.duration != "number" || !Number.isFinite(e.duration) ? 0 : Math.max(e.duration, 0), y = (e) => m(e) > 0, S = (e) => e.showDurationValue !== !1, _ = (e) => {
18
- const t = m(e), r = d.get(e.id);
19
- return !t || !r ? t : Math.max(t - (u.value - r), 0);
20
- }, x = (e) => e < 1e3 ? `${Math.ceil(e)}ms` : `${Math.ceil(e / 1e3)}s`, j = (e) => x(_(e)), B = (e) => ({
21
- "--nmorph-private-notification-provider-duration": `${m(e)}ms`
22
- }), p = (e, t = !1) => {
23
- const r = s.get(e);
24
- r && clearTimeout(r), s.delete(e), c.delete(e), t || d.delete(e);
25
- }, A = (e) => {
26
- n.value = n.value.filter((t) => t.id !== e), o.value = o.value.filter((t) => t !== e), p(e);
27
- }, h = (e, t = !0) => {
28
- o.value.includes(e) || (p(e, !0), t && !l.value.includes(e) && (l.value = [...l.value, e]), o.value = [...o.value, e], setTimeout(() => A(e), k));
29
- }, w = (e) => {
30
- const t = m(e);
31
- c.get(e.id) !== t && (p(e.id), t && (u.value = Date.now(), d.set(e.id, u.value), s.set(
15
+ setup(P, { expose: U }) {
16
+ U();
17
+ const y = (e) => typeof e.id == "string" && e.id.length > 0, l = s([]), o = s([]), n = s([]), c = s(Date.now()), d = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map();
18
+ let i;
19
+ const w = Object.values(W), p = (e) => typeof e.duration != "number" || !Number.isFinite(e.duration) ? 0 : Math.max(e.duration, 0), R = (e) => p(e) > 0, V = (e) => e.showDurationValue !== !1, q = (e) => {
20
+ const t = p(e), r = v.get(e.id);
21
+ return !t || !r ? t : Math.max(t - (c.value - r), 0);
22
+ }, z = (e) => e < 1e3 ? `${Math.ceil(e)}ms` : `${Math.ceil(e / 1e3)}s`, Z = (e) => z(q(e)), $ = (e) => ({
23
+ "--nmorph-private-notification-provider-duration": `${p(e)}ms`
24
+ }), h = (e, t = !1) => {
25
+ const r = d.get(e);
26
+ r && clearTimeout(r), d.delete(e), m.delete(e), t || v.delete(e);
27
+ }, k = (e) => {
28
+ n.value = n.value.filter((t) => t.id !== e), o.value = o.value.filter((t) => t !== e), h(e);
29
+ }, D = (e, t = !0) => {
30
+ o.value.includes(e) || (h(e, !0), t && !l.value.includes(e) && (l.value = [...l.value, e]), o.value = [...o.value, e], setTimeout(() => k(e), j));
31
+ }, E = (e) => {
32
+ const t = p(e);
33
+ m.get(e.id) !== t && (h(e.id), t && (c.value = Date.now(), v.set(e.id, c.value), d.set(
32
34
  e.id,
33
- setTimeout(() => h(e.id), t)
34
- ), c.set(e.id, t)));
35
- }, f = O, M = V("nmorph", void 0), L = D(
36
- () => g.map((e) => {
35
+ setTimeout(() => D(e.id), t)
36
+ ), m.set(e.id, t)));
37
+ }, a = P, g = s(!1), x = K("nmorph"), I = s(x?.zIndex.current.value ?? 1e3), N = s(!1), _ = () => {
38
+ a.zIndex !== void 0 || N.value || (I.value = x?.zIndex.next() ?? I.value + 1, N.value = !0);
39
+ }, C = f(
40
+ () => w.map((e) => {
37
41
  const t = n.value.filter(
38
- (i) => (i.placement ?? f.placement) === e
39
- ), r = Math.max(t.length - f.quantity, 0);
42
+ (u) => (u.placement ?? a.placement) === e
43
+ ), r = Math.max(t.length - a.quantity, 0);
40
44
  return {
41
45
  placement: e,
42
46
  notifications: t.slice(r)
43
47
  };
44
48
  })
45
- ), b = D(
49
+ ), O = f(
46
50
  () => n.value.some(
47
- (e) => y(e) && !o.value.includes(e.id)
51
+ (e) => R(e) && !o.value.includes(e.id)
48
52
  )
49
- ), N = () => {
50
- a && (clearInterval(a), a = void 0);
53
+ ), b = f(() => n.value.length > 0), B = f(
54
+ () => b.value || a.notifications.some(
55
+ (e) => y(e) && !l.value.includes(e.id)
56
+ )
57
+ ), F = f(() => a.zIndex ?? I.value), G = f(() => !g.value || a.disabledTeleport), A = () => {
58
+ i && (clearInterval(i), i = void 0);
51
59
  };
52
- q(
60
+ T(
61
+ () => a.notifications,
62
+ () => {
63
+ B.value && _();
64
+ },
65
+ { deep: !0, immediate: !0, flush: "sync" }
66
+ ), T(
53
67
  b,
68
+ (e) => {
69
+ if (e) {
70
+ _();
71
+ return;
72
+ }
73
+ N.value = !1;
74
+ },
75
+ { immediate: !0, flush: "sync" }
76
+ ), T(
77
+ O,
54
78
  (e) => {
55
79
  if (!e) {
56
- N();
80
+ A();
57
81
  return;
58
82
  }
59
- a || (u.value = Date.now(), a = setInterval(() => {
60
- u.value = Date.now();
61
- }, E));
83
+ i || (c.value = Date.now(), i = setInterval(() => {
84
+ c.value = Date.now();
85
+ }, L));
62
86
  },
63
87
  { immediate: !0 }
64
- ), q(
65
- () => f.notifications,
88
+ ), T(
89
+ () => a.notifications,
66
90
  (e) => {
67
- const t = e.filter(T).filter((r) => !l.value.includes(r.id));
91
+ const t = e.filter(y).filter((r) => !l.value.includes(r.id));
68
92
  n.value = n.value.map((r) => {
69
- const i = t.find((I) => I.id === r.id);
70
- return i ? { ...r, ...i } : r;
93
+ const u = t.find((M) => M.id === r.id);
94
+ return u ? { ...r, ...u } : r;
71
95
  }), t.forEach((r) => {
72
96
  n.value.some(
73
- (I) => I.id === r.id
74
- ) || n.value.push(r);
75
- }), t.forEach((r) => w(r)), n.value.filter(
76
- (r) => !t.some((i) => i.id === r.id)
77
- ).forEach((r) => h(r.id, !1));
97
+ (M) => M.id === r.id
98
+ ) || (n.value = [...n.value, r]);
99
+ }), t.forEach((r) => E(r)), n.value.filter(
100
+ (r) => !t.some((u) => u.id === r.id)
101
+ ).forEach((r) => D(r.id, !1));
78
102
  },
79
103
  { deep: !0, immediate: !0 }
80
- );
81
- const P = D(() => f.zIndex ?? (M?.zIndex.current.value ?? 1e3) + 1);
82
- $(() => {
83
- s.forEach((e) => clearTimeout(e)), s.clear(), c.clear(), d.clear(), N();
104
+ ), J(() => {
105
+ g.value = !0;
106
+ }), Q(() => {
107
+ d.forEach((e) => clearTimeout(e)), d.clear(), m.clear(), v.clear(), A();
84
108
  });
85
- const R = { ANIMATION_DURATION: k, DURATION_TICK_INTERVAL: E, hasNotificationId: T, removedIds: l, closingIds: o, renderedNotifications: n, durationTick: u, durationTimers: s, durationById: c, durationStartedAtById: d, get durationTicker() {
86
- return a;
109
+ const S = { ANIMATION_DURATION: j, DURATION_TICK_INTERVAL: L, hasNotificationId: y, removedIds: l, closingIds: o, renderedNotifications: n, durationTick: c, durationTimers: d, durationById: m, durationStartedAtById: v, get durationTicker() {
110
+ return i;
87
111
  }, set durationTicker(e) {
88
- a = e;
89
- }, placementList: g, getNotificationDuration: m, hasDurationIndicator: y, hasDurationValue: S, getNotificationRemainingDuration: _, formatNotificationDuration: x, getNotificationDurationLabel: j, getNotificationStyle: B, clearDurationTimer: p, removeRenderedNotification: A, closeHandler: h, scheduleDurationTimer: w, props: f, nmorph: M, notificationGroups: L, hasRunningDurationIndicator: b, stopDurationTicker: N, zIndex: P, get NmorphAlert() {
90
- return F;
112
+ i = e;
113
+ }, placementList: w, getNotificationDuration: p, hasDurationIndicator: R, hasDurationValue: V, getNotificationRemainingDuration: q, formatNotificationDuration: z, getNotificationDurationLabel: Z, getNotificationStyle: $, clearDurationTimer: h, removeRenderedNotification: k, closeHandler: D, scheduleDurationTimer: E, props: a, isMounted: g, nmorph: x, dynamicZIndex: I, activeZIndexAllocated: N, allocateZIndex: _, notificationGroups: C, hasRunningDurationIndicator: O, hasRenderedNotifications: b, hasActiveNotifications: B, zIndex: F, teleportDisabled: G, stopDurationTicker: A, get NmorphAlert() {
114
+ return X;
91
115
  } };
92
- return Object.defineProperty(R, "__isScriptSetup", { enumerable: !1, value: !0 }), R;
116
+ return Object.defineProperty(S, "__isScriptSetup", { enumerable: !1, value: !0 }), S;
93
117
  }
94
118
  });
95
119
  export {
96
- J as default
120
+ re as default
97
121
  };
@@ -1,14 +1,14 @@
1
- import { inject as u, ref as c, watch as m, computed as a } from "vue";
2
- const i = (r, n) => {
3
- const t = u("nmorph"), e = c(t?.zIndex.current.value ?? 1e3);
4
- return m(
5
- r,
6
- (o) => {
7
- o && n() === void 0 && (e.value = t?.zIndex.next() ?? e.value + 1);
1
+ import { inject as o, ref as r, watch as i, computed as s } from "vue";
2
+ const d = (e, t) => {
3
+ const u = o("nmorph"), n = r(u?.zIndex.current.value ?? 1e3);
4
+ return i(
5
+ () => typeof e == "function" ? e() : e.value,
6
+ (c) => {
7
+ c && t() === void 0 && (n.value = u?.zIndex.next() ?? n.value + 1);
8
8
  },
9
- { immediate: !0 }
10
- ), a(() => n() ?? e.value);
9
+ { immediate: !0, flush: "sync" }
10
+ ), s(() => t() ?? n.value);
11
11
  };
12
12
  export {
13
- i as useZIndex
13
+ d as useZIndex
14
14
  };