beez-ui 2.7.1 → 3.0.1
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/CHANGELOG.md +78 -0
- package/README.md +43 -13
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/components/account-menu.d.ts +4 -3
- package/dist/components/account-menu.js +63 -54
- package/dist/components/alert.d.ts +15 -15
- package/dist/components/alert.js +289 -270
- package/dist/components/animated-theme-toggler.js +1 -1
- package/dist/components/avatar.d.ts +56 -31
- package/dist/components/avatar.js +394 -277
- package/dist/components/badge.d.ts +8 -28
- package/dist/components/badge.js +55 -108
- package/dist/components/calendar.d.ts +36 -26
- package/dist/components/calendar.js +132 -1227
- package/dist/components/card.d.ts +36 -25
- package/dist/components/card.js +895 -72
- package/dist/components/carousel.d.ts +63 -47
- package/dist/components/carousel.js +496 -777
- package/dist/components/data-table.d.ts +5 -4
- package/dist/components/data-table.js +7 -6
- package/dist/components/dialog-surface.d.ts +23 -1
- package/dist/components/dialog-surface.js +99 -3
- package/dist/components/dialog.d.ts +80 -45
- package/dist/components/dialog.js +258 -503
- package/dist/components/dropdown-menu.d.ts +56 -73
- package/dist/components/dropdown-menu.js +79 -714
- package/dist/components/field.d.ts +3 -1
- package/dist/components/field.js +49 -39
- package/dist/components/filter-presets-bar.js +2 -2
- package/dist/components/filter-query-bar.js +1 -1
- package/dist/components/hover-card.d.ts +42 -41
- package/dist/components/hover-card.js +57 -483
- package/dist/components/pagination.d.ts +53 -31
- package/dist/components/pagination.js +176 -412
- package/dist/components/popover.d.ts +11 -23
- package/dist/components/popover.js +19 -304
- package/dist/components/{alert-dialog.d.ts → primitives/alert-dialog.d.ts} +17 -5
- package/dist/components/{alert-dialog.js → primitives/alert-dialog.js} +102 -54
- package/dist/components/primitives/avatar.d.ts +46 -0
- package/dist/components/primitives/avatar.js +268 -0
- package/dist/components/primitives/calendar.d.ts +37 -0
- package/dist/components/primitives/calendar.js +1250 -0
- package/dist/components/primitives/carousel.d.ts +106 -0
- package/dist/components/primitives/carousel.js +928 -0
- package/dist/components/primitives/dialog.d.ts +62 -0
- package/dist/components/primitives/dialog.js +490 -0
- package/dist/components/primitives/dropdown-menu-items.d.ts +59 -0
- package/dist/components/primitives/dropdown-menu-items.js +265 -0
- package/dist/components/primitives/dropdown-menu.d.ts +64 -0
- package/dist/components/primitives/dropdown-menu.js +557 -0
- package/dist/components/primitives/hover-card.d.ts +50 -0
- package/dist/components/primitives/hover-card.js +507 -0
- package/dist/components/primitives/pagination.d.ts +65 -0
- package/dist/components/primitives/pagination.js +373 -0
- package/dist/components/primitives/popover.d.ts +22 -0
- package/dist/components/primitives/popover.js +213 -0
- package/dist/components/primitives/select.d.ts +36 -0
- package/dist/components/primitives/select.js +407 -0
- package/dist/components/primitives/tooltip.d.ts +30 -0
- package/dist/components/primitives/tooltip.js +277 -0
- package/dist/components/radio-group.d.ts +30 -17
- package/dist/components/radio-group.js +266 -315
- package/dist/components/rich-link-editor.js +1 -1
- package/dist/components/select.d.ts +51 -42
- package/dist/components/select.js +163 -495
- package/dist/components/skeleton.d.ts +16 -15
- package/dist/components/skeleton.js +99 -205
- package/dist/components/split-button.js +1 -1
- package/dist/components/switch.d.ts +3 -6
- package/dist/components/switch.js +163 -170
- package/dist/components/tabs.d.ts +3 -11
- package/dist/components/tabs.js +61 -75
- package/dist/components/themed-toaster.d.ts +1 -1
- package/dist/components/themed-toaster.js +1 -1
- package/dist/components/toaster.d.ts +1 -1
- package/dist/components/toaster.js +1 -1
- package/dist/components/tooltip.d.ts +36 -31
- package/dist/components/tooltip.js +44 -284
- package/dist/constants/alert.d.ts +5 -1
- package/dist/constants/alert.js +5 -1
- package/dist/constants/avatar.d.ts +29 -1
- package/dist/constants/avatar.js +25 -0
- package/dist/constants/calendar.d.ts +12 -0
- package/dist/constants/calendar.js +12 -0
- package/dist/constants/card.d.ts +23 -0
- package/dist/constants/card.js +20 -0
- package/dist/constants/carousel.d.ts +31 -13
- package/dist/constants/carousel.js +32 -11
- package/dist/constants/dialog.d.ts +6 -1
- package/dist/constants/dialog.js +5 -1
- package/dist/constants/dropdown-menu.d.ts +2 -2
- package/dist/constants/dropdown-menu.js +2 -2
- package/dist/constants/pagination.d.ts +13 -2
- package/dist/constants/pagination.js +13 -2
- package/dist/constants/select.d.ts +4 -2
- package/dist/constants/select.js +4 -2
- package/dist/constants/switch.d.ts +5 -16
- package/dist/constants/switch.js +6 -14
- package/dist/hooks/use-today.d.ts +7 -0
- package/dist/hooks/use-today.js +50 -0
- package/dist/hooks.d.ts +1 -0
- package/dist/hooks.js +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/motion/glide-indicator.d.ts +1 -1
- package/dist/motion/glide-indicator.js +1 -1
- package/dist/motion/presence.d.ts +0 -1
- package/dist/motion/presence.js +0 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -6
|
@@ -0,0 +1,928 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c as _c } from "react/compiler-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Internal carousel composition on Embla with Arc's carousel design (https://uiarc.dev, MIT License, see
|
|
5
|
+
* THIRD_PARTY_NOTICES.md): a focusable, draggable slide area with Arc's grab cursor, round outlined controls on the
|
|
6
|
+
* surface that answer hover on fine pointers and press in, Home and End to reach the edges, and Arc's indicator tab list
|
|
7
|
+
* whose pill stretches and travels with the slides frame by frame. Embla keeps dragging, snapping and looping.
|
|
8
|
+
*
|
|
9
|
+
* Not exported from the package: the public `Carousel` (`../carousel.tsx`) composes these parts behind Arc's closed API.
|
|
10
|
+
*/
|
|
11
|
+
import * as React from "react";
|
|
12
|
+
import useEmblaCarousel from "embla-carousel-react";
|
|
13
|
+
import { animate, motion, useMotionValue, useTransform } from "motion/react";
|
|
14
|
+
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
15
|
+
import { CAROUSEL_COPY, CAROUSEL_EDGE_KEYS, CAROUSEL_INDICATOR_LENGTH_PX, CAROUSEL_INDICATORS_SELECTOR, CAROUSEL_KEYS, CAROUSEL_OWN_KEYBOARD_SELECTOR, CAROUSEL_ROOT_SELECTOR } from "../../constants/carousel.js";
|
|
16
|
+
import { usePrefersReducedMotion } from "../../hooks/use-prefers-reduced-motion.js";
|
|
17
|
+
import { ARC_SPRING_SMOOTH } from "../../motion/arc-tokens.js";
|
|
18
|
+
import { cn } from "../../lib/utils.js";
|
|
19
|
+
import { ControlButton } from "../control-button.js";
|
|
20
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
|
+
const CarouselContext = React.createContext(null);
|
|
22
|
+
/**
|
|
23
|
+
* Reads the carousel the part is rendered in.
|
|
24
|
+
* @returns The shared Embla API, scroll actions and edge state.
|
|
25
|
+
*/
|
|
26
|
+
function useCarousel() {
|
|
27
|
+
const context = React.useContext(CarouselContext);
|
|
28
|
+
if (!context) {
|
|
29
|
+
throw new Error("useCarousel must be used within a <Carousel />");
|
|
30
|
+
}
|
|
31
|
+
return context;
|
|
32
|
+
}
|
|
33
|
+
/** Arc's round control on the surface: outlined, a fill on hover-capable pointers and a dimmed unavailable state. */
|
|
34
|
+
const carouselControlClassName = "size-(--control-height-sm) touch-manipulation rounded-full border-border bg-surface text-foreground hover-fine:not-aria-disabled:bg-surface-muted aria-disabled:pointer-events-none aria-disabled:cursor-default aria-disabled:bg-surface aria-disabled:text-text-muted aria-disabled:opacity-50 [&_svg:not([class*='size-'])]:size-[18px]";
|
|
35
|
+
/**
|
|
36
|
+
* The carousel root: a named section that owns the arrow, Home and End keys pressed inside it.
|
|
37
|
+
* @param props - Embla options and API callback plus native section attributes.
|
|
38
|
+
* @returns The carousel section.
|
|
39
|
+
*/
|
|
40
|
+
function Carousel(t0) {
|
|
41
|
+
const $ = _c(43);
|
|
42
|
+
let children;
|
|
43
|
+
let className;
|
|
44
|
+
let opts;
|
|
45
|
+
let props;
|
|
46
|
+
let setApi;
|
|
47
|
+
if ($[0] !== t0) {
|
|
48
|
+
({opts, setApi, className, children, ...props} = t0);
|
|
49
|
+
$[0] = t0;
|
|
50
|
+
$[1] = children;
|
|
51
|
+
$[2] = className;
|
|
52
|
+
$[3] = opts;
|
|
53
|
+
$[4] = props;
|
|
54
|
+
$[5] = setApi;
|
|
55
|
+
} else {
|
|
56
|
+
children = $[1];
|
|
57
|
+
className = $[2];
|
|
58
|
+
opts = $[3];
|
|
59
|
+
props = $[4];
|
|
60
|
+
setApi = $[5];
|
|
61
|
+
}
|
|
62
|
+
const shouldReduceMotion = usePrefersReducedMotion();
|
|
63
|
+
const [carouselRef, api] = useEmblaCarousel(opts);
|
|
64
|
+
const [canScrollPrev, setCanScrollPrev] = React.useState(false);
|
|
65
|
+
const [canScrollNext, setCanScrollNext] = React.useState(false);
|
|
66
|
+
let t1;
|
|
67
|
+
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
68
|
+
t1 = (api_0) => {
|
|
69
|
+
if (!api_0) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
setCanScrollPrev(api_0.canScrollPrev());
|
|
73
|
+
setCanScrollNext(api_0.canScrollNext());
|
|
74
|
+
};
|
|
75
|
+
$[6] = t1;
|
|
76
|
+
} else {
|
|
77
|
+
t1 = $[6];
|
|
78
|
+
}
|
|
79
|
+
const onSelect = t1;
|
|
80
|
+
let t2;
|
|
81
|
+
if ($[7] !== api || $[8] !== shouldReduceMotion) {
|
|
82
|
+
t2 = () => {
|
|
83
|
+
api?.scrollPrev(shouldReduceMotion);
|
|
84
|
+
};
|
|
85
|
+
$[7] = api;
|
|
86
|
+
$[8] = shouldReduceMotion;
|
|
87
|
+
$[9] = t2;
|
|
88
|
+
} else {
|
|
89
|
+
t2 = $[9];
|
|
90
|
+
}
|
|
91
|
+
const scrollPrev = t2;
|
|
92
|
+
let t3;
|
|
93
|
+
if ($[10] !== api || $[11] !== shouldReduceMotion) {
|
|
94
|
+
t3 = () => {
|
|
95
|
+
api?.scrollNext(shouldReduceMotion);
|
|
96
|
+
};
|
|
97
|
+
$[10] = api;
|
|
98
|
+
$[11] = shouldReduceMotion;
|
|
99
|
+
$[12] = t3;
|
|
100
|
+
} else {
|
|
101
|
+
t3 = $[12];
|
|
102
|
+
}
|
|
103
|
+
const scrollNext = t3;
|
|
104
|
+
let t4;
|
|
105
|
+
if ($[13] !== api || $[14] !== scrollNext || $[15] !== scrollPrev || $[16] !== shouldReduceMotion) {
|
|
106
|
+
t4 = (event) => {
|
|
107
|
+
if (event.altKey || event.ctrlKey || event.metaKey) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const target = event.target instanceof Element ? event.target : null;
|
|
111
|
+
const keyboardOwner = target?.closest(CAROUSEL_OWN_KEYBOARD_SELECTOR) ?? null;
|
|
112
|
+
if (keyboardOwner && event.currentTarget.contains(keyboardOwner) && !keyboardOwner.matches(CAROUSEL_INDICATORS_SELECTOR)) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const closestCarousel = target?.closest(CAROUSEL_ROOT_SELECTOR) ?? null;
|
|
116
|
+
if (closestCarousel && closestCarousel !== event.currentTarget) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (!api) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
let isHandled = true;
|
|
123
|
+
if (event.key === CAROUSEL_KEYS.previous) {
|
|
124
|
+
scrollPrev();
|
|
125
|
+
} else {
|
|
126
|
+
if (event.key === CAROUSEL_KEYS.next) {
|
|
127
|
+
scrollNext();
|
|
128
|
+
} else {
|
|
129
|
+
if (event.key === CAROUSEL_EDGE_KEYS.first) {
|
|
130
|
+
api.scrollTo(0, shouldReduceMotion);
|
|
131
|
+
} else {
|
|
132
|
+
if (event.key === CAROUSEL_EDGE_KEYS.last) {
|
|
133
|
+
api.scrollTo(api.scrollSnapList().length - 1, shouldReduceMotion);
|
|
134
|
+
} else {
|
|
135
|
+
isHandled = false;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (!isHandled) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
event.preventDefault();
|
|
144
|
+
if (target && api.containerNode().contains(target)) {
|
|
145
|
+
api.rootNode().focus({ preventScroll: true });
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
$[13] = api;
|
|
149
|
+
$[14] = scrollNext;
|
|
150
|
+
$[15] = scrollPrev;
|
|
151
|
+
$[16] = shouldReduceMotion;
|
|
152
|
+
$[17] = t4;
|
|
153
|
+
} else {
|
|
154
|
+
t4 = $[17];
|
|
155
|
+
}
|
|
156
|
+
const handleKeyDown = t4;
|
|
157
|
+
let t5;
|
|
158
|
+
let t6;
|
|
159
|
+
if ($[18] !== api || $[19] !== setApi) {
|
|
160
|
+
t5 = () => {
|
|
161
|
+
if (!api || !setApi) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
setApi(api);
|
|
165
|
+
};
|
|
166
|
+
t6 = [api, setApi];
|
|
167
|
+
$[18] = api;
|
|
168
|
+
$[19] = setApi;
|
|
169
|
+
$[20] = t5;
|
|
170
|
+
$[21] = t6;
|
|
171
|
+
} else {
|
|
172
|
+
t5 = $[20];
|
|
173
|
+
t6 = $[21];
|
|
174
|
+
}
|
|
175
|
+
React.useEffect(t5, t6);
|
|
176
|
+
let t7;
|
|
177
|
+
let t8;
|
|
178
|
+
if ($[22] !== api) {
|
|
179
|
+
t7 = () => {
|
|
180
|
+
if (!api) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
let isMounted = true;
|
|
184
|
+
queueMicrotask(() => {
|
|
185
|
+
if (isMounted) {
|
|
186
|
+
onSelect(api);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
api.on("reInit", onSelect);
|
|
190
|
+
api.on("select", onSelect);
|
|
191
|
+
return () => {
|
|
192
|
+
isMounted = false;
|
|
193
|
+
api?.off("reInit", onSelect);
|
|
194
|
+
api?.off("select", onSelect);
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
t8 = [api, onSelect];
|
|
198
|
+
$[22] = api;
|
|
199
|
+
$[23] = t7;
|
|
200
|
+
$[24] = t8;
|
|
201
|
+
} else {
|
|
202
|
+
t7 = $[23];
|
|
203
|
+
t8 = $[24];
|
|
204
|
+
}
|
|
205
|
+
React.useEffect(t7, t8);
|
|
206
|
+
let t9;
|
|
207
|
+
if ($[25] !== api || $[26] !== canScrollNext || $[27] !== canScrollPrev || $[28] !== carouselRef || $[29] !== opts || $[30] !== scrollNext || $[31] !== scrollPrev) {
|
|
208
|
+
t9 = {
|
|
209
|
+
carouselRef,
|
|
210
|
+
api,
|
|
211
|
+
opts,
|
|
212
|
+
scrollPrev,
|
|
213
|
+
scrollNext,
|
|
214
|
+
canScrollPrev,
|
|
215
|
+
canScrollNext
|
|
216
|
+
};
|
|
217
|
+
$[25] = api;
|
|
218
|
+
$[26] = canScrollNext;
|
|
219
|
+
$[27] = canScrollPrev;
|
|
220
|
+
$[28] = carouselRef;
|
|
221
|
+
$[29] = opts;
|
|
222
|
+
$[30] = scrollNext;
|
|
223
|
+
$[31] = scrollPrev;
|
|
224
|
+
$[32] = t9;
|
|
225
|
+
} else {
|
|
226
|
+
t9 = $[32];
|
|
227
|
+
}
|
|
228
|
+
let t10;
|
|
229
|
+
if ($[33] !== className) {
|
|
230
|
+
t10 = cn("relative", className);
|
|
231
|
+
$[33] = className;
|
|
232
|
+
$[34] = t10;
|
|
233
|
+
} else {
|
|
234
|
+
t10 = $[34];
|
|
235
|
+
}
|
|
236
|
+
let t11;
|
|
237
|
+
if ($[35] !== children || $[36] !== handleKeyDown || $[37] !== props || $[38] !== t10) {
|
|
238
|
+
t11 = /* @__PURE__ */ _jsx("section", {
|
|
239
|
+
onKeyDownCapture: handleKeyDown,
|
|
240
|
+
className: t10,
|
|
241
|
+
"aria-roledescription": CAROUSEL_COPY.roleDescription,
|
|
242
|
+
"data-slot": "carousel",
|
|
243
|
+
...props,
|
|
244
|
+
children
|
|
245
|
+
});
|
|
246
|
+
$[35] = children;
|
|
247
|
+
$[36] = handleKeyDown;
|
|
248
|
+
$[37] = props;
|
|
249
|
+
$[38] = t10;
|
|
250
|
+
$[39] = t11;
|
|
251
|
+
} else {
|
|
252
|
+
t11 = $[39];
|
|
253
|
+
}
|
|
254
|
+
let t12;
|
|
255
|
+
if ($[40] !== t11 || $[41] !== t9) {
|
|
256
|
+
t12 = /* @__PURE__ */ _jsx(CarouselContext.Provider, {
|
|
257
|
+
value: t9,
|
|
258
|
+
children: t11
|
|
259
|
+
});
|
|
260
|
+
$[40] = t11;
|
|
261
|
+
$[41] = t9;
|
|
262
|
+
$[42] = t12;
|
|
263
|
+
} else {
|
|
264
|
+
t12 = $[42];
|
|
265
|
+
}
|
|
266
|
+
return t12;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* The clipped, focusable viewport and the slide track. While the track can be dragged it shows Arc's grab cursor on
|
|
270
|
+
* fine pointers, and a grabbing cursor while a drag is held. A click on a neighbouring slide selects it, as in Arc.
|
|
271
|
+
* @param props - Viewport copy and class plus native attributes of the track.
|
|
272
|
+
* @returns The viewport holding the track.
|
|
273
|
+
*/
|
|
274
|
+
function CarouselContent(t0) {
|
|
275
|
+
const $ = _c(26);
|
|
276
|
+
let className;
|
|
277
|
+
let props;
|
|
278
|
+
let t1;
|
|
279
|
+
let viewportClassName;
|
|
280
|
+
if ($[0] !== t0) {
|
|
281
|
+
({className, viewportLabel: t1, viewportClassName, ...props} = t0);
|
|
282
|
+
$[0] = t0;
|
|
283
|
+
$[1] = className;
|
|
284
|
+
$[2] = props;
|
|
285
|
+
$[3] = t1;
|
|
286
|
+
$[4] = viewportClassName;
|
|
287
|
+
} else {
|
|
288
|
+
className = $[1];
|
|
289
|
+
props = $[2];
|
|
290
|
+
t1 = $[3];
|
|
291
|
+
viewportClassName = $[4];
|
|
292
|
+
}
|
|
293
|
+
const viewportLabel = t1 === undefined ? CAROUSEL_COPY.viewportLabel : t1;
|
|
294
|
+
const { carouselRef, api, opts, canScrollPrev, canScrollNext } = useCarousel();
|
|
295
|
+
const [isDragging, setIsDragging] = React.useState(false);
|
|
296
|
+
const reduceMotion = usePrefersReducedMotion();
|
|
297
|
+
const isDraggable = opts?.watchDrag !== false && (canScrollPrev || canScrollNext);
|
|
298
|
+
let t2;
|
|
299
|
+
let t3;
|
|
300
|
+
if ($[5] !== api) {
|
|
301
|
+
t2 = () => {
|
|
302
|
+
if (!api) {
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
const handlePointerDown = () => setIsDragging(true);
|
|
306
|
+
const handlePointerUp = () => setIsDragging(false);
|
|
307
|
+
api.on("pointerDown", handlePointerDown);
|
|
308
|
+
api.on("pointerUp", handlePointerUp);
|
|
309
|
+
return () => {
|
|
310
|
+
api.off("pointerDown", handlePointerDown);
|
|
311
|
+
api.off("pointerUp", handlePointerUp);
|
|
312
|
+
};
|
|
313
|
+
};
|
|
314
|
+
t3 = [api];
|
|
315
|
+
$[5] = api;
|
|
316
|
+
$[6] = t2;
|
|
317
|
+
$[7] = t3;
|
|
318
|
+
} else {
|
|
319
|
+
t2 = $[6];
|
|
320
|
+
t3 = $[7];
|
|
321
|
+
}
|
|
322
|
+
React.useEffect(t2, t3);
|
|
323
|
+
let t4;
|
|
324
|
+
if ($[8] !== api || $[9] !== reduceMotion) {
|
|
325
|
+
t4 = (event) => {
|
|
326
|
+
if (!api) {
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
const slideIndex = api.slideNodes().findIndex((slide) => {
|
|
330
|
+
const rect = slide.getBoundingClientRect();
|
|
331
|
+
return event.clientX >= rect.left && event.clientX <= rect.right;
|
|
332
|
+
});
|
|
333
|
+
if (slideIndex < 0 || slideIndex === api.selectedScrollSnap()) {
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
api.scrollTo(slideIndex, reduceMotion);
|
|
337
|
+
};
|
|
338
|
+
$[8] = api;
|
|
339
|
+
$[9] = reduceMotion;
|
|
340
|
+
$[10] = t4;
|
|
341
|
+
} else {
|
|
342
|
+
t4 = $[10];
|
|
343
|
+
}
|
|
344
|
+
const handleClick = t4;
|
|
345
|
+
const t5 = isDraggable && "pointer-fine:cursor-grab pointer-fine:data-dragging:cursor-grabbing";
|
|
346
|
+
let t6;
|
|
347
|
+
if ($[11] !== t5 || $[12] !== viewportClassName) {
|
|
348
|
+
t6 = cn("min-w-0 overflow-hidden rounded-(--radius-panel) outline-none [-webkit-tap-highlight-color:transparent] focus-visible:ring-3 focus-visible:ring-ring/50", t5, viewportClassName);
|
|
349
|
+
$[11] = t5;
|
|
350
|
+
$[12] = viewportClassName;
|
|
351
|
+
$[13] = t6;
|
|
352
|
+
} else {
|
|
353
|
+
t6 = $[13];
|
|
354
|
+
}
|
|
355
|
+
const t7 = isDraggable && isDragging || undefined;
|
|
356
|
+
let t8;
|
|
357
|
+
if ($[14] !== className) {
|
|
358
|
+
t8 = cn("flex", className);
|
|
359
|
+
$[14] = className;
|
|
360
|
+
$[15] = t8;
|
|
361
|
+
} else {
|
|
362
|
+
t8 = $[15];
|
|
363
|
+
}
|
|
364
|
+
let t9;
|
|
365
|
+
if ($[16] !== props || $[17] !== t8) {
|
|
366
|
+
t9 = /* @__PURE__ */ _jsx("div", {
|
|
367
|
+
className: t8,
|
|
368
|
+
...props
|
|
369
|
+
});
|
|
370
|
+
$[16] = props;
|
|
371
|
+
$[17] = t8;
|
|
372
|
+
$[18] = t9;
|
|
373
|
+
} else {
|
|
374
|
+
t9 = $[18];
|
|
375
|
+
}
|
|
376
|
+
let t10;
|
|
377
|
+
if ($[19] !== carouselRef || $[20] !== handleClick || $[21] !== t6 || $[22] !== t7 || $[23] !== t9 || $[24] !== viewportLabel) {
|
|
378
|
+
t10 = /* @__PURE__ */ _jsx("div", {
|
|
379
|
+
ref: carouselRef,
|
|
380
|
+
role: "group",
|
|
381
|
+
"aria-label": viewportLabel,
|
|
382
|
+
tabIndex: 0,
|
|
383
|
+
className: t6,
|
|
384
|
+
"data-slot": "carousel-content",
|
|
385
|
+
"data-dragging": t7,
|
|
386
|
+
onClick: handleClick,
|
|
387
|
+
children: t9
|
|
388
|
+
});
|
|
389
|
+
$[19] = carouselRef;
|
|
390
|
+
$[20] = handleClick;
|
|
391
|
+
$[21] = t6;
|
|
392
|
+
$[22] = t7;
|
|
393
|
+
$[23] = t9;
|
|
394
|
+
$[24] = viewportLabel;
|
|
395
|
+
$[25] = t10;
|
|
396
|
+
} else {
|
|
397
|
+
t10 = $[25];
|
|
398
|
+
}
|
|
399
|
+
return t10;
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* One slide. Its trailing margin is the gap to the next slide, so Embla measures it and centers the slide itself. It is
|
|
403
|
+
* a group described as a slide; pass `role="tabpanel"` only when indicator tabs control it.
|
|
404
|
+
* @param props - Native attributes of the slide panel.
|
|
405
|
+
* @returns The slide panel.
|
|
406
|
+
*/
|
|
407
|
+
function CarouselItem(t0) {
|
|
408
|
+
const $ = _c(8);
|
|
409
|
+
let className;
|
|
410
|
+
let props;
|
|
411
|
+
if ($[0] !== t0) {
|
|
412
|
+
({className, ...props} = t0);
|
|
413
|
+
$[0] = t0;
|
|
414
|
+
$[1] = className;
|
|
415
|
+
$[2] = props;
|
|
416
|
+
} else {
|
|
417
|
+
className = $[1];
|
|
418
|
+
props = $[2];
|
|
419
|
+
}
|
|
420
|
+
let t1;
|
|
421
|
+
if ($[3] !== className) {
|
|
422
|
+
t1 = cn("me-4 min-w-0 shrink-0 grow-0 basis-full", className);
|
|
423
|
+
$[3] = className;
|
|
424
|
+
$[4] = t1;
|
|
425
|
+
} else {
|
|
426
|
+
t1 = $[4];
|
|
427
|
+
}
|
|
428
|
+
let t2;
|
|
429
|
+
if ($[5] !== props || $[6] !== t1) {
|
|
430
|
+
t2 = /* @__PURE__ */ _jsx("div", {
|
|
431
|
+
role: "group",
|
|
432
|
+
"aria-roledescription": CAROUSEL_COPY.slideRoleDescription,
|
|
433
|
+
"data-slot": "carousel-item",
|
|
434
|
+
className: t1,
|
|
435
|
+
...props
|
|
436
|
+
});
|
|
437
|
+
$[5] = props;
|
|
438
|
+
$[6] = t1;
|
|
439
|
+
$[7] = t2;
|
|
440
|
+
} else {
|
|
441
|
+
t2 = $[7];
|
|
442
|
+
}
|
|
443
|
+
return t2;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Moves to the previous slide. It stays focusable and reports `aria-disabled` at the first slide, so focus is never
|
|
447
|
+
* lost when the carousel reaches its edge.
|
|
448
|
+
* @param props - Control button attributes; `aria-label` defaults to "Diapositiva anterior".
|
|
449
|
+
* @returns The previous control.
|
|
450
|
+
*/
|
|
451
|
+
function CarouselPrevious(t0) {
|
|
452
|
+
const $ = _c(16);
|
|
453
|
+
let className;
|
|
454
|
+
let onClick;
|
|
455
|
+
let props;
|
|
456
|
+
if ($[0] !== t0) {
|
|
457
|
+
({className, onClick, ...props} = t0);
|
|
458
|
+
$[0] = t0;
|
|
459
|
+
$[1] = className;
|
|
460
|
+
$[2] = onClick;
|
|
461
|
+
$[3] = props;
|
|
462
|
+
} else {
|
|
463
|
+
className = $[1];
|
|
464
|
+
onClick = $[2];
|
|
465
|
+
props = $[3];
|
|
466
|
+
}
|
|
467
|
+
const { scrollPrev, canScrollPrev } = useCarousel();
|
|
468
|
+
let t1;
|
|
469
|
+
if ($[4] !== className) {
|
|
470
|
+
t1 = cn(carouselControlClassName, className);
|
|
471
|
+
$[4] = className;
|
|
472
|
+
$[5] = t1;
|
|
473
|
+
} else {
|
|
474
|
+
t1 = $[5];
|
|
475
|
+
}
|
|
476
|
+
const t2 = !canScrollPrev || undefined;
|
|
477
|
+
let t3;
|
|
478
|
+
if ($[6] !== canScrollPrev || $[7] !== onClick || $[8] !== scrollPrev) {
|
|
479
|
+
t3 = (event) => {
|
|
480
|
+
onClick?.(event);
|
|
481
|
+
if (canScrollPrev) {
|
|
482
|
+
scrollPrev();
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
$[6] = canScrollPrev;
|
|
486
|
+
$[7] = onClick;
|
|
487
|
+
$[8] = scrollPrev;
|
|
488
|
+
$[9] = t3;
|
|
489
|
+
} else {
|
|
490
|
+
t3 = $[9];
|
|
491
|
+
}
|
|
492
|
+
let t4;
|
|
493
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
494
|
+
t4 = /* @__PURE__ */ _jsx(ChevronLeftIcon, {
|
|
495
|
+
strokeWidth: 1.75,
|
|
496
|
+
"aria-hidden": "true"
|
|
497
|
+
});
|
|
498
|
+
$[10] = t4;
|
|
499
|
+
} else {
|
|
500
|
+
t4 = $[10];
|
|
501
|
+
}
|
|
502
|
+
let t5;
|
|
503
|
+
if ($[11] !== props || $[12] !== t1 || $[13] !== t2 || $[14] !== t3) {
|
|
504
|
+
t5 = /* @__PURE__ */ _jsx(ControlButton, {
|
|
505
|
+
"data-slot": "carousel-previous",
|
|
506
|
+
variant: "outline",
|
|
507
|
+
size: "icon",
|
|
508
|
+
className: t1,
|
|
509
|
+
"aria-label": CAROUSEL_COPY.previous,
|
|
510
|
+
"aria-disabled": t2,
|
|
511
|
+
onClick: t3,
|
|
512
|
+
...props,
|
|
513
|
+
children: t4
|
|
514
|
+
});
|
|
515
|
+
$[11] = props;
|
|
516
|
+
$[12] = t1;
|
|
517
|
+
$[13] = t2;
|
|
518
|
+
$[14] = t3;
|
|
519
|
+
$[15] = t5;
|
|
520
|
+
} else {
|
|
521
|
+
t5 = $[15];
|
|
522
|
+
}
|
|
523
|
+
return t5;
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Moves to the next slide. It stays focusable and reports `aria-disabled` at the last slide.
|
|
527
|
+
* @param props - Control button attributes; `aria-label` defaults to "Diapositiva siguiente".
|
|
528
|
+
* @returns The next control.
|
|
529
|
+
*/
|
|
530
|
+
function CarouselNext(t0) {
|
|
531
|
+
const $ = _c(16);
|
|
532
|
+
let className;
|
|
533
|
+
let onClick;
|
|
534
|
+
let props;
|
|
535
|
+
if ($[0] !== t0) {
|
|
536
|
+
({className, onClick, ...props} = t0);
|
|
537
|
+
$[0] = t0;
|
|
538
|
+
$[1] = className;
|
|
539
|
+
$[2] = onClick;
|
|
540
|
+
$[3] = props;
|
|
541
|
+
} else {
|
|
542
|
+
className = $[1];
|
|
543
|
+
onClick = $[2];
|
|
544
|
+
props = $[3];
|
|
545
|
+
}
|
|
546
|
+
const { scrollNext, canScrollNext } = useCarousel();
|
|
547
|
+
let t1;
|
|
548
|
+
if ($[4] !== className) {
|
|
549
|
+
t1 = cn(carouselControlClassName, className);
|
|
550
|
+
$[4] = className;
|
|
551
|
+
$[5] = t1;
|
|
552
|
+
} else {
|
|
553
|
+
t1 = $[5];
|
|
554
|
+
}
|
|
555
|
+
const t2 = !canScrollNext || undefined;
|
|
556
|
+
let t3;
|
|
557
|
+
if ($[6] !== canScrollNext || $[7] !== onClick || $[8] !== scrollNext) {
|
|
558
|
+
t3 = (event) => {
|
|
559
|
+
onClick?.(event);
|
|
560
|
+
if (canScrollNext) {
|
|
561
|
+
scrollNext();
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
$[6] = canScrollNext;
|
|
565
|
+
$[7] = onClick;
|
|
566
|
+
$[8] = scrollNext;
|
|
567
|
+
$[9] = t3;
|
|
568
|
+
} else {
|
|
569
|
+
t3 = $[9];
|
|
570
|
+
}
|
|
571
|
+
let t4;
|
|
572
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
573
|
+
t4 = /* @__PURE__ */ _jsx(ChevronRightIcon, {
|
|
574
|
+
strokeWidth: 1.75,
|
|
575
|
+
"aria-hidden": "true"
|
|
576
|
+
});
|
|
577
|
+
$[10] = t4;
|
|
578
|
+
} else {
|
|
579
|
+
t4 = $[10];
|
|
580
|
+
}
|
|
581
|
+
let t5;
|
|
582
|
+
if ($[11] !== props || $[12] !== t1 || $[13] !== t2 || $[14] !== t3) {
|
|
583
|
+
t5 = /* @__PURE__ */ _jsx(ControlButton, {
|
|
584
|
+
"data-slot": "carousel-next",
|
|
585
|
+
variant: "outline",
|
|
586
|
+
size: "icon",
|
|
587
|
+
className: t1,
|
|
588
|
+
"aria-label": CAROUSEL_COPY.next,
|
|
589
|
+
"aria-disabled": t2,
|
|
590
|
+
onClick: t3,
|
|
591
|
+
...props,
|
|
592
|
+
children: t4
|
|
593
|
+
});
|
|
594
|
+
$[11] = props;
|
|
595
|
+
$[12] = t1;
|
|
596
|
+
$[13] = t2;
|
|
597
|
+
$[14] = t3;
|
|
598
|
+
$[15] = t5;
|
|
599
|
+
} else {
|
|
600
|
+
t5 = $[15];
|
|
601
|
+
}
|
|
602
|
+
return t5;
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Default accessible name of one slide and its indicator, for example "Diapositiva 2 de 5".
|
|
606
|
+
* @param index - Zero-based slide position.
|
|
607
|
+
* @param count - Number of slides.
|
|
608
|
+
* @returns The Spanish slide label.
|
|
609
|
+
*/
|
|
610
|
+
function defaultCarouselSlideLabel(index, count) {
|
|
611
|
+
return `${CAROUSEL_COPY.slideLabelPrefix} ${index + 1} ${CAROUSEL_COPY.slideLabelSeparator} ${count}`;
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* Continuous slide position, in slides, of a scroll progress between Embla's snap points. Snaps are progress values,
|
|
615
|
+
* so slides of different sizes still map to whole slides at rest.
|
|
616
|
+
* @param progress - Embla's scroll progress, from 0 to 1.
|
|
617
|
+
* @param snaps - Embla's snap points, as scroll progress values.
|
|
618
|
+
* @returns The fractional index of the slide in view.
|
|
619
|
+
*/
|
|
620
|
+
function toSlidePosition(progress, snaps) {
|
|
621
|
+
const lastIndex = snaps.length - 1;
|
|
622
|
+
if (lastIndex < 1) return 0;
|
|
623
|
+
const first = snaps[0] ?? 0;
|
|
624
|
+
const last = snaps[lastIndex] ?? 1;
|
|
625
|
+
if (progress <= first) return 0;
|
|
626
|
+
if (progress >= last) return lastIndex;
|
|
627
|
+
for (let index = 0; index < lastIndex; index += 1) {
|
|
628
|
+
const start = snaps[index] ?? 0;
|
|
629
|
+
const end = snaps[index + 1] ?? 1;
|
|
630
|
+
if (progress <= end) return end > start ? index + (progress - start) / (end - start) : index;
|
|
631
|
+
}
|
|
632
|
+
return lastIndex;
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Arc's page indicator: a tab per snap point, where the selected one stretches into a pill that follows the track frame
|
|
636
|
+
* by frame while it is dragged or scrolled. Only the selected tab is in the tab order; activating a tab scrolls to its
|
|
637
|
+
* slide, and while a tab has focus the carousel's arrow, Home and End keys move the focus to the tab of the new slide.
|
|
638
|
+
* It renders once Embla has measured the slides, or from `initialCount` until then. Place it inside `Carousel`.
|
|
639
|
+
* @param props - Optional accessible copy, slide ids and rotation drain plus native attributes of the list.
|
|
640
|
+
* @returns The indicator tab list, or nothing until there is more than one snap point.
|
|
641
|
+
*/
|
|
642
|
+
function CarouselIndicators(t0) {
|
|
643
|
+
const $ = _c(32);
|
|
644
|
+
let className;
|
|
645
|
+
let drain;
|
|
646
|
+
let getSlideId;
|
|
647
|
+
let props;
|
|
648
|
+
let t1;
|
|
649
|
+
let t2;
|
|
650
|
+
let t3;
|
|
651
|
+
let t4;
|
|
652
|
+
if ($[0] !== t0) {
|
|
653
|
+
({className, label: t1, slideLabel: t2, getSlideId, drain, initialCount: t3, initialIndex: t4, ...props} = t0);
|
|
654
|
+
$[0] = t0;
|
|
655
|
+
$[1] = className;
|
|
656
|
+
$[2] = drain;
|
|
657
|
+
$[3] = getSlideId;
|
|
658
|
+
$[4] = props;
|
|
659
|
+
$[5] = t1;
|
|
660
|
+
$[6] = t2;
|
|
661
|
+
$[7] = t3;
|
|
662
|
+
$[8] = t4;
|
|
663
|
+
} else {
|
|
664
|
+
className = $[1];
|
|
665
|
+
drain = $[2];
|
|
666
|
+
getSlideId = $[3];
|
|
667
|
+
props = $[4];
|
|
668
|
+
t1 = $[5];
|
|
669
|
+
t2 = $[6];
|
|
670
|
+
t3 = $[7];
|
|
671
|
+
t4 = $[8];
|
|
672
|
+
}
|
|
673
|
+
const label = t1 === undefined ? CAROUSEL_COPY.indicatorsLabel : t1;
|
|
674
|
+
const slideLabel = t2 === undefined ? defaultCarouselSlideLabel : t2;
|
|
675
|
+
const initialCount = t3 === undefined ? 0 : t3;
|
|
676
|
+
const initialIndex = t4 === undefined ? 0 : t4;
|
|
677
|
+
const { api } = useCarousel();
|
|
678
|
+
const reduceMotion = usePrefersReducedMotion();
|
|
679
|
+
const [snapCount, setSnapCount] = React.useState(initialCount);
|
|
680
|
+
const [selectedIndex, setSelectedIndex] = React.useState(initialIndex);
|
|
681
|
+
const [isLooping, setIsLooping] = React.useState(false);
|
|
682
|
+
const position = useMotionValue(initialIndex);
|
|
683
|
+
let t5;
|
|
684
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
685
|
+
t5 = [];
|
|
686
|
+
$[9] = t5;
|
|
687
|
+
} else {
|
|
688
|
+
t5 = $[9];
|
|
689
|
+
}
|
|
690
|
+
const indicatorRefs = React.useRef(t5);
|
|
691
|
+
let t6;
|
|
692
|
+
let t7;
|
|
693
|
+
if ($[10] !== api || $[11] !== position || $[12] !== reduceMotion) {
|
|
694
|
+
t6 = () => {
|
|
695
|
+
if (!api) {
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
698
|
+
let positionAnimation = null;
|
|
699
|
+
const isLoop = () => api.internalEngine().options.loop;
|
|
700
|
+
const trackScroll = () => {
|
|
701
|
+
if (isLoop()) {
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
704
|
+
positionAnimation?.stop();
|
|
705
|
+
position.set(toSlidePosition(api.scrollProgress(), api.scrollSnapList()));
|
|
706
|
+
};
|
|
707
|
+
const syncSelection = () => {
|
|
708
|
+
const nextIndex = api.selectedScrollSnap();
|
|
709
|
+
const count = api.scrollSnapList().length;
|
|
710
|
+
setSnapCount(count);
|
|
711
|
+
setSelectedIndex(nextIndex);
|
|
712
|
+
setIsLooping(isLoop());
|
|
713
|
+
if (isLoop()) {
|
|
714
|
+
positionAnimation?.stop();
|
|
715
|
+
const turns = Math.round((position.get() - nextIndex) / count);
|
|
716
|
+
const destination = nextIndex + turns * count;
|
|
717
|
+
positionAnimation = reduceMotion ? null : animate(position, destination, {
|
|
718
|
+
...ARC_SPRING_SMOOTH,
|
|
719
|
+
onComplete: () => position.jump(nextIndex)
|
|
720
|
+
});
|
|
721
|
+
if (reduceMotion) {
|
|
722
|
+
position.set(nextIndex);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
if (indicatorRefs.current.some(_temp)) {
|
|
726
|
+
indicatorRefs.current[nextIndex]?.focus({ preventScroll: true });
|
|
727
|
+
}
|
|
728
|
+
};
|
|
729
|
+
const syncAll = () => {
|
|
730
|
+
syncSelection();
|
|
731
|
+
if (isLoop()) {
|
|
732
|
+
positionAnimation?.stop();
|
|
733
|
+
position.set(api.selectedScrollSnap());
|
|
734
|
+
} else {
|
|
735
|
+
trackScroll();
|
|
736
|
+
}
|
|
737
|
+
};
|
|
738
|
+
syncAll();
|
|
739
|
+
api.on("reInit", syncAll);
|
|
740
|
+
api.on("select", syncSelection);
|
|
741
|
+
api.on("scroll", trackScroll);
|
|
742
|
+
return () => {
|
|
743
|
+
positionAnimation?.stop();
|
|
744
|
+
api.off("reInit", syncAll);
|
|
745
|
+
api.off("select", syncSelection);
|
|
746
|
+
api.off("scroll", trackScroll);
|
|
747
|
+
};
|
|
748
|
+
};
|
|
749
|
+
t7 = [
|
|
750
|
+
api,
|
|
751
|
+
position,
|
|
752
|
+
reduceMotion
|
|
753
|
+
];
|
|
754
|
+
$[10] = api;
|
|
755
|
+
$[11] = position;
|
|
756
|
+
$[12] = reduceMotion;
|
|
757
|
+
$[13] = t6;
|
|
758
|
+
$[14] = t7;
|
|
759
|
+
} else {
|
|
760
|
+
t6 = $[13];
|
|
761
|
+
t7 = $[14];
|
|
762
|
+
}
|
|
763
|
+
React.useEffect(t6, t7);
|
|
764
|
+
if (snapCount < 2) {
|
|
765
|
+
return null;
|
|
766
|
+
}
|
|
767
|
+
let t8;
|
|
768
|
+
if ($[15] !== className) {
|
|
769
|
+
t8 = cn("flex min-w-0 items-center", className);
|
|
770
|
+
$[15] = className;
|
|
771
|
+
$[16] = t8;
|
|
772
|
+
} else {
|
|
773
|
+
t8 = $[16];
|
|
774
|
+
}
|
|
775
|
+
let t9;
|
|
776
|
+
if ($[17] !== api || $[18] !== drain || $[19] !== getSlideId || $[20] !== isLooping || $[21] !== position || $[22] !== reduceMotion || $[23] !== selectedIndex || $[24] !== slideLabel || $[25] !== snapCount) {
|
|
777
|
+
t9 = Array.from({ length: snapCount }, (_, index) => /* @__PURE__ */ _jsx(CarouselIndicator, {
|
|
778
|
+
index,
|
|
779
|
+
lastIndex: snapCount - 1,
|
|
780
|
+
isLooping,
|
|
781
|
+
position,
|
|
782
|
+
isSelected: index === selectedIndex,
|
|
783
|
+
drain: index === selectedIndex ? drain : undefined,
|
|
784
|
+
label: slideLabel(index, snapCount),
|
|
785
|
+
controls: getSlideId?.(index),
|
|
786
|
+
indicatorRef: (node) => {
|
|
787
|
+
indicatorRefs.current[index] = node;
|
|
788
|
+
},
|
|
789
|
+
onSelect: () => api?.scrollTo(index, reduceMotion)
|
|
790
|
+
}, index));
|
|
791
|
+
$[17] = api;
|
|
792
|
+
$[18] = drain;
|
|
793
|
+
$[19] = getSlideId;
|
|
794
|
+
$[20] = isLooping;
|
|
795
|
+
$[21] = position;
|
|
796
|
+
$[22] = reduceMotion;
|
|
797
|
+
$[23] = selectedIndex;
|
|
798
|
+
$[24] = slideLabel;
|
|
799
|
+
$[25] = snapCount;
|
|
800
|
+
$[26] = t9;
|
|
801
|
+
} else {
|
|
802
|
+
t9 = $[26];
|
|
803
|
+
}
|
|
804
|
+
let t10;
|
|
805
|
+
if ($[27] !== label || $[28] !== props || $[29] !== t8 || $[30] !== t9) {
|
|
806
|
+
t10 = /* @__PURE__ */ _jsx("div", {
|
|
807
|
+
role: "tablist",
|
|
808
|
+
"aria-label": label,
|
|
809
|
+
"data-slot": "carousel-indicators",
|
|
810
|
+
className: t8,
|
|
811
|
+
...props,
|
|
812
|
+
children: t9
|
|
813
|
+
});
|
|
814
|
+
$[27] = label;
|
|
815
|
+
$[28] = props;
|
|
816
|
+
$[29] = t8;
|
|
817
|
+
$[30] = t9;
|
|
818
|
+
$[31] = t10;
|
|
819
|
+
} else {
|
|
820
|
+
t10 = $[31];
|
|
821
|
+
}
|
|
822
|
+
return t10;
|
|
823
|
+
}
|
|
824
|
+
function _temp(indicator) {
|
|
825
|
+
return indicator !== null && indicator === document.activeElement;
|
|
826
|
+
}
|
|
827
|
+
/** One tab whose dot grows toward the pill as the track nears its slide, so the pill hands over continuously. */
|
|
828
|
+
function CarouselIndicator(t0) {
|
|
829
|
+
const $ = _c(22);
|
|
830
|
+
const { index, lastIndex, isLooping, position, isSelected, drain, label, controls, indicatorRef, onSelect } = t0;
|
|
831
|
+
let t1;
|
|
832
|
+
if ($[0] !== index || $[1] !== isLooping || $[2] !== lastIndex) {
|
|
833
|
+
t1 = (value) => {
|
|
834
|
+
if (!isLooping) {
|
|
835
|
+
return Math.max(0, 1 - Math.abs(Math.min(lastIndex, Math.max(0, value)) - index));
|
|
836
|
+
}
|
|
837
|
+
const count = lastIndex + 1;
|
|
838
|
+
const distance = Math.abs(value - index) % count;
|
|
839
|
+
return Math.max(0, 1 - Math.min(distance, count - distance));
|
|
840
|
+
};
|
|
841
|
+
$[0] = index;
|
|
842
|
+
$[1] = isLooping;
|
|
843
|
+
$[2] = lastIndex;
|
|
844
|
+
$[3] = t1;
|
|
845
|
+
} else {
|
|
846
|
+
t1 = $[3];
|
|
847
|
+
}
|
|
848
|
+
const emphasis = useTransform(position, t1);
|
|
849
|
+
const length = useTransform(emphasis, _temp2);
|
|
850
|
+
const t2 = isSelected ? 0 : -1;
|
|
851
|
+
let t3;
|
|
852
|
+
if ($[4] !== length) {
|
|
853
|
+
t3 = { width: length };
|
|
854
|
+
$[4] = length;
|
|
855
|
+
$[5] = t3;
|
|
856
|
+
} else {
|
|
857
|
+
t3 = $[5];
|
|
858
|
+
}
|
|
859
|
+
let t4;
|
|
860
|
+
if ($[6] !== emphasis) {
|
|
861
|
+
t4 = /* @__PURE__ */ _jsx(motion.span, {
|
|
862
|
+
className: "absolute inset-0 bg-foreground",
|
|
863
|
+
style: { opacity: emphasis }
|
|
864
|
+
});
|
|
865
|
+
$[6] = emphasis;
|
|
866
|
+
$[7] = t4;
|
|
867
|
+
} else {
|
|
868
|
+
t4 = $[7];
|
|
869
|
+
}
|
|
870
|
+
let t5;
|
|
871
|
+
if ($[8] !== drain) {
|
|
872
|
+
t5 = drain ? /* @__PURE__ */ _jsx(motion.span, {
|
|
873
|
+
"data-slot": "carousel-indicator-drain",
|
|
874
|
+
className: "absolute inset-0 origin-right bg-border-strong",
|
|
875
|
+
style: { scaleX: drain }
|
|
876
|
+
}) : null;
|
|
877
|
+
$[8] = drain;
|
|
878
|
+
$[9] = t5;
|
|
879
|
+
} else {
|
|
880
|
+
t5 = $[9];
|
|
881
|
+
}
|
|
882
|
+
let t6;
|
|
883
|
+
if ($[10] !== t3 || $[11] !== t4 || $[12] !== t5) {
|
|
884
|
+
t6 = /* @__PURE__ */ _jsxs(motion.span, {
|
|
885
|
+
"aria-hidden": "true",
|
|
886
|
+
className: "relative block h-1.5 overflow-hidden rounded-full bg-border-strong transition-colors duration-(--duration-fast) ease-(--ease-standard) motion-reduce:transition-none hover-fine:group-hover/indicator:bg-text-muted",
|
|
887
|
+
style: t3,
|
|
888
|
+
children: [t4, t5]
|
|
889
|
+
});
|
|
890
|
+
$[10] = t3;
|
|
891
|
+
$[11] = t4;
|
|
892
|
+
$[12] = t5;
|
|
893
|
+
$[13] = t6;
|
|
894
|
+
} else {
|
|
895
|
+
t6 = $[13];
|
|
896
|
+
}
|
|
897
|
+
let t7;
|
|
898
|
+
if ($[14] !== controls || $[15] !== indicatorRef || $[16] !== isSelected || $[17] !== label || $[18] !== onSelect || $[19] !== t2 || $[20] !== t6) {
|
|
899
|
+
t7 = /* @__PURE__ */ _jsx("button", {
|
|
900
|
+
ref: indicatorRef,
|
|
901
|
+
type: "button",
|
|
902
|
+
role: "tab",
|
|
903
|
+
"aria-selected": isSelected,
|
|
904
|
+
"aria-controls": controls,
|
|
905
|
+
"aria-label": label,
|
|
906
|
+
tabIndex: t2,
|
|
907
|
+
"data-slot": "carousel-indicator",
|
|
908
|
+
className: "group/indicator grid h-(--control-height-sm) shrink-0 cursor-pointer place-items-center rounded-full border-0 bg-transparent px-[5px] py-0 outline-none [-webkit-tap-highlight-color:transparent] focus-visible:ring-3 focus-visible:ring-ring/50 @max-[340px]/carousel:px-1",
|
|
909
|
+
onClick: onSelect,
|
|
910
|
+
children: t6
|
|
911
|
+
});
|
|
912
|
+
$[14] = controls;
|
|
913
|
+
$[15] = indicatorRef;
|
|
914
|
+
$[16] = isSelected;
|
|
915
|
+
$[17] = label;
|
|
916
|
+
$[18] = onSelect;
|
|
917
|
+
$[19] = t2;
|
|
918
|
+
$[20] = t6;
|
|
919
|
+
$[21] = t7;
|
|
920
|
+
} else {
|
|
921
|
+
t7 = $[21];
|
|
922
|
+
}
|
|
923
|
+
return t7;
|
|
924
|
+
}
|
|
925
|
+
function _temp2(value_0) {
|
|
926
|
+
return CAROUSEL_INDICATOR_LENGTH_PX.dot + (CAROUSEL_INDICATOR_LENGTH_PX.pill - CAROUSEL_INDICATOR_LENGTH_PX.dot) * value_0;
|
|
927
|
+
}
|
|
928
|
+
export { Carousel, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext, CarouselIndicators, defaultCarouselSlideLabel, useCarousel };
|