meta-mosaic 1.0.12 → 1.1.0

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/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
- import oe, { useState as _, useEffect as O, useRef as se } from "react";
2
- var X = { exports: {} }, P = {};
1
+ import ne, { useState as O, useEffect as y, useRef as se } from "react";
2
+ var X = { exports: {} }, C = {};
3
3
  /**
4
4
  * @license React
5
5
  * react-jsx-runtime.production.js
@@ -11,27 +11,27 @@ var X = { exports: {} }, P = {};
11
11
  */
12
12
  var K;
13
13
  function ae() {
14
- if (K) return P;
14
+ if (K) return C;
15
15
  K = 1;
16
- var t = Symbol.for("react.transitional.element"), c = Symbol.for("react.fragment");
17
- function o(u, s, a) {
18
- var d = null;
19
- if (a !== void 0 && (d = "" + a), s.key !== void 0 && (d = "" + s.key), "key" in s) {
16
+ var t = Symbol.for("react.transitional.element"), u = Symbol.for("react.fragment");
17
+ function n(l, s, a) {
18
+ var m = null;
19
+ if (a !== void 0 && (m = "" + a), s.key !== void 0 && (m = "" + s.key), "key" in s) {
20
20
  a = {};
21
- for (var m in s)
22
- m !== "key" && (a[m] = s[m]);
21
+ for (var p in s)
22
+ p !== "key" && (a[p] = s[p]);
23
23
  } else a = s;
24
24
  return s = a.ref, {
25
25
  $$typeof: t,
26
- type: u,
27
- key: d,
26
+ type: l,
27
+ key: m,
28
28
  ref: s !== void 0 ? s : null,
29
29
  props: a
30
30
  };
31
31
  }
32
- return P.Fragment = c, P.jsx = o, P.jsxs = o, P;
32
+ return C.Fragment = u, C.jsx = n, C.jsxs = n, C;
33
33
  }
34
- var y = {};
34
+ var N = {};
35
35
  /**
36
36
  * @license React
37
37
  * react-jsx-runtime.development.js
@@ -50,33 +50,33 @@ function le() {
50
50
  return e.$$typeof === re ? null : e.displayName || e.name || null;
51
51
  if (typeof e == "string") return e;
52
52
  switch (e) {
53
- case S:
53
+ case x:
54
54
  return "Fragment";
55
- case I:
55
+ case Y:
56
56
  return "Profiler";
57
- case $:
57
+ case M:
58
58
  return "StrictMode";
59
- case R:
59
+ case _:
60
60
  return "Suspense";
61
- case z:
61
+ case $:
62
62
  return "SuspenseList";
63
- case A:
63
+ case j:
64
64
  return "Activity";
65
65
  }
66
66
  if (typeof e == "object")
67
67
  switch (typeof e.tag == "number" && console.error(
68
68
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
69
69
  ), e.$$typeof) {
70
- case N:
70
+ case A:
71
71
  return "Portal";
72
- case Y:
72
+ case D:
73
73
  return (e.displayName || "Context") + ".Provider";
74
- case M:
74
+ case z:
75
75
  return (e._context.displayName || "Context") + ".Consumer";
76
- case x:
76
+ case h:
77
77
  var r = e.render;
78
78
  return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
79
- case D:
79
+ case S:
80
80
  return r = e.displayName || null, r !== null ? r : t(e.type) || "Memo";
81
81
  case g:
82
82
  r = e._payload, e = e._init;
@@ -87,28 +87,28 @@ function le() {
87
87
  }
88
88
  return null;
89
89
  }
90
- function c(e) {
90
+ function u(e) {
91
91
  return "" + e;
92
92
  }
93
- function o(e) {
93
+ function n(e) {
94
94
  try {
95
- c(e);
95
+ u(e);
96
96
  var r = !1;
97
97
  } catch {
98
98
  r = !0;
99
99
  }
100
100
  if (r) {
101
101
  r = console;
102
- var n = r.error, l = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
103
- return n.call(
102
+ var o = r.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
103
+ return o.call(
104
104
  r,
105
105
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
106
- l
107
- ), c(e);
106
+ i
107
+ ), u(e);
108
108
  }
109
109
  }
110
- function u(e) {
111
- if (e === S) return "<>";
110
+ function l(e) {
111
+ if (e === x) return "<>";
112
112
  if (typeof e == "object" && e !== null && e.$$typeof === g)
113
113
  return "<...>";
114
114
  try {
@@ -119,47 +119,47 @@ function le() {
119
119
  }
120
120
  }
121
121
  function s() {
122
- var e = L.A;
122
+ var e = F.A;
123
123
  return e === null ? null : e.getOwner();
124
124
  }
125
125
  function a() {
126
126
  return Error("react-stack-top-frame");
127
127
  }
128
- function d(e) {
128
+ function m(e) {
129
129
  if (q.call(e, "key")) {
130
130
  var r = Object.getOwnPropertyDescriptor(e, "key").get;
131
131
  if (r && r.isReactWarning) return !1;
132
132
  }
133
133
  return e.key !== void 0;
134
134
  }
135
- function m(e, r) {
136
- function n() {
135
+ function p(e, r) {
136
+ function o() {
137
137
  G || (G = !0, console.error(
138
138
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
139
139
  r
140
140
  ));
141
141
  }
142
- n.isReactWarning = !0, Object.defineProperty(e, "key", {
143
- get: n,
142
+ o.isReactWarning = !0, Object.defineProperty(e, "key", {
143
+ get: o,
144
144
  configurable: !0
145
145
  });
146
146
  }
147
- function E() {
147
+ function T() {
148
148
  var e = t(this.type);
149
149
  return J[e] || (J[e] = !0, console.error(
150
150
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
151
151
  )), e = this.props.ref, e !== void 0 ? e : null;
152
152
  }
153
- function b(e, r, n, l, k, v, W, U) {
154
- return n = v.ref, e = {
155
- $$typeof: T,
153
+ function f(e, r, o, i, w, E, W, U) {
154
+ return o = E.ref, e = {
155
+ $$typeof: k,
156
156
  type: e,
157
157
  key: r,
158
- props: v,
159
- _owner: k
160
- }, (n !== void 0 ? n : null) !== null ? Object.defineProperty(e, "ref", {
158
+ props: E,
159
+ _owner: w
160
+ }, (o !== void 0 ? o : null) !== null ? Object.defineProperty(e, "ref", {
161
161
  enumerable: !1,
162
- get: E
162
+ get: T
163
163
  }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
164
164
  configurable: !1,
165
165
  enumerable: !1,
@@ -182,112 +182,112 @@ function le() {
182
182
  value: U
183
183
  }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
184
184
  }
185
- function h(e, r, n, l, k, v, W, U) {
186
- var i = r.children;
187
- if (i !== void 0)
188
- if (l)
189
- if (te(i)) {
190
- for (l = 0; l < i.length; l++)
191
- w(i[l]);
192
- Object.freeze && Object.freeze(i);
185
+ function v(e, r, o, i, w, E, W, U) {
186
+ var c = r.children;
187
+ if (c !== void 0)
188
+ if (i)
189
+ if (te(c)) {
190
+ for (i = 0; i < c.length; i++)
191
+ R(c[i]);
192
+ Object.freeze && Object.freeze(c);
193
193
  } else
194
194
  console.error(
195
195
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
196
196
  );
197
- else w(i);
197
+ else R(c);
198
198
  if (q.call(r, "key")) {
199
- i = t(e);
200
- var j = Object.keys(r).filter(function(ne) {
201
- return ne !== "key";
199
+ c = t(e);
200
+ var P = Object.keys(r).filter(function(oe) {
201
+ return oe !== "key";
202
202
  });
203
- l = 0 < j.length ? "{key: someKey, " + j.join(": ..., ") + ": ...}" : "{key: someKey}", Z[i + l] || (j = 0 < j.length ? "{" + j.join(": ..., ") + ": ...}" : "{}", console.error(
203
+ i = 0 < P.length ? "{key: someKey, " + P.join(": ..., ") + ": ...}" : "{key: someKey}", Z[c + i] || (P = 0 < P.length ? "{" + P.join(": ..., ") + ": ...}" : "{}", console.error(
204
204
  `A props object containing a "key" prop is being spread into JSX:
205
205
  let props = %s;
206
206
  <%s {...props} />
207
207
  React keys must be passed directly to JSX without using spread:
208
208
  let props = %s;
209
209
  <%s key={someKey} {...props} />`,
210
- l,
211
210
  i,
212
- j,
213
- i
214
- ), Z[i + l] = !0);
211
+ c,
212
+ P,
213
+ c
214
+ ), Z[c + i] = !0);
215
215
  }
216
- if (i = null, n !== void 0 && (o(n), i = "" + n), d(r) && (o(r.key), i = "" + r.key), "key" in r) {
217
- n = {};
216
+ if (c = null, o !== void 0 && (n(o), c = "" + o), m(r) && (n(r.key), c = "" + r.key), "key" in r) {
217
+ o = {};
218
218
  for (var V in r)
219
- V !== "key" && (n[V] = r[V]);
220
- } else n = r;
221
- return i && m(
222
- n,
219
+ V !== "key" && (o[V] = r[V]);
220
+ } else o = r;
221
+ return c && p(
222
+ o,
223
223
  typeof e == "function" ? e.displayName || e.name || "Unknown" : e
224
- ), b(
224
+ ), f(
225
225
  e,
226
- i,
227
- v,
228
- k,
226
+ c,
227
+ E,
228
+ w,
229
229
  s(),
230
- n,
230
+ o,
231
231
  W,
232
232
  U
233
233
  );
234
234
  }
235
- function w(e) {
236
- typeof e == "object" && e !== null && e.$$typeof === T && e._store && (e._store.validated = 1);
235
+ function R(e) {
236
+ typeof e == "object" && e !== null && e.$$typeof === k && e._store && (e._store.validated = 1);
237
237
  }
238
- var p = oe, T = Symbol.for("react.transitional.element"), N = Symbol.for("react.portal"), S = Symbol.for("react.fragment"), $ = Symbol.for("react.strict_mode"), I = Symbol.for("react.profiler"), M = Symbol.for("react.consumer"), Y = Symbol.for("react.context"), x = Symbol.for("react.forward_ref"), R = Symbol.for("react.suspense"), z = Symbol.for("react.suspense_list"), D = Symbol.for("react.memo"), g = Symbol.for("react.lazy"), A = Symbol.for("react.activity"), re = Symbol.for("react.client.reference"), L = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, q = Object.prototype.hasOwnProperty, te = Array.isArray, F = console.createTask ? console.createTask : function() {
238
+ var b = ne, k = Symbol.for("react.transitional.element"), A = Symbol.for("react.portal"), x = Symbol.for("react.fragment"), M = Symbol.for("react.strict_mode"), Y = Symbol.for("react.profiler"), z = Symbol.for("react.consumer"), D = Symbol.for("react.context"), h = Symbol.for("react.forward_ref"), _ = Symbol.for("react.suspense"), $ = Symbol.for("react.suspense_list"), S = Symbol.for("react.memo"), g = Symbol.for("react.lazy"), j = Symbol.for("react.activity"), re = Symbol.for("react.client.reference"), F = b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, q = Object.prototype.hasOwnProperty, te = Array.isArray, L = console.createTask ? console.createTask : function() {
239
239
  return null;
240
240
  };
241
- p = {
241
+ b = {
242
242
  "react-stack-bottom-frame": function(e) {
243
243
  return e();
244
244
  }
245
245
  };
246
- var G, J = {}, B = p["react-stack-bottom-frame"].bind(
247
- p,
246
+ var G, J = {}, H = b["react-stack-bottom-frame"].bind(
247
+ b,
248
248
  a
249
- )(), H = F(u(a)), Z = {};
250
- y.Fragment = S, y.jsx = function(e, r, n, l, k) {
251
- var v = 1e4 > L.recentlyCreatedOwnerStacks++;
252
- return h(
249
+ )(), B = L(l(a)), Z = {};
250
+ N.Fragment = x, N.jsx = function(e, r, o, i, w) {
251
+ var E = 1e4 > F.recentlyCreatedOwnerStacks++;
252
+ return v(
253
253
  e,
254
254
  r,
255
- n,
255
+ o,
256
256
  !1,
257
- l,
258
- k,
259
- v ? Error("react-stack-top-frame") : B,
260
- v ? F(u(e)) : H
257
+ i,
258
+ w,
259
+ E ? Error("react-stack-top-frame") : H,
260
+ E ? L(l(e)) : B
261
261
  );
262
- }, y.jsxs = function(e, r, n, l, k) {
263
- var v = 1e4 > L.recentlyCreatedOwnerStacks++;
264
- return h(
262
+ }, N.jsxs = function(e, r, o, i, w) {
263
+ var E = 1e4 > F.recentlyCreatedOwnerStacks++;
264
+ return v(
265
265
  e,
266
266
  r,
267
- n,
267
+ o,
268
268
  !0,
269
- l,
270
- k,
271
- v ? Error("react-stack-top-frame") : B,
272
- v ? F(u(e)) : H
269
+ i,
270
+ w,
271
+ E ? Error("react-stack-top-frame") : H,
272
+ E ? L(l(e)) : B
273
273
  );
274
274
  };
275
- }()), y;
275
+ }()), N;
276
276
  }
277
277
  process.env.NODE_ENV === "production" ? X.exports = ae() : X.exports = le();
278
- var f = X.exports;
279
- const C = {
278
+ var d = X.exports;
279
+ const I = {
280
280
  sm: 600,
281
281
  md: 960,
282
282
  lg: 1280,
283
283
  xl: 1920
284
- }, ee = (t) => t >= C.xl ? "xl" : t >= C.lg ? "lg" : t >= C.md ? "md" : t >= C.sm ? "sm" : "xs", ie = () => {
285
- const [t, c] = _(() => ee(window.innerWidth));
286
- return O(() => {
287
- const o = () => {
288
- c(ee(window.innerWidth));
284
+ }, ee = (t) => t >= I.xl ? "xl" : t >= I.lg ? "lg" : t >= I.md ? "md" : t >= I.sm ? "sm" : "xs", ie = () => {
285
+ const [t, u] = O(() => ee(window.innerWidth));
286
+ return y(() => {
287
+ const n = () => {
288
+ u(ee(window.innerWidth));
289
289
  };
290
- return window.addEventListener("resize", o), () => window.removeEventListener("resize", o);
290
+ return window.addEventListener("resize", n), () => window.removeEventListener("resize", n);
291
291
  }, []), {
292
292
  isXs: t === "xs",
293
293
  isSm: t === "sm",
@@ -298,28 +298,33 @@ const C = {
298
298
  };
299
299
  }, ce = ({
300
300
  image: t,
301
- bgImageUrl: c,
302
- width: o,
303
- height: u,
304
- bgPosition: s,
305
- onClickCard: a
301
+ bgImageUrl: u,
302
+ width: n,
303
+ height: l,
304
+ row: s,
305
+ col: a,
306
+ totalRows: m,
307
+ totalCols: p,
308
+ onClickCard: T
306
309
  }) => {
307
- const [d, m] = _(!1);
308
- return O(() => {
310
+ const [f, v] = O(!1);
311
+ y(() => {
309
312
  if (!(t != null && t.link)) return;
310
- const E = new Image();
311
- E.src = t.link, E.onload = () => m(!0), E.onerror = () => m(!1);
312
- }, [t]), /* @__PURE__ */ f.jsx("div", { className: "mosaic-cell-wrapper", children: d ? /* @__PURE__ */ f.jsx(
313
+ const x = new Image();
314
+ x.src = t.link, x.onload = () => v(!0), x.onerror = () => v(!1);
315
+ }, [t]);
316
+ const R = n / p, b = l / m, k = Number((-(a * R)).toFixed(5)), A = Number((-(s * b)).toFixed(5));
317
+ return /* @__PURE__ */ d.jsx("div", { className: "mosaic-cell-wrapper", children: f ? /* @__PURE__ */ d.jsx(
313
318
  "div",
314
319
  {
315
320
  className: "mosaic-cell",
316
321
  style: {
317
- backgroundImage: `url(${c})`,
318
- backgroundSize: `${o}px ${u}px`,
319
- backgroundPosition: s
322
+ backgroundImage: `url(${u})`,
323
+ backgroundSize: `${n}px ${l}px`,
324
+ backgroundPosition: `${k}px ${A}px`
320
325
  },
321
- onClick: () => a(t),
322
- children: /* @__PURE__ */ f.jsx(
326
+ onClick: () => T(t),
327
+ children: /* @__PURE__ */ d.jsx(
323
328
  "div",
324
329
  {
325
330
  className: "mosaic-cell-img",
@@ -330,38 +335,38 @@ const C = {
330
335
  }
331
336
  )
332
337
  }
333
- ) : null }, t.id);
338
+ ) : null });
334
339
  }, ue = ({
335
340
  image: t,
336
- onClose: c,
337
- animationType: o = "bottom",
338
- position: u,
341
+ onClose: u,
342
+ animationType: n = "bottom",
343
+ position: l,
339
344
  setDialog: s
340
345
  // 🆕 New prop
341
346
  }) => {
342
- const [a, d] = _(!0), [m, E] = _({}), b = se();
343
- O(() => (document.body.style.overflow = "hidden", () => {
347
+ const [a, m] = O(!0), [p, T] = O({}), f = se();
348
+ y(() => (document.body.style.overflow = "hidden", () => {
344
349
  document.body.style.overflow = "";
345
- }), []), O(() => {
346
- if (o === "position" && b.current && u) {
347
- const { offsetWidth: p, offsetHeight: T } = b.current;
348
- E({
350
+ }), []), y(() => {
351
+ if (n === "position" && f.current && l) {
352
+ const { offsetWidth: b, offsetHeight: k } = f.current;
353
+ T({
349
354
  position: "absolute",
350
- left: u.x - p / 2,
351
- top: u.y - T / 2
355
+ left: l.x - b / 2,
356
+ top: l.y - k / 2
352
357
  });
353
358
  }
354
- }, [o, u]);
355
- const h = () => {
356
- d(!1), setTimeout(() => {
357
- c();
359
+ }, [n, l]);
360
+ const v = () => {
361
+ m(!1), setTimeout(() => {
362
+ u();
358
363
  }, 300);
359
- }, w = a ? o === "position" ? "zoom-in" : `slide-in-${o}` : o === "position" ? "zoom-out" : `slide-out-${o}`;
360
- return /* @__PURE__ */ f.jsx(
364
+ }, R = a ? n === "position" ? "zoom-in" : `slide-in-${n}` : n === "position" ? "zoom-out" : `slide-out-${n}`;
365
+ return /* @__PURE__ */ d.jsx(
361
366
  "div",
362
367
  {
363
368
  className: "dialog-overlay",
364
- onClick: h,
369
+ onClick: v,
365
370
  style: {
366
371
  position: "fixed",
367
372
  top: 0,
@@ -374,12 +379,12 @@ const C = {
374
379
  alignItems: "center",
375
380
  zIndex: 1e3
376
381
  },
377
- children: /* @__PURE__ */ f.jsx(
382
+ children: /* @__PURE__ */ d.jsx(
378
383
  "div",
379
384
  {
380
- ref: b,
381
- className: `dialog-content ${w}`,
382
- onClick: (p) => p.stopPropagation(),
385
+ ref: f,
386
+ className: `dialog-content ${R}`,
387
+ onClick: (b) => b.stopPropagation(),
383
388
  style: {
384
389
  backgroundColor: "#fff",
385
390
  padding: "20px",
@@ -387,11 +392,11 @@ const C = {
387
392
  maxWidth: "90%",
388
393
  maxHeight: "90%",
389
394
  overflow: "auto",
390
- ...o === "position" ? m : {}
395
+ ...n === "position" ? p : {}
391
396
  },
392
- children: typeof s == "function" ? s(t) : /* @__PURE__ */ f.jsxs(f.Fragment, { children: [
393
- /* @__PURE__ */ f.jsx("h3", { children: "Image Info" }),
394
- /* @__PURE__ */ f.jsx(
397
+ children: typeof s == "function" ? s(t) : /* @__PURE__ */ d.jsxs(d.Fragment, { children: [
398
+ /* @__PURE__ */ d.jsx("h3", { children: "Image Info" }),
399
+ /* @__PURE__ */ d.jsx(
395
400
  "img",
396
401
  {
397
402
  src: t.link,
@@ -399,7 +404,7 @@ const C = {
399
404
  style: { width: "100%", height: "auto", borderRadius: "4px" }
400
405
  }
401
406
  ),
402
- /* @__PURE__ */ f.jsxs("p", { children: [
407
+ /* @__PURE__ */ d.jsxs("p", { children: [
403
408
  "ID: ",
404
409
  t.id
405
410
  ] })
@@ -410,63 +415,67 @@ const C = {
410
415
  );
411
416
  }, de = ({
412
417
  images: t = [],
413
- size: c = 14,
414
- bgImageUrl: o = null,
415
- gridWrapperClassName: u = null,
418
+ size: u = 14,
419
+ bgImageUrl: n = null,
420
+ gridWrapperClassName: l = null,
416
421
  gridWrapperStyle: s = {},
417
422
  width: a = { xs: 350, md: 500, lg: 700 },
418
- height: d = { xs: 350, md: 500, lg: 700 },
419
- bgPosition: m = "center",
420
- setDialog: E = null
423
+ height: m = { xs: 350, md: 500, lg: 700 },
424
+ bgPosition: p = "center",
425
+ setDialog: T = null
421
426
  }) => {
422
- const [b, h] = _(c), [w, p] = _(!1), [T, N] = _({}), S = (g = null) => {
423
- g && N(g), p(!0);
424
- }, $ = () => p(!1), { isXs: I, isMd: M, isLg: Y } = ie();
425
- let x = 350, R = 350;
426
- I && (x = a.xs, R = d.xs), M && (x = a.md || 350, R = d.md || 350), Y && (x = a.lg || 350, R = d.lg || 350), O(() => {
427
- c > 0 && h(c);
428
- }, [c]), O(() => {
429
- if (b * b < t.length) {
430
- const A = Math.ceil(Math.sqrt(t.length));
431
- A !== b && h(A);
427
+ const [f, v] = O(u), [R, b] = O(!1), [k, A] = O({}), x = (g = null) => {
428
+ g && A(g), b(!0);
429
+ }, M = () => b(!1), { isXs: Y, isMd: z, isLg: D } = ie();
430
+ let h = 350, _ = 350;
431
+ Y && (h = a.xs, _ = m.xs), z && (h = a.md || 350, _ = m.md || 350), D && (h = a.lg || 350, _ = m.lg || 350), y(() => {
432
+ u > 0 && v(u);
433
+ }, [u]), y(() => {
434
+ if (f * f < t.length) {
435
+ const j = Math.ceil(Math.sqrt(t.length));
436
+ j !== f && v(j);
432
437
  }
433
- }, [t.length, b]);
434
- let z = b, D = b;
435
- return /* @__PURE__ */ f.jsxs(
438
+ }, [t.length, f]);
439
+ let $ = f, S = f;
440
+ return /* @__PURE__ */ d.jsxs(
436
441
  "div",
437
442
  {
438
- className: `mosaic-grid-wrapper ${u || ""}`,
443
+ className: `mosaic-grid-wrapper ${l || ""}`,
439
444
  style: {
440
- gridTemplateColumns: `repeat(${D}, 1fr)`,
441
- gridTemplateRows: `repeat(${z}, 1fr)`,
442
- backgroundImage: `url(${o})`,
443
- backgroundSize: `${x}px ${R}px`,
444
- backgroundPosition: m,
445
- width: `${x}px`,
446
- height: `${R}px`,
445
+ gridTemplateColumns: `repeat(${S}, 1fr)`,
446
+ gridTemplateRows: `repeat(${$}, 1fr)`,
447
+ backgroundImage: `url(${n})`,
448
+ backgroundSize: `${h}px ${_}px`,
449
+ backgroundPosition: "0px 0px",
450
+ width: `${h}px`,
451
+ height: `${_}px`,
447
452
  ...s
448
453
  },
449
454
  children: [
450
- /* @__PURE__ */ f.jsx("div", { className: "mosaic-grid-wrapper-overlay" }),
451
- t.map((g) => /* @__PURE__ */ f.jsx(
455
+ /* @__PURE__ */ d.jsx("div", { className: "mosaic-grid-wrapper-overlay" }),
456
+ t.map((g, j) => /* @__PURE__ */ d.jsx(
452
457
  ce,
453
458
  {
454
459
  image: g,
455
- bgImageUrl: o,
456
- width: x,
457
- height: R,
458
- bgPosition: m,
459
- onClickCard: S
460
- }
460
+ bgImageUrl: n,
461
+ width: h,
462
+ height: _,
463
+ row: Math.floor(j / S),
464
+ col: j % S,
465
+ totalRows: $,
466
+ totalCols: S,
467
+ onClickCard: x
468
+ },
469
+ g.id
461
470
  )),
462
- w && /* @__PURE__ */ f.jsx(
471
+ R && /* @__PURE__ */ d.jsx(
463
472
  ue,
464
473
  {
465
- image: T,
466
- onClose: $,
474
+ image: k,
475
+ onClose: M,
467
476
  animationType: "top",
468
477
  position: "top",
469
- setDialog: E
478
+ setDialog: T
470
479
  }
471
480
  )
472
481
  ]
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(_,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],s):(_=typeof globalThis<"u"?globalThis:_||self,s(_.MetaMosaic={},_.React))})(this,function(_,s){"use strict";var N={exports:{}},O={};/**
1
+ (function(S,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],s):(S=typeof globalThis<"u"?globalThis:S||self,s(S.MetaMosaic={},S.React))})(this,function(S,s){"use strict";var Y={exports:{}},A={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var J;function re(){if(J)return O;J=1;var t=Symbol.for("react.transitional.element"),u=Symbol.for("react.fragment");function o(f,a,l){var m=null;if(l!==void 0&&(m=""+l),a.key!==void 0&&(m=""+a.key),"key"in a){l={};for(var b in a)b!=="key"&&(l[b]=a[b])}else l=a;return a=l.ref,{$$typeof:t,type:f,key:m,ref:a!==void 0?a:null,props:l}}return O.Fragment=u,O.jsx=o,O.jsxs=o,O}var y={};/**
9
+ */var J;function re(){if(J)return A;J=1;var t=Symbol.for("react.transitional.element"),f=Symbol.for("react.fragment");function o(c,a,l){var b=null;if(l!==void 0&&(b=""+l),a.key!==void 0&&(b=""+a.key),"key"in a){l={};for(var E in a)E!=="key"&&(l[E]=a[E])}else l=a;return a=l.ref,{$$typeof:t,type:c,key:b,ref:a!==void 0?a:null,props:l}}return A.Fragment=f,A.jsx=o,A.jsxs=o,A}var C={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,9 +14,9 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var B;function te(){return B||(B=1,process.env.NODE_ENV!=="production"&&function(){function t(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===le?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case P:return"Fragment";case Y:return"Profiler";case M:return"StrictMode";case g:return"Suspense";case L:return"SuspenseList";case C:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case I:return"Portal";case D:return(e.displayName||"Context")+".Provider";case z:return(e._context.displayName||"Context")+".Consumer";case R:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case F:return r=e.displayName||null,r!==null?r:t(e.type)||"Memo";case k:r=e._payload,e=e._init;try{return t(e(r))}catch{}}return null}function u(e){return""+e}function o(e){try{u(e);var r=!1}catch{r=!0}if(r){r=console;var n=r.error,c=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",c),u(e)}}function f(e){if(e===P)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===k)return"<...>";try{var r=t(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function a(){var e=W.A;return e===null?null:e.getOwner()}function l(){return Error("react-stack-top-frame")}function m(e){if(Z.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function b(e,r){function n(){$||($=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}function x(){var e=t(this.type);return K[e]||(K[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function p(e,r,n,c,h,v,V,X){return n=v.ref,e={$$typeof:S,type:e,key:r,props:v,_owner:h},(n!==void 0?n:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:x}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:V}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:X}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function T(e,r,n,c,h,v,V,X){var i=r.children;if(i!==void 0)if(c)if(ce(i)){for(c=0;c<i.length;c++)w(i[c]);Object.freeze&&Object.freeze(i)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else w(i);if(Z.call(r,"key")){i=t(e);var j=Object.keys(r).filter(function(ie){return ie!=="key"});c=0<j.length?"{key: someKey, "+j.join(": ..., ")+": ...}":"{key: someKey}",ee[i+c]||(j=0<j.length?"{"+j.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
17
+ */var H;function te(){return H||(H=1,process.env.NODE_ENV!=="production"&&function(){function t(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===le?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case g:return"Fragment";case D:return"Profiler";case z:return"StrictMode";case w:return"Suspense";case M:return"SuspenseList";case O:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case N:return"Portal";case L:return(e.displayName||"Context")+".Provider";case F:return(e._context.displayName||"Context")+".Consumer";case _:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case P:return r=e.displayName||null,r!==null?r:t(e.type)||"Memo";case R:r=e._payload,e=e._init;try{return t(e(r))}catch{}}return null}function f(e){return""+e}function o(e){try{f(e);var r=!1}catch{r=!0}if(r){r=console;var n=r.error,i=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",i),f(e)}}function c(e){if(e===g)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===R)return"<...>";try{var r=t(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function a(){var e=W.A;return e===null?null:e.getOwner()}function l(){return Error("react-stack-top-frame")}function b(e){if(Z.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function E(e,r){function n(){$||($=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}function j(){var e=t(this.type);return K[e]||(K[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function m(e,r,n,i,T,x,V,X){return n=x.ref,e={$$typeof:h,type:e,key:r,props:x,_owner:T},(n!==void 0?n:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:j}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:V}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:X}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function v(e,r,n,i,T,x,V,X){var u=r.children;if(u!==void 0)if(i)if(ce(u)){for(i=0;i<u.length;i++)k(u[i]);Object.freeze&&Object.freeze(u)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else k(u);if(Z.call(r,"key")){u=t(e);var y=Object.keys(r).filter(function(ie){return ie!=="key"});i=0<y.length?"{key: someKey, "+y.join(": ..., ")+": ...}":"{key: someKey}",ee[u+i]||(y=0<y.length?"{"+y.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
18
  let props = %s;
19
19
  <%s {...props} />
20
20
  React keys must be passed directly to JSX without using spread:
21
21
  let props = %s;
22
- <%s key={someKey} {...props} />`,c,i,j,i),ee[i+c]=!0)}if(i=null,n!==void 0&&(o(n),i=""+n),m(r)&&(o(r.key),i=""+r.key),"key"in r){n={};for(var G in r)G!=="key"&&(n[G]=r[G])}else n=r;return i&&b(n,typeof e=="function"?e.displayName||e.name||"Unknown":e),p(e,i,v,h,a(),n,V,X)}function w(e){typeof e=="object"&&e!==null&&e.$$typeof===S&&e._store&&(e._store.validated=1)}var E=s,S=Symbol.for("react.transitional.element"),I=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),Y=Symbol.for("react.profiler"),z=Symbol.for("react.consumer"),D=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),C=Symbol.for("react.activity"),le=Symbol.for("react.client.reference"),W=E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=Object.prototype.hasOwnProperty,ce=Array.isArray,U=console.createTask?console.createTask:function(){return null};E={"react-stack-bottom-frame":function(e){return e()}};var $,K={},Q=E["react-stack-bottom-frame"].bind(E,l)(),q=U(f(l)),ee={};y.Fragment=P,y.jsx=function(e,r,n,c,h){var v=1e4>W.recentlyCreatedOwnerStacks++;return T(e,r,n,!1,c,h,v?Error("react-stack-top-frame"):Q,v?U(f(e)):q)},y.jsxs=function(e,r,n,c,h){var v=1e4>W.recentlyCreatedOwnerStacks++;return T(e,r,n,!0,c,h,v?Error("react-stack-top-frame"):Q,v?U(f(e)):q)}}()),y}process.env.NODE_ENV==="production"?N.exports=re():N.exports=te();var d=N.exports;const A={sm:600,md:960,lg:1280,xl:1920},H=t=>t>=A.xl?"xl":t>=A.lg?"lg":t>=A.md?"md":t>=A.sm?"sm":"xs",ne=()=>{const[t,u]=s.useState(()=>H(window.innerWidth));return s.useEffect(()=>{const o=()=>{u(H(window.innerWidth))};return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),{isXs:t==="xs",isSm:t==="sm",isMd:t==="md",isLg:t==="lg",isXl:t==="xl",current:t}},oe=({image:t,bgImageUrl:u,width:o,height:f,bgPosition:a,onClickCard:l})=>{const[m,b]=s.useState(!1);return s.useEffect(()=>{if(!(t!=null&&t.link))return;const x=new Image;x.src=t.link,x.onload=()=>b(!0),x.onerror=()=>b(!1)},[t]),d.jsx("div",{className:"mosaic-cell-wrapper",children:m?d.jsx("div",{className:"mosaic-cell",style:{backgroundImage:`url(${u})`,backgroundSize:`${o}px ${f}px`,backgroundPosition:a},onClick:()=>l(t),children:d.jsx("div",{className:"mosaic-cell-img",style:{backgroundImage:`url(${t.link})`,backgroundSize:"cover"}})}):null},t.id)},se=({image:t,onClose:u,animationType:o="bottom",position:f,setDialog:a})=>{const[l,m]=s.useState(!0),[b,x]=s.useState({}),p=s.useRef();s.useEffect(()=>(document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}),[]),s.useEffect(()=>{if(o==="position"&&p.current&&f){const{offsetWidth:E,offsetHeight:S}=p.current;x({position:"absolute",left:f.x-E/2,top:f.y-S/2})}},[o,f]);const T=()=>{m(!1),setTimeout(()=>{u()},300)},w=l?o==="position"?"zoom-in":`slide-in-${o}`:o==="position"?"zoom-out":`slide-out-${o}`;return d.jsx("div",{className:"dialog-overlay",onClick:T,style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",backgroundColor:"rgba(0,0,0,0.6)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:1e3},children:d.jsx("div",{ref:p,className:`dialog-content ${w}`,onClick:E=>E.stopPropagation(),style:{backgroundColor:"#fff",padding:"20px",borderRadius:"8px",maxWidth:"90%",maxHeight:"90%",overflow:"auto",...o==="position"?b:{}},children:typeof a=="function"?a(t):d.jsxs(d.Fragment,{children:[d.jsx("h3",{children:"Image Info"}),d.jsx("img",{src:t.link,alt:"Preview",style:{width:"100%",height:"auto",borderRadius:"4px"}}),d.jsxs("p",{children:["ID: ",t.id]})]})})})},ae=({images:t=[],size:u=14,bgImageUrl:o=null,gridWrapperClassName:f=null,gridWrapperStyle:a={},width:l={xs:350,md:500,lg:700},height:m={xs:350,md:500,lg:700},bgPosition:b="center",setDialog:x=null})=>{const[p,T]=s.useState(u),[w,E]=s.useState(!1),[S,I]=s.useState({}),P=(k=null)=>{k&&I(k),E(!0)},M=()=>E(!1),{isXs:Y,isMd:z,isLg:D}=ne();let R=350,g=350;Y&&(R=l.xs,g=m.xs),z&&(R=l.md||350,g=m.md||350),D&&(R=l.lg||350,g=m.lg||350),s.useEffect(()=>{u>0&&T(u)},[u]),s.useEffect(()=>{if(p*p<t.length){const C=Math.ceil(Math.sqrt(t.length));C!==p&&T(C)}},[t.length,p]);let L=p,F=p;return d.jsxs("div",{className:`mosaic-grid-wrapper ${f||""}`,style:{gridTemplateColumns:`repeat(${F}, 1fr)`,gridTemplateRows:`repeat(${L}, 1fr)`,backgroundImage:`url(${o})`,backgroundSize:`${R}px ${g}px`,backgroundPosition:b,width:`${R}px`,height:`${g}px`,...a},children:[d.jsx("div",{className:"mosaic-grid-wrapper-overlay"}),t.map(k=>d.jsx(oe,{image:k,bgImageUrl:o,width:R,height:g,bgPosition:b,onClickCard:P})),w&&d.jsx(se,{image:S,onClose:M,animationType:"top",position:"top",setDialog:x})]})};_.MetaMosaic=ae,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
22
+ <%s key={someKey} {...props} />`,i,u,y,u),ee[u+i]=!0)}if(u=null,n!==void 0&&(o(n),u=""+n),b(r)&&(o(r.key),u=""+r.key),"key"in r){n={};for(var G in r)G!=="key"&&(n[G]=r[G])}else n=r;return u&&E(n,typeof e=="function"?e.displayName||e.name||"Unknown":e),m(e,u,x,T,a(),n,V,X)}function k(e){typeof e=="object"&&e!==null&&e.$$typeof===h&&e._store&&(e._store.validated=1)}var p=s,h=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),F=Symbol.for("react.consumer"),L=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),O=Symbol.for("react.activity"),le=Symbol.for("react.client.reference"),W=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=Object.prototype.hasOwnProperty,ce=Array.isArray,U=console.createTask?console.createTask:function(){return null};p={"react-stack-bottom-frame":function(e){return e()}};var $,K={},Q=p["react-stack-bottom-frame"].bind(p,l)(),q=U(c(l)),ee={};C.Fragment=g,C.jsx=function(e,r,n,i,T){var x=1e4>W.recentlyCreatedOwnerStacks++;return v(e,r,n,!1,i,T,x?Error("react-stack-top-frame"):Q,x?U(c(e)):q)},C.jsxs=function(e,r,n,i,T){var x=1e4>W.recentlyCreatedOwnerStacks++;return v(e,r,n,!0,i,T,x?Error("react-stack-top-frame"):Q,x?U(c(e)):q)}}()),C}process.env.NODE_ENV==="production"?Y.exports=re():Y.exports=te();var d=Y.exports;const I={sm:600,md:960,lg:1280,xl:1920},B=t=>t>=I.xl?"xl":t>=I.lg?"lg":t>=I.md?"md":t>=I.sm?"sm":"xs",ne=()=>{const[t,f]=s.useState(()=>B(window.innerWidth));return s.useEffect(()=>{const o=()=>{f(B(window.innerWidth))};return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),{isXs:t==="xs",isSm:t==="sm",isMd:t==="md",isLg:t==="lg",isXl:t==="xl",current:t}},oe=({image:t,bgImageUrl:f,width:o,height:c,row:a,col:l,totalRows:b,totalCols:E,onClickCard:j})=>{const[m,v]=s.useState(!1);s.useEffect(()=>{if(!(t!=null&&t.link))return;const g=new Image;g.src=t.link,g.onload=()=>v(!0),g.onerror=()=>v(!1)},[t]);const k=o/E,p=c/b,h=Number((-(l*k)).toFixed(5)),N=Number((-(a*p)).toFixed(5));return d.jsx("div",{className:"mosaic-cell-wrapper",children:m?d.jsx("div",{className:"mosaic-cell",style:{backgroundImage:`url(${f})`,backgroundSize:`${o}px ${c}px`,backgroundPosition:`${h}px ${N}px`},onClick:()=>j(t),children:d.jsx("div",{className:"mosaic-cell-img",style:{backgroundImage:`url(${t.link})`,backgroundSize:"cover"}})}):null})},se=({image:t,onClose:f,animationType:o="bottom",position:c,setDialog:a})=>{const[l,b]=s.useState(!0),[E,j]=s.useState({}),m=s.useRef();s.useEffect(()=>(document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}),[]),s.useEffect(()=>{if(o==="position"&&m.current&&c){const{offsetWidth:p,offsetHeight:h}=m.current;j({position:"absolute",left:c.x-p/2,top:c.y-h/2})}},[o,c]);const v=()=>{b(!1),setTimeout(()=>{f()},300)},k=l?o==="position"?"zoom-in":`slide-in-${o}`:o==="position"?"zoom-out":`slide-out-${o}`;return d.jsx("div",{className:"dialog-overlay",onClick:v,style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",backgroundColor:"rgba(0,0,0,0.6)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:1e3},children:d.jsx("div",{ref:m,className:`dialog-content ${k}`,onClick:p=>p.stopPropagation(),style:{backgroundColor:"#fff",padding:"20px",borderRadius:"8px",maxWidth:"90%",maxHeight:"90%",overflow:"auto",...o==="position"?E:{}},children:typeof a=="function"?a(t):d.jsxs(d.Fragment,{children:[d.jsx("h3",{children:"Image Info"}),d.jsx("img",{src:t.link,alt:"Preview",style:{width:"100%",height:"auto",borderRadius:"4px"}}),d.jsxs("p",{children:["ID: ",t.id]})]})})})},ae=({images:t=[],size:f=14,bgImageUrl:o=null,gridWrapperClassName:c=null,gridWrapperStyle:a={},width:l={xs:350,md:500,lg:700},height:b={xs:350,md:500,lg:700},bgPosition:E="center",setDialog:j=null})=>{const[m,v]=s.useState(f),[k,p]=s.useState(!1),[h,N]=s.useState({}),g=(R=null)=>{R&&N(R),p(!0)},z=()=>p(!1),{isXs:D,isMd:F,isLg:L}=ne();let _=350,w=350;D&&(_=l.xs,w=b.xs),F&&(_=l.md||350,w=b.md||350),L&&(_=l.lg||350,w=b.lg||350),s.useEffect(()=>{f>0&&v(f)},[f]),s.useEffect(()=>{if(m*m<t.length){const O=Math.ceil(Math.sqrt(t.length));O!==m&&v(O)}},[t.length,m]);let M=m,P=m;return d.jsxs("div",{className:`mosaic-grid-wrapper ${c||""}`,style:{gridTemplateColumns:`repeat(${P}, 1fr)`,gridTemplateRows:`repeat(${M}, 1fr)`,backgroundImage:`url(${o})`,backgroundSize:`${_}px ${w}px`,backgroundPosition:"0px 0px",width:`${_}px`,height:`${w}px`,...a},children:[d.jsx("div",{className:"mosaic-grid-wrapper-overlay"}),t.map((R,O)=>d.jsx(oe,{image:R,bgImageUrl:o,width:_,height:w,row:Math.floor(O/P),col:O%P,totalRows:M,totalCols:P,onClickCard:g},R.id)),k&&d.jsx(se,{image:h,onClose:z,animationType:"top",position:"top",setDialog:j})]})};S.MetaMosaic=ae,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})});
@@ -1 +1 @@
1
- .mosaic-grid-wrapper{display:grid;aspect-ratio:1;margin:0 auto;background-color:"#f9f9f9";background-attachment:fixed;background-repeat:no-repeat;position:relative}.mosaic-grid-wrapper-overlay{position:absolute;top:0;right:0;bottom:0;left:0;backdrop-filter:grayscale(1);-webkit-backdrop-filter:grayscale(1);background-color:#fff3}.mosaic-cell-wrapper{position:relative;z-index:2;cursor:pointer}.mosaic-cell{background-attachment:fixed;background-repeat:no-repeat;height:100%;width:100%}.mosaic-cell-img{width:100%;opacity:.4;height:100%;mix-blend-mode:multiply;position:relative;z-index:1}@keyframes slide-in-top{0%{transform:translateY(-100%);opacity:0}to{transform:translateY(0);opacity:1}}@keyframes slide-out-top{0%{transform:translateY(0);opacity:1}to{transform:translateY(-100%);opacity:0}}@keyframes slide-in-right{0%{transform:translate(100%);opacity:0}to{transform:translate(0);opacity:1}}@keyframes slide-out-right{0%{transform:translate(0);opacity:1}to{transform:translate(100%);opacity:0}}@keyframes slide-in-bottom{0%{transform:translateY(100%);opacity:0}to{transform:translateY(0);opacity:1}}@keyframes slide-out-bottom{0%{transform:translateY(0);opacity:1}to{transform:translateY(100%);opacity:0}}@keyframes slide-in-left{0%{transform:translate(-100%);opacity:0}to{transform:translate(0);opacity:1}}@keyframes slide-out-left{0%{transform:translate(0);opacity:1}to{transform:translate(-100%);opacity:0}}@keyframes zoom-in{0%{transform:scale(.5);opacity:0}to{transform:scale(1);opacity:1}}@keyframes zoom-out{0%{transform:scale(1);opacity:1}to{transform:scale(.5);opacity:0}}.slide-in-top{animation:slide-in-top .3s forwards}.slide-out-top{animation:slide-out-top .3s forwards}.slide-in-right{animation:slide-in-right .3s forwards}.slide-out-right{animation:slide-out-right .3s forwards}.slide-in-bottom{animation:slide-in-bottom .3s forwards}.slide-out-bottom{animation:slide-out-bottom .3s forwards}.slide-in-left{animation:slide-in-left .3s forwards}.slide-out-left{animation:slide-out-left .3s forwards}.zoom-in{animation:zoom-in .3s forwards}.zoom-out{animation:zoom-out .3s forwards}.custom-mosaic-grid-wrapper{border-radius:.2em;overflow:hidden}.mosaic-cell-wrapper{transition:transform .4s}.mosaic-cell-wrapper:hover{transform:scale(1.1);z-index:3}.mosaic-cell-img{transition:.3s;transition-delay:.5s}.mosaic-cell-wrapper:hover .mosaic-cell-img{opacity:1;mix-blend-mode:normal;transition-delay:0s;border-radius:.1em;z-index:4}
1
+ .mosaic-grid-wrapper{display:grid;aspect-ratio:1;margin:0 auto;background-color:"#f9f9f9";background-attachment:scroll;background-repeat:no-repeat;position:relative}.mosaic-grid-wrapper-overlay{position:absolute;top:0;right:0;bottom:0;left:0;backdrop-filter:grayscale(1);-webkit-backdrop-filter:grayscale(1);background-color:#fff3}.mosaic-cell-wrapper{position:relative;z-index:2;cursor:pointer}.mosaic-cell{background-attachment:scroll;background-repeat:no-repeat;height:100%;width:100%}.mosaic-cell-img{width:100%;opacity:.4;height:100%;mix-blend-mode:multiply;position:relative;z-index:1}@keyframes slide-in-top{0%{transform:translateY(-100%);opacity:0}to{transform:translateY(0);opacity:1}}@keyframes slide-out-top{0%{transform:translateY(0);opacity:1}to{transform:translateY(-100%);opacity:0}}@keyframes slide-in-right{0%{transform:translate(100%);opacity:0}to{transform:translate(0);opacity:1}}@keyframes slide-out-right{0%{transform:translate(0);opacity:1}to{transform:translate(100%);opacity:0}}@keyframes slide-in-bottom{0%{transform:translateY(100%);opacity:0}to{transform:translateY(0);opacity:1}}@keyframes slide-out-bottom{0%{transform:translateY(0);opacity:1}to{transform:translateY(100%);opacity:0}}@keyframes slide-in-left{0%{transform:translate(-100%);opacity:0}to{transform:translate(0);opacity:1}}@keyframes slide-out-left{0%{transform:translate(0);opacity:1}to{transform:translate(-100%);opacity:0}}@keyframes zoom-in{0%{transform:scale(.5);opacity:0}to{transform:scale(1);opacity:1}}@keyframes zoom-out{0%{transform:scale(1);opacity:1}to{transform:scale(.5);opacity:0}}.slide-in-top{animation:slide-in-top .3s forwards}.slide-out-top{animation:slide-out-top .3s forwards}.slide-in-right{animation:slide-in-right .3s forwards}.slide-out-right{animation:slide-out-right .3s forwards}.slide-in-bottom{animation:slide-in-bottom .3s forwards}.slide-out-bottom{animation:slide-out-bottom .3s forwards}.slide-in-left{animation:slide-in-left .3s forwards}.slide-out-left{animation:slide-out-left .3s forwards}.zoom-in{animation:zoom-in .3s forwards}.zoom-out{animation:zoom-out .3s forwards}.custom-mosaic-grid-wrapper{border-radius:.2em;overflow:hidden}.mosaic-cell-wrapper{transition:transform .4s}.mosaic-cell-wrapper:hover{transform:scale(1.1);z-index:3}.mosaic-cell-img{transition:.3s;transition-delay:.5s}.mosaic-cell-wrapper:hover .mosaic-cell-img{opacity:1;mix-blend-mode:normal;transition-delay:0s;border-radius:.1em;z-index:4}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meta-mosaic",
3
- "version": "1.0.12",
3
+ "version": "1.1.0",
4
4
  "description": "A simple and responsive React component to create interactive image mosaics with metadata popups, background images, and click-to-enlarge dialogs.",
5
5
  "homepage": "https://meta-mosaic-showcase.onrender.com",
6
6
  "main": "dist/index.umd.js",