@nmorph/nmorph-ui-kit 2.2.46 → 2.2.48

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 (29) 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/data/nmorph-file-card/NmorphFileCard.css +1 -1
  8. package/dist/components/data/nmorph-file-card/NmorphFileCard.vue.js +25 -16
  9. package/dist/components/feedback/nmorph-callout/NmorphCallout.css +1 -1
  10. package/dist/components/feedback/nmorph-callout/NmorphCallout.vue.js +66 -28
  11. package/dist/components/providers/nmorph-notification-provider/NmorphNotificationProvider.css +1 -1
  12. package/dist/components/providers/nmorph-notification-provider/NmorphNotificationProvider.vue.js +81 -47
  13. package/dist/index.umd.js +13 -13
  14. package/dist/package.json.js +1 -1
  15. package/dist/src/components/basic/nmorph-link/NmorphLink.vue.d.ts +7 -0
  16. package/dist/src/components/basic/nmorph-link/types.d.ts +7 -0
  17. package/dist/src/components/data/nmorph-audio-preview/NmorphAudioPreview.vue.d.ts +2 -2
  18. package/dist/src/components/data/nmorph-emoji-picker/NmorphEmojiPicker.vue.d.ts +1 -0
  19. package/dist/src/components/data/nmorph-emoji-picker/types.d.ts +1 -0
  20. package/dist/src/components/data/nmorph-empty/NmorphEmpty.vue.d.ts +1 -1
  21. package/dist/src/components/data/nmorph-file-card/NmorphFileCard.vue.d.ts +6 -2
  22. package/dist/src/components/data/nmorph-file-card/types.d.ts +4 -0
  23. package/dist/src/components/data/nmorph-video-preview/NmorphVideoPreview.vue.d.ts +2 -2
  24. package/dist/src/components/feedback/nmorph-callout/NmorphCallout.vue.d.ts +17 -3
  25. package/dist/src/components/feedback/nmorph-callout/types.d.ts +12 -1
  26. package/dist/src/components/navigation/nmorph-context-menu/NmorphContextMenu.vue.d.ts +2 -2
  27. package/dist/src/components/navigation/nmorph-dropdown/NmorphDropdown.vue.d.ts +2 -2
  28. package/dist/style.css +1 -1
  29. package/package.json +1 -1
@@ -1,15 +1,26 @@
1
1
  import './NmorphCallout.css';
2
- import { defineComponent as n, computed as i, openBlock as e, createElementBlock as o, normalizeStyle as r, normalizeClass as c, toDisplayString as d, createCommentVNode as s, createElementVNode as u } from "vue";
3
- import { createCssVariables as p, createCssSizeVariables as m } from "../../../utils/common.js";
4
- const f = {
2
+ import { defineComponent as v, useSlots as m, computed as t, openBlock as a, createBlock as h, resolveDynamicComponent as _, mergeProps as y, withCtx as g, createElementBlock as r, renderSlot as n, createTextVNode as b, toDisplayString as z, createCommentVNode as S } from "vue";
3
+ import { createCssVariables as k, createCssSizeVariables as C } from "../../../utils/common.js";
4
+ const w = {
5
5
  key: 0,
6
6
  class: "nmorph-callout__title"
7
- }, _ = ["innerHTML"], S = /* @__PURE__ */ n({
7
+ }, B = {
8
+ key: 1,
9
+ class: "nmorph-callout__content"
10
+ }, F = ["innerHTML"], $ = /* @__PURE__ */ v({
8
11
  __name: "NmorphCallout",
9
12
  props: {
10
13
  type: { default: "info" },
11
14
  title: { default: "" },
12
- content: {},
15
+ content: { default: "" },
16
+ as: { default: "div" },
17
+ href: { default: void 0 },
18
+ target: { default: void 0 },
19
+ rel: { default: void 0 },
20
+ referrerpolicy: { default: void 0 },
21
+ referrerPolicy: { default: void 0 },
22
+ download: { type: [String, Boolean], default: void 0 },
23
+ ariaLabel: { default: void 0 },
13
24
  color: { default: void 0 },
14
25
  padding: { default: "var(--indentation-03) var(--indentation-04)" },
15
26
  borderRadius: { default: "var(--default-border-radius)" },
@@ -18,32 +29,59 @@ const f = {
18
29
  titleFontSize: { default: "var(--font-size-medium)" },
19
30
  contentFontSize: { default: "var(--font-size-extra-small)" }
20
31
  },
21
- setup(a) {
22
- const t = a, l = i(() => ({
23
- ...m({
24
- "--callout-padding": t.padding,
25
- "--callout-border-radius": t.borderRadius,
26
- "--callout-accent-width": t.accentWidth,
27
- "--callout-title-gap": t.titleGap,
28
- "--callout-title-font-size": t.titleFontSize,
29
- "--callout-content-font-size": t.contentFontSize
32
+ setup(d) {
33
+ const i = {
34
+ self: "_self",
35
+ blank: "_blank",
36
+ parent: "_parent",
37
+ top: "_top"
38
+ }, e = d, o = m(), s = t(() => ({
39
+ ...C({
40
+ "--callout-padding": e.padding,
41
+ "--callout-border-radius": e.borderRadius,
42
+ "--callout-accent-width": e.accentWidth,
43
+ "--callout-title-gap": e.titleGap,
44
+ "--callout-title-font-size": e.titleFontSize,
45
+ "--callout-content-font-size": e.contentFontSize
30
46
  }),
31
- ...p({
32
- "--callout-color": t.color
47
+ ...k({
48
+ "--callout-color": e.color
33
49
  })
34
- }));
35
- return (v, h) => (e(), o("div", {
36
- class: c(["nmorph-callout", `nmorph-callout--${t.type}`]),
37
- style: r(l.value)
38
- }, [
39
- t.title ? (e(), o("div", f, d(t.title), 1)) : s("", !0),
40
- u("div", {
41
- class: "nmorph-callout__content",
42
- innerHTML: t.content
43
- }, null, 8, _)
44
- ], 6));
50
+ })), c = t(() => {
51
+ if (e.target)
52
+ return e.target in i ? i[e.target] : e.target;
53
+ }), u = t(() => e.as !== "a" ? {} : {
54
+ href: e.href,
55
+ target: c.value,
56
+ rel: e.rel,
57
+ referrerpolicy: e.referrerpolicy ?? e.referrerPolicy,
58
+ download: e.download === !0 ? "" : e.download === !1 ? void 0 : e.download,
59
+ "aria-label": e.ariaLabel
60
+ }), f = t(() => !!(o.header || o.title || e.title)), p = t(() => !!o.default);
61
+ return (l, L) => (a(), h(_(e.as), y({
62
+ class: ["nmorph-callout", `nmorph-callout--${e.type}`],
63
+ style: s.value
64
+ }, u.value), {
65
+ default: g(() => [
66
+ f.value ? (a(), r("div", w, [
67
+ n(l.$slots, "header", {}, () => [
68
+ n(l.$slots, "title", {}, () => [
69
+ b(z(e.title), 1)
70
+ ])
71
+ ])
72
+ ])) : S("", !0),
73
+ p.value ? (a(), r("div", B, [
74
+ n(l.$slots, "default")
75
+ ])) : (a(), r("div", {
76
+ key: 2,
77
+ class: "nmorph-callout__content",
78
+ innerHTML: e.content
79
+ }, null, 8, F))
80
+ ]),
81
+ _: 3
82
+ }, 16, ["class", "style"]));
45
83
  }
46
84
  });
47
85
  export {
48
- S as default
86
+ $ as default
49
87
  };
@@ -1 +1 @@
1
- .nmorph-notification-provider{position:fixed;inset:0;width:100vw;height:100vh;pointer-events:none}.nmorph-notification-provider .nmorph-notification-provider__notification{width:fit-content;height:fit-content;margin:1rem;transition:transform .5s ease,opacity .5s ease-in-out;pointer-events:all}.nmorph-notification-provider .nmorph-notification-provider__list{position:fixed;display:flex;flex-direction:column;width:fit-content;max-width:100vw;pointer-events:none}.nmorph-notification-provider .nmorph-notification-move{transition:transform .5s ease}.nmorph-notification-provider .nmorph-notification-provider__list--top-left{top:0;left:0;align-items:flex-start}.nmorph-notification-provider .nmorph-notification-provider__list--top-right{top:0;right:0;align-items:flex-end}.nmorph-notification-provider .nmorph-notification-provider__list--bottom-left{bottom:0;left:0;align-items:flex-start}.nmorph-notification-provider .nmorph-notification-provider__list--bottom-right{right:0;bottom:0;align-items:flex-end}.nmorph-notification-provider .nmorph-notification-provider__list--top-center{top:0;left:50%;align-items:center;transform:translate(-50%)}.nmorph-notification-provider .nmorph-notification-provider__list--bottom-center{bottom:0;left:50%;align-items:center;transform:translate(-50%)}.nmorph-notification-provider .nmorph-notification-provider__list--top-left .nmorph-notification-enter-active,.nmorph-notification-provider .nmorph-notification-provider__list--bottom-left .nmorph-notification-enter-active,.nmorph-notification-provider .nmorph-notification-provider__list--top-right .nmorph-notification-enter-active,.nmorph-notification-provider .nmorph-notification-provider__list--bottom-right .nmorph-notification-enter-active,.nmorph-notification-provider .nmorph-notification-provider__list--top-center .nmorph-notification-enter-active,.nmorph-notification-provider .nmorph-notification-provider__list--bottom-center .nmorph-notification-enter-active,.nmorph-notification-provider .nmorph-notification-provider__list--top-left .nmorph-notification-leave-active,.nmorph-notification-provider .nmorph-notification-provider__list--bottom-left .nmorph-notification-leave-active,.nmorph-notification-provider .nmorph-notification-provider__list--top-right .nmorph-notification-leave-active,.nmorph-notification-provider .nmorph-notification-provider__list--bottom-right .nmorph-notification-leave-active,.nmorph-notification-provider .nmorph-notification-provider__list--top-center .nmorph-notification-leave-active,.nmorph-notification-provider .nmorph-notification-provider__list--bottom-center .nmorph-notification-leave-active{transition:transform .5s ease,opacity .5s ease-in-out}.nmorph-notification-provider .nmorph-notification-provider__list--top-left .nmorph-notification-enter-from,.nmorph-notification-provider .nmorph-notification-provider__list--bottom-left .nmorph-notification-enter-from{transform:translate(-100%)}.nmorph-notification-provider .nmorph-notification-provider__list--top-right .nmorph-notification-enter-from,.nmorph-notification-provider .nmorph-notification-provider__list--bottom-right .nmorph-notification-enter-from{transform:translate(100%)}.nmorph-notification-provider .nmorph-notification-provider__list--top-center .nmorph-notification-enter-from{transform:translateY(-100%)}.nmorph-notification-provider .nmorph-notification-provider__list--bottom-center .nmorph-notification-enter-from{transform:translateY(100%)}.nmorph-notification-provider .nmorph-notification-provider__list--top-left .nmorph-notification-leave-to,.nmorph-notification-provider .nmorph-notification-provider__list--bottom-left .nmorph-notification-leave-to{transform:translate(-100%)}.nmorph-notification-provider .nmorph-notification-provider__list--top-right .nmorph-notification-leave-to,.nmorph-notification-provider .nmorph-notification-provider__list--bottom-right .nmorph-notification-leave-to{transform:translate(100%)}.nmorph-notification-provider .nmorph-notification-provider__list--top-center .nmorph-notification-leave-to{transform:translateY(-100%)}.nmorph-notification-provider .nmorph-notification-provider__list--bottom-center .nmorph-notification-leave-to{transform:translateY(100%)}.nmorph-notification-provider .nmorph-notification-enter-from{opacity:0}.nmorph-notification-provider .nmorph-notification-enter-to{transform:translate(0);opacity:1}.nmorph-notification-provider .nmorph-notification-leave-active{overflow:hidden}.nmorph-notification-provider .nmorph-notification-leave-active .nmorph-icon{--color: var(--nmorph-text-color);display:flex;align-items:center;width:var(--width);min-width:var(--width);height:var(--height);min-height:var(--height)}.nmorph-notification-provider .nmorph-notification-leave-active .nmorph-icon--small{--width: 14px;--height: 14px}.nmorph-notification-provider .nmorph-notification-leave-active .nmorph-icon--medium{--width: 20px;--height: 20px}.nmorph-notification-provider .nmorph-notification-leave-active .nmorph-icon--large{--width: 32px;--height: 32px}.nmorph-notification-provider .nmorph-notification-leave-active .nmorph-icon__content{display:flex;justify-content:center;align-items:center;width:var(--width);min-width:var(--width);height:var(--height);min-height:var(--height);overflow:hidden}.nmorph-notification-provider .nmorph-notification-leave-active .nmorph-alert__close .nmorph-icon,.nmorph-notification-provider .nmorph-notification-leave-active .nmorph-alert__content,.nmorph-notification-provider .nmorph-notification-leave-active .nmorph-alert__content-title{--color: var(--nmorph-white-color)}.nmorph-notification-provider .nmorph-notification-leave-active.nmorph-alert--success .nmorph-alert__icon .nmorph-icon{--color: var(--nmorph-success-color)}.nmorph-notification-provider .nmorph-notification-leave-active.nmorph-alert--error .nmorph-alert__icon .nmorph-icon{--color: var(--nmorph-error-color)}.nmorph-notification-provider .nmorph-notification-leave-active.nmorph-alert--warning .nmorph-alert__icon .nmorph-icon{--color: var(--nmorph-warn-color)}.nmorph-notification-provider .nmorph-notification-leave-active.nmorph-alert--info .nmorph-alert__icon .nmorph-icon{--color: var(--nmorph-info-color)}.nmorph-notification-provider .nmorph-notification-leave-active svg{width:100%;height:100%;fill:var(--color);stroke-width:0}.nmorph-notification-provider .nmorph-notification-leave-active path{stroke:var(--color)}.nmorph-notification-provider .nmorph-notification-leave-to{opacity:0;pointer-events:none}.nmorph-notification-provider .nmorph-notification-provider__list--top-left .nmorph-notification-provider__notification--closing,.nmorph-notification-provider .nmorph-notification-provider__list--bottom-left .nmorph-notification-provider__notification--closing{position:absolute;transform:translate(-100%);opacity:0;pointer-events:none}.nmorph-notification-provider .nmorph-notification-provider__list--top-right .nmorph-notification-provider__notification--closing,.nmorph-notification-provider .nmorph-notification-provider__list--bottom-right .nmorph-notification-provider__notification--closing{position:absolute;transform:translate(100%);opacity:0;pointer-events:none}.nmorph-notification-provider .nmorph-notification-provider__list--top-center .nmorph-notification-provider__notification--closing{position:absolute;transform:translateY(-100%);opacity:0;pointer-events:none}.nmorph-notification-provider .nmorph-notification-provider__list--bottom-center .nmorph-notification-provider__notification--closing{position:absolute;transform:translateY(100%);opacity:0;pointer-events:none}
1
+ .nmorph-notification-provider{position:fixed;inset:0;width:100vw;height:100vh;pointer-events:none}.nmorph-notification-provider .nmorph-notification-provider__notification{position:relative;width:fit-content;height:fit-content;margin:1rem;overflow:hidden;border-radius:var(--default-border-radius);transition:transform .5s ease,opacity .5s ease-in-out;pointer-events:all}.nmorph-notification-provider .nmorph-notification-provider__notification--with-duration .nmorph-alert{padding-bottom:calc(var(--indentation-03) + 12px)}.nmorph-notification-provider .nmorph-notification-provider__duration{position:absolute;right:var(--indentation-04);bottom:var(--indentation-02);left:var(--indentation-04);display:flex;gap:var(--indentation-02);align-items:center;color:var(--nmorph-white-color);pointer-events:none}.nmorph-notification-provider .nmorph-notification-provider__duration-track{flex:1 1 auto;min-width:20px;height:3px;overflow:hidden;background:color-mix(in srgb,currentColor 20%,transparent);border-radius:999px}.nmorph-notification-provider .nmorph-notification-provider__duration-bar{display:block;width:100%;height:100%;background:currentColor;border-radius:inherit;transform-origin:left center;opacity:.72;animation:nmorph-notification-provider-duration var(--nmorph-notification-provider-duration) linear forwards}.nmorph-notification-provider .nmorph-notification-provider__duration-value{flex:0 0 auto;color:currentColor;font-size:var(--font-size-extra-small);line-height:1;opacity:.72}.nmorph-notification-provider .nmorph-notification-provider__list{position:fixed;display:flex;flex-direction:column;width:fit-content;max-width:100vw;pointer-events:none}.nmorph-notification-provider .nmorph-notification-move{transition:transform .5s ease}.nmorph-notification-provider .nmorph-notification-provider__list--top-left{top:0;left:0;align-items:flex-start}.nmorph-notification-provider .nmorph-notification-provider__list--top-right{top:0;right:0;align-items:flex-end}.nmorph-notification-provider .nmorph-notification-provider__list--bottom-left{bottom:0;left:0;align-items:flex-start}.nmorph-notification-provider .nmorph-notification-provider__list--bottom-right{right:0;bottom:0;align-items:flex-end}.nmorph-notification-provider .nmorph-notification-provider__list--top-center{top:0;left:50%;align-items:center;transform:translate(-50%)}.nmorph-notification-provider .nmorph-notification-provider__list--bottom-center{bottom:0;left:50%;align-items:center;transform:translate(-50%)}.nmorph-notification-provider .nmorph-notification-provider__list--top-left .nmorph-notification-enter-active,.nmorph-notification-provider .nmorph-notification-provider__list--bottom-left .nmorph-notification-enter-active,.nmorph-notification-provider .nmorph-notification-provider__list--top-right .nmorph-notification-enter-active,.nmorph-notification-provider .nmorph-notification-provider__list--bottom-right .nmorph-notification-enter-active,.nmorph-notification-provider .nmorph-notification-provider__list--top-center .nmorph-notification-enter-active,.nmorph-notification-provider .nmorph-notification-provider__list--bottom-center .nmorph-notification-enter-active,.nmorph-notification-provider .nmorph-notification-provider__list--top-left .nmorph-notification-leave-active,.nmorph-notification-provider .nmorph-notification-provider__list--bottom-left .nmorph-notification-leave-active,.nmorph-notification-provider .nmorph-notification-provider__list--top-right .nmorph-notification-leave-active,.nmorph-notification-provider .nmorph-notification-provider__list--bottom-right .nmorph-notification-leave-active,.nmorph-notification-provider .nmorph-notification-provider__list--top-center .nmorph-notification-leave-active,.nmorph-notification-provider .nmorph-notification-provider__list--bottom-center .nmorph-notification-leave-active{transition:transform .5s ease,opacity .5s ease-in-out}.nmorph-notification-provider .nmorph-notification-provider__list--top-left .nmorph-notification-enter-from,.nmorph-notification-provider .nmorph-notification-provider__list--bottom-left .nmorph-notification-enter-from{transform:translate(-100%)}.nmorph-notification-provider .nmorph-notification-provider__list--top-right .nmorph-notification-enter-from,.nmorph-notification-provider .nmorph-notification-provider__list--bottom-right .nmorph-notification-enter-from{transform:translate(100%)}.nmorph-notification-provider .nmorph-notification-provider__list--top-center .nmorph-notification-enter-from{transform:translateY(-100%)}.nmorph-notification-provider .nmorph-notification-provider__list--bottom-center .nmorph-notification-enter-from{transform:translateY(100%)}.nmorph-notification-provider .nmorph-notification-provider__list--top-left .nmorph-notification-leave-to,.nmorph-notification-provider .nmorph-notification-provider__list--bottom-left .nmorph-notification-leave-to{transform:translate(-100%)}.nmorph-notification-provider .nmorph-notification-provider__list--top-right .nmorph-notification-leave-to,.nmorph-notification-provider .nmorph-notification-provider__list--bottom-right .nmorph-notification-leave-to{transform:translate(100%)}.nmorph-notification-provider .nmorph-notification-provider__list--top-center .nmorph-notification-leave-to{transform:translateY(-100%)}.nmorph-notification-provider .nmorph-notification-provider__list--bottom-center .nmorph-notification-leave-to{transform:translateY(100%)}.nmorph-notification-provider .nmorph-notification-enter-from{opacity:0}.nmorph-notification-provider .nmorph-notification-enter-to{transform:translate(0);opacity:1}.nmorph-notification-provider .nmorph-notification-leave-active{overflow:hidden}.nmorph-notification-provider .nmorph-notification-leave-active .nmorph-icon{--color: var(--nmorph-text-color);display:flex;align-items:center;width:var(--width);min-width:var(--width);height:var(--height);min-height:var(--height)}.nmorph-notification-provider .nmorph-notification-leave-active .nmorph-icon--small{--width: 14px;--height: 14px}.nmorph-notification-provider .nmorph-notification-leave-active .nmorph-icon--medium{--width: 20px;--height: 20px}.nmorph-notification-provider .nmorph-notification-leave-active .nmorph-icon--large{--width: 32px;--height: 32px}.nmorph-notification-provider .nmorph-notification-leave-active .nmorph-icon__content{display:flex;justify-content:center;align-items:center;width:var(--width);min-width:var(--width);height:var(--height);min-height:var(--height);overflow:hidden}.nmorph-notification-provider .nmorph-notification-leave-active .nmorph-alert__close .nmorph-icon,.nmorph-notification-provider .nmorph-notification-leave-active .nmorph-alert__content,.nmorph-notification-provider .nmorph-notification-leave-active .nmorph-alert__content-title{--color: var(--nmorph-white-color)}.nmorph-notification-provider .nmorph-notification-leave-active .nmorph-alert--success .nmorph-alert__icon .nmorph-icon{--color: var(--nmorph-success-color)}.nmorph-notification-provider .nmorph-notification-leave-active .nmorph-alert--error .nmorph-alert__icon .nmorph-icon{--color: var(--nmorph-error-color)}.nmorph-notification-provider .nmorph-notification-leave-active .nmorph-alert--warning .nmorph-alert__icon .nmorph-icon{--color: var(--nmorph-warn-color)}.nmorph-notification-provider .nmorph-notification-leave-active .nmorph-alert--info .nmorph-alert__icon .nmorph-icon{--color: var(--nmorph-info-color)}.nmorph-notification-provider .nmorph-notification-leave-active svg{width:100%;height:100%;fill:var(--color);stroke-width:0}.nmorph-notification-provider .nmorph-notification-leave-active path{stroke:var(--color)}.nmorph-notification-provider .nmorph-notification-leave-to{opacity:0;pointer-events:none}.nmorph-notification-provider .nmorph-notification-provider__list--top-left .nmorph-notification-provider__notification--closing,.nmorph-notification-provider .nmorph-notification-provider__list--bottom-left .nmorph-notification-provider__notification--closing{position:absolute;transform:translate(-100%);opacity:0;pointer-events:none}.nmorph-notification-provider .nmorph-notification-provider__list--top-right .nmorph-notification-provider__notification--closing,.nmorph-notification-provider .nmorph-notification-provider__list--bottom-right .nmorph-notification-provider__notification--closing{position:absolute;transform:translate(100%);opacity:0;pointer-events:none}.nmorph-notification-provider .nmorph-notification-provider__list--top-center .nmorph-notification-provider__notification--closing{position:absolute;transform:translateY(-100%);opacity:0;pointer-events:none}.nmorph-notification-provider .nmorph-notification-provider__list--bottom-center .nmorph-notification-provider__notification--closing{position:absolute;transform:translateY(100%);opacity:0;pointer-events:none}@keyframes nmorph-notification-provider-duration{0%{transform:scaleX(1)}to{transform:scaleX(0)}}
@@ -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
  };