@mortenbrudvik/waveui 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +157 -13
- package/dist/components/button/Link.cjs +1 -1
- package/dist/components/button/Link.cjs.map +1 -1
- package/dist/components/button/Link.mjs +4 -4
- package/dist/components/data-display/Avatar.cjs +1 -1
- package/dist/components/data-display/Avatar.cjs.map +1 -1
- package/dist/components/data-display/Avatar.colors.cjs +2 -0
- package/dist/components/data-display/Avatar.colors.cjs.map +1 -0
- package/dist/components/data-display/Avatar.colors.mjs +45 -0
- package/dist/components/data-display/Avatar.colors.mjs.map +1 -0
- package/dist/components/data-display/Avatar.context.cjs +1 -1
- package/dist/components/data-display/Avatar.context.cjs.map +1 -1
- package/dist/components/data-display/Avatar.context.mjs +4 -2
- package/dist/components/data-display/Avatar.context.mjs.map +1 -1
- package/dist/components/data-display/Avatar.mjs +103 -96
- package/dist/components/data-display/Avatar.mjs.map +1 -1
- package/dist/components/data-display/Avatar.sizes.cjs +2 -0
- package/dist/components/data-display/Avatar.sizes.cjs.map +1 -0
- package/dist/components/data-display/Avatar.sizes.mjs +41 -0
- package/dist/components/data-display/Avatar.sizes.mjs.map +1 -0
- package/dist/components/data-display/AvatarGroup.cjs +1 -1
- package/dist/components/data-display/AvatarGroup.cjs.map +1 -1
- package/dist/components/data-display/AvatarGroup.context.cjs +2 -0
- package/dist/components/data-display/AvatarGroup.context.cjs.map +1 -0
- package/dist/components/data-display/AvatarGroup.context.mjs +9 -0
- package/dist/components/data-display/AvatarGroup.context.mjs.map +1 -0
- package/dist/components/data-display/AvatarGroup.mjs +65 -122
- package/dist/components/data-display/AvatarGroup.mjs.map +1 -1
- package/dist/components/data-display/AvatarGroup.partition.cjs +2 -0
- package/dist/components/data-display/AvatarGroup.partition.cjs.map +1 -0
- package/dist/components/data-display/AvatarGroup.partition.mjs +14 -0
- package/dist/components/data-display/AvatarGroup.partition.mjs.map +1 -0
- package/dist/components/data-display/AvatarGroup.parts.cjs +2 -0
- package/dist/components/data-display/AvatarGroup.parts.cjs.map +1 -0
- package/dist/components/data-display/AvatarGroup.parts.mjs +178 -0
- package/dist/components/data-display/AvatarGroup.parts.mjs.map +1 -0
- package/dist/components/data-display/InfoButton.cjs +1 -1
- package/dist/components/data-display/InfoButton.cjs.map +1 -1
- package/dist/components/data-display/InfoButton.mjs +12 -12
- package/dist/components/data-display/InteractionTag.cjs +1 -1
- package/dist/components/data-display/InteractionTag.cjs.map +1 -1
- package/dist/components/data-display/InteractionTag.mjs +36 -33
- package/dist/components/data-display/InteractionTag.mjs.map +1 -1
- package/dist/components/data-display/Persona.cjs +1 -1
- package/dist/components/data-display/Persona.cjs.map +1 -1
- package/dist/components/data-display/Persona.mjs +96 -37
- package/dist/components/data-display/Persona.mjs.map +1 -1
- package/dist/components/data-display/PresenceBadge.cjs +1 -1
- package/dist/components/data-display/PresenceBadge.cjs.map +1 -1
- package/dist/components/data-display/PresenceBadge.mjs +42 -28
- package/dist/components/data-display/PresenceBadge.mjs.map +1 -1
- package/dist/components/data-display/Tag.cjs +1 -1
- package/dist/components/data-display/Tag.cjs.map +1 -1
- package/dist/components/data-display/Tag.mjs +111 -108
- package/dist/components/data-display/Tag.mjs.map +1 -1
- package/dist/components/feedback/Toaster.cjs +1 -1
- package/dist/components/feedback/Toaster.cjs.map +1 -1
- package/dist/components/feedback/Toaster.mjs +235 -235
- package/dist/components/feedback/Toaster.mjs.map +1 -1
- package/dist/components/input/Combobox.cjs +1 -1
- package/dist/components/input/Combobox.cjs.map +1 -1
- package/dist/components/input/Combobox.mjs +176 -175
- package/dist/components/input/Combobox.mjs.map +1 -1
- package/dist/components/input/DatePicker.cjs +1 -1
- package/dist/components/input/DatePicker.cjs.map +1 -1
- package/dist/components/input/DatePicker.mjs +188 -187
- package/dist/components/input/DatePicker.mjs.map +1 -1
- package/dist/components/input/Dropdown.cjs +1 -1
- package/dist/components/input/Dropdown.cjs.map +1 -1
- package/dist/components/input/Dropdown.mjs +41 -40
- package/dist/components/input/Dropdown.mjs.map +1 -1
- package/dist/components/input/Option.cjs +1 -1
- package/dist/components/input/Option.cjs.map +1 -1
- package/dist/components/input/Option.mjs +89 -87
- package/dist/components/input/Option.mjs.map +1 -1
- package/dist/components/input/TagPicker.root.cjs +1 -1
- package/dist/components/input/TagPicker.root.cjs.map +1 -1
- package/dist/components/input/TagPicker.root.mjs +136 -135
- package/dist/components/input/TagPicker.root.mjs.map +1 -1
- package/dist/components/input/TimePicker.cjs +1 -1
- package/dist/components/input/TimePicker.cjs.map +1 -1
- package/dist/components/input/TimePicker.mjs +156 -154
- package/dist/components/input/TimePicker.mjs.map +1 -1
- package/dist/components/layout/Card.cjs +1 -1
- package/dist/components/layout/Card.cjs.map +1 -1
- package/dist/components/layout/Card.context.cjs +2 -0
- package/dist/components/layout/Card.context.cjs.map +1 -0
- package/dist/components/layout/Card.context.mjs +14 -0
- package/dist/components/layout/Card.context.mjs.map +1 -0
- package/dist/components/layout/Card.mjs +138 -92
- package/dist/components/layout/Card.mjs.map +1 -1
- package/dist/components/layout/Card.preview.cjs +2 -0
- package/dist/components/layout/Card.preview.cjs.map +1 -0
- package/dist/components/layout/Card.preview.mjs +22 -0
- package/dist/components/layout/Card.preview.mjs.map +1 -0
- package/dist/components/layout/Carousel.button.cjs +2 -0
- package/dist/components/layout/Carousel.button.cjs.map +1 -0
- package/dist/components/layout/Carousel.button.mjs +34 -0
- package/dist/components/layout/Carousel.button.mjs.map +1 -0
- package/dist/components/layout/Carousel.cjs +1 -1
- package/dist/components/layout/Carousel.cjs.map +1 -1
- package/dist/components/layout/Carousel.context.cjs +2 -0
- package/dist/components/layout/Carousel.context.cjs.map +1 -0
- package/dist/components/layout/Carousel.context.mjs +24 -0
- package/dist/components/layout/Carousel.context.mjs.map +1 -0
- package/dist/components/layout/Carousel.drag.cjs +2 -0
- package/dist/components/layout/Carousel.drag.cjs.map +1 -0
- package/dist/components/layout/Carousel.drag.mjs +79 -0
- package/dist/components/layout/Carousel.drag.mjs.map +1 -0
- package/dist/components/layout/Carousel.groups.cjs +2 -0
- package/dist/components/layout/Carousel.groups.cjs.map +1 -0
- package/dist/components/layout/Carousel.groups.mjs +23 -0
- package/dist/components/layout/Carousel.groups.mjs.map +1 -0
- package/dist/components/layout/Carousel.mjs +288 -150
- package/dist/components/layout/Carousel.mjs.map +1 -1
- package/dist/components/layout/Carousel.styles.cjs +2 -0
- package/dist/components/layout/Carousel.styles.cjs.map +1 -0
- package/dist/components/layout/Carousel.styles.mjs +30 -0
- package/dist/components/layout/Carousel.styles.mjs.map +1 -0
- package/dist/components/layout/TabList.cjs +1 -1
- package/dist/components/layout/TabList.cjs.map +1 -1
- package/dist/components/layout/TabList.mjs +163 -124
- package/dist/components/layout/TabList.mjs.map +1 -1
- package/dist/components/navigation/Menu.popover.cjs +1 -1
- package/dist/components/navigation/Menu.popover.cjs.map +1 -1
- package/dist/components/navigation/Menu.popover.mjs +137 -127
- package/dist/components/navigation/Menu.popover.mjs.map +1 -1
- package/dist/components/navigation/Menu.root.cjs +1 -1
- package/dist/components/navigation/Menu.root.cjs.map +1 -1
- package/dist/components/navigation/Menu.root.mjs +4 -4
- package/dist/components/overlays/Dialog.cjs +1 -1
- package/dist/components/overlays/Dialog.cjs.map +1 -1
- package/dist/components/overlays/Dialog.mjs +123 -123
- package/dist/components/overlays/Dialog.mjs.map +1 -1
- package/dist/components/overlays/Drawer.panel.cjs +1 -1
- package/dist/components/overlays/Drawer.panel.cjs.map +1 -1
- package/dist/components/overlays/Drawer.panel.mjs +12 -12
- package/dist/components/overlays/Drawer.panel.mjs.map +1 -1
- package/dist/components/overlays/Popover.cjs +1 -1
- package/dist/components/overlays/Popover.cjs.map +1 -1
- package/dist/components/overlays/Popover.mjs +173 -162
- package/dist/components/overlays/Popover.mjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.cjs +1 -1
- package/dist/components/overlays/TeachingPopover.cjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.mjs +96 -91
- package/dist/components/overlays/TeachingPopover.mjs.map +1 -1
- package/dist/components/overlays/Tooltip.cjs +1 -1
- package/dist/components/overlays/Tooltip.cjs.map +1 -1
- package/dist/components/overlays/Tooltip.mjs +47 -47
- package/dist/components/overlays/Tooltip.mjs.map +1 -1
- package/dist/components/portal/Portal.cjs +1 -1
- package/dist/components/portal/Portal.cjs.map +1 -1
- package/dist/components/portal/Portal.mjs +5 -5
- package/dist/components/table/DataGrid.cjs +1 -1
- package/dist/components/table/DataGrid.cjs.map +1 -1
- package/dist/components/table/DataGrid.mjs +1 -1
- package/dist/hooks/useDismiss.cjs.map +1 -1
- package/dist/hooks/useDismiss.mjs.map +1 -1
- package/dist/hooks/useFocusTrap.cjs.map +1 -1
- package/dist/hooks/useFocusTrap.mjs.map +1 -1
- package/dist/hooks/useFocusVisible.cjs +2 -0
- package/dist/hooks/useFocusVisible.cjs.map +1 -0
- package/dist/hooks/useFocusVisible.mjs +49 -0
- package/dist/hooks/useFocusVisible.mjs.map +1 -0
- package/dist/hooks/useFocusableGroup.cjs +2 -0
- package/dist/hooks/useFocusableGroup.cjs.map +1 -0
- package/dist/hooks/useFocusableGroup.mjs +70 -0
- package/dist/hooks/useFocusableGroup.mjs.map +1 -0
- package/dist/hooks/useModalLayer.cjs +1 -1
- package/dist/hooks/useModalLayer.cjs.map +1 -1
- package/dist/hooks/useModalLayer.mjs +4 -4
- package/dist/hooks/useModalOpen.cjs +2 -0
- package/dist/hooks/useModalOpen.cjs.map +1 -0
- package/dist/hooks/useModalOpen.mjs +14 -0
- package/dist/hooks/useModalOpen.mjs.map +1 -0
- package/dist/hooks/usePopupPosition.cjs +1 -1
- package/dist/hooks/usePopupPosition.cjs.map +1 -1
- package/dist/hooks/usePopupPosition.mjs +82 -53
- package/dist/hooks/usePopupPosition.mjs.map +1 -1
- package/dist/hooks/useResolvedTarget.cjs +2 -0
- package/dist/hooks/useResolvedTarget.cjs.map +1 -0
- package/dist/hooks/useResolvedTarget.mjs +37 -0
- package/dist/hooks/useResolvedTarget.mjs.map +1 -0
- package/dist/hooks/useRovingGrid.cjs +1 -1
- package/dist/hooks/useRovingGrid.cjs.map +1 -1
- package/dist/hooks/useRovingGrid.mjs +8 -57
- package/dist/hooks/useRovingGrid.mjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.cjs +1 -1
- package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.mjs +142 -107
- package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1364 -66
- package/dist/index.d.ts +1364 -66
- package/dist/index.mjs +132 -115
- package/dist/lib/classNames.cjs +1 -1
- package/dist/lib/classNames.cjs.map +1 -1
- package/dist/lib/classNames.mjs +112 -92
- package/dist/lib/classNames.mjs.map +1 -1
- package/dist/lib/initials.cjs +2 -0
- package/dist/lib/initials.cjs.map +1 -0
- package/dist/lib/initials.mjs +21 -0
- package/dist/lib/initials.mjs.map +1 -0
- package/dist/lib/layers.cjs +1 -1
- package/dist/lib/layers.cjs.map +1 -1
- package/dist/lib/layers.mjs +112 -109
- package/dist/lib/layers.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/styles/tokens.css +102 -0
|
@@ -2,205 +2,343 @@
|
|
|
2
2
|
import { cn as e } from "../../lib/cn.mjs";
|
|
3
3
|
import { flattenChildren as t, isElementOfType as n } from "../../lib/children.mjs";
|
|
4
4
|
import { warnOnce as r } from "../../lib/dev.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import { composeEventHandlers as
|
|
7
|
-
import { carouselClassNames as
|
|
8
|
-
import { useEventCallback as
|
|
5
|
+
import { renderSlot as i, slotRendersContent as a } from "../../lib/slot.mjs";
|
|
6
|
+
import { composeEventHandlers as o } from "../../lib/composeEventHandlers.mjs";
|
|
7
|
+
import { carouselClassNames as s, carouselItemClassNames as ee } from "../../lib/classNames.mjs";
|
|
8
|
+
import { useEventCallback as c } from "../../hooks/useEventCallback.mjs";
|
|
9
9
|
import { useControllable as te } from "../../hooks/useControllable.mjs";
|
|
10
10
|
import { useId as ne } from "../../hooks/useId.mjs";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
11
|
+
import { getArrowIntent as re } from "../../lib/direction.mjs";
|
|
12
|
+
import { useRovingTabIndex as ie } from "../../hooks/useRovingTabIndex.mjs";
|
|
13
|
+
import { useMergedRefs as ae } from "../../hooks/useMergedRefs.mjs";
|
|
14
|
+
import { focusableDisabledProps as oe, preventIfDisabled as se } from "../../lib/aria.mjs";
|
|
15
|
+
import { usePrefersReducedMotion as ce } from "../../hooks/usePrefersReducedMotion.mjs";
|
|
16
|
+
import { useDirection as le } from "../../hooks/useDirection.mjs";
|
|
17
|
+
import { focusRing as ue, forcedColors as de } from "../../lib/styles.mjs";
|
|
18
|
+
import { ChevronLeftIcon as fe, ChevronRightIcon as pe } from "../../lib/icons.mjs";
|
|
19
|
+
import { CarouselContext as me } from "./Carousel.context.mjs";
|
|
20
|
+
import { CAROUSEL_CONTROL_BASE as l, CAROUSEL_CONTROL_LAYOUT as he } from "./Carousel.styles.mjs";
|
|
21
|
+
import { CarouselButton as ge } from "./Carousel.button.mjs";
|
|
22
|
+
import { useCarouselDrag as _e } from "./Carousel.drag.mjs";
|
|
23
|
+
import { clampToPage as ve, lastPageStart as ye, pageCount as be } from "./Carousel.groups.mjs";
|
|
24
|
+
import * as u from "react";
|
|
25
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
19
26
|
//#region src/components/layout/Carousel.tsx
|
|
20
|
-
var
|
|
21
|
-
function
|
|
22
|
-
|
|
27
|
+
var xe = "Pause slide rotation", Se = "Start slide rotation", Ce = "Previous slide", we = "Next slide", Te = "Choose slide", Ee = (e, t) => `Slide ${e + 1} of ${t}`, De = "carousel", Oe = "slide", ke = (e, t, n) => `Slides ${e} to ${t} of ${n}`;
|
|
28
|
+
function Ae(e, t, n) {
|
|
29
|
+
let r = u.useCallback((r) => {
|
|
30
|
+
if (!e || !t || typeof ResizeObserver > "u") return () => {};
|
|
31
|
+
let i = new ResizeObserver(r);
|
|
32
|
+
return i.observe(t), n && i.observe(n), () => i.disconnect();
|
|
33
|
+
}, [
|
|
34
|
+
e,
|
|
35
|
+
t,
|
|
36
|
+
n
|
|
37
|
+
]), [i, a, o] = u.useSyncExternalStore(r, () => {
|
|
38
|
+
if (!e || !t || !n) return "1:0:0";
|
|
39
|
+
let r = n.offsetWidth, i = t.clientWidth;
|
|
40
|
+
return `${r > 0 ? Math.max(1, Math.floor(i / r)) : 1}:${r}:${i}`;
|
|
41
|
+
}, () => "1:0:0").split(":").map(Number);
|
|
42
|
+
return {
|
|
43
|
+
perPage: i,
|
|
44
|
+
slideWidth: a,
|
|
45
|
+
rootWidth: o
|
|
46
|
+
};
|
|
23
47
|
}
|
|
24
|
-
function
|
|
48
|
+
function je(e) {
|
|
25
49
|
return e instanceof Element && e.closest("[data-carousel-rotation]") !== null;
|
|
26
50
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
u
|
|
32
|
-
].join(" "), ve = () => /* @__PURE__ */ m("svg", {
|
|
51
|
+
function Me(e) {
|
|
52
|
+
return typeof e == "string" ? { src: e } : e;
|
|
53
|
+
}
|
|
54
|
+
var Ne = () => /* @__PURE__ */ f("svg", {
|
|
33
55
|
width: "16",
|
|
34
56
|
height: "16",
|
|
35
57
|
viewBox: "0 0 16 16",
|
|
36
58
|
fill: "currentColor",
|
|
37
59
|
"aria-hidden": "true",
|
|
38
|
-
children: [/* @__PURE__ */
|
|
60
|
+
children: [/* @__PURE__ */ d("rect", {
|
|
39
61
|
x: "4",
|
|
40
62
|
y: "3",
|
|
41
63
|
width: "3",
|
|
42
64
|
height: "10",
|
|
43
65
|
rx: "1"
|
|
44
|
-
}), /* @__PURE__ */
|
|
66
|
+
}), /* @__PURE__ */ d("rect", {
|
|
45
67
|
x: "9",
|
|
46
68
|
y: "3",
|
|
47
69
|
width: "3",
|
|
48
70
|
height: "10",
|
|
49
71
|
rx: "1"
|
|
50
72
|
})]
|
|
51
|
-
}),
|
|
73
|
+
}), Pe = () => /* @__PURE__ */ d("svg", {
|
|
52
74
|
width: "16",
|
|
53
75
|
height: "16",
|
|
54
76
|
viewBox: "0 0 16 16",
|
|
55
77
|
fill: "currentColor",
|
|
56
78
|
"aria-hidden": "true",
|
|
57
|
-
children: /* @__PURE__ */
|
|
58
|
-
}),
|
|
59
|
-
let [
|
|
60
|
-
for (let e of t(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
79
|
+
children: /* @__PURE__ */ d("path", { d: "M5 3.5v9a.5.5 0 0 0 .77.42l7-4.5a.5.5 0 0 0 0-.84l-7-4.5A.5.5 0 0 0 5 3.5Z" })
|
|
80
|
+
}), p = ({ value: p, defaultValue: Fe = 0, onValueChange: Ie, autoPlay: Le = !1, autoPlayInterval: Re = 5e3, autoPlayLabels: ze, labels: h, loop: g = !1, groupSize: Be = 1, align: Ve = "start", draggable: He = !1, controlsLayout: _ = "overlay", appearance: v = "flat", className: Ue, children: We, onMouseEnter: Ge, onMouseLeave: Ke, onFocus: qe, onBlur: Je, ref: Ye, ...y }) => {
|
|
81
|
+
let [Xe, Ze] = te(p, Fe, Ie), b = ne("carousel-slides"), [Qe, $e] = u.useState(null), et = ae(Ye, $e), tt = le(Qe), x = y.dir === "rtl" || y.dir === "ltr" ? y.dir : tt, nt = ce(), [rt, it] = u.useState(null), [S, at] = u.useState(null), [ot, st] = u.useState(null), C = Be === "auto", w = Ae(C, ot, rt), T = C ? w.perPage : Math.max(1, Math.floor(Be) || 1), [ct, lt] = u.useState(null), [ut, E] = u.useState(null), [dt, ft] = u.useState(!1), [pt, mt] = u.useState(!1), [ht, gt] = u.useState(!1), [_t, D] = u.useState(!1), O = [], k = {}, A = !1;
|
|
82
|
+
for (let e of t(We)) if (n(e.node, m)) O.push({
|
|
83
|
+
...e,
|
|
84
|
+
thumbnail: e.node.props.thumbnail
|
|
85
|
+
});
|
|
86
|
+
else if (n(e.node, ge)) {
|
|
87
|
+
let t = e.node.props.direction === "next" ? "next" : "previous";
|
|
88
|
+
k[t] ? A = !0 : k[t] = u.cloneElement(e.node, { key: e.key });
|
|
89
|
+
} else a(e.node) && (A = !0);
|
|
90
|
+
let vt = O.some((e) => e.thumbnail !== void 0), j = O.length;
|
|
91
|
+
u.useEffect(() => {
|
|
92
|
+
A && r("Carousel:non-item-children", "Carousel: only `Carousel.Item` (`CarouselItem`) children are slides, directly or in Fragments; other children are not rendered. A component that renders `Carousel.Item` itself is not recognised: render the `Carousel.Item` in the Carousel and put the component inside it.");
|
|
93
|
+
}, [A]);
|
|
94
|
+
let M = ve(Xe, T, j), N = be(j, T), P = ye(j, T), F = M <= 0, I = M >= P, L = N <= 1 || !g && F, R = N <= 1 || !g && I, yt = ut === j && !g, z = (ct ?? nt) || yt, B = Le && N > 1;
|
|
95
|
+
B && !g && I && !z ? E(j) : ut !== null && !yt && E(null);
|
|
96
|
+
let V = _e({
|
|
97
|
+
enabled: He && N > 1,
|
|
98
|
+
dir: x,
|
|
99
|
+
onCommit: (e) => {
|
|
100
|
+
e === 1 ? I ? g && U(0) : U(M + T) : e === -1 && (F ? g && U(P) : U(M - T));
|
|
101
|
+
}
|
|
102
|
+
}), bt = dt && !pt || V.dragging, H = B && !z && !bt && !(ht && !_t), U = (e) => {
|
|
103
|
+
e >= 0 && e < j && e !== M && Ze(e);
|
|
104
|
+
}, W = () => U(F ? P : M - T), G = () => U(I ? 0 : M + T), xt = c(() => {
|
|
105
|
+
Ze((e) => {
|
|
106
|
+
let t = ve(e, T, j);
|
|
107
|
+
return t < P ? t + T : g ? 0 : e;
|
|
73
108
|
});
|
|
74
109
|
});
|
|
75
|
-
|
|
76
|
-
if (!
|
|
77
|
-
let e = setInterval(
|
|
110
|
+
u.useEffect(() => {
|
|
111
|
+
if (!H) return;
|
|
112
|
+
let e = setInterval(xt, Re);
|
|
78
113
|
return () => clearInterval(e);
|
|
79
114
|
}, [
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
115
|
+
H,
|
|
116
|
+
Re,
|
|
117
|
+
xt
|
|
83
118
|
]);
|
|
84
|
-
let
|
|
85
|
-
|
|
86
|
-
},
|
|
87
|
-
onMouseEnter:
|
|
88
|
-
onMouseLeave:
|
|
89
|
-
onFocus:
|
|
119
|
+
let St = () => {
|
|
120
|
+
z ? (!g && I && U(0), E(null), lt(!1), D(!0)) : (lt(!0), D(!1));
|
|
121
|
+
}, Ct = {
|
|
122
|
+
onMouseEnter: o(Ge, () => ft(!0)),
|
|
123
|
+
onMouseLeave: o(Ke, () => ft(!1)),
|
|
124
|
+
onFocus: o(qe, (e) => {
|
|
90
125
|
let t = e.relatedTarget, n = !(t instanceof Node && e.currentTarget.contains(t));
|
|
91
|
-
|
|
126
|
+
gt(!0), (n || !je(e.target)) && D(!1);
|
|
92
127
|
}),
|
|
93
|
-
onBlur:
|
|
128
|
+
onBlur: o(Je, (e) => {
|
|
94
129
|
let t = e.relatedTarget;
|
|
95
|
-
t instanceof Node && e.currentTarget.contains(t) || (
|
|
130
|
+
t instanceof Node && e.currentTarget.contains(t) || (gt(!1), D(!1));
|
|
96
131
|
})
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
132
|
+
}, K = T > 1, q = Math.min(M + T, j), wt = u.useMemo(() => K ? Array.from({ length: q - M }, (e, t) => String(M + t)) : [], [
|
|
133
|
+
K,
|
|
134
|
+
M,
|
|
135
|
+
q
|
|
136
|
+
]), J = ie({
|
|
137
|
+
items: wt,
|
|
138
|
+
activeValue: String(M),
|
|
139
|
+
orientation: "horizontal",
|
|
140
|
+
loop: !1,
|
|
141
|
+
dir: x,
|
|
142
|
+
tabStop: "last-focused"
|
|
143
|
+
}), Tt = ae(J.containerProps.ref, at), Y = u.useRef(null);
|
|
144
|
+
u.useLayoutEffect(() => {
|
|
145
|
+
let e = Y.current;
|
|
146
|
+
if (!e || !S) return;
|
|
147
|
+
Y.current = null;
|
|
148
|
+
let t = e === "first" ? M : q - 1;
|
|
149
|
+
S.querySelector(`[data-roving-value="${t}"]`)?.focus();
|
|
150
|
+
}, [
|
|
151
|
+
M,
|
|
152
|
+
q,
|
|
153
|
+
S
|
|
154
|
+
]);
|
|
155
|
+
let Et = (e) => {
|
|
156
|
+
let t = e.target.getAttribute("data-roving-value"), n = re(e.key, {
|
|
157
|
+
orientation: "horizontal",
|
|
158
|
+
dir: x
|
|
159
|
+
});
|
|
160
|
+
if (t !== null && n && !e.defaultPrevented && !e.altKey && !e.ctrlKey && !e.metaKey) {
|
|
161
|
+
let r = Number(t);
|
|
162
|
+
if (n === "next" && r === q - 1) {
|
|
163
|
+
e.preventDefault(), R || (Y.current = "first", G());
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (n === "prev" && r === M) {
|
|
167
|
+
e.preventDefault(), L || (Y.current = "last", W());
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
J.containerProps.onKeyDown(e);
|
|
172
|
+
}, X = h?.previous ?? Ce, Z = h?.next ?? we, Dt = c(() => W()), Ot = c(() => G()), kt = u.useMemo(() => ({
|
|
173
|
+
trackId: b,
|
|
174
|
+
previousLabel: X,
|
|
175
|
+
nextLabel: Z,
|
|
176
|
+
previousDisabled: L,
|
|
177
|
+
nextDisabled: R,
|
|
178
|
+
goPrevious: Dt,
|
|
179
|
+
goNext: Ot,
|
|
180
|
+
controlsLayout: _,
|
|
181
|
+
dir: x
|
|
182
|
+
}), [
|
|
183
|
+
b,
|
|
184
|
+
X,
|
|
185
|
+
Z,
|
|
186
|
+
L,
|
|
187
|
+
R,
|
|
188
|
+
Dt,
|
|
189
|
+
Ot,
|
|
190
|
+
_,
|
|
191
|
+
x
|
|
192
|
+
]);
|
|
193
|
+
if (j === 0) return /* @__PURE__ */ d("div", {
|
|
194
|
+
ref: et,
|
|
195
|
+
"data-controls-layout": _,
|
|
196
|
+
"data-appearance": v,
|
|
197
|
+
className: e(s.root, "relative", Ue),
|
|
198
|
+
...Ct,
|
|
199
|
+
...y
|
|
103
200
|
});
|
|
104
|
-
let
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
201
|
+
let Q = x === "rtl" ? 1 : -1, At = `translateX(${M / T * Q * 100}%)`;
|
|
202
|
+
if (V.offsetPx !== 0 && (At = `translateX(calc(${M / T * Q * 100}% + ${V.offsetPx}px))`), C) {
|
|
203
|
+
let e = Math.max(0, w.rootWidth - T * w.slideWidth), t = Ve === "center" ? e / 2 : Ve === "end" ? e : 0;
|
|
204
|
+
At = `translateX(${Q * M * w.slideWidth + (x === "rtl" ? -t : t) + V.offsetPx + 0}px)`;
|
|
205
|
+
}
|
|
206
|
+
let jt = h?.slides ?? ke, Mt = (e) => {
|
|
207
|
+
let t = Math.min(e + T, j);
|
|
208
|
+
return t - e === 1 ? Lt(e, j) : jt(e + 1, t, j);
|
|
209
|
+
}, Nt = x === "rtl" ? "-scale-x-100" : void 0, Pt = ze?.pause ?? xe, Ft = ze?.play ?? Se, It = h?.picker ?? Te, Lt = h?.slide ?? Ee, Rt = h?.carouselRoleDescription ?? De, zt = h?.slideRoleDescription ?? Oe, $ = _ === "inline" || _ === "inline-wide", Bt = he[_], Vt = k.previous ?? /* @__PURE__ */ d("button", {
|
|
210
|
+
type: "button",
|
|
211
|
+
"aria-label": X,
|
|
212
|
+
"aria-controls": b,
|
|
213
|
+
...oe(L),
|
|
214
|
+
onClick: se(L, W),
|
|
215
|
+
className: e(s.previousButton, l, Bt.previous),
|
|
216
|
+
children: /* @__PURE__ */ d(fe, {
|
|
217
|
+
size: 16,
|
|
218
|
+
className: Nt
|
|
219
|
+
})
|
|
220
|
+
}, "previous"), Ht = k.next ?? /* @__PURE__ */ d("button", {
|
|
221
|
+
type: "button",
|
|
222
|
+
"aria-label": Z,
|
|
223
|
+
"aria-controls": b,
|
|
224
|
+
...oe(R),
|
|
225
|
+
onClick: se(R, G),
|
|
226
|
+
className: e(s.nextButton, l, Bt.next),
|
|
227
|
+
children: /* @__PURE__ */ d(pe, {
|
|
228
|
+
size: 16,
|
|
229
|
+
className: Nt
|
|
230
|
+
})
|
|
231
|
+
}, "next"), Ut = /* @__PURE__ */ f("div", {
|
|
232
|
+
ref: st,
|
|
233
|
+
className: e(s.viewport, "relative min-w-0 flex-1 overflow-hidden"),
|
|
113
234
|
children: [
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
"
|
|
117
|
-
|
|
118
|
-
"
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
children:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
className: e(o.track, "flex transition-transform duration-300 ease-in-out motion-reduce:transition-none"),
|
|
128
|
-
style: { transform: `translateX(${ze}%)` },
|
|
129
|
-
children: L.map(({ key: t, node: n }, r) => {
|
|
130
|
-
let i = r === B;
|
|
131
|
-
return /* @__PURE__ */ p("div", {
|
|
235
|
+
/* @__PURE__ */ d("div", {
|
|
236
|
+
id: b,
|
|
237
|
+
className: e(s.track, V.dragging ? "flex" : "flex transition-transform duration-300 ease-in-out motion-reduce:transition-none", He && "touch-pan-y"),
|
|
238
|
+
style: { transform: At },
|
|
239
|
+
"data-dragging": V.dragging ? "" : void 0,
|
|
240
|
+
...V.handlers,
|
|
241
|
+
...K ? J.containerProps : null,
|
|
242
|
+
ref: K ? Tt : at,
|
|
243
|
+
onKeyDown: K ? Et : void 0,
|
|
244
|
+
children: O.map(({ key: t, node: n }, r) => {
|
|
245
|
+
let i = r >= M && r < M + T;
|
|
246
|
+
return /* @__PURE__ */ d("div", {
|
|
247
|
+
ref: r === 0 ? it : void 0,
|
|
132
248
|
role: "group",
|
|
133
|
-
"aria-roledescription":
|
|
134
|
-
"aria-label":
|
|
249
|
+
"aria-roledescription": zt,
|
|
250
|
+
"aria-label": Lt(r, j),
|
|
135
251
|
"aria-hidden": !i || void 0,
|
|
136
252
|
inert: !i,
|
|
137
|
-
|
|
253
|
+
"data-roving-value": K && i ? String(r) : void 0,
|
|
254
|
+
tabIndex: K && i ? J.getTabIndex(String(r)) : void 0,
|
|
255
|
+
className: e(s.slide, C ? "w-auto shrink-0" : T === 1 ? "w-full shrink-0" : "shrink-0", K && "focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring"),
|
|
256
|
+
style: !C && T > 1 ? { width: `calc(100% / ${T})` } : void 0,
|
|
138
257
|
children: n
|
|
139
258
|
}, t);
|
|
140
259
|
})
|
|
141
260
|
}),
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
"aria-atomic": "true",
|
|
145
|
-
className: "sr-only",
|
|
146
|
-
children: $(B, z)
|
|
147
|
-
}),
|
|
148
|
-
/* @__PURE__ */ p("button", {
|
|
149
|
-
type: "button",
|
|
150
|
-
"aria-label": He,
|
|
151
|
-
"aria-controls": D,
|
|
152
|
-
...c(U),
|
|
153
|
-
onClick: l(U, Ie),
|
|
154
|
-
className: e(o.previousButton, g, "top-1/2 start-2 -translate-y-1/2"),
|
|
155
|
-
children: /* @__PURE__ */ p(se, {
|
|
156
|
-
size: 16,
|
|
157
|
-
className: Q
|
|
158
|
-
})
|
|
159
|
-
}),
|
|
160
|
-
/* @__PURE__ */ p("button", {
|
|
161
|
-
type: "button",
|
|
162
|
-
"aria-label": Ue,
|
|
163
|
-
"aria-controls": D,
|
|
164
|
-
...c(W),
|
|
165
|
-
onClick: l(W, Le),
|
|
166
|
-
className: e(o.nextButton, g, "top-1/2 end-2 -translate-y-1/2"),
|
|
167
|
-
children: /* @__PURE__ */ p(ce, {
|
|
168
|
-
size: 16,
|
|
169
|
-
className: Q
|
|
170
|
-
})
|
|
171
|
-
}),
|
|
172
|
-
/* @__PURE__ */ p("div", {
|
|
173
|
-
role: "group",
|
|
174
|
-
"aria-label": We,
|
|
175
|
-
className: e(o.picker, "absolute inset-x-0 bottom-1 z-10 mx-auto flex w-fit"),
|
|
176
|
-
children: L.map(({ key: t }, n) => {
|
|
177
|
-
let r = n === B;
|
|
178
|
-
return /* @__PURE__ */ p("button", {
|
|
179
|
-
type: "button",
|
|
180
|
-
"aria-label": $(n, z),
|
|
181
|
-
"aria-current": r ? "true" : void 0,
|
|
182
|
-
onClick: () => Y(n),
|
|
183
|
-
className: e(o.pickerButton, "group inline-flex h-6 min-w-6 items-center justify-center", d),
|
|
184
|
-
children: /* @__PURE__ */ p("span", {
|
|
185
|
-
"aria-hidden": "true",
|
|
186
|
-
className: e(o.pickerIndicator, "block h-2 rounded-full transition-[width,background-color] duration-200 motion-reduce:transition-none", r ? e("w-5 bg-primary", oe.selectedLeaf) : "w-2 bg-stroke-accessible group-hover:bg-foreground forced-colors:bg-[ButtonText] forced-colors:forced-color-adjust-none")
|
|
187
|
-
})
|
|
188
|
-
}, t);
|
|
189
|
-
})
|
|
190
|
-
})
|
|
261
|
+
!$ && Vt,
|
|
262
|
+
!$ && Ht
|
|
191
263
|
]
|
|
192
264
|
});
|
|
265
|
+
return /* @__PURE__ */ d(me.Provider, {
|
|
266
|
+
value: kt,
|
|
267
|
+
children: /* @__PURE__ */ f("div", {
|
|
268
|
+
ref: et,
|
|
269
|
+
role: "region",
|
|
270
|
+
"aria-roledescription": Rt,
|
|
271
|
+
"aria-label": "Carousel",
|
|
272
|
+
"data-controls-layout": _,
|
|
273
|
+
"data-appearance": v,
|
|
274
|
+
className: e(s.root, "relative isolate overflow-hidden", v === "elevated" && "rounded-md shadow-4", Ue),
|
|
275
|
+
...Ct,
|
|
276
|
+
...y,
|
|
277
|
+
children: [
|
|
278
|
+
B && /* @__PURE__ */ d("button", {
|
|
279
|
+
type: "button",
|
|
280
|
+
"data-carousel-rotation": "",
|
|
281
|
+
"aria-label": z ? Ft : Pt,
|
|
282
|
+
"aria-controls": b,
|
|
283
|
+
onClick: St,
|
|
284
|
+
onMouseEnter: () => mt(!0),
|
|
285
|
+
onMouseLeave: () => mt(!1),
|
|
286
|
+
className: e(s.autoPlayButton, l, "absolute z-20 h-8 w-8 rounded-full border border-border bg-background shadow-2 top-2", $ ? "start-12" : "start-2"),
|
|
287
|
+
children: d(z ? Pe : Ne, {})
|
|
288
|
+
}),
|
|
289
|
+
$ ? /* @__PURE__ */ f("div", {
|
|
290
|
+
className: "flex items-stretch",
|
|
291
|
+
children: [
|
|
292
|
+
Vt,
|
|
293
|
+
Ut,
|
|
294
|
+
Ht
|
|
295
|
+
]
|
|
296
|
+
}) : Ut,
|
|
297
|
+
/* @__PURE__ */ d("div", {
|
|
298
|
+
"aria-live": H ? "off" : "polite",
|
|
299
|
+
"aria-atomic": "true",
|
|
300
|
+
className: "sr-only",
|
|
301
|
+
children: Mt(M)
|
|
302
|
+
}),
|
|
303
|
+
/* @__PURE__ */ d("div", {
|
|
304
|
+
role: "group",
|
|
305
|
+
"aria-label": It,
|
|
306
|
+
className: e(s.picker, vt ? "relative mx-auto flex w-fit flex-wrap justify-center gap-2 p-2" : "absolute inset-x-0 bottom-1 z-10 mx-auto flex w-fit"),
|
|
307
|
+
children: O.filter((e, t) => t % T === 0).map(({ key: t, thumbnail: n }, r) => {
|
|
308
|
+
let a = r * T, o = a === M;
|
|
309
|
+
return /* @__PURE__ */ d("button", {
|
|
310
|
+
type: "button",
|
|
311
|
+
"aria-label": Mt(a),
|
|
312
|
+
"aria-current": o ? "true" : void 0,
|
|
313
|
+
onClick: () => U(a),
|
|
314
|
+
className: e(s.pickerButton, "group inline-flex items-center justify-center", n === void 0 ? "h-6 min-w-6" : "rounded-md p-0.5", ue),
|
|
315
|
+
children: n === void 0 ? /* @__PURE__ */ d("span", {
|
|
316
|
+
"aria-hidden": "true",
|
|
317
|
+
className: e(s.pickerIndicator, "block h-2 rounded-full transition-[width,background-color] duration-200 motion-reduce:transition-none", o ? e("w-5 bg-primary", de.selectedLeaf) : "w-2 bg-stroke-accessible group-hover:bg-foreground forced-colors:bg-[ButtonText] forced-colors:forced-color-adjust-none")
|
|
318
|
+
}) : i(Me(n), "img", e(ee.thumbnail, "block h-12 w-16 rounded object-cover", o ? e("outline-2 outline-primary", de.selectedContainer) : "opacity-70 group-hover:opacity-100"), {
|
|
319
|
+
alt: "",
|
|
320
|
+
draggable: !1
|
|
321
|
+
})
|
|
322
|
+
}, t);
|
|
323
|
+
})
|
|
324
|
+
})
|
|
325
|
+
]
|
|
326
|
+
})
|
|
327
|
+
});
|
|
193
328
|
};
|
|
194
|
-
|
|
195
|
-
var
|
|
196
|
-
ref:
|
|
197
|
-
className: e(
|
|
198
|
-
...
|
|
199
|
-
children:
|
|
329
|
+
p.displayName = "Carousel";
|
|
330
|
+
var m = ({ thumbnail: t, className: n, children: r, ref: i, ...a }) => /* @__PURE__ */ d("div", {
|
|
331
|
+
ref: i,
|
|
332
|
+
className: e(ee.root, "p-4", n),
|
|
333
|
+
...a,
|
|
334
|
+
children: r
|
|
335
|
+
});
|
|
336
|
+
m.displayName = "CarouselItem";
|
|
337
|
+
var Fe = /* @__PURE__ */ Object.assign(p, {
|
|
338
|
+
Item: m,
|
|
339
|
+
Button: ge
|
|
200
340
|
});
|
|
201
|
-
v.displayName = "CarouselItem";
|
|
202
|
-
var y = /* @__PURE__ */ Object.assign(_, { Item: v });
|
|
203
341
|
//#endregion
|
|
204
|
-
export {
|
|
342
|
+
export { Fe as Carousel, m as CarouselItem };
|
|
205
343
|
|
|
206
344
|
//# sourceMappingURL=Carousel.mjs.map
|