@nmorph/nmorph-ui-kit 2.2.50 → 2.2.51
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.
- package/dist/assets/icons/full-screen.svg.js +6 -6
- package/dist/components/data/nmorph-audio-preview/NmorphAudioPreview.css +1 -1
- package/dist/components/data/nmorph-audio-preview/NmorphAudioPreview.vue.js +84 -78
- package/dist/components/data/nmorph-file-card/NmorphFileCard.css +1 -1
- package/dist/components/data/nmorph-file-card/NmorphFileCard.vue.js +81 -77
- package/dist/components/data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue.js +57 -54
- package/dist/components/data/nmorph-video-preview/NmorphVideoPreview.css +1 -1
- package/dist/components/data/nmorph-video-preview/NmorphVideoPreview.vue.js +226 -134
- package/dist/index.umd.js +24 -24
- package/dist/package.json.js +1 -1
- package/dist/src/components/data/nmorph-media-tile/NmorphMediaTile.vue.d.ts +1 -1
- package/dist/src/components/data/nmorph-video-preview/NmorphVideoPreview.vue.d.ts +7 -1
- package/dist/src/components/data/nmorph-video-preview/types.d.ts +4 -0
- package/dist/src/components/feedback/nmorph-alert/NmorphAlert.vue.d.ts +1 -1
- package/dist/src/components/feedback/nmorph-tooltip/NmorphTooltip.vue.d.ts +3 -3
- package/dist/src/components/form/nmorph-file-upload/NmorphFileUpload.vue.d.ts +2 -2
- package/dist/src/components/form/nmorph-select/NmorphSelect.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-slider/NmorphSlider.vue.d.ts +9 -9
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { openBlock as t, createElementBlock as
|
|
2
|
-
const
|
|
1
|
+
import { openBlock as t, createElementBlock as o, createElementVNode as l } from "vue";
|
|
2
|
+
const n = {
|
|
3
3
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4
4
|
viewBox: "0 0 1024 1024"
|
|
5
5
|
};
|
|
6
6
|
function r(a, e) {
|
|
7
|
-
return t(),
|
|
8
|
-
|
|
7
|
+
return t(), o("svg", n, [...e[0] || (e[0] = [
|
|
8
|
+
l("path", { d: "m160 96.064 192 .192a32 32 0 0 1 0 64l-192-.192V352a32 32 0 0 1-64 0V96h64zm0 831.872V928H96V672a32 32 0 1 1 64 0v191.936l192-.192a32 32 0 1 1 0 64zM864 96.064V96h64v256a32 32 0 1 1-64 0V160.064l-192 .192a32 32 0 1 1 0-64zm0 831.872-192-.192a32 32 0 0 1 0-64l192 .192V672a32 32 0 1 1 64 0v256h-64z" }, null, -1)
|
|
9
9
|
])]);
|
|
10
10
|
}
|
|
11
|
-
const
|
|
11
|
+
const c = { render: r };
|
|
12
12
|
export {
|
|
13
|
-
|
|
13
|
+
c as default,
|
|
14
14
|
r as render
|
|
15
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.nmorph-audio-preview{display:flex;gap:var(--indentation-02);align-items:center;box-sizing:border-box;width:var(--nmorph-audio-preview-width, 360px);min-width:0;max-width:100%;min-height:64px;padding:var(--indentation-03);color:var(--nmorph-text-color);background:var(--nmorph-main-color);border-radius:var(--default-border-radius);box-shadow:var(--nmorph-shadow-inset)}.nmorph-audio-preview audio{display:none}.nmorph-audio-preview .nmorph-audio-preview__icon{position:relative;display:flex;flex:0 0 auto;justify-content:center;align-items:center;width:36px;height:36px;padding:0;color:var(--nmorph-
|
|
1
|
+
.nmorph-audio-preview{display:flex;gap:var(--indentation-02);align-items:center;box-sizing:border-box;width:var(--nmorph-audio-preview-width, 360px);min-width:0;max-width:100%;min-height:64px;padding:var(--indentation-03);color:var(--nmorph-text-color);background:var(--nmorph-main-color);border-radius:var(--default-border-radius);box-shadow:var(--nmorph-shadow-inset)}.nmorph-audio-preview audio{display:none}.nmorph-audio-preview .nmorph-audio-preview__icon{position:relative;display:flex;flex:0 0 auto;justify-content:center;align-items:center;width:36px;height:36px;padding:0;color:var(--nmorph-text-color);background:color-mix(in srgb,var(--nmorph-text-color) 10%,transparent);border:0;border-radius:var(--default-border-radius);cursor:pointer;--color: currentColor}.nmorph-audio-preview .nmorph-audio-preview__icon:disabled{cursor:default}.nmorph-audio-preview .nmorph-audio-preview__play-button{display:inline-flex;flex:0 0 auto;justify-content:center;align-items:center;width:20px;height:20px;padding:0;color:var(--nmorph-contrast-text-color);background:color-mix(in srgb,var(--nmorph-black-color) 36%,transparent);border:0;border-radius:var(--border-radius-circular);cursor:pointer}.nmorph-audio-preview .nmorph-audio-preview__play-button:hover{background:color-mix(in srgb,var(--nmorph-black-color) 48%,transparent)}.nmorph-audio-preview .nmorph-audio-preview__play-button .nmorph-icon{--nmorph-icon-color: var(--nmorph-contrast-text-color);--color: var(--nmorph-contrast-text-color)}.nmorph-audio-preview .nmorph-audio-preview__play-indicator{position:absolute;right:-4px;bottom:-4px;display:inline-flex;justify-content:center;align-items:center;width:18px;height:18px;color:var(--nmorph-contrast-text-color);background:color-mix(in srgb,var(--nmorph-black-color) 36%,transparent);border-radius:var(--border-radius-circular);box-shadow:var(--nmorph-shadow-outset)}.nmorph-audio-preview .nmorph-audio-preview__play-indicator .nmorph-icon{--nmorph-icon-color: var(--nmorph-contrast-text-color);--color: var(--nmorph-contrast-text-color)}.nmorph-audio-preview .nmorph-audio-preview__body{display:flex;flex:1 1 0;flex-direction:column;gap:var(--indentation-02);box-sizing:border-box;min-width:0}.nmorph-audio-preview .nmorph-audio-preview__header{display:flex;gap:var(--indentation-02);justify-content:space-between;align-items:center;min-width:0}.nmorph-audio-preview .nmorph-audio-preview__control{display:flex;gap:var(--indentation-02);align-items:center;width:100%;min-width:0}.nmorph-audio-preview .nmorph-audio-preview__name,.nmorph-audio-preview .nmorph-audio-preview__time,.nmorph-audio-preview .nmorph-audio-preview__error{min-width:0;overflow:hidden;font-size:var(--font-size-extra-small);line-height:var(--line-height-regular);white-space:nowrap;text-overflow:ellipsis}.nmorph-audio-preview .nmorph-audio-preview__name{flex:1 1 auto;font-weight:600}.nmorph-audio-preview .nmorph-audio-preview__time{flex:0 0 auto;color:var(--nmorph-semi-contrast-text-color);font-variant-numeric:tabular-nums}.nmorph-audio-preview .nmorph-audio-preview__error{flex:0 1 auto;color:var(--nmorph-error-text-color)}.nmorph-audio-preview .nmorph-audio-preview__range{flex:1 1 0;width:100%;min-width:0;height:6px;padding:0;background:linear-gradient(to right,var(--nmorph-accent-color) var(--nmorph-audio-preview-progress, 0%),color-mix(in srgb,var(--nmorph-text-color) 16%,transparent) 0);border-radius:var(--border-radius-100);outline:0;cursor:pointer;appearance:none}.nmorph-audio-preview .nmorph-audio-preview__range:disabled{cursor:default;opacity:.6}.nmorph-audio-preview .nmorph-audio-preview__range::-webkit-slider-thumb{width:14px;height:14px;background:var(--nmorph-accent-color);border:2px solid var(--nmorph-main-color);border-radius:var(--border-radius-circular);box-shadow:var(--nmorph-shadow-outset);appearance:none}.nmorph-audio-preview .nmorph-audio-preview__range::-moz-range-thumb{width:14px;height:14px;background:var(--nmorph-accent-color);border:2px solid var(--nmorph-main-color);border-radius:var(--border-radius-circular);box-shadow:var(--nmorph-shadow-outset)}.nmorph-audio-preview .nmorph-audio-preview__actions{display:flex;flex:0 0 auto;gap:var(--indentation-01);align-items:center}.nmorph-audio-preview .nmorph-audio-preview__action-link{display:inline-flex;justify-content:center;align-items:center;width:22px;height:22px;color:inherit;text-decoration:none;border-radius:var(--default-border-radius)}.nmorph-audio-preview .nmorph-audio-preview__action-link:hover{color:var(--nmorph-accent-color);background:color-mix(in srgb,var(--nmorph-accent-color) 10%,transparent)}.nmorph-audio-preview .nmorph-audio-preview__action-link .nmorph-icon{--color: currentColor}.nmorph-audio-preview.nmorph-audio-preview--compact{min-height:52px;padding:var(--indentation-02)}.nmorph-audio-preview.nmorph-audio-preview--compact .nmorph-audio-preview__icon{width:30px;height:30px}.nmorph-audio-preview.nmorph-audio-preview--no-actions .nmorph-audio-preview__body{padding-inline-end:var(--indentation-02)}.nmorph-audio-preview.nmorph-audio-preview--embedded{width:var(--nmorph-audio-preview-width, 100%);min-height:auto;padding:0;background:transparent;border-radius:0;box-shadow:none}.nmorph-audio-preview.nmorph-audio-preview--embedded .nmorph-audio-preview__body{gap:0;padding-inline-end:0}.nmorph-audio-preview.nmorph-audio-preview--embedded .nmorph-audio-preview__range{height:5px}.nmorph-audio-preview.nmorph-audio-preview--embedded .nmorph-audio-preview__range::-webkit-slider-thumb{width:11px;height:11px;box-shadow:none}.nmorph-audio-preview.nmorph-audio-preview--embedded .nmorph-audio-preview__range::-moz-range-thumb{width:11px;height:11px;box-shadow:none}.nmorph-audio-preview.nmorph-audio-preview--embedded .nmorph-audio-preview__play-indicator{box-shadow:none}.nmorph-audio-preview.nmorph-audio-preview--no-header .nmorph-audio-preview__time{flex:0 0 auto}.nmorph-audio-preview.nmorph-audio-preview--soft{background:color-mix(in srgb,var(--nmorph-accent-color) 6%,transparent);box-shadow:none}.nmorph-audio-preview.nmorph-audio-preview--soft .nmorph-audio-preview__play-indicator{box-shadow:none}.nmorph-audio-preview.nmorph-audio-preview--plain{background:transparent;box-shadow:none}.nmorph-audio-preview.nmorph-audio-preview--plain .nmorph-audio-preview__play-indicator{box-shadow:none}.nmorph-audio-preview.nmorph-audio-preview--error{outline:1px solid var(--nmorph-error-color)}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import './NmorphAudioPreview.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import { createCssSizeVariables as
|
|
5
|
-
import
|
|
2
|
+
import { defineComponent as K, useSlots as Q, ref as b, watch as W, computed as s, openBlock as a, createElementBlock as n, normalizeStyle as $, normalizeClass as X, createElementVNode as u, createBlock as c, unref as r, withCtx as p, createVNode as i, createCommentVNode as m, toDisplayString as v, withDirectives as Y, vModelText as Z, renderSlot as ee } from "vue";
|
|
3
|
+
import { useModifiers as oe } from "../../../utils/create-modifiers.js";
|
|
4
|
+
import { createCssSizeVariables as ae } from "../../../utils/common.js";
|
|
5
|
+
import _ from "../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
6
6
|
/* empty css */
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
const
|
|
7
|
+
import re from "../../../assets/icons/audio.svg.js";
|
|
8
|
+
import B from "../../../assets/icons/pause.svg.js";
|
|
9
|
+
import I from "../../../assets/icons/play.svg.js";
|
|
10
|
+
import te from "../../../assets/icons/open.svg.js";
|
|
11
|
+
import le from "../../../assets/icons/download.svg.js";
|
|
12
|
+
import ne from "../../../assets/icons/loading.svg.js";
|
|
13
|
+
const se = ["src", "preload"], ie = ["disabled", "aria-label"], de = {
|
|
14
14
|
key: 2,
|
|
15
15
|
class: "nmorph-audio-preview__play-indicator"
|
|
16
|
-
},
|
|
16
|
+
}, ue = ["aria-label"], ce = { class: "nmorph-audio-preview__body" }, pe = {
|
|
17
17
|
key: 0,
|
|
18
18
|
class: "nmorph-audio-preview__header"
|
|
19
|
-
},
|
|
19
|
+
}, me = { class: "nmorph-audio-preview__name" }, ve = {
|
|
20
20
|
key: 0,
|
|
21
21
|
class: "nmorph-audio-preview__error"
|
|
22
|
-
},
|
|
22
|
+
}, _e = {
|
|
23
23
|
key: 1,
|
|
24
24
|
class: "nmorph-audio-preview__time"
|
|
25
|
-
}, fe = { class: "nmorph-audio-preview__control" },
|
|
25
|
+
}, fe = { class: "nmorph-audio-preview__control" }, he = ["disabled", "aria-label"], ye = {
|
|
26
26
|
key: 0,
|
|
27
27
|
class: "nmorph-audio-preview__time"
|
|
28
|
-
},
|
|
28
|
+
}, we = {
|
|
29
29
|
key: 2,
|
|
30
30
|
class: "nmorph-audio-preview__actions"
|
|
31
|
-
},
|
|
31
|
+
}, be = ["href", "aria-label"], ke = ["href", "download", "aria-label"], P = "var(--nmorph-contrast-text-color)", ze = /* @__PURE__ */ K({
|
|
32
32
|
__name: "NmorphAudioPreview",
|
|
33
33
|
props: {
|
|
34
34
|
src: {},
|
|
@@ -48,9 +48,9 @@ const ne = ["src", "preload"], se = ["disabled", "aria-label"], ie = {
|
|
|
48
48
|
showDefaultActions: { type: Boolean, default: !0 }
|
|
49
49
|
},
|
|
50
50
|
emits: ["play", "pause", "open", "download", "error"],
|
|
51
|
-
setup(
|
|
52
|
-
const e =
|
|
53
|
-
|
|
51
|
+
setup(x, { expose: z, emit: A }) {
|
|
52
|
+
const e = x, f = A, M = Q(), t = b(null), l = b(!1), y = b(0), w = b(e.durationMs ? e.durationMs / 1e3 : 0);
|
|
53
|
+
W(
|
|
54
54
|
() => e.durationMs,
|
|
55
55
|
(o) => {
|
|
56
56
|
w.value = o ? o / 1e3 : w.value;
|
|
@@ -61,10 +61,10 @@ const ne = ["src", "preload"], se = ["disabled", "aria-label"], ie = {
|
|
|
61
61
|
set: (o) => {
|
|
62
62
|
!t.value || d.value <= 0 || (t.value.currentTime = o / 100 * d.value, y.value = t.value.currentTime);
|
|
63
63
|
}
|
|
64
|
-
}),
|
|
64
|
+
}), D = s(() => ({ "--nmorph-audio-preview-progress": `${k.value}%` })), H = s(
|
|
65
65
|
() => !!M.actions || e.showDefaultActions && (e.src || e.downloadHref)
|
|
66
|
-
),
|
|
67
|
-
() =>
|
|
66
|
+
), O = s(
|
|
67
|
+
() => oe({
|
|
68
68
|
"nmorph-audio-preview": [
|
|
69
69
|
e.surface,
|
|
70
70
|
e.embedded && "embedded",
|
|
@@ -77,15 +77,15 @@ const ne = ["src", "preload"], se = ["disabled", "aria-label"], ie = {
|
|
|
77
77
|
!H.value && "no-actions"
|
|
78
78
|
]
|
|
79
79
|
})
|
|
80
|
-
),
|
|
81
|
-
() =>
|
|
80
|
+
), L = s(
|
|
81
|
+
() => ae({
|
|
82
82
|
"--nmorph-audio-preview-width": e.width
|
|
83
83
|
})
|
|
84
84
|
), N = (o) => {
|
|
85
85
|
if (!Number.isFinite(o) || o < 0) return "0:00";
|
|
86
|
-
const h = Math.floor(o), g = Math.floor(h / 60),
|
|
87
|
-
return `${g}:${
|
|
88
|
-
},
|
|
86
|
+
const h = Math.floor(o), g = Math.floor(h / 60), J = h % 60;
|
|
87
|
+
return `${g}:${J.toString().padStart(2, "0")}`;
|
|
88
|
+
}, T = s(() => N(y.value)), C = s(() => N(d.value)), S = async () => {
|
|
89
89
|
if (!(!t.value || e.loading || e.error)) {
|
|
90
90
|
if (l.value) {
|
|
91
91
|
t.value.pause();
|
|
@@ -97,35 +97,35 @@ const ne = ["src", "preload"], se = ["disabled", "aria-label"], ie = {
|
|
|
97
97
|
l.value = !1;
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
},
|
|
100
|
+
}, V = () => {
|
|
101
101
|
!t.value || Number.isNaN(t.value.duration) || (w.value = t.value.duration);
|
|
102
|
-
},
|
|
102
|
+
}, E = () => {
|
|
103
103
|
y.value = t.value?.currentTime || 0;
|
|
104
|
-
}, O = (o) => {
|
|
105
|
-
l.value = !0, _("play", o);
|
|
106
104
|
}, R = (o) => {
|
|
107
|
-
l.value = !
|
|
108
|
-
}, U = () => {
|
|
105
|
+
l.value = !0, f("play", o);
|
|
106
|
+
}, U = (o) => {
|
|
107
|
+
l.value = !1, f("pause", o);
|
|
108
|
+
}, F = () => {
|
|
109
109
|
l.value = !1;
|
|
110
|
-
},
|
|
111
|
-
l.value = !1,
|
|
112
|
-
},
|
|
113
|
-
return
|
|
114
|
-
class:
|
|
115
|
-
style:
|
|
110
|
+
}, j = (o) => {
|
|
111
|
+
l.value = !1, f("error", o);
|
|
112
|
+
}, q = () => f("open"), G = () => f("download");
|
|
113
|
+
return z({ audioRef: t }), (o, h) => (a(), n("div", {
|
|
114
|
+
class: X(O.value),
|
|
115
|
+
style: $(L.value)
|
|
116
116
|
}, [
|
|
117
117
|
u("audio", {
|
|
118
118
|
ref_key: "audioRef",
|
|
119
119
|
ref: t,
|
|
120
120
|
src: e.src,
|
|
121
121
|
preload: e.preload,
|
|
122
|
-
onLoadedmetadata:
|
|
123
|
-
onTimeupdate:
|
|
124
|
-
onPlay:
|
|
125
|
-
onPause:
|
|
126
|
-
onEnded:
|
|
127
|
-
onError:
|
|
128
|
-
}, null, 40,
|
|
122
|
+
onLoadedmetadata: V,
|
|
123
|
+
onTimeupdate: E,
|
|
124
|
+
onPlay: R,
|
|
125
|
+
onPause: U,
|
|
126
|
+
onEnded: F,
|
|
127
|
+
onError: j
|
|
128
|
+
}, null, 40, se),
|
|
129
129
|
e.showIcon ? (a(), n("button", {
|
|
130
130
|
key: 0,
|
|
131
131
|
class: "nmorph-audio-preview__icon",
|
|
@@ -134,109 +134,115 @@ const ne = ["src", "preload"], se = ["disabled", "aria-label"], ie = {
|
|
|
134
134
|
"aria-label": l.value ? `Pause ${e.name || "audio"}` : `Play ${e.name || "audio"}`,
|
|
135
135
|
onClick: S
|
|
136
136
|
}, [
|
|
137
|
-
e.loading ? (a(), c(r(
|
|
137
|
+
e.loading ? (a(), c(r(_), {
|
|
138
138
|
key: 0,
|
|
139
139
|
size: "medium"
|
|
140
140
|
}, {
|
|
141
141
|
default: p(() => [
|
|
142
|
-
i(r(
|
|
142
|
+
i(r(ne))
|
|
143
143
|
]),
|
|
144
144
|
_: 1
|
|
145
|
-
})) : (a(), c(r(
|
|
145
|
+
})) : (a(), c(r(_), {
|
|
146
146
|
key: 1,
|
|
147
147
|
size: "medium"
|
|
148
148
|
}, {
|
|
149
149
|
default: p(() => [
|
|
150
|
-
i(r(
|
|
150
|
+
i(r(re))
|
|
151
151
|
]),
|
|
152
152
|
_: 1
|
|
153
153
|
})),
|
|
154
|
-
!e.loading && !e.error ? (a(), n("span",
|
|
155
|
-
i(r(
|
|
154
|
+
!e.loading && !e.error ? (a(), n("span", de, [
|
|
155
|
+
i(r(_), {
|
|
156
|
+
size: "small",
|
|
157
|
+
color: P
|
|
158
|
+
}, {
|
|
156
159
|
default: p(() => [
|
|
157
|
-
l.value ? (a(), c(r(
|
|
160
|
+
l.value ? (a(), c(r(B), { key: 0 })) : (a(), c(r(I), { key: 1 }))
|
|
158
161
|
]),
|
|
159
162
|
_: 1
|
|
160
163
|
})
|
|
161
164
|
])) : m("", !0)
|
|
162
|
-
], 8,
|
|
165
|
+
], 8, ie)) : !e.loading && !e.error ? (a(), n("button", {
|
|
163
166
|
key: 1,
|
|
164
167
|
class: "nmorph-audio-preview__play-button",
|
|
165
168
|
type: "button",
|
|
166
169
|
"aria-label": l.value ? `Pause ${e.name || "audio"}` : `Play ${e.name || "audio"}`,
|
|
167
170
|
onClick: S
|
|
168
171
|
}, [
|
|
169
|
-
i(r(
|
|
172
|
+
i(r(_), {
|
|
173
|
+
size: "small",
|
|
174
|
+
color: P
|
|
175
|
+
}, {
|
|
170
176
|
default: p(() => [
|
|
171
|
-
l.value ? (a(), c(r(
|
|
177
|
+
l.value ? (a(), c(r(B), { key: 0 })) : (a(), c(r(I), { key: 1 }))
|
|
172
178
|
]),
|
|
173
179
|
_: 1
|
|
174
180
|
})
|
|
175
|
-
], 8,
|
|
176
|
-
u("div",
|
|
177
|
-
e.showHeader ? (a(), n("div",
|
|
178
|
-
u("span",
|
|
179
|
-
e.error && e.errorText ? (a(), n("span",
|
|
181
|
+
], 8, ue)) : m("", !0),
|
|
182
|
+
u("div", ce, [
|
|
183
|
+
e.showHeader ? (a(), n("div", pe, [
|
|
184
|
+
u("span", me, v(e.name || "Audio"), 1),
|
|
185
|
+
e.error && e.errorText ? (a(), n("span", ve, v(e.errorText), 1)) : (a(), n("span", _e, v(T.value) + " / " + v(C.value), 1))
|
|
180
186
|
])) : m("", !0),
|
|
181
187
|
u("div", fe, [
|
|
182
|
-
|
|
188
|
+
Y(u("input", {
|
|
183
189
|
"onUpdate:modelValue": h[0] || (h[0] = (g) => k.value = g),
|
|
184
190
|
class: "nmorph-audio-preview__range",
|
|
185
191
|
type: "range",
|
|
186
192
|
min: "0",
|
|
187
193
|
max: "100",
|
|
188
194
|
step: "0.1",
|
|
189
|
-
style:
|
|
195
|
+
style: $(D.value),
|
|
190
196
|
disabled: e.loading || e.error || d.value <= 0,
|
|
191
197
|
"aria-label": `Audio progress ${e.name || ""}`
|
|
192
|
-
}, null, 12,
|
|
198
|
+
}, null, 12, he), [
|
|
193
199
|
[
|
|
194
|
-
|
|
200
|
+
Z,
|
|
195
201
|
k.value,
|
|
196
202
|
void 0,
|
|
197
203
|
{ number: !0 }
|
|
198
204
|
]
|
|
199
205
|
]),
|
|
200
|
-
e.showHeader ? m("", !0) : (a(), n("span",
|
|
206
|
+
e.showHeader ? m("", !0) : (a(), n("span", ye, v(T.value) + " / " + v(C.value), 1))
|
|
201
207
|
])
|
|
202
208
|
]),
|
|
203
|
-
H.value ? (a(), n("div",
|
|
204
|
-
|
|
209
|
+
H.value ? (a(), n("div", we, [
|
|
210
|
+
ee(o.$slots, "actions", {}, () => [
|
|
205
211
|
u("a", {
|
|
206
212
|
href: e.src,
|
|
207
213
|
target: "_blank",
|
|
208
214
|
rel: "noopener noreferrer",
|
|
209
215
|
class: "nmorph-audio-preview__action-link",
|
|
210
216
|
"aria-label": `Open ${e.name || "audio"}`,
|
|
211
|
-
onClick:
|
|
217
|
+
onClick: q
|
|
212
218
|
}, [
|
|
213
|
-
i(r(
|
|
219
|
+
i(r(_), { size: "small" }, {
|
|
214
220
|
default: p(() => [
|
|
215
|
-
i(r(
|
|
221
|
+
i(r(te))
|
|
216
222
|
]),
|
|
217
223
|
_: 1
|
|
218
224
|
})
|
|
219
|
-
], 8,
|
|
225
|
+
], 8, be),
|
|
220
226
|
e.downloadHref ? (a(), n("a", {
|
|
221
227
|
key: 0,
|
|
222
228
|
href: e.downloadHref,
|
|
223
229
|
download: e.name,
|
|
224
230
|
class: "nmorph-audio-preview__action-link",
|
|
225
231
|
"aria-label": `Download ${e.name || "audio"}`,
|
|
226
|
-
onClick:
|
|
232
|
+
onClick: G
|
|
227
233
|
}, [
|
|
228
|
-
i(r(
|
|
234
|
+
i(r(_), { size: "small" }, {
|
|
229
235
|
default: p(() => [
|
|
230
|
-
i(r(
|
|
236
|
+
i(r(le))
|
|
231
237
|
]),
|
|
232
238
|
_: 1
|
|
233
239
|
})
|
|
234
|
-
], 8,
|
|
240
|
+
], 8, ke)) : m("", !0)
|
|
235
241
|
])
|
|
236
242
|
])) : m("", !0)
|
|
237
243
|
], 6));
|
|
238
244
|
}
|
|
239
245
|
});
|
|
240
246
|
export {
|
|
241
|
-
|
|
247
|
+
ze as default
|
|
242
248
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.nmorph-file-card{display:flex;gap:var(--indentation-03);align-items:center;box-sizing:border-box;width:100%;min-width:0;max-width:100%;min-height:64px;padding:var(--indentation-03);color:var(--nmorph-text-color);background:var(--nmorph-main-color);border-radius:var(--default-border-radius);box-shadow:var(--nmorph-shadow-inset)}.nmorph-file-card .nmorph-file-card__icon{position:relative;display:flex;flex:0 0 auto;justify-content:center;align-items:center;width:36px;height:36px;color:var(--nmorph-
|
|
1
|
+
.nmorph-file-card{display:flex;gap:var(--indentation-03);align-items:center;box-sizing:border-box;width:100%;min-width:0;max-width:100%;min-height:64px;padding:var(--indentation-03);color:var(--nmorph-text-color);background:var(--nmorph-main-color);border-radius:var(--default-border-radius);box-shadow:var(--nmorph-shadow-inset)}.nmorph-file-card .nmorph-file-card__icon{position:relative;display:flex;flex:0 0 auto;justify-content:center;align-items:center;width:36px;height:36px;color:var(--nmorph-text-color);background:color-mix(in srgb,var(--nmorph-text-color) 10%,transparent);border-radius:var(--default-border-radius);--color: currentColor}.nmorph-file-card .nmorph-file-card__icon-action{position:absolute;right:-4px;bottom:-4px;display:inline-flex;justify-content:center;align-items:center;width:18px;height:18px;color:var(--nmorph-contrast-text-color);text-decoration:none;background:color-mix(in srgb,var(--nmorph-black-color) 36%,transparent);border-radius:var(--border-radius-circular);box-shadow:var(--nmorph-shadow-outset)}.nmorph-file-card .nmorph-file-card__icon-action:hover{background:color-mix(in srgb,var(--nmorph-black-color) 48%,transparent)}.nmorph-file-card .nmorph-file-card__icon-action .nmorph-icon{--nmorph-icon-color: var(--nmorph-contrast-text-color);--color: var(--nmorph-contrast-text-color)}.nmorph-file-card .nmorph-file-card__body{display:flex;flex:1 1 0;flex-direction:column;gap:var(--indentation-01);min-width:0}.nmorph-file-card .nmorph-file-card__info{display:flex;flex-direction:column;gap:2px;min-width:0}.nmorph-file-card .nmorph-file-card__name,.nmorph-file-card .nmorph-file-card__meta,.nmorph-file-card .nmorph-file-card__error{display:block;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.nmorph-file-card .nmorph-file-card__name{font-weight:600;font-size:var(--font-size-small);line-height:var(--line-height-regular)}.nmorph-file-card .nmorph-file-card__meta,.nmorph-file-card .nmorph-file-card__error{font-size:var(--font-size-extra-small);line-height:var(--line-height-regular)}.nmorph-file-card .nmorph-file-card__meta{color:var(--nmorph-semi-contrast-text-color)}.nmorph-file-card .nmorph-file-card__error{color:var(--nmorph-error-text-color)}.nmorph-file-card .nmorph-file-card__audio-preview,.nmorph-file-card .nmorph-file-card__video-preview{width:100%;min-width:0}.nmorph-file-card .nmorph-file-card__badge{flex:0 0 auto;max-width:72px;padding:2px 6px;overflow:hidden;color:var(--nmorph-accent-color);font-weight:700;font-size:var(--font-size-extra-small);line-height:var(--line-height-regular);white-space:nowrap;text-transform:uppercase;text-overflow:ellipsis;background:color-mix(in srgb,var(--nmorph-accent-color) 10%,transparent);border-radius:var(--default-border-radius)}.nmorph-file-card .nmorph-file-card__actions{display:flex;flex:0 0 auto;gap:var(--indentation-01);align-items:center}.nmorph-file-card .nmorph-file-card__action-link,.nmorph-file-card .nmorph-file-card__action-loader{display:inline-flex;justify-content:center;align-items:center;width:22px;height:22px;color:inherit;text-decoration:none;border-radius:var(--default-border-radius)}.nmorph-file-card .nmorph-file-card__action-link:hover{color:var(--nmorph-accent-color);background:color-mix(in srgb,var(--nmorph-accent-color) 10%,transparent)}.nmorph-file-card .nmorph-file-card__action-link .nmorph-icon{--color: currentColor}.nmorph-file-card .nmorph-file-card__action-loader{color:var(--nmorph-semi-contrast-text-color)}.nmorph-file-card .nmorph-file-card__action-loader .nmorph-icon{--color: currentColor}.nmorph-file-card.nmorph-file-card--compact{min-height:52px;padding:var(--indentation-02)}.nmorph-file-card.nmorph-file-card--compact .nmorph-file-card__icon{width:30px;height:30px}.nmorph-file-card.nmorph-file-card--compact .nmorph-file-card__audio-preview,.nmorph-file-card.nmorph-file-card--compact .nmorph-file-card__video-preview{margin-top:0}.nmorph-file-card.nmorph-file-card--media-audio.nmorph-file-card--no-actions .nmorph-file-card__body{padding-inline-end:var(--indentation-02)}.nmorph-file-card.nmorph-file-card--media-video.nmorph-file-card--compact{padding-block:var(--indentation-03)}.nmorph-file-card.nmorph-file-card--error{outline:1px solid var(--nmorph-error-color)}.nmorph-file-card.nmorph-file-card--soft{background:color-mix(in srgb,var(--nmorph-accent-color) 6%,transparent);box-shadow:none}.nmorph-file-card.nmorph-file-card--soft .nmorph-file-card__icon-action{box-shadow:none}.nmorph-file-card.nmorph-file-card--plain{background:transparent;box-shadow:none}.nmorph-file-card.nmorph-file-card--plain .nmorph-file-card__icon-action{box-shadow:none}.nmorph-file-card.nmorph-file-card--icon-plain .nmorph-file-card__icon{background:transparent}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import './NmorphFileCard.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import { getFileExtension as
|
|
2
|
+
import { defineComponent as V, useSlots as W, computed as a, openBlock as r, createElementBlock as n, normalizeClass as K, createElementVNode as f, createVNode as t, unref as i, withCtx as c, createBlock as b, resolveDynamicComponent as j, createCommentVNode as l, toDisplayString as h, renderSlot as G } from "vue";
|
|
3
|
+
import { useModifiers as U } from "../../../utils/create-modifiers.js";
|
|
4
|
+
import { getFileExtension as q, getPlainFileType as J, getTypeCandidates as Q, isKnownFileType as m } from "../../../utils/file-types.js";
|
|
5
5
|
import { NmorphImageResolution as X, NmorphAudioResolution as Y, NmorphVideoResolution as Z, NmorphArchiveResolution as ee, NmorphDocResolution as oe } from "../../form/nmorph-file-upload/types.js";
|
|
6
|
-
import
|
|
6
|
+
import ae from "../nmorph-audio-preview/NmorphAudioPreview.vue.js";
|
|
7
7
|
/* empty css */
|
|
8
|
-
import
|
|
8
|
+
import re from "../nmorph-video-preview/NmorphVideoPreview.vue.js";
|
|
9
9
|
/* empty css */
|
|
10
10
|
import ne from "../../../assets/icons/image.svg.js";
|
|
11
11
|
import te from "../../../assets/icons/archive.svg.js";
|
|
12
12
|
import A from "../../../assets/icons/doc.svg.js";
|
|
13
|
-
import
|
|
13
|
+
import d from "../../basic/nmorph-icon/NmorphIcon.vue.js";
|
|
14
14
|
/* empty css */
|
|
15
|
-
import ie from "../../../assets/icons/
|
|
16
|
-
import le from "../../../assets/icons/
|
|
17
|
-
import se from "../../../assets/icons/
|
|
15
|
+
import ie from "../../../assets/icons/audio.svg.js";
|
|
16
|
+
import le from "../../../assets/icons/video.svg.js";
|
|
17
|
+
import se from "../../../assets/icons/eye.svg.js";
|
|
18
18
|
import ce from "../../../assets/icons/loading.svg.js";
|
|
19
19
|
import me from "../../../assets/icons/open.svg.js";
|
|
20
20
|
import de from "../../../assets/icons/download.svg.js";
|
|
21
|
-
const pe = { class: "nmorph-file-card__icon" }, ue = ["href", "aria-label"], fe = { class: "nmorph-file-card__body" },
|
|
21
|
+
const pe = { class: "nmorph-file-card__icon" }, ue = ["href", "aria-label"], fe = { class: "nmorph-file-card__body" }, he = { class: "nmorph-file-card__info" }, ve = { class: "nmorph-file-card__name" }, _e = {
|
|
22
22
|
key: 0,
|
|
23
23
|
class: "nmorph-file-card__error"
|
|
24
24
|
}, we = {
|
|
@@ -30,7 +30,7 @@ const pe = { class: "nmorph-file-card__icon" }, ue = ["href", "aria-label"], fe
|
|
|
30
30
|
}, ge = {
|
|
31
31
|
key: 1,
|
|
32
32
|
class: "nmorph-file-card__actions"
|
|
33
|
-
}, Be = ["href", "aria-label"],
|
|
33
|
+
}, Ne = ["aria-label"], Be = ["href", "aria-label"], be = ["href", "download", "aria-label"], ke = "var(--nmorph-contrast-text-color)", Ke = /* @__PURE__ */ V({
|
|
34
34
|
__name: "NmorphFileCard",
|
|
35
35
|
props: {
|
|
36
36
|
name: {},
|
|
@@ -51,74 +51,66 @@ const pe = { class: "nmorph-file-card__icon" }, ue = ["href", "aria-label"], fe
|
|
|
51
51
|
},
|
|
52
52
|
emits: ["open", "download", "error"],
|
|
53
53
|
setup(P, { emit: H }) {
|
|
54
|
-
const e = P,
|
|
54
|
+
const e = P, v = H, $ = W(), p = a(() => (e.extension || q(e.name) || J(e.mimeType)).toLowerCase()), s = a(() => Q(e.mimeType, e.name)), D = a(() => e.mimeType.toLowerCase().startsWith("image/") || s.value.some((o) => m(o, X)) ? ne : e.mimeType.toLowerCase().startsWith("audio/") || s.value.some((o) => m(o, Y)) ? ie : e.mimeType.toLowerCase().startsWith("video/") || s.value.some((o) => m(o, Z)) ? le : s.value.some((o) => m(o, ee)) ? te : s.value.some((o) => m(o, oe)) ? A : A), E = (o) => {
|
|
55
55
|
if (o === void 0 || Number.isNaN(o) || o < 0) return "";
|
|
56
56
|
if (o === 0) return "0 B";
|
|
57
|
-
const
|
|
58
|
-
return `${
|
|
59
|
-
}, L =
|
|
60
|
-
() => e.showDefaultActions && !!
|
|
61
|
-
),
|
|
62
|
-
() =>
|
|
63
|
-
),
|
|
64
|
-
() =>
|
|
57
|
+
const g = ["B", "KB", "MB", "GB", "TB"], N = Math.min(Math.floor(Math.log(o) / Math.log(1024)), g.length - 1), B = o / 1024 ** N, F = B >= 10 || N === 0 || Number.isInteger(B) ? 0 : 1;
|
|
58
|
+
return `${B.toFixed(F)} ${g[N]}`;
|
|
59
|
+
}, L = a(() => E(e.size)), O = a(() => p.value || e.mimeType), k = a(() => [O.value, L.value].filter(Boolean).join(" · ")), _ = a(() => e.mediaPreview === "audio" && !!e.previewSrc && !e.loading && !e.error), w = a(() => e.mediaPreview === "video" && !!e.previewSrc && !e.loading && !e.error), u = a(() => _.value || w.value), R = a(() => e.compact ? "96px" : "120px"), C = a(() => e.mimeType.toLowerCase() === "application/pdf" || p.value === "pdf"), S = a(() => C.value ? e.previewSrc || e.downloadHref : ""), y = a(
|
|
60
|
+
() => e.showDefaultActions && !!S.value && !u.value && C.value
|
|
61
|
+
), T = a(
|
|
62
|
+
() => !!$.actions || e.showDefaultActions && (e.loading || e.previewSrc && !u.value && !y.value || e.downloadHref)
|
|
63
|
+
), M = a(
|
|
64
|
+
() => U({
|
|
65
65
|
"nmorph-file-card": [
|
|
66
66
|
e.surface,
|
|
67
67
|
e.compact && "compact",
|
|
68
68
|
e.loading && "loading",
|
|
69
69
|
e.error && "error",
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
u.value && "media",
|
|
71
|
+
_.value && "media-audio",
|
|
72
|
+
w.value && "media-video",
|
|
73
73
|
!e.iconSurface && "icon-plain",
|
|
74
|
-
!
|
|
74
|
+
!T.value && "no-actions"
|
|
75
75
|
]
|
|
76
76
|
})
|
|
77
|
-
),
|
|
78
|
-
return (o,
|
|
79
|
-
class: K(
|
|
77
|
+
), x = () => v("open"), z = () => v("download"), I = () => v("error");
|
|
78
|
+
return (o, g) => (r(), n("div", {
|
|
79
|
+
class: K(M.value)
|
|
80
80
|
}, [
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}, {
|
|
86
|
-
default: m(() => [
|
|
87
|
-
l(n(ce))
|
|
88
|
-
]),
|
|
89
|
-
_: 1
|
|
90
|
-
})) : (a(), c(n(p), {
|
|
91
|
-
key: 1,
|
|
92
|
-
size: "medium"
|
|
93
|
-
}, {
|
|
94
|
-
default: m(() => [
|
|
95
|
-
(a(), c(j($.value)))
|
|
81
|
+
f("div", pe, [
|
|
82
|
+
t(i(d), { size: "medium" }, {
|
|
83
|
+
default: c(() => [
|
|
84
|
+
(r(), b(j(D.value)))
|
|
96
85
|
]),
|
|
97
86
|
_: 1
|
|
98
|
-
})
|
|
99
|
-
|
|
100
|
-
key:
|
|
101
|
-
href:
|
|
87
|
+
}),
|
|
88
|
+
y.value && !e.loading && !e.error ? (r(), n("a", {
|
|
89
|
+
key: 0,
|
|
90
|
+
href: S.value,
|
|
102
91
|
target: "_blank",
|
|
103
92
|
rel: "noopener noreferrer",
|
|
104
93
|
class: "nmorph-file-card__icon-action",
|
|
105
94
|
"aria-label": `Preview ${e.name}`,
|
|
106
|
-
onClick:
|
|
95
|
+
onClick: x
|
|
107
96
|
}, [
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
97
|
+
t(i(d), {
|
|
98
|
+
size: "small",
|
|
99
|
+
color: ke
|
|
100
|
+
}, {
|
|
101
|
+
default: c(() => [
|
|
102
|
+
t(i(se))
|
|
111
103
|
]),
|
|
112
104
|
_: 1
|
|
113
105
|
})
|
|
114
|
-
], 8, ue)) :
|
|
106
|
+
], 8, ue)) : l("", !0)
|
|
115
107
|
]),
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
e.error && e.errorText ? (
|
|
108
|
+
f("div", fe, [
|
|
109
|
+
f("div", he, [
|
|
110
|
+
f("span", ve, h(e.name), 1),
|
|
111
|
+
e.error && e.errorText ? (r(), n("span", _e, h(e.errorText), 1)) : k.value ? (r(), n("span", we, h(k.value), 1)) : l("", !0)
|
|
120
112
|
]),
|
|
121
|
-
|
|
113
|
+
_.value ? (r(), b(ae, {
|
|
122
114
|
key: 0,
|
|
123
115
|
class: "nmorph-file-card__audio-preview",
|
|
124
116
|
src: e.previewSrc,
|
|
@@ -130,13 +122,13 @@ const pe = { class: "nmorph-file-card__icon" }, ue = ["href", "aria-label"], fe
|
|
|
130
122
|
"show-header": !1,
|
|
131
123
|
"show-default-actions": !1,
|
|
132
124
|
onError: I
|
|
133
|
-
}, null, 8, ["src", "name"])) :
|
|
134
|
-
|
|
125
|
+
}, null, 8, ["src", "name"])) : l("", !0),
|
|
126
|
+
w.value ? (r(), b(re, {
|
|
135
127
|
key: 1,
|
|
136
128
|
class: "nmorph-file-card__video-preview",
|
|
137
129
|
src: e.previewSrc,
|
|
138
130
|
name: e.name,
|
|
139
|
-
height:
|
|
131
|
+
height: R.value,
|
|
140
132
|
surface: "plain",
|
|
141
133
|
embedded: "",
|
|
142
134
|
compact: "",
|
|
@@ -144,47 +136,59 @@ const pe = { class: "nmorph-file-card__icon" }, ue = ["href", "aria-label"], fe
|
|
|
144
136
|
"show-meta": !1,
|
|
145
137
|
"show-default-actions": !1,
|
|
146
138
|
onError: I
|
|
147
|
-
}, null, 8, ["src", "name", "height"])) :
|
|
139
|
+
}, null, 8, ["src", "name", "height"])) : l("", !0)
|
|
148
140
|
]),
|
|
149
|
-
e.showExtensionBadge &&
|
|
150
|
-
|
|
141
|
+
e.showExtensionBadge && p.value ? (r(), n("span", ye, h(p.value), 1)) : l("", !0),
|
|
142
|
+
T.value ? (r(), n("div", ge, [
|
|
151
143
|
G(o.$slots, "actions", {}, () => [
|
|
152
|
-
e.
|
|
144
|
+
e.loading ? (r(), n("span", {
|
|
153
145
|
key: 0,
|
|
146
|
+
class: "nmorph-file-card__action-loader",
|
|
147
|
+
role: "status",
|
|
148
|
+
"aria-label": `Uploading ${e.name}`
|
|
149
|
+
}, [
|
|
150
|
+
t(i(d), { size: "small" }, {
|
|
151
|
+
default: c(() => [
|
|
152
|
+
t(i(ce))
|
|
153
|
+
]),
|
|
154
|
+
_: 1
|
|
155
|
+
})
|
|
156
|
+
], 8, Ne)) : e.previewSrc && !u.value && !y.value ? (r(), n("a", {
|
|
157
|
+
key: 1,
|
|
154
158
|
href: e.previewSrc,
|
|
155
159
|
target: "_blank",
|
|
156
160
|
rel: "noopener noreferrer",
|
|
157
161
|
class: "nmorph-file-card__action-link",
|
|
158
162
|
"aria-label": `Open ${e.name}`,
|
|
159
|
-
onClick:
|
|
163
|
+
onClick: x
|
|
160
164
|
}, [
|
|
161
|
-
|
|
162
|
-
default:
|
|
163
|
-
|
|
165
|
+
t(i(d), { size: "small" }, {
|
|
166
|
+
default: c(() => [
|
|
167
|
+
t(i(me))
|
|
164
168
|
]),
|
|
165
169
|
_: 1
|
|
166
170
|
})
|
|
167
|
-
], 8, Be)) :
|
|
168
|
-
e.downloadHref ? (
|
|
169
|
-
key:
|
|
171
|
+
], 8, Be)) : l("", !0),
|
|
172
|
+
!e.loading && e.downloadHref ? (r(), n("a", {
|
|
173
|
+
key: 2,
|
|
170
174
|
href: e.downloadHref,
|
|
171
175
|
download: e.name,
|
|
172
176
|
class: "nmorph-file-card__action-link",
|
|
173
177
|
"aria-label": `Download ${e.name}`,
|
|
174
|
-
onClick:
|
|
178
|
+
onClick: z
|
|
175
179
|
}, [
|
|
176
|
-
|
|
177
|
-
default:
|
|
178
|
-
|
|
180
|
+
t(i(d), { size: "small" }, {
|
|
181
|
+
default: c(() => [
|
|
182
|
+
t(i(de))
|
|
179
183
|
]),
|
|
180
184
|
_: 1
|
|
181
185
|
})
|
|
182
|
-
], 8,
|
|
186
|
+
], 8, be)) : l("", !0)
|
|
183
187
|
])
|
|
184
|
-
])) :
|
|
188
|
+
])) : l("", !0)
|
|
185
189
|
], 2));
|
|
186
190
|
}
|
|
187
191
|
});
|
|
188
192
|
export {
|
|
189
|
-
|
|
193
|
+
Ke as default
|
|
190
194
|
};
|