@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,16 +1,17 @@
1
1
  import './NmorphSelect.css';
2
- import { defineComponent as U, computed as n, ref as o, watch as N, onMounted as F, nextTick as j, onUnmounted as z, provide as E } from "vue";
3
- import { NmorphComponentHeight as G } from "../../../types/index.js";
4
- import { useModifiers as J } from "../../../utils/create-modifiers.js";
5
- import { useI18n as K } from "vue-i18n";
6
- import { useFormItemInput as Q } from "../nmorph-form/use-form-item-input.js";
7
- import X from "../../navigation/nmorph-dropdown/NmorphDropdown.vue.js";
8
- import Y from "./components/nmorph-select-option/NmorphSelectOption.vue.js";
9
- import Z from "../../basic/nmorph-icon/NmorphIcon.vue.js";
10
- import ee from "../../data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue.js";
11
- import te from "../../../assets/icons/chevron-down.svg.js";
12
- import le from "../../../assets/icons/loader.svg.js";
13
- const ye = /* @__PURE__ */ U({
2
+ import { defineComponent as le, computed as a, ref as s, watch as f, nextTick as E, onMounted as ae, onUnmounted as re, provide as L } from "vue";
3
+ import { NmorphComponentHeight as ne } from "../../../types/index.js";
4
+ import { useModifiers as ue } from "../../../utils/create-modifiers.js";
5
+ import { useI18n as oe } from "vue-i18n";
6
+ import { useFormItemInput as ie } from "../nmorph-form/use-form-item-input.js";
7
+ import { useVirtualList as se } from "../../../hooks/use-virtual-list.js";
8
+ import de from "../../navigation/nmorph-dropdown/NmorphDropdown.vue.js";
9
+ import ve from "./components/nmorph-select-option/NmorphSelectOption.vue.js";
10
+ import ce from "../../basic/nmorph-icon/NmorphIcon.vue.js";
11
+ import fe from "../../data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue.js";
12
+ import pe from "../../../assets/icons/chevron-down.svg.js";
13
+ import me from "../../../assets/icons/loader.svg.js";
14
+ const _e = /* @__PURE__ */ le({
14
15
  __name: "NmorphSelect",
15
16
  props: {
16
17
  noElementPlaceholder: { type: String, required: !1, default: "" },
@@ -23,6 +24,10 @@ const ye = /* @__PURE__ */ U({
23
24
  fill: { type: Boolean, required: !1, default: !1 },
24
25
  optionsWidth: { type: String, required: !1, default: "truncate" },
25
26
  zIndex: { type: Number, required: !1 },
27
+ virtual: { type: Boolean, required: !1, default: !1 },
28
+ virtualItemHeight: { type: Number, required: !1, default: 0 },
29
+ virtualMaxHeight: { type: [Number, String], required: !1, default: 240 },
30
+ virtualOverscan: { type: Number, required: !1, default: 5 },
26
31
  id: { type: String, required: !1 },
27
32
  name: { type: String, required: !1 },
28
33
  autocomplete: { type: String, required: !1 },
@@ -31,98 +36,122 @@ const ye = /* @__PURE__ */ U({
31
36
  tabindex: { type: Number, required: !1 }
32
37
  },
33
38
  emits: ["update:model-value"],
34
- setup(M, { expose: _, emit: $ }) {
35
- _();
36
- const { t: H } = K(), t = M, I = n(
37
- () => t.noElementPlaceholder ? t.noElementPlaceholder : H("noElementPlaceholder")
38
- ), v = $, e = o(t.modelValue), r = o(t.open), u = n(() => t.disabled || t.loading), m = n(() => t.optionsWidth === "auto"), c = o(null), w = o(null), h = o(!0), { id: V, name: D, autocomplete: O, tabindex: L } = Q(t), g = (l) => {
39
- if (!u.value) {
40
- if (r.value = !1, typeof e.value == "string" && (!t.valueRequired && e.value === l ? e.value = "" : e.value = l, v("update:model-value", e.value)), Array.isArray(e.value)) {
41
- const a = e.value.includes(l), A = e.value.length === 1 && a;
42
- if (t.valueRequired && A) return;
43
- a ? e.value = e.value.filter((b) => b !== l) : e.value = [...e.value, l];
39
+ setup(V, { expose: B, emit: T }) {
40
+ B();
41
+ const { t: O } = oe(), l = V, S = a(
42
+ () => l.noElementPlaceholder ? l.noElementPlaceholder : O("noElementPlaceholder")
43
+ ), m = T, t = s(l.modelValue), r = s(l.open), d = a(() => l.disabled || l.loading), h = a(() => l.optionsWidth === "auto"), g = s(!0), { id: C, name: P, autocomplete: k, tabindex: R } = ie(l), y = (e) => {
44
+ if (!d.value) {
45
+ if (r.value = !1, typeof t.value == "string" && (!l.valueRequired && t.value === e ? t.value = "" : t.value = e, m("update:model-value", t.value)), Array.isArray(t.value)) {
46
+ const n = t.value.includes(e), ee = t.value.length === 1 && n;
47
+ if (l.valueRequired && ee) return;
48
+ n ? t.value = t.value.filter((te) => te !== e) : t.value = [...t.value, e];
44
49
  }
45
- v("update:model-value", e.value);
50
+ m("update:model-value", t.value);
46
51
  }
47
- }, p = o(!1), P = () => {
52
+ }, p = s(!1), W = () => {
48
53
  p.value = !0;
49
- }, B = () => {
54
+ }, U = () => {
50
55
  p.value = !1;
51
- }, R = n(
52
- () => J({
53
- nmorph: [G[t.height]],
56
+ }, z = a(
57
+ () => ue({
58
+ nmorph: [ne[l.height]],
54
59
  "nmorph-select": [
55
- `${t.disabled && "disabled"}`,
56
- `${t.modelValue ? "on" : "off"}`,
57
- `${t.loading && "loading"}`,
58
- `${r.value && !u.value && "open"}`,
59
- `${t.fill && "fill"}`,
60
- `${m.value && "options-auto-width"}`,
61
- `${h.value ? "selected-line-outset" : "selected-line-inset"}`,
60
+ `${l.disabled && "disabled"}`,
61
+ `${l.modelValue ? "on" : "off"}`,
62
+ `${l.loading && "loading"}`,
63
+ `${r.value && !d.value && "open"}`,
64
+ `${l.fill && "fill"}`,
65
+ `${h.value && "options-auto-width"}`,
66
+ `${g.value ? "selected-line-outset" : "selected-line-inset"}`,
62
67
  `${p.value && "focus"}`
63
68
  ]
64
69
  })
65
- ), W = () => {
66
- u.value || (r.value = !r.value);
70
+ ), F = () => {
71
+ d.value || (r.value = !r.value);
67
72
  };
68
- N(
73
+ f(
69
74
  r,
70
- (l) => {
71
- l && (h.value = !1);
75
+ (e) => {
76
+ e && (g.value = !1);
72
77
  },
73
78
  { immediate: !0 }
74
79
  );
75
- const y = () => {
80
+ const b = () => {
76
81
  r.value = !1;
77
82
  };
78
- N(
79
- () => t.loading,
80
- (l) => {
81
- l && (r.value = !1);
83
+ f(
84
+ () => l.loading,
85
+ (e) => {
86
+ e && (r.value = !1);
82
87
  }
83
88
  );
84
- const f = o(), i = o([]), s = o(0), d = o("");
85
- N(s, (l) => {
86
- d.value = i.value[l], f.value.forEach((a) => {
87
- const b = a.getAttribute("value") === d.value ? "add" : "remove";
88
- a.classList[b]("nmorph-select-option--focused");
89
- });
90
- }), F(async () => {
91
- await j(), c.value && (f.value = c.value.querySelectorAll(".nmorph-select-option"), f.value.forEach((l) => {
92
- const a = l.getAttribute("value");
93
- a && i.value.push(a);
94
- }), d.value = i.value[s.value], w.value = `${c.value.clientHeight}px`, document.addEventListener("click", y));
95
- }), z(() => {
96
- document.removeEventListener("click", y);
89
+ const i = a(() => l.options.length > 0 ? l.options : l.optionsMap), q = s(null), H = s([]), x = a(() => l.options), c = a(() => l.virtual && x.value.length > 0), M = a(() => ({
90
+ basic: 30,
91
+ thick: 38,
92
+ thin: 22
93
+ })[l.height || "basic"]), w = a(() => l.virtualItemHeight || M.value), A = a(() => l.virtualOverscan), v = se(x, {
94
+ enabled: c,
95
+ itemHeight: w,
96
+ overscan: A
97
+ }), j = a(() => v.virtualItems.value), Y = a(() => ({
98
+ height: `${v.totalHeight.value}px`
99
+ })), G = a(() => ({
100
+ transform: `translateY(${v.offsetTop.value}px)`
101
+ })), $ = (e) => typeof e == "number" ? `${e}px` : e, J = a(() => $(l.virtualMaxHeight)), I = () => {
102
+ i.value.length > 0 || !q.value || (H.value = Array.from(q.value.querySelectorAll(".nmorph-select-option")).map((e) => e.getAttribute("value")).filter((e) => !!e));
103
+ }, o = a(
104
+ () => i.value.length > 0 ? i.value.map((e) => e.value) : H.value
105
+ ), K = a(() => c.value ? Array.isArray(t.value) ? t.value : t.value ? [t.value] : [] : o.value), u = s(0), N = a(() => o.value[u.value] || "");
106
+ f(u, (e) => {
107
+ r.value && c.value && v.scrollToIndex(e);
108
+ }), f(
109
+ o,
110
+ (e) => {
111
+ u.value >= e.length && (u.value = Math.max(e.length - 1, 0));
112
+ },
113
+ { immediate: !0 }
114
+ ), f(r, async (e) => {
115
+ if (e) {
116
+ if (await E(), I(), typeof t.value == "string") {
117
+ const n = o.value.indexOf(t.value);
118
+ n !== -1 && (u.value = n);
119
+ }
120
+ v.refresh(), c.value && v.scrollToIndex(u.value);
121
+ }
122
+ }), ae(async () => {
123
+ await E(), I(), document.addEventListener("click", b);
124
+ }), re(() => {
125
+ document.removeEventListener("click", b);
97
126
  });
98
- const k = n(() => typeof e.value == "string" ? e.value === "" ? I.value : t.options.find((l) => l.value === e.value)?.label : t.options.find((l) => l.value === e.value)?.label), q = n(() => t.options.length > 0 ? t.options : t.optionsMap), C = n(() => q.value.length > 0 ? q.value.filter((a) => e.value.includes(a.value)).map((a) => ({ text: a.label, value: a.value })) : Array.isArray(e.value) ? e.value.map((a) => ({ text: a, value: a })) : [{ text: e.value, value: e.value }]);
99
- E("select-selected-value", e), E("select-change-selected-value", g);
100
- const S = o(null), T = n(
101
- () => m.value ? `${S.value?.clientWidth || 0}px` : void 0
102
- ), x = { t: H, props: t, computedNoElementPlaceholder: I, emit: v, initialValue: e, open: r, disabledInput: u, autoOptionsWidth: m, optionsDOMRef: c, optionsHeight: w, selectedLineOutset: h, id: V, name: D, autocomplete: O, tabindex: L, changeHandler: g, focus: p, focusHandler: P, blurHandler: B, modifiers: R, clickHandler: W, closeHandler: y, nodeOptions: f, domOptions: i, currentIndex: s, currentFocusedEl: d, selectedValueTitle: k, optionsMap: q, tags: C, nmorphSelectDOMRef: S, optionsMinWidth: T, spaceHandler: () => {
103
- u.value || (r.value = !r.value);
127
+ const Q = a(() => typeof t.value == "string" ? t.value === "" ? S.value : i.value.find((e) => e.value === t.value)?.label : i.value.find((e) => e.value === t.value)?.label), X = a(() => i.value.length > 0 ? i.value.filter((n) => t.value.includes(n.value)).map((n) => ({ text: n.label, value: n.value })) : Array.isArray(t.value) ? t.value.map((n) => ({ text: n, value: n })) : [{ text: t.value, value: t.value }]);
128
+ L("select-selected-value", t), L("select-change-selected-value", y);
129
+ const D = s(null), Z = a(
130
+ () => h.value ? `${D.value?.clientWidth || 0}px` : void 0
131
+ ), _ = { t: O, props: l, computedNoElementPlaceholder: S, emit: m, initialValue: t, open: r, disabledInput: d, autoOptionsWidth: h, selectedLineOutset: g, id: C, name: P, autocomplete: k, tabindex: R, changeHandler: y, focus: p, focusHandler: W, blurHandler: U, modifiers: z, clickHandler: F, closeHandler: b, optionsMap: i, optionsDOMRef: q, slotDomOptions: H, renderedOptions: x, virtualEnabled: c, defaultOptionHeight: M, virtualItemHeight: w, virtualOverscan: A, virtualList: v, virtualOptions: j, virtualSpacerStyle: Y, virtualContentStyle: G, getCssSize: $, virtualMaxHeight: J, refreshDomOptions: I, domOptions: o, nativeOptions: K, currentIndex: u, currentFocusedEl: N, selectedValueTitle: Q, tags: X, nmorphSelectDOMRef: D, optionsMinWidth: Z, spaceHandler: () => {
132
+ d.value || (r.value = !r.value);
104
133
  }, arrowDownHandler: () => {
105
- u.value || (s.value = (s.value + 1) % i.value.length);
134
+ d.value || o.value.length !== 0 && (u.value = (u.value + 1) % o.value.length);
106
135
  }, arrowUpHandler: () => {
107
- u.value || (s.value = (s.value - 1 + i.value.length) % i.value.length);
136
+ d.value || o.value.length !== 0 && (u.value = (u.value - 1 + o.value.length) % o.value.length);
108
137
  }, enterHandler: () => {
109
- r.value && g(d.value);
138
+ r.value && N.value && y(N.value);
110
139
  }, get NmorphTagItem() {
111
- return ee;
140
+ return fe;
112
141
  }, get NmorphIcon() {
113
- return Z;
142
+ return ce;
114
143
  }, get NmorphSelectOption() {
115
- return Y;
144
+ return ve;
116
145
  }, get NmorphDropdown() {
117
- return X;
146
+ return de;
118
147
  }, get NmorphIconLoader() {
119
- return le;
148
+ return me;
120
149
  }, get NmorphIconChevronDown() {
121
- return te;
150
+ return pe;
122
151
  } };
123
- return Object.defineProperty(x, "__isScriptSetup", { enumerable: !1, value: !0 }), x;
152
+ return Object.defineProperty(_, "__isScriptSetup", { enumerable: !1, value: !0 }), _;
124
153
  }
125
154
  });
126
155
  export {
127
- ye as default
156
+ _e as default
128
157
  };
@@ -1,14 +1,15 @@
1
1
  import './NmorphSelectOption.css';
2
- import { defineComponent as f, inject as i, computed as n } from "vue";
2
+ import { defineComponent as m, inject as u, computed as s } from "vue";
3
3
  import { NmorphComponentHeight as h } from "../../../../../types/index.js";
4
4
  import { useModifiers as g } from "../../../../../utils/create-modifiers.js";
5
5
  import v from "../../../../basic/nmorph-icon/NmorphIcon.vue.js";
6
- import b from "../../../../../assets/icons/success.svg.js";
7
- const I = /* @__PURE__ */ f({
6
+ import y from "../../../../../assets/icons/success.svg.js";
7
+ const I = /* @__PURE__ */ m({
8
8
  __name: "NmorphSelectOption",
9
9
  props: {
10
10
  value: { type: String, required: !0 },
11
11
  label: { type: String, required: !0, default: "" },
12
+ focused: { type: Boolean, required: !1, default: !1 },
12
13
  id: { type: String, required: !1 },
13
14
  name: { type: String, required: !1 },
14
15
  autocomplete: { type: String, required: !1 },
@@ -17,23 +18,24 @@ const I = /* @__PURE__ */ f({
17
18
  tabindex: { type: Number, required: !1 }
18
19
  },
19
20
  emits: ["change-value"],
20
- setup(u, { expose: s, emit: c }) {
21
- s();
22
- const t = i("select-selected-value"), r = i("select-change-selected-value"), e = u, l = c, p = () => {
21
+ setup(i, { expose: n, emit: c }) {
22
+ n();
23
+ const t = u("select-selected-value"), r = u("select-change-selected-value"), e = i, l = c, d = () => {
23
24
  e.disabled || (l("change-value", e.value), r && r(e.value));
24
- }, a = n(() => typeof t?.value == "string" ? t.value === e.value : Array.isArray(t?.value) ? t.value.some((m) => m === e.value) : !1), d = n(
25
+ }, a = s(() => typeof t?.value == "string" ? t.value === e.value : Array.isArray(t?.value) ? t.value.some((f) => f === e.value) : !1), p = s(
25
26
  () => g({
26
27
  nmorph: [h[e.height]],
27
28
  "nmorph-select-option": [
28
29
  `${e.disabled && "disabled"}`,
29
30
  `${e.label && "with-label"}`,
30
- `${a.value && "checked"}`
31
+ `${a.value && "checked"}`,
32
+ `${e.focused && "focused"}`
31
33
  ]
32
34
  })
33
- ), o = { selectSelectedValue: t, selectChangeSelectedValue: r, props: e, emit: l, clickHandler: p, checked: a, modifiers: d, get NmorphIcon() {
35
+ ), o = { selectSelectedValue: t, selectChangeSelectedValue: r, props: e, emit: l, clickHandler: d, checked: a, modifiers: p, get NmorphIcon() {
34
36
  return v;
35
37
  }, get NmorphIconSuccess() {
36
- return b;
38
+ return y;
37
39
  } };
38
40
  return Object.defineProperty(o, "__isScriptSetup", { enumerable: !1, value: !0 }), o;
39
41
  }
@@ -1,20 +1,20 @@
1
1
  import './NmorphBacktop.css';
2
2
  import p from "./NmorphBacktop.vue2.js";
3
- import { openBlock as l, createElementBlock as a, normalizeStyle as i, createElementVNode as t, normalizeClass as c, withModifiers as m, renderSlot as s, createVNode as r, withCtx as e } from "vue";
3
+ import { openBlock as a, createElementBlock as l, normalizeStyle as c, createElementVNode as t, normalizeClass as i, withModifiers as m, renderSlot as s, createVNode as r, withCtx as e } from "vue";
4
4
  /* empty css */
5
5
  import d from "../../../_virtual/_plugin-vue_export-helper.js";
6
6
  function h(n, f, _, o, k, b) {
7
- return l(), a(
7
+ return a(), l(
8
8
  "div",
9
9
  {
10
- style: i({ "--nmorph-backtop-right": `${o.props.right}px`, "--nmorph-backtop-bottom": `${o.props.bottom}px` })
10
+ style: c({ "--nmorph-backtop-right": `${o.props.right}px`, "--nmorph-backtop-bottom": `${o.props.bottom}px` })
11
11
  },
12
12
  [
13
13
  t(
14
14
  "div",
15
15
  {
16
16
  ref: "selfDOMEl",
17
- class: c(o.modifiers)
17
+ class: i(o.modifiers)
18
18
  },
19
19
  [
20
20
  t("div", {
@@ -27,7 +27,7 @@ function h(n, f, _, o, k, b) {
27
27
  default: e(() => [
28
28
  r(o.NmorphIcon, {
29
29
  class: "nmorph-backtop__up-icon",
30
- color: o.props.design === "nmorph" ? void 0 : "var(--nmorph-white-color)"
30
+ color: o.props.design === "nmorph" ? void 0 : "var(--nmorph-contrast-text-color)"
31
31
  }, {
32
32
  default: e(() => [
33
33
  r(o.NmorphIconChevronDown)
@@ -50,7 +50,7 @@ function h(n, f, _, o, k, b) {
50
50
  /* STYLE */
51
51
  );
52
52
  }
53
- const x = /* @__PURE__ */ d(p, [["render", h], ["__file", "/builds/ketjo/nmorph/library/src/components/navigation/nmorph-backtop/NmorphBacktop.vue"]]);
53
+ const g = /* @__PURE__ */ d(p, [["render", h], ["__file", "/builds/ketjo/nmorph/library/src/components/navigation/nmorph-backtop/NmorphBacktop.vue"]]);
54
54
  export {
55
- x as default
55
+ g as default
56
56
  };
@@ -1,49 +1,36 @@
1
1
  import './NmorphDropdown.css';
2
2
  import n from "./NmorphDropdown.vue2.js";
3
- import { openBlock as d, createElementBlock as i, normalizeStyle as r, createVNode as t, withCtx as m, createElementVNode as p, normalizeClass as a, renderSlot as l } from "vue";
3
+ import { openBlock as r, createBlock as t, withCtx as d, createElementBlock as i, normalizeStyle as p, normalizeClass as l, renderSlot as a, createCommentVNode as m } from "vue";
4
4
  /* empty css */
5
5
  import s from "../../../_virtual/_plugin-vue_export-helper.js";
6
- function c(e, h, f, o, w, _) {
7
- return d(), i(
8
- "div",
9
- {
10
- style: r({
11
- "--nmorph-dropdown-width": o.width,
12
- "--nmorph-dropdown-min-width": o.getCssSize(o.props.minWidth) || "auto",
13
- "--nmorph-dropdown-max-width": o.getCssSize(o.props.maxWidth) || "none"
14
- })
15
- },
16
- [
17
- t(o.NmorphOverlay, {
18
- show: o.props.open,
19
- transparent: "",
20
- "z-index": o.props.zIndex,
21
- onOnOutsideClick: o.outsideClickHandler
22
- }, {
23
- default: m(() => [
24
- p(
25
- "div",
26
- {
27
- ref: "dropdownDOMRef",
28
- class: a(o.modifiers),
29
- style: r({ left: `${o.placementCoords.x}`, top: `${o.placementCoords.y}` })
30
- },
31
- [
32
- l(e.$slots, "default")
33
- ],
34
- 6
35
- /* CLASS, STYLE */
36
- )
37
- ]),
38
- _: 3
39
- /* FORWARDED */
40
- }, 8, ["show", "z-index"])
41
- ],
42
- 4
43
- /* STYLE */
44
- );
6
+ function c(e, f, _, o, h, w) {
7
+ return r(), t(o.NmorphOverlay, {
8
+ show: o.props.open,
9
+ transparent: "",
10
+ "z-index": o.props.zIndex,
11
+ onOnOutsideClick: o.outsideClickHandler
12
+ }, {
13
+ default: d(() => [
14
+ o.props.open ? (r(), i(
15
+ "div",
16
+ {
17
+ key: 0,
18
+ ref: "dropdownDOMRef",
19
+ class: l(o.modifiers),
20
+ style: p(o.dropdownStyle)
21
+ },
22
+ [
23
+ a(e.$slots, "default")
24
+ ],
25
+ 6
26
+ /* CLASS, STYLE */
27
+ )) : m("v-if", !0)
28
+ ]),
29
+ _: 3
30
+ /* FORWARDED */
31
+ }, 8, ["show", "z-index"]);
45
32
  }
46
- const k = /* @__PURE__ */ s(n, [["render", c], ["__file", "/builds/ketjo/nmorph/library/src/components/navigation/nmorph-dropdown/NmorphDropdown.vue"]]);
33
+ const z = /* @__PURE__ */ s(n, [["render", c], ["__file", "/builds/ketjo/nmorph/library/src/components/navigation/nmorph-dropdown/NmorphDropdown.vue"]]);
47
34
  export {
48
- k as default
35
+ z as default
49
36
  };
@@ -1,13 +1,14 @@
1
1
  import './NmorphDropdown.css';
2
- import { defineComponent as a, ref as c, computed as l } from "vue";
3
- import { useModifiers as y } from "../../../utils/create-modifiers.js";
4
- import { usePlacement as h } from "../../../hooks/use-placement.js";
5
- import O from "../../others/nmorph-overlay/NmorphOverlay.vue.js";
6
- const w = /* @__PURE__ */ a({
2
+ import { defineComponent as w, ref as b, toRef as r, computed as i, watch as v } from "vue";
3
+ import { useModifiers as x } from "../../../utils/create-modifiers.js";
4
+ import { usePlacement as O } from "../../../hooks/use-placement.js";
5
+ import q from "../../others/nmorph-overlay/NmorphOverlay.vue.js";
6
+ const g = /* @__PURE__ */ w({
7
7
  __name: "NmorphDropdown",
8
8
  props: {
9
9
  open: { type: Boolean, required: !0 },
10
10
  relativeElement: { type: null, required: !0 },
11
+ placement: { type: null, required: !1, default: "bottom" },
11
12
  width: { type: [Number, String], required: !1, default: 160 },
12
13
  minWidth: { type: [Number, String], required: !1 },
13
14
  maxWidth: { type: [Number, String], required: !1 },
@@ -17,26 +18,44 @@ const w = /* @__PURE__ */ a({
17
18
  zIndex: { type: Number, required: !1 }
18
19
  },
19
20
  emits: ["on-outside-click"],
20
- setup(s, { expose: d, emit: f }) {
21
- d();
22
- const e = s, r = f, o = c(null), { placementCoords: m } = h({
23
- initialPlacement: "bottom",
24
- contentDOMElement: o,
25
- relativeElement: e.relativeElement,
26
- yOffset: e.yOffset,
27
- xOffset: e.xOffset
28
- }), u = l(
29
- () => y({
21
+ setup(u, { expose: f, emit: c }) {
22
+ f();
23
+ const e = u, l = c, d = b(null), { placementCoords: n, placementReady: p, adjustPlacement: m } = O({
24
+ initialPlacement: r(e, "placement"),
25
+ contentDOMElement: d,
26
+ relativeElement: r(e, "relativeElement"),
27
+ yOffset: r(e, "yOffset"),
28
+ xOffset: r(e, "xOffset"),
29
+ enabled: r(e, "open")
30
+ }), h = i(
31
+ () => x({
30
32
  "nmorph-dropdown": [`${!e.open && "closed"}`]
31
33
  })
32
- ), i = (t) => typeof t == "number" ? `${t}px` : t, p = l(() => e.fillWidth ? `${e.relativeElement?.clientWidth}px` : i(e.width)), n = { props: e, emit: r, dropdownDOMRef: o, placementCoords: m, modifiers: u, getCssSize: i, width: p, outsideClickHandler: () => {
33
- r("on-outside-click");
34
+ ), o = (t) => typeof t == "number" ? `${t}px` : t, s = i(
35
+ () => e.fillWidth && e.relativeElement ? `${e.relativeElement.clientWidth}px` : o(e.width)
36
+ ), y = i(() => ({
37
+ "--nmorph-dropdown-width": s.value,
38
+ "--nmorph-dropdown-min-width": o(e.minWidth) || "auto",
39
+ "--nmorph-dropdown-max-width": o(e.maxWidth) || "none",
40
+ left: n.value.x,
41
+ top: n.value.y,
42
+ visibility: e.open && p.value ? "visible" : "hidden"
43
+ }));
44
+ v(
45
+ () => e.open,
46
+ (t) => {
47
+ t && m();
48
+ },
49
+ { flush: "post" }
50
+ );
51
+ const a = { props: e, emit: l, dropdownDOMRef: d, placementCoords: n, placementReady: p, adjustPlacement: m, modifiers: h, getCssSize: o, width: s, dropdownStyle: y, outsideClickHandler: () => {
52
+ l("on-outside-click");
34
53
  }, get NmorphOverlay() {
35
- return O;
54
+ return q;
36
55
  } };
37
- return Object.defineProperty(n, "__isScriptSetup", { enumerable: !1, value: !0 }), n;
56
+ return Object.defineProperty(a, "__isScriptSetup", { enumerable: !1, value: !0 }), a;
38
57
  }
39
58
  });
40
59
  export {
41
- w as default
60
+ g as default
42
61
  };
@@ -1,30 +1,35 @@
1
1
  import './NmorphOverlay.css';
2
- import t from "./NmorphOverlay.vue2.js";
3
- import { openBlock as n, createElementBlock as i, withModifiers as e, normalizeStyle as s, normalizeClass as m, createElementVNode as a, renderSlot as p } from "vue";
2
+ import s from "./NmorphOverlay.vue2.js";
3
+ import { openBlock as i, createBlock as n, Teleport as p, createElementVNode as e, withModifiers as l, normalizeStyle as a, normalizeClass as d, renderSlot as m } from "vue";
4
4
  /* empty css */
5
5
  import c from "../../../_virtual/_plugin-vue_export-helper.js";
6
- function d(l, r, f, o, _, v) {
7
- return n(), i(
8
- "div",
9
- {
10
- class: m(o.modifiers),
11
- style: s({ "--nmorph-overlay-z-index": o.zIndex }),
12
- onClick: e(o.clickHandler, ["stop"])
13
- },
14
- [
15
- a("div", {
16
- class: "nmorph-overlay__slot",
17
- onClick: r[0] || (r[0] = e(() => {
18
- }, ["stop"]))
19
- }, [
20
- p(l.$slots, "default")
21
- ])
22
- ],
23
- 6
24
- /* CLASS, STYLE */
25
- );
6
+ function f(t, r, _, o, h, v) {
7
+ return i(), n(p, {
8
+ to: o.props.teleportTo,
9
+ disabled: o.props.disabledTeleport || !o.props.show
10
+ }, [
11
+ e(
12
+ "div",
13
+ {
14
+ class: d(o.modifiers),
15
+ style: a({ "--nmorph-overlay-z-index": o.zIndex }),
16
+ onClick: l(o.clickHandler, ["stop"])
17
+ },
18
+ [
19
+ e("div", {
20
+ class: "nmorph-overlay__slot",
21
+ onClick: r[0] || (r[0] = l(() => {
22
+ }, ["stop"]))
23
+ }, [
24
+ m(t.$slots, "default")
25
+ ])
26
+ ],
27
+ 6
28
+ /* CLASS, STYLE */
29
+ )
30
+ ], 8, ["to", "disabled"]);
26
31
  }
27
- const x = /* @__PURE__ */ c(t, [["render", d], ["__file", "/builds/ketjo/nmorph/library/src/components/others/nmorph-overlay/NmorphOverlay.vue"]]);
32
+ const z = /* @__PURE__ */ c(s, [["render", f], ["__file", "/builds/ketjo/nmorph/library/src/components/others/nmorph-overlay/NmorphOverlay.vue"]]);
28
33
  export {
29
- x as default
34
+ z as default
30
35
  };
@@ -1,30 +1,32 @@
1
1
  import './NmorphOverlay.css';
2
- import { defineComponent as d, computed as t } from "vue";
3
- import { useModifiers as m } from "../../../utils/create-modifiers.js";
4
- import { useZIndex as c } from "../../../hooks/use-z-index.js";
5
- const h = /* @__PURE__ */ d({
2
+ import { defineComponent as d, computed as o } from "vue";
3
+ import { useModifiers as u } from "../../../utils/create-modifiers.js";
4
+ import { useZIndex as f } from "../../../hooks/use-z-index.js";
5
+ const y = /* @__PURE__ */ d({
6
6
  __name: "NmorphOverlay",
7
7
  props: {
8
8
  show: { type: Boolean, required: !0 },
9
9
  transparent: { type: Boolean, required: !1, default: !1 },
10
- zIndex: { type: Number, required: !1 }
10
+ zIndex: { type: Number, required: !1 },
11
+ teleportTo: { type: null, required: !1, default: "body" },
12
+ disabledTeleport: { type: Boolean, required: !1, default: !1 }
11
13
  },
12
14
  emits: ["on-outside-click"],
13
- setup(n, { expose: s, emit: i }) {
14
- s();
15
- const e = n, p = c(
16
- t(() => e.show),
15
+ setup(s, { expose: n, emit: a }) {
16
+ n();
17
+ const e = s, l = f(
18
+ o(() => e.show),
17
19
  () => e.zIndex
18
- ), a = t(
19
- () => m({
20
+ ), p = o(
21
+ () => u({
20
22
  "nmorph-overlay": [`${e.show && "show"}`, `${e.transparent && "transparent"}`]
21
23
  })
22
- ), u = () => {
24
+ ), i = () => {
23
25
  r("on-outside-click");
24
- }, r = i, o = { props: e, zIndex: p, modifiers: a, clickHandler: u, emit: r };
25
- return Object.defineProperty(o, "__isScriptSetup", { enumerable: !1, value: !0 }), o;
26
+ }, r = a, t = { props: e, zIndex: l, modifiers: p, clickHandler: i, emit: r };
27
+ return Object.defineProperty(t, "__isScriptSetup", { enumerable: !1, value: !0 }), t;
26
28
  }
27
29
  });
28
30
  export {
29
- h as default
31
+ y as default
30
32
  };