@nmorph/nmorph-ui-kit 2.2.10 → 2.2.13
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/README.md +11 -7
- package/dist/components/basic/nmorph-icon/NmorphIcon.css +1 -1
- package/dist/components/basic/nmorph-icon/NmorphIcon.vue2.js +11 -11
- package/dist/components/data/nmorph-avatar/NmorphAvatar.css +1 -0
- package/dist/components/data/nmorph-avatar/NmorphAvatar.vue.js +74 -46
- package/dist/components/data/nmorph-avatar/NmorphAvatar.vue2.js +26 -21
- package/dist/components/data/nmorph-carousel/NmorphCarousel.vue2.js +4 -4
- package/dist/components/data/nmorph-image-preview/NmorphImagePreview.vue.js +77 -38
- package/dist/components/data/nmorph-image-preview/NmorphImagePreview.vue2.js +31 -30
- package/dist/components/data/nmorph-pagination/NmorphPagination.css +1 -1
- package/dist/components/data/nmorph-pagination/NmorphPagination.vue.js +36 -30
- package/dist/components/data/nmorph-pagination/NmorphPagination.vue2.js +48 -41
- package/dist/components/data/nmorph-table/NmorphTable.css +1 -1
- package/dist/components/data/nmorph-table/NmorphTable.vue.js +228 -103
- package/dist/components/data/nmorph-table/NmorphTable.vue2.js +49 -30
- package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.css +1 -1
- package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.vue.js +91 -35
- package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.vue2.js +48 -35
- package/dist/components/form/nmorph-checkbox/NmorphCheckbox.css +1 -1
- package/dist/components/form/nmorph-checkbox/NmorphCheckbox.vue.js +15 -13
- package/dist/components/form/nmorph-checkbox/NmorphCheckbox.vue2.js +8 -8
- package/dist/components/form/nmorph-checkbox-group/NmorphCheckboxGroup.vue2.js +22 -14
- package/dist/components/form/nmorph-color-picker/NmorphColorPicker.vue2.js +11 -10
- package/dist/components/form/nmorph-radio/NmorphRadio.css +1 -1
- package/dist/components/form/nmorph-radio/NmorphRadio.vue.js +22 -20
- package/dist/components/form/nmorph-radio/NmorphRadio.vue2.js +7 -7
- package/dist/components/form/nmorph-radio-group/NmorphRadioGroup.vue2.js +14 -14
- package/dist/components/form/nmorph-select/NmorphSelect.css +1 -1
- package/dist/components/form/nmorph-select/NmorphSelect.vue.js +115 -58
- package/dist/components/form/nmorph-select/NmorphSelect.vue2.js +104 -75
- package/dist/components/form/nmorph-select/components/nmorph-select-option/NmorphSelectOption.vue2.js +12 -10
- package/dist/components/navigation/nmorph-backtop/NmorphBacktop.vue.js +7 -7
- package/dist/components/navigation/nmorph-dropdown/NmorphDropdown.vue.js +29 -42
- package/dist/components/navigation/nmorph-dropdown/NmorphDropdown.vue2.js +39 -20
- package/dist/components/others/nmorph-overlay/NmorphOverlay.vue.js +29 -24
- package/dist/components/others/nmorph-overlay/NmorphOverlay.vue2.js +17 -15
- package/dist/hooks/use-common-styles.js +23 -20
- package/dist/hooks/use-placement.js +76 -44
- package/dist/hooks/use-virtual-list.js +46 -0
- package/dist/index.es.js +698 -694
- package/dist/index.umd.js +46 -38
- package/dist/nuxt.mjs +21 -8
- package/dist/outside-hooks/use-nmorph-browser.js +9 -9
- package/dist/outside-hooks/use-nmorph-theme.js +133 -87
- package/dist/package.json.js +1 -1
- package/dist/plugin.js +34 -29
- package/dist/src/components/data/nmorph-badge/NmorphBadge.vue.d.ts +1 -1
- package/dist/src/components/data/nmorph-image/NmorphImage.vue.d.ts +3 -3
- package/dist/src/components/data/nmorph-image-preview/NmorphImagePreview.vue.d.ts +14 -2
- package/dist/src/components/data/nmorph-pagination/NmorphPagination.vue.d.ts +3 -0
- package/dist/src/components/data/nmorph-table/NmorphTable.vue.d.ts +9 -0
- package/dist/src/components/data/nmorph-table/types.d.ts +2 -2
- package/dist/src/components/feedback/nmorph-tooltip/NmorphTooltip.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-autocomplete/NmorphAutocomplete.vue.d.ts +11 -0
- package/dist/src/components/form/nmorph-checkbox/NmorphCheckbox.vue.d.ts +1 -0
- package/dist/src/components/form/nmorph-checkbox-group/NmorphCheckboxGroup.vue.d.ts +4 -3
- package/dist/src/components/form/nmorph-radio/NmorphRadio.vue.d.ts +1 -0
- package/dist/src/components/form/nmorph-radio-group/NmorphRadioGroup.vue.d.ts +4 -3
- package/dist/src/components/form/nmorph-select/NmorphSelect.vue.d.ts +8 -0
- package/dist/src/components/form/nmorph-select/components/nmorph-select-option/NmorphSelectOption.vue.d.ts +1 -0
- package/dist/src/components/form/nmorph-select/types.d.ts +1 -0
- package/dist/src/components/navigation/nmorph-dropdown/NmorphDropdown.vue.d.ts +3 -1
- package/dist/src/components/others/nmorph-overlay/NmorphOverlay.vue.d.ts +4 -0
- package/dist/src/components/providers/nmorph-notification-provider/NmorphNotificationProvider.vue.d.ts +1 -1
- package/dist/src/hooks/index.d.ts +1 -0
- package/dist/src/hooks/use-common-styles.d.ts +1 -0
- package/dist/src/hooks/use-placement.d.ts +8 -4
- package/dist/src/hooks/use-virtual-list.d.ts +21 -0
- package/dist/src/outside-hooks/use-nmorph-notification.d.ts +2 -2
- package/dist/src/outside-hooks/use-nmorph-theme.d.ts +1 -0
- package/dist/src/plugin.d.ts +2 -0
- package/dist/src/types/index.d.ts +12 -3
- package/dist/style.css +1 -1
- package/dist/types/index.js +14 -8
- package/package.json +1 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { nmorphCombined as p, nmorphInset as
|
|
1
|
+
import { nmorphCombined as p, nmorphInset as t, nmorphOutset as e, title1 as s, title2 as d, title3 as m, title4 as l, body1 as n, body2 as c, body3 as i, body4 as u } from "../utils/theme-style.js";
|
|
2
2
|
const b = {
|
|
3
3
|
"nmorph-body-4": u,
|
|
4
4
|
"nmorph-body-3": i,
|
|
5
5
|
"nmorph-body-2": c,
|
|
6
6
|
"nmorph-body-1": n,
|
|
7
|
-
"nmorph-title-4":
|
|
8
|
-
"nmorph-title-3":
|
|
7
|
+
"nmorph-title-4": l,
|
|
8
|
+
"nmorph-title-3": m,
|
|
9
9
|
"nmorph-title-2": d,
|
|
10
10
|
"nmorph-title-1": s,
|
|
11
11
|
"nmorph--shadow-outset": e,
|
|
12
|
-
"nmorph--shadow-inset":
|
|
12
|
+
"nmorph--shadow-inset": t,
|
|
13
13
|
"nmorph--shadow-combined": p
|
|
14
|
-
},
|
|
15
|
-
let
|
|
14
|
+
}, v = () => {
|
|
15
|
+
let r = `
|
|
16
16
|
:root {
|
|
17
17
|
--font-size-tiny: 10px;
|
|
18
18
|
--font-size-extra-small: 12px;
|
|
@@ -198,6 +198,12 @@ const b = {
|
|
|
198
198
|
height: var(--height);
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
+
.nmorph--extra-thin-component {
|
|
202
|
+
--height: var(--extra-thin-component);
|
|
203
|
+
|
|
204
|
+
height: var(--height);
|
|
205
|
+
}
|
|
206
|
+
|
|
201
207
|
.nmorph--thick-component {
|
|
202
208
|
--height: var(--thick-component);
|
|
203
209
|
|
|
@@ -281,15 +287,8 @@ const b = {
|
|
|
281
287
|
cursor: pointer;
|
|
282
288
|
}
|
|
283
289
|
|
|
284
|
-
.nmorph-
|
|
285
|
-
|
|
286
|
-
width: 0;
|
|
287
|
-
height: 0;
|
|
288
|
-
overflow: visible;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
.nmorph-avatar__preview .nmorph-image-preview__trigger {
|
|
292
|
-
display: none;
|
|
290
|
+
.nmorph-avatar--preview:hover > .nmorph-image {
|
|
291
|
+
filter: brightness(0.8);
|
|
293
292
|
}
|
|
294
293
|
|
|
295
294
|
.nmorph-image {
|
|
@@ -380,7 +379,7 @@ const b = {
|
|
|
380
379
|
text-indent: var(--nmorph-text-input-indentation);
|
|
381
380
|
border: none;
|
|
382
381
|
border-radius: var(--default-border-radius);
|
|
383
|
-
${
|
|
382
|
+
${t()}
|
|
384
383
|
}
|
|
385
384
|
|
|
386
385
|
.nmorph-text-input--with-action input {
|
|
@@ -513,7 +512,7 @@ const b = {
|
|
|
513
512
|
|
|
514
513
|
.nmorph-scroll::-webkit-scrollbar-track {
|
|
515
514
|
border-radius: var(--border-radius-40);
|
|
516
|
-
${
|
|
515
|
+
${t()}
|
|
517
516
|
}
|
|
518
517
|
|
|
519
518
|
.nmorph-scroll::-webkit-scrollbar-thumb {
|
|
@@ -526,14 +525,18 @@ const b = {
|
|
|
526
525
|
}
|
|
527
526
|
`;
|
|
528
527
|
for (const [a, h] of Object.entries(b))
|
|
529
|
-
|
|
528
|
+
r += `
|
|
530
529
|
.${a} {
|
|
531
530
|
${h()}
|
|
532
531
|
}
|
|
533
532
|
`;
|
|
534
|
-
|
|
535
|
-
|
|
533
|
+
return r;
|
|
534
|
+
}, x = () => {
|
|
535
|
+
if (typeof document > "u" || document.getElementById("nmorph-common-styles")) return;
|
|
536
|
+
const o = document.createElement("style");
|
|
537
|
+
o.id = "nmorph-common-styles", o.innerHTML = v(), document.head.appendChild(o);
|
|
536
538
|
};
|
|
537
539
|
export {
|
|
540
|
+
v as getCommonStyles,
|
|
538
541
|
x as useCommonStyles
|
|
539
542
|
};
|
|
@@ -1,57 +1,89 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
const
|
|
3
|
-
const { initialPlacement:
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { ref as b, unref as n, inject as T, watch as F, onMounted as U, onUnmounted as X, nextTick as S } from "vue";
|
|
2
|
+
const G = (j) => {
|
|
3
|
+
const { initialPlacement: g, relativeElement: y, contentDOMElement: u, yOffset: L = 0, xOffset: O = 0, enabled: h } = j, R = b(n(g)), C = b({ x: "0px", y: "0px" }), v = b(!1), k = T("nmorph"), P = { passive: !0, capture: !0 };
|
|
4
|
+
let w = null;
|
|
5
|
+
F(
|
|
6
|
+
() => k?.browser,
|
|
6
7
|
() => {
|
|
7
|
-
|
|
8
|
+
o();
|
|
8
9
|
},
|
|
9
10
|
{ deep: !0 }
|
|
10
|
-
),
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
), U(() => {
|
|
12
|
+
o(), V(), window.addEventListener("resize", o, { passive: !0 }), w = new MutationObserver(() => {
|
|
13
|
+
M();
|
|
14
|
+
}), w.observe(document.body, { childList: !0, subtree: !0 }), M();
|
|
15
|
+
}), X(() => {
|
|
16
|
+
W(), window.removeEventListener("resize", o), w?.disconnect();
|
|
17
|
+
}), F(
|
|
18
|
+
() => [n(g), n(y), n(O), n(L), n(h)],
|
|
19
|
+
() => {
|
|
20
|
+
o();
|
|
21
|
+
},
|
|
22
|
+
{ flush: "post" }
|
|
23
|
+
);
|
|
24
|
+
const M = () => {
|
|
25
|
+
S(() => {
|
|
26
|
+
u.value && o();
|
|
21
27
|
});
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}, n = () => {
|
|
39
|
-
E(() => {
|
|
40
|
-
if (!c.value || !s) {
|
|
41
|
-
console.warn("There is no relative element or content DOM element");
|
|
28
|
+
}, A = () => h === void 0 || n(h) !== !1, q = (e) => {
|
|
29
|
+
const [s, t] = e.split("-");
|
|
30
|
+
return {
|
|
31
|
+
side: s,
|
|
32
|
+
align: t || "start",
|
|
33
|
+
hasAlign: !!t
|
|
34
|
+
};
|
|
35
|
+
}, z = (e, s, t) => t ? `${e}-${s}` : e, B = () => n(y), H = (e, s, t, l, d, r, i) => e === "top" && t - i < 0 ? "bottom" : e === "bottom" && t + d + i > window.innerHeight ? "top" : e === "left" && s - r < 0 ? "right" : e === "right" && s + l + r > window.innerWidth ? "left" : e, V = () => {
|
|
36
|
+
window.addEventListener("scroll", o, P);
|
|
37
|
+
}, W = () => {
|
|
38
|
+
window.removeEventListener("scroll", o, P);
|
|
39
|
+
}, o = () => {
|
|
40
|
+
S(() => {
|
|
41
|
+
if (typeof window > "u") return;
|
|
42
|
+
if (!A()) {
|
|
43
|
+
v.value = !1;
|
|
42
44
|
return;
|
|
43
45
|
}
|
|
44
|
-
const
|
|
45
|
-
if (!
|
|
46
|
-
|
|
46
|
+
const e = B();
|
|
47
|
+
if (!u.value || !e) {
|
|
48
|
+
v.value = !1;
|
|
47
49
|
return;
|
|
48
50
|
}
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
+
const s = u.value.getBoundingClientRect(), t = s.width, l = s.height, d = e.getBoundingClientRect(), { x: r, y: i } = d, m = d.width, p = d.height, D = n(O) || 0, N = n(L) || 0, f = q(n(g)), a = H(
|
|
52
|
+
f.side,
|
|
53
|
+
r,
|
|
54
|
+
i,
|
|
55
|
+
m,
|
|
56
|
+
p,
|
|
57
|
+
t,
|
|
58
|
+
l
|
|
59
|
+
);
|
|
60
|
+
let E = r, x = i;
|
|
61
|
+
if (a === "top" || a === "bottom") {
|
|
62
|
+
const c = {
|
|
63
|
+
start: r,
|
|
64
|
+
center: r + m / 2 - t / 2,
|
|
65
|
+
end: r + m - t
|
|
66
|
+
};
|
|
67
|
+
E = c[f.align] ?? c.start, x = a === "top" ? i - l : i + p;
|
|
68
|
+
}
|
|
69
|
+
if (a === "left" || a === "right") {
|
|
70
|
+
const c = {
|
|
71
|
+
start: i,
|
|
72
|
+
center: i + p / 2 - l / 2,
|
|
73
|
+
end: i + p - l
|
|
74
|
+
};
|
|
75
|
+
E = a === "left" ? r - t : r + m, x = c[f.align] ?? c.start;
|
|
76
|
+
}
|
|
77
|
+
R.value = z(a, f.align, f.hasAlign), C.value = { x: `${E + D}px`, y: `${x + N}px` }, v.value = !0, typeof requestAnimationFrame == "function" && requestAnimationFrame(() => {
|
|
78
|
+
const c = B();
|
|
79
|
+
if (!u.value || !c || !A()) return;
|
|
80
|
+
const $ = u.value.getBoundingClientRect();
|
|
81
|
+
($.width !== t || $.height !== l) && o();
|
|
82
|
+
});
|
|
51
83
|
});
|
|
52
84
|
};
|
|
53
|
-
return { placement:
|
|
85
|
+
return { placement: R, placementCoords: C, placementReady: v, adjustPlacement: o };
|
|
54
86
|
};
|
|
55
87
|
export {
|
|
56
|
-
|
|
88
|
+
G as usePlacement
|
|
57
89
|
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ref as d, computed as t, onMounted as I, nextTick as p, onUnmounted as z, watch as L } from "vue";
|
|
2
|
+
const y = (l, v) => {
|
|
3
|
+
const c = d(null), s = d(0), h = d(0), n = t(() => v.enabled?.value ?? !0), i = t(() => Math.max(v.overscan?.value ?? 0, 0)), a = t(() => Math.max(v.itemHeight.value, 1)), f = t(() => n.value ? l.value.length * a.value : 0), u = () => {
|
|
4
|
+
const e = c.value;
|
|
5
|
+
e && (s.value = e.scrollTop, h.value = e.clientHeight);
|
|
6
|
+
}, w = () => {
|
|
7
|
+
u();
|
|
8
|
+
}, r = t(() => n.value ? Math.max(Math.floor(s.value / a.value) - i.value, 0) : 0), m = t(() => {
|
|
9
|
+
if (!n.value) return l.value.length;
|
|
10
|
+
const e = Math.ceil((s.value + h.value) / a.value) + i.value;
|
|
11
|
+
return Math.min(Math.max(e, r.value + i.value), l.value.length);
|
|
12
|
+
}), M = t(() => r.value * a.value), g = t(() => n.value ? l.value.slice(r.value, m.value).map((e, o) => ({
|
|
13
|
+
item: e,
|
|
14
|
+
index: r.value + o
|
|
15
|
+
})) : l.value.map((e, o) => ({ item: e, index: o }))), H = (e) => {
|
|
16
|
+
const o = c.value;
|
|
17
|
+
if (!o || !n.value) return;
|
|
18
|
+
const T = Math.min(Math.max(e, 0) * a.value, f.value);
|
|
19
|
+
o.scrollTop = T, u();
|
|
20
|
+
}, x = () => {
|
|
21
|
+
u();
|
|
22
|
+
};
|
|
23
|
+
return I(() => {
|
|
24
|
+
p(u), typeof window < "u" && window.addEventListener("resize", x);
|
|
25
|
+
}), z(() => {
|
|
26
|
+
typeof window < "u" && window.removeEventListener("resize", x);
|
|
27
|
+
}), L(
|
|
28
|
+
() => [l.value.length, n.value, a.value],
|
|
29
|
+
() => {
|
|
30
|
+
p(u);
|
|
31
|
+
}
|
|
32
|
+
), {
|
|
33
|
+
containerRef: c,
|
|
34
|
+
endIndex: m,
|
|
35
|
+
offsetTop: M,
|
|
36
|
+
refresh: u,
|
|
37
|
+
scrollHandler: w,
|
|
38
|
+
scrollToIndex: H,
|
|
39
|
+
startIndex: r,
|
|
40
|
+
totalHeight: f,
|
|
41
|
+
virtualItems: g
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
y as useVirtualList
|
|
46
|
+
};
|