@nmorph/nmorph-ui-kit 2.2.39 → 2.2.41

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 (27) hide show
  1. package/dist/components/basic/nmorph-button/NmorphButton.css +1 -1
  2. package/dist/components/basic/nmorph-button/NmorphButton.vue.js +13 -10
  3. package/dist/components/data/nmorph-image-preview/NmorphImagePreview.css +1 -1
  4. package/dist/components/data/nmorph-image-preview/NmorphImagePreview.vue.js +122 -75
  5. package/dist/components/data/nmorph-image-preview/NmorphImagePreview.vue2.js +100 -75
  6. package/dist/components/data/nmorph-tag-list/NmorphTagList.css +1 -0
  7. package/dist/components/data/nmorph-tag-list/NmorphTagList.vue.js +17 -12
  8. package/dist/components/data/nmorph-tag-list/NmorphTagList.vue2.js +31 -19
  9. package/dist/components/data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.css +1 -1
  10. package/dist/components/data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue.js +18 -15
  11. package/dist/components/data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue2.js +84 -21
  12. package/dist/components/form/nmorph-text-input/NmorphTextInput.css +1 -1
  13. package/dist/components/navigation/nmorph-context-menu/NmorphContextMenu.vue.js +27 -22
  14. package/dist/components/navigation/nmorph-context-menu/NmorphContextMenu.vue2.js +80 -45
  15. package/dist/hooks/use-placement.js +65 -61
  16. package/dist/index.umd.js +29 -29
  17. package/dist/package.json.js +1 -1
  18. package/dist/src/components/data/nmorph-image-preview/NmorphImagePreview.vue.d.ts +6 -0
  19. package/dist/src/components/data/nmorph-image-preview/types.d.ts +4 -0
  20. package/dist/src/components/data/nmorph-tag-list/NmorphTagList.vue.d.ts +10 -1
  21. package/dist/src/components/data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue.d.ts +6 -1
  22. package/dist/src/components/data/nmorph-tag-list/components/nmorph-tag-item/types.d.ts +1 -0
  23. package/dist/src/components/data/nmorph-tag-list/types.d.ts +7 -0
  24. package/dist/src/components/navigation/nmorph-context-menu/NmorphContextMenu.vue.d.ts +5 -3
  25. package/dist/src/components/navigation/nmorph-context-menu/types.d.ts +8 -2
  26. package/dist/style.css +1 -1
  27. package/package.json +1 -1
@@ -1,21 +1,26 @@
1
+ import './NmorphTagList.css';
1
2
  import n from "./NmorphTagList.vue2.js";
2
- import { openBlock as e, createElementBlock as t, normalizeClass as a, Fragment as l, renderList as s, createBlock as m, mergeProps as i } from "vue";
3
- import c from "../../../_virtual/_plugin-vue_export-helper.js";
4
- function p(f, _, d, r, u, g) {
5
- return e(), t(
3
+ import { openBlock as e, createElementBlock as l, normalizeClass as t, Fragment as a, renderList as i, createBlock as c, mergeProps as m } from "vue";
4
+ /* empty css */
5
+ import s from "../../../_virtual/_plugin-vue_export-helper.js";
6
+ function p(d, f, _, r, g, k) {
7
+ return e(), l(
6
8
  "div",
7
9
  {
8
- class: a(r.modifiers)
10
+ class: t(r.modifiers)
9
11
  },
10
12
  [
11
- (e(!0), t(
12
- l,
13
+ (e(!0), l(
14
+ a,
13
15
  null,
14
- s(r.tagList, (o) => (e(), m(
16
+ i(r.resolvedTagList, (o) => (e(), c(
15
17
  r.NmorphTagItem,
16
- i({
18
+ m({
17
19
  key: o.value
18
- }, { ref_for: !0 }, o, { onClose: r.closeTagHandler }),
20
+ }, { ref_for: !0 }, o, {
21
+ onClick: r.clickTagHandler,
22
+ onClose: r.closeTagHandler
23
+ }),
19
24
  null,
20
25
  16
21
26
  /* FULL_PROPS */
@@ -28,7 +33,7 @@ function p(f, _, d, r, u, g) {
28
33
  /* CLASS */
29
34
  );
30
35
  }
31
- const T = /* @__PURE__ */ c(n, [["render", p], ["__file", "/builds/ketjo/nmorph/library/src/components/data/nmorph-tag-list/NmorphTagList.vue"]]);
36
+ const L = /* @__PURE__ */ s(n, [["render", p], ["__file", "/builds/ketjo/nmorph/library/src/components/data/nmorph-tag-list/NmorphTagList.vue"]]);
32
37
  export {
33
- T as default
38
+ L as default
34
39
  };
@@ -1,32 +1,44 @@
1
- import { defineComponent as p, computed as n, ref as d } from "vue";
2
- import { useModifiers as c } from "../../../utils/create-modifiers.js";
1
+ import './NmorphTagList.css';
2
+ import { defineComponent as p, computed as s, ref as m } from "vue";
3
+ import { useModifiers as g } from "../../../utils/create-modifiers.js";
3
4
  import f from "./components/nmorph-tag-item/NmorphTagItem.vue.js";
4
- const h = /* @__PURE__ */ p({
5
+ const L = /* @__PURE__ */ p({
5
6
  __name: "NmorphTagList",
6
7
  props: {
7
- modelValue: { type: Array, required: !0 }
8
+ modelValue: { type: Array, required: !0 },
9
+ selectedValue: { type: [String, null], required: !1 },
10
+ design: { type: String, required: !1, default: "nmorph" },
11
+ color: { type: String, required: !1 }
8
12
  },
9
- emits: ["close", "update:model-value"],
10
- setup(a, { expose: m, emit: l }) {
11
- m();
12
- const o = a, r = l, u = n(
13
- () => c({
14
- "nmorph-list": []
13
+ emits: ["click", "close", "update:model-value", "update:selected-value", "update:selectedValue"],
14
+ setup(a, { expose: i, emit: d }) {
15
+ i();
16
+ const l = a, t = d, u = s(
17
+ () => g({
18
+ "nmorph-list": [l.design]
15
19
  })
16
20
  );
17
- let e = d(o.modelValue);
18
- const s = { props: o, emit: r, modifiers: u, get tagList() {
19
- return e;
20
- }, set tagList(t) {
21
- e = t;
22
- }, closeTagHandler: (t) => {
23
- e.value = e.value.filter((i) => i.value !== t), r("close", t), r("update:model-value", e.value);
21
+ let r = m(l.modelValue);
22
+ const n = s(
23
+ () => r.value.map((e) => ({
24
+ ...e,
25
+ design: e.design ?? l.design,
26
+ color: e.color ?? l.color
27
+ }))
28
+ ), o = { props: l, emit: t, modifiers: u, get tagList() {
29
+ return r;
30
+ }, set tagList(e) {
31
+ r = e;
32
+ }, resolvedTagList: n, closeTagHandler: (e) => {
33
+ r.value = r.value.filter((c) => c.value !== e), t("close", e), t("update:model-value", r.value);
34
+ }, clickTagHandler: (e) => {
35
+ t("click", e), t("update:selected-value", e), t("update:selectedValue", e);
24
36
  }, get NmorphTagItem() {
25
37
  return f;
26
38
  } };
27
- return Object.defineProperty(s, "__isScriptSetup", { enumerable: !1, value: !0 }), s;
39
+ return Object.defineProperty(o, "__isScriptSetup", { enumerable: !1, value: !0 }), o;
28
40
  }
29
41
  });
30
42
  export {
31
- h as default
43
+ L as default
32
44
  };
@@ -1 +1 @@
1
- .nmorph-tag-item{display:inline-flex;margin-right:var(--indentation-02);padding:var(--indentation-00) var(--indentation-03);border:solid 2px var(--nmorph-text-color);border-radius:var(--default-border-radius);cursor:default}.nmorph-tag-item .nmorph-tag-item__content{display:flex;align-items:center;height:100%}.nmorph-tag-item .nmorph-tag-item__close-icon{margin-left:4px;cursor:pointer}.nmorph-tag-item.nmorph-tag-item--nmorph-design{background:var(--nmorph-main-color);border:none;box-shadow:inset var(--base-shadow-width) var(--base-shadow-width) var(--base-shadow-blur) var(--nmorph-dark-shade-color),inset calc(-1 * var(--base-shadow-width)) calc(-1 * var(--base-shadow-width)) var(--base-shadow-blur) var(--nmorph-light-shade-color)}.nmorph-tag-item.nmorph-tag-item--thin{--height: var(--thin-component)}.nmorph-tag-item.nmorph-tag-item--thin span{font-weight:400;font-size:var(--font-size-extra-small);line-height:var(--line-height-regular)}.nmorph-tag-item.nmorph-tag-item--thick{--height: var(--thick-component)}
1
+ .nmorph-tag-item{display:inline-flex;margin-right:var(--indentation-02);padding:var(--indentation-00) var(--indentation-03);color:var(--nmorph-text-color);border-radius:var(--default-border-radius);cursor:default}.nmorph-tag-item .nmorph-tag-item__content{display:flex;align-items:center;height:100%}.nmorph-tag-item span{color:inherit}.nmorph-tag-item .nmorph-tag-item__close-icon{margin-left:4px;cursor:pointer;--color: currentColor}.nmorph-tag-item.nmorph-tag-item--nmorph{background:var(--nmorph-main-color);border:none;box-shadow:inset var(--base-shadow-width) var(--base-shadow-width) var(--base-shadow-blur) var(--nmorph-dark-shade-color),inset calc(-1 * var(--base-shadow-width)) calc(-1 * var(--base-shadow-width)) var(--base-shadow-blur) var(--nmorph-light-shade-color)}.nmorph-tag-item.nmorph-tag-item--common{color:var(--tag-item-content-color);background:var(--tag-item-background-color);border:none;box-shadow:none}.nmorph-tag-item.nmorph-tag-item--thin{--height: var(--thin-component)}.nmorph-tag-item.nmorph-tag-item--thin span{font-weight:400;font-size:var(--font-size-extra-small);line-height:var(--line-height-regular)}.nmorph-tag-item.nmorph-tag-item--thick{--height: var(--thick-component)}
@@ -1,42 +1,45 @@
1
1
  import './NmorphTagItem.css';
2
2
  import n from "./NmorphTagItem.vue2.js";
3
- import { openBlock as e, createElementBlock as m, normalizeClass as a, createElementVNode as t, toDisplayString as c, createBlock as i, withModifiers as s, withCtx as l, createVNode as p, createCommentVNode as _ } from "vue";
3
+ import { openBlock as e, createElementBlock as a, normalizeStyle as c, normalizeClass as i, createElementVNode as t, toDisplayString as m, createBlock as l, withModifiers as s, withCtx as p, createVNode as d, createCommentVNode as _ } from "vue";
4
4
  /* empty css */
5
- import d from "../../../../../_virtual/_plugin-vue_export-helper.js";
6
- const f = { class: "nmorph-tag-item__content" };
7
- function h(g, N, r, o, k, v) {
8
- return e(), m(
5
+ import f from "../../../../../_virtual/_plugin-vue_export-helper.js";
6
+ const h = { class: "nmorph-tag-item__content" };
7
+ function g(k, N, r, o, y, v) {
8
+ return e(), a(
9
9
  "div",
10
10
  {
11
- class: a(o.modifiers)
11
+ ref: "tagRef",
12
+ class: i(o.modifiers),
13
+ style: c(o.styles),
14
+ onClick: o.clickHandler
12
15
  },
13
16
  [
14
- t("div", f, [
17
+ t("div", h, [
15
18
  t(
16
19
  "span",
17
20
  null,
18
- c(r.text),
21
+ m(r.text),
19
22
  1
20
23
  /* TEXT */
21
24
  ),
22
- o.props.removable ? (e(), i(o.NmorphIcon, {
25
+ o.props.removable ? (e(), l(o.NmorphIcon, {
23
26
  key: 0,
24
27
  class: "nmorph-tag-item__close-icon",
25
28
  onClick: s(o.closeHandler, ["stop"])
26
29
  }, {
27
- default: l(() => [
28
- p(o.NmorphIconError)
30
+ default: p(() => [
31
+ d(o.NmorphIconError)
29
32
  ]),
30
33
  _: 1
31
34
  /* STABLE */
32
35
  })) : _("v-if", !0)
33
36
  ])
34
37
  ],
35
- 2
36
- /* CLASS */
38
+ 6
39
+ /* CLASS, STYLE */
37
40
  );
38
41
  }
39
- const b = /* @__PURE__ */ d(n, [["render", h], ["__file", "/builds/ketjo/nmorph/library/src/components/data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue"]]);
42
+ const B = /* @__PURE__ */ f(n, [["render", g], ["__file", "/builds/ketjo/nmorph/library/src/components/data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue"]]);
40
43
  export {
41
- b as default
44
+ B as default
42
45
  };
@@ -1,36 +1,99 @@
1
1
  import './NmorphTagItem.css';
2
- import { defineComponent as i, computed as s } from "vue";
3
- import { useModifiers as u } from "../../../../../utils/create-modifiers.js";
4
- import { NmorphComponentHeight as a } from "../../../../../types/common.types.js";
5
- import l from "../../../../../assets/icons/error.svg.js";
6
- import d from "../../../../basic/nmorph-icon/NmorphIcon.vue.js";
7
- const N = /* @__PURE__ */ i({
2
+ import { defineComponent as x, ref as S, computed as h, onMounted as E, onBeforeUnmount as H, watch as B, nextTick as F } from "vue";
3
+ import { useModifiers as P } from "../../../../../utils/create-modifiers.js";
4
+ import { createCssVariables as U } from "../../../../../utils/common.js";
5
+ import { NmorphComponentHeight as $ } from "../../../../../types/common.types.js";
6
+ import z from "../../../../../assets/icons/error.svg.js";
7
+ import G from "../../../../basic/nmorph-icon/NmorphIcon.vue.js";
8
+ const w = "var(--nmorph-gray-color)", b = "var(--nmorph-black-color)", I = "var(--nmorph-white-color)", X = /* @__PURE__ */ x({
8
9
  __name: "NmorphTagItem",
9
10
  props: {
10
11
  value: { type: String, required: !0 },
11
12
  text: { type: String, required: !0 },
12
13
  removable: { type: Boolean, required: !1, default: !0 },
13
14
  height: { type: null, required: !1, default: "basic" },
14
- design: { type: String, required: !1, default: "nmorph" }
15
+ design: { type: String, required: !1, default: "nmorph" },
16
+ color: { type: String, required: !1, default: w }
15
17
  },
16
- emits: ["close"],
17
- setup(o, { expose: n, emit: m }) {
18
- n();
19
- const e = o, p = s(
20
- () => u({
21
- nmorph: [a[e.height]],
22
- "nmorph-tag-item": [`${e.design === "nmorph" ? "nmorph-design" : ""}`]
18
+ emits: ["click", "close"],
19
+ setup(L, { expose: T, emit: D }) {
20
+ T();
21
+ const C = { r: 201, g: 210, b: 222 }, s = L, i = S(null), p = S(b);
22
+ let u = null;
23
+ const V = h(
24
+ () => P({
25
+ nmorph: [$[s.height]],
26
+ "nmorph-tag-item": [s.design]
23
27
  })
24
- ), r = m, t = { props: e, modifiers: p, emit: r, closeHandler: () => {
25
- r("close", e.value);
26
- }, get NmorphIcon() {
27
- return d;
28
+ ), d = h(() => s.design === "common"), A = h(() => d.value ? U({
29
+ "--tag-item-background-color": s.color,
30
+ "--tag-item-content-color": p.value
31
+ }) : {}), g = D, M = () => {
32
+ g("close", s.value);
33
+ }, q = () => {
34
+ g("click", s.value);
35
+ }, v = (r) => {
36
+ const t = r.trim().replace("#", "");
37
+ if (![3, 4, 6, 8].includes(t.length)) return null;
38
+ const e = t.length <= 4 ? t.split("").map((o) => `${o}${o}`).join("") : t;
39
+ return {
40
+ r: parseInt(e.slice(0, 2), 16),
41
+ g: parseInt(e.slice(2, 4), 16),
42
+ b: parseInt(e.slice(4, 6), 16)
43
+ };
44
+ }, _ = (r) => {
45
+ const t = r.match(/^rgba?\((.+)\)$/);
46
+ if (!t) return null;
47
+ const e = t[1].split("/")[0], o = e.includes(",") ? e.split(",") : e.trim().split(/\s+/), [n, a, c] = o.map((l) => Number.parseFloat(l));
48
+ return [n, a, c].some((l) => Number.isNaN(l)) ? null : { r: n, g: a, b: c };
49
+ }, O = (r, t) => {
50
+ const e = r.trim().match(/^var\(\s*(--[A-Za-z0-9-_]+)(?:\s*,\s*(.+))?\)$/);
51
+ if (!e) return r;
52
+ const [, o, n] = e, a = t.ownerDocument, c = getComputedStyle(t).getPropertyValue(o).trim(), l = getComputedStyle(a.documentElement).getPropertyValue(o).trim();
53
+ return c || l || n || r;
54
+ }, y = (r, t) => {
55
+ let e = r;
56
+ for (let o = 0; o < 4; o += 1) {
57
+ const n = O(e, t);
58
+ if (n === e) break;
59
+ e = n;
60
+ }
61
+ return v(e) || _(e) || C;
62
+ }, N = ({ r, g: t, b: e }) => {
63
+ const [o, n, a] = [r, t, e].map((c) => {
64
+ const l = c / 255;
65
+ return l <= 0.03928 ? l / 12.92 : ((l + 0.055) / 1.055) ** 2.4;
66
+ });
67
+ return 0.2126 * o + 0.7152 * n + 0.0722 * a;
68
+ }, f = (r, t) => {
69
+ const [e, o] = [r, t].sort((n, a) => a - n);
70
+ return (e + 0.05) / (o + 0.05);
71
+ }, R = (r) => {
72
+ const t = N(r), e = f(t, 1), o = f(t, 0);
73
+ return e > o ? I : b;
74
+ }, m = async () => {
75
+ await F(), !(!d.value || !i.value) && (p.value = R(y(s.color, i.value)));
76
+ };
77
+ E(() => {
78
+ m(), !(typeof MutationObserver > "u" || !i.value) && (u = new MutationObserver(() => m()), u.observe(i.value.ownerDocument.documentElement, {
79
+ attributes: !0,
80
+ attributeFilter: ["nmorph-data-theme", "class", "style"]
81
+ }));
82
+ }), H(() => {
83
+ u?.disconnect();
84
+ }), B(() => [s.color, s.design], m, { flush: "post" });
85
+ const k = { DEFAULT_COMMON_BACKGROUND_COLOR: w, DARK_CONTRAST_COLOR: b, LIGHT_CONTRAST_COLOR: I, DEFAULT_RGB_COLOR: C, props: s, tagRef: i, commonContentColor: p, get themeObserver() {
86
+ return u;
87
+ }, set themeObserver(r) {
88
+ u = r;
89
+ }, modifiers: V, isCommonDesign: d, styles: A, emit: g, closeHandler: M, clickHandler: q, parseHexColor: v, parseRgbColor: _, resolveCssVariable: O, resolveColor: y, getLuminance: N, getContrastRatio: f, getReadableContentColor: R, updateCommonContentColor: m, get NmorphIcon() {
90
+ return G;
28
91
  }, get NmorphIconError() {
29
- return l;
92
+ return z;
30
93
  } };
31
- return Object.defineProperty(t, "__isScriptSetup", { enumerable: !1, value: !0 }), t;
94
+ return Object.defineProperty(k, "__isScriptSetup", { enumerable: !1, value: !0 }), k;
32
95
  }
33
96
  });
34
97
  export {
35
- N as default
98
+ X as default
36
99
  };
@@ -1 +1 @@
1
- .nmorph-text-input{--prepend-icon-indent: 8px;--prepend-icon-size: 14px;display:flex;flex:1 1 auto;flex-direction:column;align-items:flex-start;min-width:0}.nmorph-text-input__input-side{position:relative;display:flex;justify-content:flex-end;align-items:center;width:100%}.nmorph-text-input__prepend-icon{position:absolute;left:0;z-index:1;display:flex;justify-content:center;align-items:center;width:var(--prepend-icon-size);min-width:var(--prepend-icon-size);height:var(--prepend-icon-size);min-height:var(--prepend-icon-size);margin-left:var(--prepend-icon-indent);pointer-events:none}.nmorph-text-input__prepend-icon svg,.nmorph-text-input__prepend-icon .nmorph-icon,.nmorph-text-input__prepend-icon .nmorph-icon__content{width:100%;min-width:100%;height:100%;min-height:100%}.nmorph-text-input__prepend-icon svg{fill:var(--nmorph-text-color);stroke-width:0}.nmorph-text-input__prepend-icon path{stroke:var(--nmorph-text-color)}.nmorph-text-input input{width:100%;height:var(--height);text-indent:var(--nmorph-text-input-indentation);background:var(--nmorph-main-color);border:none;border-radius:var(--default-border-radius);box-shadow:var(--nmorph-shadow-inset)}.nmorph-text-input--with-action input{padding-right:calc(var(--height) + var(--indentation-03))}.nmorph-text-input input:focus{background:var(--nmorph-accent-color);outline:none;box-shadow:var(--nmorph-shadow-outset)}.nmorph-text-input.nmorph--focused .nmorph-text-input__prepend-icon svg{fill:var(--nmorph-focus-text-color)}.nmorph-text-input.nmorph--focused .nmorph-text-input__prepend-icon path{stroke:var(--nmorph-focus-text-color)}.nmorph-text-input input:-webkit-autofill,.nmorph-text-input input:-webkit-autofill:hover,.nmorph-text-input input:-webkit-autofill:active{caret-color:var(--nmorph-text-color);box-shadow:var(--nmorph-shadow-inset),inset 0 0 0 1000px var(--nmorph-main-color);-webkit-text-fill-color:var(--nmorph-text-color)}.nmorph-text-input input:-webkit-autofill:focus{caret-color:var(--nmorph-focus-text-color);outline:none;box-shadow:var(--nmorph-shadow-outset),inset 0 0 0 1000px var(--nmorph-accent-color);-webkit-text-fill-color:var(--nmorph-focus-text-color)}.nmorph-text-input input:disabled{cursor:not-allowed;opacity:.6}.nmorph-text-input__password-btn{position:absolute;right:0;height:100%}.nmorph-text-input__password-btn .nmorph-button__content{padding:var(--indentation-03)}.nmorph-text-input.nmorph-button.nmorph--thin-component .nmorph-text-input__password-btn{margin-top:var(--indentation-00)}.nmorph-text-input.nmorph-button.nmorph--thin-component .nmorph-text-input__password-btn .nmorph-button{--height: var(--thin-component)}.nmorph-text-input.nmorph-button.nmorph--focused .nmorph-text-input__password-btn .nmorph-icon{--color: var(--nmorph-white-color)}.nmorph-text-input.nmorph-button.nmorph--focused .nmorph-text-input__password-btn .nmorph-button:not(:disabled,[loading=true]):hover .nmorph-icon{--color: var(--nmorph-white-color)}
1
+ .nmorph-text-input{--prepend-icon-indent: 8px;--prepend-icon-size: 14px;--nmorph-text-input-prepend-icon-color: var(--nmorph-placeholder-text-color);display:flex;flex:1 1 auto;flex-direction:column;align-items:flex-start;min-width:0}.nmorph-text-input__input-side{position:relative;display:flex;justify-content:flex-end;align-items:center;width:100%}.nmorph-text-input__prepend-icon{position:absolute;left:0;z-index:1;display:flex;justify-content:center;align-items:center;width:var(--prepend-icon-size);min-width:var(--prepend-icon-size);height:var(--prepend-icon-size);min-height:var(--prepend-icon-size);margin-left:var(--prepend-icon-indent);color:var(--nmorph-text-input-prepend-icon-color);pointer-events:none}.nmorph-text-input__prepend-icon .nmorph-icon{--color: var(--nmorph-text-input-prepend-icon-color)}.nmorph-text-input__prepend-icon svg,.nmorph-text-input__prepend-icon .nmorph-icon,.nmorph-text-input__prepend-icon .nmorph-icon__content{width:100%;min-width:100%;height:100%;min-height:100%}.nmorph-text-input__prepend-icon svg{fill:var(--nmorph-text-input-prepend-icon-color);stroke-width:0}.nmorph-text-input__prepend-icon path{stroke:var(--nmorph-text-input-prepend-icon-color)}.nmorph-text-input input{width:100%;height:var(--height);text-indent:var(--nmorph-text-input-indentation);background:var(--nmorph-main-color);border:none;border-radius:var(--default-border-radius);box-shadow:var(--nmorph-shadow-inset)}.nmorph-text-input--with-action input{padding-right:calc(var(--height) + var(--indentation-03))}.nmorph-text-input input:focus{background:var(--nmorph-accent-color);outline:none;box-shadow:var(--nmorph-shadow-outset)}.nmorph-text-input.nmorph--focused{--nmorph-text-input-prepend-icon-color: var(--nmorph-focus-text-color)}.nmorph-text-input input:-webkit-autofill,.nmorph-text-input input:-webkit-autofill:hover,.nmorph-text-input input:-webkit-autofill:active{caret-color:var(--nmorph-text-color);box-shadow:var(--nmorph-shadow-inset),inset 0 0 0 1000px var(--nmorph-main-color);-webkit-text-fill-color:var(--nmorph-text-color)}.nmorph-text-input input:-webkit-autofill:focus{caret-color:var(--nmorph-focus-text-color);outline:none;box-shadow:var(--nmorph-shadow-outset),inset 0 0 0 1000px var(--nmorph-accent-color);-webkit-text-fill-color:var(--nmorph-focus-text-color)}.nmorph-text-input input:disabled{cursor:not-allowed;opacity:.6}.nmorph-text-input__password-btn{position:absolute;right:0;height:100%}.nmorph-text-input__password-btn .nmorph-button__content{padding:var(--indentation-03)}.nmorph-text-input.nmorph-button.nmorph--thin-component .nmorph-text-input__password-btn{margin-top:var(--indentation-00)}.nmorph-text-input.nmorph-button.nmorph--thin-component .nmorph-text-input__password-btn .nmorph-button{--height: var(--thin-component)}.nmorph-text-input.nmorph-button.nmorph--focused .nmorph-text-input__password-btn .nmorph-icon{--color: var(--nmorph-white-color)}.nmorph-text-input.nmorph-button.nmorph--focused .nmorph-text-input__password-btn .nmorph-button:not(:disabled,[loading=true]):hover .nmorph-icon{--color: var(--nmorph-white-color)}
@@ -1,24 +1,29 @@
1
1
  import './NmorphContextMenu.css';
2
2
  import s from "./NmorphContextMenu.vue2.js";
3
- import { openBlock as o, createElementBlock as l, renderSlot as i, createBlock as d, withCtx as p, Fragment as c, renderList as h, normalizeStyle as m, createElementVNode as f, toDisplayString as _, normalizeClass as y, resolveDynamicComponent as x, mergeProps as k, createCommentVNode as w } from "vue";
3
+ import { openBlock as o, createElementBlock as r, renderSlot as a, createBlock as d, withCtx as p, Fragment as c, renderList as h, normalizeStyle as m, createElementVNode as f, toDisplayString as _, normalizeClass as y, resolveDynamicComponent as w, mergeProps as x, createCommentVNode as k } from "vue";
4
4
  /* empty css */
5
5
  import b from "../../../_virtual/_plugin-vue_export-helper.js";
6
- const C = {
6
+ const v = {
7
7
  key: 0,
8
8
  class: "nmorph-context-menu__options"
9
- }, v = ["disabled", "onClick"], O = { class: "nmorph-context-menu__item-label" }, g = ["tabindex", "aria-disabled", "onClick", "onKeydown"];
10
- function H(a, u, z, e, E, S) {
11
- return o(), l(
9
+ }, C = ["disabled", "onClick"], H = { class: "nmorph-context-menu__item-label" }, O = ["tabindex", "aria-disabled", "onClick", "onKeydown"];
10
+ function E(i, g, P, e, z, S) {
11
+ return o(), r(
12
12
  "div",
13
13
  {
14
14
  ref: "triggerDOMRef",
15
15
  class: "nmorph-context-menu",
16
16
  onClick: e.clickHandler,
17
17
  onContextmenu: e.contextMenuHandler,
18
- onKeydown: e.keydownHandler
18
+ onKeydown: e.keydownHandler,
19
+ onPointerdown: e.pointerDownHandler,
20
+ onPointermove: e.pointerMoveHandler,
21
+ onPointerup: e.pointerEndHandler,
22
+ onPointercancel: e.pointerEndHandler,
23
+ onPointerleave: e.pointerEndHandler
19
24
  },
20
25
  [
21
- i(a.$slots, "default"),
26
+ a(i.$slots, "default"),
22
27
  e.relativeElement ? (o(), d(e.NmorphDropdown, {
23
28
  key: 0,
24
29
  open: e.isOpen,
@@ -41,50 +46,50 @@ function H(a, u, z, e, E, S) {
41
46
  onOnEscapeKeydown: e.escapeHandler
42
47
  }, {
43
48
  default: p(() => [
44
- e.hasOptions ? (o(), l("div", C, [
45
- (o(!0), l(
49
+ e.hasOptions ? (o(), r("div", v, [
50
+ (o(!0), r(
46
51
  c,
47
52
  null,
48
- h(e.normalizedOptions, (n, r) => (o(), l(
53
+ h(e.normalizedOptions, (n, l) => (o(), r(
49
54
  c,
50
55
  {
51
56
  key: n.key
52
57
  },
53
58
  [
54
- n.component ? (o(), l("div", {
59
+ n.component ? (o(), r("div", {
55
60
  key: 1,
56
61
  class: y(["nmorph-context-menu__item", { "nmorph-context-menu__item--disabled": n.disabled }]),
57
62
  role: "menuitem",
58
63
  tabindex: n.disabled ? -1 : 0,
59
64
  "aria-disabled": n.disabled,
60
65
  style: m(e.getOptionStyle(n)),
61
- onClick: (t) => e.optionClickHandler(n, r),
62
- onKeydown: (t) => e.optionKeydownHandler(t, n, r)
66
+ onClick: (t) => e.optionClickHandler(n, l),
67
+ onKeydown: (t) => e.optionKeydownHandler(t, n, l)
63
68
  }, [
64
69
  (o(), d(
65
- x(n.component),
66
- k({ ref_for: !0 }, n.componentProps),
70
+ w(n.component),
71
+ x({ ref_for: !0 }, n.componentProps),
67
72
  null,
68
73
  16
69
74
  /* FULL_PROPS */
70
75
  ))
71
- ], 46, g)) : (o(), l("button", {
76
+ ], 46, O)) : (o(), r("button", {
72
77
  key: 0,
73
78
  type: "button",
74
79
  class: "nmorph-context-menu__item",
75
80
  role: "menuitem",
76
81
  disabled: n.disabled,
77
82
  style: m(e.getOptionStyle(n)),
78
- onClick: (t) => e.optionClickHandler(n, r)
83
+ onClick: (t) => e.optionClickHandler(n, l)
79
84
  }, [
80
85
  f(
81
86
  "span",
82
- O,
87
+ H,
83
88
  _(n.label),
84
89
  1
85
90
  /* TEXT */
86
91
  )
87
- ], 12, v))
92
+ ], 12, C))
88
93
  ],
89
94
  64
90
95
  /* STABLE_FRAGMENT */
@@ -92,20 +97,20 @@ function H(a, u, z, e, E, S) {
92
97
  128
93
98
  /* KEYED_FRAGMENT */
94
99
  ))
95
- ])) : i(a.$slots, "menu", {
100
+ ])) : a(i.$slots, "menu", {
96
101
  key: 1,
97
102
  close: e.close
98
103
  })
99
104
  ]),
100
105
  _: 3
101
106
  /* FORWARDED */
102
- }, 8, ["open", "relative-element", "placement", "width", "min-width", "max-width", "x-offset", "y-offset", "fill-width", "z-index", "close-on-escape", "trap-focus", "role", "aria-label", "hide-shadow"])) : w("v-if", !0)
107
+ }, 8, ["open", "relative-element", "placement", "width", "min-width", "max-width", "x-offset", "y-offset", "fill-width", "z-index", "close-on-escape", "trap-focus", "role", "aria-label", "hide-shadow"])) : k("v-if", !0)
103
108
  ],
104
109
  544
105
110
  /* NEED_HYDRATION, NEED_PATCH */
106
111
  );
107
112
  }
108
- const B = /* @__PURE__ */ b(s, [["render", H], ["__file", "/builds/ketjo/nmorph/library/src/components/navigation/nmorph-context-menu/NmorphContextMenu.vue"]]);
113
+ const B = /* @__PURE__ */ b(s, [["render", E], ["__file", "/builds/ketjo/nmorph/library/src/components/navigation/nmorph-context-menu/NmorphContextMenu.vue"]]);
109
114
  export {
110
115
  B as default
111
116
  };
@@ -1,7 +1,7 @@
1
1
  import './NmorphContextMenu.css';
2
- import { defineComponent as L, ref as i, computed as y, markRaw as M, toRaw as D, watch as k, onBeforeUnmount as V } from "vue";
3
- import P from "../nmorph-dropdown/NmorphDropdown.vue.js";
4
- const $ = /* @__PURE__ */ L({
2
+ import { defineComponent as J, ref as n, computed as m, markRaw as U, toRaw as Q, watch as H, onBeforeUnmount as Z } from "vue";
3
+ import ee from "../nmorph-dropdown/NmorphDropdown.vue.js";
4
+ const M = 600, _ = 8, re = /* @__PURE__ */ J({
5
5
  __name: "NmorphContextMenu",
6
6
  props: {
7
7
  modelValue: { type: [Boolean, null], required: !1, default: null },
@@ -24,8 +24,8 @@ const $ = /* @__PURE__ */ L({
24
24
  hideShadow: { type: Boolean, required: !1, default: !1 }
25
25
  },
26
26
  emits: ["update:model-value", "open", "close", "select", "on-outside-click", "on-escape-keydown"],
27
- setup(q, { expose: O, emit: v }) {
28
- const l = q, r = v, d = i(null), c = i(null), o = i("point"), a = i(!!l.modelValue), f = y(() => typeof l.modelValue == "boolean" ? l.modelValue : a.value), S = y(() => l.options.length > 0), B = y(
27
+ setup(B, { expose: D, emit: R }) {
28
+ const l = B, o = R, g = n(null), S = n(null), y = n("point"), b = n(!!l.modelValue), a = n(null), c = n(null), u = n(null), v = n(!1), d = n(null), w = m(() => typeof l.modelValue == "boolean" ? l.modelValue : b.value), I = m(() => l.options.length > 0), q = m(() => l.trigger === "longpress"), T = m(() => l.trigger === "contextmenu" || l.trigger === "both"), X = m(
29
29
  () => l.options.map((e, t) => typeof e == "string" || typeof e == "number" ? {
30
30
  key: `${e}-${t}`,
31
31
  label: e,
@@ -37,7 +37,7 @@ const $ = /* @__PURE__ */ L({
37
37
  key: `${String(e.value ?? e.label ?? t)}-${t}`,
38
38
  label: e.label,
39
39
  value: e.value ?? e.label ?? t,
40
- component: e.component ? M(D(e.component)) : void 0,
40
+ component: e.component ? U(Q(e.component)) : void 0,
41
41
  componentProps: e.componentProps,
42
42
  disabled: !!e.disabled,
43
43
  color: e.color,
@@ -45,13 +45,13 @@ const $ = /* @__PURE__ */ L({
45
45
  raw: e
46
46
  })
47
47
  );
48
- k(
48
+ H(
49
49
  () => l.modelValue,
50
50
  (e) => {
51
- typeof e == "boolean" && (a.value = e);
51
+ typeof e == "boolean" && (b.value = e);
52
52
  }
53
53
  );
54
- const g = (e, t) => ({
54
+ const x = (e, t) => ({
55
55
  clientWidth: 0,
56
56
  getBoundingClientRect: () => ({
57
57
  x: e,
@@ -64,51 +64,86 @@ const $ = /* @__PURE__ */ L({
64
64
  bottom: t,
65
65
  toJSON: () => ({})
66
66
  })
67
- }), u = (e) => {
68
- const t = f.value;
69
- a.value = e, r("update:model-value", e), t && !e && r("close");
70
- }, n = () => {
71
- u(!1);
72
- }, b = (e, t, m) => {
73
- o.value = "point", c.value = g(e, t), u(!0), r("open", m);
74
- }, p = (e, t) => {
75
- o.value = "element", c.value = e, u(!0), r("open", t);
67
+ }), h = (e) => {
68
+ const t = w.value;
69
+ b.value = e, o("update:model-value", e), t && !e && o("close");
70
+ }, i = () => {
71
+ h(!1);
72
+ }, f = (e, t, r) => {
73
+ l.disabled || (y.value = "point", S.value = x(e, t), h(!0), o("open", r));
74
+ }, k = (e, t) => {
75
+ l.disabled || (y.value = "element", S.value = e, h(!0), o("open", t));
76
+ }, Y = (e) => {
77
+ if (!l.disabled) {
78
+ if (l.trigger === "longpress") {
79
+ e.preventDefault();
80
+ return;
81
+ }
82
+ T.value && (e.preventDefault(), f(e.clientX, e.clientY, e));
83
+ }
76
84
  }, C = (e) => {
77
- l.disabled || l.trigger !== "contextmenu" && l.trigger !== "both" || (e.preventDefault(), b(e.clientX, e.clientY, e));
85
+ const t = g.value;
86
+ if (!t) return !1;
87
+ if (e.target instanceof Node && t.contains(e.target)) return !0;
88
+ const r = t.getBoundingClientRect();
89
+ return e.clientX >= r.left && e.clientX <= r.right && e.clientY >= r.top && e.clientY <= r.bottom;
78
90
  }, E = (e) => {
91
+ !w.value || l.disabled || !T.value || C(e) && (e.preventDefault(), e.stopPropagation(), f(e.clientX, e.clientY, e));
92
+ }, V = (e) => {
93
+ if (v.value) {
94
+ p(), e.preventDefault();
95
+ return;
96
+ }
79
97
  if (l.disabled || l.trigger !== "click" && l.trigger !== "both" || e.button !== 0) return;
80
- const t = e.currentTarget instanceof HTMLElement ? e.currentTarget : d.value;
81
- t && p(t, e);
82
- }, H = (e) => {
83
- if (l.disabled || e.key !== "ContextMenu" && !(e.shiftKey && e.key === "F10")) return;
84
- const t = e.target instanceof HTMLElement ? e.target : d.value;
85
- t && (e.preventDefault(), p(t, e));
86
- }, _ = () => {
87
- r("on-outside-click"), n();
88
- }, N = () => {
89
- r("on-escape-keydown"), n();
90
- }, w = (e, t) => {
91
- e.disabled || (r("select", e.raw, t), e.closeOnClick && n());
92
- }, x = (e, t, m) => {
93
- e.key !== "Enter" && e.key !== " " || (e.preventDefault(), w(t, m));
94
- }, T = (e) => ({
98
+ const t = e.currentTarget instanceof HTMLElement ? e.currentTarget : g.value;
99
+ t && k(t, e);
100
+ }, A = (e) => {
101
+ if (l.disabled || l.trigger === "manual" || e.key !== "ContextMenu" && !(e.shiftKey && e.key === "F10"))
102
+ return;
103
+ const t = e.target instanceof HTMLElement ? e.target : g.value;
104
+ t && (e.preventDefault(), k(t, e));
105
+ }, W = () => {
106
+ o("on-outside-click"), i();
107
+ }, $ = () => {
108
+ o("on-escape-keydown"), i();
109
+ }, N = (e, t) => {
110
+ e.disabled || (o("select", e.raw, t), e.closeOnClick && i());
111
+ }, z = (e, t, r) => {
112
+ e.key !== "Enter" && e.key !== " " || (e.preventDefault(), N(t, r));
113
+ }, s = () => {
114
+ a.value && clearTimeout(a.value), a.value = null, c.value = null, u.value = null;
115
+ }, p = () => {
116
+ d.value && clearTimeout(d.value), v.value = !1, d.value = null;
117
+ }, L = () => {
118
+ p(), v.value = !0, d.value = setTimeout(p, 700);
119
+ }, F = (e) => {
120
+ l.disabled || !q.value || e.pointerType !== "touch" && e.pointerType !== "pen" || (s(), c.value = e.pointerId, u.value = { x: e.clientX, y: e.clientY }, a.value = setTimeout(() => {
121
+ L(), s(), f(e.clientX, e.clientY, e);
122
+ }, M));
123
+ }, G = (e) => {
124
+ if (!a.value || c.value !== e.pointerId || !u.value) return;
125
+ const t = Math.abs(e.clientX - u.value.x), r = Math.abs(e.clientY - u.value.y);
126
+ (t > _ || r > _) && s();
127
+ }, K = (e) => {
128
+ c.value === e.pointerId && s();
129
+ }, j = (e) => ({
95
130
  "--nmorph-context-menu-item-color": e.color
96
- }), s = () => {
97
- l.closeOnScroll && o.value === "point" && n();
131
+ }), O = () => {
132
+ l.closeOnScroll && y.value === "point" && i();
98
133
  };
99
- k(
100
- f,
134
+ H(
135
+ w,
101
136
  (e) => {
102
- typeof window > "u" || (e ? window.addEventListener("scroll", s, { passive: !0, capture: !0 }) : window.removeEventListener("scroll", s, !0));
137
+ typeof window > "u" || (e ? (window.addEventListener("scroll", O, { passive: !0, capture: !0 }), document.addEventListener("contextmenu", E, !0)) : (window.removeEventListener("scroll", O, !0), document.removeEventListener("contextmenu", E, !0)));
103
138
  },
104
139
  { immediate: !0 }
105
- ), V(() => {
106
- typeof window < "u" && window.removeEventListener("scroll", s, !0);
107
- }), O({ close: n });
108
- const h = { props: l, emit: r, triggerDOMRef: d, relativeElement: c, anchorType: o, openState: a, isOpen: f, hasOptions: S, normalizedOptions: B, createPointElement: g, setOpen: u, close: n, openAt: b, openAtElement: p, contextMenuHandler: C, clickHandler: E, keydownHandler: H, outsideClickHandler: _, escapeHandler: N, optionClickHandler: w, optionKeydownHandler: x, getOptionStyle: T, scrollHandler: s, NmorphDropdown: P };
109
- return Object.defineProperty(h, "__isScriptSetup", { enumerable: !1, value: !0 }), h;
140
+ ), Z(() => {
141
+ typeof window < "u" && window.removeEventListener("scroll", O, !0), typeof document < "u" && document.removeEventListener("contextmenu", E, !0), s(), p();
142
+ }), D({ close: i, openAt: f, openAtElement: k });
143
+ const P = { LONG_PRESS_DELAY_IN_MS: M, LONG_PRESS_MOVE_TOLERANCE_IN_PX: _, props: l, emit: o, triggerDOMRef: g, relativeElement: S, anchorType: y, openState: b, longPressTimer: a, longPressPointerId: c, longPressStartPoint: u, suppressNextClick: v, suppressNextClickTimer: d, isOpen: w, hasOptions: I, isLongPressTrigger: q, isContextMenuTrigger: T, normalizedOptions: X, createPointElement: x, setOpen: h, close: i, openAt: f, openAtElement: k, contextMenuHandler: Y, isEventInsideTrigger: C, documentContextMenuHandler: E, clickHandler: V, keydownHandler: A, outsideClickHandler: W, escapeHandler: $, optionClickHandler: N, optionKeydownHandler: z, clearLongPressTimer: s, clearClickSuppression: p, suppressNextClickTemporarily: L, pointerDownHandler: F, pointerMoveHandler: G, pointerEndHandler: K, getOptionStyle: j, scrollHandler: O, NmorphDropdown: ee };
144
+ return Object.defineProperty(P, "__isScriptSetup", { enumerable: !1, value: !0 }), P;
110
145
  }
111
146
  });
112
147
  export {
113
- $ as default
148
+ re as default
114
149
  };