prometeo-design-system 2.3.1 → 2.3.3

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.
Files changed (62) hide show
  1. package/dist/Avatar.es.js +1 -1
  2. package/dist/{Button-Bc0LYLfg.js → Button-DsbEyjth.js} +1 -1
  3. package/dist/Button.es.js +1 -1
  4. package/dist/{CardProfile-BiYr6kY9.js → CardProfile-BhFog7j5.js} +1 -1
  5. package/dist/CardProfile.es.js +1 -1
  6. package/dist/CheckBox.es.js +1 -1
  7. package/dist/CheckboxFormik.es.js +1 -1
  8. package/dist/DatePicker.es.js +2 -2
  9. package/dist/DialogModal.es.js +35 -31
  10. package/dist/DrawerDesktop.es.js +2 -2
  11. package/dist/DrawerMobile.es.js +1 -1
  12. package/dist/DropZone.es.js +1 -1
  13. package/dist/Header.es.js +1 -1
  14. package/dist/Icons/Icons.d.ts +48 -46
  15. package/dist/Icons.es.js +93 -90
  16. package/dist/Image.es.js +1 -1
  17. package/dist/ImageGallery-DnoRTpCr.js +317 -0
  18. package/dist/ImageGallery.es.js +1 -1
  19. package/dist/Input.es.js +1 -1
  20. package/dist/InputFormik.es.js +1 -1
  21. package/dist/InputMultiple.es.js +1 -1
  22. package/dist/{LayoutGeneric-jDE96L2N.js → LayoutGeneric-p4Pll4Cm.js} +1 -1
  23. package/dist/LayoutGeneric.es.js +1 -1
  24. package/dist/Logo.es.js +1 -1
  25. package/dist/Menu.es.js +1 -1
  26. package/dist/OtpInput.es.js +1 -1
  27. package/dist/Pagination.es.js +1 -1
  28. package/dist/ProfilePictureUpload.es.js +1 -1
  29. package/dist/ProgressBar.es.js +1 -1
  30. package/dist/SegmentedButton.es.js +1 -1
  31. package/dist/Select.es.js +368 -185
  32. package/dist/SelectFormik.es.js +90 -72
  33. package/dist/Skeleton.es.js +35 -34
  34. package/dist/Spinner.es.js +1 -1
  35. package/dist/Steps.es.js +1 -1
  36. package/dist/SwipeContainer.es.js +1 -1
  37. package/dist/Switch.es.js +31 -28
  38. package/dist/TabLinks.es.js +35 -33
  39. package/dist/Table.es.js +1 -1
  40. package/dist/TextArea.es.js +1 -1
  41. package/dist/Tooltip.es.js +1 -1
  42. package/dist/components/Dialog/Dialog.d.ts +7 -6
  43. package/dist/components/Dialog/useDialogControl.d.ts +4 -3
  44. package/dist/components/Select/Select.d.ts +33 -13
  45. package/dist/components/SelectFormik/SelectFormik.d.ts +4 -2
  46. package/dist/components/Skeleton/Skeleton.d.ts +5 -2
  47. package/dist/components/Switch/Switch.d.ts +5 -2
  48. package/dist/components/TabLinks/TabLinks.d.ts +2 -2
  49. package/dist/exports/Select.d.ts +1 -1
  50. package/dist/hooks/useDragScroll.d.ts +29 -0
  51. package/dist/hooks/useLabelBackground.d.ts +5 -0
  52. package/dist/index.d.ts +8 -8
  53. package/dist/{jsx-runtime-ByW6EXIE.js → jsx-runtime-DKDX3adD.js} +94 -96
  54. package/dist/pages/SelectsPage.d.ts +2 -0
  55. package/dist/prometeo-design-system.css +1 -1
  56. package/dist/prometeo-design-system.es.js +6 -6
  57. package/dist/useDragScroll-CHN9OMwn.js +165 -0
  58. package/package.json +4 -4
  59. package/src/styles/intellisense.css +5 -0
  60. package/dist/ImageGallery-O5Y4oBrD.js +0 -352
  61. package/dist/lib/utils.d.ts +0 -1
  62. package/dist/preview/Select.d.ts +0 -2
@@ -0,0 +1,165 @@
1
+ import { useRef as d, useEffect as X, useCallback as o, useMemo as A } from "react";
2
+ function I(i) {
3
+ const c = d({
4
+ axis: "x",
5
+ friction: 0.9,
6
+ minVelocity: 0.5,
7
+ startMomentumThreshold: 1,
8
+ momentum: !0,
9
+ clickThreshold: 5,
10
+ cursor: { idle: i?.cursor?.idle || "grab", dragging: i?.cursor?.dragging || "grabbing" },
11
+ preventTextSelection: !0,
12
+ normalizeFrameMs: 16,
13
+ disabled: !1
14
+ });
15
+ X(() => {
16
+ i && (c.current = {
17
+ ...c.current,
18
+ ...i,
19
+ cursor: {
20
+ ...c.current.cursor,
21
+ ...i.cursor || {}
22
+ }
23
+ });
24
+ }, [i]);
25
+ const f = d(null), r = d({
26
+ isDragging: !1,
27
+ startX: 0,
28
+ startY: 0,
29
+ scrollLeft: 0,
30
+ scrollTop: 0,
31
+ totalDistance: 0,
32
+ lastX: 0,
33
+ lastY: 0,
34
+ lastTime: 0,
35
+ vx: 0,
36
+ vy: 0,
37
+ pointerId: -1,
38
+ captured: !1,
39
+ dragged: !1,
40
+ suppressClickOnce: !1
41
+ }), a = d({}), m = d(null), h = o(() => {
42
+ m.current && (cancelAnimationFrame(m.current), m.current = null);
43
+ }, []), T = o(() => {
44
+ const t = f.current;
45
+ if (!t) return;
46
+ const { friction: e, minVelocity: u } = c.current, n = () => {
47
+ const { vx: s, vy: l } = r.current, g = Math.abs(s), p = Math.abs(l);
48
+ g > u || p > u ? (t.scrollLeft -= s, t.scrollTop -= l, r.current.vx *= e, r.current.vy *= e, m.current = requestAnimationFrame(n)) : (r.current.vx = 0, r.current.vy = 0, h());
49
+ };
50
+ n();
51
+ }, [h]), b = o((t) => {
52
+ const e = f.current;
53
+ if (!e || c.current.disabled || t.button !== 0) return;
54
+ h();
55
+ const u = Date.now(), n = e.offsetLeft, s = e.offsetTop;
56
+ a.current = {
57
+ cursor: e.style.cursor,
58
+ userSelect: e.style.userSelect,
59
+ scrollBehavior: e.style.scrollBehavior,
60
+ touchAction: e.style.touchAction
61
+ }, c.current.preventTextSelection && (e.style.userSelect = "none"), e.style.scrollBehavior = "auto", e.style.touchAction = "none", r.current = {
62
+ isDragging: !0,
63
+ startX: t.pageX - n,
64
+ startY: t.pageY - s,
65
+ scrollLeft: e.scrollLeft,
66
+ scrollTop: e.scrollTop,
67
+ totalDistance: 0,
68
+ lastX: t.pageX - n,
69
+ lastY: t.pageY - s,
70
+ lastTime: u,
71
+ vx: 0,
72
+ vy: 0,
73
+ pointerId: t.pointerId,
74
+ captured: !1,
75
+ dragged: !1,
76
+ suppressClickOnce: !1
77
+ };
78
+ }, [h]), x = o((t) => {
79
+ const e = f.current;
80
+ if (!e || !r.current.isDragging || c.current.disabled) return;
81
+ const u = Date.now(), n = t.pageX - e.offsetLeft, s = t.pageY - e.offsetTop, l = n - r.current.startX, g = s - r.current.startY, p = u - r.current.lastTime, Y = Math.abs(n - r.current.lastX) + Math.abs(s - r.current.lastY);
82
+ r.current.totalDistance += Y;
83
+ const k = c.current.clickThreshold, v = c.current.axis, P = v === "x" ? Math.abs(l) : v === "y" ? Math.abs(g) : Math.max(Math.abs(l), Math.abs(g));
84
+ if (!r.current.captured && P < k) {
85
+ r.current.lastX = n, r.current.lastY = s, r.current.lastTime = u;
86
+ return;
87
+ }
88
+ if (!r.current.captured) {
89
+ try {
90
+ t.currentTarget.setPointerCapture?.(t.pointerId);
91
+ } catch {
92
+ }
93
+ r.current.captured = !0, r.current.dragged = !0, e.style.cursor = c.current.cursor.dragging || "grabbing";
94
+ }
95
+ if (t.preventDefault(), p > 0) {
96
+ const S = c.current.normalizeFrameMs;
97
+ r.current.vx = (n - r.current.lastX) / p * S, r.current.vy = (s - r.current.lastY) / p * S;
98
+ }
99
+ r.current.lastX = n, r.current.lastTime = u, r.current.lastY = s, v === "x" ? e.scrollLeft = r.current.scrollLeft - l : (v === "y" || (e.scrollLeft = r.current.scrollLeft - l), e.scrollTop = r.current.scrollTop - g);
100
+ }, []), y = o(() => {
101
+ const t = f.current;
102
+ if (!t) return;
103
+ t.style.cursor = c.current.cursor.idle || "grab", c.current.preventTextSelection && a.current.userSelect !== void 0 && (t.style.userSelect = a.current.userSelect), a.current.scrollBehavior !== void 0 && (t.style.scrollBehavior = a.current.scrollBehavior), a.current.touchAction !== void 0 && (t.style.touchAction = a.current.touchAction);
104
+ const { momentum: e, startMomentumThreshold: u } = c.current;
105
+ e && r.current.dragged && Math.max(Math.abs(r.current.vx), Math.abs(r.current.vy)) > u && T(), r.current.suppressClickOnce = r.current.dragged, r.current.isDragging = !1;
106
+ }, [T]), D = o((t) => {
107
+ if (r.current.isDragging) {
108
+ if (r.current.captured) {
109
+ try {
110
+ t.currentTarget.releasePointerCapture?.(t.pointerId);
111
+ } catch {
112
+ }
113
+ r.current.captured = !1;
114
+ }
115
+ y();
116
+ }
117
+ }, [y]), M = o((t) => {
118
+ if (r.current.isDragging) {
119
+ if (r.current.captured) {
120
+ try {
121
+ t.currentTarget.releasePointerCapture?.(t.pointerId);
122
+ } catch {
123
+ }
124
+ r.current.captured = !1;
125
+ }
126
+ y();
127
+ }
128
+ }, [y]), C = o((t) => {
129
+ r.current.suppressClickOnce && (t.preventDefault(), t.stopPropagation(), r.current.suppressClickOnce = !1);
130
+ }, []), L = o((t) => {
131
+ if (r.current.captured) {
132
+ try {
133
+ t.currentTarget.releasePointerCapture?.(t.pointerId);
134
+ } catch {
135
+ }
136
+ r.current.captured = !1;
137
+ }
138
+ r.current.isDragging = !1;
139
+ }, []);
140
+ return X(() => {
141
+ const t = f.current;
142
+ t && !c.current.disabled && c.current.cursor.idle && (t.style.cursor = c.current.cursor.idle);
143
+ }, []), A(() => ({
144
+ ref: f,
145
+ bind: {
146
+ onPointerDown: b,
147
+ onPointerMove: x,
148
+ onPointerUp: D,
149
+ onPointerLeave: M,
150
+ onPointerCancel: L,
151
+ onClickCapture: C
152
+ },
153
+ isDraggingRef: {
154
+ get current() {
155
+ return r.current.isDragging;
156
+ },
157
+ set current(t) {
158
+ r.current.isDragging = t;
159
+ }
160
+ }
161
+ }), [b, x, D, M, L, C]);
162
+ }
163
+ export {
164
+ I as u
165
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "prometeo-design-system",
3
3
  "private": false,
4
- "version": "2.3.1",
4
+ "version": "2.3.3",
5
5
  "type": "module",
6
6
  "description": "design kit system",
7
7
  "main": "dist/prometeo-design-system.umd.js",
@@ -145,15 +145,15 @@
145
145
  "types": "./dist/SegmentedButton.d.ts",
146
146
  "import": "./dist/SegmentedButton.es.js"
147
147
  },
148
- "./DatePicker":{
148
+ "./DatePicker": {
149
149
  "types": "./dist/DatePicker.d.ts",
150
150
  "import": "./dist/DatePicker.es.js"
151
151
  },
152
- "./ImageGallery":{
152
+ "./ImageGallery": {
153
153
  "types": "./dist/ImageGallery.d.ts",
154
154
  "import": "./dist/ImageGallery.es.js"
155
155
  },
156
- "./Image":{
156
+ "./Image": {
157
157
  "types": "./dist/Image.d.ts",
158
158
  "import": "./dist/Image.es.js"
159
159
  },
@@ -212,3 +212,8 @@
212
212
  @utility ring-error-default-hover { --intellisense-ring-error-default-hover: 1; }
213
213
  @utility ring-error-default-pressed { --intellisense-ring-error-default-pressed: 1; }
214
214
  @utility ring-error-default-focused { --intellisense-ring-error-default-focused: 1; }
215
+ @utility prometeo-scrollbar-thin { --intellisense-prometeo-scrollbar-thin: 1; }
216
+ @utility scrollbar-stable { --intellisense-scrollbar-stable: 1; }
217
+ @utility prometeo-scrollbar-overlay { --intellisense-prometeo-scrollbar-overlay: 1; }
218
+ @utility prometeo-scrollbar-overlay-x { --intellisense-prometeo-scrollbar-overlay-x: 1; }
219
+ @utility prometeo-scrollbar-none { --intellisense-prometeo-scrollbar-none: 1; }
@@ -1,352 +0,0 @@
1
- import { j as n } from "./jsx-runtime-ByW6EXIE.js";
2
- import ee, { memo as z, forwardRef as O, useRef as w, useCallback as a, useEffect as te, useState as I, useImperativeHandle as re } from "react";
3
- import { c as L } from "./cn-B6yFEsav.js";
4
- import { B as R } from "./Button-Bc0LYLfg.js";
5
- import { Icons as S } from "./Icons.es.js";
6
- const F = z(O(({ images: s, className: f }, o) => {
7
- const h = w(null), r = w({
8
- isDragging: !1,
9
- startX: 0,
10
- scrollLeft: 0,
11
- totalDistance: 0,
12
- lastX: 0,
13
- lastTime: 0,
14
- velocity: 0
15
- }), i = w(null), u = a(() => {
16
- const e = h.current;
17
- if (!e) return;
18
- const c = 0.9;
19
- Math.abs(r.current.velocity) > 0.5 ? (e.scrollLeft -= r.current.velocity, r.current.velocity *= c, i.current = requestAnimationFrame(u)) : (r.current.velocity = 0, i.current && (cancelAnimationFrame(i.current), i.current = null));
20
- }, []), l = a((e) => {
21
- const c = h.current;
22
- if (!c) return;
23
- i.current && (cancelAnimationFrame(i.current), i.current = null);
24
- const p = Date.now();
25
- r.current = {
26
- isDragging: !0,
27
- startX: e.pageX - c.offsetLeft,
28
- scrollLeft: c.scrollLeft,
29
- totalDistance: 0,
30
- lastX: e.pageX - c.offsetLeft,
31
- lastTime: p,
32
- velocity: 0
33
- }, c.style.cursor = "grabbing", c.style.scrollBehavior = "auto", c.style.userSelect = "none";
34
- }, []), M = a((e) => {
35
- const c = h.current;
36
- if (!c || !r.current.isDragging) return;
37
- e.preventDefault();
38
- const p = Date.now(), y = e.pageX - c.offsetLeft, D = y - r.current.startX, b = p - r.current.lastTime;
39
- if (r.current.totalDistance += Math.abs(D), b > 0) {
40
- const j = y - r.current.lastX;
41
- r.current.velocity = j / b * 16;
42
- }
43
- r.current.lastX = y, r.current.lastTime = p, c.scrollLeft = r.current.scrollLeft - D;
44
- }, []), d = a(() => {
45
- const e = h.current;
46
- e && (e.style.cursor = "grab", e.style.userSelect = "auto", Math.abs(r.current.velocity) > 1 && u(), r.current.isDragging = !1);
47
- }, [u]), v = a(() => {
48
- const e = h.current;
49
- e && r.current.isDragging && (e.style.cursor = "grab", e.style.userSelect = "auto", Math.abs(r.current.velocity) > 1 && u(), r.current.isDragging = !1);
50
- }, [u]), x = a(() => r.current.totalDistance < 5, []), m = a((e) => {
51
- x() || (e.preventDefault(), e.stopPropagation());
52
- }, [x]);
53
- return /* @__PURE__ */ n.jsx(
54
- "section",
55
- {
56
- ref: h,
57
- className: L("flex gap-4 w-full overflow-x-auto py-2 relative", f),
58
- style: {},
59
- onMouseDown: l,
60
- onMouseMove: M,
61
- onMouseUp: d,
62
- onMouseLeave: v,
63
- onClickCapture: m,
64
- "aria-label": "Image gallery",
65
- children: s && s.length > 0 && s.map((e, c) => ee.cloneElement(e, {
66
- key: e.props.src || c,
67
- ...e.props,
68
- galleryRef: o,
69
- allowPreview: !0
70
- }))
71
- }
72
- );
73
- }));
74
- F.displayName = "GalleryPreview";
75
- const H = z(({ images: s, lightboxClassName: f, closeLightbox: o, showThumbnails: h, thumbnailsClassName: r, currentIndex: i, goToNext: u, goToPrevious: l, goToIndex: M }) => {
76
- const d = w(null), v = w(null), x = w(null), m = w({
77
- scale: 1,
78
- translateX: 0,
79
- translateY: 0
80
- }), e = w({
81
- startX: 0,
82
- startY: 0,
83
- isDragging: !1,
84
- distanceX: 0,
85
- distanceY: 0
86
- });
87
- te(() => {
88
- x.current && x.current.focus();
89
- }, []);
90
- const c = a((t) => {
91
- t.preventDefault(), t.stopPropagation(), t.key === "Escape" ? o() : t.key === "ArrowLeft" ? l() : t.key === "ArrowRight" && u();
92
- }, [o, l, u]), p = a((t) => {
93
- e.current = { startX: t.touches[0].clientX, startY: t.touches[0].clientY, isDragging: !0, distanceX: 0, distanceY: 0 };
94
- }, []), y = a((t) => {
95
- const X = t.touches[0];
96
- e.current = { ...e.current, isDragging: !0, distanceX: X.clientX - e.current.startX, distanceY: X.clientY - e.current.startY };
97
- }, []), D = a(() => {
98
- e.current = { ...e.current, startX: 0, startY: 0, isDragging: !1 }, Math.abs(e.current.distanceX) > Math.abs(e.current.distanceY) && (e.current.distanceX < 0 ? u() : l());
99
- }, [u, l]), b = a(() => {
100
- const t = d.current;
101
- if (!t) return;
102
- const { scale: X, translateX: Y, translateY: k } = m.current;
103
- t.style.transform = `scale(${X}) translate(${Y}px, ${k}px)`, t.style.transformOrigin = "center center", t.style.transition = "transform 0.1s ease-out";
104
- }, []), j = a(() => {
105
- m.current = { scale: 1, translateX: 0, translateY: 0 }, d.current && (d.current.style.transform = "scale(1) translate(0px, 0px)", d.current.style.transformOrigin = "center center");
106
- }, []), g = a((t) => {
107
- const X = d.current, Y = v.current;
108
- if (!X || !Y) return;
109
- if (t.shiftKey) {
110
- t.deltaY < 0 ? u() : t.deltaY > 0 && l();
111
- return;
112
- }
113
- const k = 2e-3, E = 1, _ = 8, B = -t.deltaY * k, T = m.current.scale;
114
- let C = T + B;
115
- if (C = Math.max(E, Math.min(_, C)), C === E) {
116
- j();
117
- return;
118
- }
119
- const N = Y.getBoundingClientRect(), K = t.clientX - N.left, G = t.clientY - N.top, W = N.width / 2, q = N.height / 2, V = K - W, $ = G - q, A = C / T, U = m.current.translateX, Z = m.current.translateY, J = U - V * (A - 1) / C, Q = Z - $ * (A - 1) / C;
120
- m.current = {
121
- scale: C,
122
- translateX: J,
123
- translateY: Q
124
- }, b();
125
- }, [u, l, b, j]);
126
- return s.length === 0 ? null : /* @__PURE__ */ n.jsxs(
127
- "div",
128
- {
129
- ref: x,
130
- className: L("fixed inset-0 z-50 bg-black/90 flex items-center justify-center lg:px-16", f),
131
- onClick: o,
132
- onKeyDown: c,
133
- onTouchStart: p,
134
- onTouchMove: y,
135
- onTouchEnd: D,
136
- tabIndex: 0,
137
- role: "dialog",
138
- "aria-modal": "true",
139
- children: [
140
- /* @__PURE__ */ n.jsx("div", { className: "absolute top-4 right-4 z-110", children: /* @__PURE__ */ n.jsx(
141
- R,
142
- {
143
- variant: "text",
144
- color: "secondary",
145
- size: "small",
146
- onClick: o,
147
- className: "!text-white hover:!text-gray-300 !w-auto !h-auto !p-2",
148
- "aria-label": "Close gallery",
149
- children: /* @__PURE__ */ n.jsx(S.Close, { size: 24 })
150
- }
151
- ) }),
152
- s.length > 1 && /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
153
- /* @__PURE__ */ n.jsx(
154
- "div",
155
- {
156
- className: "absolute left-0 lg:h-full items-center flex justify-center w-16 z-100 cursor-w-resize",
157
- onClick: (t) => {
158
- t.stopPropagation(), l();
159
- },
160
- children: /* @__PURE__ */ n.jsx(
161
- R,
162
- {
163
- variant: "text",
164
- color: "secondary",
165
- size: "small",
166
- onClick: (t) => {
167
- t.stopPropagation(), l();
168
- },
169
- className: "!text-white hover:!text-gray-300 !w-auto !h-auto !p-2",
170
- "aria-label": "Previous image",
171
- children: /* @__PURE__ */ n.jsx(S.CrevronLeft, { size: 24 })
172
- }
173
- )
174
- }
175
- ),
176
- /* @__PURE__ */ n.jsx(
177
- "div",
178
- {
179
- className: "absolute right-0 lg:h-full items-center flex justify-center w-16 z-100 cursor-e-resize",
180
- onClick: (t) => {
181
- t.stopPropagation(), u();
182
- },
183
- children: /* @__PURE__ */ n.jsx(
184
- R,
185
- {
186
- variant: "text",
187
- color: "secondary",
188
- size: "small",
189
- onClick: (t) => {
190
- t.stopPropagation(), u();
191
- },
192
- className: "!text-white hover:!text-gray-300 !w-auto !h-auto !p-2",
193
- "aria-label": "Next image",
194
- children: /* @__PURE__ */ n.jsx(S.CrevronRight, { size: 24 })
195
- }
196
- )
197
- }
198
- )
199
- ] }),
200
- /* @__PURE__ */ n.jsx(
201
- "div",
202
- {
203
- ref: v,
204
- onClick: (t) => t.stopPropagation(),
205
- className: "relative max-w-[90vw] max-h-[98vh] mx-auto flex flex-col w-max lg:h-full h-max",
206
- onWheel: g,
207
- children: /* @__PURE__ */ n.jsx(
208
- "div",
209
- {
210
- className: "max-h-[98vh] relative overflow-hidden w-full h-full",
211
- style: {
212
- animation: "galleryFadeIn 0.6s ease-in-out"
213
- },
214
- ref: d,
215
- children: /* @__PURE__ */ n.jsx(
216
- "img",
217
- {
218
- src: s[i].src,
219
- alt: s[i].alt,
220
- className: L(
221
- " w-full h-full object-contain select-none",
222
- "prometeo-lightbox-image"
223
- ),
224
- onLoad: () => j()
225
- }
226
- )
227
- },
228
- i
229
- )
230
- }
231
- ),
232
- h && /* @__PURE__ */ n.jsx("div", { className: " w-full absolute items-center flex justify-center left-0 right-0 z-[100] bottom-0", children: /* @__PURE__ */ n.jsx(P, { images: s, currentIndex: i, goToIndex: M, thumbnailsClassName: r }) }),
233
- s.length > 1 && /* @__PURE__ */ n.jsxs("div", { className: "absolute bottom-20 left-1/2 transform -translate-x-1/2 text-neutral-default-default prometeo-fonts-label-xlarge px-4 py-2 rounded-full", children: [
234
- i + 1,
235
- " / ",
236
- s.length
237
- ] })
238
- ]
239
- }
240
- );
241
- });
242
- H.displayName = "LightBox";
243
- const ne = (s, f) => {
244
- if (s.currentIndex !== f.currentIndex || s.thumbnailsClassName !== f.thumbnailsClassName || s.images.length !== f.images.length) return !1;
245
- for (let o = 0; o < s.images.length; o++)
246
- if (s.images[o].src !== f.images[o].src) return !1;
247
- return !0;
248
- }, P = z(({ images: s, currentIndex: f, goToIndex: o, thumbnailsClassName: h }) => /* @__PURE__ */ n.jsxs(
249
- "div",
250
- {
251
- className: "flex gap-4 w-max overflow-x-auto overflow-y-visible max-w-full px-16 py-4",
252
- style: {
253
- scrollbarWidth: "none",
254
- msOverflowStyle: "none",
255
- WebkitOverflowScrolling: "touch"
256
- },
257
- children: [
258
- /* @__PURE__ */ n.jsx("style", { children: `
259
- .flex.gap-4.w-max::-webkit-scrollbar {
260
- display: none;
261
- }
262
- ` }),
263
- s.map((r, i) => /* @__PURE__ */ n.jsx(
264
- "button",
265
- {
266
- type: "button",
267
- onClick: (u) => {
268
- u.stopPropagation(), o(i);
269
- },
270
- className: L(
271
- "w-16 h-16 aspect-square min-w-16 rounded overflow-hidden transition-all duration-300 hover:scale-125 cursor-pointer",
272
- h,
273
- i === f ? "scale-110" : ""
274
- ),
275
- children: /* @__PURE__ */ n.jsx(
276
- "img",
277
- {
278
- src: r.src,
279
- alt: r.alt,
280
- className: "w-full h-full object-cover select-none"
281
- }
282
- )
283
- },
284
- r.src
285
- ))
286
- ]
287
- }
288
- ), ne);
289
- P.displayName = "Thumbnails";
290
- const se = O(
291
- (s, f) => {
292
- const {
293
- children: o,
294
- className: h,
295
- lightboxClassName: r,
296
- showThumbnails: i,
297
- thumbnailsClassName: u
298
- } = s, [l, M] = I([]), [d, v] = I(!1), [x, m] = I(0), e = o ? Array.isArray(o) ? o : [o] : [], c = a((g) => {
299
- M((t) => t.some((Y) => Y.src === g.src) ? t : [...t, g]);
300
- }, []), p = a((g = 0) => {
301
- m(g), v(!0);
302
- }, []), y = a(() => {
303
- v(!1);
304
- }, []);
305
- re(
306
- f,
307
- () => ({
308
- openLightbox: p,
309
- closeLightbox: y,
310
- isOpen: d,
311
- addImage: c,
312
- images: l
313
- }),
314
- [l]
315
- );
316
- const D = a(() => {
317
- m((g) => (g + 1) % l.length);
318
- }, [l.length]), b = a(() => {
319
- m((g) => (g - 1 + l.length) % l.length);
320
- }, [l.length]), j = a((g) => {
321
- m(g);
322
- }, []);
323
- return /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
324
- /* @__PURE__ */ n.jsx(
325
- F,
326
- {
327
- images: e,
328
- className: h,
329
- ref: f
330
- }
331
- ),
332
- d && /* @__PURE__ */ n.jsx(
333
- H,
334
- {
335
- images: l,
336
- closeLightbox: y,
337
- showThumbnails: i,
338
- lightboxClassName: r,
339
- thumbnailsClassName: u,
340
- currentIndex: x,
341
- goToNext: D,
342
- goToPrevious: b,
343
- goToIndex: j
344
- }
345
- )
346
- ] });
347
- }
348
- );
349
- se.displayName = "ImageGallery";
350
- export {
351
- se as I
352
- };
@@ -1 +0,0 @@
1
- export declare function findScrollableAncestors(startElement: HTMLElement): HTMLElement[];
@@ -1,2 +0,0 @@
1
- declare const SelectPreview: () => import("react/jsx-runtime").JSX.Element;
2
- export default SelectPreview;