@alfadocs/ui-kit 0.24.0 → 0.25.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.
@@ -1,1696 +0,0 @@
1
- import { jsx as j, jsxs as De } from "react/jsx-runtime";
2
- import { useRef as Pe, useState as ne, useCallback as le, useEffect as fe, forwardRef as xe, useId as xt, useMemo as Qe, useImperativeHandle as yt, Children as et, isValidElement as tt, createContext as It, useContext as Ct } from "react";
3
- import { c as nt } from "./index-D2ZczOXr.js";
4
- import { useTranslation as ye } from "react-i18next";
5
- import { I as Je } from "./icon-button-C4CGcYuz.js";
6
- import { C as Lt } from "./chevron-left-CX1jqD2M.js";
7
- import { C as wt } from "./chevron-right-BrpYejk0.js";
8
- function Et(e) {
9
- return Object.prototype.toString.call(e) === "[object Object]";
10
- }
11
- function Xe(e) {
12
- return Et(e) || Array.isArray(e);
13
- }
14
- function Tt() {
15
- return !!(typeof window < "u" && window.document && window.document.createElement);
16
- }
17
- function Me(e, t) {
18
- const n = Object.keys(e), r = Object.keys(t);
19
- if (n.length !== r.length) return !1;
20
- const i = JSON.stringify(Object.keys(e.breakpoints || {})), s = JSON.stringify(Object.keys(t.breakpoints || {}));
21
- return i !== s ? !1 : n.every((o) => {
22
- const u = e[o], c = t[o];
23
- return typeof u == "function" ? `${u}` == `${c}` : !Xe(u) || !Xe(c) ? u === c : Me(u, c);
24
- });
25
- }
26
- function Ye(e) {
27
- return e.concat().sort((t, n) => t.name > n.name ? 1 : -1).map((t) => t.options);
28
- }
29
- function Dt(e, t) {
30
- if (e.length !== t.length) return !1;
31
- const n = Ye(e), r = Ye(t);
32
- return n.every((i, s) => {
33
- const o = r[s];
34
- return Me(i, o);
35
- });
36
- }
37
- function ke(e) {
38
- return typeof e == "number";
39
- }
40
- function Ae(e) {
41
- return typeof e == "string";
42
- }
43
- function Ie(e) {
44
- return typeof e == "boolean";
45
- }
46
- function Ze(e) {
47
- return Object.prototype.toString.call(e) === "[object Object]";
48
- }
49
- function N(e) {
50
- return Math.abs(e);
51
- }
52
- function Oe(e) {
53
- return Math.sign(e);
54
- }
55
- function pe(e, t) {
56
- return N(e - t);
57
- }
58
- function Pt(e, t) {
59
- if (e === 0 || t === 0 || N(e) <= N(t)) return 0;
60
- const n = pe(N(e), N(t));
61
- return N(n / e);
62
- }
63
- function At(e) {
64
- return Math.round(e * 100) / 100;
65
- }
66
- function me(e) {
67
- return ge(e).map(Number);
68
- }
69
- function J(e) {
70
- return e[be(e)];
71
- }
72
- function be(e) {
73
- return Math.max(0, e.length - 1);
74
- }
75
- function Fe(e, t) {
76
- return t === be(e);
77
- }
78
- function We(e, t = 0) {
79
- return Array.from(Array(e), (n, r) => t + r);
80
- }
81
- function ge(e) {
82
- return Object.keys(e);
83
- }
84
- function ot(e, t) {
85
- return [e, t].reduce((n, r) => (ge(r).forEach((i) => {
86
- const s = n[i], o = r[i], u = Ze(s) && Ze(o);
87
- n[i] = u ? ot(s, o) : o;
88
- }), n), {});
89
- }
90
- function Ne(e, t) {
91
- return typeof t.MouseEvent < "u" && e instanceof t.MouseEvent;
92
- }
93
- function Nt(e, t) {
94
- const n = {
95
- start: r,
96
- center: i,
97
- end: s
98
- };
99
- function r() {
100
- return 0;
101
- }
102
- function i(c) {
103
- return s(c) / 2;
104
- }
105
- function s(c) {
106
- return t - c;
107
- }
108
- function o(c, l) {
109
- return Ae(e) ? n[e](c) : e(t, c, l);
110
- }
111
- return {
112
- measure: o
113
- };
114
- }
115
- function he() {
116
- let e = [];
117
- function t(i, s, o, u = {
118
- passive: !0
119
- }) {
120
- let c;
121
- if ("addEventListener" in i)
122
- i.addEventListener(s, o, u), c = () => i.removeEventListener(s, o, u);
123
- else {
124
- const l = i;
125
- l.addListener(o), c = () => l.removeListener(o);
126
- }
127
- return e.push(c), r;
128
- }
129
- function n() {
130
- e = e.filter((i) => i());
131
- }
132
- const r = {
133
- add: t,
134
- clear: n
135
- };
136
- return r;
137
- }
138
- function Mt(e, t, n, r) {
139
- const i = he(), s = 1e3 / 60;
140
- let o = null, u = 0, c = 0;
141
- function l() {
142
- i.add(e, "visibilitychange", () => {
143
- e.hidden && f();
144
- });
145
- }
146
- function b() {
147
- v(), i.clear();
148
- }
149
- function p(h) {
150
- if (!c) return;
151
- o || (o = h, n(), n());
152
- const d = h - o;
153
- for (o = h, u += d; u >= s; )
154
- n(), u -= s;
155
- const a = u / s;
156
- r(a), c && (c = t.requestAnimationFrame(p));
157
- }
158
- function m() {
159
- c || (c = t.requestAnimationFrame(p));
160
- }
161
- function v() {
162
- t.cancelAnimationFrame(c), o = null, u = 0, c = 0;
163
- }
164
- function f() {
165
- o = null, u = 0;
166
- }
167
- return {
168
- init: l,
169
- destroy: b,
170
- start: m,
171
- stop: v,
172
- update: n,
173
- render: r
174
- };
175
- }
176
- function kt(e, t) {
177
- const n = t === "rtl", r = e === "y", i = r ? "y" : "x", s = r ? "x" : "y", o = !r && n ? -1 : 1, u = b(), c = p();
178
- function l(f) {
179
- const {
180
- height: g,
181
- width: h
182
- } = f;
183
- return r ? g : h;
184
- }
185
- function b() {
186
- return r ? "top" : n ? "right" : "left";
187
- }
188
- function p() {
189
- return r ? "bottom" : n ? "left" : "right";
190
- }
191
- function m(f) {
192
- return f * o;
193
- }
194
- return {
195
- scroll: i,
196
- cross: s,
197
- startEdge: u,
198
- endEdge: c,
199
- measureSize: l,
200
- direction: m
201
- };
202
- }
203
- function ce(e = 0, t = 0) {
204
- const n = N(e - t);
205
- function r(l) {
206
- return l < e;
207
- }
208
- function i(l) {
209
- return l > t;
210
- }
211
- function s(l) {
212
- return r(l) || i(l);
213
- }
214
- function o(l) {
215
- return s(l) ? r(l) ? e : t : l;
216
- }
217
- function u(l) {
218
- return n ? l - n * Math.ceil((l - t) / n) : l;
219
- }
220
- return {
221
- length: n,
222
- max: t,
223
- min: e,
224
- constrain: o,
225
- reachedAny: s,
226
- reachedMax: i,
227
- reachedMin: r,
228
- removeOffset: u
229
- };
230
- }
231
- function rt(e, t, n) {
232
- const {
233
- constrain: r
234
- } = ce(0, e), i = e + 1;
235
- let s = o(t);
236
- function o(m) {
237
- return n ? N((i + m) % i) : r(m);
238
- }
239
- function u() {
240
- return s;
241
- }
242
- function c(m) {
243
- return s = o(m), p;
244
- }
245
- function l(m) {
246
- return b().set(u() + m);
247
- }
248
- function b() {
249
- return rt(e, u(), n);
250
- }
251
- const p = {
252
- get: u,
253
- set: c,
254
- add: l,
255
- clone: b
256
- };
257
- return p;
258
- }
259
- function Ot(e, t, n, r, i, s, o, u, c, l, b, p, m, v, f, g, h, d, a) {
260
- const {
261
- cross: S,
262
- direction: C
263
- } = e, L = ["INPUT", "SELECT", "TEXTAREA"], w = {
264
- passive: !1
265
- }, y = he(), I = he(), E = ce(50, 225).constrain(v.measure(20)), P = {
266
- mouse: 300,
267
- touch: 400
268
- }, T = {
269
- mouse: 500,
270
- touch: 600
271
- }, V = f ? 43 : 25;
272
- let M = !1, B = 0, R = 0, q = !1, X = !1, _ = !1, K = !1;
273
- function oe(x) {
274
- if (!a) return;
275
- function D(G) {
276
- (Ie(a) || a(x, G)) && k(G);
277
- }
278
- const z = t;
279
- y.add(z, "dragstart", (G) => G.preventDefault(), w).add(z, "touchmove", () => {
280
- }, w).add(z, "touchend", () => {
281
- }).add(z, "touchstart", D).add(z, "mousedown", D).add(z, "touchcancel", F).add(z, "contextmenu", F).add(z, "click", $, !0);
282
- }
283
- function U() {
284
- y.clear(), I.clear();
285
- }
286
- function W() {
287
- const x = K ? n : t;
288
- I.add(x, "touchmove", O, w).add(x, "touchend", F).add(x, "mousemove", O, w).add(x, "mouseup", F);
289
- }
290
- function ee(x) {
291
- const D = x.nodeName || "";
292
- return L.includes(D);
293
- }
294
- function Q() {
295
- return (f ? T : P)[K ? "mouse" : "touch"];
296
- }
297
- function re(x, D) {
298
- const z = p.add(Oe(x) * -1), G = b.byDistance(x, !f).distance;
299
- return f || N(x) < E ? G : h && D ? G * 0.5 : b.byIndex(z.get(), 0).distance;
300
- }
301
- function k(x) {
302
- const D = Ne(x, r);
303
- K = D, _ = f && D && !x.buttons && M, M = pe(i.get(), o.get()) >= 2, !(D && x.button !== 0) && (ee(x.target) || (q = !0, s.pointerDown(x), l.useFriction(0).useDuration(0), i.set(o), W(), B = s.readPoint(x), R = s.readPoint(x, S), m.emit("pointerDown")));
304
- }
305
- function O(x) {
306
- if (!Ne(x, r) && x.touches.length >= 2) return F(x);
307
- const z = s.readPoint(x), G = s.readPoint(x, S), Y = pe(z, B), Z = pe(G, R);
308
- if (!X && !K && (!x.cancelable || (X = Y > Z, !X)))
309
- return F(x);
310
- const se = s.pointerMove(x);
311
- Y > g && (_ = !0), l.useFriction(0.3).useDuration(0.75), u.start(), i.add(C(se)), x.preventDefault();
312
- }
313
- function F(x) {
314
- const z = b.byDistance(0, !1).index !== p.get(), G = s.pointerUp(x) * Q(), Y = re(C(G), z), Z = Pt(G, Y), se = V - 10 * Z, te = d + Z / 50;
315
- X = !1, q = !1, I.clear(), l.useDuration(se).useFriction(te), c.distance(Y, !f), K = !1, m.emit("pointerUp");
316
- }
317
- function $(x) {
318
- _ && (x.stopPropagation(), x.preventDefault(), _ = !1);
319
- }
320
- function H() {
321
- return q;
322
- }
323
- return {
324
- init: oe,
325
- destroy: U,
326
- pointerDown: H
327
- };
328
- }
329
- function Ft(e, t) {
330
- let r, i;
331
- function s(p) {
332
- return p.timeStamp;
333
- }
334
- function o(p, m) {
335
- const f = `client${(m || e.scroll) === "x" ? "X" : "Y"}`;
336
- return (Ne(p, t) ? p : p.touches[0])[f];
337
- }
338
- function u(p) {
339
- return r = p, i = p, o(p);
340
- }
341
- function c(p) {
342
- const m = o(p) - o(i), v = s(p) - s(r) > 170;
343
- return i = p, v && (r = p), m;
344
- }
345
- function l(p) {
346
- if (!r || !i) return 0;
347
- const m = o(i) - o(r), v = s(p) - s(r), f = s(p) - s(i) > 170, g = m / v;
348
- return v && !f && N(g) > 0.1 ? g : 0;
349
- }
350
- return {
351
- pointerDown: u,
352
- pointerMove: c,
353
- pointerUp: l,
354
- readPoint: o
355
- };
356
- }
357
- function zt() {
358
- function e(n) {
359
- const {
360
- offsetTop: r,
361
- offsetLeft: i,
362
- offsetWidth: s,
363
- offsetHeight: o
364
- } = n;
365
- return {
366
- top: r,
367
- right: i + s,
368
- bottom: r + o,
369
- left: i,
370
- width: s,
371
- height: o
372
- };
373
- }
374
- return {
375
- measure: e
376
- };
377
- }
378
- function jt(e) {
379
- function t(r) {
380
- return e * (r / 100);
381
- }
382
- return {
383
- measure: t
384
- };
385
- }
386
- function Vt(e, t, n, r, i, s, o) {
387
- const u = [e].concat(r);
388
- let c, l, b = [], p = !1;
389
- function m(h) {
390
- return i.measureSize(o.measure(h));
391
- }
392
- function v(h) {
393
- if (!s) return;
394
- l = m(e), b = r.map(m);
395
- function d(a) {
396
- for (const S of a) {
397
- if (p) return;
398
- const C = S.target === e, L = r.indexOf(S.target), w = C ? l : b[L], y = m(C ? e : r[L]);
399
- if (N(y - w) >= 0.5) {
400
- h.reInit(), t.emit("resize");
401
- break;
402
- }
403
- }
404
- }
405
- c = new ResizeObserver((a) => {
406
- (Ie(s) || s(h, a)) && d(a);
407
- }), n.requestAnimationFrame(() => {
408
- u.forEach((a) => c.observe(a));
409
- });
410
- }
411
- function f() {
412
- p = !0, c && c.disconnect();
413
- }
414
- return {
415
- init: v,
416
- destroy: f
417
- };
418
- }
419
- function Bt(e, t, n, r, i, s) {
420
- let o = 0, u = 0, c = i, l = s, b = e.get(), p = 0;
421
- function m() {
422
- const w = r.get() - e.get(), y = !c;
423
- let I = 0;
424
- return y ? (o = 0, n.set(r), e.set(r), I = w) : (n.set(e), o += w / c, o *= l, b += o, e.add(o), I = b - p), u = Oe(I), p = b, L;
425
- }
426
- function v() {
427
- const w = r.get() - t.get();
428
- return N(w) < 1e-3;
429
- }
430
- function f() {
431
- return c;
432
- }
433
- function g() {
434
- return u;
435
- }
436
- function h() {
437
- return o;
438
- }
439
- function d() {
440
- return S(i);
441
- }
442
- function a() {
443
- return C(s);
444
- }
445
- function S(w) {
446
- return c = w, L;
447
- }
448
- function C(w) {
449
- return l = w, L;
450
- }
451
- const L = {
452
- direction: g,
453
- duration: f,
454
- velocity: h,
455
- seek: m,
456
- settled: v,
457
- useBaseFriction: a,
458
- useBaseDuration: d,
459
- useFriction: C,
460
- useDuration: S
461
- };
462
- return L;
463
- }
464
- function Rt(e, t, n, r, i) {
465
- const s = i.measure(10), o = i.measure(50), u = ce(0.1, 0.99);
466
- let c = !1;
467
- function l() {
468
- return !(c || !e.reachedAny(n.get()) || !e.reachedAny(t.get()));
469
- }
470
- function b(v) {
471
- if (!l()) return;
472
- const f = e.reachedMin(t.get()) ? "min" : "max", g = N(e[f] - t.get()), h = n.get() - t.get(), d = u.constrain(g / o);
473
- n.subtract(h * d), !v && N(h) < s && (n.set(e.constrain(n.get())), r.useDuration(25).useBaseFriction());
474
- }
475
- function p(v) {
476
- c = !v;
477
- }
478
- return {
479
- shouldConstrain: l,
480
- constrain: b,
481
- toggleActive: p
482
- };
483
- }
484
- function Ht(e, t, n, r, i) {
485
- const s = ce(-t + e, 0), o = p(), u = b(), c = m();
486
- function l(f, g) {
487
- return pe(f, g) <= 1;
488
- }
489
- function b() {
490
- const f = o[0], g = J(o), h = o.lastIndexOf(f), d = o.indexOf(g) + 1;
491
- return ce(h, d);
492
- }
493
- function p() {
494
- return n.map((f, g) => {
495
- const {
496
- min: h,
497
- max: d
498
- } = s, a = s.constrain(f), S = !g, C = Fe(n, g);
499
- return S ? d : C || l(h, a) ? h : l(d, a) ? d : a;
500
- }).map((f) => parseFloat(f.toFixed(3)));
501
- }
502
- function m() {
503
- if (t <= e + i) return [s.max];
504
- if (r === "keepSnaps") return o;
505
- const {
506
- min: f,
507
- max: g
508
- } = u;
509
- return o.slice(f, g);
510
- }
511
- return {
512
- snapsContained: c,
513
- scrollContainLimit: u
514
- };
515
- }
516
- function Gt(e, t, n) {
517
- const r = t[0], i = n ? r - e : J(t);
518
- return {
519
- limit: ce(i, r)
520
- };
521
- }
522
- function Ut(e, t, n, r) {
523
- const s = t.min + 0.1, o = t.max + 0.1, {
524
- reachedMin: u,
525
- reachedMax: c
526
- } = ce(s, o);
527
- function l(m) {
528
- return m === 1 ? c(n.get()) : m === -1 ? u(n.get()) : !1;
529
- }
530
- function b(m) {
531
- if (!l(m)) return;
532
- const v = e * (m * -1);
533
- r.forEach((f) => f.add(v));
534
- }
535
- return {
536
- loop: b
537
- };
538
- }
539
- function $t(e) {
540
- const {
541
- max: t,
542
- length: n
543
- } = e;
544
- function r(s) {
545
- const o = s - t;
546
- return n ? o / -n : 0;
547
- }
548
- return {
549
- get: r
550
- };
551
- }
552
- function qt(e, t, n, r, i) {
553
- const {
554
- startEdge: s,
555
- endEdge: o
556
- } = e, {
557
- groupSlides: u
558
- } = i, c = p().map(t.measure), l = m(), b = v();
559
- function p() {
560
- return u(r).map((g) => J(g)[o] - g[0][s]).map(N);
561
- }
562
- function m() {
563
- return r.map((g) => n[s] - g[s]).map((g) => -N(g));
564
- }
565
- function v() {
566
- return u(l).map((g) => g[0]).map((g, h) => g + c[h]);
567
- }
568
- return {
569
- snaps: l,
570
- snapsAligned: b
571
- };
572
- }
573
- function _t(e, t, n, r, i, s) {
574
- const {
575
- groupSlides: o
576
- } = i, {
577
- min: u,
578
- max: c
579
- } = r, l = b();
580
- function b() {
581
- const m = o(s), v = !e || t === "keepSnaps";
582
- return n.length === 1 ? [s] : v ? m : m.slice(u, c).map((f, g, h) => {
583
- const d = !g, a = Fe(h, g);
584
- if (d) {
585
- const S = J(h[0]) + 1;
586
- return We(S);
587
- }
588
- if (a) {
589
- const S = be(s) - J(h)[0] + 1;
590
- return We(S, J(h)[0]);
591
- }
592
- return f;
593
- });
594
- }
595
- return {
596
- slideRegistry: l
597
- };
598
- }
599
- function Kt(e, t, n, r, i) {
600
- const {
601
- reachedAny: s,
602
- removeOffset: o,
603
- constrain: u
604
- } = r;
605
- function c(f) {
606
- return f.concat().sort((g, h) => N(g) - N(h))[0];
607
- }
608
- function l(f) {
609
- const g = e ? o(f) : u(f), h = t.map((a, S) => ({
610
- diff: b(a - g, 0),
611
- index: S
612
- })).sort((a, S) => N(a.diff) - N(S.diff)), {
613
- index: d
614
- } = h[0];
615
- return {
616
- index: d,
617
- distance: g
618
- };
619
- }
620
- function b(f, g) {
621
- const h = [f, f + n, f - n];
622
- if (!e) return f;
623
- if (!g) return c(h);
624
- const d = h.filter((a) => Oe(a) === g);
625
- return d.length ? c(d) : J(h) - n;
626
- }
627
- function p(f, g) {
628
- const h = t[f] - i.get(), d = b(h, g);
629
- return {
630
- index: f,
631
- distance: d
632
- };
633
- }
634
- function m(f, g) {
635
- const h = i.get() + f, {
636
- index: d,
637
- distance: a
638
- } = l(h), S = !e && s(h);
639
- if (!g || S) return {
640
- index: d,
641
- distance: f
642
- };
643
- const C = t[d] - a, L = f + b(C, 0);
644
- return {
645
- index: d,
646
- distance: L
647
- };
648
- }
649
- return {
650
- byDistance: m,
651
- byIndex: p,
652
- shortcut: b
653
- };
654
- }
655
- function Qt(e, t, n, r, i, s, o) {
656
- function u(p) {
657
- const m = p.distance, v = p.index !== t.get();
658
- s.add(m), m && (r.duration() ? e.start() : (e.update(), e.render(1), e.update())), v && (n.set(t.get()), t.set(p.index), o.emit("select"));
659
- }
660
- function c(p, m) {
661
- const v = i.byDistance(p, m);
662
- u(v);
663
- }
664
- function l(p, m) {
665
- const v = t.clone().set(p), f = i.byIndex(v.get(), m);
666
- u(f);
667
- }
668
- return {
669
- distance: c,
670
- index: l
671
- };
672
- }
673
- function Jt(e, t, n, r, i, s, o, u) {
674
- const c = {
675
- passive: !0,
676
- capture: !0
677
- };
678
- let l = 0;
679
- function b(v) {
680
- if (!u) return;
681
- function f(g) {
682
- if ((/* @__PURE__ */ new Date()).getTime() - l > 10) return;
683
- o.emit("slideFocusStart"), e.scrollLeft = 0;
684
- const a = n.findIndex((S) => S.includes(g));
685
- ke(a) && (i.useDuration(0), r.index(a, 0), o.emit("slideFocus"));
686
- }
687
- s.add(document, "keydown", p, !1), t.forEach((g, h) => {
688
- s.add(g, "focus", (d) => {
689
- (Ie(u) || u(v, d)) && f(h);
690
- }, c);
691
- });
692
- }
693
- function p(v) {
694
- v.code === "Tab" && (l = (/* @__PURE__ */ new Date()).getTime());
695
- }
696
- return {
697
- init: b
698
- };
699
- }
700
- function de(e) {
701
- let t = e;
702
- function n() {
703
- return t;
704
- }
705
- function r(c) {
706
- t = o(c);
707
- }
708
- function i(c) {
709
- t += o(c);
710
- }
711
- function s(c) {
712
- t -= o(c);
713
- }
714
- function o(c) {
715
- return ke(c) ? c : c.get();
716
- }
717
- return {
718
- get: n,
719
- set: r,
720
- add: i,
721
- subtract: s
722
- };
723
- }
724
- function st(e, t) {
725
- const n = e.scroll === "x" ? o : u, r = t.style;
726
- let i = null, s = !1;
727
- function o(m) {
728
- return `translate3d(${m}px,0px,0px)`;
729
- }
730
- function u(m) {
731
- return `translate3d(0px,${m}px,0px)`;
732
- }
733
- function c(m) {
734
- if (s) return;
735
- const v = At(e.direction(m));
736
- v !== i && (r.transform = n(v), i = v);
737
- }
738
- function l(m) {
739
- s = !m;
740
- }
741
- function b() {
742
- s || (r.transform = "", t.getAttribute("style") || t.removeAttribute("style"));
743
- }
744
- return {
745
- clear: b,
746
- to: c,
747
- toggleActive: l
748
- };
749
- }
750
- function Xt(e, t, n, r, i, s, o, u, c) {
751
- const b = me(i), p = me(i).reverse(), m = d().concat(a());
752
- function v(y, I) {
753
- return y.reduce((E, P) => E - i[P], I);
754
- }
755
- function f(y, I) {
756
- return y.reduce((E, P) => v(E, I) > 0 ? E.concat([P]) : E, []);
757
- }
758
- function g(y) {
759
- return s.map((I, E) => ({
760
- start: I - r[E] + 0.5 + y,
761
- end: I + t - 0.5 + y
762
- }));
763
- }
764
- function h(y, I, E) {
765
- const P = g(I);
766
- return y.map((T) => {
767
- const V = E ? 0 : -n, M = E ? n : 0, B = E ? "end" : "start", R = P[T][B];
768
- return {
769
- index: T,
770
- loopPoint: R,
771
- slideLocation: de(-1),
772
- translate: st(e, c[T]),
773
- target: () => u.get() > R ? V : M
774
- };
775
- });
776
- }
777
- function d() {
778
- const y = o[0], I = f(p, y);
779
- return h(I, n, !1);
780
- }
781
- function a() {
782
- const y = t - o[0] - 1, I = f(b, y);
783
- return h(I, -n, !0);
784
- }
785
- function S() {
786
- return m.every(({
787
- index: y
788
- }) => {
789
- const I = b.filter((E) => E !== y);
790
- return v(I, t) <= 0.1;
791
- });
792
- }
793
- function C() {
794
- m.forEach((y) => {
795
- const {
796
- target: I,
797
- translate: E,
798
- slideLocation: P
799
- } = y, T = I();
800
- T !== P.get() && (E.to(T), P.set(T));
801
- });
802
- }
803
- function L() {
804
- m.forEach((y) => y.translate.clear());
805
- }
806
- return {
807
- canLoop: S,
808
- clear: L,
809
- loop: C,
810
- loopPoints: m
811
- };
812
- }
813
- function Yt(e, t, n) {
814
- let r, i = !1;
815
- function s(c) {
816
- if (!n) return;
817
- function l(b) {
818
- for (const p of b)
819
- if (p.type === "childList") {
820
- c.reInit(), t.emit("slidesChanged");
821
- break;
822
- }
823
- }
824
- r = new MutationObserver((b) => {
825
- i || (Ie(n) || n(c, b)) && l(b);
826
- }), r.observe(e, {
827
- childList: !0
828
- });
829
- }
830
- function o() {
831
- r && r.disconnect(), i = !0;
832
- }
833
- return {
834
- init: s,
835
- destroy: o
836
- };
837
- }
838
- function Zt(e, t, n, r) {
839
- const i = {};
840
- let s = null, o = null, u, c = !1;
841
- function l() {
842
- u = new IntersectionObserver((f) => {
843
- c || (f.forEach((g) => {
844
- const h = t.indexOf(g.target);
845
- i[h] = g;
846
- }), s = null, o = null, n.emit("slidesInView"));
847
- }, {
848
- root: e.parentElement,
849
- threshold: r
850
- }), t.forEach((f) => u.observe(f));
851
- }
852
- function b() {
853
- u && u.disconnect(), c = !0;
854
- }
855
- function p(f) {
856
- return ge(i).reduce((g, h) => {
857
- const d = parseInt(h), {
858
- isIntersecting: a
859
- } = i[d];
860
- return (f && a || !f && !a) && g.push(d), g;
861
- }, []);
862
- }
863
- function m(f = !0) {
864
- if (f && s) return s;
865
- if (!f && o) return o;
866
- const g = p(f);
867
- return f && (s = g), f || (o = g), g;
868
- }
869
- return {
870
- init: l,
871
- destroy: b,
872
- get: m
873
- };
874
- }
875
- function Wt(e, t, n, r, i, s) {
876
- const {
877
- measureSize: o,
878
- startEdge: u,
879
- endEdge: c
880
- } = e, l = n[0] && i, b = f(), p = g(), m = n.map(o), v = h();
881
- function f() {
882
- if (!l) return 0;
883
- const a = n[0];
884
- return N(t[u] - a[u]);
885
- }
886
- function g() {
887
- if (!l) return 0;
888
- const a = s.getComputedStyle(J(r));
889
- return parseFloat(a.getPropertyValue(`margin-${c}`));
890
- }
891
- function h() {
892
- return n.map((a, S, C) => {
893
- const L = !S, w = Fe(C, S);
894
- return L ? m[S] + b : w ? m[S] + p : C[S + 1][u] - a[u];
895
- }).map(N);
896
- }
897
- return {
898
- slideSizes: m,
899
- slideSizesWithGaps: v,
900
- startGap: b,
901
- endGap: p
902
- };
903
- }
904
- function en(e, t, n, r, i, s, o, u, c) {
905
- const {
906
- startEdge: l,
907
- endEdge: b,
908
- direction: p
909
- } = e, m = ke(n);
910
- function v(d, a) {
911
- return me(d).filter((S) => S % a === 0).map((S) => d.slice(S, S + a));
912
- }
913
- function f(d) {
914
- return d.length ? me(d).reduce((a, S, C) => {
915
- const L = J(a) || 0, w = L === 0, y = S === be(d), I = i[l] - s[L][l], E = i[l] - s[S][b], P = !r && w ? p(o) : 0, T = !r && y ? p(u) : 0, V = N(E - T - (I + P));
916
- return C && V > t + c && a.push(S), y && a.push(d.length), a;
917
- }, []).map((a, S, C) => {
918
- const L = Math.max(C[S - 1] || 0);
919
- return d.slice(L, a);
920
- }) : [];
921
- }
922
- function g(d) {
923
- return m ? v(d, n) : f(d);
924
- }
925
- return {
926
- groupSlides: g
927
- };
928
- }
929
- function tn(e, t, n, r, i, s, o) {
930
- const {
931
- align: u,
932
- axis: c,
933
- direction: l,
934
- startIndex: b,
935
- loop: p,
936
- duration: m,
937
- dragFree: v,
938
- dragThreshold: f,
939
- inViewThreshold: g,
940
- slidesToScroll: h,
941
- skipSnaps: d,
942
- containScroll: a,
943
- watchResize: S,
944
- watchSlides: C,
945
- watchDrag: L,
946
- watchFocus: w
947
- } = s, y = 2, I = zt(), E = I.measure(t), P = n.map(I.measure), T = kt(c, l), V = T.measureSize(E), M = jt(V), B = Nt(u, V), R = !p && !!a, q = p || !!a, {
948
- slideSizes: X,
949
- slideSizesWithGaps: _,
950
- startGap: K,
951
- endGap: oe
952
- } = Wt(T, E, P, n, q, i), U = en(T, V, h, p, E, P, K, oe, y), {
953
- snaps: W,
954
- snapsAligned: ee
955
- } = qt(T, B, E, P, U), Q = -J(W) + J(_), {
956
- snapsContained: re,
957
- scrollContainLimit: k
958
- } = Ht(V, Q, ee, a, y), O = R ? re : ee, {
959
- limit: F
960
- } = Gt(Q, O, p), $ = rt(be(O), b, p), H = $.clone(), A = me(n), x = ({
961
- dragHandler: ae,
962
- scrollBody: Ee,
963
- scrollBounds: Te,
964
- options: {
965
- loop: ve
966
- }
967
- }) => {
968
- ve || Te.constrain(ae.pointerDown()), Ee.seek();
969
- }, D = ({
970
- scrollBody: ae,
971
- translate: Ee,
972
- location: Te,
973
- offsetLocation: ve,
974
- previousLocation: ft,
975
- scrollLooper: pt,
976
- slideLooper: mt,
977
- dragHandler: gt,
978
- animation: ht,
979
- eventHandler: Ge,
980
- scrollBounds: bt,
981
- options: {
982
- loop: Ue
983
- }
984
- }, $e) => {
985
- const qe = ae.settled(), vt = !bt.shouldConstrain(), _e = Ue ? qe : qe && vt, Ke = _e && !gt.pointerDown();
986
- Ke && ht.stop();
987
- const St = Te.get() * $e + ft.get() * (1 - $e);
988
- ve.set(St), Ue && (pt.loop(ae.direction()), mt.loop()), Ee.to(ve.get()), Ke && Ge.emit("settle"), _e || Ge.emit("scroll");
989
- }, z = Mt(r, i, () => x(we), (ae) => D(we, ae)), G = 0.68, Y = O[$.get()], Z = de(Y), se = de(Y), te = de(Y), ie = de(Y), ue = Bt(Z, te, se, ie, m, G), Ce = Kt(p, O, Q, F, ie), Le = Qt(z, $, H, ue, Ce, ie, o), Be = $t(F), Re = he(), lt = Zt(t, n, o, g), {
990
- slideRegistry: He
991
- } = _t(R, a, O, k, U, A), dt = Jt(e, n, He, Le, ue, Re, o, w), we = {
992
- ownerDocument: r,
993
- ownerWindow: i,
994
- eventHandler: o,
995
- containerRect: E,
996
- slideRects: P,
997
- animation: z,
998
- axis: T,
999
- dragHandler: Ot(T, e, r, i, ie, Ft(T, i), Z, z, Le, ue, Ce, $, o, M, v, f, d, G, L),
1000
- eventStore: Re,
1001
- percentOfView: M,
1002
- index: $,
1003
- indexPrevious: H,
1004
- limit: F,
1005
- location: Z,
1006
- offsetLocation: te,
1007
- previousLocation: se,
1008
- options: s,
1009
- resizeHandler: Vt(t, o, i, n, T, S, I),
1010
- scrollBody: ue,
1011
- scrollBounds: Rt(F, te, ie, ue, M),
1012
- scrollLooper: Ut(Q, F, te, [Z, te, se, ie]),
1013
- scrollProgress: Be,
1014
- scrollSnapList: O.map(Be.get),
1015
- scrollSnaps: O,
1016
- scrollTarget: Ce,
1017
- scrollTo: Le,
1018
- slideLooper: Xt(T, V, Q, X, _, W, O, te, n),
1019
- slideFocus: dt,
1020
- slidesHandler: Yt(t, o, C),
1021
- slidesInView: lt,
1022
- slideIndexes: A,
1023
- slideRegistry: He,
1024
- slidesToScroll: U,
1025
- target: ie,
1026
- translate: st(T, t)
1027
- };
1028
- return we;
1029
- }
1030
- function nn() {
1031
- let e = {}, t;
1032
- function n(l) {
1033
- t = l;
1034
- }
1035
- function r(l) {
1036
- return e[l] || [];
1037
- }
1038
- function i(l) {
1039
- return r(l).forEach((b) => b(t, l)), c;
1040
- }
1041
- function s(l, b) {
1042
- return e[l] = r(l).concat([b]), c;
1043
- }
1044
- function o(l, b) {
1045
- return e[l] = r(l).filter((p) => p !== b), c;
1046
- }
1047
- function u() {
1048
- e = {};
1049
- }
1050
- const c = {
1051
- init: n,
1052
- emit: i,
1053
- off: o,
1054
- on: s,
1055
- clear: u
1056
- };
1057
- return c;
1058
- }
1059
- const on = {
1060
- align: "center",
1061
- axis: "x",
1062
- container: null,
1063
- slides: null,
1064
- containScroll: "trimSnaps",
1065
- direction: "ltr",
1066
- slidesToScroll: 1,
1067
- inViewThreshold: 0,
1068
- breakpoints: {},
1069
- dragFree: !1,
1070
- dragThreshold: 10,
1071
- loop: !1,
1072
- skipSnaps: !1,
1073
- duration: 25,
1074
- startIndex: 0,
1075
- active: !0,
1076
- watchDrag: !0,
1077
- watchResize: !0,
1078
- watchSlides: !0,
1079
- watchFocus: !0
1080
- };
1081
- function rn(e) {
1082
- function t(s, o) {
1083
- return ot(s, o || {});
1084
- }
1085
- function n(s) {
1086
- const o = s.breakpoints || {}, u = ge(o).filter((c) => e.matchMedia(c).matches).map((c) => o[c]).reduce((c, l) => t(c, l), {});
1087
- return t(s, u);
1088
- }
1089
- function r(s) {
1090
- return s.map((o) => ge(o.breakpoints || {})).reduce((o, u) => o.concat(u), []).map(e.matchMedia);
1091
- }
1092
- return {
1093
- mergeOptions: t,
1094
- optionsAtMedia: n,
1095
- optionsMediaQueries: r
1096
- };
1097
- }
1098
- function sn(e) {
1099
- let t = [];
1100
- function n(s, o) {
1101
- return t = o.filter(({
1102
- options: u
1103
- }) => e.optionsAtMedia(u).active !== !1), t.forEach((u) => u.init(s, e)), o.reduce((u, c) => Object.assign(u, {
1104
- [c.name]: c
1105
- }), {});
1106
- }
1107
- function r() {
1108
- t = t.filter((s) => s.destroy());
1109
- }
1110
- return {
1111
- init: n,
1112
- destroy: r
1113
- };
1114
- }
1115
- function Se(e, t, n) {
1116
- const r = e.ownerDocument, i = r.defaultView, s = rn(i), o = sn(s), u = he(), c = nn(), {
1117
- mergeOptions: l,
1118
- optionsAtMedia: b,
1119
- optionsMediaQueries: p
1120
- } = s, {
1121
- on: m,
1122
- off: v,
1123
- emit: f
1124
- } = c, g = T;
1125
- let h = !1, d, a = l(on, Se.globalOptions), S = l(a), C = [], L, w, y;
1126
- function I() {
1127
- const {
1128
- container: A,
1129
- slides: x
1130
- } = S;
1131
- w = (Ae(A) ? e.querySelector(A) : A) || e.children[0];
1132
- const z = Ae(x) ? w.querySelectorAll(x) : x;
1133
- y = [].slice.call(z || w.children);
1134
- }
1135
- function E(A) {
1136
- const x = tn(e, w, y, r, i, A, c);
1137
- if (A.loop && !x.slideLooper.canLoop()) {
1138
- const D = Object.assign({}, A, {
1139
- loop: !1
1140
- });
1141
- return E(D);
1142
- }
1143
- return x;
1144
- }
1145
- function P(A, x) {
1146
- h || (a = l(a, A), S = b(a), C = x || C, I(), d = E(S), p([a, ...C.map(({
1147
- options: D
1148
- }) => D)]).forEach((D) => u.add(D, "change", T)), S.active && (d.translate.to(d.location.get()), d.animation.init(), d.slidesInView.init(), d.slideFocus.init(H), d.eventHandler.init(H), d.resizeHandler.init(H), d.slidesHandler.init(H), d.options.loop && d.slideLooper.loop(), w.offsetParent && y.length && d.dragHandler.init(H), L = o.init(H, C)));
1149
- }
1150
- function T(A, x) {
1151
- const D = U();
1152
- V(), P(l({
1153
- startIndex: D
1154
- }, A), x), c.emit("reInit");
1155
- }
1156
- function V() {
1157
- d.dragHandler.destroy(), d.eventStore.clear(), d.translate.clear(), d.slideLooper.clear(), d.resizeHandler.destroy(), d.slidesHandler.destroy(), d.slidesInView.destroy(), d.animation.destroy(), o.destroy(), u.clear();
1158
- }
1159
- function M() {
1160
- h || (h = !0, u.clear(), V(), c.emit("destroy"), c.clear());
1161
- }
1162
- function B(A, x, D) {
1163
- !S.active || h || (d.scrollBody.useBaseFriction().useDuration(x === !0 ? 0 : S.duration), d.scrollTo.index(A, D || 0));
1164
- }
1165
- function R(A) {
1166
- const x = d.index.add(1).get();
1167
- B(x, A, -1);
1168
- }
1169
- function q(A) {
1170
- const x = d.index.add(-1).get();
1171
- B(x, A, 1);
1172
- }
1173
- function X() {
1174
- return d.index.add(1).get() !== U();
1175
- }
1176
- function _() {
1177
- return d.index.add(-1).get() !== U();
1178
- }
1179
- function K() {
1180
- return d.scrollSnapList;
1181
- }
1182
- function oe() {
1183
- return d.scrollProgress.get(d.offsetLocation.get());
1184
- }
1185
- function U() {
1186
- return d.index.get();
1187
- }
1188
- function W() {
1189
- return d.indexPrevious.get();
1190
- }
1191
- function ee() {
1192
- return d.slidesInView.get();
1193
- }
1194
- function Q() {
1195
- return d.slidesInView.get(!1);
1196
- }
1197
- function re() {
1198
- return L;
1199
- }
1200
- function k() {
1201
- return d;
1202
- }
1203
- function O() {
1204
- return e;
1205
- }
1206
- function F() {
1207
- return w;
1208
- }
1209
- function $() {
1210
- return y;
1211
- }
1212
- const H = {
1213
- canScrollNext: X,
1214
- canScrollPrev: _,
1215
- containerNode: F,
1216
- internalEngine: k,
1217
- destroy: M,
1218
- off: v,
1219
- on: m,
1220
- emit: f,
1221
- plugins: re,
1222
- previousScrollSnap: W,
1223
- reInit: g,
1224
- rootNode: O,
1225
- scrollNext: R,
1226
- scrollPrev: q,
1227
- scrollProgress: oe,
1228
- scrollSnapList: K,
1229
- scrollTo: B,
1230
- selectedScrollSnap: U,
1231
- slideNodes: $,
1232
- slidesInView: ee,
1233
- slidesNotInView: Q
1234
- };
1235
- return P(t, n), setTimeout(() => c.emit("init"), 0), H;
1236
- }
1237
- Se.globalOptions = void 0;
1238
- function ze(e = {}, t = []) {
1239
- const n = Pe(e), r = Pe(t), [i, s] = ne(), [o, u] = ne(), c = le(() => {
1240
- i && i.reInit(n.current, r.current);
1241
- }, [i]);
1242
- return fe(() => {
1243
- Me(n.current, e) || (n.current = e, c());
1244
- }, [e, c]), fe(() => {
1245
- Dt(r.current, t) || (r.current = t, c());
1246
- }, [t, c]), fe(() => {
1247
- if (Tt() && o) {
1248
- Se.globalOptions = ze.globalOptions;
1249
- const l = Se(o, n.current, r.current);
1250
- return s(l), () => l.destroy();
1251
- } else
1252
- s(void 0);
1253
- }, [o, s]), [u, i];
1254
- }
1255
- ze.globalOptions = void 0;
1256
- const cn = nt(
1257
- "ds:relative ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
1258
- {
1259
- variants: {
1260
- size: {
1261
- sm: "ds:[--carousel-item-inline-size:14rem]",
1262
- md: "ds:[--carousel-item-inline-size:20rem]",
1263
- lg: "ds:[--carousel-item-inline-size:28rem]"
1264
- }
1265
- },
1266
- defaultVariants: { size: "md" }
1267
- }
1268
- ), an = nt(
1269
- [
1270
- "ds:shrink-0 ds:basis-[var(--carousel-item-inline-size)]",
1271
- "ds:min-w-0",
1272
- "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
1273
- "ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
1274
- "ds:rounded-[var(--radius-md)]"
1275
- ].join(" ")
1276
- ), it = It(null);
1277
- function ct(e) {
1278
- const t = Ct(it);
1279
- if (!t)
1280
- throw new Error(
1281
- `[Carousel] \`${e}\` must be rendered inside <Carousel>.`
1282
- );
1283
- return t;
1284
- }
1285
- function un() {
1286
- const [e, t] = ne(() => typeof window > "u" || !window.matchMedia ? !1 : window.matchMedia("(prefers-reduced-motion: reduce)").matches);
1287
- return fe(() => {
1288
- if (typeof window > "u" || !window.matchMedia) return;
1289
- const n = window.matchMedia("(prefers-reduced-motion: reduce)"), r = () => t(n.matches);
1290
- return n.addEventListener("change", r), () => n.removeEventListener("change", r);
1291
- }, []), e;
1292
- }
1293
- function ln(e) {
1294
- let t = null;
1295
- const n = [];
1296
- return et.forEach(e, (r) => {
1297
- tt(r) && r.type.displayName === "Carousel.Header" ? t = r : n.push(r);
1298
- }), { header: t, items: n };
1299
- }
1300
- const at = xe(
1301
- ({
1302
- children: e,
1303
- size: t = "md",
1304
- showControls: n = !0,
1305
- showIndicators: r = !0,
1306
- viewAllSlot: i,
1307
- snap: s = "mandatory",
1308
- id: o,
1309
- className: u,
1310
- "aria-label": c,
1311
- ...l
1312
- }, b) => {
1313
- const { t: p } = ye(), m = un(), v = xt(), f = `${o ?? v}-track`, g = `${o ?? v}-live`, h = Qe(
1314
- () => ({
1315
- align: "start",
1316
- // `mandatory` → embla's default tight snap; `proximity` → free-scroll.
1317
- dragFree: s === "proximity",
1318
- // Reduced-motion disables embla's tween entirely (snap is instant).
1319
- duration: m ? 0 : 25,
1320
- // Prevents over-scroll at the ends so the last item snaps cleanly.
1321
- containScroll: "trimSnaps"
1322
- }),
1323
- [s, m]
1324
- ), [d, a] = ze(h), [S, C] = ne(0), [L, w] = ne(0), [y, I] = ne(!1), [E, P] = ne(!1), [T, V] = ne(""), M = Pe("init");
1325
- fe(() => {
1326
- if (!a) return;
1327
- w(a.scrollSnapList().length), C(a.selectedScrollSnap()), I(a.canScrollPrev()), P(a.canScrollNext());
1328
- const k = () => {
1329
- const H = a.selectedScrollSnap();
1330
- C(H), I(a.canScrollPrev()), P(a.canScrollNext()), M.current === "control" && V(
1331
- p("carousel.slideAnnouncement", {
1332
- current: H + 1,
1333
- total: a.scrollSnapList().length
1334
- })
1335
- );
1336
- }, O = () => {
1337
- M.current = "drag";
1338
- }, F = () => {
1339
- M.current = "init";
1340
- }, $ = () => {
1341
- w(a.scrollSnapList().length), C(a.selectedScrollSnap()), I(a.canScrollPrev()), P(a.canScrollNext());
1342
- };
1343
- return a.on("select", k), a.on("pointerDown", O), a.on("pointerUp", F), a.on("reInit", $), () => {
1344
- a.off("select", k), a.off("pointerDown", O), a.off("pointerUp", F), a.off("reInit", $);
1345
- };
1346
- }, [a, p]);
1347
- const B = le(() => {
1348
- a && (M.current = "control", a.scrollPrev());
1349
- }, [a]), R = le(() => {
1350
- a && (M.current = "control", a.scrollNext());
1351
- }, [a]), q = le(
1352
- (k) => {
1353
- a && (M.current = "control", a.scrollTo(k));
1354
- },
1355
- [a]
1356
- ), X = le(
1357
- (k) => {
1358
- if (a)
1359
- switch (k.key) {
1360
- case "ArrowRight":
1361
- k.preventDefault(), a.scrollNext(), M.current = "control";
1362
- break;
1363
- case "ArrowLeft":
1364
- k.preventDefault(), a.scrollPrev(), M.current = "control";
1365
- break;
1366
- case "Home":
1367
- k.preventDefault(), a.scrollTo(0), M.current = "control";
1368
- break;
1369
- case "End":
1370
- k.preventDefault(), a.scrollTo(a.scrollSnapList().length - 1), M.current = "control";
1371
- break;
1372
- case "PageDown":
1373
- case "PageUp": {
1374
- k.preventDefault();
1375
- const O = a.slidesInView().length || 1, F = k.key === "PageDown" ? 1 : -1, $ = Math.max(
1376
- 0,
1377
- Math.min(
1378
- a.selectedScrollSnap() + F * O,
1379
- a.scrollSnapList().length - 1
1380
- )
1381
- );
1382
- a.scrollTo($), M.current = "control";
1383
- break;
1384
- }
1385
- }
1386
- },
1387
- [a]
1388
- );
1389
- yt(
1390
- b,
1391
- () => ({
1392
- scrollTo: q,
1393
- getActiveIndex: () => S,
1394
- getCount: () => L,
1395
- scrollPrev: B,
1396
- scrollNext: R
1397
- }),
1398
- [q, B, R, S, L]
1399
- );
1400
- const { header: _, items: K } = ln(e), oe = K.length, U = Math.max(L, oe), W = n && U > 1 || i != null, ee = _ == null && W, Q = r && L > 1, re = Qe(
1401
- () => ({
1402
- api: a,
1403
- activeIndex: S,
1404
- count: L,
1405
- canScrollPrev: y,
1406
- canScrollNext: E,
1407
- scrollPrev: B,
1408
- scrollNext: R,
1409
- scrollToIndex: q,
1410
- trackId: f
1411
- }),
1412
- [
1413
- a,
1414
- S,
1415
- L,
1416
- y,
1417
- E,
1418
- B,
1419
- R,
1420
- q,
1421
- f
1422
- ]
1423
- );
1424
- return /* @__PURE__ */ j(it.Provider, { value: re, children: /* @__PURE__ */ De(
1425
- "section",
1426
- {
1427
- ...l,
1428
- "aria-label": c ?? p("carousel.label", "Carousel"),
1429
- "aria-roledescription": p("carousel.roleDescription", "carousel"),
1430
- tabIndex: 0,
1431
- onKeyDown: X,
1432
- "data-component": "carousel",
1433
- "data-component-id": o,
1434
- "data-size": t,
1435
- "data-state": m ? "reduced-motion" : void 0,
1436
- className: cn({ size: t, className: u }),
1437
- children: [
1438
- _,
1439
- ee ? /* @__PURE__ */ j("div", { className: "ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-md)]", children: /* @__PURE__ */ De("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)] ds:ms-auto", children: [
1440
- i,
1441
- n && U > 1 ? /* @__PURE__ */ j(fn, {}) : null
1442
- ] }) }) : null,
1443
- /* @__PURE__ */ j(
1444
- "div",
1445
- {
1446
- ref: d,
1447
- className: "ds:overflow-hidden ds:py-[var(--spacing-xl)] ds:-my-[var(--spacing-xl)]",
1448
- children: /* @__PURE__ */ j(
1449
- "div",
1450
- {
1451
- id: f,
1452
- role: "presentation",
1453
- className: "ds:flex ds:gap-[var(--spacing-md)]",
1454
- children: et.map(K, (k, O) => tt(k) ? /* @__PURE__ */ j(dn, { index: O, total: U, children: k }) : k)
1455
- }
1456
- )
1457
- }
1458
- ),
1459
- Q ? /* @__PURE__ */ j(pn, {}) : null,
1460
- /* @__PURE__ */ j(
1461
- "div",
1462
- {
1463
- id: g,
1464
- role: "status",
1465
- "aria-live": "polite",
1466
- "aria-atomic": "true",
1467
- className: "ds:sr-only",
1468
- children: T
1469
- }
1470
- )
1471
- ]
1472
- }
1473
- ) });
1474
- }
1475
- );
1476
- at.displayName = "Carousel";
1477
- const je = xe(
1478
- ({ children: e, className: t, ...n }, r) => /* @__PURE__ */ j(
1479
- "div",
1480
- {
1481
- ref: r,
1482
- ...n,
1483
- tabIndex: -1,
1484
- className: an({ className: t }),
1485
- children: e
1486
- }
1487
- )
1488
- );
1489
- je.displayName = "Carousel.Item";
1490
- function dn({
1491
- children: e,
1492
- index: t,
1493
- total: n
1494
- }) {
1495
- const { t: r } = ye(), i = e.props, s = i["aria-label"] ?? r("carousel.slideLabel", {
1496
- current: t + 1,
1497
- total: n,
1498
- defaultValue: "{{current}} of {{total}}"
1499
- }), o = {
1500
- ...i,
1501
- role: "group",
1502
- "aria-roledescription": r("carousel.slideRoleDescription", "slide"),
1503
- "aria-label": s,
1504
- "data-slide-index": t,
1505
- "data-slide-id": i.id
1506
- };
1507
- return /* @__PURE__ */ j(je, { ...o });
1508
- }
1509
- const ut = xe(
1510
- ({ children: e, className: t, ...n }, r) => /* @__PURE__ */ j(
1511
- "div",
1512
- {
1513
- ref: r,
1514
- ...n,
1515
- className: [
1516
- "ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-md)]",
1517
- t
1518
- ].filter(Boolean).join(" "),
1519
- children: e
1520
- }
1521
- )
1522
- );
1523
- ut.displayName = "Carousel.Header";
1524
- function fn() {
1525
- return /* @__PURE__ */ j(Ve, {});
1526
- }
1527
- const Ve = xe(({ className: e, ...t }, n) => {
1528
- const { t: r } = ye(), { canScrollPrev: i, canScrollNext: s, scrollPrev: o, scrollNext: u, trackId: c } = ct("Carousel.Controls");
1529
- return /* @__PURE__ */ De(
1530
- "div",
1531
- {
1532
- ref: n,
1533
- ...t,
1534
- className: [
1535
- "ds:hidden ds:md:flex ds:items-center ds:gap-[var(--spacing-2xs)]",
1536
- e
1537
- ].filter(Boolean).join(" "),
1538
- children: [
1539
- /* @__PURE__ */ j(
1540
- Je,
1541
- {
1542
- size: "sm",
1543
- intent: "ghost",
1544
- flipIconInRtl: !0,
1545
- icon: /* @__PURE__ */ j(Lt, { "aria-hidden": "true" }),
1546
- "aria-controls": c,
1547
- "aria-label": r("carousel.previous", "Previous slide"),
1548
- disabled: !i,
1549
- onClick: o
1550
- }
1551
- ),
1552
- /* @__PURE__ */ j(
1553
- Je,
1554
- {
1555
- size: "sm",
1556
- intent: "ghost",
1557
- flipIconInRtl: !0,
1558
- icon: /* @__PURE__ */ j(wt, { "aria-hidden": "true" }),
1559
- "aria-controls": c,
1560
- "aria-label": r("carousel.next", "Next slide"),
1561
- disabled: !s,
1562
- onClick: u
1563
- }
1564
- )
1565
- ]
1566
- }
1567
- );
1568
- });
1569
- Ve.displayName = "Carousel.Controls";
1570
- function pn() {
1571
- const { t: e } = ye(), { activeIndex: t, count: n, scrollToIndex: r, trackId: i } = ct(
1572
- "Carousel.Indicators"
1573
- );
1574
- return (
1575
- // `<div role="tablist">` with direct `<button role="tab">` children.
1576
- // axe's `aria-required-children` rejects `<li>` wrappers between the
1577
- // tablist and its tabs, and the list semantic adds nothing the
1578
- // tablist role doesn't already convey. Matches the WAI APG carousel
1579
- // pattern.
1580
- // Each tab is wrapped in a `--min-target-size` hit area (44px in
1581
- // standard, 48px in accessible) so the indicator row is actually
1582
- // usable with a pointer — the visible dot stays small (10px) but
1583
- // the touch / click target is full-size. The buttons themselves
1584
- // get a `group/dot` scope so the inner dot can respond to the
1585
- // outer button's :hover.
1586
- /* @__PURE__ */ j(
1587
- "div",
1588
- {
1589
- role: "tablist",
1590
- "aria-label": e("carousel.indicatorsLabel", "Slides"),
1591
- className: "ds:flex ds:items-center ds:justify-center ds:gap-[var(--spacing-2xs)]",
1592
- children: Array.from({ length: n }).map((s, o) => {
1593
- const u = o === t;
1594
- return /* @__PURE__ */ j(
1595
- "button",
1596
- {
1597
- type: "button",
1598
- role: "tab",
1599
- "aria-controls": i,
1600
- "aria-current": u ? "true" : void 0,
1601
- "aria-label": e("carousel.goToSlide", {
1602
- index: o + 1,
1603
- defaultValue: "Go to slide {{index}}"
1604
- }),
1605
- onClick: () => r(o),
1606
- "data-active": u ? "true" : void 0,
1607
- className: [
1608
- "group/dot",
1609
- "ds:inline-flex ds:items-center ds:justify-center",
1610
- "ds:size-[length:var(--min-target-size)]",
1611
- "ds:rounded-[var(--radius-full)]",
1612
- "ds:cursor-pointer ds:bg-transparent ds:border-0",
1613
- "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
1614
- "ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]"
1615
- ].join(" "),
1616
- children: /* @__PURE__ */ j(
1617
- "span",
1618
- {
1619
- "aria-hidden": "true",
1620
- className: [
1621
- "ds:block ds:rounded-[var(--radius-full)]",
1622
- "ds:h-2.5",
1623
- "ds:transition-[background-color,inline-size] ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none",
1624
- u ? "ds:bg-[var(--primary)] ds:w-6" : "ds:bg-[var(--border)] ds:w-2.5 ds:group-hover/dot:bg-[var(--muted-foreground)]"
1625
- ].join(" ")
1626
- }
1627
- )
1628
- },
1629
- o
1630
- );
1631
- })
1632
- }
1633
- )
1634
- );
1635
- }
1636
- const yn = Object.assign(at, {
1637
- Header: ut,
1638
- Item: je,
1639
- Controls: Ve
1640
- }), In = {
1641
- id: "carousel",
1642
- capabilities: ["navigate", "view_change"],
1643
- state: {
1644
- activeIndex: {
1645
- type: "number",
1646
- description: "Zero-based index of the currently snapped slide.",
1647
- read: (e) => e.getActiveIndex()
1648
- },
1649
- count: {
1650
- type: "number",
1651
- description: "Total slide count.",
1652
- read: (e) => e.getCount()
1653
- }
1654
- },
1655
- actions: {
1656
- scroll_to: {
1657
- safety: "read",
1658
- argsType: "{ index: number }",
1659
- description: "Scroll to the slide at the given index.",
1660
- invoke: (e, t) => {
1661
- e.scrollTo(t.index);
1662
- }
1663
- },
1664
- scroll_prev: {
1665
- safety: "read",
1666
- description: "Scroll to the previous slide.",
1667
- invoke: (e) => {
1668
- e.scrollPrev();
1669
- }
1670
- },
1671
- scroll_next: {
1672
- safety: "read",
1673
- description: "Scroll to the next slide.",
1674
- invoke: (e) => {
1675
- e.scrollNext();
1676
- }
1677
- }
1678
- },
1679
- domHooks: {
1680
- root: { attr: "data-component", value: "carousel" },
1681
- instanceId: {
1682
- attr: "data-component-id",
1683
- sourceProp: "id",
1684
- description: "Sourced from the id prop on Carousel."
1685
- },
1686
- item: {
1687
- attr: "data-slide-id",
1688
- description: "Each Carousel.Item emits its `id` prop as `data-slide-id`. `data-slide-index` carries the zero-based position alongside."
1689
- }
1690
- }
1691
- };
1692
- export {
1693
- yn as C,
1694
- In as c
1695
- };
1696
- //# sourceMappingURL=carousel.agent-CQPFfppK.js.map