@nmorph/nmorph-ui-kit 2.2.46 → 2.2.47

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 (26) hide show
  1. package/dist/assets/icons/forward.svg.js +11 -7
  2. package/dist/assets/icons/reply.svg.js +9 -5
  3. package/dist/components/basic/nmorph-icon/NmorphIcon.css +1 -1
  4. package/dist/components/basic/nmorph-link/NmorphLink.vue.js +46 -34
  5. package/dist/components/data/nmorph-emoji-picker/NmorphEmojiPicker.css +1 -1
  6. package/dist/components/data/nmorph-emoji-picker/NmorphEmojiPicker.vue.js +42 -40
  7. package/dist/components/feedback/nmorph-callout/NmorphCallout.css +1 -1
  8. package/dist/components/feedback/nmorph-callout/NmorphCallout.vue.js +66 -28
  9. package/dist/components/providers/nmorph-notification-provider/NmorphNotificationProvider.css +1 -1
  10. package/dist/components/providers/nmorph-notification-provider/NmorphNotificationProvider.vue.js +81 -47
  11. package/dist/index.umd.js +13 -13
  12. package/dist/package.json.js +1 -1
  13. package/dist/src/components/basic/nmorph-link/NmorphLink.vue.d.ts +7 -0
  14. package/dist/src/components/basic/nmorph-link/types.d.ts +7 -0
  15. package/dist/src/components/data/nmorph-audio-preview/NmorphAudioPreview.vue.d.ts +2 -2
  16. package/dist/src/components/data/nmorph-emoji-picker/NmorphEmojiPicker.vue.d.ts +1 -0
  17. package/dist/src/components/data/nmorph-emoji-picker/types.d.ts +1 -0
  18. package/dist/src/components/data/nmorph-empty/NmorphEmpty.vue.d.ts +1 -1
  19. package/dist/src/components/data/nmorph-file-card/NmorphFileCard.vue.d.ts +2 -2
  20. package/dist/src/components/data/nmorph-video-preview/NmorphVideoPreview.vue.d.ts +2 -2
  21. package/dist/src/components/feedback/nmorph-callout/NmorphCallout.vue.d.ts +17 -3
  22. package/dist/src/components/feedback/nmorph-callout/types.d.ts +12 -1
  23. package/dist/src/components/navigation/nmorph-context-menu/NmorphContextMenu.vue.d.ts +2 -2
  24. package/dist/src/components/navigation/nmorph-dropdown/NmorphDropdown.vue.d.ts +2 -2
  25. package/dist/style.css +1 -1
  26. package/package.json +1 -1
@@ -1,9 +1,9 @@
1
1
  import './NmorphNotificationProvider.css';
2
- import { defineComponent as k, ref as d, inject as C, computed as f, watch as w, openBlock as a, createElementBlock as u, normalizeStyle as R, Fragment as p, renderList as v, createBlock as h, TransitionGroup as T, normalizeClass as A, withCtx as B, unref as E, mergeProps as O } from "vue";
3
- import { NmorphNotificationPlacement as P } from "./types.js";
4
- import j from "../../feedback/nmorph-alert/NmorphAlert.vue.js";
2
+ import { defineComponent as A, ref as h, inject as F, computed as g, watch as L, onBeforeUnmount as O, openBlock as a, createElementBlock as c, normalizeStyle as I, Fragment as x, renderList as T, createBlock as P, TransitionGroup as S, normalizeClass as D, withCtx as V, createVNode as j, unref as q, mergeProps as G, createElementVNode as _, toDisplayString as U, createCommentVNode as H } from "vue";
3
+ import { NmorphNotificationPlacement as J } from "./types.js";
4
+ import K from "../../feedback/nmorph-alert/NmorphAlert.vue.js";
5
5
  /* empty css */
6
- const q = 500, b = /* @__PURE__ */ k({
6
+ const Q = ["title"], W = { class: "nmorph-notification-provider__duration-value" }, X = 500, re = /* @__PURE__ */ A({
7
7
  __name: "NmorphNotificationProvider",
8
8
  props: {
9
9
  notifications: {},
@@ -11,62 +11,96 @@ const q = 500, b = /* @__PURE__ */ k({
11
11
  zIndex: { default: void 0 },
12
12
  quantity: { default: 100 }
13
13
  },
14
- setup(_) {
15
- const I = (t) => typeof t.id == "string" && t.id.length > 0, l = d([]), r = d([]), o = d([]), x = Object.values(P), N = (t) => {
16
- o.value = o.value.filter((i) => i.id !== t), r.value = r.value.filter((i) => i !== t);
17
- }, m = (t, i = !0) => {
18
- r.value.includes(t) || (i && !l.value.includes(t) && (l.value = [...l.value, t]), r.value = [...r.value, t], setTimeout(() => N(t), q));
19
- }, s = _, y = C("nmorph", void 0), g = f(
20
- () => x.map((t) => {
21
- const i = o.value.filter(
22
- (n) => (n.placement ?? s.placement) === t
23
- ), e = Math.max(i.length - s.quantity, 0);
14
+ setup(b) {
15
+ const k = (e) => typeof e.id == "string" && e.id.length > 0, d = h([]), i = h([]), n = h([]), s = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), w = Object.values(J), l = (e) => typeof e.duration != "number" || !Number.isFinite(e.duration) ? 0 : Math.max(e.duration, 0), N = (e) => l(e) > 0, z = (e) => {
16
+ if (e < 1e3) return `${e}ms`;
17
+ const t = e / 1e3;
18
+ return `${Number.isInteger(t) ? t : Number(t.toFixed(1))}s`;
19
+ }, y = (e) => z(l(e)), $ = (e) => ({
20
+ "--nmorph-notification-provider-duration": `${l(e)}ms`
21
+ }), p = (e) => {
22
+ const t = s.get(e);
23
+ t && clearTimeout(t), s.delete(e), u.delete(e);
24
+ }, C = (e) => {
25
+ n.value = n.value.filter((t) => t.id !== e), i.value = i.value.filter((t) => t !== e), p(e);
26
+ }, f = (e, t = !0) => {
27
+ i.value.includes(e) || (p(e), t && !d.value.includes(e) && (d.value = [...d.value, e]), i.value = [...i.value, e], setTimeout(() => C(e), X));
28
+ }, E = (e) => {
29
+ const t = l(e);
30
+ u.get(e.id) !== t && (p(e.id), t && (s.set(
31
+ e.id,
32
+ setTimeout(() => f(e.id), t)
33
+ ), u.set(e.id, t)));
34
+ }, m = b, B = F("nmorph", void 0), M = g(
35
+ () => w.map((e) => {
36
+ const t = n.value.filter(
37
+ (o) => (o.placement ?? m.placement) === e
38
+ ), r = Math.max(t.length - m.quantity, 0);
24
39
  return {
25
- placement: t,
26
- notifications: i.slice(e)
40
+ placement: e,
41
+ notifications: t.slice(r)
27
42
  };
28
43
  })
29
44
  );
30
- w(
31
- () => s.notifications,
32
- (t) => {
33
- const i = t.filter(I).filter((e) => !l.value.includes(e.id));
34
- o.value = o.value.map((e) => {
35
- const n = i.find((c) => c.id === e.id);
36
- return n ? { ...e, ...n } : e;
37
- }), i.forEach((e) => {
38
- o.value.some(
39
- (c) => c.id === e.id
40
- ) || o.value.push(e);
41
- }), o.value.filter(
42
- (e) => !i.some((n) => n.id === e.id)
43
- ).forEach((e) => m(e.id, !1));
45
+ L(
46
+ () => m.notifications,
47
+ (e) => {
48
+ const t = e.filter(k).filter((r) => !d.value.includes(r.id));
49
+ n.value = n.value.map((r) => {
50
+ const o = t.find((v) => v.id === r.id);
51
+ return o ? { ...r, ...o } : r;
52
+ }), t.forEach((r) => {
53
+ n.value.some(
54
+ (v) => v.id === r.id
55
+ ) || n.value.push(r);
56
+ }), t.forEach((r) => E(r)), n.value.filter(
57
+ (r) => !t.some((o) => o.id === r.id)
58
+ ).forEach((r) => f(r.id, !1));
44
59
  },
45
60
  { deep: !0, immediate: !0 }
46
61
  );
47
- const z = f(() => s.zIndex ?? (y?.zIndex.current.value ?? 1e3) + 1);
48
- return (t, i) => (a(), u("div", {
62
+ const R = g(() => m.zIndex ?? (B?.zIndex.current.value ?? 1e3) + 1);
63
+ return O(() => {
64
+ s.forEach((e) => clearTimeout(e)), s.clear(), u.clear();
65
+ }), (e, t) => (a(), c("div", {
49
66
  class: "nmorph-notification-provider",
50
- style: R({ zIndex: z.value })
67
+ style: I({ zIndex: R.value })
51
68
  }, [
52
- (a(!0), u(p, null, v(g.value, (e) => (a(), h(T, {
53
- key: e.placement,
69
+ (a(!0), c(x, null, T(M.value, (r) => (a(), P(S, {
70
+ key: r.placement,
54
71
  appear: "",
55
72
  name: "nmorph-notification",
56
73
  tag: "div",
57
- class: A(`nmorph-notification-provider__list nmorph-notification-provider__list--${e.placement}`)
74
+ class: D(`nmorph-notification-provider__list nmorph-notification-provider__list--${r.placement}`)
58
75
  }, {
59
- default: B(() => [
60
- (a(!0), u(p, null, v(e.notifications, (n) => (a(), h(E(j), O({
61
- key: n.id,
62
- style: { width: n.width },
63
- class: [
76
+ default: V(() => [
77
+ (a(!0), c(x, null, T(r.notifications, (o) => (a(), c("div", {
78
+ key: o.id,
79
+ style: I($(o)),
80
+ class: D([
64
81
  "nmorph-notification-provider__notification",
65
- r.value.includes(n.id) && "nmorph-notification-provider__notification--closing"
66
- ]
67
- }, { ref_for: !0 }, n, {
68
- onClose: () => m(n.id)
69
- }), null, 16, ["style", "class", "onClose"]))), 128))
82
+ N(o) && "nmorph-notification-provider__notification--with-duration",
83
+ i.value.includes(o.id) && "nmorph-notification-provider__notification--closing"
84
+ ])
85
+ }, [
86
+ j(q(K), G({
87
+ class: "nmorph-notification-provider__alert",
88
+ style: { width: o.width }
89
+ }, { ref_for: !0 }, o, {
90
+ onClose: () => f(o.id)
91
+ }), null, 16, ["style", "onClose"]),
92
+ N(o) ? (a(), c("div", {
93
+ key: `${o.id}-${l(o)}`,
94
+ class: "nmorph-notification-provider__duration",
95
+ title: y(o),
96
+ "aria-hidden": "true"
97
+ }, [
98
+ t[0] || (t[0] = _("span", { class: "nmorph-notification-provider__duration-track" }, [
99
+ _("span", { class: "nmorph-notification-provider__duration-bar" })
100
+ ], -1)),
101
+ _("span", W, U(y(o)), 1)
102
+ ], 8, Q)) : H("", !0)
103
+ ], 6))), 128))
70
104
  ]),
71
105
  _: 2
72
106
  }, 1032, ["class"]))), 128))
@@ -74,5 +108,5 @@ const q = 500, b = /* @__PURE__ */ k({
74
108
  }
75
109
  });
76
110
  export {
77
- b as default
111
+ re as default
78
112
  };