@nmorph/nmorph-ui-kit 2.2.47 → 2.2.48
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/components/data/nmorph-file-card/NmorphFileCard.css +1 -1
- package/dist/components/data/nmorph-file-card/NmorphFileCard.vue.js +25 -16
- package/dist/index.umd.js +2 -2
- package/dist/package.json.js +1 -1
- package/dist/src/components/data/nmorph-file-card/NmorphFileCard.vue.d.ts +4 -0
- package/dist/src/components/data/nmorph-file-card/types.d.ts +4 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -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{display:flex;flex:0 0 auto;justify-content:center;align-items:center;width:36px;height:36px;color:var(--nmorph-accent-color);background:color-mix(in srgb,var(--nmorph-accent-color) 12%,transparent);border-radius:var(--default-border-radius);--color: currentColor}.nmorph-file-card .nmorph-file-card__body{display:flex;flex:1 1 0;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__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{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--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--error{outline:1px solid var(--nmorph-error-color)}
|
|
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{display:flex;flex:0 0 auto;justify-content:center;align-items:center;width:36px;height:36px;color:var(--nmorph-accent-color);background:color-mix(in srgb,var(--nmorph-accent-color) 12%,transparent);border-radius:var(--default-border-radius);--color: currentColor}.nmorph-file-card .nmorph-file-card__body{display:flex;flex:1 1 0;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__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{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--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--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--plain{background:transparent;box-shadow:none}.nmorph-file-card.nmorph-file-card--icon-plain .nmorph-file-card__icon{background:transparent}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import './NmorphFileCard.css';
|
|
2
|
-
import { defineComponent as M, useSlots as $, computed as t, openBlock as r, createElementBlock as a, normalizeClass as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import { getFileExtension as
|
|
2
|
+
import { defineComponent as M, useSlots as $, computed as t, openBlock as r, createElementBlock as a, normalizeClass as E, createElementVNode as _, createBlock as v, unref as n, withCtx as c, createVNode as l, resolveDynamicComponent as F, toDisplayString as d, createCommentVNode as s, renderSlot as R } from "vue";
|
|
3
|
+
import { useModifiers as V } from "../../../utils/create-modifiers.js";
|
|
4
|
+
import { getFileExtension as z, getPlainFileType as W, getTypeCandidates as K, isKnownFileType as m } from "../../../utils/file-types.js";
|
|
5
5
|
import { NmorphImageResolution as O, NmorphAudioResolution as j, NmorphVideoResolution as G, NmorphArchiveResolution as P, NmorphDocResolution as q } from "../../form/nmorph-file-upload/types.js";
|
|
6
6
|
import J from "../../../assets/icons/image.svg.js";
|
|
7
7
|
import Q from "../../../assets/icons/video.svg.js";
|
|
@@ -34,6 +34,9 @@ const oe = { class: "nmorph-file-card__icon" }, re = { class: "nmorph-file-card_
|
|
|
34
34
|
size: { default: void 0 },
|
|
35
35
|
previewSrc: { default: "" },
|
|
36
36
|
downloadHref: { default: "" },
|
|
37
|
+
surface: { default: "card" },
|
|
38
|
+
showExtensionBadge: { type: Boolean, default: !0 },
|
|
39
|
+
iconSurface: { type: Boolean, default: !0 },
|
|
37
40
|
compact: { type: Boolean, default: !1 },
|
|
38
41
|
loading: { type: Boolean, default: !1 },
|
|
39
42
|
error: { type: Boolean, default: !1 },
|
|
@@ -41,21 +44,27 @@ const oe = { class: "nmorph-file-card__icon" }, re = { class: "nmorph-file-card_
|
|
|
41
44
|
showDefaultActions: { type: Boolean, default: !0 }
|
|
42
45
|
},
|
|
43
46
|
emits: ["open", "download", "error"],
|
|
44
|
-
setup(
|
|
45
|
-
const e =
|
|
47
|
+
setup(B, { emit: k }) {
|
|
48
|
+
const e = B, y = k, T = $(), u = t(() => (e.extension || z(e.name) || W(e.mimeType)).toLowerCase()), i = t(() => K(e.mimeType, e.name)), x = t(() => e.mimeType.toLowerCase().startsWith("image/") || i.value.some((o) => m(o, O)) ? J : e.mimeType.toLowerCase().startsWith("audio/") || i.value.some((o) => m(o, j)) ? X : e.mimeType.toLowerCase().startsWith("video/") || i.value.some((o) => m(o, G)) ? Q : i.value.some((o) => m(o, P)) ? U : i.value.some((o) => m(o, q)) ? g : g), C = (o) => {
|
|
46
49
|
if (o === void 0 || Number.isNaN(o) || o < 0) return "";
|
|
47
50
|
if (o === 0) return "0 B";
|
|
48
|
-
const
|
|
49
|
-
return `${N.toFixed(L)} ${
|
|
50
|
-
},
|
|
51
|
+
const f = ["B", "KB", "MB", "GB", "TB"], h = Math.min(Math.floor(Math.log(o) / Math.log(1024)), f.length - 1), N = o / 1024 ** h, L = N >= 10 || h === 0 ? 0 : 1;
|
|
52
|
+
return `${N.toFixed(L)} ${f[h]}`;
|
|
53
|
+
}, S = t(() => C(e.size)), I = t(() => u.value || e.mimeType), w = t(() => [I.value, S.value].filter(Boolean).join(" · ")), b = t(
|
|
51
54
|
() => !!T.actions || e.showDefaultActions && (e.previewSrc || e.downloadHref)
|
|
52
55
|
), D = t(
|
|
53
|
-
() =>
|
|
54
|
-
"nmorph-file-card": [
|
|
56
|
+
() => V({
|
|
57
|
+
"nmorph-file-card": [
|
|
58
|
+
e.surface,
|
|
59
|
+
e.compact && "compact",
|
|
60
|
+
e.loading && "loading",
|
|
61
|
+
e.error && "error",
|
|
62
|
+
!e.iconSurface && "icon-plain"
|
|
63
|
+
]
|
|
55
64
|
})
|
|
56
65
|
), A = () => y("open"), H = () => y("download");
|
|
57
|
-
return (o,
|
|
58
|
-
class:
|
|
66
|
+
return (o, f) => (r(), a("div", {
|
|
67
|
+
class: E(D.value)
|
|
59
68
|
}, [
|
|
60
69
|
_("div", oe, [
|
|
61
70
|
e.loading ? (r(), v(n(p), {
|
|
@@ -71,7 +80,7 @@ const oe = { class: "nmorph-file-card__icon" }, re = { class: "nmorph-file-card_
|
|
|
71
80
|
size: "medium"
|
|
72
81
|
}, {
|
|
73
82
|
default: c(() => [
|
|
74
|
-
(r(), v(
|
|
83
|
+
(r(), v(F(x.value)))
|
|
75
84
|
]),
|
|
76
85
|
_: 1
|
|
77
86
|
}))
|
|
@@ -80,9 +89,9 @@ const oe = { class: "nmorph-file-card__icon" }, re = { class: "nmorph-file-card_
|
|
|
80
89
|
_("span", te, d(e.name), 1),
|
|
81
90
|
e.error && e.errorText ? (r(), a("span", ae, d(e.errorText), 1)) : w.value ? (r(), a("span", ne, d(w.value), 1)) : s("", !0)
|
|
82
91
|
]),
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
92
|
+
e.showExtensionBadge && u.value ? (r(), a("span", ie, d(u.value), 1)) : s("", !0),
|
|
93
|
+
b.value ? (r(), a("div", le, [
|
|
94
|
+
R(o.$slots, "actions", {}, () => [
|
|
86
95
|
e.previewSrc ? (r(), a("a", {
|
|
87
96
|
key: 0,
|
|
88
97
|
href: e.previewSrc,
|