prlg-ui 1.7.59 → 1.7.61

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "prlg-ui",
3
3
  "private": false,
4
- "version": "1.7.59",
4
+ "version": "1.7.61",
5
5
  "type": "module",
6
6
  "main": "dist/prlg-ui.umd.js",
7
7
  "module": "dist/prlg-ui.es.js",
@@ -74,6 +74,7 @@
74
74
  "rollup-plugin-copy": "^3.5.0",
75
75
  "sass-embedded": "^1.89.2",
76
76
  "storybook": "^9.0.16",
77
+ "storybook-addon-vue-slots": "^0.9.29",
77
78
  "typescript": "~5.8.3",
78
79
  "vite": "^7.0.3",
79
80
  "vite-plugin-dts": "^4.5.4",
@@ -1 +0,0 @@
1
- "use strict";const e=require("vue"),i=require("./FileIcon-sxADkCIe.cjs"),p=require("./parseFileSize.util-BTDZr2sf.cjs");function _(t){return t.startsWith("image/")?"image":t==="application/pdf"?"pdf":t==="application/msword"||t==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?"word":t==="application/vnd.ms-excel"||t==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"?"excel":"other"}const g={key:1,class:"file__title"},y={key:2,class:"file__info"},B={key:0,class:"file__type"},V={key:1,class:"file__info-separator"},C={key:2,class:"file__size"},N=e.defineComponent({__name:"File",props:{file:{},viewName:{type:Boolean,default:!1},outlined:{type:Boolean,default:!0},removable:{type:Boolean}},emits:["remove"],setup(t,{emit:u}){const s=u,n=e.useId(),l=e.ref(null);async function m(a,c="image"){const d=await(await fetch(a)).blob(),v=d.type.split("/")[1]||"",k=v?`${c}.${v}`:c;return new File([d],k,{type:d.type})}const o=e.computed(()=>l.value&&l.value.mime?_(l.value.mime):null),r=e.computed(()=>{switch(o.value){case"pdf":return i.PdfIcon;case"word":return i.WordIcon;case"excel":return i.ExcelIcon;case"other":default:return i.FileIcon}});return e.onMounted(async()=>{if(typeof t.file=="string"){const a=await m(t.file);l.value={id:n,url:t.file,name:a.name,mime:a.type,size:a.size}}else l.value=t.file}),(a,c)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["file",{"file--outlined":a.outlined}])},[a.removable&&typeof a.file!="string"?(e.openBlock(),e.createElementBlock("button",{key:0,class:"file__remove",onClick:c[0]||(c[0]=f=>s("remove",a.file))},[e.createVNode(e.unref(i.CloseIcon))])):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),{class:"file__icon"})),l.value&&l.value.name&&a.viewName?(e.openBlock(),e.createElementBlock("div",g,e.toDisplayString(l.value?l.value.name.split(".")[0]:"unknown"),1)):e.createCommentVNode("",!0),l.value?(e.openBlock(),e.createElementBlock("div",y,[l.value.mime?(e.openBlock(),e.createElementBlock("div",B,e.toDisplayString(o.value),1)):e.createCommentVNode("",!0),l.value.mime&&l.value.size?(e.openBlock(),e.createElementBlock("div",V)):e.createCommentVNode("",!0),l.value.size?(e.openBlock(),e.createElementBlock("div",C,e.toDisplayString(l.value?e.unref(p.formatFileSize)(l.value.size):"0 Б"),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],2))}}),E=i._export_sfc(N,[["__scopeId","data-v-9dee864d"]]),F={key:0,class:"image-full-modal"},I={class:"image-full-modal__wrapper"},w={class:"image-full-modal__header"},z={class:"image-full-modal__main"},$=["src","alt"],h=e.defineComponent({__name:"ImageFullModal",props:{src:{},alt:{}},setup(t,{expose:u}){const s=e.ref(!1);return u({open:()=>{s.value=!0},close:()=>{s.value=!1}}),(n,l)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[s.value?(e.openBlock(),e.createElementBlock("div",F,[e.createElementVNode("div",{class:"image-full-modal__overlay",onClick:l[0]||(l[0]=m=>s.value=!1)}),e.createElementVNode("div",I,[e.createElementVNode("div",w,[e.createElementVNode("button",{class:"image-full-modal__close",onClick:l[1]||(l[1]=m=>s.value=!1)},[e.createVNode(e.unref(i.CloseIcon))])]),e.createElementVNode("div",z,[e.createElementVNode("img",{src:n.src,alt:n.alt},null,8,$)]),l[2]||(l[2]=e.createElementVNode("div",{class:"image-full-modal__footer"},null,-1))])])):e.createCommentVNode("",!0)]),_:1})]))}}),b=i._export_sfc(h,[["__scopeId","data-v-edc1a47e"]]),S=["src","alt"],M={key:1,class:"image__info"},D={key:0,class:"image__size"},q=e.defineComponent({__name:"Image",props:{file:{},alt:{},size:{default:"medium"},fullScreen:{type:Boolean},viewInfo:{type:Boolean,default:!1}},setup(t){const u=e.useId(),s=e.useTemplateRef("imageFullModal"),n=e.ref(null);async function l(o,r="image"){const c=await(await fetch(o)).blob(),f=c.type.split("/")[1]||"",d=f?`${r}.${f}`:r;return new File([c],d,{type:c.type})}const m=e.computed(()=>typeof t.file=="string"?t.file:t.file.url);return e.onMounted(async()=>{if(t.viewInfo)if(typeof t.file=="string"){const o=await l(t.file);n.value={id:u,url:t.file,name:o.name,mime:o.type,size:o.size}}else n.value=t.file}),(o,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:e.normalizeClass(["image",`image--${o.size}`,{"image--full-screen":o.fullScreen}])},[o.fullScreen?(e.openBlock(),e.createElementBlock("div",{key:0,class:"image__overlay",onClick:r[0]||(r[0]=a=>s.value?.open())},[e.createVNode(e.unref(i.EyeIcon))])):e.createCommentVNode("",!0),e.createElementVNode("img",{src:m.value,alt:o.alt},null,8,S),o.viewInfo&&n.value&&(n.value.mime||n.value.size)&&o.size==="large"?(e.openBlock(),e.createElementBlock("div",M,[n.value.size?(e.openBlock(),e.createElementBlock("div",D,e.toDisplayString(n.value?e.unref(p.formatFileSize)(n.value.size):"0 Б"),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],2),o.fullScreen?(e.openBlock(),e.createBlock(b,{key:0,ref:"imageFullModal",src:m.value,alt:o.alt},null,8,["src","alt"])):e.createCommentVNode("",!0)],64))}}),O=i._export_sfc(q,[["__scopeId","data-v-3a012518"]]);exports.File=E;exports.Image=O;exports.getFileTypeByMime=_;
@@ -1,197 +0,0 @@
1
- import { defineComponent as F, useId as h, ref as I, computed as w, onMounted as b, createElementBlock as o, openBlock as t, normalizeClass as C, createCommentVNode as n, createBlock as $, createVNode as y, unref as p, resolveDynamicComponent as E, toDisplayString as g, Teleport as V, Transition as N, withCtx as O, createElementVNode as c, useTemplateRef as W, Fragment as j } from "vue";
2
- import { F as D, E as P, W as R, P as q, C as B, _ as k, a as x } from "./FileIcon-DkEbi-bi.js";
3
- import { f as S } from "./parseFileSize.util-BoDbFdVW.js";
4
- function A(l) {
5
- return l.startsWith("image/") ? "image" : l === "application/pdf" ? "pdf" : l === "application/msword" || l === "application/vnd.openxmlformats-officedocument.wordprocessingml.document" ? "word" : l === "application/vnd.ms-excel" || l === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ? "excel" : "other";
6
- }
7
- const G = {
8
- key: 1,
9
- class: "file__title"
10
- }, H = {
11
- key: 2,
12
- class: "file__info"
13
- }, J = {
14
- key: 0,
15
- class: "file__type"
16
- }, K = {
17
- key: 1,
18
- class: "file__info-separator"
19
- }, L = {
20
- key: 2,
21
- class: "file__size"
22
- }, Q = /* @__PURE__ */ F({
23
- __name: "File",
24
- props: {
25
- file: {},
26
- viewName: { type: Boolean, default: !1 },
27
- outlined: { type: Boolean, default: !0 },
28
- removable: { type: Boolean }
29
- },
30
- emits: ["remove"],
31
- setup(l, { emit: d }) {
32
- const u = d, s = h(), e = I(null);
33
- async function m(i, r = "image") {
34
- const v = await (await fetch(i)).blob(), z = v.type.split("/")[1] || "", M = z ? `${r}.${z}` : r;
35
- return new File([v], M, { type: v.type });
36
- }
37
- const a = w(() => e.value && e.value.mime ? A(e.value.mime) : null), f = w(() => {
38
- switch (a.value) {
39
- case "pdf":
40
- return q;
41
- case "word":
42
- return R;
43
- case "excel":
44
- return P;
45
- case "other":
46
- default:
47
- return D;
48
- }
49
- });
50
- return b(async () => {
51
- if (typeof l.file == "string") {
52
- const i = await m(l.file);
53
- e.value = {
54
- id: s,
55
- url: l.file,
56
- name: i.name,
57
- mime: i.type,
58
- size: i.size
59
- };
60
- } else
61
- e.value = l.file;
62
- }), (i, r) => (t(), o("div", {
63
- class: C(["file", { "file--outlined": i.outlined }])
64
- }, [
65
- i.removable && typeof i.file != "string" ? (t(), o("button", {
66
- key: 0,
67
- class: "file__remove",
68
- onClick: r[0] || (r[0] = (_) => u("remove", i.file))
69
- }, [
70
- y(p(B))
71
- ])) : n("", !0),
72
- (t(), $(E(f.value), { class: "file__icon" })),
73
- e.value && e.value.name && i.viewName ? (t(), o("div", G, g(e.value ? e.value.name.split(".")[0] : "unknown"), 1)) : n("", !0),
74
- e.value ? (t(), o("div", H, [
75
- e.value.mime ? (t(), o("div", J, g(a.value), 1)) : n("", !0),
76
- e.value.mime && e.value.size ? (t(), o("div", K)) : n("", !0),
77
- e.value.size ? (t(), o("div", L, g(e.value ? p(S)(e.value.size) : "0 Б"), 1)) : n("", !0)
78
- ])) : n("", !0)
79
- ], 2));
80
- }
81
- }), re = /* @__PURE__ */ k(Q, [["__scopeId", "data-v-9dee864d"]]), U = {
82
- key: 0,
83
- class: "image-full-modal"
84
- }, X = { class: "image-full-modal__wrapper" }, Y = { class: "image-full-modal__header" }, Z = { class: "image-full-modal__main" }, T = ["src", "alt"], ee = /* @__PURE__ */ F({
85
- __name: "ImageFullModal",
86
- props: {
87
- src: {},
88
- alt: {}
89
- },
90
- setup(l, { expose: d }) {
91
- const u = I(!1);
92
- return d({
93
- open: () => {
94
- u.value = !0;
95
- },
96
- close: () => {
97
- u.value = !1;
98
- }
99
- }), (s, e) => (t(), $(V, { to: "body" }, [
100
- y(N, { name: "fade" }, {
101
- default: O(() => [
102
- u.value ? (t(), o("div", U, [
103
- c("div", {
104
- class: "image-full-modal__overlay",
105
- onClick: e[0] || (e[0] = (m) => u.value = !1)
106
- }),
107
- c("div", X, [
108
- c("div", Y, [
109
- c("button", {
110
- class: "image-full-modal__close",
111
- onClick: e[1] || (e[1] = (m) => u.value = !1)
112
- }, [
113
- y(p(B))
114
- ])
115
- ]),
116
- c("div", Z, [
117
- c("img", {
118
- src: s.src,
119
- alt: s.alt
120
- }, null, 8, T)
121
- ]),
122
- e[2] || (e[2] = c("div", { class: "image-full-modal__footer" }, null, -1))
123
- ])
124
- ])) : n("", !0)
125
- ]),
126
- _: 1
127
- })
128
- ]));
129
- }
130
- }), le = /* @__PURE__ */ k(ee, [["__scopeId", "data-v-edc1a47e"]]), ae = ["src", "alt"], te = {
131
- key: 1,
132
- class: "image__info"
133
- }, se = {
134
- key: 0,
135
- class: "image__size"
136
- }, ie = /* @__PURE__ */ F({
137
- __name: "Image",
138
- props: {
139
- file: {},
140
- alt: {},
141
- size: { default: "medium" },
142
- fullScreen: { type: Boolean },
143
- viewInfo: { type: Boolean, default: !1 }
144
- },
145
- setup(l) {
146
- const d = h(), u = W("imageFullModal"), s = I(null);
147
- async function e(a, f = "image") {
148
- const r = await (await fetch(a)).blob(), _ = r.type.split("/")[1] || "", v = _ ? `${f}.${_}` : f;
149
- return new File([r], v, { type: r.type });
150
- }
151
- const m = w(() => typeof l.file == "string" ? l.file : l.file.url);
152
- return b(async () => {
153
- if (l.viewInfo)
154
- if (typeof l.file == "string") {
155
- const a = await e(l.file);
156
- s.value = {
157
- id: d,
158
- url: l.file,
159
- name: a.name,
160
- mime: a.type,
161
- size: a.size
162
- };
163
- } else
164
- s.value = l.file;
165
- }), (a, f) => (t(), o(j, null, [
166
- c("div", {
167
- class: C(["image", `image--${a.size}`, { "image--full-screen": a.fullScreen }])
168
- }, [
169
- a.fullScreen ? (t(), o("div", {
170
- key: 0,
171
- class: "image__overlay",
172
- onClick: f[0] || (f[0] = (i) => u.value?.open())
173
- }, [
174
- y(p(x))
175
- ])) : n("", !0),
176
- c("img", {
177
- src: m.value,
178
- alt: a.alt
179
- }, null, 8, ae),
180
- a.viewInfo && s.value && (s.value.mime || s.value.size) && a.size === "large" ? (t(), o("div", te, [
181
- s.value.size ? (t(), o("div", se, g(s.value ? p(S)(s.value.size) : "0 Б"), 1)) : n("", !0)
182
- ])) : n("", !0)
183
- ], 2),
184
- a.fullScreen ? (t(), $(le, {
185
- key: 0,
186
- ref: "imageFullModal",
187
- src: m.value,
188
- alt: a.alt
189
- }, null, 8, ["src", "alt"])) : n("", !0)
190
- ], 64));
191
- }
192
- }), ce = /* @__PURE__ */ k(ie, [["__scopeId", "data-v-3a012518"]]);
193
- export {
194
- re as F,
195
- ce as I,
196
- A as g
197
- };