beez-ui 2.5.0 → 2.6.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 +63 -0
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/components/alert-dialog.d.ts +15 -4
- package/dist/components/alert-dialog.js +84 -44
- package/dist/components/alert.d.ts +30 -9
- package/dist/components/alert.js +360 -39
- package/dist/components/avatar.d.ts +33 -10
- package/dist/components/avatar.js +110 -30
- package/dist/components/badge.d.ts +39 -7
- package/dist/components/badge.js +348 -24
- package/dist/components/calendar.d.ts +29 -2
- package/dist/components/calendar.js +1035 -223
- package/dist/components/card.d.ts +17 -1
- package/dist/components/card.js +34 -8
- package/dist/components/carousel.d.ts +29 -2
- package/dist/components/carousel.js +471 -90
- package/dist/components/checkbox.d.ts +13 -2
- package/dist/components/checkbox.js +301 -41
- package/dist/components/dialog-surface.d.ts +27 -0
- package/dist/components/dialog-surface.js +137 -0
- package/dist/components/dialog.d.ts +21 -4
- package/dist/components/dialog.js +163 -96
- package/dist/components/dropdown-menu.d.ts +30 -16
- package/dist/components/dropdown-menu.js +139 -83
- package/dist/components/hover-card.d.ts +46 -3
- package/dist/components/hover-card.js +423 -60
- package/dist/components/pagination.d.ts +32 -14
- package/dist/components/pagination.js +136 -59
- package/dist/components/popover.d.ts +14 -5
- package/dist/components/popover.js +78 -36
- package/dist/components/radio-group.d.ts +19 -3
- package/dist/components/radio-group.js +400 -57
- package/dist/components/select.d.ts +17 -6
- package/dist/components/select.js +83 -71
- package/dist/components/sheet.js +37 -26
- package/dist/components/sidebar.js +11 -0
- package/dist/components/skeleton.d.ts +19 -5
- package/dist/components/skeleton.js +434 -14
- package/dist/components/switch.d.ts +14 -4
- package/dist/components/switch.js +424 -40
- package/dist/components/tabs.d.ts +38 -5
- package/dist/components/tabs.js +564 -97
- package/dist/components/themed-toaster.d.ts +6 -2
- package/dist/components/themed-toaster.js +80 -50
- package/dist/components/tooltip.d.ts +33 -2
- package/dist/components/tooltip.js +197 -69
- package/dist/constants/alert.d.ts +12 -0
- package/dist/constants/alert.js +9 -0
- package/dist/constants/avatar.d.ts +10 -0
- package/dist/constants/avatar.js +7 -0
- package/dist/constants/badge.d.ts +6 -0
- package/dist/constants/badge.js +6 -0
- package/dist/constants/calendar.d.ts +24 -0
- package/dist/constants/calendar.js +22 -0
- package/dist/constants/carousel.d.ts +37 -0
- package/dist/constants/carousel.js +53 -0
- package/dist/constants/checkbox.d.ts +17 -0
- package/dist/constants/checkbox.js +17 -0
- package/dist/constants/dialog.d.ts +6 -0
- package/dist/constants/dialog.js +6 -0
- package/dist/constants/dropdown-menu.d.ts +5 -0
- package/dist/constants/dropdown-menu.js +5 -0
- package/dist/constants/hover-card.d.ts +37 -0
- package/dist/constants/hover-card.js +85 -0
- package/dist/constants/pagination.d.ts +9 -0
- package/dist/constants/pagination.js +9 -0
- package/dist/constants/popover.d.ts +7 -0
- package/dist/constants/popover.js +39 -0
- package/dist/constants/radio-group.d.ts +10 -0
- package/dist/constants/radio-group.js +10 -0
- package/dist/constants/select.d.ts +3 -0
- package/dist/constants/select.js +3 -0
- package/dist/constants/skeleton.d.ts +17 -0
- package/dist/constants/skeleton.js +17 -0
- package/dist/constants/switch.d.ts +44 -0
- package/dist/constants/switch.js +49 -0
- package/dist/constants/tabs.d.ts +17 -0
- package/dist/constants/tabs.js +17 -0
- package/dist/constants/toast.d.ts +3 -0
- package/dist/constants/toast.js +3 -0
- package/dist/constants/tooltip.d.ts +13 -0
- package/dist/constants/tooltip.js +52 -0
- package/dist/lib/toast-layer.d.ts +24 -0
- package/dist/lib/toast-layer.js +76 -0
- package/dist/motion/arc-floating-slot.d.ts +40 -0
- package/dist/motion/arc-floating-slot.js +167 -0
- package/dist/motion/glide-indicator.d.ts +6 -7
- package/dist/motion/glide-indicator.js +5 -3
- package/dist/motion/overlay-warmth.d.ts +24 -0
- package/dist/motion/overlay-warmth.js +70 -0
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { c as _c } from "react/compiler-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Carousel on Embla with Arc's carousel design (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md): round
|
|
5
|
+
* outlined controls on the surface that answer hover on fine pointers and press in, a grab cursor while the track can
|
|
6
|
+
* be dragged, Home and End to reach the edges, and optional Arc indicators whose pill stretches and travels with the
|
|
7
|
+
* slides frame by frame. Embla keeps dragging, snapping, looping and plugins.
|
|
8
|
+
*/
|
|
3
9
|
import * as React from "react";
|
|
4
10
|
import useEmblaCarousel from "embla-carousel-react";
|
|
11
|
+
import { animate, motion, useMotionValue, useTransform } from "motion/react";
|
|
12
|
+
import { CAROUSEL_COPY, CAROUSEL_EDGE_KEYS, CAROUSEL_INDICATOR_LENGTH_PX, CAROUSEL_KEYS, CAROUSEL_OWN_KEYBOARD_SELECTOR, CAROUSEL_ROOT_SELECTOR } from "../constants/carousel.js";
|
|
5
13
|
import { usePrefersReducedMotion } from "../hooks/use-prefers-reduced-motion.js";
|
|
14
|
+
import { ARC_SPRING_SMOOTH } from "../motion/arc-tokens.js";
|
|
6
15
|
import { cn } from "../lib/utils.js";
|
|
7
16
|
import { ControlButton } from "./control-button.js";
|
|
8
17
|
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
9
18
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
-
/** Arrow keys that move to the previous and next slide along each axis. */
|
|
11
|
-
const CAROUSEL_KEYS = {
|
|
12
|
-
horizontal: {
|
|
13
|
-
previous: "ArrowLeft",
|
|
14
|
-
next: "ArrowRight"
|
|
15
|
-
},
|
|
16
|
-
vertical: {
|
|
17
|
-
previous: "ArrowUp",
|
|
18
|
-
next: "ArrowDown"
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
19
|
const CarouselContext = React.createContext(null);
|
|
22
20
|
function useCarousel() {
|
|
23
21
|
const context = React.useContext(CarouselContext);
|
|
@@ -26,8 +24,10 @@ function useCarousel() {
|
|
|
26
24
|
}
|
|
27
25
|
return context;
|
|
28
26
|
}
|
|
27
|
+
/** Arc's round control on the surface: outlined, a fill on hover-capable pointers and a dimmed disabled state. */
|
|
28
|
+
const carouselControlClassName = "absolute touch-manipulation rounded-full border-border bg-surface text-foreground hover-fine:not-disabled:bg-surface-muted disabled:bg-surface disabled:text-text-muted disabled:opacity-50 [&_svg:not([class*='size-'])]:size-[18px]";
|
|
29
29
|
function Carousel(t0) {
|
|
30
|
-
const $ = _c(
|
|
30
|
+
const $ = _c(50);
|
|
31
31
|
let children;
|
|
32
32
|
let className;
|
|
33
33
|
let opts;
|
|
@@ -111,8 +111,19 @@ function Carousel(t0) {
|
|
|
111
111
|
}
|
|
112
112
|
const scrollNext = t6;
|
|
113
113
|
let t7;
|
|
114
|
-
if ($[18] !==
|
|
114
|
+
if ($[18] !== api || $[19] !== orientation || $[20] !== scrollNext || $[21] !== scrollPrev || $[22] !== shouldReduceMotion) {
|
|
115
115
|
t7 = (event) => {
|
|
116
|
+
if (event.altKey || event.ctrlKey || event.metaKey) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const keyboardOwner = event.target instanceof Element ? event.target.closest(CAROUSEL_OWN_KEYBOARD_SELECTOR) : null;
|
|
120
|
+
if (keyboardOwner && event.currentTarget.contains(keyboardOwner)) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const closestCarousel = event.target instanceof Element ? event.target.closest(CAROUSEL_ROOT_SELECTOR) : null;
|
|
124
|
+
if (closestCarousel && closestCarousel !== event.currentTarget) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
116
127
|
const keys = CAROUSEL_KEYS[orientation];
|
|
117
128
|
if (event.key === keys.previous) {
|
|
118
129
|
event.preventDefault();
|
|
@@ -121,20 +132,32 @@ function Carousel(t0) {
|
|
|
121
132
|
if (event.key === keys.next) {
|
|
122
133
|
event.preventDefault();
|
|
123
134
|
scrollNext();
|
|
135
|
+
} else {
|
|
136
|
+
if (api && event.key === CAROUSEL_EDGE_KEYS.first) {
|
|
137
|
+
event.preventDefault();
|
|
138
|
+
api.scrollTo(0, shouldReduceMotion);
|
|
139
|
+
} else {
|
|
140
|
+
if (api && event.key === CAROUSEL_EDGE_KEYS.last) {
|
|
141
|
+
event.preventDefault();
|
|
142
|
+
api.scrollTo(api.scrollSnapList().length - 1, shouldReduceMotion);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
124
145
|
}
|
|
125
146
|
}
|
|
126
147
|
};
|
|
127
|
-
$[18] =
|
|
128
|
-
$[19] =
|
|
129
|
-
$[20] =
|
|
130
|
-
$[21] =
|
|
148
|
+
$[18] = api;
|
|
149
|
+
$[19] = orientation;
|
|
150
|
+
$[20] = scrollNext;
|
|
151
|
+
$[21] = scrollPrev;
|
|
152
|
+
$[22] = shouldReduceMotion;
|
|
153
|
+
$[23] = t7;
|
|
131
154
|
} else {
|
|
132
|
-
t7 = $[
|
|
155
|
+
t7 = $[23];
|
|
133
156
|
}
|
|
134
157
|
const handleKeyDown = t7;
|
|
135
158
|
let t8;
|
|
136
159
|
let t9;
|
|
137
|
-
if ($[
|
|
160
|
+
if ($[24] !== api || $[25] !== setApi) {
|
|
138
161
|
t8 = () => {
|
|
139
162
|
if (!api || !setApi) {
|
|
140
163
|
return;
|
|
@@ -142,18 +165,18 @@ function Carousel(t0) {
|
|
|
142
165
|
setApi(api);
|
|
143
166
|
};
|
|
144
167
|
t9 = [api, setApi];
|
|
145
|
-
$[
|
|
146
|
-
$[
|
|
147
|
-
$[
|
|
148
|
-
$[
|
|
168
|
+
$[24] = api;
|
|
169
|
+
$[25] = setApi;
|
|
170
|
+
$[26] = t8;
|
|
171
|
+
$[27] = t9;
|
|
149
172
|
} else {
|
|
150
|
-
t8 = $[
|
|
151
|
-
t9 = $[
|
|
173
|
+
t8 = $[26];
|
|
174
|
+
t9 = $[27];
|
|
152
175
|
}
|
|
153
176
|
React.useEffect(t8, t9);
|
|
154
177
|
let t10;
|
|
155
178
|
let t11;
|
|
156
|
-
if ($[
|
|
179
|
+
if ($[28] !== api) {
|
|
157
180
|
t10 = () => {
|
|
158
181
|
if (!api) {
|
|
159
182
|
return;
|
|
@@ -173,17 +196,17 @@ function Carousel(t0) {
|
|
|
173
196
|
};
|
|
174
197
|
};
|
|
175
198
|
t11 = [api, onSelect];
|
|
176
|
-
$[
|
|
177
|
-
$[
|
|
178
|
-
$[
|
|
199
|
+
$[28] = api;
|
|
200
|
+
$[29] = t10;
|
|
201
|
+
$[30] = t11;
|
|
179
202
|
} else {
|
|
180
|
-
t10 = $[
|
|
181
|
-
t11 = $[
|
|
203
|
+
t10 = $[29];
|
|
204
|
+
t11 = $[30];
|
|
182
205
|
}
|
|
183
206
|
React.useEffect(t10, t11);
|
|
184
207
|
const t12 = orientation || (opts?.axis === "y" ? "vertical" : "horizontal");
|
|
185
208
|
let t13;
|
|
186
|
-
if ($[
|
|
209
|
+
if ($[31] !== api || $[32] !== canScrollNext || $[33] !== canScrollPrev || $[34] !== carouselRef || $[35] !== opts || $[36] !== scrollNext || $[37] !== scrollPrev || $[38] !== t12) {
|
|
187
210
|
t13 = {
|
|
188
211
|
carouselRef,
|
|
189
212
|
api,
|
|
@@ -194,28 +217,28 @@ function Carousel(t0) {
|
|
|
194
217
|
canScrollPrev,
|
|
195
218
|
canScrollNext
|
|
196
219
|
};
|
|
197
|
-
$[
|
|
198
|
-
$[
|
|
199
|
-
$[
|
|
200
|
-
$[
|
|
201
|
-
$[
|
|
202
|
-
$[
|
|
203
|
-
$[
|
|
204
|
-
$[
|
|
205
|
-
$[
|
|
206
|
-
} else {
|
|
207
|
-
t13 = $[
|
|
220
|
+
$[31] = api;
|
|
221
|
+
$[32] = canScrollNext;
|
|
222
|
+
$[33] = canScrollPrev;
|
|
223
|
+
$[34] = carouselRef;
|
|
224
|
+
$[35] = opts;
|
|
225
|
+
$[36] = scrollNext;
|
|
226
|
+
$[37] = scrollPrev;
|
|
227
|
+
$[38] = t12;
|
|
228
|
+
$[39] = t13;
|
|
229
|
+
} else {
|
|
230
|
+
t13 = $[39];
|
|
208
231
|
}
|
|
209
232
|
let t14;
|
|
210
|
-
if ($[
|
|
233
|
+
if ($[40] !== className) {
|
|
211
234
|
t14 = cn("relative", className);
|
|
212
|
-
$[
|
|
213
|
-
$[
|
|
235
|
+
$[40] = className;
|
|
236
|
+
$[41] = t14;
|
|
214
237
|
} else {
|
|
215
|
-
t14 = $[
|
|
238
|
+
t14 = $[41];
|
|
216
239
|
}
|
|
217
240
|
let t15;
|
|
218
|
-
if ($[
|
|
241
|
+
if ($[42] !== children || $[43] !== handleKeyDown || $[44] !== props || $[45] !== t14) {
|
|
219
242
|
t15 = /* @__PURE__ */ _jsx("div", {
|
|
220
243
|
onKeyDownCapture: handleKeyDown,
|
|
221
244
|
className: t14,
|
|
@@ -225,30 +248,34 @@ function Carousel(t0) {
|
|
|
225
248
|
...props,
|
|
226
249
|
children
|
|
227
250
|
});
|
|
228
|
-
$[
|
|
229
|
-
$[
|
|
230
|
-
$[
|
|
231
|
-
$[
|
|
232
|
-
$[
|
|
251
|
+
$[42] = children;
|
|
252
|
+
$[43] = handleKeyDown;
|
|
253
|
+
$[44] = props;
|
|
254
|
+
$[45] = t14;
|
|
255
|
+
$[46] = t15;
|
|
233
256
|
} else {
|
|
234
|
-
t15 = $[
|
|
257
|
+
t15 = $[46];
|
|
235
258
|
}
|
|
236
259
|
let t16;
|
|
237
|
-
if ($[
|
|
260
|
+
if ($[47] !== t13 || $[48] !== t15) {
|
|
238
261
|
t16 = /* @__PURE__ */ _jsx(CarouselContext.Provider, {
|
|
239
262
|
value: t13,
|
|
240
263
|
children: t15
|
|
241
264
|
});
|
|
242
|
-
$[
|
|
243
|
-
$[
|
|
244
|
-
$[
|
|
265
|
+
$[47] = t13;
|
|
266
|
+
$[48] = t15;
|
|
267
|
+
$[49] = t16;
|
|
245
268
|
} else {
|
|
246
|
-
t16 = $[
|
|
269
|
+
t16 = $[49];
|
|
247
270
|
}
|
|
248
271
|
return t16;
|
|
249
272
|
}
|
|
273
|
+
/**
|
|
274
|
+
* The clipped viewport and the slide track. While the track can be dragged it shows Arc's grab cursor on fine
|
|
275
|
+
* pointers, and a grabbing cursor while a drag is held.
|
|
276
|
+
*/
|
|
250
277
|
function CarouselContent(t0) {
|
|
251
|
-
const $ = _c(
|
|
278
|
+
const $ = _c(19);
|
|
252
279
|
let className;
|
|
253
280
|
let props;
|
|
254
281
|
if ($[0] !== t0) {
|
|
@@ -260,44 +287,84 @@ function CarouselContent(t0) {
|
|
|
260
287
|
className = $[1];
|
|
261
288
|
props = $[2];
|
|
262
289
|
}
|
|
263
|
-
const { carouselRef, orientation } = useCarousel();
|
|
264
|
-
const
|
|
290
|
+
const { carouselRef, api, opts, orientation, canScrollPrev, canScrollNext } = useCarousel();
|
|
291
|
+
const [isDragging, setIsDragging] = React.useState(false);
|
|
292
|
+
const isDraggable = opts?.watchDrag !== false && (canScrollPrev || canScrollNext);
|
|
293
|
+
let t1;
|
|
265
294
|
let t2;
|
|
266
|
-
if ($[3] !==
|
|
267
|
-
|
|
268
|
-
|
|
295
|
+
if ($[3] !== api) {
|
|
296
|
+
t1 = () => {
|
|
297
|
+
if (!api) {
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
const handlePointerDown = () => setIsDragging(true);
|
|
301
|
+
const handlePointerUp = () => setIsDragging(false);
|
|
302
|
+
api.on("pointerDown", handlePointerDown);
|
|
303
|
+
api.on("pointerUp", handlePointerUp);
|
|
304
|
+
return () => {
|
|
305
|
+
api.off("pointerDown", handlePointerDown);
|
|
306
|
+
api.off("pointerUp", handlePointerUp);
|
|
307
|
+
};
|
|
308
|
+
};
|
|
309
|
+
t2 = [api];
|
|
310
|
+
$[3] = api;
|
|
269
311
|
$[4] = t1;
|
|
270
312
|
$[5] = t2;
|
|
271
313
|
} else {
|
|
314
|
+
t1 = $[4];
|
|
272
315
|
t2 = $[5];
|
|
273
316
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
317
|
+
React.useEffect(t1, t2);
|
|
318
|
+
const t3 = isDraggable && "pointer-fine:cursor-grab pointer-fine:data-dragging:cursor-grabbing";
|
|
319
|
+
let t4;
|
|
320
|
+
if ($[6] !== t3) {
|
|
321
|
+
t4 = cn("overflow-hidden", t3);
|
|
322
|
+
$[6] = t3;
|
|
323
|
+
$[7] = t4;
|
|
324
|
+
} else {
|
|
325
|
+
t4 = $[7];
|
|
326
|
+
}
|
|
327
|
+
const t5 = isDraggable && isDragging || undefined;
|
|
328
|
+
const t6 = orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col";
|
|
329
|
+
let t7;
|
|
330
|
+
if ($[8] !== className || $[9] !== t6) {
|
|
331
|
+
t7 = cn("flex", t6, className);
|
|
332
|
+
$[8] = className;
|
|
333
|
+
$[9] = t6;
|
|
334
|
+
$[10] = t7;
|
|
335
|
+
} else {
|
|
336
|
+
t7 = $[10];
|
|
337
|
+
}
|
|
338
|
+
let t8;
|
|
339
|
+
if ($[11] !== props || $[12] !== t7) {
|
|
340
|
+
t8 = /* @__PURE__ */ _jsx("div", {
|
|
341
|
+
className: t7,
|
|
278
342
|
...props
|
|
279
343
|
});
|
|
280
|
-
$[
|
|
281
|
-
$[
|
|
282
|
-
$[
|
|
344
|
+
$[11] = props;
|
|
345
|
+
$[12] = t7;
|
|
346
|
+
$[13] = t8;
|
|
283
347
|
} else {
|
|
284
|
-
|
|
348
|
+
t8 = $[13];
|
|
285
349
|
}
|
|
286
|
-
let
|
|
287
|
-
if ($[
|
|
288
|
-
|
|
350
|
+
let t9;
|
|
351
|
+
if ($[14] !== carouselRef || $[15] !== t4 || $[16] !== t5 || $[17] !== t8) {
|
|
352
|
+
t9 = /* @__PURE__ */ _jsx("div", {
|
|
289
353
|
ref: carouselRef,
|
|
290
|
-
className:
|
|
354
|
+
className: t4,
|
|
291
355
|
"data-slot": "carousel-content",
|
|
292
|
-
|
|
356
|
+
"data-dragging": t5,
|
|
357
|
+
children: t8
|
|
293
358
|
});
|
|
294
|
-
$[
|
|
295
|
-
$[
|
|
296
|
-
$[
|
|
359
|
+
$[14] = carouselRef;
|
|
360
|
+
$[15] = t4;
|
|
361
|
+
$[16] = t5;
|
|
362
|
+
$[17] = t8;
|
|
363
|
+
$[18] = t9;
|
|
297
364
|
} else {
|
|
298
|
-
|
|
365
|
+
t9 = $[18];
|
|
299
366
|
}
|
|
300
|
-
return
|
|
367
|
+
return t9;
|
|
301
368
|
}
|
|
302
369
|
function CarouselItem(t0) {
|
|
303
370
|
const $ = _c(9);
|
|
@@ -360,12 +427,12 @@ function CarouselPrevious(t0) {
|
|
|
360
427
|
t2 = $[4];
|
|
361
428
|
}
|
|
362
429
|
const variant = t1 === undefined ? "outline" : t1;
|
|
363
|
-
const size = t2 === undefined ? "icon-
|
|
430
|
+
const size = t2 === undefined ? "icon-lg" : t2;
|
|
364
431
|
const { orientation, scrollPrev, canScrollPrev } = useCarousel();
|
|
365
432
|
const t3 = orientation === "horizontal" ? "top-1/2 -left-12 -translate-y-1/2" : "-top-12 left-1/2 -translate-x-1/2 rotate-90";
|
|
366
433
|
let t4;
|
|
367
434
|
if ($[5] !== className || $[6] !== t3) {
|
|
368
|
-
t4 = cn(
|
|
435
|
+
t4 = cn(carouselControlClassName, t3, className);
|
|
369
436
|
$[5] = className;
|
|
370
437
|
$[6] = t3;
|
|
371
438
|
$[7] = t4;
|
|
@@ -376,7 +443,7 @@ function CarouselPrevious(t0) {
|
|
|
376
443
|
let t6;
|
|
377
444
|
let t7;
|
|
378
445
|
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
379
|
-
t6 = /* @__PURE__ */ _jsx(ChevronLeftIcon, {});
|
|
446
|
+
t6 = /* @__PURE__ */ _jsx(ChevronLeftIcon, { strokeWidth: 1.75 });
|
|
380
447
|
t7 = /* @__PURE__ */ _jsx("span", {
|
|
381
448
|
className: "sr-only",
|
|
382
449
|
children: "Previous slide"
|
|
@@ -431,12 +498,12 @@ function CarouselNext(t0) {
|
|
|
431
498
|
t2 = $[4];
|
|
432
499
|
}
|
|
433
500
|
const variant = t1 === undefined ? "outline" : t1;
|
|
434
|
-
const size = t2 === undefined ? "icon-
|
|
501
|
+
const size = t2 === undefined ? "icon-lg" : t2;
|
|
435
502
|
const { orientation, scrollNext, canScrollNext } = useCarousel();
|
|
436
503
|
const t3 = orientation === "horizontal" ? "top-1/2 -right-12 -translate-y-1/2" : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90";
|
|
437
504
|
let t4;
|
|
438
505
|
if ($[5] !== className || $[6] !== t3) {
|
|
439
|
-
t4 = cn(
|
|
506
|
+
t4 = cn(carouselControlClassName, t3, className);
|
|
440
507
|
$[5] = className;
|
|
441
508
|
$[6] = t3;
|
|
442
509
|
$[7] = t4;
|
|
@@ -447,7 +514,7 @@ function CarouselNext(t0) {
|
|
|
447
514
|
let t6;
|
|
448
515
|
let t7;
|
|
449
516
|
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
450
|
-
t6 = /* @__PURE__ */ _jsx(ChevronRightIcon, {});
|
|
517
|
+
t6 = /* @__PURE__ */ _jsx(ChevronRightIcon, { strokeWidth: 1.75 });
|
|
451
518
|
t7 = /* @__PURE__ */ _jsx("span", {
|
|
452
519
|
className: "sr-only",
|
|
453
520
|
children: "Next slide"
|
|
@@ -482,4 +549,318 @@ function CarouselNext(t0) {
|
|
|
482
549
|
}
|
|
483
550
|
return t8;
|
|
484
551
|
}
|
|
485
|
-
|
|
552
|
+
/**
|
|
553
|
+
* Default accessible name of one indicator, for example "Diapositiva 2 de 5".
|
|
554
|
+
* @param index - Zero-based slide position.
|
|
555
|
+
* @param count - Number of slides.
|
|
556
|
+
* @returns The Spanish slide label.
|
|
557
|
+
*/
|
|
558
|
+
function defaultCarouselSlideLabel(index, count) {
|
|
559
|
+
return `${CAROUSEL_COPY.slideLabelPrefix} ${index + 1} ${CAROUSEL_COPY.slideLabelSeparator} ${count}`;
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* Continuous slide position, in slides, of a scroll progress between Embla's snap points. Snaps are progress values,
|
|
563
|
+
* so trimmed edges and slides of different sizes still map to whole slides at rest.
|
|
564
|
+
* @param progress - Embla's scroll progress, from 0 to 1.
|
|
565
|
+
* @param snaps - Embla's snap points, as scroll progress values.
|
|
566
|
+
* @returns The fractional index of the slide in view.
|
|
567
|
+
*/
|
|
568
|
+
function toSlidePosition(progress, snaps) {
|
|
569
|
+
const lastIndex = snaps.length - 1;
|
|
570
|
+
if (lastIndex < 1) return 0;
|
|
571
|
+
const first = snaps[0] ?? 0;
|
|
572
|
+
const last = snaps[lastIndex] ?? 1;
|
|
573
|
+
if (progress <= first) return 0;
|
|
574
|
+
if (progress >= last) return lastIndex;
|
|
575
|
+
for (let index = 0; index < lastIndex; index += 1) {
|
|
576
|
+
const start = snaps[index] ?? 0;
|
|
577
|
+
const end = snaps[index + 1] ?? 1;
|
|
578
|
+
if (progress <= end) return end > start ? index + (progress - start) / (end - start) : index;
|
|
579
|
+
}
|
|
580
|
+
return lastIndex;
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Arc's page indicator for a carousel: one dot per snap point, where the current one stretches into a pill that
|
|
584
|
+
* follows the track frame by frame while it is dragged or scrolled. The dots are buttons in a named group and the
|
|
585
|
+
* current one carries `aria-current`; activating a dot scrolls to its slide, and when a dot has focus the carousel's
|
|
586
|
+
* arrow, Home and End keys move the focus to the dot of the new slide. It renders
|
|
587
|
+
* once Embla has measured the slides. Place it inside `Carousel`.
|
|
588
|
+
* @param props - Optional accessible copy plus native attributes of the list.
|
|
589
|
+
* @returns The indicator list, or nothing until there is more than one snap point.
|
|
590
|
+
*/
|
|
591
|
+
function CarouselIndicators(t0) {
|
|
592
|
+
const $ = _c(28);
|
|
593
|
+
let className;
|
|
594
|
+
let props;
|
|
595
|
+
let t1;
|
|
596
|
+
let t2;
|
|
597
|
+
if ($[0] !== t0) {
|
|
598
|
+
({className, label: t1, slideLabel: t2, ...props} = t0);
|
|
599
|
+
$[0] = t0;
|
|
600
|
+
$[1] = className;
|
|
601
|
+
$[2] = props;
|
|
602
|
+
$[3] = t1;
|
|
603
|
+
$[4] = t2;
|
|
604
|
+
} else {
|
|
605
|
+
className = $[1];
|
|
606
|
+
props = $[2];
|
|
607
|
+
t1 = $[3];
|
|
608
|
+
t2 = $[4];
|
|
609
|
+
}
|
|
610
|
+
const label = t1 === undefined ? CAROUSEL_COPY.indicatorsLabel : t1;
|
|
611
|
+
const slideLabel = t2 === undefined ? defaultCarouselSlideLabel : t2;
|
|
612
|
+
const { api, orientation } = useCarousel();
|
|
613
|
+
const reduceMotion = usePrefersReducedMotion();
|
|
614
|
+
const [snapCount, setSnapCount] = React.useState(0);
|
|
615
|
+
const [selectedIndex, setSelectedIndex] = React.useState(0);
|
|
616
|
+
const [isLooping, setIsLooping] = React.useState(false);
|
|
617
|
+
const position = useMotionValue(0);
|
|
618
|
+
let t3;
|
|
619
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
620
|
+
t3 = [];
|
|
621
|
+
$[5] = t3;
|
|
622
|
+
} else {
|
|
623
|
+
t3 = $[5];
|
|
624
|
+
}
|
|
625
|
+
const indicatorRefs = React.useRef(t3);
|
|
626
|
+
let t4;
|
|
627
|
+
let t5;
|
|
628
|
+
if ($[6] !== api || $[7] !== position || $[8] !== reduceMotion) {
|
|
629
|
+
t4 = () => {
|
|
630
|
+
if (!api) {
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
633
|
+
let positionAnimation = null;
|
|
634
|
+
const isLoop = () => api.internalEngine().options.loop;
|
|
635
|
+
const trackScroll = () => {
|
|
636
|
+
if (isLoop()) {
|
|
637
|
+
return;
|
|
638
|
+
}
|
|
639
|
+
positionAnimation?.stop();
|
|
640
|
+
position.set(toSlidePosition(api.scrollProgress(), api.scrollSnapList()));
|
|
641
|
+
};
|
|
642
|
+
const syncSelection = () => {
|
|
643
|
+
const nextIndex = api.selectedScrollSnap();
|
|
644
|
+
const count = api.scrollSnapList().length;
|
|
645
|
+
setSnapCount(count);
|
|
646
|
+
setSelectedIndex(nextIndex);
|
|
647
|
+
setIsLooping(isLoop());
|
|
648
|
+
if (isLoop()) {
|
|
649
|
+
positionAnimation?.stop();
|
|
650
|
+
const turns = Math.round((position.get() - nextIndex) / count);
|
|
651
|
+
const destination = nextIndex + turns * count;
|
|
652
|
+
positionAnimation = reduceMotion ? null : animate(position, destination, {
|
|
653
|
+
...ARC_SPRING_SMOOTH,
|
|
654
|
+
onComplete: () => position.jump(nextIndex)
|
|
655
|
+
});
|
|
656
|
+
if (reduceMotion) {
|
|
657
|
+
position.set(nextIndex);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
if (indicatorRefs.current.some(_temp)) {
|
|
661
|
+
indicatorRefs.current[nextIndex]?.focus({ preventScroll: true });
|
|
662
|
+
}
|
|
663
|
+
};
|
|
664
|
+
const syncAll = () => {
|
|
665
|
+
syncSelection();
|
|
666
|
+
if (isLoop()) {
|
|
667
|
+
positionAnimation?.stop();
|
|
668
|
+
position.set(api.selectedScrollSnap());
|
|
669
|
+
} else {
|
|
670
|
+
trackScroll();
|
|
671
|
+
}
|
|
672
|
+
};
|
|
673
|
+
syncAll();
|
|
674
|
+
api.on("reInit", syncAll);
|
|
675
|
+
api.on("select", syncSelection);
|
|
676
|
+
api.on("scroll", trackScroll);
|
|
677
|
+
return () => {
|
|
678
|
+
positionAnimation?.stop();
|
|
679
|
+
api.off("reInit", syncAll);
|
|
680
|
+
api.off("select", syncSelection);
|
|
681
|
+
api.off("scroll", trackScroll);
|
|
682
|
+
};
|
|
683
|
+
};
|
|
684
|
+
t5 = [
|
|
685
|
+
api,
|
|
686
|
+
position,
|
|
687
|
+
reduceMotion
|
|
688
|
+
];
|
|
689
|
+
$[6] = api;
|
|
690
|
+
$[7] = position;
|
|
691
|
+
$[8] = reduceMotion;
|
|
692
|
+
$[9] = t4;
|
|
693
|
+
$[10] = t5;
|
|
694
|
+
} else {
|
|
695
|
+
t4 = $[9];
|
|
696
|
+
t5 = $[10];
|
|
697
|
+
}
|
|
698
|
+
React.useEffect(t4, t5);
|
|
699
|
+
if (snapCount < 2) {
|
|
700
|
+
return null;
|
|
701
|
+
}
|
|
702
|
+
const t6 = orientation === "vertical" && "flex-col";
|
|
703
|
+
let t7;
|
|
704
|
+
if ($[11] !== className || $[12] !== t6) {
|
|
705
|
+
t7 = cn("flex min-w-0 items-center justify-center", t6, className);
|
|
706
|
+
$[11] = className;
|
|
707
|
+
$[12] = t6;
|
|
708
|
+
$[13] = t7;
|
|
709
|
+
} else {
|
|
710
|
+
t7 = $[13];
|
|
711
|
+
}
|
|
712
|
+
let t8;
|
|
713
|
+
if ($[14] !== api || $[15] !== isLooping || $[16] !== orientation || $[17] !== position || $[18] !== reduceMotion || $[19] !== selectedIndex || $[20] !== slideLabel || $[21] !== snapCount) {
|
|
714
|
+
t8 = Array.from({ length: snapCount }, (_, index) => /* @__PURE__ */ _jsx(CarouselIndicator, {
|
|
715
|
+
index,
|
|
716
|
+
lastIndex: snapCount - 1,
|
|
717
|
+
isLooping,
|
|
718
|
+
position,
|
|
719
|
+
isSelected: index === selectedIndex,
|
|
720
|
+
orientation: orientation ?? "horizontal",
|
|
721
|
+
label: slideLabel(index, snapCount),
|
|
722
|
+
indicatorRef: (node) => {
|
|
723
|
+
indicatorRefs.current[index] = node;
|
|
724
|
+
},
|
|
725
|
+
onSelect: () => api?.scrollTo(index, reduceMotion)
|
|
726
|
+
}, index));
|
|
727
|
+
$[14] = api;
|
|
728
|
+
$[15] = isLooping;
|
|
729
|
+
$[16] = orientation;
|
|
730
|
+
$[17] = position;
|
|
731
|
+
$[18] = reduceMotion;
|
|
732
|
+
$[19] = selectedIndex;
|
|
733
|
+
$[20] = slideLabel;
|
|
734
|
+
$[21] = snapCount;
|
|
735
|
+
$[22] = t8;
|
|
736
|
+
} else {
|
|
737
|
+
t8 = $[22];
|
|
738
|
+
}
|
|
739
|
+
let t9;
|
|
740
|
+
if ($[23] !== label || $[24] !== props || $[25] !== t7 || $[26] !== t8) {
|
|
741
|
+
t9 = /* @__PURE__ */ _jsx("div", {
|
|
742
|
+
role: "group",
|
|
743
|
+
"aria-label": label,
|
|
744
|
+
"data-slot": "carousel-indicators",
|
|
745
|
+
className: t7,
|
|
746
|
+
...props,
|
|
747
|
+
children: t8
|
|
748
|
+
});
|
|
749
|
+
$[23] = label;
|
|
750
|
+
$[24] = props;
|
|
751
|
+
$[25] = t7;
|
|
752
|
+
$[26] = t8;
|
|
753
|
+
$[27] = t9;
|
|
754
|
+
} else {
|
|
755
|
+
t9 = $[27];
|
|
756
|
+
}
|
|
757
|
+
return t9;
|
|
758
|
+
}
|
|
759
|
+
function _temp(indicator) {
|
|
760
|
+
return indicator !== null && indicator === document.activeElement;
|
|
761
|
+
}
|
|
762
|
+
/** One dot that grows toward the pill as the track nears its slide, so the pill hands over continuously. */
|
|
763
|
+
function CarouselIndicator(t0) {
|
|
764
|
+
const $ = _c(24);
|
|
765
|
+
const { index, lastIndex, isLooping, position, isSelected, orientation, label, indicatorRef, onSelect } = t0;
|
|
766
|
+
let t1;
|
|
767
|
+
if ($[0] !== index || $[1] !== isLooping || $[2] !== lastIndex) {
|
|
768
|
+
t1 = (value) => {
|
|
769
|
+
if (!isLooping) {
|
|
770
|
+
return Math.max(0, 1 - Math.abs(Math.min(lastIndex, Math.max(0, value)) - index));
|
|
771
|
+
}
|
|
772
|
+
const count = lastIndex + 1;
|
|
773
|
+
const distance = Math.abs(value - index) % count;
|
|
774
|
+
return Math.max(0, 1 - Math.min(distance, count - distance));
|
|
775
|
+
};
|
|
776
|
+
$[0] = index;
|
|
777
|
+
$[1] = isLooping;
|
|
778
|
+
$[2] = lastIndex;
|
|
779
|
+
$[3] = t1;
|
|
780
|
+
} else {
|
|
781
|
+
t1 = $[3];
|
|
782
|
+
}
|
|
783
|
+
const emphasis = useTransform(position, t1);
|
|
784
|
+
const length = useTransform(emphasis, _temp2);
|
|
785
|
+
const t2 = isSelected || undefined;
|
|
786
|
+
const t3 = orientation === "horizontal" ? "h-(--control-height-sm) px-[5px]" : "w-(--control-height-sm) py-[5px]";
|
|
787
|
+
let t4;
|
|
788
|
+
if ($[4] !== t3) {
|
|
789
|
+
t4 = cn("group/indicator grid shrink-0 cursor-pointer place-items-center rounded-full border-0 bg-transparent p-0 outline-none [-webkit-tap-highlight-color:transparent] focus-visible:ring-3 focus-visible:ring-ring/50", t3);
|
|
790
|
+
$[4] = t3;
|
|
791
|
+
$[5] = t4;
|
|
792
|
+
} else {
|
|
793
|
+
t4 = $[5];
|
|
794
|
+
}
|
|
795
|
+
const t5 = orientation === "horizontal" ? "h-1.5" : "w-1.5";
|
|
796
|
+
let t6;
|
|
797
|
+
if ($[6] !== t5) {
|
|
798
|
+
t6 = cn("relative block overflow-hidden rounded-full bg-border-strong transition-colors duration-(--duration-fast) ease-(--ease-standard) motion-reduce:transition-none group-hover/indicator:bg-text-muted", t5);
|
|
799
|
+
$[6] = t5;
|
|
800
|
+
$[7] = t6;
|
|
801
|
+
} else {
|
|
802
|
+
t6 = $[7];
|
|
803
|
+
}
|
|
804
|
+
let t7;
|
|
805
|
+
if ($[8] !== length || $[9] !== orientation) {
|
|
806
|
+
t7 = orientation === "horizontal" ? { width: length } : { height: length };
|
|
807
|
+
$[8] = length;
|
|
808
|
+
$[9] = orientation;
|
|
809
|
+
$[10] = t7;
|
|
810
|
+
} else {
|
|
811
|
+
t7 = $[10];
|
|
812
|
+
}
|
|
813
|
+
let t8;
|
|
814
|
+
if ($[11] !== emphasis) {
|
|
815
|
+
t8 = /* @__PURE__ */ _jsx(motion.span, {
|
|
816
|
+
className: "absolute inset-0 bg-foreground",
|
|
817
|
+
style: { opacity: emphasis }
|
|
818
|
+
});
|
|
819
|
+
$[11] = emphasis;
|
|
820
|
+
$[12] = t8;
|
|
821
|
+
} else {
|
|
822
|
+
t8 = $[12];
|
|
823
|
+
}
|
|
824
|
+
let t9;
|
|
825
|
+
if ($[13] !== t6 || $[14] !== t7 || $[15] !== t8) {
|
|
826
|
+
t9 = /* @__PURE__ */ _jsx(motion.span, {
|
|
827
|
+
"aria-hidden": "true",
|
|
828
|
+
className: t6,
|
|
829
|
+
style: t7,
|
|
830
|
+
children: t8
|
|
831
|
+
});
|
|
832
|
+
$[13] = t6;
|
|
833
|
+
$[14] = t7;
|
|
834
|
+
$[15] = t8;
|
|
835
|
+
$[16] = t9;
|
|
836
|
+
} else {
|
|
837
|
+
t9 = $[16];
|
|
838
|
+
}
|
|
839
|
+
let t10;
|
|
840
|
+
if ($[17] !== indicatorRef || $[18] !== label || $[19] !== onSelect || $[20] !== t2 || $[21] !== t4 || $[22] !== t9) {
|
|
841
|
+
t10 = /* @__PURE__ */ _jsx("button", {
|
|
842
|
+
ref: indicatorRef,
|
|
843
|
+
type: "button",
|
|
844
|
+
"aria-current": t2,
|
|
845
|
+
"aria-label": label,
|
|
846
|
+
"data-slot": "carousel-indicator",
|
|
847
|
+
className: t4,
|
|
848
|
+
onClick: onSelect,
|
|
849
|
+
children: t9
|
|
850
|
+
});
|
|
851
|
+
$[17] = indicatorRef;
|
|
852
|
+
$[18] = label;
|
|
853
|
+
$[19] = onSelect;
|
|
854
|
+
$[20] = t2;
|
|
855
|
+
$[21] = t4;
|
|
856
|
+
$[22] = t9;
|
|
857
|
+
$[23] = t10;
|
|
858
|
+
} else {
|
|
859
|
+
t10 = $[23];
|
|
860
|
+
}
|
|
861
|
+
return t10;
|
|
862
|
+
}
|
|
863
|
+
function _temp2(value_0) {
|
|
864
|
+
return CAROUSEL_INDICATOR_LENGTH_PX.dot + (CAROUSEL_INDICATOR_LENGTH_PX.pill - CAROUSEL_INDICATOR_LENGTH_PX.dot) * value_0;
|
|
865
|
+
}
|
|
866
|
+
export { Carousel, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext, CarouselIndicators, useCarousel };
|