astralis-ui 0.1.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/LICENSE +21 -0
- package/README.md +89 -0
- package/dist/components/buttons/button/button.js +83 -0
- package/dist/components/buttons/button/button.styles.js +69 -0
- package/dist/components/buttons/button-group/button-group.context.js +10 -0
- package/dist/components/buttons/button-group/button-group.js +42 -0
- package/dist/components/buttons/button-group/button-group.styles.js +39 -0
- package/dist/components/buttons/theme-toggle/theme-toggle.js +53 -0
- package/dist/components/data-display/avatar/avatar.context.js +10 -0
- package/dist/components/data-display/avatar/avatar.styles.js +40 -0
- package/dist/components/data-display/avatar/components/avatar-badge.js +24 -0
- package/dist/components/data-display/avatar/components/avatar-group.js +30 -0
- package/dist/components/data-display/avatar/components/avatar-root.js +57 -0
- package/dist/components/data-display/avatar/index.js +13 -0
- package/dist/components/data-display/badge/badge.js +12 -0
- package/dist/components/data-display/badge/badge.styles.js +25 -0
- package/dist/components/data-display/calendar/calendar.context.js +13 -0
- package/dist/components/data-display/calendar/components/calendar-cell.js +60 -0
- package/dist/components/data-display/calendar/components/calendar-grid.js +106 -0
- package/dist/components/data-display/calendar/components/calendar-header.js +23 -0
- package/dist/components/data-display/calendar/components/calendar-next-trigger.js +34 -0
- package/dist/components/data-display/calendar/components/calendar-prev-trigger.js +34 -0
- package/dist/components/data-display/calendar/components/calendar-root.js +154 -0
- package/dist/components/data-display/calendar/components/calendar-view-trigger.js +28 -0
- package/dist/components/data-display/calendar/components/calendar-weekdays.js +43 -0
- package/dist/components/data-display/calendar/index.js +30 -0
- package/dist/components/data-display/card/card.context.js +10 -0
- package/dist/components/data-display/card/card.styles.js +30 -0
- package/dist/components/data-display/card/components/card-body.js +19 -0
- package/dist/components/data-display/card/components/card-description.js +25 -0
- package/dist/components/data-display/card/components/card-footer.js +32 -0
- package/dist/components/data-display/card/components/card-header.js +37 -0
- package/dist/components/data-display/card/components/card-root.js +30 -0
- package/dist/components/data-display/card/components/card-title.js +25 -0
- package/dist/components/data-display/card/index.js +24 -0
- package/dist/components/data-display/data-list/components/data-list-item.js +20 -0
- package/dist/components/data-display/data-list/components/data-list-label.js +23 -0
- package/dist/components/data-display/data-list/components/data-list-root.js +11 -0
- package/dist/components/data-display/data-list/components/data-list-value.js +12 -0
- package/dist/components/data-display/data-list/data-list.context.js +12 -0
- package/dist/components/data-display/data-list/index.js +16 -0
- package/dist/components/data-display/image/components/image-group.js +79 -0
- package/dist/components/data-display/image/components/image-lightbox.js +188 -0
- package/dist/components/data-display/image/components/image-root.js +98 -0
- package/dist/components/data-display/image/components/image.constants.js +28 -0
- package/dist/components/data-display/image/index.js +11 -0
- package/dist/components/data-display/marquee/components/marquee-item.js +27 -0
- package/dist/components/data-display/marquee/components/marquee-root.js +130 -0
- package/dist/components/data-display/marquee/index.js +11 -0
- package/dist/components/data-display/qr-code/index.js +7 -0
- package/dist/components/data-display/qr-code/qr-code.js +203 -0
- package/dist/components/data-display/stat/components/stat-help-text.js +9 -0
- package/dist/components/data-display/stat/components/stat-indicator.js +23 -0
- package/dist/components/data-display/stat/components/stat-label.js +9 -0
- package/dist/components/data-display/stat/components/stat-root.js +10 -0
- package/dist/components/data-display/stat/components/stat-value.js +9 -0
- package/dist/components/data-display/stat/index.js +19 -0
- package/dist/components/data-display/stat/stat.context.js +6 -0
- package/dist/components/data-display/table/components/table-body.js +9 -0
- package/dist/components/data-display/table/components/table-caption.js +26 -0
- package/dist/components/data-display/table/components/table-cell.js +12 -0
- package/dist/components/data-display/table/components/table-footer.js +9 -0
- package/dist/components/data-display/table/components/table-head.js +20 -0
- package/dist/components/data-display/table/components/table-header.js +22 -0
- package/dist/components/data-display/table/components/table-root.js +20 -0
- package/dist/components/data-display/table/components/table-row.js +23 -0
- package/dist/components/data-display/table/index.js +28 -0
- package/dist/components/data-display/table/table.context.js +12 -0
- package/dist/components/data-display/table/table.styles.js +9 -0
- package/dist/components/data-display/tag/components/checkable-tag-group.js +37 -0
- package/dist/components/data-display/tag/components/checkable-tag.js +45 -0
- package/dist/components/data-display/tag/components/tag-root.js +52 -0
- package/dist/components/data-display/tag/index.js +14 -0
- package/dist/components/data-display/tag/tag.styles.js +27 -0
- package/dist/components/data-display/timeline/components/timeline-content.js +23 -0
- package/dist/components/data-display/timeline/components/timeline-indicator.js +21 -0
- package/dist/components/data-display/timeline/components/timeline-item.js +23 -0
- package/dist/components/data-display/timeline/components/timeline-root.js +12 -0
- package/dist/components/data-display/timeline/index.js +20 -0
- package/dist/components/data-display/timeline/timeline.context.js +18 -0
- package/dist/components/data-display/timeline/timeline.styles.js +33 -0
- package/dist/components/data-entry/checkbox/checkbox.context.js +12 -0
- package/dist/components/data-entry/checkbox/checkbox.styles.js +14 -0
- package/dist/components/data-entry/checkbox/components/checkbox-group.js +38 -0
- package/dist/components/data-entry/checkbox/components/checkbox.js +86 -0
- package/dist/components/data-entry/checkbox/index.js +11 -0
- package/dist/components/data-entry/combobox/combobox.js +178 -0
- package/dist/components/data-entry/field/components/field-error-text.js +47 -0
- package/dist/components/data-entry/field/components/field-help-text.js +30 -0
- package/dist/components/data-entry/field/components/field-label.js +35 -0
- package/dist/components/data-entry/field/components/field-root.js +45 -0
- package/dist/components/data-entry/field/field.context.js +10 -0
- package/dist/components/data-entry/field/index.js +17 -0
- package/dist/components/data-entry/input/components/input-group.js +15 -0
- package/dist/components/data-entry/input/components/input-password.js +42 -0
- package/dist/components/data-entry/input/components/input-search.js +48 -0
- package/dist/components/data-entry/input/components/input-textarea.js +53 -0
- package/dist/components/data-entry/input/components/input.js +44 -0
- package/dist/components/data-entry/input/index.js +18 -0
- package/dist/components/data-entry/input/input.context.js +13 -0
- package/dist/components/data-entry/input/input.styles.js +48 -0
- package/dist/components/data-entry/multi-select/components/multi-select.js +301 -0
- package/dist/components/data-entry/multi-select/multi-select.styles.js +47 -0
- package/dist/components/data-entry/number-input/number-input.js +97 -0
- package/dist/components/data-entry/pin-input/components/pin-input.js +127 -0
- package/dist/components/data-entry/pin-input/pin-input.styles.js +35 -0
- package/dist/components/data-entry/radio/components/radio-group.js +38 -0
- package/dist/components/data-entry/radio/components/radio.js +80 -0
- package/dist/components/data-entry/radio/index.js +11 -0
- package/dist/components/data-entry/radio/radio.context.js +10 -0
- package/dist/components/data-entry/radio/radio.styles.js +14 -0
- package/dist/components/data-entry/select/components/select.js +208 -0
- package/dist/components/data-entry/select/select.styles.js +35 -0
- package/dist/components/data-entry/shared/options.js +49 -0
- package/dist/components/data-entry/slider/components/slider.js +395 -0
- package/dist/components/data-entry/slider/slider.styles.js +15 -0
- package/dist/components/data-entry/switch/components/switch.js +86 -0
- package/dist/components/data-entry/switch/switch.styles.js +14 -0
- package/dist/components/disclosure/accordion/accordion.context.js +20 -0
- package/dist/components/disclosure/accordion/accordion.styles.js +84 -0
- package/dist/components/disclosure/accordion/components/accordion-content.js +26 -0
- package/dist/components/disclosure/accordion/components/accordion-item.js +30 -0
- package/dist/components/disclosure/accordion/components/accordion-root.js +80 -0
- package/dist/components/disclosure/accordion/components/accordion-trigger.js +49 -0
- package/dist/components/disclosure/accordion/index.js +16 -0
- package/dist/components/disclosure/carousel/carousel.context.js +18 -0
- package/dist/components/disclosure/carousel/carousel.styles.js +77 -0
- package/dist/components/disclosure/carousel/components/carousel-autoplay-trigger.js +25 -0
- package/dist/components/disclosure/carousel/components/carousel-control.js +12 -0
- package/dist/components/disclosure/carousel/components/carousel-indicator.js +22 -0
- package/dist/components/disclosure/carousel/components/carousel-indicators.js +32 -0
- package/dist/components/disclosure/carousel/components/carousel-next.js +24 -0
- package/dist/components/disclosure/carousel/components/carousel-prev.js +24 -0
- package/dist/components/disclosure/carousel/components/carousel-progress-text.js +21 -0
- package/dist/components/disclosure/carousel/components/carousel-root.js +129 -0
- package/dist/components/disclosure/carousel/components/carousel-slide.js +49 -0
- package/dist/components/disclosure/carousel/components/carousel-track.js +74 -0
- package/dist/components/disclosure/carousel/index.js +34 -0
- package/dist/components/disclosure/pagination/components/pagination-controls.js +79 -0
- package/dist/components/disclosure/pagination/components/pagination-ellipsis.js +11 -0
- package/dist/components/disclosure/pagination/components/pagination-item.js +24 -0
- package/dist/components/disclosure/pagination/components/pagination-jumper.js +35 -0
- package/dist/components/disclosure/pagination/components/pagination-list.js +9 -0
- package/dist/components/disclosure/pagination/components/pagination-page-text.js +18 -0
- package/dist/components/disclosure/pagination/components/pagination-pages.js +24 -0
- package/dist/components/disclosure/pagination/components/pagination-root.js +44 -0
- package/dist/components/disclosure/pagination/index.js +34 -0
- package/dist/components/disclosure/pagination/pagination.context.js +12 -0
- package/dist/components/disclosure/pagination/pagination.styles.js +84 -0
- package/dist/components/feedback/alert/alert.js +55 -0
- package/dist/components/feedback/alert/alert.styles.js +23 -0
- package/dist/components/feedback/progress/progress.js +112 -0
- package/dist/components/feedback/progress/progress.styles.js +25 -0
- package/dist/components/feedback/skeleton/skeleton.js +27 -0
- package/dist/components/feedback/skeleton/skeleton.styles.js +20 -0
- package/dist/components/feedback/spinner/spinner.js +32 -0
- package/dist/components/feedback/spinner/spinner.styles.js +17 -0
- package/dist/components/feedback/status.js +18 -0
- package/dist/components/feedback/toast/toast-store.js +35 -0
- package/dist/components/feedback/toast/toast.styles.js +20 -0
- package/dist/components/feedback/toast/toaster.js +65 -0
- package/dist/components/icon/icon.js +47 -0
- package/dist/components/icon/icon.styles.js +20 -0
- package/dist/components/icon/internal-icons.js +143 -0
- package/dist/components/layout/aspect-ratio/aspect-ratio.js +32 -0
- package/dist/components/layout/aspect-ratio/aspect-ratio.styles.js +18 -0
- package/dist/components/layout/box/box.js +30 -0
- package/dist/components/layout/box/box.styles.js +76 -0
- package/dist/components/layout/center/center.js +31 -0
- package/dist/components/layout/container/container.js +40 -0
- package/dist/components/layout/flex/flex-item.js +35 -0
- package/dist/components/layout/flex/flex.js +32 -0
- package/dist/components/layout/flex/flex.style.js +42 -0
- package/dist/components/layout/flex/index.js +11 -0
- package/dist/components/layout/float/float.js +32 -0
- package/dist/components/layout/float/float.styles.js +29 -0
- package/dist/components/layout/grid/grid-item.js +36 -0
- package/dist/components/layout/grid/grid.js +47 -0
- package/dist/components/layout/grid/grid.styles.js +43 -0
- package/dist/components/layout/grid/index.js +10 -0
- package/dist/components/layout/separator/separator.js +33 -0
- package/dist/components/layout/separator/separator.styles.js +29 -0
- package/dist/components/layout/stack/stack.js +24 -0
- package/dist/components/menu/components/menu-content.js +62 -0
- package/dist/components/menu/components/menu-parts.js +81 -0
- package/dist/components/menu/components/menu-root.js +36 -0
- package/dist/components/menu/index.js +15 -0
- package/dist/components/menu/menu.context.js +12 -0
- package/dist/components/menu/menu.styles.js +12 -0
- package/dist/components/navigation/breadcrumb/breadcrumb.js +50 -0
- package/dist/components/navigation/steps/components/steps-completed.js +12 -0
- package/dist/components/navigation/steps/components/steps-content.js +12 -0
- package/dist/components/navigation/steps/components/steps-description.js +13 -0
- package/dist/components/navigation/steps/components/steps-indicator.js +34 -0
- package/dist/components/navigation/steps/components/steps-item.js +112 -0
- package/dist/components/navigation/steps/components/steps-list.js +21 -0
- package/dist/components/navigation/steps/components/steps-next.js +25 -0
- package/dist/components/navigation/steps/components/steps-prev.js +25 -0
- package/dist/components/navigation/steps/components/steps-root.js +61 -0
- package/dist/components/navigation/steps/components/steps-title.js +13 -0
- package/dist/components/navigation/steps/index.js +34 -0
- package/dist/components/navigation/steps/steps.context.js +20 -0
- package/dist/components/navigation/steps/steps.styles.js +97 -0
- package/dist/components/navigation/tabs/components/tabs-content.js +26 -0
- package/dist/components/navigation/tabs/components/tabs-list.js +45 -0
- package/dist/components/navigation/tabs/components/tabs-root.js +54 -0
- package/dist/components/navigation/tabs/components/tabs-trigger.js +54 -0
- package/dist/components/navigation/tabs/index.js +16 -0
- package/dist/components/navigation/tabs/tabs.context.js +12 -0
- package/dist/components/navigation/tabs/tabs.styles.js +80 -0
- package/dist/components/overlay/drawer/components/drawer-content.js +48 -0
- package/dist/components/overlay/drawer/components/drawer-parts.js +48 -0
- package/dist/components/overlay/drawer/components/drawer-root.js +58 -0
- package/dist/components/overlay/drawer/drawer.context.js +12 -0
- package/dist/components/overlay/drawer/drawer.styles.js +32 -0
- package/dist/components/overlay/drawer/index.js +27 -0
- package/dist/components/overlay/modal/components/modal-content.js +48 -0
- package/dist/components/overlay/modal/components/modal-parts.js +48 -0
- package/dist/components/overlay/modal/components/modal-root.js +58 -0
- package/dist/components/overlay/modal/index.js +27 -0
- package/dist/components/overlay/modal/modal.context.js +12 -0
- package/dist/components/overlay/modal/modal.styles.js +31 -0
- package/dist/components/overlay/popover/components/popover-content.js +76 -0
- package/dist/components/overlay/popover/components/popover-parts.js +17 -0
- package/dist/components/overlay/popover/components/popover-root.js +71 -0
- package/dist/components/overlay/popover/index.js +19 -0
- package/dist/components/overlay/popover/popover.context.js +12 -0
- package/dist/components/overlay/popover/popover.styles.js +6 -0
- package/dist/components/overlay/portal.js +10 -0
- package/dist/components/overlay/tooltip/components/tooltip-content.js +52 -0
- package/dist/components/overlay/tooltip/components/tooltip-root.js +53 -0
- package/dist/components/overlay/tooltip/index.js +12 -0
- package/dist/components/overlay/tooltip/tooltip.context.js +12 -0
- package/dist/components/overlay/tooltip/tooltip.styles.js +6 -0
- package/dist/components/typography/blockquote/blockquote.js +39 -0
- package/dist/components/typography/blockquote/blockquote.styles.js +21 -0
- package/dist/components/typography/code/code.js +35 -0
- package/dist/components/typography/code/code.styles.js +26 -0
- package/dist/components/typography/code-block/code-block.js +57 -0
- package/dist/components/typography/code-block/code-block.styles.js +36 -0
- package/dist/components/typography/heading/heading.js +21 -0
- package/dist/components/typography/highlight/highlight.js +30 -0
- package/dist/components/typography/highlight/highlight.styles.js +18 -0
- package/dist/components/typography/kbd/kbd.js +26 -0
- package/dist/components/typography/link/link.js +48 -0
- package/dist/components/typography/list/index.js +10 -0
- package/dist/components/typography/list/list-item.js +37 -0
- package/dist/components/typography/list/list.js +35 -0
- package/dist/components/typography/list/list.styles.js +35 -0
- package/dist/components/typography/text/text.js +80 -0
- package/dist/components/typography/text/text.styles.js +110 -0
- package/dist/const/color-mappings.js +541 -0
- package/dist/const/color-schemes.js +5 -0
- package/dist/const/common-mappings.js +127 -0
- package/dist/const/layout-mappings.js +446 -0
- package/dist/const/positioning-mappings.js +164 -0
- package/dist/const/rounded-mappings.js +121 -0
- package/dist/const/sizing-mappings.js +1113 -0
- package/dist/const/spacing-mappings.js +508 -0
- package/dist/hooks/use-anchor-position.js +39 -0
- package/dist/hooks/use-controllable-state.js +18 -0
- package/dist/hooks/use-dismiss.js +23 -0
- package/dist/hooks/use-overlay-behavior.js +42 -0
- package/dist/hooks/use-prefers-reduced-motion.js +15 -0
- package/dist/hooks/use-presence.js +18 -0
- package/dist/hooks/use-roving-focus.js +51 -0
- package/dist/index.d.ts +3533 -0
- package/dist/index.js +359 -0
- package/dist/styles.css +2 -0
- package/dist/theme/provider.js +130 -0
- package/dist/utils/astralis-merge.js +31 -0
- package/dist/utils/overlay-stack.js +27 -0
- package/dist/utils/responsive.js +32 -0
- package/dist/utils/split-variant-props.js +13 -0
- package/package.json +107 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as h } from "react/jsx-runtime";
|
|
3
|
+
import { useId as q, useState as v, useCallback as f, useMemo as E } from "react";
|
|
4
|
+
import { AccordionContext as H } from "../accordion.context.js";
|
|
5
|
+
import { accordionRootVariants as M } from "../accordion.styles.js";
|
|
6
|
+
import { astralisMerge as N } from "../../../../utils/astralis-merge.js";
|
|
7
|
+
import { accentClass as T } from "../../../../const/color-schemes.js";
|
|
8
|
+
function Q({
|
|
9
|
+
children: V,
|
|
10
|
+
type: s = "single",
|
|
11
|
+
variant: l = "enclosed",
|
|
12
|
+
size: i = "md",
|
|
13
|
+
colorScheme: b = "gray",
|
|
14
|
+
value: a,
|
|
15
|
+
defaultValue: C,
|
|
16
|
+
collapsible: u = !1,
|
|
17
|
+
disabled: d = !1,
|
|
18
|
+
keepMounted: g = !1,
|
|
19
|
+
indicator: m,
|
|
20
|
+
indicatorPosition: y = "end",
|
|
21
|
+
hideIndicator: A = !1,
|
|
22
|
+
headingLevel: p = 3,
|
|
23
|
+
onValueChange: x,
|
|
24
|
+
className: I = ""
|
|
25
|
+
}) {
|
|
26
|
+
const w = q(), [K, O] = v(C), e = a ?? K, k = f(
|
|
27
|
+
(r) => s === "multiple" ? Array.isArray(e) && e.includes(r) : e === r,
|
|
28
|
+
[s, e]
|
|
29
|
+
), D = f(
|
|
30
|
+
(r) => {
|
|
31
|
+
let o;
|
|
32
|
+
if (s === "multiple") {
|
|
33
|
+
const t = Array.isArray(e) ? e : [];
|
|
34
|
+
o = t.includes(r) ? t.filter((n) => n !== r) : [...t, r];
|
|
35
|
+
} else
|
|
36
|
+
o = e === r && u ? "" : r;
|
|
37
|
+
a === void 0 && O(o), x?.(o);
|
|
38
|
+
},
|
|
39
|
+
[s, e, u, x, a]
|
|
40
|
+
), R = f((r) => {
|
|
41
|
+
const o = r.target;
|
|
42
|
+
if (!o.matches('button[data-accordion-trigger="true"]')) return;
|
|
43
|
+
const t = Array.from(
|
|
44
|
+
r.currentTarget.querySelectorAll(
|
|
45
|
+
'button[data-accordion-trigger="true"]:not([disabled])'
|
|
46
|
+
)
|
|
47
|
+
), n = t.indexOf(o);
|
|
48
|
+
if (n === -1) return;
|
|
49
|
+
const c = (j) => {
|
|
50
|
+
r.preventDefault(), t[(j + t.length) % t.length]?.focus();
|
|
51
|
+
};
|
|
52
|
+
r.key === "ArrowDown" ? c(n + 1) : r.key === "ArrowUp" ? c(n - 1) : r.key === "Home" ? c(0) : r.key === "End" && c(t.length - 1);
|
|
53
|
+
}, []), S = E(
|
|
54
|
+
() => ({
|
|
55
|
+
isOpen: k,
|
|
56
|
+
toggle: D,
|
|
57
|
+
rootId: w,
|
|
58
|
+
variant: l,
|
|
59
|
+
size: i,
|
|
60
|
+
disabled: d,
|
|
61
|
+
keepMounted: g,
|
|
62
|
+
indicator: m,
|
|
63
|
+
indicatorPosition: y,
|
|
64
|
+
hideIndicator: A,
|
|
65
|
+
headingLevel: p
|
|
66
|
+
}),
|
|
67
|
+
[k, D, w, l, i, d, g, m, y, A, p]
|
|
68
|
+
);
|
|
69
|
+
return /* @__PURE__ */ h(H.Provider, { value: S, children: /* @__PURE__ */ h(
|
|
70
|
+
"div",
|
|
71
|
+
{
|
|
72
|
+
onKeyDown: R,
|
|
73
|
+
className: N(M({ variant: l }), T(b), I),
|
|
74
|
+
children: V
|
|
75
|
+
}
|
|
76
|
+
) });
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
Q as AccordionRoot
|
|
80
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as t, jsxs as h } from "react/jsx-runtime";
|
|
3
|
+
import { useAccordion as I, useAccordionItem as x } from "../accordion.context.js";
|
|
4
|
+
import { accordionIndicatorVariants as v, accordionTriggerVariants as z } from "../accordion.styles.js";
|
|
5
|
+
import { astralisMerge as N } from "../../../../utils/astralis-merge.js";
|
|
6
|
+
import b from "../../../icon/icon.js";
|
|
7
|
+
import { ChevronDownIcon as A } from "../../../icon/internal-icons.js";
|
|
8
|
+
const j = { sm: "xs", md: "sm", lg: "md" };
|
|
9
|
+
function y({
|
|
10
|
+
children: e,
|
|
11
|
+
indicator: s,
|
|
12
|
+
hideIndicator: c,
|
|
13
|
+
className: d = ""
|
|
14
|
+
}) {
|
|
15
|
+
const i = I(), { value: l, open: o, disabled: a, triggerId: m, contentId: g } = x(), p = `h${i.headingLevel}`, u = c ?? i.hideIndicator;
|
|
16
|
+
let r = null;
|
|
17
|
+
if (!u) {
|
|
18
|
+
const f = s ?? i.indicator;
|
|
19
|
+
r = /* @__PURE__ */ t("span", { className: v({ open: o }), "aria-hidden": !0, children: f ?? /* @__PURE__ */ t(b, { size: j[i.size], children: /* @__PURE__ */ t(A, {}) }) });
|
|
20
|
+
}
|
|
21
|
+
const n = i.indicatorPosition === "start";
|
|
22
|
+
return /* @__PURE__ */ t(p, { className: "astralis:m-0", children: /* @__PURE__ */ h(
|
|
23
|
+
"button",
|
|
24
|
+
{
|
|
25
|
+
type: "button",
|
|
26
|
+
id: m,
|
|
27
|
+
"data-accordion-trigger": "true",
|
|
28
|
+
"data-state": o ? "open" : "closed",
|
|
29
|
+
disabled: a,
|
|
30
|
+
"aria-expanded": o,
|
|
31
|
+
"aria-controls": g,
|
|
32
|
+
onClick: () => {
|
|
33
|
+
a || i.toggle(l);
|
|
34
|
+
},
|
|
35
|
+
className: N(
|
|
36
|
+
z({ size: i.size, variant: i.variant, open: o }),
|
|
37
|
+
d
|
|
38
|
+
),
|
|
39
|
+
children: [
|
|
40
|
+
n && r,
|
|
41
|
+
/* @__PURE__ */ t("span", { className: "astralis:flex-1 astralis:text-left", children: e }),
|
|
42
|
+
!n && r
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
) });
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
y as AccordionTrigger
|
|
49
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { AccordionRoot as o } from "./components/accordion-root.js";
|
|
3
|
+
import { AccordionItem as r } from "./components/accordion-item.js";
|
|
4
|
+
import { AccordionTrigger as t } from "./components/accordion-trigger.js";
|
|
5
|
+
import { AccordionContent as c } from "./components/accordion-content.js";
|
|
6
|
+
const d = Object.assign(o, {
|
|
7
|
+
Item: r,
|
|
8
|
+
Trigger: t,
|
|
9
|
+
Content: c
|
|
10
|
+
});
|
|
11
|
+
export {
|
|
12
|
+
d as Accordion,
|
|
13
|
+
c as AccordionContent,
|
|
14
|
+
r as AccordionItem,
|
|
15
|
+
t as AccordionTrigger
|
|
16
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useContext as t, createContext as o } from "react";
|
|
3
|
+
const n = o(null);
|
|
4
|
+
function s() {
|
|
5
|
+
const e = t(n);
|
|
6
|
+
if (!e) throw new Error("Carousel sub-components must be used within <Carousel>");
|
|
7
|
+
return e;
|
|
8
|
+
}
|
|
9
|
+
const r = o(0);
|
|
10
|
+
function C() {
|
|
11
|
+
return t(r);
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
n as CarouselContext,
|
|
15
|
+
r as CarouselItemContext,
|
|
16
|
+
s as useCarousel,
|
|
17
|
+
C as useCarouselItemIndex
|
|
18
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cva as s } from "class-variance-authority";
|
|
3
|
+
const a = "astralis:outline-none astralis:focus-visible:outline-2 astralis:focus-visible:outline-offset-2 astralis:focus-visible:outline-accent-ring", i = s(
|
|
4
|
+
`astralis:inline-flex astralis:items-center astralis:justify-center astralis:shrink-0 astralis:rounded-full astralis:cursor-pointer astralis:bg-surface-base astralis:text-label-base astralis:border-normal astralis:border-stroke-subtle astralis:shadow-md astralis:transition-colors astralis:hover:bg-surface-muted astralis:disabled:opacity-moderate astralis:disabled:cursor-not-allowed ${a}`,
|
|
5
|
+
{
|
|
6
|
+
variants: {
|
|
7
|
+
size: {
|
|
8
|
+
sm: "astralis:size-7",
|
|
9
|
+
md: "astralis:size-9",
|
|
10
|
+
lg: "astralis:size-11"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: { size: "md" }
|
|
14
|
+
}
|
|
15
|
+
), r = { sm: "xs", md: "sm", lg: "md" }, l = s("astralis:flex astralis:gap-4", {
|
|
16
|
+
variants: {
|
|
17
|
+
orientation: {
|
|
18
|
+
horizontal: "astralis:flex-row astralis:items-center astralis:justify-center astralis:mt-4",
|
|
19
|
+
vertical: "astralis:flex-col astralis:items-center astralis:justify-between"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
defaultVariants: { orientation: "horizontal" }
|
|
23
|
+
}), e = s(
|
|
24
|
+
"astralis:flex astralis:items-center astralis:justify-center astralis:gap-2",
|
|
25
|
+
{
|
|
26
|
+
variants: {
|
|
27
|
+
orientation: { horizontal: "astralis:flex-row", vertical: "astralis:flex-col" }
|
|
28
|
+
},
|
|
29
|
+
defaultVariants: { orientation: "horizontal" }
|
|
30
|
+
}
|
|
31
|
+
), o = s(
|
|
32
|
+
`astralis:rounded-full astralis:cursor-pointer astralis:transition-all astralis:duration-moderate ${a}`,
|
|
33
|
+
{
|
|
34
|
+
variants: {
|
|
35
|
+
size: { sm: "astralis:h-1.5", md: "astralis:h-2", lg: "astralis:h-2.5" },
|
|
36
|
+
active: {
|
|
37
|
+
true: "astralis:bg-accent-solid",
|
|
38
|
+
false: "astralis:bg-surface-emphasized astralis:hover:bg-surface-muted"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
compoundVariants: [
|
|
42
|
+
{ size: "sm", active: !0, class: "astralis:w-5" },
|
|
43
|
+
{ size: "sm", active: !1, class: "astralis:w-1.5" },
|
|
44
|
+
{ size: "md", active: !0, class: "astralis:w-6" },
|
|
45
|
+
{ size: "md", active: !1, class: "astralis:w-2" },
|
|
46
|
+
{ size: "lg", active: !0, class: "astralis:w-8" },
|
|
47
|
+
{ size: "lg", active: !1, class: "astralis:w-2.5" }
|
|
48
|
+
],
|
|
49
|
+
defaultVariants: { size: "md", active: !1 }
|
|
50
|
+
}
|
|
51
|
+
), n = s(
|
|
52
|
+
`astralis:shrink-0 astralis:rounded-full astralis:cursor-pointer astralis:transition-colors astralis:duration-moderate ${a}`,
|
|
53
|
+
{
|
|
54
|
+
variants: {
|
|
55
|
+
orientation: {
|
|
56
|
+
horizontal: "astralis:h-1 astralis:w-8",
|
|
57
|
+
vertical: "astralis:w-1 astralis:h-8"
|
|
58
|
+
},
|
|
59
|
+
active: {
|
|
60
|
+
true: "astralis:bg-accent-solid",
|
|
61
|
+
false: "astralis:bg-surface-emphasized astralis:hover:bg-surface-muted"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
defaultVariants: { orientation: "horizontal", active: !1 }
|
|
65
|
+
}
|
|
66
|
+
), c = s(
|
|
67
|
+
"astralis:text-sm astralis:font-medium astralis:tabular-nums astralis:text-label-muted"
|
|
68
|
+
);
|
|
69
|
+
export {
|
|
70
|
+
l as carouselControlGroupVariants,
|
|
71
|
+
i as carouselControlVariants,
|
|
72
|
+
o as carouselDotVariants,
|
|
73
|
+
e as carouselIndicatorsVariants,
|
|
74
|
+
n as carouselLineVariants,
|
|
75
|
+
c as carouselProgressVariants,
|
|
76
|
+
r as controlIconSize
|
|
77
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
3
|
+
import { useCarousel as s } from "../carousel.context.js";
|
|
4
|
+
import { controlIconSize as n, carouselControlVariants as u } from "../carousel.styles.js";
|
|
5
|
+
import { astralisMerge as m } from "../../../../utils/astralis-merge.js";
|
|
6
|
+
import c from "../../../icon/icon.js";
|
|
7
|
+
import { PauseIcon as p, PlayIcon as f } from "../../../icon/internal-icons.js";
|
|
8
|
+
function I({ className: e = "", children: t }) {
|
|
9
|
+
const { isPlaying: o, toggleAutoPlay: i, disabled: l, size: a } = s();
|
|
10
|
+
return /* @__PURE__ */ r(
|
|
11
|
+
"button",
|
|
12
|
+
{
|
|
13
|
+
type: "button",
|
|
14
|
+
"aria-label": o ? "Pause autoplay" : "Start autoplay",
|
|
15
|
+
"aria-pressed": o,
|
|
16
|
+
disabled: l,
|
|
17
|
+
onClick: i,
|
|
18
|
+
className: m(u({ size: a }), e),
|
|
19
|
+
children: t ? t(o) : /* @__PURE__ */ r(c, { size: n[a], children: o ? /* @__PURE__ */ r(p, {}) : /* @__PURE__ */ r(f, {}) })
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
I as CarouselAutoPlayTrigger
|
|
25
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import { useCarousel as s } from "../carousel.context.js";
|
|
4
|
+
import { carouselControlGroupVariants as i } from "../carousel.styles.js";
|
|
5
|
+
import { astralisMerge as a } from "../../../../utils/astralis-merge.js";
|
|
6
|
+
function p({ children: o, className: r = "" }) {
|
|
7
|
+
const { orientation: t } = s();
|
|
8
|
+
return /* @__PURE__ */ e("div", { className: a(i({ orientation: t }), r), children: o });
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
p as CarouselControl
|
|
12
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
3
|
+
import { useCarousel as n } from "../carousel.context.js";
|
|
4
|
+
import { carouselDotVariants as c } from "../carousel.styles.js";
|
|
5
|
+
import { astralisMerge as u } from "../../../../utils/astralis-merge.js";
|
|
6
|
+
function b({ index: t, className: e = "" }) {
|
|
7
|
+
const { index: r, setIndex: a, slideCount: s, size: i } = n(), o = t === r;
|
|
8
|
+
return /* @__PURE__ */ l(
|
|
9
|
+
"button",
|
|
10
|
+
{
|
|
11
|
+
type: "button",
|
|
12
|
+
role: "tab",
|
|
13
|
+
"aria-label": `Go to slide ${t + 1} of ${s}`,
|
|
14
|
+
"aria-selected": o,
|
|
15
|
+
onClick: () => a(t),
|
|
16
|
+
className: u(c({ size: i, active: o }), e)
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
b as CarouselIndicator
|
|
22
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as p, jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import { useCarousel as x } from "../carousel.context.js";
|
|
4
|
+
import { carouselProgressVariants as C, carouselLineVariants as M, carouselDotVariants as I, carouselIndicatorsVariants as V } from "../carousel.styles.js";
|
|
5
|
+
import { astralisMerge as d } from "../../../../utils/astralis-merge.js";
|
|
6
|
+
function j({ className: s = "", variant: i = "dot" }) {
|
|
7
|
+
const { slideCount: m, index: f, setIndex: b, lastIndex: l, slidesToScroll: a, orientation: n, size: g } = x();
|
|
8
|
+
if (m <= 1) return null;
|
|
9
|
+
const e = Math.floor(l / a) + 1, c = Math.min(Math.round(f / a), e - 1), h = (u) => b(Math.min(u * a, l));
|
|
10
|
+
return i === "number" ? /* @__PURE__ */ p("div", { "aria-label": "Slide progress", className: d(C(), s), children: [
|
|
11
|
+
c + 1,
|
|
12
|
+
/* @__PURE__ */ o("span", { className: "astralis:mx-1", children: "/" }),
|
|
13
|
+
e
|
|
14
|
+
] }) : /* @__PURE__ */ o("div", { role: "tablist", "aria-label": "Slides", className: d(V({ orientation: n }), s), children: Array.from({ length: e }).map((u, r) => {
|
|
15
|
+
const t = r === c;
|
|
16
|
+
return /* @__PURE__ */ o(
|
|
17
|
+
"button",
|
|
18
|
+
{
|
|
19
|
+
type: "button",
|
|
20
|
+
role: "tab",
|
|
21
|
+
"aria-label": `Go to slide ${r + 1} of ${e}`,
|
|
22
|
+
"aria-selected": t,
|
|
23
|
+
onClick: () => h(r),
|
|
24
|
+
className: i === "line" ? M({ orientation: n, active: t }) : I({ size: g, active: t })
|
|
25
|
+
},
|
|
26
|
+
r
|
|
27
|
+
);
|
|
28
|
+
}) });
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
j as CarouselIndicators
|
|
32
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import { useCarousel as u } from "../carousel.context.js";
|
|
4
|
+
import { controlIconSize as f, carouselControlVariants as x } from "../carousel.styles.js";
|
|
5
|
+
import { astralisMerge as b } from "../../../../utils/astralis-merge.js";
|
|
6
|
+
import C from "../../../icon/icon.js";
|
|
7
|
+
import { ChevronDownIcon as I, ChevronRightIcon as h } from "../../../icon/internal-icons.js";
|
|
8
|
+
function V({ icon: t, className: i = "" }) {
|
|
9
|
+
const { index: e, setIndex: n, slidesToScroll: s, lastIndex: l, orientation: a, disabled: c, loop: m, size: r } = u(), d = a === "vertical", p = !m && (c || e >= l);
|
|
10
|
+
return /* @__PURE__ */ o(
|
|
11
|
+
"button",
|
|
12
|
+
{
|
|
13
|
+
type: "button",
|
|
14
|
+
"aria-label": "Next slide",
|
|
15
|
+
disabled: p,
|
|
16
|
+
onClick: () => n(e + s),
|
|
17
|
+
className: b(x({ size: r }), i),
|
|
18
|
+
children: t ?? /* @__PURE__ */ o(C, { size: f[r], children: d ? /* @__PURE__ */ o(I, {}) : /* @__PURE__ */ o(h, {}) })
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
V as CarouselNext
|
|
24
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import { useCarousel as p } from "../carousel.context.js";
|
|
4
|
+
import { controlIconSize as u, carouselControlVariants as f } from "../carousel.styles.js";
|
|
5
|
+
import { astralisMerge as b } from "../../../../utils/astralis-merge.js";
|
|
6
|
+
import C from "../../../icon/icon.js";
|
|
7
|
+
import { ChevronUpIcon as v, ChevronLeftIcon as I } from "../../../icon/internal-icons.js";
|
|
8
|
+
function g({ icon: i, className: t = "" }) {
|
|
9
|
+
const { index: e, setIndex: s, slidesToScroll: n, orientation: l, disabled: a, loop: c, size: r } = p(), m = l === "vertical", d = !c && (a || e <= 0);
|
|
10
|
+
return /* @__PURE__ */ o(
|
|
11
|
+
"button",
|
|
12
|
+
{
|
|
13
|
+
type: "button",
|
|
14
|
+
"aria-label": "Previous slide",
|
|
15
|
+
disabled: d,
|
|
16
|
+
onClick: () => s(e - n),
|
|
17
|
+
className: b(f({ size: r }), t),
|
|
18
|
+
children: i ?? /* @__PURE__ */ o(C, { size: u[r], children: m ? /* @__PURE__ */ o(v, {}) : /* @__PURE__ */ o(I, {}) })
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
g as CarouselPrev
|
|
24
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
3
|
+
import { useCarousel as a } from "../carousel.context.js";
|
|
4
|
+
import { carouselProgressVariants as t } from "../carousel.styles.js";
|
|
5
|
+
import { astralisMerge as l } from "../../../../utils/astralis-merge.js";
|
|
6
|
+
function p({ className: o = "", format: i }) {
|
|
7
|
+
const { index: r, slideCount: e } = a();
|
|
8
|
+
return /* @__PURE__ */ s(
|
|
9
|
+
"div",
|
|
10
|
+
{
|
|
11
|
+
"aria-live": "polite",
|
|
12
|
+
"aria-atomic": "true",
|
|
13
|
+
"aria-label": `Slide ${r + 1} of ${e}`,
|
|
14
|
+
className: l(t(), o),
|
|
15
|
+
children: i ? i(r, e) : `${r + 1} / ${e}`
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
p as CarouselProgressText
|
|
21
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as j } from "react/jsx-runtime";
|
|
3
|
+
import { useState as R, useEffect as N, useRef as H, useCallback as f, useMemo as O } from "react";
|
|
4
|
+
import { usePrefersReducedMotion as T } from "../../../../hooks/use-prefers-reduced-motion.js";
|
|
5
|
+
import { CarouselContext as S } from "../carousel.context.js";
|
|
6
|
+
import { astralisMerge as b } from "../../../../utils/astralis-merge.js";
|
|
7
|
+
import { accentClass as tt } from "../../../../const/color-schemes.js";
|
|
8
|
+
function it({
|
|
9
|
+
index: l,
|
|
10
|
+
defaultIndex: q = 0,
|
|
11
|
+
onIndexChange: M,
|
|
12
|
+
beforeChange: K,
|
|
13
|
+
afterChange: w,
|
|
14
|
+
slidesPerView: z = 1,
|
|
15
|
+
slidesToScroll: u = 1,
|
|
16
|
+
slideGap: P = 0,
|
|
17
|
+
loop: n = !1,
|
|
18
|
+
autoPlay: x = !1,
|
|
19
|
+
autoPlayInterval: k = 3e3,
|
|
20
|
+
pauseOnHover: p = !0,
|
|
21
|
+
animation: y = "slide",
|
|
22
|
+
orientation: o = "horizontal",
|
|
23
|
+
speed: m = 300,
|
|
24
|
+
easing: E = "ease-out",
|
|
25
|
+
disabled: i = !1,
|
|
26
|
+
swipeable: L = !0,
|
|
27
|
+
draggable: g = !1,
|
|
28
|
+
size: C = "md",
|
|
29
|
+
colorScheme: B = "brand",
|
|
30
|
+
className: F = "",
|
|
31
|
+
style: I,
|
|
32
|
+
children: J
|
|
33
|
+
}) {
|
|
34
|
+
const [Q, U] = R(q), [a, W] = R(0), [v, h] = R(x);
|
|
35
|
+
N(() => {
|
|
36
|
+
h(x);
|
|
37
|
+
}, [x]);
|
|
38
|
+
const e = l ?? Q, A = H(!1), D = y === "fade" ? 1 : z, s = Math.max(0, Math.ceil(a - D)), c = f(
|
|
39
|
+
(t) => {
|
|
40
|
+
if (i) return;
|
|
41
|
+
const r = n ? t > s ? 0 : t < 0 ? s : t : Math.min(Math.max(0, t), s);
|
|
42
|
+
r !== e && (K?.(e, r), l === void 0 && U(r), M?.(r), w && setTimeout(() => w(r), m));
|
|
43
|
+
},
|
|
44
|
+
[i, n, s, e, l, M, K, w, m]
|
|
45
|
+
), V = T();
|
|
46
|
+
N(() => {
|
|
47
|
+
if (!v || i || V || a <= 1) return;
|
|
48
|
+
const t = setTimeout(() => {
|
|
49
|
+
if (A.current) return;
|
|
50
|
+
if (!n && e >= s) {
|
|
51
|
+
h(!1);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const r = e >= s ? 0 : e + u;
|
|
55
|
+
l === void 0 && U(r), M?.(r);
|
|
56
|
+
}, k);
|
|
57
|
+
return () => clearTimeout(t);
|
|
58
|
+
}, [v, i, V, e, a, s, n, u, k]);
|
|
59
|
+
const d = f(() => h((t) => !t), []), X = f(() => {
|
|
60
|
+
p && (A.current = !0);
|
|
61
|
+
}, [p]), Y = f(() => {
|
|
62
|
+
A.current = !1;
|
|
63
|
+
}, []), Z = f(
|
|
64
|
+
(t) => {
|
|
65
|
+
const r = o === "vertical" ? "ArrowUp" : "ArrowLeft", G = o === "vertical" ? "ArrowDown" : "ArrowRight";
|
|
66
|
+
t.key === r ? (t.preventDefault(), c(e - u)) : t.key === G && (t.preventDefault(), c(e + u));
|
|
67
|
+
},
|
|
68
|
+
[o, c, e, u]
|
|
69
|
+
), _ = O(
|
|
70
|
+
() => ({
|
|
71
|
+
index: e,
|
|
72
|
+
setIndex: c,
|
|
73
|
+
slideCount: a,
|
|
74
|
+
setSlideCount: W,
|
|
75
|
+
lastIndex: s,
|
|
76
|
+
slidesPerView: D,
|
|
77
|
+
slidesToScroll: u,
|
|
78
|
+
slideGap: P,
|
|
79
|
+
orientation: o,
|
|
80
|
+
animation: y,
|
|
81
|
+
speed: m,
|
|
82
|
+
easing: E,
|
|
83
|
+
size: C,
|
|
84
|
+
loop: n,
|
|
85
|
+
disabled: i,
|
|
86
|
+
swipeable: L,
|
|
87
|
+
draggable: g,
|
|
88
|
+
isPlaying: v,
|
|
89
|
+
toggleAutoPlay: d
|
|
90
|
+
}),
|
|
91
|
+
[
|
|
92
|
+
e,
|
|
93
|
+
c,
|
|
94
|
+
a,
|
|
95
|
+
s,
|
|
96
|
+
D,
|
|
97
|
+
u,
|
|
98
|
+
P,
|
|
99
|
+
o,
|
|
100
|
+
y,
|
|
101
|
+
m,
|
|
102
|
+
E,
|
|
103
|
+
C,
|
|
104
|
+
n,
|
|
105
|
+
i,
|
|
106
|
+
L,
|
|
107
|
+
g,
|
|
108
|
+
v,
|
|
109
|
+
d
|
|
110
|
+
]
|
|
111
|
+
), $ = o === "vertical" ? "astralis:relative astralis:flex astralis:w-full astralis:gap-3 astralis:items-stretch" : "astralis:relative astralis:w-full";
|
|
112
|
+
return /* @__PURE__ */ j(S.Provider, { value: _, children: /* @__PURE__ */ j(
|
|
113
|
+
"div",
|
|
114
|
+
{
|
|
115
|
+
role: "region",
|
|
116
|
+
"aria-roledescription": "carousel",
|
|
117
|
+
tabIndex: 0,
|
|
118
|
+
onKeyDown: Z,
|
|
119
|
+
onMouseEnter: X,
|
|
120
|
+
onMouseLeave: Y,
|
|
121
|
+
className: b($, "astralis:outline-none", tt(B), F),
|
|
122
|
+
style: I,
|
|
123
|
+
children: J
|
|
124
|
+
}
|
|
125
|
+
) });
|
|
126
|
+
}
|
|
127
|
+
export {
|
|
128
|
+
it as CarouselRoot
|
|
129
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
3
|
+
import { useCarousel as g, useCarouselItemIndex as h } from "../carousel.context.js";
|
|
4
|
+
function C({ children: r, className: n = "" }) {
|
|
5
|
+
const { index: a, slideCount: o, slidesPerView: e, slideGap: c, orientation: u, animation: p, speed: m, easing: f } = g(), i = h(), $ = u === "vertical";
|
|
6
|
+
if (p === "fade") {
|
|
7
|
+
const t = i === a;
|
|
8
|
+
return /* @__PURE__ */ d(
|
|
9
|
+
"div",
|
|
10
|
+
{
|
|
11
|
+
role: "group",
|
|
12
|
+
"aria-roledescription": "slide",
|
|
13
|
+
"aria-label": `Slide ${i + 1} of ${o}`,
|
|
14
|
+
"aria-hidden": !t,
|
|
15
|
+
inert: !t,
|
|
16
|
+
className: n,
|
|
17
|
+
style: {
|
|
18
|
+
gridArea: "1 / 1",
|
|
19
|
+
opacity: t ? 1 : 0,
|
|
20
|
+
zIndex: t ? 1 : 0,
|
|
21
|
+
transitionProperty: "opacity",
|
|
22
|
+
transitionDuration: `${m}ms`,
|
|
23
|
+
transitionTimingFunction: f
|
|
24
|
+
},
|
|
25
|
+
children: r
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
const s = Math.min(a, Math.max(0, o - e)), l = i >= Math.floor(s) && i < s + e, x = {
|
|
30
|
+
flex: `0 0 ${`calc((100% - ${e - 1} * ${c}px) / ${e})`}`,
|
|
31
|
+
...$ ? { minHeight: 0 } : { minWidth: 0 }
|
|
32
|
+
};
|
|
33
|
+
return /* @__PURE__ */ d(
|
|
34
|
+
"div",
|
|
35
|
+
{
|
|
36
|
+
role: "group",
|
|
37
|
+
"aria-roledescription": "slide",
|
|
38
|
+
"aria-label": `Slide ${i + 1} of ${o}`,
|
|
39
|
+
"aria-hidden": !l,
|
|
40
|
+
inert: !l,
|
|
41
|
+
className: n,
|
|
42
|
+
style: x,
|
|
43
|
+
children: r
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
C as CarouselSlide
|
|
49
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import { Children as N, useEffect as R, useRef as V } from "react";
|
|
4
|
+
import { useCarousel as X, CarouselItemContext as Y } from "../carousel.context.js";
|
|
5
|
+
import { astralisMerge as C } from "../../../../utils/astralis-merge.js";
|
|
6
|
+
function L({ children: M, className: i = "" }) {
|
|
7
|
+
const {
|
|
8
|
+
index: o,
|
|
9
|
+
setIndex: S,
|
|
10
|
+
setSlideCount: c,
|
|
11
|
+
slideCount: T,
|
|
12
|
+
slidesPerView: u,
|
|
13
|
+
slidesToScroll: d,
|
|
14
|
+
slideGap: n,
|
|
15
|
+
orientation: b,
|
|
16
|
+
animation: y,
|
|
17
|
+
speed: P,
|
|
18
|
+
easing: D,
|
|
19
|
+
swipeable: E,
|
|
20
|
+
draggable: f
|
|
21
|
+
} = X(), s = b === "vertical", m = N.toArray(M), h = m.length;
|
|
22
|
+
R(() => c(h), [h, c]);
|
|
23
|
+
const p = m.map((e, r) => /* @__PURE__ */ a(Y.Provider, { value: r, children: e }, r)), t = V(null), l = (e) => s ? e.clientY : e.clientX, x = (e) => {
|
|
24
|
+
t.current = e;
|
|
25
|
+
}, v = (e) => {
|
|
26
|
+
if (t.current === null) return;
|
|
27
|
+
const r = t.current - e;
|
|
28
|
+
t.current = null, Math.abs(r) > 50 && S(o + (r > 0 ? d : -d));
|
|
29
|
+
}, g = {
|
|
30
|
+
...E && {
|
|
31
|
+
onTouchStart: (e) => x(l(e.touches[0])),
|
|
32
|
+
onTouchEnd: (e) => v(l(e.changedTouches[0]))
|
|
33
|
+
},
|
|
34
|
+
...f && {
|
|
35
|
+
onMouseDown: (e) => x(l(e)),
|
|
36
|
+
onMouseUp: (e) => v(l(e)),
|
|
37
|
+
onMouseLeave: () => {
|
|
38
|
+
t.current = null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}, w = f ? { cursor: "grab", userSelect: "none" } : {};
|
|
42
|
+
if (y === "fade")
|
|
43
|
+
return /* @__PURE__ */ a(
|
|
44
|
+
"div",
|
|
45
|
+
{
|
|
46
|
+
"aria-live": "polite",
|
|
47
|
+
className: C("astralis:relative astralis:grid astralis:overflow-hidden", s ? "astralis:flex-1" : "astralis:w-full", i),
|
|
48
|
+
style: w,
|
|
49
|
+
...g,
|
|
50
|
+
children: p
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
const I = Math.max(0, T - u), $ = `calc(-1 * ${Math.min(o, I)} * (100% + ${n}px) / ${u})`;
|
|
54
|
+
return /* @__PURE__ */ a("div", { className: C("astralis:overflow-hidden", s ? "astralis:h-full astralis:flex-1" : "astralis:w-full", i), children: /* @__PURE__ */ a(
|
|
55
|
+
"div",
|
|
56
|
+
{
|
|
57
|
+
"aria-live": "polite",
|
|
58
|
+
className: `astralis:flex ${s ? "astralis:flex-col astralis:h-full" : "astralis:flex-row astralis:w-full"}`,
|
|
59
|
+
style: {
|
|
60
|
+
gap: n ? `${n}px` : void 0,
|
|
61
|
+
transform: s ? `translateY(${$})` : `translateX(${$})`,
|
|
62
|
+
transitionProperty: "transform",
|
|
63
|
+
transitionDuration: `${P}ms`,
|
|
64
|
+
transitionTimingFunction: D,
|
|
65
|
+
...w
|
|
66
|
+
},
|
|
67
|
+
...g,
|
|
68
|
+
children: p
|
|
69
|
+
}
|
|
70
|
+
) });
|
|
71
|
+
}
|
|
72
|
+
export {
|
|
73
|
+
L as CarouselTrack
|
|
74
|
+
};
|