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,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as M } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback as N } from "react";
|
|
4
|
+
import { astralisMerge as V } from "../../../../utils/astralis-merge.js";
|
|
5
|
+
import { useTabsContext as j } from "../tabs.context.js";
|
|
6
|
+
import { tabsTriggerVariants as q } from "../tabs.styles.js";
|
|
7
|
+
function E({ value: r, disabled: m = !1, className: p, children: y, onClick: h, onKeyDown: c, ...T }) {
|
|
8
|
+
const { value: A, setValue: i, orientation: s, variant: k, size: v, fitted: w, rounded: x, activationMode: f, loop: l, baseId: d } = j(), a = r === A, I = `${d}-trigger-${r}`, $ = `${d}-panel-${r}`, z = N(
|
|
9
|
+
(t) => {
|
|
10
|
+
c?.(t);
|
|
11
|
+
const g = t.currentTarget.closest('[role="tablist"]');
|
|
12
|
+
if (!g) return;
|
|
13
|
+
const o = Array.from(g.querySelectorAll('[role="tab"]:not([disabled])')), n = o.indexOf(t.currentTarget);
|
|
14
|
+
if (n === -1) return;
|
|
15
|
+
const u = s === "horizontal", C = u ? "ArrowRight" : "ArrowDown", D = u ? "ArrowLeft" : "ArrowUp";
|
|
16
|
+
let e = n;
|
|
17
|
+
if (t.key === C) e = n + 1;
|
|
18
|
+
else if (t.key === D) e = n - 1;
|
|
19
|
+
else if (t.key === "Home") e = 0;
|
|
20
|
+
else if (t.key === "End") e = o.length - 1;
|
|
21
|
+
else return;
|
|
22
|
+
t.preventDefault(), e >= o.length && (e = l ? 0 : o.length - 1), e < 0 && (e = l ? o.length - 1 : 0);
|
|
23
|
+
const b = o[e];
|
|
24
|
+
b.focus(), f === "automatic" && i(b.dataset.value ?? r);
|
|
25
|
+
},
|
|
26
|
+
[c, s, l, f, i, r]
|
|
27
|
+
);
|
|
28
|
+
return /* @__PURE__ */ M(
|
|
29
|
+
"button",
|
|
30
|
+
{
|
|
31
|
+
id: I,
|
|
32
|
+
role: "tab",
|
|
33
|
+
type: "button",
|
|
34
|
+
"data-value": r,
|
|
35
|
+
"data-state": a ? "active" : "inactive",
|
|
36
|
+
"data-orientation": s,
|
|
37
|
+
"aria-selected": a,
|
|
38
|
+
"aria-controls": $,
|
|
39
|
+
tabIndex: a ? 0 : -1,
|
|
40
|
+
disabled: m,
|
|
41
|
+
className: V(q({ size: v, variant: k, fitted: w, rounded: x, active: a }), p),
|
|
42
|
+
onClick: (t) => {
|
|
43
|
+
i(r), h?.(t);
|
|
44
|
+
},
|
|
45
|
+
onKeyDown: z,
|
|
46
|
+
...T,
|
|
47
|
+
children: y
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
E.displayName = "Tabs.Trigger";
|
|
52
|
+
export {
|
|
53
|
+
E as TabsTrigger
|
|
54
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { TabsRoot as t } from "./components/tabs-root.js";
|
|
3
|
+
import { TabsList as o } from "./components/tabs-list.js";
|
|
4
|
+
import { TabsTrigger as r } from "./components/tabs-trigger.js";
|
|
5
|
+
import { TabsContent as s } from "./components/tabs-content.js";
|
|
6
|
+
const T = Object.assign(t, {
|
|
7
|
+
List: o,
|
|
8
|
+
Trigger: r,
|
|
9
|
+
Content: s
|
|
10
|
+
});
|
|
11
|
+
export {
|
|
12
|
+
T as Tabs,
|
|
13
|
+
s as TabsContent,
|
|
14
|
+
o as TabsList,
|
|
15
|
+
r as TabsTrigger
|
|
16
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useContext as e, createContext as o } from "react";
|
|
3
|
+
const n = o(null);
|
|
4
|
+
function r() {
|
|
5
|
+
const t = e(n);
|
|
6
|
+
if (!t) throw new Error("Tabs sub-components must be used within <Tabs.Root>");
|
|
7
|
+
return t;
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
n as TabsContext,
|
|
11
|
+
r as useTabsContext
|
|
12
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cva as a } from "class-variance-authority";
|
|
3
|
+
const t = a("astralis:flex astralis:relative astralis:gap-1", {
|
|
4
|
+
variants: {
|
|
5
|
+
orientation: {
|
|
6
|
+
horizontal: "astralis:flex-row astralis:items-center",
|
|
7
|
+
vertical: "astralis:flex-col astralis:items-stretch"
|
|
8
|
+
},
|
|
9
|
+
variant: { line: "", subtle: "", segmented: "astralis:p-1", outline: "", plain: "" },
|
|
10
|
+
rounded: { true: "", false: "" }
|
|
11
|
+
},
|
|
12
|
+
compoundVariants: [
|
|
13
|
+
// line + outline sit on a track border
|
|
14
|
+
{ orientation: "horizontal", variant: "line", class: "astralis:border-b astralis:border-stroke-base" },
|
|
15
|
+
{ orientation: "vertical", variant: "line", class: "astralis:border-e astralis:border-stroke-base" },
|
|
16
|
+
{ orientation: "horizontal", variant: "outline", class: "astralis:border-b astralis:border-stroke-base" },
|
|
17
|
+
{ orientation: "vertical", variant: "outline", class: "astralis:border-e astralis:border-stroke-base" },
|
|
18
|
+
// segmented is a filled container
|
|
19
|
+
{ variant: "segmented", class: "astralis:bg-surface-subtle" },
|
|
20
|
+
{ variant: "segmented", rounded: !1, class: "astralis:rounded-md" },
|
|
21
|
+
{ variant: "segmented", rounded: !0, class: "astralis:rounded-full" }
|
|
22
|
+
],
|
|
23
|
+
defaultVariants: { orientation: "horizontal", variant: "line", rounded: !1 }
|
|
24
|
+
}), e = a(
|
|
25
|
+
"astralis:absolute astralis:bg-accent-solid astralis:rounded-full astralis:transition-all astralis:duration-fast astralis:pointer-events-none",
|
|
26
|
+
{
|
|
27
|
+
variants: {
|
|
28
|
+
orientation: {
|
|
29
|
+
horizontal: "astralis:bottom-0 astralis:h-0.5",
|
|
30
|
+
vertical: "astralis:end-0 astralis:w-0.5"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
defaultVariants: { orientation: "horizontal" }
|
|
34
|
+
}
|
|
35
|
+
), r = a(
|
|
36
|
+
"astralis:inline-flex astralis:items-center astralis:justify-center astralis:gap-2 astralis:whitespace-nowrap astralis:font-medium astralis:transition-colors astralis:cursor-pointer astralis:outline-none astralis:disabled:opacity-moderate astralis:disabled:cursor-not-allowed astralis:focus-visible:outline-2 astralis:focus-visible:outline-offset-2 astralis:focus-visible:outline-accent-ring astralis:focus-visible:rounded-sm",
|
|
37
|
+
{
|
|
38
|
+
variants: {
|
|
39
|
+
size: {
|
|
40
|
+
sm: "astralis:text-xs astralis:px-3 astralis:py-1.5",
|
|
41
|
+
md: "astralis:text-sm astralis:px-4 astralis:py-2",
|
|
42
|
+
lg: "astralis:text-md astralis:px-5 astralis:py-2.5"
|
|
43
|
+
},
|
|
44
|
+
// `outline` reserves a transparent border so the layout doesn't shift when active.
|
|
45
|
+
variant: { line: "", subtle: "", segmented: "", outline: "astralis:border-normal astralis:border-transparent", plain: "astralis:rounded-md" },
|
|
46
|
+
active: { true: "", false: "" },
|
|
47
|
+
fitted: { true: "astralis:flex-1", false: "" },
|
|
48
|
+
rounded: { true: "", false: "" }
|
|
49
|
+
},
|
|
50
|
+
compoundVariants: [
|
|
51
|
+
// --- radius per variant (default vs rounded) ---
|
|
52
|
+
{ variant: "subtle", rounded: !1, class: "astralis:rounded-md" },
|
|
53
|
+
{ variant: "subtle", rounded: !0, class: "astralis:rounded-full" },
|
|
54
|
+
{ variant: "segmented", rounded: !1, class: "astralis:rounded-md" },
|
|
55
|
+
{ variant: "segmented", rounded: !0, class: "astralis:rounded-full" },
|
|
56
|
+
{ variant: "outline", rounded: !1, class: "astralis:rounded-t-md" },
|
|
57
|
+
{ variant: "outline", rounded: !0, class: "astralis:rounded-t-xl" },
|
|
58
|
+
// --- active / inactive colours (active = accent text everywhere) ---
|
|
59
|
+
{ variant: "line", active: !0, class: "astralis:text-accent-solid" },
|
|
60
|
+
{ variant: "line", active: !1, class: "astralis:text-label-muted astralis:hover:text-label-base" },
|
|
61
|
+
{ variant: "subtle", active: !0, class: "astralis:bg-surface-subtle astralis:text-accent-solid" },
|
|
62
|
+
{ variant: "subtle", active: !1, class: "astralis:text-label-muted astralis:hover:bg-surface-subtle astralis:hover:text-label-base" },
|
|
63
|
+
{ variant: "segmented", active: !0, class: "astralis:bg-surface-base astralis:shadow-sm astralis:text-accent-solid" },
|
|
64
|
+
{ variant: "segmented", active: !1, class: "astralis:text-label-muted astralis:hover:text-label-base" },
|
|
65
|
+
{ variant: "outline", active: !0, class: "astralis:bg-surface-base astralis:border-stroke-base astralis:border-b-transparent astralis:text-accent-solid astralis:-mb-px" },
|
|
66
|
+
{ variant: "outline", active: !1, class: "astralis:text-label-muted astralis:hover:text-label-base" },
|
|
67
|
+
{ variant: "plain", active: !0, class: "astralis:text-accent-solid" },
|
|
68
|
+
{ variant: "plain", active: !1, class: "astralis:text-label-muted astralis:hover:text-label-base" }
|
|
69
|
+
],
|
|
70
|
+
defaultVariants: { size: "md", variant: "line", active: !1, fitted: !1, rounded: !1 }
|
|
71
|
+
}
|
|
72
|
+
), i = a(
|
|
73
|
+
"astralis:flex-1 astralis:text-label-base astralis:outline-none astralis:focus-visible:outline-2 astralis:focus-visible:outline-offset-2 astralis:focus-visible:outline-accent-ring astralis:focus-visible:rounded-sm"
|
|
74
|
+
);
|
|
75
|
+
export {
|
|
76
|
+
i as tabsContentVariants,
|
|
77
|
+
e as tabsIndicatorVariants,
|
|
78
|
+
t as tabsListVariants,
|
|
79
|
+
r as tabsTriggerVariants
|
|
80
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as w, jsx as s } from "react/jsx-runtime";
|
|
3
|
+
import { useDrawer as D } from "../drawer.context.js";
|
|
4
|
+
import { SCRIM_COLOR as h, drawerBackdropClasses as x, drawerSizeStyle as I, drawerPanelVariants as k, drawerClosedTransform as R } from "../drawer.styles.js";
|
|
5
|
+
import { Portal as $ } from "../../portal.js";
|
|
6
|
+
import { usePresence as g } from "../../../../hooks/use-presence.js";
|
|
7
|
+
import { useOverlayBehavior as N } from "../../../../hooks/use-overlay-behavior.js";
|
|
8
|
+
import { astralisMerge as P } from "../../../../utils/astralis-merge.js";
|
|
9
|
+
const a = 250;
|
|
10
|
+
function E({ children: i, className: o = "", ...n }) {
|
|
11
|
+
const { open: e, setOpen: l, close: c, titleId: d, descriptionId: m, hasTitle: p, hasDescription: u, placement: r, size: f, closeOnOverlayClick: y, closeOnEsc: O } = D(), { mounted: v, state: C } = g(e, a), { containerRef: b } = N(e, l, { closeOnEsc: O });
|
|
12
|
+
if (!v) return null;
|
|
13
|
+
const t = C === "open";
|
|
14
|
+
return /* @__PURE__ */ w($, { children: [
|
|
15
|
+
/* @__PURE__ */ s(
|
|
16
|
+
"div",
|
|
17
|
+
{
|
|
18
|
+
"aria-hidden": !0,
|
|
19
|
+
onClick: y ? c : void 0,
|
|
20
|
+
className: `${x} astralis:transition-opacity ${t ? "astralis:opacity-100" : "astralis:opacity-0"}`,
|
|
21
|
+
style: { backgroundColor: h, transitionDuration: `${a}ms` }
|
|
22
|
+
}
|
|
23
|
+
),
|
|
24
|
+
/* @__PURE__ */ s(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
ref: b,
|
|
28
|
+
role: "dialog",
|
|
29
|
+
"aria-modal": "true",
|
|
30
|
+
"aria-labelledby": p ? d : void 0,
|
|
31
|
+
"aria-describedby": u ? m : void 0,
|
|
32
|
+
tabIndex: -1,
|
|
33
|
+
className: P(
|
|
34
|
+
k({ placement: r }),
|
|
35
|
+
"astralis:transition-transform astralis:ease-out",
|
|
36
|
+
t ? "astralis:translate-x-0 astralis:translate-y-0" : R[r],
|
|
37
|
+
o
|
|
38
|
+
),
|
|
39
|
+
style: { ...I(r, f), transitionDuration: `${a}ms` },
|
|
40
|
+
...n,
|
|
41
|
+
children: i
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
] });
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
E as DrawerContent
|
|
48
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect as o } from "react";
|
|
4
|
+
import { useDrawer as l } from "../drawer.context.js";
|
|
5
|
+
import { astralisMerge as e } from "../../../../utils/astralis-merge.js";
|
|
6
|
+
import n from "../../../icon/icon.js";
|
|
7
|
+
import { XIcon as u } from "../../../icon/internal-icons.js";
|
|
8
|
+
function x({ children: s, className: t = "" }) {
|
|
9
|
+
return /* @__PURE__ */ a("div", { className: e("astralis:flex astralis:items-center astralis:justify-between astralis:gap-4 astralis:px-6 astralis:py-4 astralis:border-b astralis:border-stroke-subtle", t), children: s });
|
|
10
|
+
}
|
|
11
|
+
function v({ children: s, className: t = "" }) {
|
|
12
|
+
return /* @__PURE__ */ a("div", { className: e("astralis:flex-1 astralis:overflow-y-auto astralis:px-6 astralis:py-4 astralis:text-label-muted", t), children: s });
|
|
13
|
+
}
|
|
14
|
+
function w({ children: s, className: t = "" }) {
|
|
15
|
+
return /* @__PURE__ */ a("div", { className: e("astralis:flex astralis:items-center astralis:justify-end astralis:gap-3 astralis:px-6 astralis:py-4 astralis:border-t astralis:border-stroke-subtle", t), children: s });
|
|
16
|
+
}
|
|
17
|
+
function y({ children: s, className: t = "" }) {
|
|
18
|
+
const { titleId: i, setHasTitle: r } = l();
|
|
19
|
+
return o(() => (r(!0), () => r(!1)), [r]), /* @__PURE__ */ a("h2", { id: i, className: e("astralis:text-lg astralis:font-semibold astralis:text-label-base", t), children: s });
|
|
20
|
+
}
|
|
21
|
+
function D({ children: s, className: t = "" }) {
|
|
22
|
+
const { descriptionId: i, setHasDescription: r } = l();
|
|
23
|
+
return o(() => (r(!0), () => r(!1)), [r]), /* @__PURE__ */ a("p", { id: i, className: e("astralis:text-sm astralis:text-label-muted", t), children: s });
|
|
24
|
+
}
|
|
25
|
+
function g({ className: s = "" }) {
|
|
26
|
+
const { close: t } = l();
|
|
27
|
+
return /* @__PURE__ */ a(
|
|
28
|
+
"button",
|
|
29
|
+
{
|
|
30
|
+
type: "button",
|
|
31
|
+
"aria-label": "Close",
|
|
32
|
+
onClick: t,
|
|
33
|
+
className: e(
|
|
34
|
+
"astralis:inline-flex astralis:items-center astralis:justify-center astralis:size-8 astralis:rounded-md astralis:text-label-muted astralis:cursor-pointer astralis:transition-colors astralis:hover:bg-surface-muted astralis:hover:text-label-base astralis:outline-none astralis:focus-visible:outline-2 astralis:focus-visible:outline-offset-2 astralis:focus-visible:outline-accent-ring",
|
|
35
|
+
s
|
|
36
|
+
),
|
|
37
|
+
children: /* @__PURE__ */ a(n, { size: "sm", children: /* @__PURE__ */ a(u, {}) })
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
v as DrawerBody,
|
|
43
|
+
g as DrawerCloseButton,
|
|
44
|
+
D as DrawerDescription,
|
|
45
|
+
w as DrawerFooter,
|
|
46
|
+
x as DrawerHeader,
|
|
47
|
+
y as DrawerTitle
|
|
48
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as k } from "react/jsx-runtime";
|
|
3
|
+
import { cloneElement as C, useId as h, useState as m, useCallback as I, useMemo as T } from "react";
|
|
4
|
+
import { useDrawer as D, DrawerContext as b } from "../drawer.context.js";
|
|
5
|
+
import { useControllableState as v } from "../../../../hooks/use-controllable-state.js";
|
|
6
|
+
function M({
|
|
7
|
+
children: e,
|
|
8
|
+
open: t,
|
|
9
|
+
defaultOpen: o = !1,
|
|
10
|
+
onOpenChange: s,
|
|
11
|
+
placement: a = "right",
|
|
12
|
+
size: i = "md",
|
|
13
|
+
closeOnOverlayClick: l = !0,
|
|
14
|
+
closeOnEsc: u = !0
|
|
15
|
+
}) {
|
|
16
|
+
const [p, r] = v({ value: t, defaultValue: o, onChange: s }), n = h(), [c, g] = m(!1), [f, w] = m(!1), d = I(() => r(!1), [r]), x = T(
|
|
17
|
+
() => ({
|
|
18
|
+
open: p,
|
|
19
|
+
setOpen: r,
|
|
20
|
+
close: d,
|
|
21
|
+
titleId: `${n}-title`,
|
|
22
|
+
descriptionId: `${n}-desc`,
|
|
23
|
+
hasTitle: c,
|
|
24
|
+
setHasTitle: g,
|
|
25
|
+
hasDescription: f,
|
|
26
|
+
setHasDescription: w,
|
|
27
|
+
placement: a,
|
|
28
|
+
size: i,
|
|
29
|
+
closeOnOverlayClick: l,
|
|
30
|
+
closeOnEsc: u
|
|
31
|
+
}),
|
|
32
|
+
[p, r, d, n, c, f, a, i, l, u]
|
|
33
|
+
);
|
|
34
|
+
return /* @__PURE__ */ k(b.Provider, { value: x, children: e });
|
|
35
|
+
}
|
|
36
|
+
function P({ children: e }) {
|
|
37
|
+
const { setOpen: t, open: o } = D();
|
|
38
|
+
return C(e, {
|
|
39
|
+
onClick: (s) => {
|
|
40
|
+
e.props.onClick?.(s), t(!0);
|
|
41
|
+
},
|
|
42
|
+
"aria-haspopup": "dialog",
|
|
43
|
+
"aria-expanded": o
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function R({ children: e }) {
|
|
47
|
+
const { close: t } = D();
|
|
48
|
+
return C(e, {
|
|
49
|
+
onClick: (o) => {
|
|
50
|
+
e.props.onClick?.(o), t();
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
R as DrawerClose,
|
|
56
|
+
M as DrawerRoot,
|
|
57
|
+
P as DrawerTrigger
|
|
58
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useContext as t, createContext as r } from "react";
|
|
3
|
+
const n = r(null);
|
|
4
|
+
function s() {
|
|
5
|
+
const e = t(n);
|
|
6
|
+
if (!e) throw new Error("Drawer sub-components must be used within <Drawer>");
|
|
7
|
+
return e;
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
n as DrawerContext,
|
|
11
|
+
s as useDrawer
|
|
12
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cva as t } from "class-variance-authority";
|
|
3
|
+
const e = "astralis:fixed astralis:inset-0 astralis:z-high astralis:backdrop-blur-sm", o = "rgba(0, 0, 0, 0.5)", n = t(
|
|
4
|
+
"astralis:fixed astralis:z-high astralis:flex astralis:flex-col astralis:bg-surface-base astralis:text-label-base astralis:shadow-xl astralis:border-stroke-subtle astralis:outline-none",
|
|
5
|
+
{
|
|
6
|
+
variants: {
|
|
7
|
+
placement: {
|
|
8
|
+
right: "astralis:top-0 astralis:right-0 astralis:h-full astralis:border-l",
|
|
9
|
+
left: "astralis:top-0 astralis:left-0 astralis:h-full astralis:border-r",
|
|
10
|
+
top: "astralis:top-0 astralis:inset-x-0 astralis:w-full astralis:border-b",
|
|
11
|
+
bottom: "astralis:bottom-0 astralis:inset-x-0 astralis:w-full astralis:border-t"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: { placement: "right" }
|
|
15
|
+
}
|
|
16
|
+
), l = { sm: "18rem", md: "22rem", lg: "26rem", xl: "32rem", full: "100vw" }, r = { sm: "30vh", md: "45vh", lg: "60vh", xl: "80vh", full: "100vh" };
|
|
17
|
+
function f(a, s) {
|
|
18
|
+
return a === "left" || a === "right" ? { width: l[s] } : { height: r[s] };
|
|
19
|
+
}
|
|
20
|
+
const h = {
|
|
21
|
+
right: "astralis:translate-x-full",
|
|
22
|
+
left: "astralis:-translate-x-full",
|
|
23
|
+
top: "astralis:-translate-y-full",
|
|
24
|
+
bottom: "astralis:translate-y-full"
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
o as SCRIM_COLOR,
|
|
28
|
+
e as drawerBackdropClasses,
|
|
29
|
+
h as drawerClosedTransform,
|
|
30
|
+
n as drawerPanelVariants,
|
|
31
|
+
f as drawerSizeStyle
|
|
32
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { DrawerRoot as r, DrawerClose as e, DrawerTrigger as o } from "./components/drawer-root.js";
|
|
3
|
+
import { DrawerContent as t } from "./components/drawer-content.js";
|
|
4
|
+
import { DrawerCloseButton as a, DrawerDescription as i, DrawerTitle as D, DrawerFooter as n, DrawerBody as w, DrawerHeader as s } from "./components/drawer-parts.js";
|
|
5
|
+
const C = Object.assign(r, {
|
|
6
|
+
Trigger: o,
|
|
7
|
+
Content: t,
|
|
8
|
+
Header: s,
|
|
9
|
+
Body: w,
|
|
10
|
+
Footer: n,
|
|
11
|
+
Title: D,
|
|
12
|
+
Description: i,
|
|
13
|
+
Close: e,
|
|
14
|
+
CloseButton: a
|
|
15
|
+
});
|
|
16
|
+
export {
|
|
17
|
+
C as Drawer,
|
|
18
|
+
w as DrawerBody,
|
|
19
|
+
e as DrawerClose,
|
|
20
|
+
a as DrawerCloseButton,
|
|
21
|
+
t as DrawerContent,
|
|
22
|
+
i as DrawerDescription,
|
|
23
|
+
n as DrawerFooter,
|
|
24
|
+
s as DrawerHeader,
|
|
25
|
+
D as DrawerTitle,
|
|
26
|
+
o as DrawerTrigger
|
|
27
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as a, jsxs as h } from "react/jsx-runtime";
|
|
3
|
+
import { useModal as I } from "../modal.context.js";
|
|
4
|
+
import { SCRIM_COLOR as k, modalBackdropClasses as x, modalPanelVariants as D, modalViewportVariants as M } from "../modal.styles.js";
|
|
5
|
+
import { Portal as N } from "../../portal.js";
|
|
6
|
+
import { usePresence as R } from "../../../../hooks/use-presence.js";
|
|
7
|
+
import { useOverlayBehavior as $ } from "../../../../hooks/use-overlay-behavior.js";
|
|
8
|
+
import { astralisMerge as g } from "../../../../utils/astralis-merge.js";
|
|
9
|
+
const s = 200;
|
|
10
|
+
function A({ children: r, className: e = "", ...o }) {
|
|
11
|
+
const { open: t, setOpen: l, close: n, titleId: c, descriptionId: d, hasTitle: m, hasDescription: p, size: u, centered: y, closeOnOverlayClick: f, closeOnEsc: v } = I(), { mounted: O, state: C } = R(t, s), { containerRef: b } = $(t, l, { closeOnEsc: v });
|
|
12
|
+
if (!O) return null;
|
|
13
|
+
const i = C === "open";
|
|
14
|
+
return /* @__PURE__ */ a(N, { children: /* @__PURE__ */ h("div", { className: M({ centered: y }), children: [
|
|
15
|
+
/* @__PURE__ */ a(
|
|
16
|
+
"div",
|
|
17
|
+
{
|
|
18
|
+
"aria-hidden": !0,
|
|
19
|
+
onClick: f ? n : void 0,
|
|
20
|
+
className: `${x} astralis:transition-opacity ${i ? "astralis:opacity-100" : "astralis:opacity-0"}`,
|
|
21
|
+
style: { backgroundColor: k, transitionDuration: `${s}ms` }
|
|
22
|
+
}
|
|
23
|
+
),
|
|
24
|
+
/* @__PURE__ */ a(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
ref: b,
|
|
28
|
+
role: "dialog",
|
|
29
|
+
"aria-modal": "true",
|
|
30
|
+
"aria-labelledby": m ? c : void 0,
|
|
31
|
+
"aria-describedby": p ? d : void 0,
|
|
32
|
+
tabIndex: -1,
|
|
33
|
+
className: g(
|
|
34
|
+
D({ size: u }),
|
|
35
|
+
"astralis:outline-none astralis:transition-all",
|
|
36
|
+
i ? "astralis:opacity-100 astralis:scale-100 astralis:translate-y-0" : "astralis:opacity-0 astralis:scale-95 astralis:translate-y-2",
|
|
37
|
+
e
|
|
38
|
+
),
|
|
39
|
+
style: { transitionDuration: `${s}ms` },
|
|
40
|
+
...o,
|
|
41
|
+
children: r
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
] }) });
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
A as ModalContent
|
|
48
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect as o } from "react";
|
|
4
|
+
import { useModal as r } from "../modal.context.js";
|
|
5
|
+
import { astralisMerge as i } from "../../../../utils/astralis-merge.js";
|
|
6
|
+
import n from "../../../icon/icon.js";
|
|
7
|
+
import { XIcon as u } from "../../../icon/internal-icons.js";
|
|
8
|
+
function x({ children: s, className: t = "" }) {
|
|
9
|
+
return /* @__PURE__ */ a("div", { className: i("astralis:flex astralis:flex-col astralis:gap-1 astralis:px-6 astralis:pt-6 astralis:pb-2", t), children: s });
|
|
10
|
+
}
|
|
11
|
+
function v({ children: s, className: t = "" }) {
|
|
12
|
+
return /* @__PURE__ */ a("div", { className: i("astralis:px-6 astralis:py-4 astralis:text-label-muted", t), children: s });
|
|
13
|
+
}
|
|
14
|
+
function M({ children: s, className: t = "" }) {
|
|
15
|
+
return /* @__PURE__ */ a("div", { className: i("astralis:flex astralis:items-center astralis:justify-end astralis:gap-3 astralis:px-6 astralis:pt-2 astralis:pb-6", t), children: s });
|
|
16
|
+
}
|
|
17
|
+
function g({ children: s, className: t = "" }) {
|
|
18
|
+
const { titleId: l, setHasTitle: e } = r();
|
|
19
|
+
return o(() => (e(!0), () => e(!1)), [e]), /* @__PURE__ */ a("h2", { id: l, className: i("astralis:text-lg astralis:font-semibold astralis:text-label-base", t), children: s });
|
|
20
|
+
}
|
|
21
|
+
function h({ children: s, className: t = "" }) {
|
|
22
|
+
const { descriptionId: l, setHasDescription: e } = r();
|
|
23
|
+
return o(() => (e(!0), () => e(!1)), [e]), /* @__PURE__ */ a("p", { id: l, className: i("astralis:text-sm astralis:text-label-muted", t), children: s });
|
|
24
|
+
}
|
|
25
|
+
function N({ className: s = "" }) {
|
|
26
|
+
const { close: t } = r();
|
|
27
|
+
return /* @__PURE__ */ a(
|
|
28
|
+
"button",
|
|
29
|
+
{
|
|
30
|
+
type: "button",
|
|
31
|
+
"aria-label": "Close",
|
|
32
|
+
onClick: t,
|
|
33
|
+
className: i(
|
|
34
|
+
"astralis:absolute astralis:top-4 astralis:right-4 astralis:inline-flex astralis:items-center astralis:justify-center astralis:size-8 astralis:rounded-md astralis:text-label-muted astralis:cursor-pointer astralis:transition-colors astralis:hover:bg-surface-muted astralis:hover:text-label-base astralis:outline-none astralis:focus-visible:outline-2 astralis:focus-visible:outline-offset-2 astralis:focus-visible:outline-accent-ring",
|
|
35
|
+
s
|
|
36
|
+
),
|
|
37
|
+
children: /* @__PURE__ */ a(n, { size: "sm", children: /* @__PURE__ */ a(u, {}) })
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
v as ModalBody,
|
|
43
|
+
N as ModalCloseButton,
|
|
44
|
+
h as ModalDescription,
|
|
45
|
+
M as ModalFooter,
|
|
46
|
+
x as ModalHeader,
|
|
47
|
+
g as ModalTitle
|
|
48
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as I } from "react/jsx-runtime";
|
|
3
|
+
import { cloneElement as C, useId as T, useState as m, useCallback as b, useMemo as h } from "react";
|
|
4
|
+
import { useModal as M, ModalContext as v } from "../modal.context.js";
|
|
5
|
+
import { useControllableState as D } from "../../../../hooks/use-controllable-state.js";
|
|
6
|
+
function P({
|
|
7
|
+
children: o,
|
|
8
|
+
open: e,
|
|
9
|
+
defaultOpen: t = !1,
|
|
10
|
+
onOpenChange: n,
|
|
11
|
+
size: l = "md",
|
|
12
|
+
centered: r = !0,
|
|
13
|
+
closeOnOverlayClick: i = !0,
|
|
14
|
+
closeOnEsc: u = !0
|
|
15
|
+
}) {
|
|
16
|
+
const [p, s] = D({ value: e, defaultValue: t, onChange: n }), a = T(), [c, x] = m(!1), [d, g] = m(!1), f = b(() => s(!1), [s]), k = h(
|
|
17
|
+
() => ({
|
|
18
|
+
open: p,
|
|
19
|
+
setOpen: s,
|
|
20
|
+
close: f,
|
|
21
|
+
titleId: `${a}-title`,
|
|
22
|
+
descriptionId: `${a}-desc`,
|
|
23
|
+
hasTitle: c,
|
|
24
|
+
setHasTitle: x,
|
|
25
|
+
hasDescription: d,
|
|
26
|
+
setHasDescription: g,
|
|
27
|
+
size: l,
|
|
28
|
+
centered: r,
|
|
29
|
+
closeOnOverlayClick: i,
|
|
30
|
+
closeOnEsc: u
|
|
31
|
+
}),
|
|
32
|
+
[p, s, f, a, c, d, l, r, i, u]
|
|
33
|
+
);
|
|
34
|
+
return /* @__PURE__ */ I(v.Provider, { value: k, children: o });
|
|
35
|
+
}
|
|
36
|
+
function R({ children: o }) {
|
|
37
|
+
const { setOpen: e, open: t } = M();
|
|
38
|
+
return C(o, {
|
|
39
|
+
onClick: (n) => {
|
|
40
|
+
o.props.onClick?.(n), e(!0);
|
|
41
|
+
},
|
|
42
|
+
"aria-haspopup": "dialog",
|
|
43
|
+
"aria-expanded": t
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function V({ children: o }) {
|
|
47
|
+
const { close: e } = M();
|
|
48
|
+
return C(o, {
|
|
49
|
+
onClick: (t) => {
|
|
50
|
+
o.props.onClick?.(t), e();
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
V as ModalClose,
|
|
56
|
+
P as ModalRoot,
|
|
57
|
+
R as ModalTrigger
|
|
58
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ModalRoot as o, ModalClose as e, ModalTrigger as t } from "./components/modal-root.js";
|
|
3
|
+
import { ModalContent as l } from "./components/modal-content.js";
|
|
4
|
+
import { ModalCloseButton as r, ModalDescription as d, ModalTitle as a, ModalFooter as i, ModalBody as n, ModalHeader as M } from "./components/modal-parts.js";
|
|
5
|
+
const C = Object.assign(o, {
|
|
6
|
+
Trigger: t,
|
|
7
|
+
Content: l,
|
|
8
|
+
Header: M,
|
|
9
|
+
Body: n,
|
|
10
|
+
Footer: i,
|
|
11
|
+
Title: a,
|
|
12
|
+
Description: d,
|
|
13
|
+
Close: e,
|
|
14
|
+
CloseButton: r
|
|
15
|
+
});
|
|
16
|
+
export {
|
|
17
|
+
C as Modal,
|
|
18
|
+
n as ModalBody,
|
|
19
|
+
e as ModalClose,
|
|
20
|
+
r as ModalCloseButton,
|
|
21
|
+
l as ModalContent,
|
|
22
|
+
d as ModalDescription,
|
|
23
|
+
i as ModalFooter,
|
|
24
|
+
M as ModalHeader,
|
|
25
|
+
a as ModalTitle,
|
|
26
|
+
t as ModalTrigger
|
|
27
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useContext as o, createContext as e } from "react";
|
|
3
|
+
const n = e(null);
|
|
4
|
+
function s() {
|
|
5
|
+
const t = o(n);
|
|
6
|
+
if (!t) throw new Error("Modal sub-components must be used within <Modal>");
|
|
7
|
+
return t;
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
n as ModalContext,
|
|
11
|
+
s as useModal
|
|
12
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cva as a } from "class-variance-authority";
|
|
3
|
+
const t = a(
|
|
4
|
+
"astralis:fixed astralis:inset-0 astralis:z-high astralis:flex astralis:justify-center astralis:p-4 astralis:overflow-y-auto",
|
|
5
|
+
{
|
|
6
|
+
variants: {
|
|
7
|
+
centered: { true: "astralis:items-center", false: "astralis:items-start astralis:pt-16" }
|
|
8
|
+
},
|
|
9
|
+
defaultVariants: { centered: !0 }
|
|
10
|
+
}
|
|
11
|
+
), r = "astralis:fixed astralis:inset-0 astralis:backdrop-blur-sm", l = "rgba(0, 0, 0, 0.5)", i = a(
|
|
12
|
+
"astralis:relative astralis:w-full astralis:my-auto astralis:bg-surface-base astralis:text-label-base astralis:rounded-xl astralis:border-normal astralis:border-stroke-subtle astralis:shadow-xl",
|
|
13
|
+
{
|
|
14
|
+
variants: {
|
|
15
|
+
size: {
|
|
16
|
+
sm: "astralis:max-w-sm",
|
|
17
|
+
md: "astralis:max-w-md",
|
|
18
|
+
lg: "astralis:max-w-lg",
|
|
19
|
+
xl: "astralis:max-w-2xl",
|
|
20
|
+
full: "astralis:max-w-[calc(100vw-2rem)]"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: { size: "md" }
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
export {
|
|
27
|
+
l as SCRIM_COLOR,
|
|
28
|
+
r as modalBackdropClasses,
|
|
29
|
+
i as modalPanelVariants,
|
|
30
|
+
t as modalViewportVariants
|
|
31
|
+
};
|