@nmorph/nmorph-ui-kit 2.2.34 → 2.2.35

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 (31) hide show
  1. package/dist/assets/icons/pin.svg.js +21 -0
  2. package/dist/components/basic/nmorph-icon/NmorphIcons.js +209 -207
  3. package/dist/components/data/nmorph-empty/NmorphEmpty.css +1 -1
  4. package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.css +1 -1
  5. package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.vue.js +20 -17
  6. package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.vue2.js +63 -54
  7. package/dist/components/form/nmorph-file-upload/NmorphFileUpload.vue.js +34 -30
  8. package/dist/components/form/nmorph-file-upload/NmorphFileUpload.vue2.js +94 -62
  9. package/dist/components/form/nmorph-select/NmorphSelect.vue2.js +52 -52
  10. package/dist/components/form/nmorph-select/components/nmorph-select-option/NmorphSelectOption.vue2.js +24 -21
  11. package/dist/components/form/nmorph-time-picker/NmorphTimePicker.css +1 -1
  12. package/dist/components/form/nmorph-time-picker/NmorphTimePicker.vue.js +40 -31
  13. package/dist/components/form/nmorph-time-picker/NmorphTimePicker.vue2.js +45 -41
  14. package/dist/components/navigation/nmorph-backtop/NmorphBacktop.vue.js +20 -25
  15. package/dist/components/navigation/nmorph-backtop/NmorphBacktop.vue2.js +25 -21
  16. package/dist/components/navigation/nmorph-context-menu/NmorphContextMenu.vue.js +11 -10
  17. package/dist/components/navigation/nmorph-context-menu/NmorphContextMenu.vue2.js +10 -9
  18. package/dist/components/navigation/nmorph-dropdown/NmorphDropdown.css +1 -1
  19. package/dist/components/navigation/nmorph-dropdown/NmorphDropdown.vue2.js +13 -12
  20. package/dist/hooks/use-common-styles.js +2 -1
  21. package/dist/icons.js +209 -207
  22. package/dist/index.es.js +331 -329
  23. package/dist/index.umd.js +31 -30
  24. package/dist/package.json.js +1 -1
  25. package/dist/src/components/basic/nmorph-icon/NmorphIcons.d.ts +1 -0
  26. package/dist/src/components/form/nmorph-file-upload/NmorphFileUpload.vue.d.ts +2 -2
  27. package/dist/src/components/form/nmorph-select/components/nmorph-select-option/NmorphSelectOption.vue.d.ts +0 -1
  28. package/dist/src/components/navigation/nmorph-context-menu/NmorphContextMenu.vue.d.ts +2 -0
  29. package/dist/src/components/navigation/nmorph-dropdown/NmorphDropdown.vue.d.ts +2 -0
  30. package/dist/style.css +1 -1
  31. package/package.json +1 -1
@@ -1,13 +1,14 @@
1
1
  import './NmorphAutocomplete.css';
2
- import { defineComponent as P, ref as s, computed as l, watch as c, nextTick as Y } from "vue";
3
- import { useModifiers as G } from "../../../utils/create-modifiers.js";
4
- import { useVirtualList as J } from "../../../hooks/use-virtual-list.js";
5
- import { useZIndex as K } from "../../../hooks/use-z-index.js";
6
- import Q from "../nmorph-text-input/NmorphTextInput.vue.js";
7
- import W from "../../navigation/nmorph-dropdown/NmorphDropdown.vue.js";
8
- import X from "../../basic/nmorph-icon/NmorphIcon.vue.js";
9
- import ee from "../../../assets/icons/loader.svg.js";
10
- const se = /* @__PURE__ */ P({
2
+ import { defineComponent as J, ref as s, computed as a, watch as c, nextTick as K } from "vue";
3
+ import { useModifiers as _ } from "../../../utils/create-modifiers.js";
4
+ import { NmorphComponentHeight as Q } from "../../../types/index.js";
5
+ import { useVirtualList as W } from "../../../hooks/use-virtual-list.js";
6
+ import { useZIndex as X } from "../../../hooks/use-z-index.js";
7
+ import ee from "../nmorph-text-input/NmorphTextInput.vue.js";
8
+ import te from "../../navigation/nmorph-dropdown/NmorphDropdown.vue.js";
9
+ import ae from "../../basic/nmorph-icon/NmorphIcon.vue.js";
10
+ import le from "../../../assets/icons/loader.svg.js";
11
+ const fe = /* @__PURE__ */ J({
11
12
  __name: "NmorphAutocomplete",
12
13
  props: {
13
14
  modelValue: { type: String, required: !1, default: "" },
@@ -17,7 +18,7 @@ const se = /* @__PURE__ */ P({
17
18
  actionCallback: { type: Function, required: !1, default: void 0 },
18
19
  zIndex: { type: Number, required: !1, default: void 0 },
19
20
  virtual: { type: Boolean, required: !1, default: !1 },
20
- virtualItemHeight: { type: Number, required: !1, default: 34 },
21
+ virtualItemHeight: { type: Number, required: !1, default: void 0 },
21
22
  virtualMaxHeight: { type: [Number, String], required: !1, default: 240 },
22
23
  virtualOverscan: { type: Number, required: !1, default: 5 },
23
24
  virtualDynamicHeight: { type: Boolean, required: !1, default: !1 },
@@ -29,81 +30,89 @@ const se = /* @__PURE__ */ P({
29
30
  tabindex: { type: Number, required: !1 }
30
31
  },
31
32
  emits: ["update:model-value", "select"],
32
- setup(_, { expose: C, emit: $ }) {
33
- C();
34
- const t = _, u = s(t.modelValue), d = $, L = l(
35
- () => G({
36
- "nmorph-autocomplete": [`${a.value && "open"}`]
33
+ setup(M, { expose: O, emit: $ }) {
34
+ O();
35
+ const t = M, o = s(t.modelValue), d = $, L = a(
36
+ () => _({
37
+ "nmorph-autocomplete": [`${l.value && "open"}`]
37
38
  })
38
- ), i = s(!1), O = (e) => {
39
- i.value = e === "", u.value = e, a.value = !i.value && r.value.length > 0, o.value = 0, d("update:model-value", u.value);
40
- }, a = s(!1), T = s(null), y = () => {
41
- i.value = !0, a.value = !1;
42
- }, r = l(() => t.list.filter((e) => Object.keys(e).some((g) => String(e[g]).toLowerCase().includes(u.value.toLowerCase())))), f = l(() => t.virtual && r.value.length > 0), x = l(() => t.virtualItemHeight), I = l(() => t.virtualOverscan), b = l(() => t.virtualDynamicHeight), n = J(r, {
39
+ ), i = s(!1), T = (e) => {
40
+ i.value = e === "", o.value = e, l.value = !i.value && r.value.length > 0, u.value = 0, d("update:model-value", o.value);
41
+ }, l = s(!1), A = s(null), y = () => {
42
+ i.value = !0, l.value = !1;
43
+ }, r = a(() => t.list.filter((e) => Object.keys(e).some((g) => String(e[g]).toLowerCase().includes(o.value.toLowerCase())))), f = a(() => t.virtual && r.value.length > 0), b = a(() => ({
44
+ basic: 30,
45
+ thick: 38,
46
+ thin: 22
47
+ })[t.height || "basic"]), x = a(() => t.virtualItemHeight || b.value), I = a(() => t.virtualOverscan), H = a(() => t.virtualDynamicHeight), n = W(r, {
43
48
  enabled: f,
44
49
  itemHeight: x,
45
50
  overscan: I,
46
- dynamic: b
47
- }), A = l(() => n.virtualItems.value), V = l(() => ({
51
+ dynamic: H
52
+ }), V = a(() => n.virtualItems.value), z = a(() => ({
48
53
  height: `${n.totalHeight.value}px`
49
- })), M = l(() => ({
54
+ })), B = a(() => ({
50
55
  transform: `translateY(${n.offsetTop.value}px)`
51
- })), H = (e) => typeof e == "number" ? `${e}px` : e, z = l(() => H(t.virtualMaxHeight)), o = s(0), v = l(() => r.value[o.value]), m = l(() => `${t.id || t.name || "nmorph-autocomplete"}-listbox`), q = (e) => `${m.value}-option-${e}`;
56
+ })), q = (e) => typeof e == "number" ? `${e}px` : e, E = a(() => q(t.virtualMaxHeight)), u = s(0), v = a(() => r.value[u.value]), m = a(() => `${t.id || t.name || "nmorph-autocomplete"}-listbox`), N = (e) => `${m.value}-option-${e}`;
52
57
  c(
53
58
  () => t.modelValue,
54
59
  (e) => {
55
- e !== u.value && (u.value = e);
60
+ e !== o.value && (o.value = e);
56
61
  }
57
62
  ), c(r, async (e) => {
58
- a.value = !i.value && u.value !== "" && e.length > 0, o.value = 0, await Y(), n.scrollToIndex(0), n.refresh();
63
+ l.value = !i.value && o.value !== "" && e.length > 0, u.value = 0, await K(), n.scrollToIndex(0), n.refresh();
59
64
  });
60
65
  const h = (e) => {
61
- d("select", e), u.value = e.value, d("update:model-value", u.value), setTimeout(() => {
62
- i.value = !0, a.value = !1;
66
+ d("select", e), o.value = e.value, d("update:model-value", o.value), setTimeout(() => {
67
+ i.value = !0, l.value = !1;
63
68
  });
64
- }, B = (e) => {
69
+ }, j = (e) => {
65
70
  h(e);
66
- }, E = () => {
67
- i.value = !1, a.value = r.value.length > 0;
71
+ }, R = () => {
72
+ i.value = !1, l.value = r.value.length > 0;
68
73
  }, p = s(!1);
69
- c(u, async (e) => {
74
+ c(o, async (e) => {
70
75
  e !== "" && t.actionCallback && (p.value = !0, await t.actionCallback(), p.value = !1);
71
76
  }), c(p, (e) => {
72
- e && (a.value = !0);
73
- }), c(o, (e) => {
77
+ e && (l.value = !0);
78
+ }), c(u, (e) => {
74
79
  f.value && n.scrollToIndex(e);
75
80
  });
76
81
  const w = () => {
77
- r.value.length && (a.value = !0, o.value = (o.value + 1) % r.value.length);
78
- }, N = () => {
79
- r.value.length && (a.value = !0, o.value = (o.value - 1 + r.value.length) % r.value.length);
82
+ r.value.length && (l.value = !0, u.value = (u.value + 1) % r.value.length);
80
83
  }, S = () => {
81
- !a.value || !v.value || h(v.value);
82
- }, j = (e) => {
83
- e.key === "ArrowDown" ? (e.preventDefault(), w()) : e.key === "ArrowUp" ? (e.preventDefault(), N()) : e.key === "Enter" ? (e.preventDefault(), S()) : e.key === "Escape" && (e.preventDefault(), y());
84
- }, R = l(() => ({
84
+ r.value.length && (l.value = !0, u.value = (u.value - 1 + r.value.length) % r.value.length);
85
+ }, k = () => {
86
+ !l.value || !v.value || h(v.value);
87
+ }, U = (e) => {
88
+ e.key === "ArrowDown" ? (e.preventDefault(), w()) : e.key === "ArrowUp" ? (e.preventDefault(), S()) : e.key === "Enter" ? (e.preventDefault(), k()) : e.key === "Escape" && (e.preventDefault(), y());
89
+ }, Z = a(() => ({
85
90
  role: "combobox",
86
91
  "aria-autocomplete": "list",
87
- "aria-expanded": a.value,
92
+ "aria-expanded": l.value,
88
93
  "aria-controls": m.value,
89
- "aria-activedescendant": a.value ? q(o.value) : void 0
90
- })), U = (e, g) => {
91
- const F = e instanceof Element ? e : e?.$el;
92
- n.measureElement(g, F);
93
- }, D = K(a, () => t.zIndex), Z = l(() => ({
94
+ "aria-activedescendant": l.value ? N(u.value) : void 0
95
+ })), F = (e, g) => {
96
+ const G = e instanceof Element ? e : e?.$el;
97
+ n.measureElement(g, G);
98
+ }, D = X(l, () => t.zIndex), P = a(() => ({
94
99
  "--nmorph-autocomplete-input-z-index": D.value + 1
95
- })), k = { props: t, initialValue: u, emit: d, modifiers: L, userClosed: i, updateValueHandler: O, open: a, nmorphAutocompleteDOMRef: T, closeHandler: y, filteredList: r, virtualEnabled: f, virtualItemHeight: x, virtualOverscan: I, virtualDynamicHeight: b, virtualList: n, virtualItems: A, virtualSpacerStyle: V, virtualContentStyle: M, getCssSize: H, virtualMaxHeight: z, currentIndex: o, activeItem: v, listboxId: m, getOptionId: q, selectItem: h, clickHandler: B, focusHandler: E, loader: p, arrowDownHandler: w, arrowUpHandler: N, enterHandler: S, keydownHandler: j, inputAttrs: R, setVirtualItemRef: U, dropdownZIndex: D, styles: Z, get NmorphIcon() {
96
- return X;
100
+ })), Y = a(
101
+ () => _({
102
+ nmorph: [Q[t.height]]
103
+ })
104
+ ), C = { props: t, initialValue: o, emit: d, modifiers: L, userClosed: i, updateValueHandler: T, open: l, nmorphAutocompleteDOMRef: A, closeHandler: y, filteredList: r, virtualEnabled: f, defaultOptionHeight: b, virtualItemHeight: x, virtualOverscan: I, virtualDynamicHeight: H, virtualList: n, virtualItems: V, virtualSpacerStyle: z, virtualContentStyle: B, getCssSize: q, virtualMaxHeight: E, currentIndex: u, activeItem: v, listboxId: m, getOptionId: N, selectItem: h, clickHandler: j, focusHandler: R, loader: p, arrowDownHandler: w, arrowUpHandler: S, enterHandler: k, keydownHandler: U, inputAttrs: Z, setVirtualItemRef: F, dropdownZIndex: D, styles: P, optionHeightModifiers: Y, get NmorphIcon() {
105
+ return ae;
97
106
  }, get NmorphDropdown() {
98
- return W;
107
+ return te;
99
108
  }, get NmorphTextInput() {
100
- return Q;
101
- }, get NmorphIconLoader() {
102
109
  return ee;
110
+ }, get NmorphIconLoader() {
111
+ return le;
103
112
  } };
104
- return Object.defineProperty(k, "__isScriptSetup", { enumerable: !1, value: !0 }), k;
113
+ return Object.defineProperty(C, "__isScriptSetup", { enumerable: !1, value: !0 }), C;
105
114
  }
106
115
  });
107
116
  export {
108
- se as default
117
+ fe as default
109
118
  };
@@ -1,30 +1,31 @@
1
1
  import './NmorphFileUpload.css';
2
- import d from "./NmorphFileUpload.vue2.js";
3
- import { openBlock as l, createElementBlock as r, normalizeClass as p, createElementVNode as i, renderSlot as m, createVNode as o, TransitionGroup as c, withCtx as t, Fragment as _, renderList as h, createBlock as f, resolveDynamicComponent as u, toDisplayString as v, createCommentVNode as g } from "vue";
2
+ import m from "./NmorphFileUpload.vue2.js";
3
+ import { openBlock as o, createElementBlock as r, normalizeClass as d, createElementVNode as l, renderSlot as _, createVNode as n, TransitionGroup as h, withCtx as t, Fragment as f, renderList as v, createBlock as a, createCommentVNode as p, resolveDynamicComponent as u, toDisplayString as g } from "vue";
4
4
  /* empty css */
5
5
  import y from "../../../_virtual/_plugin-vue_export-helper.js";
6
- const N = { class: "nmorph-file-upload__trigger" }, k = ["multiple", "disabled"], C = {
6
+ const k = { class: "nmorph-file-upload__trigger" }, N = ["multiple", "disabled", "accept"], C = {
7
7
  key: 0,
8
8
  class: "nmorph-file-upload__list"
9
9
  }, b = { class: "nmorph-file-upload__file-info" }, x = { class: "nmorph-file-upload__file-name" }, F = { class: "nmorph-file-upload__remove-file" };
10
- function B(a, I, w, e, D, S) {
11
- return l(), r(
10
+ function B(s, I, w, e, D, S) {
11
+ return o(), r(
12
12
  "div",
13
13
  {
14
- class: p(e.modifiers)
14
+ class: d(e.modifiers)
15
15
  },
16
16
  [
17
- i("div", N, [
18
- i("input", {
17
+ l("div", k, [
18
+ l("input", {
19
19
  ref: "inputDOMRef",
20
20
  type: "file",
21
21
  multiple: e.props.multiple,
22
22
  disabled: e.props.disabled,
23
+ accept: e.inputAccept,
23
24
  class: "nmorph-native-input",
24
25
  onChange: e.handleFileUpload
25
- }, null, 40, k),
26
- m(a.$slots, "trigger", {}, () => [
27
- o(e.NmorphButton, {
26
+ }, null, 40, N),
27
+ _(s.$slots, "trigger", {}, () => [
28
+ n(e.NmorphButton, {
28
29
  text: e.computedButtonText,
29
30
  fill: "",
30
31
  disabled: e.props.disabled,
@@ -32,22 +33,25 @@ function B(a, I, w, e, D, S) {
32
33
  }, null, 8, ["text", "disabled"])
33
34
  ])
34
35
  ]),
35
- e.files.length > 0 ? (l(), r("div", C, [
36
- o(c, {
36
+ e.files.length > 0 ? (o(), r("div", C, [
37
+ n(h, {
37
38
  name: "list",
38
39
  tag: "div"
39
40
  }, {
40
41
  default: t(() => [
41
- (l(!0), r(
42
- _,
42
+ (o(!0), r(
43
+ f,
43
44
  null,
44
- h(e.files, ({ data: n, previewUrl: s }) => (l(), r("div", {
45
- key: n.name,
45
+ v(e.files, ({ data: i, previewUrl: c }) => (o(), r("div", {
46
+ key: i.name,
46
47
  class: "nmorph-file-upload__file"
47
48
  }, [
48
- o(e.NmorphImagePreview, { src: s }, null, 8, ["src"]),
49
- i("div", b, [
50
- o(
49
+ e.props.photoWithPreview && e.isImageFile(i) ? (o(), a(e.NmorphImagePreview, {
50
+ key: 0,
51
+ src: c
52
+ }, null, 8, ["src"])) : p("v-if", !0),
53
+ l("div", b, [
54
+ n(
51
55
  e.NmorphIcon,
52
56
  {
53
57
  width: "14px",
@@ -55,7 +59,7 @@ function B(a, I, w, e, D, S) {
55
59
  },
56
60
  {
57
61
  default: t(() => [
58
- (l(), f(u(e.typeFileIconMap(n.type))))
62
+ (o(), a(u(e.typeFileIconMap(i))))
59
63
  ]),
60
64
  _: 2
61
65
  /* DYNAMIC */
@@ -63,22 +67,22 @@ function B(a, I, w, e, D, S) {
63
67
  1024
64
68
  /* DYNAMIC_SLOTS */
65
69
  ),
66
- i(
70
+ l(
67
71
  "span",
68
72
  x,
69
- v(n.name),
73
+ g(i.name),
70
74
  1
71
75
  /* TEXT */
72
76
  )
73
77
  ]),
74
- i("div", F, [
75
- o(e.NmorphButton, {
78
+ l("div", F, [
79
+ n(e.NmorphButton, {
76
80
  height: "thin",
77
81
  "style-type": "transparent",
78
- onClick: (U) => e.removeFile(n.name)
82
+ onClick: (U) => e.removeFile(i.name)
79
83
  }, {
80
84
  "icon-only": t(() => [
81
- o(e.NmorphIconCross)
85
+ n(e.NmorphIconCross)
82
86
  ]),
83
87
  _: 1
84
88
  /* STABLE */
@@ -92,13 +96,13 @@ function B(a, I, w, e, D, S) {
92
96
  _: 1
93
97
  /* STABLE */
94
98
  })
95
- ])) : g("v-if", !0)
99
+ ])) : p("v-if", !0)
96
100
  ],
97
101
  2
98
102
  /* CLASS */
99
103
  );
100
104
  }
101
- const j = /* @__PURE__ */ y(d, [["render", B], ["__file", "/builds/ketjo/nmorph/library/src/components/form/nmorph-file-upload/NmorphFileUpload.vue"]]);
105
+ const T = /* @__PURE__ */ y(m, [["render", B], ["__file", "/builds/ketjo/nmorph/library/src/components/form/nmorph-file-upload/NmorphFileUpload.vue"]]);
102
106
  export {
103
- j as default
107
+ T as default
104
108
  };
@@ -1,94 +1,126 @@
1
1
  import './NmorphFileUpload.css';
2
- import { defineComponent as V, computed as N, ref as g, watch as B, onBeforeUnmount as T } from "vue";
3
- import { useModifiers as q } from "../../../utils/create-modifiers.js";
4
- import { useI18n as S } from "vue-i18n";
5
- import j from "../../../assets/icons/doc.svg.js";
6
- import k from "../../data/nmorph-image-preview/NmorphImagePreview.vue.js";
7
- import C from "../../basic/nmorph-icon/NmorphIcon.vue.js";
8
- import L from "../../basic/nmorph-button/NmorphButton.vue.js";
9
- import { NmorphImageResolution as O, NmorphAudioResolution as E, NmorphVideoResolution as M, NmorphArchiveResolution as D } from "./types.js";
10
- import W from "../../../assets/icons/audio.svg.js";
11
- import $ from "../../../assets/icons/video.svg.js";
12
- import z from "../../../assets/icons/archive.svg.js";
13
- import G from "../../../assets/icons/cross.svg.js";
14
- import H from "../../../assets/icons/image.svg.js";
15
- const se = /* @__PURE__ */ V({
2
+ import { defineComponent as M, computed as y, ref as F, watch as E, onBeforeUnmount as W } from "vue";
3
+ import { useModifiers as $ } from "../../../utils/create-modifiers.js";
4
+ import { useI18n as D } from "vue-i18n";
5
+ import { resolution as T, NmorphImageResolution as A, NmorphAudioResolution as K, NmorphVideoResolution as z, NmorphArchiveResolution as G } from "./types.js";
6
+ import H from "../../../assets/icons/doc.svg.js";
7
+ import J from "../../data/nmorph-image-preview/NmorphImagePreview.vue.js";
8
+ import Q from "../../basic/nmorph-icon/NmorphIcon.vue.js";
9
+ import X from "../../basic/nmorph-button/NmorphButton.vue.js";
10
+ import Y from "../../../assets/icons/audio.svg.js";
11
+ import Z from "../../../assets/icons/video.svg.js";
12
+ import ee from "../../../assets/icons/archive.svg.js";
13
+ import oe from "../../../assets/icons/cross.svg.js";
14
+ import te from "../../../assets/icons/image.svg.js";
15
+ const ye = /* @__PURE__ */ M({
16
16
  __name: "NmorphFileUpload",
17
17
  props: {
18
18
  modelValue: { type: Array, required: !1, default: () => [] },
19
19
  disabled: { type: Boolean, required: !1, default: !1 },
20
20
  multiple: { type: Boolean, required: !1, default: !1 },
21
- allowedTypes: { type: Array, required: !1, default: () => ["jpg", "jpeg", "png"] },
21
+ allowedTypes: { type: Array, required: !1, default: () => [] },
22
22
  photoWithPreview: { type: Boolean, required: !1, default: !0 },
23
23
  buttonText: { type: String, required: !1, default: "" }
24
24
  },
25
25
  emits: ["update:model-value", "on-unsupported-file-type-error"],
26
- setup(I, { expose: b, emit: w }) {
27
- const { t: f } = S(), r = I, m = w, x = N(() => r.buttonText ? r.buttonText : f("selectFile")), d = (e) => e.split("/")[1], R = (e) => {
28
- const o = d(e);
29
- let t = j;
30
- return o in O && (t = H), o in E && (t = W), o in M && (t = $), o in D && (t = z), t;
31
- }, s = g(null), n = g([...r.modelValue]), i = /* @__PURE__ */ new Set(), a = () => {
32
- const e = s.value;
26
+ setup(R, { expose: U, emit: _ }) {
27
+ const { t: w } = D(), n = R, d = _, B = y(() => n.buttonText ? n.buttonText : w("selectFile")), g = Object.entries(T), v = {
28
+ "svg-xml": "svg",
29
+ "audio-ogg": "ogg",
30
+ "wideo-ogg": "ogg"
31
+ }, C = (e) => e.split("/")[1]?.toLowerCase() || "", f = (e) => {
32
+ const o = e.split(".").pop()?.toLowerCase();
33
+ return o && o !== e.toLowerCase() ? o : "";
34
+ }, I = (e) => g.find(([, o]) => o.toLowerCase() === e.toLowerCase())?.[0] || "", u = (e) => Array.from(
35
+ new Set(
36
+ [
37
+ e.type.toLowerCase(),
38
+ I(e.type),
39
+ f(e.name),
40
+ C(e.type)
41
+ ].filter(Boolean).map((o) => o.toLowerCase())
42
+ )
43
+ ), i = (e, o) => Object.prototype.hasOwnProperty.call(o, e), P = (e) => {
44
+ const o = u(e);
45
+ return e.type.toLowerCase().startsWith("image/") || o.some((t) => i(t, A));
46
+ }, L = (e) => {
47
+ if (n.allowedTypes.length === 0) return !0;
48
+ const o = u(e);
49
+ return n.allowedTypes.some((t) => o.includes(String(t).toLowerCase()));
50
+ }, S = y(() => {
51
+ if (n.allowedTypes.length !== 0)
52
+ return Array.from(
53
+ new Set(
54
+ n.allowedTypes.flatMap((e) => {
55
+ const o = String(e).toLowerCase(), t = T[o], r = v[o] || o;
56
+ return o.includes("/") ? o : t ? [`.${r}`, t] : `.${r}`;
57
+ })
58
+ )
59
+ ).join(",");
60
+ }), V = (e) => {
61
+ const o = u(e);
62
+ let t = H;
63
+ return (e.type.toLowerCase().startsWith("image/") || o.some((r) => i(r, A))) && (t = te), (e.type.toLowerCase().startsWith("audio/") || o.some((r) => i(r, K))) && (t = Y), (e.type.toLowerCase().startsWith("video/") || o.some((r) => i(r, z))) && (t = Z), o.some((r) => i(r, G)) && (t = ee), t;
64
+ }, p = F(null), a = F([...n.modelValue]), l = /* @__PURE__ */ new Set(), m = () => {
65
+ const e = p.value;
33
66
  e && (e.value = "");
34
- }, u = (e) => {
35
- i.has(e) && (URL.revokeObjectURL(e), i.delete(e));
36
- }, h = (e) => {
67
+ }, c = (e) => {
68
+ l.has(e) && (URL.revokeObjectURL(e), l.delete(e));
69
+ }, N = (e) => {
37
70
  const o = new Set(e.map((t) => t.previewUrl));
38
- Array.from(i).forEach((t) => {
39
- o.has(t) || u(t);
71
+ Array.from(l).forEach((t) => {
72
+ o.has(t) || c(t);
40
73
  });
41
- }, c = (e) => {
74
+ }, h = (e) => {
42
75
  const o = [...e];
43
- n.value = o, m("update:model-value", o);
44
- }, U = () => {
45
- r.disabled || !s.value || s.value.click();
46
- }, _ = (e) => {
47
- if (r.disabled) return;
48
- const o = e.target, t = Array.from(o.files || []), p = [];
49
- t.forEach((l) => {
50
- const P = d(l.type);
51
- if (!r.allowedTypes.includes(P)) {
52
- m("on-unsupported-file-type-error", l.type);
76
+ a.value = o, d("update:model-value", o);
77
+ }, O = () => {
78
+ n.disabled || !p.value || p.value.click();
79
+ }, j = (e) => {
80
+ if (n.disabled) return;
81
+ const o = e.target, t = Array.from(o.files || []), r = [];
82
+ t.forEach((s) => {
83
+ if (!L(s)) {
84
+ d("on-unsupported-file-type-error", s.type || f(s.name) || s.name);
53
85
  return;
54
86
  }
55
- const y = URL.createObjectURL(l);
56
- i.add(y), p.push({ data: l, previewUrl: y });
57
- }), a(), p.length > 0 && c([...n.value, ...p]);
58
- }, A = (e) => {
59
- if (r.disabled) return;
60
- const o = n.value.findIndex((t) => t.data.name === e);
87
+ const b = URL.createObjectURL(s);
88
+ l.add(b), r.push({ data: s, previewUrl: b });
89
+ }), m(), r.length > 0 && h([...a.value, ...r]);
90
+ }, k = (e) => {
91
+ if (n.disabled) return;
92
+ const o = a.value.findIndex((t) => t.data.name === e);
61
93
  if (o !== -1) {
62
- const t = n.value[o];
63
- u(t.previewUrl), a(), c(n.value.filter((p, l) => l !== o));
94
+ const t = a.value[o];
95
+ c(t.previewUrl), m(), h(a.value.filter((r, s) => s !== o));
64
96
  }
65
97
  };
66
- B(
67
- () => r.modelValue,
98
+ E(
99
+ () => n.modelValue,
68
100
  (e) => {
69
101
  const o = [...e];
70
- h(o), n.value = o, o.length === 0 && a();
102
+ N(o), a.value = o, o.length === 0 && m();
71
103
  },
72
104
  { deep: !0 }
73
- ), T(() => {
74
- Array.from(i).forEach((e) => u(e));
75
- }), b({ inputDOMRef: s });
76
- const F = N(
77
- () => q({
78
- "nmorph-file-upload": [`${r.disabled && "disabled"}`]
105
+ ), W(() => {
106
+ Array.from(l).forEach((e) => c(e));
107
+ }), U({ inputDOMRef: p });
108
+ const q = y(
109
+ () => $({
110
+ "nmorph-file-upload": [`${n.disabled && "disabled"}`]
79
111
  })
80
- ), v = { t: f, props: r, emit: m, computedButtonText: x, getPlainType: d, typeFileIconMap: R, inputDOMRef: s, files: n, createdPreviewUrls: i, resetInputValue: a, revokePreviewUrl: u, revokeRemovedPreviewUrls: h, filesChanged: c, openFileSelector: U, handleFileUpload: _, removeFile: A, modifiers: F, get NmorphButton() {
81
- return L;
112
+ ), x = { t: w, props: n, emit: d, computedButtonText: B, knownResolutionEntries: g, extensionByResolution: v, getPlainType: C, getFileExtension: f, getKnownResolutionByMime: I, getFileTypeCandidates: u, isKnownFileType: i, isImageFile: P, isFileAllowed: L, inputAccept: S, typeFileIconMap: V, inputDOMRef: p, files: a, createdPreviewUrls: l, resetInputValue: m, revokePreviewUrl: c, revokeRemovedPreviewUrls: N, filesChanged: h, openFileSelector: O, handleFileUpload: j, removeFile: k, modifiers: q, get NmorphButton() {
113
+ return X;
82
114
  }, get NmorphIcon() {
83
- return C;
115
+ return Q;
84
116
  }, get NmorphImagePreview() {
85
- return k;
117
+ return J;
86
118
  }, get NmorphIconCross() {
87
- return G;
119
+ return oe;
88
120
  } };
89
- return Object.defineProperty(v, "__isScriptSetup", { enumerable: !1, value: !0 }), v;
121
+ return Object.defineProperty(x, "__isScriptSetup", { enumerable: !1, value: !0 }), x;
90
122
  }
91
123
  });
92
124
  export {
93
- se as default
125
+ ye as default
94
126
  };