@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.
Files changed (75) hide show
  1. package/README.md +11 -7
  2. package/dist/components/basic/nmorph-icon/NmorphIcon.css +1 -1
  3. package/dist/components/basic/nmorph-icon/NmorphIcon.vue2.js +11 -11
  4. package/dist/components/data/nmorph-avatar/NmorphAvatar.css +1 -0
  5. package/dist/components/data/nmorph-avatar/NmorphAvatar.vue.js +74 -46
  6. package/dist/components/data/nmorph-avatar/NmorphAvatar.vue2.js +26 -21
  7. package/dist/components/data/nmorph-carousel/NmorphCarousel.vue2.js +4 -4
  8. package/dist/components/data/nmorph-image-preview/NmorphImagePreview.vue.js +77 -38
  9. package/dist/components/data/nmorph-image-preview/NmorphImagePreview.vue2.js +31 -30
  10. package/dist/components/data/nmorph-pagination/NmorphPagination.css +1 -1
  11. package/dist/components/data/nmorph-pagination/NmorphPagination.vue.js +36 -30
  12. package/dist/components/data/nmorph-pagination/NmorphPagination.vue2.js +48 -41
  13. package/dist/components/data/nmorph-table/NmorphTable.css +1 -1
  14. package/dist/components/data/nmorph-table/NmorphTable.vue.js +228 -103
  15. package/dist/components/data/nmorph-table/NmorphTable.vue2.js +49 -30
  16. package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.css +1 -1
  17. package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.vue.js +91 -35
  18. package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.vue2.js +48 -35
  19. package/dist/components/form/nmorph-checkbox/NmorphCheckbox.css +1 -1
  20. package/dist/components/form/nmorph-checkbox/NmorphCheckbox.vue.js +15 -13
  21. package/dist/components/form/nmorph-checkbox/NmorphCheckbox.vue2.js +8 -8
  22. package/dist/components/form/nmorph-checkbox-group/NmorphCheckboxGroup.vue2.js +22 -14
  23. package/dist/components/form/nmorph-color-picker/NmorphColorPicker.vue2.js +11 -10
  24. package/dist/components/form/nmorph-radio/NmorphRadio.css +1 -1
  25. package/dist/components/form/nmorph-radio/NmorphRadio.vue.js +22 -20
  26. package/dist/components/form/nmorph-radio/NmorphRadio.vue2.js +7 -7
  27. package/dist/components/form/nmorph-radio-group/NmorphRadioGroup.vue2.js +14 -14
  28. package/dist/components/form/nmorph-select/NmorphSelect.css +1 -1
  29. package/dist/components/form/nmorph-select/NmorphSelect.vue.js +115 -58
  30. package/dist/components/form/nmorph-select/NmorphSelect.vue2.js +104 -75
  31. package/dist/components/form/nmorph-select/components/nmorph-select-option/NmorphSelectOption.vue2.js +12 -10
  32. package/dist/components/navigation/nmorph-backtop/NmorphBacktop.vue.js +7 -7
  33. package/dist/components/navigation/nmorph-dropdown/NmorphDropdown.vue.js +29 -42
  34. package/dist/components/navigation/nmorph-dropdown/NmorphDropdown.vue2.js +39 -20
  35. package/dist/components/others/nmorph-overlay/NmorphOverlay.vue.js +29 -24
  36. package/dist/components/others/nmorph-overlay/NmorphOverlay.vue2.js +17 -15
  37. package/dist/hooks/use-common-styles.js +23 -20
  38. package/dist/hooks/use-placement.js +76 -44
  39. package/dist/hooks/use-virtual-list.js +46 -0
  40. package/dist/index.es.js +698 -694
  41. package/dist/index.umd.js +46 -38
  42. package/dist/nuxt.mjs +21 -8
  43. package/dist/outside-hooks/use-nmorph-browser.js +9 -9
  44. package/dist/outside-hooks/use-nmorph-theme.js +133 -87
  45. package/dist/package.json.js +1 -1
  46. package/dist/plugin.js +34 -29
  47. package/dist/src/components/data/nmorph-badge/NmorphBadge.vue.d.ts +1 -1
  48. package/dist/src/components/data/nmorph-image/NmorphImage.vue.d.ts +3 -3
  49. package/dist/src/components/data/nmorph-image-preview/NmorphImagePreview.vue.d.ts +14 -2
  50. package/dist/src/components/data/nmorph-pagination/NmorphPagination.vue.d.ts +3 -0
  51. package/dist/src/components/data/nmorph-table/NmorphTable.vue.d.ts +9 -0
  52. package/dist/src/components/data/nmorph-table/types.d.ts +2 -2
  53. package/dist/src/components/feedback/nmorph-tooltip/NmorphTooltip.vue.d.ts +1 -1
  54. package/dist/src/components/form/nmorph-autocomplete/NmorphAutocomplete.vue.d.ts +11 -0
  55. package/dist/src/components/form/nmorph-checkbox/NmorphCheckbox.vue.d.ts +1 -0
  56. package/dist/src/components/form/nmorph-checkbox-group/NmorphCheckboxGroup.vue.d.ts +4 -3
  57. package/dist/src/components/form/nmorph-radio/NmorphRadio.vue.d.ts +1 -0
  58. package/dist/src/components/form/nmorph-radio-group/NmorphRadioGroup.vue.d.ts +4 -3
  59. package/dist/src/components/form/nmorph-select/NmorphSelect.vue.d.ts +8 -0
  60. package/dist/src/components/form/nmorph-select/components/nmorph-select-option/NmorphSelectOption.vue.d.ts +1 -0
  61. package/dist/src/components/form/nmorph-select/types.d.ts +1 -0
  62. package/dist/src/components/navigation/nmorph-dropdown/NmorphDropdown.vue.d.ts +3 -1
  63. package/dist/src/components/others/nmorph-overlay/NmorphOverlay.vue.d.ts +4 -0
  64. package/dist/src/components/providers/nmorph-notification-provider/NmorphNotificationProvider.vue.d.ts +1 -1
  65. package/dist/src/hooks/index.d.ts +1 -0
  66. package/dist/src/hooks/use-common-styles.d.ts +1 -0
  67. package/dist/src/hooks/use-placement.d.ts +8 -4
  68. package/dist/src/hooks/use-virtual-list.d.ts +21 -0
  69. package/dist/src/outside-hooks/use-nmorph-notification.d.ts +2 -2
  70. package/dist/src/outside-hooks/use-nmorph-theme.d.ts +1 -0
  71. package/dist/src/plugin.d.ts +2 -0
  72. package/dist/src/types/index.d.ts +12 -3
  73. package/dist/style.css +1 -1
  74. package/dist/types/index.js +14 -8
  75. package/package.json +1 -1
@@ -1,18 +1,18 @@
1
- import { nmorphCombined as p, nmorphInset as o, nmorphOutset as e, title1 as s, title2 as d, title3 as l, title4 as m, body1 as n, body2 as c, body3 as i, body4 as u } from "../utils/theme-style.js";
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": m,
8
- "nmorph-title-3": l,
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": o,
12
+ "nmorph--shadow-inset": t,
13
13
  "nmorph--shadow-combined": p
14
- }, x = () => {
15
- let t = `
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-avatar__preview {
285
- position: absolute;
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
- ${o()}
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
- ${o()}
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
- t += `
528
+ r += `
530
529
  .${a} {
531
530
  ${h()}
532
531
  }
533
532
  `;
534
- const r = document.createElement("style");
535
- r.innerHTML = t, document.head.appendChild(r);
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 p, inject as R, watch as S, onMounted as W, onUnmounted as k, nextTick as E } from "vue";
2
- const T = (b) => {
3
- const { initialPlacement: y, relativeElement: s, contentDOMElement: c, yOffset: u = 0, xOffset: v = 0 } = b, e = p(y), r = p({ x: "0px", y: "0px" }), C = R("nmorph"), a = p(null);
4
- S(
5
- () => C.browser,
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
- n();
8
+ o();
8
9
  },
9
10
  { deep: !0 }
10
- ), W(() => {
11
- n(), L(), $(), h.observe(document.body, {
12
- childList: !0,
13
- subtree: !0
14
- }), f();
15
- }), k(() => {
16
- O(), h.disconnect();
17
- });
18
- const f = () => {
19
- E(() => {
20
- c.value && n();
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
- }, h = new MutationObserver(() => {
23
- f();
24
- }), L = () => {
25
- let t = c.value;
26
- for (; t; ) {
27
- const o = window.getComputedStyle(t);
28
- if (o.overflowY === "auto" || o.overflowY === "scroll") {
29
- a.value = t;
30
- break;
31
- }
32
- t = t.parentElement;
33
- }
34
- }, $ = () => {
35
- a.value ? a.value.addEventListener("scroll", n, { passive: !0 }) : window.addEventListener("scroll", n, { passive: !0 });
36
- }, O = () => {
37
- a.value ? a.value.removeEventListener("scroll", n) : window.removeEventListener("scroll", n);
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 t = c.value.getBoundingClientRect(), o = t.width, d = t.height, w = "value" in s ? s.value : s;
45
- if (!w) {
46
- console.warn("Relative element is not an HTMLElement");
46
+ const e = B();
47
+ if (!u.value || !e) {
48
+ v.value = !1;
47
49
  return;
48
50
  }
49
- const m = w.getBoundingClientRect(), { x: l, y: i } = m, x = m.width, g = m.height, H = window.innerWidth, M = window.innerHeight;
50
- e.value === "top" && i - d < 0 && (e.value = "bottom"), e.value === "bottom" && i + g + d > M && (e.value = "top"), e.value === "left" && l - o < 0 && (e.value = "right"), e.value === "right" && l + x + o > H && (e.value = "left"), e.value === "top" && (r.value = { x: `${l + v}px`, y: `${i - d + u}px` }), e.value === "bottom" && (r.value = { x: `${l + v}px`, y: `${i + g + u}px` }), e.value === "right" && (r.value = { x: `${l + x + v}px`, y: `${i + u}px` }), e.value === "left" && (r.value = { x: `${l - o + v}px`, y: `${i + u}px` });
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: e, placementCoords: r };
85
+ return { placement: R, placementCoords: C, placementReady: v, adjustPlacement: o };
54
86
  };
55
87
  export {
56
- T as usePlacement
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
+ };