dgz-ui-shared 1.0.67 → 1.0.68
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,21 +1,21 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../../jsx-runtime-DUiatUiq.cjs"),a=require("react"),k=require("../../lodash-C5w_OPmE.cjs"),N=require("../../utils-B6fNqzRf-BNysSCt9.cjs"),w=require("../../_commonjsHelpers-DKOUU3wS.cjs"),g=require("../../createLucideIcon-BnAj0RnC.cjs");/**
|
|
2
2
|
* @license lucide-react v0.511.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const
|
|
6
|
+
*/const S=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],C=g.createLucideIcon("chevron-left",S);/**
|
|
7
7
|
* @license lucide-react v0.511.0 - ISC
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const A=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],
|
|
11
|
+
*/const A=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],_=g.createLucideIcon("chevron-right",A);/**
|
|
12
12
|
* @license lucide-react v0.511.0 - ISC
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const
|
|
16
|
+
*/const F=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],T=g.createLucideIcon("download",F);/**
|
|
17
17
|
* @license lucide-react v0.511.0 - ISC
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the ISC license.
|
|
20
20
|
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const
|
|
21
|
+
*/const q=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],O=g.createLucideIcon("x",q);var R={exports:{}},z=R.exports,L;function D(){return L||(L=1,function(l,v){(function(u,m){m()})(z,function(){function u(e,o){return typeof o>"u"?o={autoBom:!1}:typeof o!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),o={autoBom:!o}),o.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e}function m(e,o,d){var n=new XMLHttpRequest;n.open("GET",e),n.responseType="blob",n.onload=function(){p(n.response,o,d)},n.onerror=function(){console.error("could not download file")},n.send()}function h(e){var o=new XMLHttpRequest;o.open("HEAD",e,!1);try{o.send()}catch{}return 200<=o.status&&299>=o.status}function f(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{var o=document.createEvent("MouseEvents");o.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(o)}}var t=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof w.commonjsGlobal=="object"&&w.commonjsGlobal.global===w.commonjsGlobal?w.commonjsGlobal:void 0,j=t.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),p=t.saveAs||(typeof window!="object"||window!==t?function(){}:"download"in HTMLAnchorElement.prototype&&!j?function(e,o,d){var n=t.URL||t.webkitURL,i=document.createElement("a");o=o||e.name||"download",i.download=o,i.rel="noopener",typeof e=="string"?(i.href=e,i.origin===location.origin?f(i):h(i.href)?m(e,o,d):f(i,i.target="_blank")):(i.href=n.createObjectURL(e),setTimeout(function(){n.revokeObjectURL(i.href)},4e4),setTimeout(function(){f(i)},0))}:"msSaveOrOpenBlob"in navigator?function(e,o,d){if(o=o||e.name||"download",typeof e!="string")navigator.msSaveOrOpenBlob(u(e,d),o);else if(h(e))m(e,o,d);else{var n=document.createElement("a");n.href=e,n.target="_blank",setTimeout(function(){f(n)})}}:function(e,o,d,n){if(n=n||open("","_blank"),n&&(n.document.title=n.document.body.innerText="downloading..."),typeof e=="string")return m(e,o,d);var i=e.type==="application/octet-stream",y=/constructor/i.test(t.HTMLElement)||t.safari,b=/CriOS\/[\d]+/.test(navigator.userAgent);if((b||i&&y||j)&&typeof FileReader<"u"){var x=new FileReader;x.onloadend=function(){var c=x.result;c=b?c:c.replace(/^data:[^;]*;/,"data:attachment/file;"),n?n.location.href=c:location=c,n=null},x.readAsDataURL(e)}else{var E=t.URL||t.webkitURL,r=E.createObjectURL(e);n?n.location=r:location.href=r,n=null,setTimeout(function(){E.revokeObjectURL(r)},4e4)}});t.saveAs=p.saveAs=p,l.exports=p})}(R)),R.exports}var U=D();const G=()=>[{icon:s.jsxRuntimeExports.jsx(T,{size:20}),onClick:l=>{U.saveAs(l.src,l.title)},label:"Download"}],I=a.memo(({src:l,alt:v,fallbackImage:u})=>{const[m,h]=a.useState(!1),f=()=>{h(!0)};return s.jsxRuntimeExports.jsx("img",{src:m&&u?u:l,alt:v,className:"max-h-full max-w-full object-contain",onError:f})}),B=a.memo(({image:l,index:v,onClick:u,fallbackImage:m})=>{const[h,f]=a.useState(!1),t=()=>{f(!0)};return s.jsxRuntimeExports.jsx("div",{className:"aspect-video cursor-pointer overflow-hidden rounded-lg bg-gray-200 transition-opacity hover:opacity-80",onClick:()=>u(v),children:s.jsxRuntimeExports.jsx("img",{src:h&&m?m:l.thumbnail||l.src,alt:l.alt||`Image ${v+1}`,className:"h-full w-full object-cover",onError:t})},l.id)}),H=({images:l,actionButtons:v=[],fallbackImage:u,className:m,hasInfo:h,...f})=>{const[t,j]=a.useState(null),[p,e]=a.useState(!1),o=a.useMemo(()=>G(),[]),d=a.useMemo(()=>[...o,...v],[o,v]),n=a.useCallback(r=>{j(r),e(!0)},[]),i=a.useCallback(()=>{e(!1),j(null)},[]),y=a.useCallback(()=>{t!==null&&t>0&&j(t-1)},[t]),b=a.useCallback(()=>{t!==null&&t<l.length-1&&j(t+1)},[t,l.length]);a.useEffect(()=>{const r=c=>{if(p)switch(c.key){case"Escape":i();break;case"ArrowLeft":c.preventDefault(),y();break;case"ArrowRight":c.preventDefault(),b();break}};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[p,y,b,i]),a.useEffect(()=>(p?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset"}),[p]);const x=a.useMemo(()=>t!==null?l[t]:null,[t,l]),E=a.useMemo(()=>!p||!x?null:s.jsxRuntimeExports.jsxs("div",{className:"bg-opacity-95 bg-bg fixed inset-0 z-50 flex flex-col items-center justify-center",children:[s.jsxRuntimeExports.jsxs("div",{className:"absolute top-0 flex w-full items-start justify-between p-3",children:[s.jsxRuntimeExports.jsx("div",{children:x.title&&s.jsxRuntimeExports.jsx("h2",{className:"text-body-lg-semi-bold",children:x.title})}),s.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-4 py-1",children:[d.map((r,c)=>s.jsxRuntimeExports.jsx("button",{onClick:()=>r.onClick(x),className:"cursor-pointer",title:r.label,children:r.icon},c)),s.jsxRuntimeExports.jsx("button",{onClick:i,className:"cursor-pointer",title:"Close (Esc)",children:s.jsxRuntimeExports.jsx(O,{size:20})})]})]}),k.lodashExports.isNumber(t)&&t>0&&s.jsxRuntimeExports.jsx("button",{onClick:y,className:"bg-opacity-50 hover:bg-opacity-70 bg-bg text-secondary absolute top-1/2 left-2 z-50 -translate-y-1/2 rounded-full p-3 transition-all",title:"Previous (←)",children:s.jsxRuntimeExports.jsx(C,{size:24})}),k.lodashExports.isNumber(t)&&t<l.length-1&&s.jsxRuntimeExports.jsx("button",{onClick:b,className:"bg-opacity-0 hover:bg-opacity-100 text-secondary bg-bg absolute top-1/2 right-2 z-50 -translate-y-1/2 rounded-full p-3 transition-all",title:"Next (→)",children:s.jsxRuntimeExports.jsx(_,{size:24})}),s.jsxRuntimeExports.jsx("div",{className:"flex max-h-full max-w-full items-center justify-center overflow-hidden p-8",children:s.jsxRuntimeExports.jsx(I,{src:x.src,alt:x.alt||`Image ${t}`,fallbackImage:u})}),s.jsxRuntimeExports.jsx("div",{className:"bg-bg absolute bottom-0 w-full",children:s.jsxRuntimeExports.jsx("div",{className:"flex gap-2 overflow-x-auto p-3",children:l.map((r,c)=>s.jsxRuntimeExports.jsx("div",{className:N.mo("hover:border-item-primary h-16 min-w-16 shrink-0 cursor-pointer rounded border-3 border-transparent transition-all",c==t&&"border-item-primary"),onClick:()=>j(c),children:s.jsxRuntimeExports.jsx("img",{src:r.thumbnail||r.src,alt:r.alt||`Thumbnail ${c+1}`,className:"size-full object-cover",onError:M=>{u&&(M.currentTarget.src=u)}})},r.id))})})]}),[p,u,x,d,i,t,y,l,b]);return s.jsxRuntimeExports.jsxs("div",{className:"w-full",children:[s.jsxRuntimeExports.jsx("div",{...f,className:N.mo("grid grid-cols-1 gap-4 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",m),children:l.map((r,c)=>s.jsxRuntimeExports.jsxs("div",{className:"relative",children:[s.jsxRuntimeExports.jsx(B,{image:r,index:c,onClick:n,fallbackImage:u}),h&&r.title&&s.jsxRuntimeExports.jsx("div",{className:"bg-bg/70 absolute bottom-0 flex min-h-10 w-full items-center justify-center text-center",children:r.title})]},r.id))}),E]})},$=a.memo(H);exports.MyGallery=$;
|
|
@@ -1,173 +1,200 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { memo as
|
|
3
|
-
import { l as
|
|
1
|
+
import { j as r } from "../../jsx-runtime-C5mzlN2N.js";
|
|
2
|
+
import { memo as A, useState as k, useMemo as j, useCallback as g, useEffect as R } from "react";
|
|
3
|
+
import { l as F } from "../../lodash-CYNxjS-I.js";
|
|
4
4
|
import { m as _ } from "../../utils-B6fNqzRf-B1_jG1K7.js";
|
|
5
|
-
import { c as
|
|
6
|
-
import { c as
|
|
5
|
+
import { c as E } from "../../_commonjsHelpers-DaMA6jEr.js";
|
|
6
|
+
import { c as L } from "../../createLucideIcon-B950nf2d.js";
|
|
7
7
|
/**
|
|
8
8
|
* @license lucide-react v0.511.0 - ISC
|
|
9
9
|
*
|
|
10
10
|
* This source code is licensed under the ISC license.
|
|
11
11
|
* See the LICENSE file in the root directory of this source tree.
|
|
12
12
|
*/
|
|
13
|
-
const
|
|
13
|
+
const S = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]], T = L("chevron-left", S);
|
|
14
14
|
/**
|
|
15
15
|
* @license lucide-react v0.511.0 - ISC
|
|
16
16
|
*
|
|
17
17
|
* This source code is licensed under the ISC license.
|
|
18
18
|
* See the LICENSE file in the root directory of this source tree.
|
|
19
19
|
*/
|
|
20
|
-
const
|
|
20
|
+
const D = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]], O = L("chevron-right", D);
|
|
21
21
|
/**
|
|
22
22
|
* @license lucide-react v0.511.0 - ISC
|
|
23
23
|
*
|
|
24
24
|
* This source code is licensed under the ISC license.
|
|
25
25
|
* See the LICENSE file in the root directory of this source tree.
|
|
26
26
|
*/
|
|
27
|
-
const
|
|
27
|
+
const U = [
|
|
28
28
|
["path", { d: "M12 15V3", key: "m9g1x1" }],
|
|
29
29
|
["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
|
|
30
30
|
["path", { d: "m7 10 5 5 5-5", key: "brsn70" }]
|
|
31
|
-
],
|
|
31
|
+
], z = L("download", U);
|
|
32
32
|
/**
|
|
33
33
|
* @license lucide-react v0.511.0 - ISC
|
|
34
34
|
*
|
|
35
35
|
* This source code is licensed under the ISC license.
|
|
36
36
|
* See the LICENSE file in the root directory of this source tree.
|
|
37
37
|
*/
|
|
38
|
-
const
|
|
38
|
+
const $ = [
|
|
39
39
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
40
40
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
41
|
-
],
|
|
42
|
-
var N = { exports: {} },
|
|
43
|
-
function
|
|
41
|
+
], B = L("x", $);
|
|
42
|
+
var N = { exports: {} }, H = N.exports, C;
|
|
43
|
+
function q() {
|
|
44
44
|
return C || (C = 1, function(l, v) {
|
|
45
|
-
(function(
|
|
46
|
-
|
|
47
|
-
})(
|
|
48
|
-
function
|
|
49
|
-
return typeof
|
|
45
|
+
(function(a, u) {
|
|
46
|
+
u();
|
|
47
|
+
})(H, function() {
|
|
48
|
+
function a(e, o) {
|
|
49
|
+
return typeof o > "u" ? o = { autoBom: !1 } : typeof o != "object" && (console.warn("Deprecated: Expected third argument to be a object"), o = { autoBom: !o }), o.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type) ? new Blob(["\uFEFF", e], { type: e.type }) : e;
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
var
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
},
|
|
51
|
+
function u(e, o, d) {
|
|
52
|
+
var n = new XMLHttpRequest();
|
|
53
|
+
n.open("GET", e), n.responseType = "blob", n.onload = function() {
|
|
54
|
+
f(n.response, o, d);
|
|
55
|
+
}, n.onerror = function() {
|
|
56
56
|
console.error("could not download file");
|
|
57
|
-
},
|
|
57
|
+
}, n.send();
|
|
58
58
|
}
|
|
59
|
-
function
|
|
60
|
-
var
|
|
61
|
-
|
|
59
|
+
function h(e) {
|
|
60
|
+
var o = new XMLHttpRequest();
|
|
61
|
+
o.open("HEAD", e, !1);
|
|
62
62
|
try {
|
|
63
|
-
|
|
63
|
+
o.send();
|
|
64
64
|
} catch {
|
|
65
65
|
}
|
|
66
|
-
return 200 <=
|
|
66
|
+
return 200 <= o.status && 299 >= o.status;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function p(e) {
|
|
69
69
|
try {
|
|
70
70
|
e.dispatchEvent(new MouseEvent("click"));
|
|
71
71
|
} catch {
|
|
72
|
-
var
|
|
73
|
-
|
|
72
|
+
var o = document.createEvent("MouseEvents");
|
|
73
|
+
o.initMouseEvent("click", !0, !0, window, 0, 0, 0, 80, 20, !1, !1, !1, !1, 0, null), e.dispatchEvent(o);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
var
|
|
77
|
-
} : "download" in HTMLAnchorElement.prototype && !
|
|
78
|
-
var
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
var t = typeof window == "object" && window.window === window ? window : typeof self == "object" && self.self === self ? self : typeof E == "object" && E.global === E ? E : void 0, x = t.navigator && /Macintosh/.test(navigator.userAgent) && /AppleWebKit/.test(navigator.userAgent) && !/Safari/.test(navigator.userAgent), f = t.saveAs || (typeof window != "object" || window !== t ? function() {
|
|
77
|
+
} : "download" in HTMLAnchorElement.prototype && !x ? function(e, o, d) {
|
|
78
|
+
var n = t.URL || t.webkitURL, i = document.createElement("a");
|
|
79
|
+
o = o || e.name || "download", i.download = o, i.rel = "noopener", typeof e == "string" ? (i.href = e, i.origin === location.origin ? p(i) : h(i.href) ? u(e, o, d) : p(i, i.target = "_blank")) : (i.href = n.createObjectURL(e), setTimeout(function() {
|
|
80
|
+
n.revokeObjectURL(i.href);
|
|
81
81
|
}, 4e4), setTimeout(function() {
|
|
82
|
-
|
|
82
|
+
p(i);
|
|
83
83
|
}, 0));
|
|
84
|
-
} : "msSaveOrOpenBlob" in navigator ? function(e,
|
|
85
|
-
if (
|
|
86
|
-
else if (
|
|
84
|
+
} : "msSaveOrOpenBlob" in navigator ? function(e, o, d) {
|
|
85
|
+
if (o = o || e.name || "download", typeof e != "string") navigator.msSaveOrOpenBlob(a(e, d), o);
|
|
86
|
+
else if (h(e)) u(e, o, d);
|
|
87
87
|
else {
|
|
88
|
-
var
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
var n = document.createElement("a");
|
|
89
|
+
n.href = e, n.target = "_blank", setTimeout(function() {
|
|
90
|
+
p(n);
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
|
-
} : function(e,
|
|
94
|
-
if (
|
|
95
|
-
var
|
|
96
|
-
if ((
|
|
97
|
-
var
|
|
98
|
-
|
|
99
|
-
var
|
|
100
|
-
|
|
101
|
-
},
|
|
93
|
+
} : function(e, o, d, n) {
|
|
94
|
+
if (n = n || open("", "_blank"), n && (n.document.title = n.document.body.innerText = "downloading..."), typeof e == "string") return u(e, o, d);
|
|
95
|
+
var i = e.type === "application/octet-stream", y = /constructor/i.test(t.HTMLElement) || t.safari, b = /CriOS\/[\d]+/.test(navigator.userAgent);
|
|
96
|
+
if ((b || i && y || x) && typeof FileReader < "u") {
|
|
97
|
+
var m = new FileReader();
|
|
98
|
+
m.onloadend = function() {
|
|
99
|
+
var c = m.result;
|
|
100
|
+
c = b ? c : c.replace(/^data:[^;]*;/, "data:attachment/file;"), n ? n.location.href = c : location = c, n = null;
|
|
101
|
+
}, m.readAsDataURL(e);
|
|
102
102
|
} else {
|
|
103
|
-
var
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
var w = t.URL || t.webkitURL, s = w.createObjectURL(e);
|
|
104
|
+
n ? n.location = s : location.href = s, n = null, setTimeout(function() {
|
|
105
|
+
w.revokeObjectURL(s);
|
|
106
106
|
}, 4e4);
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
|
-
|
|
109
|
+
t.saveAs = f.saveAs = f, l.exports = f;
|
|
110
110
|
});
|
|
111
111
|
}(N)), N.exports;
|
|
112
112
|
}
|
|
113
|
-
var
|
|
114
|
-
const
|
|
113
|
+
var G = q();
|
|
114
|
+
const I = () => [
|
|
115
115
|
{
|
|
116
|
-
icon: /* @__PURE__ */
|
|
116
|
+
icon: /* @__PURE__ */ r.jsx(z, { size: 20 }),
|
|
117
117
|
onClick: (l) => {
|
|
118
|
-
|
|
118
|
+
G.saveAs(l.src, l.title);
|
|
119
119
|
},
|
|
120
120
|
label: "Download"
|
|
121
121
|
}
|
|
122
|
-
],
|
|
122
|
+
], X = A(
|
|
123
|
+
({
|
|
124
|
+
src: l,
|
|
125
|
+
alt: v,
|
|
126
|
+
fallbackImage: a
|
|
127
|
+
}) => {
|
|
128
|
+
const [u, h] = k(!1), p = () => {
|
|
129
|
+
h(!0);
|
|
130
|
+
};
|
|
131
|
+
return /* @__PURE__ */ r.jsx(
|
|
132
|
+
"img",
|
|
133
|
+
{
|
|
134
|
+
src: u && a ? a : l,
|
|
135
|
+
alt: v,
|
|
136
|
+
className: "max-h-full max-w-full object-contain",
|
|
137
|
+
onError: p
|
|
138
|
+
}
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
), K = A(
|
|
123
142
|
({
|
|
124
143
|
image: l,
|
|
125
144
|
index: v,
|
|
126
|
-
onClick:
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
{
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
145
|
+
onClick: a,
|
|
146
|
+
fallbackImage: u
|
|
147
|
+
}) => {
|
|
148
|
+
const [h, p] = k(!1), t = () => {
|
|
149
|
+
p(!0);
|
|
150
|
+
};
|
|
151
|
+
return /* @__PURE__ */ r.jsx(
|
|
152
|
+
"div",
|
|
153
|
+
{
|
|
154
|
+
className: "aspect-video cursor-pointer overflow-hidden rounded-lg bg-gray-200 transition-opacity hover:opacity-80",
|
|
155
|
+
onClick: () => a(v),
|
|
156
|
+
children: /* @__PURE__ */ r.jsx(
|
|
157
|
+
"img",
|
|
158
|
+
{
|
|
159
|
+
src: h && u ? u : l.thumbnail || l.src,
|
|
160
|
+
alt: l.alt || `Image ${v + 1}`,
|
|
161
|
+
className: "h-full w-full object-cover",
|
|
162
|
+
onError: t
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
},
|
|
166
|
+
l.id
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
), P = ({
|
|
144
170
|
images: l,
|
|
145
171
|
actionButtons: v = [],
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
172
|
+
fallbackImage: a,
|
|
173
|
+
className: u,
|
|
174
|
+
hasInfo: h,
|
|
175
|
+
...p
|
|
149
176
|
}) => {
|
|
150
|
-
const [
|
|
151
|
-
() => [...
|
|
152
|
-
[
|
|
153
|
-
),
|
|
154
|
-
|
|
155
|
-
}, []),
|
|
156
|
-
|
|
157
|
-
}, []),
|
|
158
|
-
|
|
159
|
-
}, [
|
|
160
|
-
|
|
161
|
-
}, [
|
|
162
|
-
|
|
177
|
+
const [t, x] = k(null), [f, e] = k(!1), o = j(() => I(), []), d = j(
|
|
178
|
+
() => [...o, ...v],
|
|
179
|
+
[o, v]
|
|
180
|
+
), n = g((s) => {
|
|
181
|
+
x(s), e(!0);
|
|
182
|
+
}, []), i = g(() => {
|
|
183
|
+
e(!1), x(null);
|
|
184
|
+
}, []), y = g(() => {
|
|
185
|
+
t !== null && t > 0 && x(t - 1);
|
|
186
|
+
}, [t]), b = g(() => {
|
|
187
|
+
t !== null && t < l.length - 1 && x(t + 1);
|
|
188
|
+
}, [t, l.length]);
|
|
189
|
+
R(() => {
|
|
163
190
|
const s = (c) => {
|
|
164
191
|
if (f)
|
|
165
192
|
switch (c.key) {
|
|
166
193
|
case "Escape":
|
|
167
|
-
|
|
194
|
+
i();
|
|
168
195
|
break;
|
|
169
196
|
case "ArrowLeft":
|
|
170
|
-
c.preventDefault(),
|
|
197
|
+
c.preventDefault(), y();
|
|
171
198
|
break;
|
|
172
199
|
case "ArrowRight":
|
|
173
200
|
c.preventDefault(), b();
|
|
@@ -175,83 +202,86 @@ const q = () => [
|
|
|
175
202
|
}
|
|
176
203
|
};
|
|
177
204
|
return document.addEventListener("keydown", s), () => document.removeEventListener("keydown", s);
|
|
178
|
-
}, [f,
|
|
205
|
+
}, [f, y, b, i]), R(() => (f ? document.body.style.overflow = "hidden" : document.body.style.overflow = "unset", () => {
|
|
179
206
|
document.body.style.overflow = "unset";
|
|
180
207
|
}), [f]);
|
|
181
|
-
const
|
|
182
|
-
() =>
|
|
183
|
-
[
|
|
184
|
-
),
|
|
185
|
-
/* @__PURE__ */
|
|
208
|
+
const m = j(
|
|
209
|
+
() => t !== null ? l[t] : null,
|
|
210
|
+
[t, l]
|
|
211
|
+
), w = j(() => !f || !m ? null : /* @__PURE__ */ r.jsxs("div", { className: "bg-opacity-95 bg-bg fixed inset-0 z-50 flex flex-col items-center justify-center", children: [
|
|
212
|
+
/* @__PURE__ */ r.jsxs(
|
|
186
213
|
"div",
|
|
187
214
|
{
|
|
188
215
|
className: "absolute top-0 flex w-full items-start justify-between p-3",
|
|
189
216
|
children: [
|
|
190
|
-
/* @__PURE__ */
|
|
191
|
-
/* @__PURE__ */
|
|
192
|
-
|
|
217
|
+
/* @__PURE__ */ r.jsx("div", { children: m.title && /* @__PURE__ */ r.jsx("h2", { className: "text-body-lg-semi-bold", children: m.title }) }),
|
|
218
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex items-center gap-4 py-1", children: [
|
|
219
|
+
d.map((s, c) => /* @__PURE__ */ r.jsx(
|
|
193
220
|
"button",
|
|
194
221
|
{
|
|
195
|
-
onClick: () => s.onClick(
|
|
222
|
+
onClick: () => s.onClick(m),
|
|
196
223
|
className: "cursor-pointer",
|
|
197
224
|
title: s.label,
|
|
198
225
|
children: s.icon
|
|
199
226
|
},
|
|
200
227
|
c
|
|
201
228
|
)),
|
|
202
|
-
/* @__PURE__ */
|
|
229
|
+
/* @__PURE__ */ r.jsx(
|
|
203
230
|
"button",
|
|
204
231
|
{
|
|
205
|
-
onClick:
|
|
232
|
+
onClick: i,
|
|
206
233
|
className: "cursor-pointer",
|
|
207
234
|
title: "Close (Esc)",
|
|
208
|
-
children: /* @__PURE__ */
|
|
235
|
+
children: /* @__PURE__ */ r.jsx(B, { size: 20 })
|
|
209
236
|
}
|
|
210
237
|
)
|
|
211
238
|
] })
|
|
212
239
|
]
|
|
213
240
|
}
|
|
214
241
|
),
|
|
215
|
-
|
|
242
|
+
F.isNumber(t) && t > 0 && /* @__PURE__ */ r.jsx(
|
|
216
243
|
"button",
|
|
217
244
|
{
|
|
218
|
-
onClick:
|
|
245
|
+
onClick: y,
|
|
219
246
|
className: "bg-opacity-50 hover:bg-opacity-70 bg-bg text-secondary absolute top-1/2 left-2 z-50 -translate-y-1/2 rounded-full p-3 transition-all",
|
|
220
247
|
title: "Previous (←)",
|
|
221
|
-
children: /* @__PURE__ */
|
|
248
|
+
children: /* @__PURE__ */ r.jsx(T, { size: 24 })
|
|
222
249
|
}
|
|
223
250
|
),
|
|
224
|
-
|
|
251
|
+
F.isNumber(t) && t < l.length - 1 && /* @__PURE__ */ r.jsx(
|
|
225
252
|
"button",
|
|
226
253
|
{
|
|
227
254
|
onClick: b,
|
|
228
255
|
className: "bg-opacity-0 hover:bg-opacity-100 text-secondary bg-bg absolute top-1/2 right-2 z-50 -translate-y-1/2 rounded-full p-3 transition-all",
|
|
229
256
|
title: "Next (→)",
|
|
230
|
-
children: /* @__PURE__ */
|
|
257
|
+
children: /* @__PURE__ */ r.jsx(O, { size: 24 })
|
|
231
258
|
}
|
|
232
259
|
),
|
|
233
|
-
/* @__PURE__ */
|
|
234
|
-
|
|
260
|
+
/* @__PURE__ */ r.jsx("div", { className: "flex max-h-full max-w-full items-center justify-center overflow-hidden p-8", children: /* @__PURE__ */ r.jsx(
|
|
261
|
+
X,
|
|
235
262
|
{
|
|
236
|
-
src:
|
|
237
|
-
alt:
|
|
238
|
-
|
|
263
|
+
src: m.src,
|
|
264
|
+
alt: m.alt || `Image ${t}`,
|
|
265
|
+
fallbackImage: a
|
|
239
266
|
}
|
|
240
267
|
) }),
|
|
241
|
-
/* @__PURE__ */
|
|
268
|
+
/* @__PURE__ */ r.jsx("div", { className: "bg-bg absolute bottom-0 w-full", children: /* @__PURE__ */ r.jsx("div", { className: "flex gap-2 overflow-x-auto p-3", children: l.map((s, c) => /* @__PURE__ */ r.jsx(
|
|
242
269
|
"div",
|
|
243
270
|
{
|
|
244
271
|
className: _(
|
|
245
272
|
"hover:border-item-primary h-16 min-w-16 shrink-0 cursor-pointer rounded border-3 border-transparent transition-all",
|
|
246
|
-
c ==
|
|
273
|
+
c == t && "border-item-primary"
|
|
247
274
|
),
|
|
248
|
-
onClick: () =>
|
|
249
|
-
children: /* @__PURE__ */
|
|
275
|
+
onClick: () => x(c),
|
|
276
|
+
children: /* @__PURE__ */ r.jsx(
|
|
250
277
|
"img",
|
|
251
278
|
{
|
|
252
279
|
src: s.thumbnail || s.src,
|
|
253
280
|
alt: s.alt || `Thumbnail ${c + 1}`,
|
|
254
|
-
className: "size-full object-cover"
|
|
281
|
+
className: "size-full object-cover",
|
|
282
|
+
onError: (M) => {
|
|
283
|
+
a && (M.currentTarget.src = a);
|
|
284
|
+
}
|
|
255
285
|
}
|
|
256
286
|
)
|
|
257
287
|
},
|
|
@@ -259,26 +289,35 @@ const q = () => [
|
|
|
259
289
|
)) }) })
|
|
260
290
|
] }), [
|
|
261
291
|
f,
|
|
262
|
-
u,
|
|
263
|
-
t,
|
|
264
|
-
o,
|
|
265
|
-
r,
|
|
266
292
|
a,
|
|
293
|
+
m,
|
|
294
|
+
d,
|
|
295
|
+
i,
|
|
296
|
+
t,
|
|
297
|
+
y,
|
|
267
298
|
l,
|
|
268
299
|
b
|
|
269
300
|
]);
|
|
270
|
-
return /* @__PURE__ */
|
|
271
|
-
/* @__PURE__ */
|
|
301
|
+
return /* @__PURE__ */ r.jsxs("div", { className: "w-full", children: [
|
|
302
|
+
/* @__PURE__ */ r.jsx(
|
|
272
303
|
"div",
|
|
273
304
|
{
|
|
274
|
-
...
|
|
305
|
+
...p,
|
|
275
306
|
className: _(
|
|
276
307
|
"grid grid-cols-1 gap-4 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",
|
|
277
|
-
|
|
308
|
+
u
|
|
278
309
|
),
|
|
279
|
-
children: l.map((s, c) => /* @__PURE__ */
|
|
280
|
-
/* @__PURE__ */
|
|
281
|
-
|
|
310
|
+
children: l.map((s, c) => /* @__PURE__ */ r.jsxs("div", { className: "relative", children: [
|
|
311
|
+
/* @__PURE__ */ r.jsx(
|
|
312
|
+
K,
|
|
313
|
+
{
|
|
314
|
+
image: s,
|
|
315
|
+
index: c,
|
|
316
|
+
onClick: n,
|
|
317
|
+
fallbackImage: a
|
|
318
|
+
}
|
|
319
|
+
),
|
|
320
|
+
h && s.title && /* @__PURE__ */ r.jsx(
|
|
282
321
|
"div",
|
|
283
322
|
{
|
|
284
323
|
className: "bg-bg/70 absolute bottom-0 flex min-h-10 w-full items-center justify-center text-center",
|
|
@@ -288,9 +327,9 @@ const q = () => [
|
|
|
288
327
|
] }, s.id))
|
|
289
328
|
}
|
|
290
329
|
),
|
|
291
|
-
|
|
330
|
+
w
|
|
292
331
|
] });
|
|
293
|
-
},
|
|
332
|
+
}, ee = A(P);
|
|
294
333
|
export {
|
|
295
|
-
|
|
334
|
+
ee as MyGallery
|
|
296
335
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
2
|
export interface GalleryItem {
|
|
3
3
|
id: string;
|
|
4
4
|
src: string;
|
|
@@ -7,15 +7,16 @@ export interface GalleryItem {
|
|
|
7
7
|
title?: string;
|
|
8
8
|
}
|
|
9
9
|
export interface GalleryActionButton {
|
|
10
|
-
icon:
|
|
10
|
+
icon: ReactNode;
|
|
11
11
|
label: string;
|
|
12
12
|
onClick: (image: GalleryItem) => void;
|
|
13
13
|
className?: string;
|
|
14
14
|
}
|
|
15
15
|
export type MyGalleryProps = HTMLAttributes<HTMLDivElement> & {
|
|
16
16
|
images: GalleryItem[];
|
|
17
|
+
fallbackImage?: string;
|
|
17
18
|
actionButtons?: GalleryActionButton[];
|
|
18
19
|
hasInfo?: true;
|
|
19
20
|
};
|
|
20
|
-
export declare const MyGallery:
|
|
21
|
+
export declare const MyGallery: import("react").MemoExoticComponent<({ images, actionButtons, fallbackImage, className, hasInfo, ...props }: MyGalleryProps) => import("react/jsx-runtime").JSX.Element>;
|
|
21
22
|
//# sourceMappingURL=MyGallery.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MyGallery.d.ts","sourceRoot":"","sources":["../../../../src/components/gallery/MyGallery.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"MyGallery.d.ts","sourceRoot":"","sources":["../../../../src/components/gallery/MyGallery.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AAMf,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,cAAc,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAC5D,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACtC,OAAO,CAAC,EAAE,IAAI,CAAC;CAChB,CAAC;AA4TF,eAAO,MAAM,SAAS,+GAnOnB,cAAc,6CAmOgC,CAAC"}
|