@nmorph/nmorph-ui-kit 2.2.47 → 2.2.49

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.
@@ -1 +1 @@
1
- .nmorph-video-preview{position:relative;display:flex;width:var(--nmorph-video-preview-width, 280px);min-width:0;max-width:100%;height:var(--nmorph-video-preview-height, 158px);overflow:hidden;color:var(--nmorph-white-color);background:color-mix(in srgb,var(--nmorph-black-color) 72%,var(--nmorph-main-color));border-radius:var(--default-border-radius);box-shadow:var(--nmorph-shadow-inset)}.nmorph-video-preview .nmorph-video-preview__media,.nmorph-video-preview .nmorph-video-preview__state{width:100%;height:100%}.nmorph-video-preview .nmorph-video-preview__media{display:block;object-fit:cover}.nmorph-video-preview.nmorph-video-preview--contain .nmorph-video-preview__media{object-fit:contain}.nmorph-video-preview .nmorph-video-preview__state{display:flex;flex-direction:column;gap:var(--indentation-02);justify-content:center;align-items:center;padding:var(--indentation-03);text-align:center}.nmorph-video-preview .nmorph-video-preview__error{max-width:100%;overflow:hidden;color:var(--nmorph-error-text-color);font-size:var(--font-size-extra-small);white-space:nowrap;text-overflow:ellipsis}.nmorph-video-preview .nmorph-video-preview__meta{position:absolute;right:0;bottom:0;left:0;display:flex;gap:var(--indentation-02);justify-content:space-between;align-items:center;padding:18px var(--indentation-03) var(--indentation-02);background:linear-gradient(transparent,color-mix(in srgb,var(--nmorph-black-color) 66%,transparent));pointer-events:none}.nmorph-video-preview .nmorph-video-preview__name,.nmorph-video-preview .nmorph-video-preview__duration{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-video-preview .nmorph-video-preview__name{flex:1 1 auto}.nmorph-video-preview .nmorph-video-preview__duration{flex:0 0 auto;font-variant-numeric:tabular-nums}.nmorph-video-preview .nmorph-video-preview__actions{position:absolute;top:var(--indentation-02);right:var(--indentation-02);display:flex;gap:var(--indentation-01);padding:2px;background:color-mix(in srgb,var(--nmorph-main-color) 86%,transparent);border-radius:var(--default-border-radius)}.nmorph-video-preview .nmorph-video-preview__action-link{display:inline-flex;justify-content:center;align-items:center;width:22px;height:22px;color:var(--nmorph-text-color);text-decoration:none;border-radius:var(--default-border-radius)}.nmorph-video-preview .nmorph-video-preview__action-link:hover{color:var(--nmorph-accent-color);background:color-mix(in srgb,var(--nmorph-accent-color) 10%,transparent)}.nmorph-video-preview .nmorph-video-preview__action-link .nmorph-icon{--color: currentColor}.nmorph-video-preview.nmorph-video-preview--compact{width:var(--nmorph-video-preview-width, 180px);height:var(--nmorph-video-preview-height, 102px)}.nmorph-video-preview.nmorph-video-preview--error{outline:1px solid var(--nmorph-error-color)}
1
+ .nmorph-video-preview{position:relative;display:flex;width:var(--nmorph-video-preview-width, 280px);min-width:0;max-width:100%;height:var(--nmorph-video-preview-height, 158px);overflow:hidden;color:var(--nmorph-white-color);background:color-mix(in srgb,var(--nmorph-black-color) 72%,var(--nmorph-main-color));border-radius:var(--default-border-radius);box-shadow:var(--nmorph-shadow-inset)}.nmorph-video-preview .nmorph-video-preview__media,.nmorph-video-preview .nmorph-video-preview__state{width:100%;height:100%}.nmorph-video-preview.nmorph-video-preview--soft .nmorph-video-preview__state,.nmorph-video-preview.nmorph-video-preview--plain .nmorph-video-preview__state{color:var(--nmorph-text-color)}.nmorph-video-preview .nmorph-video-preview__media{display:block;object-fit:cover}.nmorph-video-preview.nmorph-video-preview--contain .nmorph-video-preview__media{object-fit:contain}.nmorph-video-preview .nmorph-video-preview__state{display:flex;flex-direction:column;gap:var(--indentation-02);justify-content:center;align-items:center;padding:var(--indentation-03);text-align:center}.nmorph-video-preview .nmorph-video-preview__error{max-width:100%;overflow:hidden;color:var(--nmorph-error-text-color);font-size:var(--font-size-extra-small);white-space:nowrap;text-overflow:ellipsis}.nmorph-video-preview .nmorph-video-preview__meta{position:absolute;right:0;bottom:0;left:0;display:flex;gap:var(--indentation-02);justify-content:space-between;align-items:center;padding:18px var(--indentation-03) var(--indentation-02);background:linear-gradient(transparent,color-mix(in srgb,var(--nmorph-black-color) 66%,transparent));pointer-events:none}.nmorph-video-preview .nmorph-video-preview__play{position:absolute;top:50%;left:50%;z-index:1;display:inline-flex;justify-content:center;align-items:center;width:42px;height:42px;padding:0;color:var(--nmorph-text-color);background:color-mix(in srgb,var(--nmorph-main-color) 86%,transparent);border:0;border-radius:var(--border-radius-circular);box-shadow:var(--nmorph-shadow-outset);transform:translate(-50%,-50%);cursor:pointer}.nmorph-video-preview .nmorph-video-preview__play .nmorph-icon{--color: currentColor}.nmorph-video-preview .nmorph-video-preview__play:hover{color:var(--nmorph-accent-color)}.nmorph-video-preview.nmorph-video-preview--playing .nmorph-video-preview__play{opacity:.72}.nmorph-video-preview .nmorph-video-preview__name,.nmorph-video-preview .nmorph-video-preview__duration{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-video-preview .nmorph-video-preview__name{flex:1 1 auto}.nmorph-video-preview .nmorph-video-preview__duration{flex:0 0 auto;font-variant-numeric:tabular-nums}.nmorph-video-preview .nmorph-video-preview__actions{position:absolute;top:var(--indentation-02);right:var(--indentation-02);display:flex;gap:var(--indentation-01);padding:2px;background:color-mix(in srgb,var(--nmorph-main-color) 86%,transparent);border-radius:var(--default-border-radius)}.nmorph-video-preview .nmorph-video-preview__action-link{display:inline-flex;justify-content:center;align-items:center;width:22px;height:22px;color:var(--nmorph-text-color);text-decoration:none;border-radius:var(--default-border-radius)}.nmorph-video-preview .nmorph-video-preview__action-link:hover{color:var(--nmorph-accent-color);background:color-mix(in srgb,var(--nmorph-accent-color) 10%,transparent)}.nmorph-video-preview .nmorph-video-preview__action-link .nmorph-icon{--color: currentColor}.nmorph-video-preview.nmorph-video-preview--compact{width:var(--nmorph-video-preview-width, 180px);height:var(--nmorph-video-preview-height, 102px)}.nmorph-video-preview.nmorph-video-preview--soft{background:color-mix(in srgb,var(--nmorph-accent-color) 6%,transparent);box-shadow:none}.nmorph-video-preview.nmorph-video-preview--plain{background:transparent;box-shadow:none}.nmorph-video-preview.nmorph-video-preview--error{outline:1px solid var(--nmorph-error-color)}
@@ -1,32 +1,34 @@
1
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";
2
+ import { defineComponent as E, useSlots as A, ref as h, computed as u, openBlock as o, createElementBlock as t, normalizeStyle as M, normalizeClass as T, createCommentVNode as n, createVNode as s, unref as r, withCtx as c, createBlock as m, toDisplayString as _, renderSlot as O, createElementVNode as R } from "vue";
3
+ import { useModifiers as L } from "../../../utils/create-modifiers.js";
4
+ import { createCssSizeVariables as j } from "../../../utils/common.js";
5
+ import p from "../../basic/nmorph-icon/NmorphIcon.vue.js";
6
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,
7
+ import q from "../../../assets/icons/pause.svg.js";
8
+ import F from "../../../assets/icons/play.svg.js";
9
+ import G from "../../../assets/icons/loading.svg.js";
10
+ import J from "../../../assets/icons/video.svg.js";
11
+ import K from "../../../assets/icons/open.svg.js";
12
+ import Q from "../../../assets/icons/download.svg.js";
13
+ const U = ["src", "poster", "controls", "muted", "playsinline", "preload"], W = ["aria-label"], X = {
14
+ key: 2,
13
15
  class: "nmorph-video-preview__state"
14
- }, L = {
16
+ }, Y = {
15
17
  key: 2,
16
18
  class: "nmorph-video-preview__error"
17
- }, j = {
18
- key: 2,
19
+ }, Z = {
20
+ key: 3,
19
21
  class: "nmorph-video-preview__meta"
20
- }, q = {
22
+ }, ee = {
21
23
  key: 0,
22
24
  class: "nmorph-video-preview__name"
23
- }, F = {
25
+ }, oe = {
24
26
  key: 1,
25
27
  class: "nmorph-video-preview__duration"
26
- }, G = {
27
- key: 3,
28
+ }, ae = {
29
+ key: 4,
28
30
  class: "nmorph-video-preview__actions"
29
- }, J = ["href", "aria-label"], K = ["href", "download", "aria-label"], re = /* @__PURE__ */ C({
31
+ }, re = ["href", "aria-label"], te = ["href", "download", "aria-label"], _e = /* @__PURE__ */ E({
30
32
  __name: "NmorphVideoPreview",
31
33
  props: {
32
34
  src: {},
@@ -35,6 +37,7 @@ const T = ["src", "poster", "controls", "muted", "playsinline", "preload"], O =
35
37
  width: { default: void 0 },
36
38
  height: { default: void 0 },
37
39
  durationMs: { default: void 0 },
40
+ surface: { default: "card" },
38
41
  compact: { type: Boolean, default: !1 },
39
42
  controls: { type: Boolean, default: !0 },
40
43
  muted: { type: Boolean, default: !1 },
@@ -48,29 +51,58 @@ const T = ["src", "poster", "controls", "muted", "playsinline", "preload"], O =
48
51
  showDefaultActions: { type: Boolean, default: !0 }
49
52
  },
50
53
  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"]
54
+ setup(y, { expose: w, emit: k }) {
55
+ const e = y, i = k, g = A(), d = h(null), l = h(!1), b = (a) => {
56
+ if (!a || a < 0) return "";
57
+ const v = Math.round(a / 1e3), I = Math.floor(v / 60), V = v % 60;
58
+ return `${I}:${V.toString().padStart(2, "0")}`;
59
+ }, f = u(() => b(e.durationMs)), B = u(
60
+ () => !!g.actions || e.showDefaultActions && (e.src || e.downloadHref)
61
+ ), H = u(
62
+ () => L({
63
+ "nmorph-video-preview": [
64
+ e.surface,
65
+ e.compact && "compact",
66
+ e.fit,
67
+ e.loading && "loading",
68
+ e.error && "error",
69
+ l.value && "playing"
70
+ ]
61
71
  })
62
- ), B = p(
63
- () => I({
72
+ ), N = u(
73
+ () => j({
64
74
  "--nmorph-video-preview-width": e.width,
65
75
  "--nmorph-video-preview-height": e.height
66
76
  })
67
- ), N = () => i("open"), S = () => i("download");
68
- return (d, r) => (o(), t("div", {
69
- class: H(g.value),
70
- style: D(B.value)
77
+ ), z = () => i("open"), C = () => i("download"), P = async () => {
78
+ if (!(!d.value || e.loading || e.error)) {
79
+ if (l.value) {
80
+ d.value.pause();
81
+ return;
82
+ }
83
+ try {
84
+ await d.value.play();
85
+ } catch {
86
+ l.value = !1;
87
+ }
88
+ }
89
+ }, S = (a) => {
90
+ l.value = !0, i("play", a);
91
+ }, $ = (a) => {
92
+ l.value = !1, i("pause", a);
93
+ }, x = () => {
94
+ l.value = !1;
95
+ }, D = (a) => {
96
+ l.value = !1, i("error", a);
97
+ };
98
+ return w({ videoRef: d }), (a, v) => (o(), t("div", {
99
+ class: T(H.value),
100
+ style: M(N.value)
71
101
  }, [
72
102
  !e.loading && !e.error ? (o(), t("video", {
73
103
  key: 0,
104
+ ref_key: "videoRef",
105
+ ref: d,
74
106
  class: "nmorph-video-preview__media",
75
107
  src: e.src,
76
108
  poster: e.poster || void 0,
@@ -78,70 +110,85 @@ const T = ["src", "poster", "controls", "muted", "playsinline", "preload"], O =
78
110
  muted: e.muted,
79
111
  playsinline: e.playsinline,
80
112
  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), {
113
+ onPlay: S,
114
+ onPause: $,
115
+ onEnded: x,
116
+ onError: D
117
+ }, null, 40, U)) : n("", !0),
118
+ !e.loading && !e.error ? (o(), t("button", {
119
+ key: 1,
120
+ class: "nmorph-video-preview__play",
121
+ type: "button",
122
+ "aria-label": l.value ? `Pause ${e.name || "video"}` : `Play ${e.name || "video"}`,
123
+ onClick: P
124
+ }, [
125
+ s(r(p), { size: "medium" }, {
126
+ default: c(() => [
127
+ l.value ? (o(), m(r(q), { key: 0 })) : (o(), m(r(F), { key: 1 }))
128
+ ]),
129
+ _: 1
130
+ })
131
+ ], 8, W)) : (o(), t("div", X, [
132
+ e.loading ? (o(), m(r(p), {
86
133
  key: 0,
87
134
  size: "large"
88
135
  }, {
89
- default: m(() => [
90
- l(a(A))
136
+ default: c(() => [
137
+ s(r(G))
91
138
  ]),
92
139
  _: 1
93
- })) : (o(), v(a(c), {
140
+ })) : (o(), m(r(p), {
94
141
  key: 1,
95
142
  size: "large"
96
143
  }, {
97
- default: m(() => [
98
- l(a(E))
144
+ default: c(() => [
145
+ s(r(J))
99
146
  ]),
100
147
  _: 1
101
148
  })),
102
- e.error && e.errorText ? (o(), t("span", L, f(e.errorText), 1)) : s("", !0)
149
+ e.error && e.errorText ? (o(), t("span", Y, _(e.errorText), 1)) : n("", !0)
103
150
  ])),
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", {
151
+ e.name || f.value ? (o(), t("div", Z, [
152
+ e.name ? (o(), t("span", ee, _(e.name), 1)) : n("", !0),
153
+ f.value ? (o(), t("span", oe, _(f.value), 1)) : n("", !0)
154
+ ])) : n("", !0),
155
+ B.value ? (o(), t("div", ae, [
156
+ O(a.$slots, "actions", {}, () => [
157
+ R("a", {
111
158
  href: e.src,
112
159
  target: "_blank",
113
160
  rel: "noopener noreferrer",
114
161
  class: "nmorph-video-preview__action-link",
115
162
  "aria-label": `Open ${e.name || "video"}`,
116
- onClick: N
163
+ onClick: z
117
164
  }, [
118
- l(a(c), { size: "small" }, {
119
- default: m(() => [
120
- l(a(M))
165
+ s(r(p), { size: "small" }, {
166
+ default: c(() => [
167
+ s(r(K))
121
168
  ]),
122
169
  _: 1
123
170
  })
124
- ], 8, J),
171
+ ], 8, re),
125
172
  e.downloadHref ? (o(), t("a", {
126
173
  key: 0,
127
174
  href: e.downloadHref,
128
175
  download: e.name,
129
176
  class: "nmorph-video-preview__action-link",
130
177
  "aria-label": `Download ${e.name || "video"}`,
131
- onClick: S
178
+ onClick: C
132
179
  }, [
133
- l(a(c), { size: "small" }, {
134
- default: m(() => [
135
- l(a(P))
180
+ s(r(p), { size: "small" }, {
181
+ default: c(() => [
182
+ s(r(Q))
136
183
  ]),
137
184
  _: 1
138
185
  })
139
- ], 8, K)) : s("", !0)
186
+ ], 8, te)) : n("", !0)
140
187
  ])
141
- ])) : s("", !0)
188
+ ])) : n("", !0)
142
189
  ], 6));
143
190
  }
144
191
  });
145
192
  export {
146
- re as default
193
+ _e as default
147
194
  };
@@ -5,12 +5,12 @@ import { useFocusableInput as W } from "../../../hooks/use-focusable-input.js";
5
5
  import { useFormItemInput as X, useFormItemModel as Y } from "../nmorph-form/use-form-item-input.js";
6
6
  import { NmorphComponentHeight as Z } from "../../../types/common.types.js";
7
7
  import ee from "../../../assets/icons/eye-blocked.svg.js";
8
- import te from "../../../assets/icons/eye.svg.js";
9
- import oe from "../../basic/nmorph-button/NmorphButton.vue.js";
8
+ import te from "../../basic/nmorph-button/NmorphButton.vue.js";
10
9
  /* empty css */
11
- import ne from "../../basic/nmorph-icon/NmorphIcon.vue.js";
10
+ import oe from "../../basic/nmorph-icon/NmorphIcon.vue.js";
12
11
  /* empty css */
13
- import le from "../../../assets/icons/error.svg.js";
12
+ import ne from "../../../assets/icons/error.svg.js";
13
+ import le from "../../../assets/icons/eye.svg.js";
14
14
  const re = { class: "nmorph-text-input__input-side" }, ae = {
15
15
  key: 0,
16
16
  class: "nmorph-text-input__prepend-icon"
@@ -59,7 +59,7 @@ const re = { class: "nmorph-text-input__input-side" }, ae = {
59
59
  onBlur: () => l("blur")
60
60
  });
61
61
  x({ inputDOMRef: u, focus: E, blur: $, select: D });
62
- const K = a(() => e.clearable ? le : s.value ? ee : te), R = a(() => e.indentation || (p["prepend-icon"] ? "28px" : "8px")), S = a(() => ({ "--nmorph-text-input-indentation": R.value }));
62
+ const K = a(() => e.clearable ? ne : s.value ? ee : le), R = a(() => e.indentation || (p["prepend-icon"] ? "28px" : "8px")), S = a(() => ({ "--nmorph-text-input-indentation": R.value }));
63
63
  return (r, t) => (i(), f("div", {
64
64
  class: T(N.value),
65
65
  style: O(S.value)
@@ -89,7 +89,7 @@ const re = { class: "nmorph-text-input__input-side" }, ae = {
89
89
  onKeydown: t[2] || (t[2] = (n) => l("keydown", n)),
90
90
  onKeyup: t[3] || (t[3] = G((n) => l("on-enter"), ["enter"]))
91
91
  }), null, 16, se),
92
- e.typePassword || e.clearable ? (i(), b(o(oe), {
92
+ e.typePassword || e.clearable ? (i(), b(o(te), {
93
93
  key: 1,
94
94
  disabled: e.disabled,
95
95
  class: "nmorph-text-input__password-btn",
@@ -101,7 +101,7 @@ const re = { class: "nmorph-text-input__input-side" }, ae = {
101
101
  onClick: P
102
102
  }, {
103
103
  default: v(() => [
104
- L(o(ne), null, {
104
+ L(o(oe), null, {
105
105
  default: v(() => [
106
106
  (i(), b(Q(K.value)))
107
107
  ]),