@nmorph/nmorph-ui-kit 3.0.15 → 3.0.17
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/basic/nmorph-layout/NmorphLayout.vue.js +32 -29
- package/dist/components/basic/nmorph-layout/NmorphLayout.vue2.js +13 -11
- package/dist/components/basic/nmorph-space/NmorphSpace.vue.js +18 -15
- package/dist/components/basic/nmorph-space/NmorphSpace.vue2.js +19 -17
- package/dist/components/basic/nmorph-text/NmorphText.vue.js +24 -15
- package/dist/components/basic/nmorph-text/NmorphText.vue2.js +24 -14
- package/dist/components/data/nmorph-card/NmorphCard.vue.js +36 -33
- package/dist/components/data/nmorph-card/NmorphCard.vue2.js +22 -20
- package/dist/components/data/nmorph-preview-portal/NmorphPreviewPortal.vue.js +23 -26
- package/dist/components/data/nmorph-preview-portal/NmorphPreviewPortal.vue2.js +21 -19
- package/dist/components/data/nmorph-video-preview/NmorphVideoPreview.vue.js +40 -43
- package/dist/components/data/nmorph-video-preview/NmorphVideoPreview.vue2.js +55 -54
- package/dist/components/feedback/nmorph-callout/NmorphCallout.vue.js +37 -34
- package/dist/components/feedback/nmorph-callout/NmorphCallout.vue2.js +22 -14
- package/dist/components/feedback/nmorph-dialog/NmorphDialog.vue.js +21 -23
- package/dist/components/feedback/nmorph-dialog/NmorphDialog.vue2.js +32 -30
- package/dist/components/feedback/nmorph-drawer/NmorphDrawer.vue.js +16 -18
- package/dist/components/feedback/nmorph-drawer/NmorphDrawer.vue2.js +32 -30
- package/dist/components/feedback/nmorph-guide/NmorphGuideStep.vue.js +37 -39
- package/dist/components/feedback/nmorph-guide/NmorphGuideStep.vue2.js +26 -21
- package/dist/components/navigation/nmorph-dropdown/NmorphDropdown.vue.js +13 -14
- package/dist/components/navigation/nmorph-dropdown/NmorphDropdown.vue2.js +34 -29
- package/dist/components/others/nmorph-overlay/NmorphOverlay.vue.js +24 -29
- package/dist/components/others/nmorph-overlay/NmorphOverlay.vue2.js +38 -36
- package/dist/components/providers/nmorph-notification-provider/NmorphNotificationProvider.vue.js +29 -32
- package/dist/components/providers/nmorph-notification-provider/NmorphNotificationProvider.vue2.js +47 -45
- package/dist/hooks/use-common-styles.js +16 -4
- package/dist/index.umd.js +39 -27
- package/dist/outside-hooks/use-nmorph-theme.js +1 -1
- package/dist/package.json.js +1 -1
- package/dist/src/components/basic/nmorph-button/NmorphButton.vue.d.ts +6 -6
- package/dist/src/components/basic/nmorph-icon/NmorphIcon.vue.d.ts +1 -1
- package/dist/src/components/basic/nmorph-layout/NmorphLayout.vue.d.ts +7 -1
- package/dist/src/components/basic/nmorph-link/NmorphLink.vue.d.ts +3 -3
- package/dist/src/components/basic/nmorph-scroll/NmorphScroll.vue.d.ts +3 -3
- package/dist/src/components/basic/nmorph-space/NmorphSpace.vue.d.ts +3 -3
- package/dist/src/components/basic/nmorph-text/NmorphText.vue.d.ts +7 -3
- package/dist/src/components/basic/nmorph-text/types.d.ts +4 -0
- package/dist/src/components/data/nmorph-audio-preview/NmorphAudioPreview.vue.d.ts +4 -4
- package/dist/src/components/data/nmorph-avatar/NmorphAvatar.vue.d.ts +1 -1
- package/dist/src/components/data/nmorph-badge/NmorphBadge.vue.d.ts +4 -4
- package/dist/src/components/data/nmorph-calendar/NmorphCalendar.vue.d.ts +1 -1
- package/dist/src/components/data/nmorph-card/NmorphCard.vue.d.ts +6 -2
- package/dist/src/components/data/nmorph-collapse/components/nmorph-collapse-item/NmorphCollapseItem.vue.d.ts +1 -1
- package/dist/src/components/data/nmorph-emoji-picker/NmorphEmojiPicker.vue.d.ts +2 -2
- package/dist/src/components/data/nmorph-empty/NmorphEmpty.vue.d.ts +1 -1
- package/dist/src/components/data/nmorph-file-card/NmorphFileCard.vue.d.ts +4 -4
- package/dist/src/components/data/nmorph-image/NmorphImage.vue.d.ts +1 -1
- package/dist/src/components/data/nmorph-pagination/NmorphPagination.vue.d.ts +1 -1
- package/dist/src/components/data/nmorph-preview-portal/NmorphPreviewPortal.vue.d.ts +2 -2
- package/dist/src/components/data/nmorph-tag-list/NmorphTagList.vue.d.ts +1 -1
- package/dist/src/components/data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue.d.ts +1 -1
- package/dist/src/components/data/nmorph-video-preview/NmorphVideoPreview.vue.d.ts +4 -4
- package/dist/src/components/feedback/nmorph-alert/NmorphAlert.vue.d.ts +1 -1
- package/dist/src/components/feedback/nmorph-callout/NmorphCallout.vue.d.ts +7 -3
- package/dist/src/components/feedback/nmorph-dialog/NmorphDialog.vue.d.ts +4 -1
- package/dist/src/components/feedback/nmorph-drawer/NmorphDrawer.vue.d.ts +6 -2
- package/dist/src/components/feedback/nmorph-guide/NmorphGuide.vue.d.ts +2 -2
- package/dist/src/components/feedback/nmorph-guide/NmorphGuideStep.vue.d.ts +2 -2
- package/dist/src/components/feedback/nmorph-tooltip/NmorphTooltip.vue.d.ts +2 -2
- package/dist/src/components/form/nmorph-autocomplete/NmorphAutocomplete.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-color-picker/NmorphColorPicker.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-date-picker/NmorphDatePicker.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-file-upload/NmorphFileUpload.vue.d.ts +3 -3
- package/dist/src/components/form/nmorph-number-input/NmorphNumberInput.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-otp-input/NmorphOTPInput.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-select/NmorphSelect.vue.d.ts +3 -3
- package/dist/src/components/form/nmorph-select-button/NmorphSelectButton.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-select-button/components/nmorph-select-button-item/NmorphSelectButtonItem.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-slider/NmorphSlider.vue.d.ts +9 -9
- package/dist/src/components/form/nmorph-switch/NmorphSwitch.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-text-input/NmorphTextInput.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-textarea/NmorphTextarea.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-time-picker/NmorphTimePicker.vue.d.ts +1 -1
- package/dist/src/components/navigation/nmorph-backtop/NmorphBacktop.vue.d.ts +1 -1
- package/dist/src/components/navigation/nmorph-context-menu/NmorphContextMenu.vue.d.ts +3 -3
- package/dist/src/components/navigation/nmorph-stepper/NmorphStepper.vue.d.ts +1 -1
- package/dist/src/components/navigation/nmorph-tabs/NmorphTabs.vue.d.ts +1 -1
- package/dist/src/components/navigation/nmorph-tabs/components/nmorph-tab-pane/NmorphTabPane.vue.d.ts +1 -1
- package/dist/src/components/others/nmorph-overlay/NmorphOverlay.vue.d.ts +1 -1
- package/dist/src/components/providers/nmorph-notification-provider/NmorphNotificationProvider.vue.d.ts +1 -1
- package/dist/src/outside-hooks/use-nmorph-notification.d.ts +2 -2
- package/dist/src/types/common.types.d.ts +1 -0
- package/dist/src/utils/attrs.d.ts +5 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/types/common.types.js +1 -0
- package/dist/utils/attrs.js +15 -0
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import './NmorphDropdown.css';
|
|
2
2
|
import n from "./NmorphDropdown.vue2.js";
|
|
3
|
-
import { openBlock as r, createBlock as
|
|
3
|
+
import { openBlock as r, createBlock as p, withCtx as a, createElementBlock as s, mergeProps as c, renderSlot as t, createCommentVNode as l } from "vue";
|
|
4
4
|
/* empty css */
|
|
5
5
|
import d from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
6
|
-
const
|
|
7
|
-
function
|
|
8
|
-
return r(),
|
|
6
|
+
const i = ["role", "aria-label"];
|
|
7
|
+
function m(e, f, h, o, _, w) {
|
|
8
|
+
return r(), p(o.NmorphOverlay, {
|
|
9
9
|
show: o.props.open,
|
|
10
10
|
transparent: "",
|
|
11
11
|
"z-index": o.props.zIndex,
|
|
@@ -15,23 +15,22 @@ function f(e, h, _, o, w, k) {
|
|
|
15
15
|
onOnOutsideClick: o.outsideClickHandler,
|
|
16
16
|
onOnEscapeKeydown: o.escapeHandler
|
|
17
17
|
}, {
|
|
18
|
-
default:
|
|
19
|
-
o.props.open ? (r(),
|
|
18
|
+
default: a(() => [
|
|
19
|
+
o.props.open ? (r(), s("div", c({
|
|
20
20
|
key: 0,
|
|
21
|
-
ref: "dropdownDOMRef"
|
|
22
|
-
|
|
23
|
-
style: l(o.dropdownStyle),
|
|
21
|
+
ref: "dropdownDOMRef"
|
|
22
|
+
}, o.rootAttrs, {
|
|
24
23
|
role: o.props.role || void 0,
|
|
25
24
|
"aria-label": o.props.ariaLabel || void 0
|
|
26
|
-
}, [
|
|
27
|
-
|
|
28
|
-
],
|
|
25
|
+
}), [
|
|
26
|
+
t(e.$slots, "default")
|
|
27
|
+
], 16, i)) : l("v-if", !0)
|
|
29
28
|
]),
|
|
30
29
|
_: 3
|
|
31
30
|
/* FORWARDED */
|
|
32
31
|
}, 8, ["show", "z-index", "close-on-escape", "trap-focus", "restore-focus"]);
|
|
33
32
|
}
|
|
34
|
-
const
|
|
33
|
+
const u = /* @__PURE__ */ d(n, [["render", m], ["__file", "/home/runner/work/nmorph/nmorph/library/src/components/navigation/nmorph-dropdown/NmorphDropdown.vue"]]);
|
|
35
34
|
export {
|
|
36
|
-
|
|
35
|
+
u as default
|
|
37
36
|
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import './NmorphDropdown.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import { toCssSize as
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
|
|
2
|
+
import { defineComponent as v, ref as w, toRef as t, computed as r, watch as q } from "vue";
|
|
3
|
+
import { useModifiers as b } from "../../../utils/create-modifiers.js";
|
|
4
|
+
import { toCssSize as x, createCssSizeVariables as S } from "../../../utils/common.js";
|
|
5
|
+
import { useMergedAttrs as O } from "../../../utils/attrs.js";
|
|
6
|
+
import { usePlacement as g } from "../../../hooks/use-placement.js";
|
|
7
|
+
import _ from "../../others/nmorph-overlay/NmorphOverlay.vue.js";
|
|
8
|
+
const P = /* @__PURE__ */ v({
|
|
9
|
+
inheritAttrs: !1,
|
|
8
10
|
__name: "NmorphDropdown",
|
|
9
11
|
props: {
|
|
10
12
|
open: { type: Boolean, required: !0 },
|
|
@@ -27,48 +29,51 @@ const B = /* @__PURE__ */ y({
|
|
|
27
29
|
design: { type: null, required: !1, default: "nmorph" }
|
|
28
30
|
},
|
|
29
31
|
emits: ["on-outside-click", "on-escape-keydown"],
|
|
30
|
-
setup(
|
|
31
|
-
|
|
32
|
-
const e =
|
|
32
|
+
setup(f, { expose: m, emit: c }) {
|
|
33
|
+
m();
|
|
34
|
+
const e = f, o = c, l = w(null), { placementCoords: i, placementReady: a, adjustPlacement: d } = g({
|
|
33
35
|
initialPlacement: t(e, "placement"),
|
|
34
36
|
contentDOMElement: l,
|
|
35
37
|
relativeElement: t(e, "relativeElement"),
|
|
36
38
|
yOffset: t(e, "yOffset"),
|
|
37
39
|
xOffset: t(e, "xOffset"),
|
|
38
40
|
enabled: t(e, "open")
|
|
39
|
-
}),
|
|
40
|
-
() =>
|
|
41
|
+
}), n = r(
|
|
42
|
+
() => b({
|
|
41
43
|
"nmorph-dropdown": [!e.open && "closed", e.hideShadow && "hide-shadow", e.design]
|
|
42
44
|
})
|
|
43
|
-
),
|
|
44
|
-
() => e.fillWidth && e.relativeElement ? `${e.relativeElement.clientWidth}px` :
|
|
45
|
-
),
|
|
46
|
-
"--nmorph-private-dropdown-width":
|
|
47
|
-
...
|
|
45
|
+
), s = r(
|
|
46
|
+
() => e.fillWidth && e.relativeElement ? `${e.relativeElement.clientWidth}px` : x(e.width)
|
|
47
|
+
), u = r(() => ({
|
|
48
|
+
"--nmorph-private-dropdown-width": s.value,
|
|
49
|
+
...S({
|
|
48
50
|
"--nmorph-private-dropdown-min-width": e.minWidth === void 0 ? "auto" : e.minWidth,
|
|
49
51
|
"--nmorph-private-dropdown-max-width": e.maxWidth === void 0 ? "none" : e.maxWidth
|
|
50
52
|
}),
|
|
51
|
-
left:
|
|
52
|
-
top:
|
|
53
|
-
visibility: e.open &&
|
|
54
|
-
}))
|
|
55
|
-
|
|
53
|
+
left: i.value.x,
|
|
54
|
+
top: i.value.y,
|
|
55
|
+
visibility: e.open && a.value ? "visible" : "hidden"
|
|
56
|
+
})), h = O(
|
|
57
|
+
r(() => [n.value, e.contentClass]),
|
|
58
|
+
u
|
|
59
|
+
);
|
|
60
|
+
q(
|
|
56
61
|
() => e.open,
|
|
57
|
-
(
|
|
58
|
-
|
|
62
|
+
(y) => {
|
|
63
|
+
y && d();
|
|
59
64
|
},
|
|
60
65
|
{ flush: "post" }
|
|
61
66
|
);
|
|
62
|
-
const
|
|
63
|
-
|
|
67
|
+
const p = { props: e, emit: o, dropdownDOMRef: l, placementCoords: i, placementReady: a, adjustPlacement: d, modifiers: n, width: s, dropdownStyle: u, rootAttrs: h, outsideClickHandler: () => {
|
|
68
|
+
o("on-outside-click");
|
|
64
69
|
}, escapeHandler: () => {
|
|
65
|
-
|
|
70
|
+
o("on-escape-keydown");
|
|
66
71
|
}, get NmorphOverlay() {
|
|
67
|
-
return
|
|
72
|
+
return _;
|
|
68
73
|
} };
|
|
69
|
-
return Object.defineProperty(
|
|
74
|
+
return Object.defineProperty(p, "__isScriptSetup", { enumerable: !1, value: !0 }), p;
|
|
70
75
|
}
|
|
71
76
|
});
|
|
72
77
|
export {
|
|
73
|
-
|
|
78
|
+
P as default
|
|
74
79
|
};
|
|
@@ -1,59 +1,54 @@
|
|
|
1
1
|
import './NmorphOverlay.css';
|
|
2
|
-
import
|
|
3
|
-
import { openBlock as l, createElementBlock as
|
|
2
|
+
import p from "./NmorphOverlay.vue2.js";
|
|
3
|
+
import { openBlock as l, createElementBlock as d, mergeProps as i, withModifiers as e, createElementVNode as t, renderSlot as s, createBlock as a, Teleport as c } from "vue";
|
|
4
4
|
/* empty css */
|
|
5
|
-
import
|
|
6
|
-
const
|
|
7
|
-
function
|
|
8
|
-
return o.renderInline ? (l(),
|
|
5
|
+
import m from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
6
|
+
const f = ["tabindex"], k = ["tabindex"];
|
|
7
|
+
function v(n, r, _, o, h, y) {
|
|
8
|
+
return o.renderInline ? (l(), d(
|
|
9
9
|
"div",
|
|
10
|
-
{
|
|
11
|
-
key: 0,
|
|
12
|
-
class: s(o.modifiers),
|
|
13
|
-
style: i({ "--nmorph-private-overlay-z-index": o.zIndex }),
|
|
10
|
+
i({ key: 0 }, o.rootAttrs, {
|
|
14
11
|
onClick: e(o.clickHandler, ["stop"])
|
|
15
|
-
},
|
|
12
|
+
}),
|
|
16
13
|
[
|
|
17
|
-
|
|
14
|
+
t("div", {
|
|
18
15
|
ref: "contentRef",
|
|
19
16
|
class: "nmorph-overlay__slot",
|
|
20
17
|
tabindex: o.props.trapFocus ? -1 : void 0,
|
|
21
18
|
onClick: r[0] || (r[0] = e(() => {
|
|
22
19
|
}, ["stop"]))
|
|
23
20
|
}, [
|
|
24
|
-
|
|
25
|
-
], 8,
|
|
21
|
+
s(n.$slots, "default")
|
|
22
|
+
], 8, f)
|
|
26
23
|
],
|
|
27
|
-
|
|
28
|
-
/*
|
|
29
|
-
)) : (l(),
|
|
24
|
+
16
|
|
25
|
+
/* FULL_PROPS */
|
|
26
|
+
)) : (l(), a(c, {
|
|
30
27
|
key: 1,
|
|
31
28
|
to: o.props.teleportTo
|
|
32
29
|
}, [
|
|
33
|
-
|
|
30
|
+
t(
|
|
34
31
|
"div",
|
|
35
|
-
{
|
|
36
|
-
class: s(o.modifiers),
|
|
37
|
-
style: i({ "--nmorph-private-overlay-z-index": o.zIndex }),
|
|
32
|
+
i(o.rootAttrs, {
|
|
38
33
|
onClick: e(o.clickHandler, ["stop"])
|
|
39
|
-
},
|
|
34
|
+
}),
|
|
40
35
|
[
|
|
41
|
-
|
|
36
|
+
t("div", {
|
|
42
37
|
ref: "contentRef",
|
|
43
38
|
class: "nmorph-overlay__slot",
|
|
44
39
|
tabindex: o.props.trapFocus ? -1 : void 0,
|
|
45
40
|
onClick: r[1] || (r[1] = e(() => {
|
|
46
41
|
}, ["stop"]))
|
|
47
42
|
}, [
|
|
48
|
-
|
|
49
|
-
], 8,
|
|
43
|
+
s(n.$slots, "default")
|
|
44
|
+
], 8, k)
|
|
50
45
|
],
|
|
51
|
-
|
|
52
|
-
/*
|
|
46
|
+
16
|
|
47
|
+
/* FULL_PROPS */
|
|
53
48
|
)
|
|
54
49
|
], 8, ["to"]));
|
|
55
50
|
}
|
|
56
|
-
const
|
|
51
|
+
const N = /* @__PURE__ */ m(p, [["render", v], ["__file", "/home/runner/work/nmorph/nmorph/library/src/components/others/nmorph-overlay/NmorphOverlay.vue"]]);
|
|
57
52
|
export {
|
|
58
|
-
|
|
53
|
+
N as default
|
|
59
54
|
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import './NmorphOverlay.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import {
|
|
5
|
-
|
|
2
|
+
import { defineComponent as A, computed as s, ref as g, watch as B, onBeforeUnmount as F, nextTick as I } from "vue";
|
|
3
|
+
import { useModifiers as S } from "../../../utils/create-modifiers.js";
|
|
4
|
+
import { useMergedAttrs as T } from "../../../utils/attrs.js";
|
|
5
|
+
import { useZIndex as z } from "../../../hooks/use-z-index.js";
|
|
6
|
+
const j = /* @__PURE__ */ A({
|
|
7
|
+
inheritAttrs: !1,
|
|
6
8
|
__name: "NmorphOverlay",
|
|
7
9
|
props: {
|
|
8
10
|
show: { type: Boolean, required: !0 },
|
|
@@ -15,65 +17,65 @@ const L = /* @__PURE__ */ _({
|
|
|
15
17
|
restoreFocus: { type: Boolean, required: !1, default: !0 }
|
|
16
18
|
},
|
|
17
19
|
emits: ["on-outside-click", "on-escape-keydown"],
|
|
18
|
-
setup(
|
|
19
|
-
|
|
20
|
-
const t =
|
|
21
|
-
|
|
20
|
+
setup(E, { expose: w, emit: k }) {
|
|
21
|
+
w();
|
|
22
|
+
const t = E, d = z(
|
|
23
|
+
s(() => t.show),
|
|
22
24
|
() => t.zIndex
|
|
23
|
-
),
|
|
24
|
-
() =>
|
|
25
|
+
), c = s(
|
|
26
|
+
() => S({
|
|
25
27
|
"nmorph-overlay": [t.show && "show", t.transparent && "transparent"]
|
|
26
28
|
})
|
|
27
|
-
),
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
let
|
|
31
|
-
const
|
|
29
|
+
), x = s(() => t.disabledTeleport || !t.show || typeof document > "u"), f = s(() => ({ "--nmorph-private-overlay-z-index": d.value })), _ = T(c, f), q = () => {
|
|
30
|
+
l("on-outside-click");
|
|
31
|
+
}, l = k, o = g(null);
|
|
32
|
+
let n = null;
|
|
33
|
+
const p = [
|
|
32
34
|
"a[href]",
|
|
33
35
|
"button:not([disabled])",
|
|
34
36
|
"textarea:not([disabled])",
|
|
35
37
|
"input:not([disabled])",
|
|
36
38
|
"select:not([disabled])",
|
|
37
39
|
'[tabindex]:not([tabindex="-1"])'
|
|
38
|
-
].join(","), u = () =>
|
|
40
|
+
].join(","), u = () => o.value ? Array.from(o.value.querySelectorAll(p)).filter(
|
|
39
41
|
(e) => e.getAttribute("aria-hidden") !== "true"
|
|
40
|
-
) : [],
|
|
42
|
+
) : [], m = async () => {
|
|
41
43
|
if (!t.trapFocus) return;
|
|
42
|
-
await
|
|
43
|
-
},
|
|
44
|
+
await I(), (u()[0] || o.value)?.focus();
|
|
45
|
+
}, a = (e) => {
|
|
44
46
|
if (!t.show) return;
|
|
45
47
|
if (e.key === "Escape" && t.closeOnEscape) {
|
|
46
|
-
e.preventDefault(),
|
|
48
|
+
e.preventDefault(), l("on-escape-keydown");
|
|
47
49
|
return;
|
|
48
50
|
}
|
|
49
51
|
if (e.key !== "Tab" || !t.trapFocus) return;
|
|
50
52
|
const r = u();
|
|
51
53
|
if (!r.length) {
|
|
52
|
-
e.preventDefault(),
|
|
54
|
+
e.preventDefault(), o.value?.focus();
|
|
53
55
|
return;
|
|
54
56
|
}
|
|
55
|
-
const
|
|
56
|
-
e.shiftKey && document.activeElement ===
|
|
57
|
-
},
|
|
58
|
-
typeof document > "u" || document.addEventListener("keydown",
|
|
59
|
-
},
|
|
60
|
-
typeof document > "u" || document.removeEventListener("keydown",
|
|
57
|
+
const b = r[0], h = r[r.length - 1];
|
|
58
|
+
e.shiftKey && document.activeElement === b ? (e.preventDefault(), h.focus()) : !e.shiftKey && document.activeElement === h && (e.preventDefault(), b.focus());
|
|
59
|
+
}, y = () => {
|
|
60
|
+
typeof document > "u" || document.addEventListener("keydown", a);
|
|
61
|
+
}, i = () => {
|
|
62
|
+
typeof document > "u" || document.removeEventListener("keydown", a);
|
|
61
63
|
};
|
|
62
|
-
|
|
64
|
+
B(
|
|
63
65
|
() => t.show,
|
|
64
66
|
(e) => {
|
|
65
|
-
typeof document > "u" || (e ? (
|
|
67
|
+
typeof document > "u" || (e ? (n = document.activeElement, y(), m()) : (i(), t.restoreFocus && n?.focus?.(), n = null));
|
|
66
68
|
},
|
|
67
69
|
{ immediate: !0, flush: "post" }
|
|
68
|
-
),
|
|
69
|
-
const
|
|
70
|
-
return
|
|
70
|
+
), F(i);
|
|
71
|
+
const v = { props: t, zIndex: d, modifiers: c, renderInline: x, overlayStyle: f, rootAttrs: _, clickHandler: q, emit: l, contentRef: o, get previousActiveElement() {
|
|
72
|
+
return n;
|
|
71
73
|
}, set previousActiveElement(e) {
|
|
72
|
-
|
|
73
|
-
}, focusableSelector:
|
|
74
|
-
return Object.defineProperty(
|
|
74
|
+
n = e;
|
|
75
|
+
}, focusableSelector: p, getFocusableElements: u, focusContent: m, keydownHandler: a, addKeydownListener: y, removeKeydownListener: i };
|
|
76
|
+
return Object.defineProperty(v, "__isScriptSetup", { enumerable: !1, value: !0 }), v;
|
|
75
77
|
}
|
|
76
78
|
});
|
|
77
79
|
export {
|
|
78
|
-
|
|
80
|
+
j as default
|
|
79
81
|
};
|
package/dist/components/providers/nmorph-notification-provider/NmorphNotificationProvider.vue.js
CHANGED
|
@@ -1,54 +1,51 @@
|
|
|
1
1
|
import './NmorphNotificationProvider.css';
|
|
2
2
|
import h from "./NmorphNotificationProvider.vue2.js";
|
|
3
|
-
import { openBlock as e, createBlock as
|
|
3
|
+
import { openBlock as e, createBlock as a, Teleport as _, createElementVNode as n, normalizeProps as v, guardReactiveProps as u, createElementBlock as t, Fragment as d, renderList as s, TransitionGroup as b, normalizeClass as c, withCtx as f, normalizeStyle as p, createVNode as y, toDisplayString as k, createCommentVNode as m } from "vue";
|
|
4
4
|
/* empty css */
|
|
5
|
-
import
|
|
6
|
-
const
|
|
5
|
+
import N from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
6
|
+
const g = ["title"], D = {
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "nmorph-notification-provider__duration-value"
|
|
9
9
|
};
|
|
10
|
-
function
|
|
11
|
-
return e(),
|
|
10
|
+
function w(C, l, I, r, P, V) {
|
|
11
|
+
return e(), a(_, {
|
|
12
12
|
to: r.props.teleportTo,
|
|
13
13
|
disabled: r.teleportDisabled
|
|
14
14
|
}, [
|
|
15
15
|
n(
|
|
16
16
|
"div",
|
|
17
|
-
|
|
18
|
-
class: "nmorph-notification-provider",
|
|
19
|
-
style: l({ zIndex: r.zIndex })
|
|
20
|
-
},
|
|
17
|
+
v(u(r.rootAttrs)),
|
|
21
18
|
[
|
|
22
|
-
(e(!0),
|
|
23
|
-
|
|
19
|
+
(e(!0), t(
|
|
20
|
+
d,
|
|
24
21
|
null,
|
|
25
|
-
|
|
26
|
-
key:
|
|
22
|
+
s(r.notificationGroups, (i) => (e(), a(b, {
|
|
23
|
+
key: i.placement,
|
|
27
24
|
appear: "",
|
|
28
25
|
name: "nmorph-notification",
|
|
29
26
|
tag: "div",
|
|
30
|
-
class:
|
|
27
|
+
class: c(`nmorph-notification-provider__list nmorph-notification-provider__list--${i.placement}`)
|
|
31
28
|
}, {
|
|
32
|
-
default:
|
|
33
|
-
(e(!0),
|
|
34
|
-
|
|
29
|
+
default: f(() => [
|
|
30
|
+
(e(!0), t(
|
|
31
|
+
d,
|
|
35
32
|
null,
|
|
36
|
-
|
|
33
|
+
s(i.notifications, (o) => (e(), t(
|
|
37
34
|
"div",
|
|
38
35
|
{
|
|
39
36
|
key: o.id,
|
|
40
|
-
style:
|
|
41
|
-
class:
|
|
37
|
+
style: p(r.getNotificationStyle(o)),
|
|
38
|
+
class: c([
|
|
42
39
|
"nmorph-notification-provider__notification",
|
|
43
40
|
r.hasDurationIndicator(o) && "nmorph-notification-provider__notification--with-duration",
|
|
44
41
|
r.closingIds.includes(o.id) && "nmorph-notification-provider__notification--closing"
|
|
45
42
|
])
|
|
46
43
|
},
|
|
47
44
|
[
|
|
48
|
-
|
|
45
|
+
y(r.NmorphAlert, {
|
|
49
46
|
id: o.id,
|
|
50
47
|
class: "nmorph-notification-provider__alert",
|
|
51
|
-
style:
|
|
48
|
+
style: p({ width: o.width }),
|
|
52
49
|
type: o.type,
|
|
53
50
|
closable: o.closable,
|
|
54
51
|
title: o.title,
|
|
@@ -61,13 +58,13 @@ function g(D, a, w, r, I, x) {
|
|
|
61
58
|
"background-color": o.backgroundColor,
|
|
62
59
|
onClose: () => r.closeHandler(o.id)
|
|
63
60
|
}, null, 8, ["id", "style", "type", "closable", "title", "content", "fill", "show-icon", "bordered", "html", "close-icon-position", "background-color", "onClose"]),
|
|
64
|
-
r.hasDurationIndicator(o) ? (e(),
|
|
61
|
+
r.hasDurationIndicator(o) ? (e(), t("div", {
|
|
65
62
|
key: `${o.id}-${r.getNotificationDuration(o)}`,
|
|
66
63
|
class: "nmorph-notification-provider__duration",
|
|
67
64
|
title: r.hasDurationValue(o) ? r.getNotificationDurationLabel(o) : void 0,
|
|
68
65
|
"aria-hidden": "true"
|
|
69
66
|
}, [
|
|
70
|
-
|
|
67
|
+
l[0] || (l[0] = n(
|
|
71
68
|
"span",
|
|
72
69
|
{ class: "nmorph-notification-provider__duration-track" },
|
|
73
70
|
[
|
|
@@ -76,14 +73,14 @@ function g(D, a, w, r, I, x) {
|
|
|
76
73
|
-1
|
|
77
74
|
/* CACHED */
|
|
78
75
|
)),
|
|
79
|
-
r.hasDurationValue(o) ? (e(),
|
|
76
|
+
r.hasDurationValue(o) ? (e(), t(
|
|
80
77
|
"span",
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
D,
|
|
79
|
+
k(r.getNotificationDurationLabel(o)),
|
|
83
80
|
1
|
|
84
81
|
/* TEXT */
|
|
85
82
|
)) : m("v-if", !0)
|
|
86
|
-
], 8,
|
|
83
|
+
], 8, g)) : m("v-if", !0)
|
|
87
84
|
],
|
|
88
85
|
6
|
|
89
86
|
/* CLASS, STYLE */
|
|
@@ -99,12 +96,12 @@ function g(D, a, w, r, I, x) {
|
|
|
99
96
|
/* KEYED_FRAGMENT */
|
|
100
97
|
))
|
|
101
98
|
],
|
|
102
|
-
|
|
103
|
-
/*
|
|
99
|
+
16
|
|
100
|
+
/* FULL_PROPS */
|
|
104
101
|
)
|
|
105
102
|
], 8, ["to", "disabled"]);
|
|
106
103
|
}
|
|
107
|
-
const
|
|
104
|
+
const S = /* @__PURE__ */ N(h, [["render", w], ["__file", "/home/runner/work/nmorph/nmorph/library/src/components/providers/nmorph-notification-provider/NmorphNotificationProvider.vue"]]);
|
|
108
105
|
export {
|
|
109
|
-
|
|
106
|
+
S as default
|
|
110
107
|
};
|
package/dist/components/providers/nmorph-notification-provider/NmorphNotificationProvider.vue2.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import './NmorphNotificationProvider.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
2
|
+
import { defineComponent as J, ref as s, inject as Q, computed as l, watch as y, onMounted as W, onBeforeUnmount as X } from "vue";
|
|
3
|
+
import { useMergedAttrs as Y } from "../../../utils/attrs.js";
|
|
4
|
+
import { NmorphNotificationPlacement as ee } from "./types.js";
|
|
5
|
+
import te from "../../feedback/nmorph-alert/NmorphAlert.vue.js";
|
|
6
|
+
const P = 500, U = 250, ie = /* @__PURE__ */ J({
|
|
7
|
+
inheritAttrs: !1,
|
|
6
8
|
__name: "NmorphNotificationProvider",
|
|
7
9
|
props: {
|
|
8
10
|
notifications: { type: Array, required: !0 },
|
|
@@ -12,31 +14,31 @@ const j = 500, L = 250, re = /* @__PURE__ */ H({
|
|
|
12
14
|
teleportTo: { type: null, required: !1, default: "body" },
|
|
13
15
|
disabledTeleport: { type: Boolean, required: !1, default: !1 }
|
|
14
16
|
},
|
|
15
|
-
setup(
|
|
16
|
-
|
|
17
|
-
const
|
|
17
|
+
setup(V, { expose: Z }) {
|
|
18
|
+
Z();
|
|
19
|
+
const T = (e) => typeof e.id == "string" && e.id.length > 0, c = s([]), o = s([]), n = s([]), d = s(Date.now()), f = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map();
|
|
18
20
|
let i;
|
|
19
|
-
const w = Object.values(
|
|
21
|
+
const w = Object.values(ee), p = (e) => typeof e.duration != "number" || !Number.isFinite(e.duration) ? 0 : Math.max(e.duration, 0), R = (e) => p(e) > 0, $ = (e) => e.showDurationValue !== !1, q = (e) => {
|
|
20
22
|
const t = p(e), r = v.get(e.id);
|
|
21
|
-
return !t || !r ? t : Math.max(t - (
|
|
22
|
-
}, z = (e) => e < 1e3 ? `${Math.ceil(e)}ms` : `${Math.ceil(e / 1e3)}s`,
|
|
23
|
+
return !t || !r ? t : Math.max(t - (d.value - r), 0);
|
|
24
|
+
}, z = (e) => e < 1e3 ? `${Math.ceil(e)}ms` : `${Math.ceil(e / 1e3)}s`, C = (e) => z(q(e)), F = (e) => ({
|
|
23
25
|
"--nmorph-private-notification-provider-duration": `${p(e)}ms`
|
|
24
26
|
}), h = (e, t = !1) => {
|
|
25
|
-
const r =
|
|
26
|
-
r && clearTimeout(r),
|
|
27
|
+
const r = f.get(e);
|
|
28
|
+
r && clearTimeout(r), f.delete(e), m.delete(e), t || v.delete(e);
|
|
27
29
|
}, k = (e) => {
|
|
28
30
|
n.value = n.value.filter((t) => t.id !== e), o.value = o.value.filter((t) => t !== e), h(e);
|
|
29
|
-
},
|
|
30
|
-
o.value.includes(e) || (h(e, !0), t && !
|
|
31
|
+
}, g = (e, t = !0) => {
|
|
32
|
+
o.value.includes(e) || (h(e, !0), t && !c.value.includes(e) && (c.value = [...c.value, e]), o.value = [...o.value, e], setTimeout(() => k(e), P));
|
|
31
33
|
}, E = (e) => {
|
|
32
34
|
const t = p(e);
|
|
33
|
-
m.get(e.id) !== t && (h(e.id), t && (
|
|
35
|
+
m.get(e.id) !== t && (h(e.id), t && (d.value = Date.now(), v.set(e.id, d.value), f.set(
|
|
34
36
|
e.id,
|
|
35
|
-
setTimeout(() =>
|
|
37
|
+
setTimeout(() => g(e.id), t)
|
|
36
38
|
), m.set(e.id, t)));
|
|
37
|
-
}, a =
|
|
39
|
+
}, a = V, D = s(!1), x = Q("nmorph"), I = s(x?.zIndex.current.value ?? 1e3), N = s(!1), A = () => {
|
|
38
40
|
a.zIndex !== void 0 || N.value || (I.value = x?.zIndex.next() ?? I.value + 1, N.value = !0);
|
|
39
|
-
},
|
|
41
|
+
}, G = l(
|
|
40
42
|
() => w.map((e) => {
|
|
41
43
|
const t = n.value.filter(
|
|
42
44
|
(u) => (u.placement ?? a.placement) === e
|
|
@@ -46,49 +48,49 @@ const j = 500, L = 250, re = /* @__PURE__ */ H({
|
|
|
46
48
|
notifications: t.slice(r)
|
|
47
49
|
};
|
|
48
50
|
})
|
|
49
|
-
), O =
|
|
51
|
+
), O = l(
|
|
50
52
|
() => n.value.some(
|
|
51
53
|
(e) => R(e) && !o.value.includes(e.id)
|
|
52
54
|
)
|
|
53
|
-
),
|
|
54
|
-
() =>
|
|
55
|
-
(e) =>
|
|
55
|
+
), _ = l(() => n.value.length > 0), S = l(
|
|
56
|
+
() => _.value || a.notifications.some(
|
|
57
|
+
(e) => T(e) && !c.value.includes(e.id)
|
|
56
58
|
)
|
|
57
|
-
),
|
|
59
|
+
), B = l(() => a.zIndex ?? I.value), H = l(() => !D.value || a.disabledTeleport), j = l(() => ({ zIndex: B.value })), K = Y("nmorph-notification-provider", j), b = () => {
|
|
58
60
|
i && (clearInterval(i), i = void 0);
|
|
59
61
|
};
|
|
60
|
-
|
|
62
|
+
y(
|
|
61
63
|
() => a.notifications,
|
|
62
64
|
() => {
|
|
63
|
-
|
|
65
|
+
S.value && A();
|
|
64
66
|
},
|
|
65
67
|
{ deep: !0, immediate: !0, flush: "sync" }
|
|
66
|
-
),
|
|
67
|
-
|
|
68
|
+
), y(
|
|
69
|
+
_,
|
|
68
70
|
(e) => {
|
|
69
71
|
if (e) {
|
|
70
|
-
|
|
72
|
+
A();
|
|
71
73
|
return;
|
|
72
74
|
}
|
|
73
75
|
N.value = !1;
|
|
74
76
|
},
|
|
75
77
|
{ immediate: !0, flush: "sync" }
|
|
76
|
-
),
|
|
78
|
+
), y(
|
|
77
79
|
O,
|
|
78
80
|
(e) => {
|
|
79
81
|
if (!e) {
|
|
80
|
-
|
|
82
|
+
b();
|
|
81
83
|
return;
|
|
82
84
|
}
|
|
83
|
-
i || (
|
|
84
|
-
|
|
85
|
-
},
|
|
85
|
+
i || (d.value = Date.now(), i = setInterval(() => {
|
|
86
|
+
d.value = Date.now();
|
|
87
|
+
}, U));
|
|
86
88
|
},
|
|
87
89
|
{ immediate: !0 }
|
|
88
|
-
),
|
|
90
|
+
), y(
|
|
89
91
|
() => a.notifications,
|
|
90
92
|
(e) => {
|
|
91
|
-
const t = e.filter(
|
|
93
|
+
const t = e.filter(T).filter((r) => !c.value.includes(r.id));
|
|
92
94
|
n.value = n.value.map((r) => {
|
|
93
95
|
const u = t.find((M) => M.id === r.id);
|
|
94
96
|
return u ? { ...r, ...u } : r;
|
|
@@ -98,24 +100,24 @@ const j = 500, L = 250, re = /* @__PURE__ */ H({
|
|
|
98
100
|
) || (n.value = [...n.value, r]);
|
|
99
101
|
}), t.forEach((r) => E(r)), n.value.filter(
|
|
100
102
|
(r) => !t.some((u) => u.id === r.id)
|
|
101
|
-
).forEach((r) =>
|
|
103
|
+
).forEach((r) => g(r.id, !1));
|
|
102
104
|
},
|
|
103
105
|
{ deep: !0, immediate: !0 }
|
|
104
|
-
),
|
|
105
|
-
|
|
106
|
-
}),
|
|
107
|
-
|
|
106
|
+
), W(() => {
|
|
107
|
+
D.value = !0;
|
|
108
|
+
}), X(() => {
|
|
109
|
+
f.forEach((e) => clearTimeout(e)), f.clear(), m.clear(), v.clear(), b();
|
|
108
110
|
});
|
|
109
|
-
const
|
|
111
|
+
const L = { ANIMATION_DURATION: P, DURATION_TICK_INTERVAL: U, hasNotificationId: T, removedIds: c, closingIds: o, renderedNotifications: n, durationTick: d, durationTimers: f, durationById: m, durationStartedAtById: v, get durationTicker() {
|
|
110
112
|
return i;
|
|
111
113
|
}, set durationTicker(e) {
|
|
112
114
|
i = e;
|
|
113
|
-
}, placementList: w, getNotificationDuration: p, hasDurationIndicator: R, hasDurationValue:
|
|
114
|
-
return
|
|
115
|
+
}, placementList: w, getNotificationDuration: p, hasDurationIndicator: R, hasDurationValue: $, getNotificationRemainingDuration: q, formatNotificationDuration: z, getNotificationDurationLabel: C, getNotificationStyle: F, clearDurationTimer: h, removeRenderedNotification: k, closeHandler: g, scheduleDurationTimer: E, props: a, isMounted: D, nmorph: x, dynamicZIndex: I, activeZIndexAllocated: N, allocateZIndex: A, notificationGroups: G, hasRunningDurationIndicator: O, hasRenderedNotifications: _, hasActiveNotifications: S, zIndex: B, teleportDisabled: H, rootStyle: j, rootAttrs: K, stopDurationTicker: b, get NmorphAlert() {
|
|
116
|
+
return te;
|
|
115
117
|
} };
|
|
116
|
-
return Object.defineProperty(
|
|
118
|
+
return Object.defineProperty(L, "__isScriptSetup", { enumerable: !1, value: !0 }), L;
|
|
117
119
|
}
|
|
118
120
|
});
|
|
119
121
|
export {
|
|
120
|
-
|
|
122
|
+
ie as default
|
|
121
123
|
};
|