@nmorph/nmorph-ui-kit 2.2.43 → 2.2.44

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 (45) hide show
  1. package/dist/assets/icons/chevron-up.svg.js +4 -4
  2. package/dist/assets/icons/download.svg.js +5 -5
  3. package/dist/assets/icons/open.svg.js +2 -2
  4. package/dist/assets/icons/search.svg.js +1 -1
  5. package/dist/assets/icons/smile.svg.js +4 -4
  6. package/dist/components/basic/nmorph-button/NmorphButton.vue.js +16 -16
  7. package/dist/components/data/nmorph-audio-preview/NmorphAudioPreview.css +1 -0
  8. package/dist/components/data/nmorph-audio-preview/NmorphAudioPreview.vue.js +207 -0
  9. package/dist/components/data/nmorph-audio-preview/NmorphAudioPreview.vue3.js +6 -0
  10. package/dist/components/data/nmorph-emoji-picker/NmorphEmojiPicker.css +1 -0
  11. package/dist/components/data/nmorph-emoji-picker/NmorphEmojiPicker.vue.js +371 -0
  12. package/dist/components/data/nmorph-emoji-picker/NmorphEmojiPicker.vue3.js +6 -0
  13. package/dist/components/data/nmorph-file-card/NmorphFileCard.css +1 -0
  14. package/dist/components/data/nmorph-file-card/NmorphFileCard.vue.js +124 -0
  15. package/dist/components/data/nmorph-file-card/NmorphFileCard.vue3.js +6 -0
  16. package/dist/components/data/nmorph-media-tile/NmorphMediaTile.vue.js +8 -8
  17. package/dist/components/data/nmorph-video-preview/NmorphVideoPreview.css +1 -0
  18. package/dist/components/data/nmorph-video-preview/NmorphVideoPreview.vue.js +147 -0
  19. package/dist/components/data/nmorph-video-preview/NmorphVideoPreview.vue3.js +6 -0
  20. package/dist/components/form/nmorph-file-upload/NmorphFileUpload.css +1 -1
  21. package/dist/components/form/nmorph-file-upload/NmorphFileUpload.vue.js +154 -125
  22. package/dist/components/form/nmorph-file-upload/types.js +9 -9
  23. package/dist/index.es.js +861 -849
  24. package/dist/index.umd.js +26 -26
  25. package/dist/package.json.js +1 -1
  26. package/dist/src/components/data/index.d.ts +8 -0
  27. package/dist/src/components/data/nmorph-audio-preview/NmorphAudioPreview.vue.d.ts +38 -0
  28. package/dist/src/components/data/nmorph-audio-preview/types.d.ts +20 -0
  29. package/dist/src/components/data/nmorph-calendar/NmorphCalendar.vue.d.ts +1 -1
  30. package/dist/src/components/data/nmorph-emoji-picker/NmorphEmojiPicker.vue.d.ts +25 -0
  31. package/dist/src/components/data/nmorph-emoji-picker/types.d.ts +50 -0
  32. package/dist/src/components/data/nmorph-file-card/NmorphFileCard.vue.d.ts +30 -0
  33. package/dist/src/components/data/nmorph-file-card/types.d.ts +18 -0
  34. package/dist/src/components/data/nmorph-media-tile/NmorphMediaTile.vue.d.ts +1 -1
  35. package/dist/src/components/data/nmorph-video-preview/NmorphVideoPreview.vue.d.ts +41 -0
  36. package/dist/src/components/data/nmorph-video-preview/types.d.ts +27 -0
  37. package/dist/src/components/form/nmorph-date-picker/inner-components/nmorph-year-month-picker/NmorphYearMonthPicker.vue.d.ts +1 -1
  38. package/dist/src/components/form/nmorph-file-upload/NmorphFileUpload.vue.d.ts +1 -1
  39. package/dist/src/components/form/nmorph-file-upload/types.d.ts +4 -0
  40. package/dist/src/components/form/nmorph-number-input/NmorphNumberInput.vue.d.ts +1 -1
  41. package/dist/src/components/form/nmorph-slider/NmorphSlider.vue.d.ts +1 -1
  42. package/dist/src/utils/file-types.d.ts +8 -1
  43. package/dist/style.css +1 -1
  44. package/dist/utils/file-types.js +28 -21
  45. package/package.json +23 -24
@@ -0,0 +1,147 @@
1
+ import './NmorphVideoPreview.css';
2
+ import { defineComponent as C, useSlots as b, computed as p, openBlock as o, createElementBlock as t, normalizeStyle as D, normalizeClass as H, createBlock as v, unref as a, withCtx as m, createVNode as l, toDisplayString as f, createCommentVNode as s, renderSlot as V, createElementVNode as $ } from "vue";
3
+ import { useModifiers as x } from "../../../utils/create-modifiers.js";
4
+ import { createCssSizeVariables as I } from "../../../utils/common.js";
5
+ import c from "../../basic/nmorph-icon/NmorphIcon.vue.js";
6
+ /* empty css */
7
+ import A from "../../../assets/icons/loading.svg.js";
8
+ import E from "../../../assets/icons/video.svg.js";
9
+ import M from "../../../assets/icons/open.svg.js";
10
+ import P from "../../../assets/icons/download.svg.js";
11
+ const T = ["src", "poster", "controls", "muted", "playsinline", "preload"], O = {
12
+ key: 1,
13
+ class: "nmorph-video-preview__state"
14
+ }, L = {
15
+ key: 2,
16
+ class: "nmorph-video-preview__error"
17
+ }, j = {
18
+ key: 2,
19
+ class: "nmorph-video-preview__meta"
20
+ }, q = {
21
+ key: 0,
22
+ class: "nmorph-video-preview__name"
23
+ }, F = {
24
+ key: 1,
25
+ class: "nmorph-video-preview__duration"
26
+ }, G = {
27
+ key: 3,
28
+ class: "nmorph-video-preview__actions"
29
+ }, J = ["href", "aria-label"], K = ["href", "download", "aria-label"], re = /* @__PURE__ */ C({
30
+ __name: "NmorphVideoPreview",
31
+ props: {
32
+ src: {},
33
+ poster: { default: "" },
34
+ name: { default: "" },
35
+ width: { default: void 0 },
36
+ height: { default: void 0 },
37
+ durationMs: { default: void 0 },
38
+ compact: { type: Boolean, default: !1 },
39
+ controls: { type: Boolean, default: !0 },
40
+ muted: { type: Boolean, default: !1 },
41
+ playsinline: { type: Boolean, default: !0 },
42
+ preload: { default: "metadata" },
43
+ fit: { default: "cover" },
44
+ downloadHref: { default: "" },
45
+ loading: { type: Boolean, default: !1 },
46
+ error: { type: Boolean, default: !1 },
47
+ errorText: { default: "" },
48
+ showDefaultActions: { type: Boolean, default: !0 }
49
+ },
50
+ emits: ["play", "pause", "open", "download", "error"],
51
+ setup(_, { emit: h }) {
52
+ const e = _, i = h, w = b(), y = (d) => {
53
+ if (!d || d < 0) return "";
54
+ const r = Math.round(d / 1e3), n = Math.floor(r / 60), z = r % 60;
55
+ return `${n}:${z.toString().padStart(2, "0")}`;
56
+ }, u = p(() => y(e.durationMs)), k = p(
57
+ () => !!w.actions || e.showDefaultActions && (e.src || e.downloadHref)
58
+ ), g = p(
59
+ () => x({
60
+ "nmorph-video-preview": [e.compact && "compact", e.fit, e.loading && "loading", e.error && "error"]
61
+ })
62
+ ), B = p(
63
+ () => I({
64
+ "--nmorph-video-preview-width": e.width,
65
+ "--nmorph-video-preview-height": e.height
66
+ })
67
+ ), N = () => i("open"), S = () => i("download");
68
+ return (d, r) => (o(), t("div", {
69
+ class: H(g.value),
70
+ style: D(B.value)
71
+ }, [
72
+ !e.loading && !e.error ? (o(), t("video", {
73
+ key: 0,
74
+ class: "nmorph-video-preview__media",
75
+ src: e.src,
76
+ poster: e.poster || void 0,
77
+ controls: e.controls,
78
+ muted: e.muted,
79
+ playsinline: e.playsinline,
80
+ preload: e.preload,
81
+ onPlay: r[0] || (r[0] = (n) => i("play", n)),
82
+ onPause: r[1] || (r[1] = (n) => i("pause", n)),
83
+ onError: r[2] || (r[2] = (n) => i("error", n))
84
+ }, null, 40, T)) : (o(), t("div", O, [
85
+ e.loading ? (o(), v(a(c), {
86
+ key: 0,
87
+ size: "large"
88
+ }, {
89
+ default: m(() => [
90
+ l(a(A))
91
+ ]),
92
+ _: 1
93
+ })) : (o(), v(a(c), {
94
+ key: 1,
95
+ size: "large"
96
+ }, {
97
+ default: m(() => [
98
+ l(a(E))
99
+ ]),
100
+ _: 1
101
+ })),
102
+ e.error && e.errorText ? (o(), t("span", L, f(e.errorText), 1)) : s("", !0)
103
+ ])),
104
+ e.name || u.value ? (o(), t("div", j, [
105
+ e.name ? (o(), t("span", q, f(e.name), 1)) : s("", !0),
106
+ u.value ? (o(), t("span", F, f(u.value), 1)) : s("", !0)
107
+ ])) : s("", !0),
108
+ k.value ? (o(), t("div", G, [
109
+ V(d.$slots, "actions", {}, () => [
110
+ $("a", {
111
+ href: e.src,
112
+ target: "_blank",
113
+ rel: "noopener noreferrer",
114
+ class: "nmorph-video-preview__action-link",
115
+ "aria-label": `Open ${e.name || "video"}`,
116
+ onClick: N
117
+ }, [
118
+ l(a(c), { size: "small" }, {
119
+ default: m(() => [
120
+ l(a(M))
121
+ ]),
122
+ _: 1
123
+ })
124
+ ], 8, J),
125
+ e.downloadHref ? (o(), t("a", {
126
+ key: 0,
127
+ href: e.downloadHref,
128
+ download: e.name,
129
+ class: "nmorph-video-preview__action-link",
130
+ "aria-label": `Download ${e.name || "video"}`,
131
+ onClick: S
132
+ }, [
133
+ l(a(c), { size: "small" }, {
134
+ default: m(() => [
135
+ l(a(P))
136
+ ]),
137
+ _: 1
138
+ })
139
+ ], 8, K)) : s("", !0)
140
+ ])
141
+ ])) : s("", !0)
142
+ ], 6));
143
+ }
144
+ });
145
+ export {
146
+ re as default
147
+ };
@@ -0,0 +1,6 @@
1
+ import './NmorphVideoPreview.css';
2
+ import o from "./NmorphVideoPreview.vue.js";
3
+ /* empty css */
4
+ export {
5
+ o as default
6
+ };
@@ -1 +1 @@
1
- .nmorph-file-upload{box-sizing:border-box;width:100%;min-width:0}.nmorph-file-upload .nmorph-file-upload__trigger{position:relative;width:100%;min-width:0}.nmorph-file-upload input{display:none}.nmorph-file-upload .nmorph-file-upload__list{width:100%;min-width:0;margin-top:var(--indentation-03)}.nmorph-file-upload .nmorph-file-upload__list>div{box-sizing:border-box;width:100%;min-width:0}.nmorph-file-upload .nmorph-file-upload__file{display:flex;gap:var(--indentation-02);align-items:center;box-sizing:border-box;width:100%;min-width:0;max-width:100%;margin-bottom:var(--indentation-02);padding:var(--indentation-02) var(--indentation-03);overflow:hidden;background:var(--nmorph-main-color);border-radius:var(--default-border-radius);box-shadow:var(--base-shadow-width) var(--base-shadow-width) var(--base-shadow-blur) var(--nmorph-dark-shade-color),calc(-1 * var(--base-shadow-width)) calc(-1 * var(--base-shadow-width)) var(--base-shadow-blur) var(--nmorph-light-shade-color)}.nmorph-file-upload.nmorph-file-upload--compact .nmorph-file-upload__file{padding:var(--indentation-01) var(--indentation-02)}.nmorph-file-upload.nmorph-file-upload--layout-grid .nmorph-file-upload__list>div{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:var(--indentation-02)}.nmorph-file-upload.nmorph-file-upload--layout-grid .nmorph-file-upload__file{margin-bottom:0}.nmorph-file-upload.nmorph-file-upload--layout-inline .nmorph-file-upload__list>div{display:flex;flex-wrap:wrap;gap:var(--indentation-02)}.nmorph-file-upload.nmorph-file-upload--layout-inline .nmorph-file-upload__file{width:auto;margin-bottom:0}.nmorph-file-upload .nmorph-file-upload__file>.nmorph-image-preview{flex:0 0 auto}.nmorph-file-upload .nmorph-file-upload__file-info{display:flex;flex:1 1 0;gap:var(--indentation-02);align-items:center;min-width:0;max-width:100%;overflow:hidden}.nmorph-file-upload .nmorph-file-upload__file-info>.nmorph-icon{flex:0 0 auto}.nmorph-file-upload .nmorph-file-upload__file-name{display:block;flex:1 1 0;width:var(--nmorph-file-upload-name-width, auto);min-width:0;max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.nmorph-file-upload .nmorph-file-upload__remove-file{flex:0 0 auto}
1
+ .nmorph-file-upload{box-sizing:border-box;width:100%;min-width:0}.nmorph-file-upload .nmorph-file-upload__trigger{position:relative;width:100%;min-width:0}.nmorph-file-upload input{display:none}.nmorph-file-upload .nmorph-file-upload__list{width:100%;min-width:0;margin-top:var(--indentation-03)}.nmorph-file-upload .nmorph-file-upload__list>div{box-sizing:border-box;width:100%;min-width:0}.nmorph-file-upload .nmorph-file-upload__file{display:flex;gap:var(--indentation-02);align-items:center;box-sizing:border-box;width:100%;min-width:0;max-width:100%;margin-bottom:var(--indentation-02);padding:var(--indentation-02) var(--indentation-03);overflow:hidden;background:var(--nmorph-main-color);border-radius:var(--default-border-radius);box-shadow:var(--base-shadow-width) var(--base-shadow-width) var(--base-shadow-blur) var(--nmorph-dark-shade-color),calc(-1 * var(--base-shadow-width)) calc(-1 * var(--base-shadow-width)) var(--base-shadow-blur) var(--nmorph-light-shade-color)}.nmorph-file-upload.nmorph-file-upload--compact .nmorph-file-upload__file{padding:var(--indentation-01) var(--indentation-02)}.nmorph-file-upload.nmorph-file-upload--layout-grid .nmorph-file-upload__list>div{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:var(--indentation-02)}.nmorph-file-upload.nmorph-file-upload--layout-grid .nmorph-file-upload__file{margin-bottom:0}.nmorph-file-upload.nmorph-file-upload--layout-inline .nmorph-file-upload__list>div{display:flex;flex-wrap:wrap;gap:var(--indentation-02)}.nmorph-file-upload.nmorph-file-upload--layout-inline .nmorph-file-upload__file{width:auto;margin-bottom:0}.nmorph-file-upload .nmorph-file-upload__file>.nmorph-image-preview{flex:0 0 auto}.nmorph-file-upload .nmorph-file-upload__file>.nmorph-video-preview,.nmorph-file-upload .nmorph-file-upload__file>.nmorph-audio-preview,.nmorph-file-upload .nmorph-file-upload__file>.nmorph-file-card{flex:1 1 0;min-width:0}.nmorph-file-upload .nmorph-file-upload__file-info{display:flex;flex:1 1 0;gap:var(--indentation-02);align-items:center;min-width:0;max-width:100%;overflow:hidden}.nmorph-file-upload .nmorph-file-upload__file-info>.nmorph-icon{flex:0 0 auto}.nmorph-file-upload .nmorph-file-upload__file-name{display:block;flex:1 1 0;width:var(--nmorph-file-upload-name-width, auto);min-width:0;max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.nmorph-file-upload .nmorph-file-upload__remove-file{flex:0 0 auto}
@@ -1,27 +1,31 @@
1
1
  import './NmorphFileUpload.css';
2
- import { defineComponent as Z, computed as F, inject as ee, ref as R, watch as te, onBeforeUnmount as oe, openBlock as d, createElementBlock as g, normalizeStyle as le, normalizeClass as ie, createElementVNode as f, unref as n, renderSlot as ae, createVNode as v, TransitionGroup as re, withCtx as I, Fragment as ne, renderList as se, createBlock as T, createCommentVNode as U, resolveDynamicComponent as de, toDisplayString as me } from "vue";
3
- import { useModifiers as ce } from "../../../utils/create-modifiers.js";
4
- import { createCssSizeVariables as pe } from "../../../utils/common.js";
5
- import { getFileAcceptValue as ue, getFileTypeCandidates as A, isKnownFileType as h, isFileAllowedByTypes as fe, getFileExtension as ve } from "../../../utils/file-types.js";
6
- import { useI18n as he } from "vue-i18n";
2
+ import { defineComponent as ee, computed as x, inject as te, ref as R, watch as oe, onBeforeUnmount as le, openBlock as r, createElementBlock as c, normalizeStyle as ie, normalizeClass as ne, createElementVNode as u, unref as l, renderSlot as ae, createVNode as m, TransitionGroup as se, withCtx as F, Fragment as T, renderList as re, toDisplayString as $, createBlock as V, createCommentVNode as me } from "vue";
3
+ import { useModifiers as de } from "../../../utils/create-modifiers.js";
4
+ import { createCssSizeVariables as ce } from "../../../utils/common.js";
5
+ import { getFileAcceptValue as ue, isImageFile as N, isVideoFile as pe, isAudioFile as fe, getFileExtension as P, isFileAllowedByTypes as he } from "../../../utils/file-types.js";
6
+ import { useI18n as ve } from "vue-i18n";
7
7
  import { useFormItemInput as _e, useFormItemModel as ye } from "../nmorph-form/use-form-item-input.js";
8
- import B from "../../basic/nmorph-button/NmorphButton.vue.js";
8
+ import A from "../../basic/nmorph-button/NmorphButton.vue.js";
9
9
  /* empty css */
10
- import Fe from "../../data/nmorph-image-preview/NmorphImagePreview.vue.js";
10
+ import xe from "../../data/nmorph-image-preview/NmorphImagePreview.vue.js";
11
11
  /* empty css */
12
- import ge from "../../basic/nmorph-icon/NmorphIcon.vue.js";
12
+ import S from "../../basic/nmorph-icon/NmorphIcon.vue.js";
13
13
  /* empty css */
14
- import xe from "../../../assets/icons/doc.svg.js";
15
- import be from "../../../assets/icons/audio.svg.js";
16
- import we from "../../../assets/icons/archive.svg.js";
17
- import { NmorphImageResolution as L, NmorphAudioResolution as Ce, NmorphVideoResolution as Ie, NmorphArchiveResolution as Ne } from "./types.js";
18
- import Ve from "../../../assets/icons/cross.svg.js";
19
- import ke from "../../../assets/icons/image.svg.js";
20
- import Re from "../../../assets/icons/video.svg.js";
21
- const Te = { class: "nmorph-file-upload__trigger" }, Ue = ["id", "name", "autocomplete", "tabindex", "multiple", "disabled", "accept"], Ae = {
14
+ import Fe from "../../data/nmorph-video-preview/NmorphVideoPreview.vue.js";
15
+ /* empty css */
16
+ import ge from "../../data/nmorph-audio-preview/NmorphAudioPreview.vue.js";
17
+ /* empty css */
18
+ import be from "../../data/nmorph-file-card/NmorphFileCard.vue.js";
19
+ /* empty css */
20
+ import z from "../../../assets/icons/image.svg.js";
21
+ import we from "../../../assets/icons/cross.svg.js";
22
+ const ke = { class: "nmorph-file-upload__trigger" }, Ve = ["id", "name", "autocomplete", "tabindex", "multiple", "disabled", "accept"], Ce = {
22
23
  key: 0,
23
24
  class: "nmorph-file-upload__list"
24
- }, Be = { class: "nmorph-file-upload__file-info" }, Le = { class: "nmorph-file-upload__file-name" }, We = { class: "nmorph-file-upload__remove-file" }, tt = /* @__PURE__ */ Z({
25
+ }, Ie = { class: "nmorph-file-upload__file-info" }, Be = { class: "nmorph-file-upload__file-name" }, Re = {
26
+ key: 1,
27
+ class: "nmorph-file-upload__file-info"
28
+ }, Te = { class: "nmorph-file-upload__file-name" }, $e = { class: "nmorph-file-upload__remove-file" }, Ye = /* @__PURE__ */ ee({
25
29
  __name: "NmorphFileUpload",
26
30
  props: {
27
31
  id: {},
@@ -39,151 +43,176 @@ const Te = { class: "nmorph-file-upload__trigger" }, Ue = ["id", "name", "autoco
39
43
  fileNameWidth: { default: void 0 }
40
44
  },
41
45
  emits: ["update:model-value", "on-unsupported-file-type-error", "on-file-validation-error"],
42
- setup(W, { expose: P, emit: S }) {
43
- const { t: D } = he(), l = W, x = S, E = F(() => l.buttonText ? l.buttonText : D("selectFile")), { id: _, name: M, autocomplete: $, tabindex: O } = _e(l), { modelValue: N, updateModelValue: j } = ye(
44
- l,
45
- (e) => x("update:model-value", e),
46
+ setup(E, { expose: L, emit: M }) {
47
+ const { t: U } = ve(), o = E, g = M, D = x(() => o.buttonText ? o.buttonText : U("selectFile")), { id: _, name: O, autocomplete: W, tabindex: j } = _e(o), { modelValue: C, updateModelValue: G } = ye(
48
+ o,
49
+ (e) => g("update:model-value", e),
46
50
  []
47
- ), b = ee("form-data", void 0), z = (e) => {
48
- const t = A(e);
49
- return e.type.toLowerCase().startsWith("image/") || t.some((o) => h(o, L));
50
- }, G = F(() => ue(l.allowedTypes)), K = (e) => {
51
- const t = A(e);
52
- let o = xe;
53
- return (e.type.toLowerCase().startsWith("image/") || t.some((i) => h(i, L))) && (o = ke), (e.type.toLowerCase().startsWith("audio/") || t.some((i) => h(i, Ce))) && (o = be), (e.type.toLowerCase().startsWith("video/") || t.some((i) => h(i, Ie))) && (o = Re), t.some((i) => h(i, Ne)) && (o = we), o;
54
- }, m = R(null), r = R([...N.value]), c = /* @__PURE__ */ new Set(), w = () => {
55
- const e = m.value;
51
+ ), b = te("form-data", void 0), q = x(() => ue(o.allowedTypes)), H = (e) => o.photoWithPreview && N(e), p = R(null), s = R([...C.value]), f = /* @__PURE__ */ new Set(), w = () => {
52
+ const e = p.value;
56
53
  e && (e.value = "");
57
- }, C = (e) => {
58
- c.has(e) && (URL.revokeObjectURL(e), c.delete(e));
59
- }, V = (e) => {
60
- const t = new Set(e.map((o) => o.previewUrl));
61
- Array.from(c).forEach((o) => {
62
- t.has(o) || C(o);
63
- });
64
54
  }, k = (e) => {
65
- const t = [...e];
66
- r.value = t, j(t);
67
- }, q = (e) => {
68
- const t = b?.validateField(_.value, e);
55
+ f.has(e) && (URL.revokeObjectURL(e), f.delete(e));
56
+ }, I = (e) => {
57
+ const i = new Set(e.map((t) => t.previewUrl));
58
+ Array.from(f).forEach((t) => {
59
+ i.has(t) || k(t);
60
+ });
61
+ }, B = (e) => {
62
+ const i = [...e];
63
+ s.value = i, G(i);
64
+ }, J = (e) => {
65
+ const i = b?.validateField(_.value, e);
69
66
  return {
70
- valid: t?.valid.value ?? !0,
71
- errors: t?.errors.value ?? []
67
+ valid: i?.valid.value ?? !0,
68
+ errors: i?.errors.value ?? []
72
69
  };
73
- }, H = () => {
74
- l.disabled || !m.value || m.value.click();
75
- }, J = (e) => {
76
- if (l.disabled) return;
77
- const t = e.target, o = Array.from(t.files || []), i = l.multiple ? o : o.slice(0, 1), s = [];
78
- if (i.forEach((a) => {
79
- if (!fe(a, l.allowedTypes)) {
80
- x("on-unsupported-file-type-error", a.type || ve(a.name) || a.name);
70
+ }, K = () => {
71
+ o.disabled || !p.value || p.value.click();
72
+ }, Q = (e) => {
73
+ if (o.disabled) return;
74
+ const i = e.target, t = Array.from(i.files || []), a = o.multiple ? t : t.slice(0, 1), d = [];
75
+ if (a.forEach((n) => {
76
+ if (!he(n, o.allowedTypes)) {
77
+ g("on-unsupported-file-type-error", n.type || P(n.name) || n.name);
81
78
  return;
82
79
  }
83
- const p = l.multiple ? [...r.value.map((y) => y.data), ...s, a] : [a], u = q(p);
84
- if (!u.valid) {
85
- x("on-file-validation-error", { file: a, errors: u.errors });
80
+ const h = o.multiple ? [...s.value.map((y) => y.data), ...d, n] : [n], v = J(h);
81
+ if (!v.valid) {
82
+ g("on-file-validation-error", { file: n, errors: v.errors });
86
83
  return;
87
84
  }
88
- s.push(a);
89
- }), w(), s.length > 0) {
90
- const a = s.map((u) => {
91
- const y = URL.createObjectURL(u);
92
- return c.add(y), { data: u, previewUrl: y };
93
- }), p = l.multiple ? [...r.value, ...a] : a;
94
- V(p), k(p), b?.validateField(_.value, p);
85
+ d.push(n);
86
+ }), w(), d.length > 0) {
87
+ const n = d.map((v) => {
88
+ const y = URL.createObjectURL(v);
89
+ return f.add(y), { data: v, previewUrl: y };
90
+ }), h = o.multiple ? [...s.value, ...n] : n;
91
+ I(h), B(h), b?.validateField(_.value, h);
95
92
  }
96
- }, Q = (e) => {
97
- if (l.disabled) return;
98
- const t = r.value.findIndex((o) => o.data.name === e);
99
- if (t !== -1) {
100
- const o = r.value[t];
101
- C(o.previewUrl), w();
102
- const i = r.value.filter((s, a) => a !== t);
103
- k(i), b?.validateField(_.value, i);
93
+ }, X = (e) => {
94
+ if (o.disabled) return;
95
+ const i = s.value.findIndex((t) => t.data.name === e);
96
+ if (i !== -1) {
97
+ const t = s.value[i];
98
+ k(t.previewUrl), w();
99
+ const a = s.value.filter((d, n) => n !== i);
100
+ B(a), b?.validateField(_.value, a);
104
101
  }
105
102
  };
106
- te(
107
- N,
103
+ oe(
104
+ C,
108
105
  (e) => {
109
- const t = [...e];
110
- V(t), r.value = t, t.length === 0 && w();
106
+ const i = [...e];
107
+ I(i), s.value = i, i.length === 0 && w();
111
108
  },
112
109
  { deep: !0 }
113
- ), oe(() => {
114
- Array.from(c).forEach((e) => C(e));
115
- }), P({ inputDOMRef: m });
116
- const X = F(
117
- () => ce({
118
- "nmorph-file-upload": [l.disabled && "disabled", l.compact && "compact", `layout-${l.layout}`]
110
+ ), le(() => {
111
+ Array.from(f).forEach((e) => k(e));
112
+ }), L({ inputDOMRef: p });
113
+ const Y = x(
114
+ () => de({
115
+ "nmorph-file-upload": [o.disabled && "disabled", o.compact && "compact", `layout-${o.layout}`]
119
116
  })
120
- ), Y = F(
121
- () => pe({
122
- "--nmorph-file-upload-name-width": l.fileNameWidth
117
+ ), Z = x(
118
+ () => ce({
119
+ "--nmorph-file-upload-name-width": o.fileNameWidth
123
120
  })
124
121
  );
125
- return (e, t) => (d(), g("div", {
126
- class: ie(X.value),
127
- style: le(Y.value)
122
+ return (e, i) => (r(), c("div", {
123
+ class: ne(Y.value),
124
+ style: ie(Z.value)
128
125
  }, [
129
- f("div", Te, [
130
- f("input", {
131
- id: n(_),
126
+ u("div", ke, [
127
+ u("input", {
128
+ id: l(_),
132
129
  ref_key: "inputDOMRef",
133
- ref: m,
134
- name: n(M),
135
- autocomplete: n($),
136
- tabindex: n(O),
130
+ ref: p,
131
+ name: l(O),
132
+ autocomplete: l(W),
133
+ tabindex: l(j),
137
134
  type: "file",
138
- multiple: l.multiple,
139
- disabled: l.disabled,
140
- accept: G.value,
135
+ multiple: o.multiple,
136
+ disabled: o.disabled,
137
+ accept: q.value,
141
138
  class: "nmorph-native-input",
142
- onChange: J
143
- }, null, 40, Ue),
139
+ onChange: Q
140
+ }, null, 40, Ve),
144
141
  ae(e.$slots, "trigger", {}, () => [
145
- v(n(B), {
146
- text: E.value,
142
+ m(l(A), {
143
+ text: D.value,
147
144
  fill: "",
148
- disabled: l.disabled,
149
- onClick: H
145
+ disabled: o.disabled,
146
+ onClick: K
150
147
  }, null, 8, ["text", "disabled"])
151
148
  ])
152
149
  ]),
153
- r.value.length > 0 ? (d(), g("div", Ae, [
154
- v(re, {
150
+ s.value.length > 0 ? (r(), c("div", Ce, [
151
+ m(se, {
155
152
  name: "list",
156
153
  tag: "div"
157
154
  }, {
158
- default: I(() => [
159
- (d(!0), g(ne, null, se(r.value, ({ data: o, previewUrl: i }) => (d(), g("div", {
160
- key: o.name,
155
+ default: F(() => [
156
+ (r(!0), c(T, null, re(s.value, ({ data: t, previewUrl: a }) => (r(), c("div", {
157
+ key: t.name,
161
158
  class: "nmorph-file-upload__file"
162
159
  }, [
163
- l.photoWithPreview && z(o) ? (d(), T(n(Fe), {
164
- key: 0,
165
- src: i
166
- }, null, 8, ["src"])) : U("", !0),
167
- f("div", Be, [
168
- v(n(ge), {
160
+ H(t) ? (r(), c(T, { key: 0 }, [
161
+ m(l(xe), { src: a }, null, 8, ["src"]),
162
+ u("div", Ie, [
163
+ m(l(S), {
164
+ width: "14px",
165
+ height: "17px"
166
+ }, {
167
+ default: F(() => [
168
+ m(l(z))
169
+ ]),
170
+ _: 1
171
+ }),
172
+ u("span", Be, $(t.name), 1)
173
+ ])
174
+ ], 64)) : l(N)(t) ? (r(), c("div", Re, [
175
+ m(l(S), {
169
176
  width: "14px",
170
177
  height: "17px"
171
178
  }, {
172
- default: I(() => [
173
- (d(), T(de(K(o))))
179
+ default: F(() => [
180
+ m(l(z))
174
181
  ]),
175
- _: 2
176
- }, 1024),
177
- f("span", Le, me(o.name), 1)
178
- ]),
179
- f("div", We, [
180
- v(n(B), {
182
+ _: 1
183
+ }),
184
+ u("span", Te, $(t.name), 1)
185
+ ])) : l(pe)(t) ? (r(), V(l(Fe), {
186
+ key: 2,
187
+ src: a,
188
+ name: t.name,
189
+ "download-href": a,
190
+ compact: "",
191
+ controls: ""
192
+ }, null, 8, ["src", "name", "download-href"])) : l(fe)(t) ? (r(), V(l(ge), {
193
+ key: 3,
194
+ src: a,
195
+ name: t.name,
196
+ "download-href": a,
197
+ compact: ""
198
+ }, null, 8, ["src", "name", "download-href"])) : (r(), V(l(be), {
199
+ key: 4,
200
+ name: t.name,
201
+ "mime-type": t.type,
202
+ size: t.size,
203
+ extension: l(P)(t.name),
204
+ "preview-src": a,
205
+ "download-href": a,
206
+ compact: ""
207
+ }, null, 8, ["name", "mime-type", "size", "extension", "preview-src", "download-href"])),
208
+ u("div", $e, [
209
+ m(l(A), {
181
210
  height: "thin",
182
211
  "style-type": "transparent",
183
- onClick: (s) => Q(o.name)
212
+ onClick: (d) => X(t.name)
184
213
  }, {
185
- "icon-only": I(() => [
186
- v(n(Ve))
214
+ "icon-only": F(() => [
215
+ m(l(we))
187
216
  ]),
188
217
  _: 1
189
218
  }, 8, ["onClick"])
@@ -192,10 +221,10 @@ const Te = { class: "nmorph-file-upload__trigger" }, Ue = ["id", "name", "autoco
192
221
  ]),
193
222
  _: 1
194
223
  })
195
- ])) : U("", !0)
224
+ ])) : me("", !0)
196
225
  ], 6));
197
226
  }
198
227
  });
199
228
  export {
200
- tt as default
229
+ Ye as default
201
230
  };
@@ -1,5 +1,5 @@
1
1
  var p = /* @__PURE__ */ ((a) => (a.jpeg = "image/jpeg", a.jpg = "image/jpg", a.png = "image/png", a.gif = "image/gif", a["svg-xml"] = "image/svg+xml", a.webp = "image/webp", a))(p || {});
2
- const d = {
2
+ const g = {
3
3
  mp4: "video/mp4",
4
4
  webm: "video/webm",
5
5
  "video-ogg": "video/ogg",
@@ -8,19 +8,19 @@ const d = {
8
8
  */
9
9
  "wideo-ogg": "video/ogg"
10
10
  };
11
- var e = /* @__PURE__ */ ((a) => (a.mpeg = "audio/mpeg", a["audio-ogg"] = "audio/ogg", a.wav = "audio/wav", a))(e || {}), i = /* @__PURE__ */ ((a) => (a.pdf = "application/pdf", a.msword = "application/msword", a.docx = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", a.xlsx = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", a.pptx = "application/vnd.openxmlformats-officedocument.presentationml.presentation", a.json = "application/json", a.xml = "application/xml", a))(i || {}), g = /* @__PURE__ */ ((a) => (a.zip = "application/zip", a.rar = "application/x-rar-compressed", a["7z"] = "application/x-7z-compressed", a))(g || {});
11
+ var i = /* @__PURE__ */ ((a) => (a.mpeg = "audio/mpeg", a["audio-ogg"] = "audio/ogg", a.wav = "audio/wav", a))(i || {}), e = /* @__PURE__ */ ((a) => (a.pdf = "application/pdf", a.msword = "application/msword", a.docx = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", a.xls = "application/vnd.ms-excel", a.xlsx = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", a.ppt = "application/vnd.ms-powerpoint", a.pptx = "application/vnd.openxmlformats-officedocument.presentationml.presentation", a.json = "application/json", a.xml = "application/xml", a))(e || {}), d = /* @__PURE__ */ ((a) => (a.zip = "application/zip", a.rar = "application/x-rar-compressed", a["7z"] = "application/x-7z-compressed", a))(d || {});
12
12
  const n = {
13
13
  ...p,
14
- ...d,
15
- ...e,
14
+ ...g,
16
15
  ...i,
17
- ...g
16
+ ...e,
17
+ ...d
18
18
  };
19
19
  export {
20
- g as NmorphArchiveResolution,
21
- e as NmorphAudioResolution,
22
- i as NmorphDocResolution,
20
+ d as NmorphArchiveResolution,
21
+ i as NmorphAudioResolution,
22
+ e as NmorphDocResolution,
23
23
  p as NmorphImageResolution,
24
- d as NmorphVideoResolution,
24
+ g as NmorphVideoResolution,
25
25
  n as resolution
26
26
  };