@nmorph/nmorph-ui-kit 2.2.40 → 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.
@@ -0,0 +1 @@
1
+ .nmorph-list--common .nmorph-tag-item--common{border:none}
@@ -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 l, Fragment as s, renderList as a, 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: l(r.modifiers)
10
+ class: t(r.modifiers)
9
11
  },
10
12
  [
11
- (e(!0), t(
12
- s,
13
+ (e(!0), l(
14
+ a,
13
15
  null,
14
- a(r.resolvedTagList, (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 v = /* @__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
- v as default
38
+ L as default
34
39
  };
@@ -1,36 +1,42 @@
1
- import { defineComponent as d, computed as a, ref as c } from "vue";
1
+ import './NmorphTagList.css';
2
+ import { defineComponent as p, computed as s, ref as m } from "vue";
2
3
  import { useModifiers as g } from "../../../utils/create-modifiers.js";
3
4
  import f from "./components/nmorph-tag-item/NmorphTagItem.vue.js";
4
- const L = /* @__PURE__ */ d({
5
+ const L = /* @__PURE__ */ p({
5
6
  __name: "NmorphTagList",
6
7
  props: {
7
8
  modelValue: { type: Array, required: !0 },
8
- design: { type: String, required: !1, default: "nmorph" }
9
+ selectedValue: { type: [String, null], required: !1 },
10
+ design: { type: String, required: !1, default: "nmorph" },
11
+ color: { type: String, required: !1 }
9
12
  },
10
- emits: ["close", "update:model-value"],
11
- setup(i, { expose: l, emit: m }) {
12
- l();
13
- const r = i, o = m, n = a(
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(
14
17
  () => g({
15
- "nmorph-list": []
18
+ "nmorph-list": [l.design]
16
19
  })
17
20
  );
18
- let t = c(r.modelValue);
19
- const u = a(
20
- () => t.value.map((e) => ({
21
+ let r = m(l.modelValue);
22
+ const n = s(
23
+ () => r.value.map((e) => ({
21
24
  ...e,
22
- design: e.design ?? r.design
25
+ design: e.design ?? l.design,
26
+ color: e.color ?? l.color
23
27
  }))
24
- ), s = { props: r, emit: o, modifiers: n, get tagList() {
25
- return t;
28
+ ), o = { props: l, emit: t, modifiers: u, get tagList() {
29
+ return r;
26
30
  }, set tagList(e) {
27
- t = e;
28
- }, resolvedTagList: u, closeTagHandler: (e) => {
29
- t.value = t.value.filter((p) => p.value !== e), o("close", e), o("update:model-value", t.value);
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);
30
36
  }, get NmorphTagItem() {
31
37
  return f;
32
38
  } };
33
- return Object.defineProperty(s, "__isScriptSetup", { enumerable: !1, value: !0 }), s;
39
+ return Object.defineProperty(o, "__isScriptSetup", { enumerable: !1, value: !0 }), o;
34
40
  }
35
41
  });
36
42
  export {
@@ -1 +1 @@
1
- .nmorph-tag-item{display:inline-flex;margin-right:var(--indentation-02);padding:var(--indentation-00) var(--indentation-03);color:var(--nmorph-tag-item-content-color, var(--nmorph-tag-item-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: var(--nmorph-tag-item-content-color, var(--nmorph-tag-item-color, var(--nmorph-text-color)))}.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{--nmorph-tag-item-content-color: var(--nmorph-tag-item-color, var(--nmorph-contrast-text-color));background:var(--nmorph-tag-item-background, var(--nmorph-gray-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
+ .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 p, 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 c from "../../../../basic/nmorph-icon/NmorphIcon.vue.js";
7
- const N = /* @__PURE__ */ p({
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: i }) {
18
- n();
19
- const e = o, m = s(
20
- () => u({
21
- nmorph: [a[e.height]],
22
- "nmorph-tag-item": [e.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 = i, t = { props: e, modifiers: m, emit: r, closeHandler: () => {
25
- r("close", e.value);
26
- }, get NmorphIcon() {
27
- return c;
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,7 +1,7 @@
1
1
  import './NmorphContextMenu.css';
2
- import { defineComponent as j, ref as r, computed as m, markRaw as J, toRaw as U, watch as P, onBeforeUnmount as Q } from "vue";
3
- import Z from "../nmorph-dropdown/NmorphDropdown.vue.js";
4
- const H = 600, _ = 8, le = /* @__PURE__ */ j({
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 H = 600, _ = 8, le = /* @__PURE__ */ j({
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(M, { expose: D, emit: B }) {
28
- const l = M, n = B, S = r(null), E = r(null), g = r("point"), y = r(!!l.modelValue), o = r(null), i = r(null), a = r(null), b = r(!1), c = r(null), v = m(() => typeof l.modelValue == "boolean" ? l.modelValue : y.value), I = m(() => l.options.length > 0), q = m(() => l.trigger === "longpress"), T = m(() => l.trigger === "contextmenu" || l.trigger === "both"), R = m(
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 H = 600, _ = 8, le = /* @__PURE__ */ j({
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 ? J(U(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,10 +45,10 @@ const H = 600, _ = 8, le = /* @__PURE__ */ j({
45
45
  raw: e
46
46
  })
47
47
  );
48
- P(
48
+ H(
49
49
  () => l.modelValue,
50
50
  (e) => {
51
- typeof e == "boolean" && (y.value = e);
51
+ typeof e == "boolean" && (b.value = e);
52
52
  }
53
53
  );
54
54
  const x = (e, t) => ({
@@ -64,80 +64,86 @@ const H = 600, _ = 8, le = /* @__PURE__ */ j({
64
64
  bottom: t,
65
65
  toJSON: () => ({})
66
66
  })
67
- }), w = (e) => {
68
- const t = v.value;
69
- y.value = e, n("update:model-value", e), t && !e && n("close");
70
- }, u = () => {
71
- w(!1);
72
- }, d = (e, t, p) => {
73
- l.disabled || (g.value = "point", E.value = x(e, t), w(!0), n("open", p));
74
- }, h = (e, t) => {
75
- l.disabled || (g.value = "element", E.value = e, w(!0), n("open", t));
76
- }, V = (e) => {
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
77
  if (!l.disabled) {
78
78
  if (l.trigger === "longpress") {
79
79
  e.preventDefault();
80
80
  return;
81
81
  }
82
- T.value && (e.preventDefault(), d(e.clientX, e.clientY, e));
82
+ T.value && (e.preventDefault(), f(e.clientX, e.clientY, e));
83
83
  }
84
- }, k = (e) => {
85
- !v.value || l.disabled || !T.value || (e.preventDefault(), e.stopPropagation(), d(e.clientX, e.clientY, e));
86
- }, X = (e) => {
87
- if (b.value) {
88
- f(), e.preventDefault();
84
+ }, C = (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;
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();
89
95
  return;
90
96
  }
91
97
  if (l.disabled || l.trigger !== "click" && l.trigger !== "both" || e.button !== 0) return;
92
- const t = e.currentTarget instanceof HTMLElement ? e.currentTarget : S.value;
93
- t && h(t, e);
94
- }, Y = (e) => {
98
+ const t = e.currentTarget instanceof HTMLElement ? e.currentTarget : g.value;
99
+ t && k(t, e);
100
+ }, A = (e) => {
95
101
  if (l.disabled || l.trigger === "manual" || e.key !== "ContextMenu" && !(e.shiftKey && e.key === "F10"))
96
102
  return;
97
- const t = e.target instanceof HTMLElement ? e.target : S.value;
98
- t && (e.preventDefault(), h(t, e));
99
- }, A = () => {
100
- n("on-outside-click"), u();
103
+ const t = e.target instanceof HTMLElement ? e.target : g.value;
104
+ t && (e.preventDefault(), k(t, e));
101
105
  }, W = () => {
102
- n("on-escape-keydown"), u();
103
- }, C = (e, t) => {
104
- e.disabled || (n("select", e.raw, t), e.closeOnClick && u());
105
- }, $ = (e, t, p) => {
106
- e.key !== "Enter" && e.key !== " " || (e.preventDefault(), C(t, p));
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));
107
113
  }, s = () => {
108
- o.value && clearTimeout(o.value), o.value = null, i.value = null, a.value = null;
109
- }, f = () => {
110
- c.value && clearTimeout(c.value), b.value = !1, c.value = null;
111
- }, N = () => {
112
- f(), b.value = !0, c.value = setTimeout(f, 700);
113
- }, z = (e) => {
114
- l.disabled || !q.value || e.pointerType !== "touch" && e.pointerType !== "pen" || (s(), i.value = e.pointerId, a.value = { x: e.clientX, y: e.clientY }, o.value = setTimeout(() => {
115
- N(), s(), d(e.clientX, e.clientY, e);
116
- }, H));
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);
117
119
  }, F = (e) => {
118
- if (!o.value || i.value !== e.pointerId || !a.value) return;
119
- const t = Math.abs(e.clientX - a.value.x), p = Math.abs(e.clientY - a.value.y);
120
- (t > _ || p > _) && s();
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));
121
123
  }, G = (e) => {
122
- i.value === e.pointerId && s();
123
- }, K = (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) => ({
124
130
  "--nmorph-context-menu-item-color": e.color
125
131
  }), O = () => {
126
- l.closeOnScroll && g.value === "point" && u();
132
+ l.closeOnScroll && y.value === "point" && i();
127
133
  };
128
- P(
129
- v,
134
+ H(
135
+ w,
130
136
  (e) => {
131
- typeof window > "u" || (e ? (window.addEventListener("scroll", O, { passive: !0, capture: !0 }), document.addEventListener("contextmenu", k, !0)) : (window.removeEventListener("scroll", O, !0), document.removeEventListener("contextmenu", k, !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)));
132
138
  },
133
139
  { immediate: !0 }
134
- ), Q(() => {
135
- typeof window < "u" && window.removeEventListener("scroll", O, !0), typeof document < "u" && document.removeEventListener("contextmenu", k, !0), s(), f();
136
- }), D({ close: u, openAt: d, openAtElement: h });
137
- const L = { LONG_PRESS_DELAY_IN_MS: H, LONG_PRESS_MOVE_TOLERANCE_IN_PX: _, props: l, emit: n, triggerDOMRef: S, relativeElement: E, anchorType: g, openState: y, longPressTimer: o, longPressPointerId: i, longPressStartPoint: a, suppressNextClick: b, suppressNextClickTimer: c, isOpen: v, hasOptions: I, isLongPressTrigger: q, isContextMenuTrigger: T, normalizedOptions: R, createPointElement: x, setOpen: w, close: u, openAt: d, openAtElement: h, contextMenuHandler: V, documentContextMenuHandler: k, clickHandler: X, keydownHandler: Y, outsideClickHandler: A, escapeHandler: W, optionClickHandler: C, optionKeydownHandler: $, clearLongPressTimer: s, clearClickSuppression: f, suppressNextClickTemporarily: N, pointerDownHandler: z, pointerMoveHandler: F, pointerEndHandler: G, getOptionStyle: K, scrollHandler: O, NmorphDropdown: Z };
138
- return Object.defineProperty(L, "__isScriptSetup", { enumerable: !1, value: !0 }), L;
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;
139
145
  }
140
146
  });
141
147
  export {
142
- le as default
148
+ re as default
143
149
  };