framepexls-ui-lib 1.7.0 → 1.8.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/Carousel.d.mts +53 -0
- package/dist/Carousel.d.ts +53 -0
- package/dist/Carousel.js +428 -0
- package/dist/Carousel.mjs +394 -0
- package/dist/Login.d.mts +3 -1
- package/dist/Login.d.ts +3 -1
- package/dist/Login.js +192 -33
- package/dist/Login.mjs +192 -33
- package/dist/LoginCarousel.d.mts +7 -30
- package/dist/LoginCarousel.d.ts +7 -30
- package/dist/LoginCarousel.js +9 -307
- package/dist/LoginCarousel.mjs +6 -308
- package/dist/LoginGallery.d.mts +1 -0
- package/dist/LoginGallery.d.ts +1 -0
- package/dist/LoginGallery.js +2 -2
- package/dist/LoginGallery.mjs +2 -2
- package/dist/Tooltip.js +83 -72
- package/dist/Tooltip.mjs +83 -72
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -0
- package/dist/index.mjs +7 -4
- package/package.json +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
|
|
4
|
+
type CarouselSlide = {
|
|
5
|
+
key?: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
content: React__default.ReactNode;
|
|
8
|
+
background?: {
|
|
9
|
+
src: string;
|
|
10
|
+
alt?: string;
|
|
11
|
+
overlay?: boolean;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
type CarouselApi = {
|
|
15
|
+
index: number;
|
|
16
|
+
len: number;
|
|
17
|
+
dir: 1 | -1;
|
|
18
|
+
reduceMotion: boolean;
|
|
19
|
+
perfLite: boolean;
|
|
20
|
+
autoplayActive: boolean;
|
|
21
|
+
goTo: (idx: number) => void;
|
|
22
|
+
next: () => void;
|
|
23
|
+
prev: () => void;
|
|
24
|
+
};
|
|
25
|
+
declare function useCarousel(): CarouselApi;
|
|
26
|
+
type CarouselProps = {
|
|
27
|
+
className?: string;
|
|
28
|
+
slides: CarouselSlide[];
|
|
29
|
+
initialIndex?: number;
|
|
30
|
+
autoAdvanceMs?: number;
|
|
31
|
+
backgroundMotion?: "auto" | "always" | "never";
|
|
32
|
+
showControls?: boolean;
|
|
33
|
+
showDots?: boolean;
|
|
34
|
+
chrome?: "card" | "plain";
|
|
35
|
+
showDecor?: boolean;
|
|
36
|
+
overlayNavTone?: "onDark" | "onLight";
|
|
37
|
+
frameClassName?: string;
|
|
38
|
+
contentClassName?: string;
|
|
39
|
+
contentAlign?: "start" | "center" | "between";
|
|
40
|
+
overlayNavBottomPx?: number;
|
|
41
|
+
heightMode?: "max-all" | "max-seen" | "none";
|
|
42
|
+
minHeightPx?: number;
|
|
43
|
+
renderOverlay?: (api: CarouselApi) => React__default.ReactNode;
|
|
44
|
+
labels?: {
|
|
45
|
+
title?: string;
|
|
46
|
+
prev?: string;
|
|
47
|
+
next?: string;
|
|
48
|
+
goTo?: (n: number) => string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
declare function Carousel({ className, slides, initialIndex, autoAdvanceMs, backgroundMotion, showControls, showDots, chrome, showDecor, overlayNavTone, frameClassName, contentClassName, contentAlign, overlayNavBottomPx, heightMode, minHeightPx, renderOverlay, labels, }: CarouselProps): react_jsx_runtime.JSX.Element | null;
|
|
52
|
+
|
|
53
|
+
export { type CarouselApi, type CarouselProps, type CarouselSlide, Carousel as default, useCarousel };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
|
|
4
|
+
type CarouselSlide = {
|
|
5
|
+
key?: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
content: React__default.ReactNode;
|
|
8
|
+
background?: {
|
|
9
|
+
src: string;
|
|
10
|
+
alt?: string;
|
|
11
|
+
overlay?: boolean;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
type CarouselApi = {
|
|
15
|
+
index: number;
|
|
16
|
+
len: number;
|
|
17
|
+
dir: 1 | -1;
|
|
18
|
+
reduceMotion: boolean;
|
|
19
|
+
perfLite: boolean;
|
|
20
|
+
autoplayActive: boolean;
|
|
21
|
+
goTo: (idx: number) => void;
|
|
22
|
+
next: () => void;
|
|
23
|
+
prev: () => void;
|
|
24
|
+
};
|
|
25
|
+
declare function useCarousel(): CarouselApi;
|
|
26
|
+
type CarouselProps = {
|
|
27
|
+
className?: string;
|
|
28
|
+
slides: CarouselSlide[];
|
|
29
|
+
initialIndex?: number;
|
|
30
|
+
autoAdvanceMs?: number;
|
|
31
|
+
backgroundMotion?: "auto" | "always" | "never";
|
|
32
|
+
showControls?: boolean;
|
|
33
|
+
showDots?: boolean;
|
|
34
|
+
chrome?: "card" | "plain";
|
|
35
|
+
showDecor?: boolean;
|
|
36
|
+
overlayNavTone?: "onDark" | "onLight";
|
|
37
|
+
frameClassName?: string;
|
|
38
|
+
contentClassName?: string;
|
|
39
|
+
contentAlign?: "start" | "center" | "between";
|
|
40
|
+
overlayNavBottomPx?: number;
|
|
41
|
+
heightMode?: "max-all" | "max-seen" | "none";
|
|
42
|
+
minHeightPx?: number;
|
|
43
|
+
renderOverlay?: (api: CarouselApi) => React__default.ReactNode;
|
|
44
|
+
labels?: {
|
|
45
|
+
title?: string;
|
|
46
|
+
prev?: string;
|
|
47
|
+
next?: string;
|
|
48
|
+
goTo?: (n: number) => string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
declare function Carousel({ className, slides, initialIndex, autoAdvanceMs, backgroundMotion, showControls, showDots, chrome, showDecor, overlayNavTone, frameClassName, contentClassName, contentAlign, overlayNavBottomPx, heightMode, minHeightPx, renderOverlay, labels, }: CarouselProps): react_jsx_runtime.JSX.Element | null;
|
|
52
|
+
|
|
53
|
+
export { type CarouselApi, type CarouselProps, type CarouselSlide, Carousel as default, useCarousel };
|
package/dist/Carousel.js
ADDED
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var Carousel_exports = {};
|
|
31
|
+
__export(Carousel_exports, {
|
|
32
|
+
default: () => Carousel,
|
|
33
|
+
useCarousel: () => useCarousel
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(Carousel_exports);
|
|
36
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
+
var import_react = __toESM(require("react"));
|
|
38
|
+
var import_framer_motion = require("framer-motion");
|
|
39
|
+
var import_Button = __toESM(require("./Button"));
|
|
40
|
+
var import_iconos = require("./iconos");
|
|
41
|
+
const CarouselContext = import_react.default.createContext(null);
|
|
42
|
+
function useCarousel() {
|
|
43
|
+
const ctx = import_react.default.useContext(CarouselContext);
|
|
44
|
+
if (!ctx) throw new Error("useCarousel debe usarse dentro de <Carousel />");
|
|
45
|
+
return ctx;
|
|
46
|
+
}
|
|
47
|
+
function prefersReducedMotion() {
|
|
48
|
+
return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
49
|
+
}
|
|
50
|
+
function readPerfLiteFromDom() {
|
|
51
|
+
try {
|
|
52
|
+
return document.documentElement.dataset.perf === "lite";
|
|
53
|
+
} catch {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function Carousel({
|
|
58
|
+
className,
|
|
59
|
+
slides,
|
|
60
|
+
initialIndex = 0,
|
|
61
|
+
autoAdvanceMs = 8e3,
|
|
62
|
+
backgroundMotion = "auto",
|
|
63
|
+
showControls = true,
|
|
64
|
+
showDots = true,
|
|
65
|
+
chrome = "card",
|
|
66
|
+
showDecor = true,
|
|
67
|
+
overlayNavTone = "onDark",
|
|
68
|
+
frameClassName,
|
|
69
|
+
contentClassName,
|
|
70
|
+
contentAlign = "start",
|
|
71
|
+
overlayNavBottomPx,
|
|
72
|
+
heightMode = "max-seen",
|
|
73
|
+
minHeightPx = 240,
|
|
74
|
+
renderOverlay,
|
|
75
|
+
labels
|
|
76
|
+
}) {
|
|
77
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
78
|
+
const safeSlides = (slides != null ? slides : []).filter(Boolean);
|
|
79
|
+
const len = safeSlides.length;
|
|
80
|
+
const [index, setIndex] = import_react.default.useState(() => Math.min(Math.max(0, initialIndex), Math.max(0, len - 1)));
|
|
81
|
+
const [dir, setDir] = import_react.default.useState(1);
|
|
82
|
+
const rootRef = import_react.default.useRef(null);
|
|
83
|
+
const activeRef = import_react.default.useRef(null);
|
|
84
|
+
const measureBoxRef = import_react.default.useRef(null);
|
|
85
|
+
const measureRefs = import_react.default.useRef([]);
|
|
86
|
+
const [lockedHeight, setLockedHeight] = import_react.default.useState(minHeightPx);
|
|
87
|
+
const [effectiveMode, setEffectiveMode] = import_react.default.useState(heightMode);
|
|
88
|
+
const [isInView, setIsInView] = import_react.default.useState(true);
|
|
89
|
+
const [isPageVisible, setIsPageVisible] = import_react.default.useState(true);
|
|
90
|
+
const [perfLite, setPerfLite] = import_react.default.useState(false);
|
|
91
|
+
const [isAnimating, setIsAnimating] = import_react.default.useState(false);
|
|
92
|
+
const [hasBackdropBlur, setHasBackdropBlur] = import_react.default.useState(false);
|
|
93
|
+
import_react.default.useEffect(() => {
|
|
94
|
+
if (!len) return;
|
|
95
|
+
setIndex((i) => Math.min(i, len - 1));
|
|
96
|
+
}, [len]);
|
|
97
|
+
import_react.default.useEffect(() => {
|
|
98
|
+
if (!len) return;
|
|
99
|
+
setIsAnimating(true);
|
|
100
|
+
const id = window.setTimeout(() => setIsAnimating(false), 480);
|
|
101
|
+
return () => window.clearTimeout(id);
|
|
102
|
+
}, [index, len]);
|
|
103
|
+
import_react.default.useEffect(() => {
|
|
104
|
+
if (typeof document === "undefined") return;
|
|
105
|
+
const onVis = () => setIsPageVisible(document.visibilityState !== "hidden");
|
|
106
|
+
onVis();
|
|
107
|
+
document.addEventListener("visibilitychange", onVis);
|
|
108
|
+
return () => document.removeEventListener("visibilitychange", onVis);
|
|
109
|
+
}, []);
|
|
110
|
+
import_react.default.useEffect(() => {
|
|
111
|
+
if (typeof document === "undefined") return;
|
|
112
|
+
const update = () => setPerfLite(readPerfLiteFromDom());
|
|
113
|
+
update();
|
|
114
|
+
const mo = new MutationObserver(() => update());
|
|
115
|
+
mo.observe(document.documentElement, { attributes: true, attributeFilter: ["data-perf"] });
|
|
116
|
+
return () => mo.disconnect();
|
|
117
|
+
}, []);
|
|
118
|
+
import_react.default.useEffect(() => {
|
|
119
|
+
if (typeof window === "undefined") return;
|
|
120
|
+
const node = rootRef.current;
|
|
121
|
+
if (!node || typeof IntersectionObserver === "undefined") return;
|
|
122
|
+
const io = new IntersectionObserver(
|
|
123
|
+
(entries) => setIsInView(entries.some((e) => e.isIntersecting)),
|
|
124
|
+
{ root: null, threshold: 0.25 }
|
|
125
|
+
);
|
|
126
|
+
io.observe(node);
|
|
127
|
+
return () => io.disconnect();
|
|
128
|
+
}, []);
|
|
129
|
+
const reduceMotion = prefersReducedMotion() || perfLite;
|
|
130
|
+
const autoplayActive = isInView && isPageVisible && !reduceMotion;
|
|
131
|
+
import_react.default.useLayoutEffect(() => {
|
|
132
|
+
const root = activeRef.current;
|
|
133
|
+
if (!root) return;
|
|
134
|
+
setHasBackdropBlur(Boolean(root.querySelector('[class*="backdrop-blur"]')));
|
|
135
|
+
}, [index]);
|
|
136
|
+
import_react.default.useEffect(() => {
|
|
137
|
+
setEffectiveMode(heightMode);
|
|
138
|
+
}, [heightMode]);
|
|
139
|
+
import_react.default.useEffect(() => {
|
|
140
|
+
setLockedHeight((h) => {
|
|
141
|
+
const base = Math.max(0, minHeightPx);
|
|
142
|
+
if (h == null) return base || null;
|
|
143
|
+
return Math.max(h, base) || null;
|
|
144
|
+
});
|
|
145
|
+
}, [minHeightPx]);
|
|
146
|
+
const updateLockedHeight = import_react.default.useCallback(
|
|
147
|
+
(nextH) => {
|
|
148
|
+
if (!Number.isFinite(nextH) || nextH <= 0) return;
|
|
149
|
+
setLockedHeight((prevH) => {
|
|
150
|
+
const base = Math.max(0, minHeightPx);
|
|
151
|
+
const prev2 = prevH != null ? prevH : base;
|
|
152
|
+
const target = Math.max(prev2, base, Math.ceil(nextH));
|
|
153
|
+
return target || null;
|
|
154
|
+
});
|
|
155
|
+
},
|
|
156
|
+
[minHeightPx]
|
|
157
|
+
);
|
|
158
|
+
import_react.default.useLayoutEffect(() => {
|
|
159
|
+
if (effectiveMode !== "max-all") return;
|
|
160
|
+
if (!len) return;
|
|
161
|
+
const box = measureBoxRef.current;
|
|
162
|
+
if (!box) return;
|
|
163
|
+
const hasHeavyMedia = Boolean(box.querySelector("video, audio, iframe, img, picture, canvas, svg"));
|
|
164
|
+
if (hasHeavyMedia) {
|
|
165
|
+
setEffectiveMode("max-seen");
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
const compute = () => {
|
|
169
|
+
let maxH = 0;
|
|
170
|
+
for (let i = 0; i < len; i++) {
|
|
171
|
+
const el = measureRefs.current[i];
|
|
172
|
+
if (!el) continue;
|
|
173
|
+
maxH = Math.max(maxH, el.offsetHeight || 0);
|
|
174
|
+
}
|
|
175
|
+
if (maxH > 0) updateLockedHeight(maxH);
|
|
176
|
+
};
|
|
177
|
+
compute();
|
|
178
|
+
const onResize = () => compute();
|
|
179
|
+
window.addEventListener("resize", onResize);
|
|
180
|
+
return () => window.removeEventListener("resize", onResize);
|
|
181
|
+
}, [effectiveMode, len, updateLockedHeight]);
|
|
182
|
+
import_react.default.useLayoutEffect(() => {
|
|
183
|
+
if (effectiveMode !== "max-seen") return;
|
|
184
|
+
if (!len) return;
|
|
185
|
+
const target = activeRef.current;
|
|
186
|
+
if (!target) return;
|
|
187
|
+
const compute = () => {
|
|
188
|
+
const h = target.offsetHeight || 0;
|
|
189
|
+
if (h > 0) updateLockedHeight(h);
|
|
190
|
+
};
|
|
191
|
+
compute();
|
|
192
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
193
|
+
const ro = new ResizeObserver(() => compute());
|
|
194
|
+
ro.observe(target);
|
|
195
|
+
return () => ro.disconnect();
|
|
196
|
+
}
|
|
197
|
+
}, [effectiveMode, len, index, updateLockedHeight]);
|
|
198
|
+
const title = (_a = labels == null ? void 0 : labels.title) != null ? _a : "Carrusel";
|
|
199
|
+
const prevLabel = (_b = labels == null ? void 0 : labels.prev) != null ? _b : "Anterior";
|
|
200
|
+
const nextLabel = (_c = labels == null ? void 0 : labels.next) != null ? _c : "Siguiente";
|
|
201
|
+
const goToLabel = (_d = labels == null ? void 0 : labels.goTo) != null ? _d : ((n) => `Ir a slide ${n}`);
|
|
202
|
+
const goTo = import_react.default.useCallback(
|
|
203
|
+
(next2) => {
|
|
204
|
+
if (!len) return;
|
|
205
|
+
const clamped = (next2 % len + len) % len;
|
|
206
|
+
setDir(clamped > index ? 1 : -1);
|
|
207
|
+
setIndex(clamped);
|
|
208
|
+
},
|
|
209
|
+
[index, len]
|
|
210
|
+
);
|
|
211
|
+
const next = import_react.default.useCallback(() => goTo(index + 1), [goTo, index]);
|
|
212
|
+
const prev = import_react.default.useCallback(() => goTo(index - 1), [goTo, index]);
|
|
213
|
+
import_react.default.useEffect(() => {
|
|
214
|
+
if (!len || len < 2) return;
|
|
215
|
+
if (!autoAdvanceMs || autoAdvanceMs < 1500) return;
|
|
216
|
+
if (!autoplayActive) return;
|
|
217
|
+
const id = window.setInterval(() => next(), autoAdvanceMs);
|
|
218
|
+
return () => window.clearInterval(id);
|
|
219
|
+
}, [autoAdvanceMs, autoplayActive, len, next]);
|
|
220
|
+
import_react.default.useEffect(() => {
|
|
221
|
+
if (!len || len < 2) return;
|
|
222
|
+
if (!isInView) return;
|
|
223
|
+
const onKey = (e) => {
|
|
224
|
+
if (e.key === "ArrowLeft") prev();
|
|
225
|
+
if (e.key === "ArrowRight") next();
|
|
226
|
+
};
|
|
227
|
+
window.addEventListener("keydown", onKey);
|
|
228
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
229
|
+
}, [isInView, len, next, prev]);
|
|
230
|
+
if (!len) return null;
|
|
231
|
+
const active = safeSlides[index];
|
|
232
|
+
const overlayNav = chrome === "plain";
|
|
233
|
+
const fillHeight = true;
|
|
234
|
+
const contentPadClassName = contentClassName != null ? contentClassName : chrome === "card" ? "p-5 sm:p-6" : "";
|
|
235
|
+
const alignClassName = contentAlign === "center" ? "flex h-full flex-col justify-center" : contentAlign === "between" ? "flex h-full flex-col justify-between" : "";
|
|
236
|
+
const overlayOnDark = overlayNavTone === "onDark";
|
|
237
|
+
const overlayBtnClassName = overlayOnDark ? "grid h-10 w-10 place-items-center rounded-xl border border-white/15 bg-black/30 text-white shadow-sm backdrop-blur-md hover:bg-black/40" : [
|
|
238
|
+
"grid h-10 w-10 place-items-center rounded-xl border border-[color-mix(in_oklab,var(--border)_55%,transparent)]",
|
|
239
|
+
"bg-[color-mix(in_oklab,var(--card)_75%,transparent)] text-foreground shadow-sm backdrop-blur-md",
|
|
240
|
+
"hover:bg-[color-mix(in_oklab,var(--card)_88%,transparent)]"
|
|
241
|
+
].join(" ");
|
|
242
|
+
const overlayDotActiveClassName = overlayOnDark ? "bg-white/90" : "bg-primary";
|
|
243
|
+
const overlayDotInactiveClassName = overlayOnDark ? "bg-white/25 hover:bg-white/40" : "bg-[color-mix(in_oklab,var(--muted)_30%,transparent)] hover:bg-[color-mix(in_oklab,var(--muted)_45%,transparent)]";
|
|
244
|
+
const api = import_react.default.useMemo(
|
|
245
|
+
() => ({ index, len, dir, reduceMotion, perfLite, autoplayActive, goTo, next, prev }),
|
|
246
|
+
[index, len, dir, reduceMotion, perfLite, autoplayActive, goTo, next, prev]
|
|
247
|
+
);
|
|
248
|
+
const backgroundMotionEnabled = backgroundMotion === "always" ? true : backgroundMotion === "never" ? false : !hasBackdropBlur;
|
|
249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CarouselContext.Provider, { value: api, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
250
|
+
"div",
|
|
251
|
+
{
|
|
252
|
+
className: ["relative flex h-full flex-col", className != null ? className : ""].join(" "),
|
|
253
|
+
"aria-roledescription": "carousel",
|
|
254
|
+
"aria-label": title,
|
|
255
|
+
ref: rootRef,
|
|
256
|
+
children: [
|
|
257
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
258
|
+
"div",
|
|
259
|
+
{
|
|
260
|
+
className: [
|
|
261
|
+
chrome === "card" ? "relative flex flex-1 flex-col overflow-hidden rounded-2xl border border-border bg-[color-mix(in_oklab,var(--card)_80%,transparent)] shadow-sm" : "relative flex flex-1 flex-col",
|
|
262
|
+
frameClassName != null ? frameClassName : ""
|
|
263
|
+
].join(" "),
|
|
264
|
+
children: [
|
|
265
|
+
showDecor && chrome === "card" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "pointer-events-none absolute inset-0", children: [
|
|
266
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute -left-16 -top-16 h-48 w-48 rounded-full bg-[color-mix(in_oklab,var(--primary)_16%,transparent)] blur-3xl" }),
|
|
267
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute -bottom-16 -right-16 h-48 w-48 rounded-full bg-[color-mix(in_oklab,var(--primary)_12%,transparent)] blur-3xl" })
|
|
268
|
+
] }) : null,
|
|
269
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
270
|
+
"div",
|
|
271
|
+
{
|
|
272
|
+
className: "relative flex-1",
|
|
273
|
+
style: {
|
|
274
|
+
minHeight: `${Math.max(0, minHeightPx)}px`,
|
|
275
|
+
...effectiveMode === "none" ? {} : {
|
|
276
|
+
minHeight: lockedHeight ? `${lockedHeight}px` : `${Math.max(0, minHeightPx)}px`,
|
|
277
|
+
transition: "min-height 220ms ease"
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_framer_motion.AnimatePresence, { initial: false, custom: dir, mode: "wait", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
281
|
+
import_framer_motion.motion.div,
|
|
282
|
+
{
|
|
283
|
+
custom: dir,
|
|
284
|
+
initial: reduceMotion ? { opacity: 0 } : { opacity: 0, x: dir * 18, filter: "blur(4px)" },
|
|
285
|
+
animate: reduceMotion ? { opacity: 1 } : { opacity: 1, x: 0, filter: "blur(0px)" },
|
|
286
|
+
exit: reduceMotion ? { opacity: 0 } : { opacity: 0, x: -dir * 18, filter: "blur(4px)" },
|
|
287
|
+
transition: { duration: 0.28, ease: "easeOut" },
|
|
288
|
+
className: "relative h-full overflow-hidden",
|
|
289
|
+
style: isAnimating ? { willChange: "transform, opacity, filter" } : void 0,
|
|
290
|
+
children: [
|
|
291
|
+
((_f = active.background) == null ? void 0 : _f.src) ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { "aria-hidden": true, className: "pointer-events-none absolute inset-0", children: [
|
|
292
|
+
autoplayActive && backgroundMotionEnabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
293
|
+
import_framer_motion.motion.img,
|
|
294
|
+
{
|
|
295
|
+
src: active.background.src,
|
|
296
|
+
alt: (_g = active.background.alt) != null ? _g : "",
|
|
297
|
+
className: "absolute inset-0 h-full w-full object-cover opacity-[0.42] filter-[saturate(1.06)_contrast(1.08)] dark:opacity-[0.34]",
|
|
298
|
+
draggable: false,
|
|
299
|
+
decoding: "async",
|
|
300
|
+
initial: false,
|
|
301
|
+
animate: { scale: [1.02, 1.06, 1.02], y: [0, -10, 0] },
|
|
302
|
+
transition: { duration: 14, ease: "easeInOut", repeat: Infinity }
|
|
303
|
+
}
|
|
304
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
305
|
+
"img",
|
|
306
|
+
{
|
|
307
|
+
src: active.background.src,
|
|
308
|
+
alt: (_h = active.background.alt) != null ? _h : "",
|
|
309
|
+
className: "absolute inset-0 h-full w-full object-cover opacity-[0.42] filter-[saturate(1.06)_contrast(1.08)] dark:opacity-[0.34]",
|
|
310
|
+
draggable: false,
|
|
311
|
+
decoding: "async"
|
|
312
|
+
}
|
|
313
|
+
),
|
|
314
|
+
((_i = active.background.overlay) != null ? _i : true) ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
315
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute inset-0 bg-[linear-gradient(135deg,color-mix(in_oklab,var(--primary)_12%,transparent),transparent_60%)]" }),
|
|
316
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute inset-0 bg-[linear-gradient(180deg,color-mix(in_oklab,var(--card)_78%,transparent),transparent_55%)]" }),
|
|
317
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute inset-0 bg-black/10 dark:bg-black/25" })
|
|
318
|
+
] }) : null
|
|
319
|
+
] }) : null,
|
|
320
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: ["relative z-10 h-full", contentPadClassName].filter(Boolean).join(" "), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: [alignClassName, fillHeight ? "h-full" : ""].filter(Boolean).join(" "), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: activeRef, className: fillHeight ? "h-full" : void 0, children: active.content }) }) })
|
|
321
|
+
]
|
|
322
|
+
},
|
|
323
|
+
(_e = active.key) != null ? _e : String(index)
|
|
324
|
+
) })
|
|
325
|
+
}
|
|
326
|
+
),
|
|
327
|
+
effectiveMode === "max-all" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: measureBoxRef, "aria-hidden": true, className: "pointer-events-none absolute inset-0 -z-10 opacity-0", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: contentPadClassName, children: safeSlides.map((s, i) => {
|
|
328
|
+
var _a2;
|
|
329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: (el) => {
|
|
330
|
+
measureRefs.current[i] = el;
|
|
331
|
+
}, children: s.content }, (_a2 = s.key) != null ? _a2 : String(i));
|
|
332
|
+
}) }) }) : null,
|
|
333
|
+
renderOverlay ? renderOverlay(api) : null,
|
|
334
|
+
overlayNav && !renderOverlay && (showControls || showDots) && len > 1 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
335
|
+
"div",
|
|
336
|
+
{
|
|
337
|
+
className: [
|
|
338
|
+
"pointer-events-none absolute inset-x-0 z-40",
|
|
339
|
+
overlayNavBottomPx == null ? "bottom-16 lg:bottom-20" : ""
|
|
340
|
+
].join(" "),
|
|
341
|
+
style: overlayNavBottomPx == null ? void 0 : { bottom: overlayNavBottomPx },
|
|
342
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mx-auto w-full max-w-7xl px-4 lg:pr-[560px] sm:px-6 2xl:max-w-screen-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "pointer-events-auto flex items-center justify-between gap-3", children: [
|
|
343
|
+
showControls ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
344
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.default, { unstyled: true, type: "button", onClick: prev, "aria-label": prevLabel, title: prevLabel, className: overlayBtnClassName, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_iconos.ChevronLeftIcon, { className: "h-4 w-4", "aria-hidden": true }) }),
|
|
345
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.default, { unstyled: true, type: "button", onClick: next, "aria-label": nextLabel, title: nextLabel, className: overlayBtnClassName, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_iconos.ChevronRightIcon, { className: "h-4 w-4", "aria-hidden": true }) })
|
|
346
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {}),
|
|
347
|
+
showDots ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex flex-wrap items-center justify-end gap-2", children: safeSlides.map((s, i) => {
|
|
348
|
+
var _a2, _b2;
|
|
349
|
+
const isActive = i === index;
|
|
350
|
+
const text = (_a2 = s.label) != null ? _a2 : goToLabel(i + 1);
|
|
351
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
352
|
+
"button",
|
|
353
|
+
{
|
|
354
|
+
type: "button",
|
|
355
|
+
onClick: () => goTo(i),
|
|
356
|
+
"aria-label": text,
|
|
357
|
+
"aria-current": isActive ? "true" : void 0,
|
|
358
|
+
title: text,
|
|
359
|
+
className: [
|
|
360
|
+
"h-2.5 w-7 rounded-full transition",
|
|
361
|
+
isActive ? overlayDotActiveClassName : overlayDotInactiveClassName
|
|
362
|
+
].join(" ")
|
|
363
|
+
},
|
|
364
|
+
(_b2 = s.key) != null ? _b2 : String(i)
|
|
365
|
+
);
|
|
366
|
+
}) }) : null
|
|
367
|
+
] }) })
|
|
368
|
+
}
|
|
369
|
+
) : null
|
|
370
|
+
]
|
|
371
|
+
}
|
|
372
|
+
),
|
|
373
|
+
!overlayNav && !renderOverlay && (showControls || showDots) && len > 1 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mt-3 flex items-center justify-between gap-3", children: [
|
|
374
|
+
showControls ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
375
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
376
|
+
import_Button.default,
|
|
377
|
+
{
|
|
378
|
+
unstyled: true,
|
|
379
|
+
type: "button",
|
|
380
|
+
onClick: prev,
|
|
381
|
+
"aria-label": prevLabel,
|
|
382
|
+
title: prevLabel,
|
|
383
|
+
className: "grid h-10 w-10 place-items-center rounded-xl border border-border bg-card text-foreground shadow-sm hover:bg-[color-mix(in_oklab,var(--surface)_70%,transparent)]",
|
|
384
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_iconos.ChevronLeftIcon, { className: "h-4 w-4", "aria-hidden": true })
|
|
385
|
+
}
|
|
386
|
+
),
|
|
387
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
388
|
+
import_Button.default,
|
|
389
|
+
{
|
|
390
|
+
unstyled: true,
|
|
391
|
+
type: "button",
|
|
392
|
+
onClick: next,
|
|
393
|
+
"aria-label": nextLabel,
|
|
394
|
+
title: nextLabel,
|
|
395
|
+
className: "grid h-10 w-10 place-items-center rounded-xl border border-border bg-card text-foreground shadow-sm hover:bg-[color-mix(in_oklab,var(--surface)_70%,transparent)]",
|
|
396
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_iconos.ChevronRightIcon, { className: "h-4 w-4", "aria-hidden": true })
|
|
397
|
+
}
|
|
398
|
+
)
|
|
399
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {}),
|
|
400
|
+
showDots ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex flex-wrap items-center justify-end gap-2", children: safeSlides.map((s, i) => {
|
|
401
|
+
var _a2, _b2;
|
|
402
|
+
const isActive = i === index;
|
|
403
|
+
const text = (_a2 = s.label) != null ? _a2 : goToLabel(i + 1);
|
|
404
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
405
|
+
"button",
|
|
406
|
+
{
|
|
407
|
+
type: "button",
|
|
408
|
+
onClick: () => goTo(i),
|
|
409
|
+
"aria-label": text,
|
|
410
|
+
"aria-current": isActive ? "true" : void 0,
|
|
411
|
+
title: text,
|
|
412
|
+
className: [
|
|
413
|
+
"h-2.5 w-7 rounded-full transition",
|
|
414
|
+
isActive ? "bg-primary" : "bg-[color-mix(in_oklab,var(--muted)_30%,transparent)] hover:bg-[color-mix(in_oklab,var(--muted)_45%,transparent)]"
|
|
415
|
+
].join(" ")
|
|
416
|
+
},
|
|
417
|
+
(_b2 = s.key) != null ? _b2 : String(i)
|
|
418
|
+
);
|
|
419
|
+
}) }) : null
|
|
420
|
+
] }) : null
|
|
421
|
+
]
|
|
422
|
+
}
|
|
423
|
+
) });
|
|
424
|
+
}
|
|
425
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
426
|
+
0 && (module.exports = {
|
|
427
|
+
useCarousel
|
|
428
|
+
});
|