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,76 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as a, jsxs as M } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo as S, useEffect as U } from "react";
|
|
4
|
+
import { usePopover as $ } from "../popover.context.js";
|
|
5
|
+
import { popoverArrowClasses as k, popoverContentClasses as q } from "../popover.styles.js";
|
|
6
|
+
import { Portal as z } from "../../portal.js";
|
|
7
|
+
import { usePresence as B } from "../../../../hooks/use-presence.js";
|
|
8
|
+
import { useDismiss as F } from "../../../../hooks/use-dismiss.js";
|
|
9
|
+
import { useAnchorPosition as G } from "../../../../hooks/use-anchor-position.js";
|
|
10
|
+
import { astralisMerge as H } from "../../../../utils/astralis-merge.js";
|
|
11
|
+
const l = 160;
|
|
12
|
+
function _({ children: n, className: f = "", withArrow: c = !1, ...p }) {
|
|
13
|
+
const {
|
|
14
|
+
open: o,
|
|
15
|
+
close: m,
|
|
16
|
+
triggerRef: s,
|
|
17
|
+
contentRef: t,
|
|
18
|
+
arrowRef: d,
|
|
19
|
+
contentId: u,
|
|
20
|
+
titleId: v,
|
|
21
|
+
descriptionId: g,
|
|
22
|
+
hasTitle: h,
|
|
23
|
+
hasDescription: y,
|
|
24
|
+
side: O,
|
|
25
|
+
align: b,
|
|
26
|
+
sideOffset: R,
|
|
27
|
+
alignOffset: P,
|
|
28
|
+
avoidCollisions: x,
|
|
29
|
+
closeOnEsc: C,
|
|
30
|
+
closeOnOutsidePointer: I
|
|
31
|
+
} = $(), { mounted: w, state: D } = B(o, l), { x: T, y: A, side: r, arrow: i } = G({
|
|
32
|
+
open: o,
|
|
33
|
+
anchorRef: s,
|
|
34
|
+
floatingRef: t,
|
|
35
|
+
side: O,
|
|
36
|
+
align: b,
|
|
37
|
+
sideOffset: R,
|
|
38
|
+
alignOffset: P,
|
|
39
|
+
avoidCollisions: x
|
|
40
|
+
}), E = S(() => [s, t], [s, t]);
|
|
41
|
+
if (F(o, m, { refs: E, closeOnEscape: C, closeOnOutsidePointer: I }), U(() => {
|
|
42
|
+
if (!o) return;
|
|
43
|
+
const j = setTimeout(() => t.current?.focus(), 0);
|
|
44
|
+
return () => {
|
|
45
|
+
clearTimeout(j), s.current?.focus();
|
|
46
|
+
};
|
|
47
|
+
}, [o, t, s]), !w) return null;
|
|
48
|
+
const N = D === "open", e = {};
|
|
49
|
+
return r === "bottom" ? (e.top = -4, e.left = i.left) : r === "top" ? (e.bottom = -4, e.left = i.left) : r === "right" ? (e.left = -4, e.top = i.top) : (e.right = -4, e.top = i.top), /* @__PURE__ */ a(z, { children: /* @__PURE__ */ M(
|
|
50
|
+
"div",
|
|
51
|
+
{
|
|
52
|
+
ref: t,
|
|
53
|
+
id: u,
|
|
54
|
+
role: "dialog",
|
|
55
|
+
"aria-labelledby": h ? v : void 0,
|
|
56
|
+
"aria-describedby": y ? g : void 0,
|
|
57
|
+
tabIndex: -1,
|
|
58
|
+
"data-side": r,
|
|
59
|
+
style: { left: T, top: A, transitionDuration: `${l}ms` },
|
|
60
|
+
className: H(
|
|
61
|
+
q,
|
|
62
|
+
"astralis:p-4 astralis:transition-all",
|
|
63
|
+
N ? "astralis:opacity-100 astralis:scale-100" : "astralis:opacity-0 astralis:scale-95",
|
|
64
|
+
f
|
|
65
|
+
),
|
|
66
|
+
...p,
|
|
67
|
+
children: [
|
|
68
|
+
n,
|
|
69
|
+
c && /* @__PURE__ */ a("div", { ref: d, className: k, style: e })
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
) });
|
|
73
|
+
}
|
|
74
|
+
export {
|
|
75
|
+
_ as PopoverContent
|
|
76
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect as a } from "react";
|
|
4
|
+
import { usePopover as o } from "../popover.context.js";
|
|
5
|
+
import { astralisMerge as l } from "../../../../utils/astralis-merge.js";
|
|
6
|
+
function c({ children: e, className: s = "" }) {
|
|
7
|
+
const { titleId: r, setHasTitle: t } = o();
|
|
8
|
+
return a(() => (t(!0), () => t(!1)), [t]), /* @__PURE__ */ i("h3", { id: r, className: l("astralis:text-sm astralis:font-semibold astralis:text-label-base", s), children: e });
|
|
9
|
+
}
|
|
10
|
+
function f({ children: e, className: s = "" }) {
|
|
11
|
+
const { descriptionId: r, setHasDescription: t } = o();
|
|
12
|
+
return a(() => (t(!0), () => t(!1)), [t]), /* @__PURE__ */ i("p", { id: r, className: l("astralis:mt-1 astralis:text-sm astralis:text-label-muted", s), children: e });
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
f as PopoverDescription,
|
|
16
|
+
c as PopoverTitle
|
|
17
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as S } from "react/jsx-runtime";
|
|
3
|
+
import { cloneElement as I, useId as j, useRef as p, useState as k, useCallback as x, useMemo as w } from "react";
|
|
4
|
+
import { usePopover as P, PopoverContext as M } from "../popover.context.js";
|
|
5
|
+
import { useControllableState as V } from "../../../../hooks/use-controllable-state.js";
|
|
6
|
+
function B({
|
|
7
|
+
children: e,
|
|
8
|
+
open: n,
|
|
9
|
+
defaultOpen: o = !1,
|
|
10
|
+
onOpenChange: a,
|
|
11
|
+
side: r = "bottom",
|
|
12
|
+
align: s = "center",
|
|
13
|
+
sideOffset: u = 8,
|
|
14
|
+
alignOffset: i = 0,
|
|
15
|
+
avoidCollisions: f = !0,
|
|
16
|
+
closeOnEsc: m = !0,
|
|
17
|
+
closeOnOutsidePointer: g = !0
|
|
18
|
+
}) {
|
|
19
|
+
const [c, t] = V({ value: n, defaultValue: o, onChange: a }), l = j(), b = p(null), T = p(null), $ = p(null), [d, h] = k(!1), [v, D] = k(!1), C = x(() => t(!1), [t]), R = x(() => t(!c), [t, c]), H = w(
|
|
20
|
+
() => ({
|
|
21
|
+
open: c,
|
|
22
|
+
setOpen: t,
|
|
23
|
+
toggle: R,
|
|
24
|
+
close: C,
|
|
25
|
+
triggerRef: b,
|
|
26
|
+
contentRef: T,
|
|
27
|
+
arrowRef: $,
|
|
28
|
+
contentId: `${l}-content`,
|
|
29
|
+
titleId: `${l}-title`,
|
|
30
|
+
descriptionId: `${l}-desc`,
|
|
31
|
+
hasTitle: d,
|
|
32
|
+
setHasTitle: h,
|
|
33
|
+
hasDescription: v,
|
|
34
|
+
setHasDescription: D,
|
|
35
|
+
side: r,
|
|
36
|
+
align: s,
|
|
37
|
+
sideOffset: u,
|
|
38
|
+
alignOffset: i,
|
|
39
|
+
avoidCollisions: f,
|
|
40
|
+
closeOnEsc: m,
|
|
41
|
+
closeOnOutsidePointer: g
|
|
42
|
+
}),
|
|
43
|
+
[c, t, R, C, l, d, v, r, s, u, i, f, m, g]
|
|
44
|
+
);
|
|
45
|
+
return /* @__PURE__ */ S(M.Provider, { value: H, children: e });
|
|
46
|
+
}
|
|
47
|
+
function E({ children: e }) {
|
|
48
|
+
const { toggle: n, open: o, triggerRef: a, contentId: r } = P();
|
|
49
|
+
return I(e, {
|
|
50
|
+
ref: a,
|
|
51
|
+
onClick: (s) => {
|
|
52
|
+
e.props.onClick?.(s), n();
|
|
53
|
+
},
|
|
54
|
+
"aria-haspopup": "dialog",
|
|
55
|
+
"aria-expanded": o,
|
|
56
|
+
"aria-controls": o ? r : void 0
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function F({ children: e }) {
|
|
60
|
+
const { close: n } = P();
|
|
61
|
+
return I(e, {
|
|
62
|
+
onClick: (o) => {
|
|
63
|
+
e.props.onClick?.(o), n();
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
F as PopoverClose,
|
|
69
|
+
B as PopoverRoot,
|
|
70
|
+
E as PopoverTrigger
|
|
71
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { PopoverRoot as o, PopoverClose as e, PopoverTrigger as r } from "./components/popover-root.js";
|
|
3
|
+
import { PopoverContent as t } from "./components/popover-content.js";
|
|
4
|
+
import { PopoverDescription as i, PopoverTitle as p } from "./components/popover-parts.js";
|
|
5
|
+
const P = Object.assign(o, {
|
|
6
|
+
Trigger: r,
|
|
7
|
+
Content: t,
|
|
8
|
+
Title: p,
|
|
9
|
+
Description: i,
|
|
10
|
+
Close: e
|
|
11
|
+
});
|
|
12
|
+
export {
|
|
13
|
+
P as Popover,
|
|
14
|
+
e as PopoverClose,
|
|
15
|
+
t as PopoverContent,
|
|
16
|
+
i as PopoverDescription,
|
|
17
|
+
p as PopoverTitle,
|
|
18
|
+
r as PopoverTrigger
|
|
19
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useContext as e, createContext as t } from "react";
|
|
3
|
+
const n = t(null);
|
|
4
|
+
function s() {
|
|
5
|
+
const o = e(n);
|
|
6
|
+
if (!o) throw new Error("Popover sub-components must be used within <Popover>");
|
|
7
|
+
return o;
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
n as PopoverContext,
|
|
11
|
+
s as usePopover
|
|
12
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const s = "astralis:fixed astralis:z-higher astralis:min-w-48 astralis:max-w-xs astralis:rounded-lg astralis:border-normal astralis:border-stroke-subtle astralis:bg-surface-base astralis:text-label-base astralis:shadow-lg astralis:outline-none", a = "astralis:absolute astralis:size-2.5 astralis:rotate-45 astralis:bg-surface-base astralis:border-stroke-subtle";
|
|
3
|
+
export {
|
|
4
|
+
a as popoverArrowClasses,
|
|
5
|
+
s as popoverContentClasses
|
|
6
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState as u, useEffect as n } from "react";
|
|
3
|
+
import { createPortal as f } from "react-dom";
|
|
4
|
+
function m({ children: t, container: e }) {
|
|
5
|
+
const [o, r] = u(!1);
|
|
6
|
+
return n(() => r(!0), []), o ? f(t, e ?? document.body) : null;
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
m as Portal
|
|
10
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as l, jsxs as k } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect as A } from "react";
|
|
4
|
+
import { useTooltip as N } from "../tooltip.context.js";
|
|
5
|
+
import { tooltipArrowClasses as O, tooltipContentClasses as P } from "../tooltip.styles.js";
|
|
6
|
+
import { Portal as T } from "../../portal.js";
|
|
7
|
+
import { usePresence as b } from "../../../../hooks/use-presence.js";
|
|
8
|
+
import { useAnchorPosition as j } from "../../../../hooks/use-anchor-position.js";
|
|
9
|
+
import { astralisMerge as D } from "../../../../utils/astralis-merge.js";
|
|
10
|
+
const a = 140;
|
|
11
|
+
function z({ children: f, className: p = "", withArrow: m = !1 }) {
|
|
12
|
+
const { open: o, hide: s, triggerRef: c, contentRef: r, tooltipId: d, side: u, align: y, sideOffset: g, avoidCollisions: h } = N(), { mounted: v, state: w } = b(o, a), { x: C, y: R, side: e, arrow: i } = j({
|
|
13
|
+
open: o,
|
|
14
|
+
anchorRef: c,
|
|
15
|
+
floatingRef: r,
|
|
16
|
+
side: u,
|
|
17
|
+
align: y,
|
|
18
|
+
sideOffset: g,
|
|
19
|
+
avoidCollisions: h
|
|
20
|
+
});
|
|
21
|
+
if (A(() => {
|
|
22
|
+
if (!o) return;
|
|
23
|
+
const n = (E) => {
|
|
24
|
+
E.key === "Escape" && s();
|
|
25
|
+
};
|
|
26
|
+
return document.addEventListener("keydown", n), () => document.removeEventListener("keydown", n);
|
|
27
|
+
}, [o, s]), !v) return null;
|
|
28
|
+
const x = w === "open", t = {};
|
|
29
|
+
return e === "bottom" ? (t.top = -3, t.left = i.left) : e === "top" ? (t.bottom = -3, t.left = i.left) : e === "right" ? (t.left = -3, t.top = i.top) : (t.right = -3, t.top = i.top), /* @__PURE__ */ l(T, { children: /* @__PURE__ */ k(
|
|
30
|
+
"div",
|
|
31
|
+
{
|
|
32
|
+
ref: r,
|
|
33
|
+
id: d,
|
|
34
|
+
role: "tooltip",
|
|
35
|
+
"data-side": e,
|
|
36
|
+
style: { left: C, top: R, transitionDuration: `${a}ms` },
|
|
37
|
+
className: D(
|
|
38
|
+
P,
|
|
39
|
+
"astralis:transition-opacity",
|
|
40
|
+
x ? "astralis:opacity-100" : "astralis:opacity-0",
|
|
41
|
+
p
|
|
42
|
+
),
|
|
43
|
+
children: [
|
|
44
|
+
f,
|
|
45
|
+
m && /* @__PURE__ */ l("div", { className: O, style: t })
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
) });
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
z as TooltipContent
|
|
52
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
3
|
+
import { cloneElement as h, useId as C, useRef as a, useCallback as f, useMemo as E } from "react";
|
|
4
|
+
import { useTooltip as I, TooltipContext as B } from "../tooltip.context.js";
|
|
5
|
+
import { useControllableState as F } from "../../../../hooks/use-controllable-state.js";
|
|
6
|
+
function P({
|
|
7
|
+
children: e,
|
|
8
|
+
open: p,
|
|
9
|
+
defaultOpen: c = !1,
|
|
10
|
+
onOpenChange: r,
|
|
11
|
+
side: n = "top",
|
|
12
|
+
align: u = "center",
|
|
13
|
+
sideOffset: s = 6,
|
|
14
|
+
delay: o = 300,
|
|
15
|
+
avoidCollisions: m = !0
|
|
16
|
+
}) {
|
|
17
|
+
const [T, t] = F({ value: p, defaultValue: c, onChange: r }), g = C(), R = a(null), b = a(null), l = a(null), i = () => {
|
|
18
|
+
l.current && clearTimeout(l.current);
|
|
19
|
+
}, w = f(() => {
|
|
20
|
+
i(), l.current = setTimeout(() => t(!0), o);
|
|
21
|
+
}, [t, o]), v = f(() => {
|
|
22
|
+
i(), t(!0);
|
|
23
|
+
}, [t]), M = f(() => {
|
|
24
|
+
i(), t(!1);
|
|
25
|
+
}, [t]), x = E(
|
|
26
|
+
() => ({ open: T, show: w, showNow: v, hide: M, triggerRef: R, contentRef: b, tooltipId: `${g}-tip`, side: n, align: u, sideOffset: s, avoidCollisions: m }),
|
|
27
|
+
[T, w, v, M, g, n, u, s, m]
|
|
28
|
+
);
|
|
29
|
+
return /* @__PURE__ */ d(B.Provider, { value: x, children: e });
|
|
30
|
+
}
|
|
31
|
+
function S({ children: e }) {
|
|
32
|
+
const { show: p, showNow: c, hide: r, open: n, triggerRef: u, tooltipId: s } = I();
|
|
33
|
+
return h(e, {
|
|
34
|
+
ref: u,
|
|
35
|
+
onMouseEnter: (o) => {
|
|
36
|
+
e.props.onMouseEnter?.(o), p();
|
|
37
|
+
},
|
|
38
|
+
onMouseLeave: (o) => {
|
|
39
|
+
e.props.onMouseLeave?.(o), r();
|
|
40
|
+
},
|
|
41
|
+
onFocus: (o) => {
|
|
42
|
+
e.props.onFocus?.(o), c();
|
|
43
|
+
},
|
|
44
|
+
onBlur: (o) => {
|
|
45
|
+
e.props.onBlur?.(o), r();
|
|
46
|
+
},
|
|
47
|
+
"aria-describedby": n ? s : void 0
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
P as TooltipRoot,
|
|
52
|
+
S as TooltipTrigger
|
|
53
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { TooltipRoot as o, TooltipTrigger as t } from "./components/tooltip-root.js";
|
|
3
|
+
import { TooltipContent as i } from "./components/tooltip-content.js";
|
|
4
|
+
const n = Object.assign(o, {
|
|
5
|
+
Trigger: t,
|
|
6
|
+
Content: i
|
|
7
|
+
});
|
|
8
|
+
export {
|
|
9
|
+
n as Tooltip,
|
|
10
|
+
i as TooltipContent,
|
|
11
|
+
t as TooltipTrigger
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useContext as o, createContext as e } from "react";
|
|
3
|
+
const n = e(null);
|
|
4
|
+
function r() {
|
|
5
|
+
const t = o(n);
|
|
6
|
+
if (!t) throw new Error("Tooltip sub-components must be used within <Tooltip>");
|
|
7
|
+
return t;
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
n as TooltipContext,
|
|
11
|
+
r as useTooltip
|
|
12
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const s = "astralis:fixed astralis:z-highest astralis:pointer-events-none astralis:max-w-xs astralis:rounded-md astralis:bg-surface-inverted astralis:text-label-inverted astralis:px-2.5 astralis:py-1.5 astralis:text-xs astralis:font-medium astralis:shadow-md", a = "astralis:absolute astralis:size-2 astralis:rotate-45 astralis:bg-surface-inverted";
|
|
3
|
+
export {
|
|
4
|
+
a as tooltipArrowClasses,
|
|
5
|
+
s as tooltipContentClasses
|
|
6
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as u, jsx as b } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as x } from "react";
|
|
4
|
+
import { astralisMerge as V } from "../../../utils/astralis-merge.js";
|
|
5
|
+
import { resolveStyleProps as a } from "../../../utils/responsive.js";
|
|
6
|
+
import { splitVariantProps as k } from "../../../utils/split-variant-props.js";
|
|
7
|
+
import { blockquoteVariantMap as r, blockquoteVariants as d } from "./blockquote.styles.js";
|
|
8
|
+
import { boxVariantMap as q, boxVariants as N } from "../../layout/box/box.styles.js";
|
|
9
|
+
import { BOX_VARIANT_KEYS as P } from "../../layout/box/box.js";
|
|
10
|
+
const v = Object.keys(r), A = x(
|
|
11
|
+
({ as: o, className: s, children: i, cite: t, citeUrl: e, ...l }, m) => {
|
|
12
|
+
const n = o || "blockquote", [p, c, f] = k(
|
|
13
|
+
l,
|
|
14
|
+
v,
|
|
15
|
+
P
|
|
16
|
+
);
|
|
17
|
+
return /* @__PURE__ */ u(
|
|
18
|
+
n,
|
|
19
|
+
{
|
|
20
|
+
cite: e,
|
|
21
|
+
className: V(
|
|
22
|
+
a(p, { maps: r, variants: d }),
|
|
23
|
+
a(c, { maps: q, variants: N }),
|
|
24
|
+
s
|
|
25
|
+
),
|
|
26
|
+
ref: m,
|
|
27
|
+
...f,
|
|
28
|
+
children: [
|
|
29
|
+
i,
|
|
30
|
+
t != null && /* @__PURE__ */ b("cite", { className: "astralis:mt-2 astralis:block astralis:text-sm astralis:not-italic astralis:text-label-muted", children: t })
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
A.displayName = "Blockquote";
|
|
37
|
+
export {
|
|
38
|
+
A as default
|
|
39
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cva as a } from "class-variance-authority";
|
|
3
|
+
const s = {
|
|
4
|
+
variant: {
|
|
5
|
+
// Just an accent rule on the leading edge.
|
|
6
|
+
plain: "astralis:ps-4",
|
|
7
|
+
// Accent rule plus a tinted panel.
|
|
8
|
+
subtle: "astralis:ps-4 astralis:pe-4 astralis:py-3 astralis:rounded-e-md astralis:bg-surface-muted"
|
|
9
|
+
}
|
|
10
|
+
}, r = a(
|
|
11
|
+
// Leading accent border; colour overridable via `borderColor`.
|
|
12
|
+
"astralis:border-s-4 astralis:border-stroke-emphasized",
|
|
13
|
+
{
|
|
14
|
+
variants: s,
|
|
15
|
+
defaultVariants: { variant: "plain" }
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
export {
|
|
19
|
+
s as blockquoteVariantMap,
|
|
20
|
+
r as blockquoteVariants
|
|
21
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as l } from "react";
|
|
4
|
+
import { astralisMerge as d } from "../../../utils/astralis-merge.js";
|
|
5
|
+
import { resolveStyleProps as r } from "../../../utils/responsive.js";
|
|
6
|
+
import { splitVariantProps as V } from "../../../utils/split-variant-props.js";
|
|
7
|
+
import { codeVariantMap as o, codeVariants as x } from "./code.styles.js";
|
|
8
|
+
import { boxVariantMap as P, boxVariants as b } from "../../layout/box/box.styles.js";
|
|
9
|
+
import { BOX_VARIANT_KEYS as v } from "../../layout/box/box.js";
|
|
10
|
+
const A = Object.keys(o), N = l(
|
|
11
|
+
({ as: a, className: t, children: s, ...e }, m) => {
|
|
12
|
+
const i = a || "code", [p, n, f] = V(
|
|
13
|
+
e,
|
|
14
|
+
A,
|
|
15
|
+
v
|
|
16
|
+
);
|
|
17
|
+
return /* @__PURE__ */ c(
|
|
18
|
+
i,
|
|
19
|
+
{
|
|
20
|
+
className: d(
|
|
21
|
+
r(p, { maps: o, variants: x }),
|
|
22
|
+
r(n, { maps: P, variants: b }),
|
|
23
|
+
t
|
|
24
|
+
),
|
|
25
|
+
ref: m,
|
|
26
|
+
...f,
|
|
27
|
+
children: s
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
N.displayName = "Code";
|
|
33
|
+
export {
|
|
34
|
+
N as default
|
|
35
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cva as a } from "class-variance-authority";
|
|
3
|
+
const s = {
|
|
4
|
+
variant: {
|
|
5
|
+
subtle: "astralis:bg-surface-muted astralis:text-label-base",
|
|
6
|
+
// Same-polarity surface — tracks the active theme instead of inverting.
|
|
7
|
+
solid: "astralis:bg-surface-subtle astralis:text-label-base",
|
|
8
|
+
outline: "astralis:border-normal astralis:border-stroke-base astralis:text-label-base"
|
|
9
|
+
},
|
|
10
|
+
size: {
|
|
11
|
+
sm: "astralis:text-xs",
|
|
12
|
+
md: "astralis:text-sm",
|
|
13
|
+
lg: "astralis:text-md"
|
|
14
|
+
}
|
|
15
|
+
}, e = a(
|
|
16
|
+
// Inline, monospace, never wraps mid-token; padding/rounding keep it legible in prose.
|
|
17
|
+
"astralis:font-mono astralis:inline-flex astralis:items-center astralis:rounded-sm astralis:px-1.5 astralis:py-0.5 astralis:whitespace-nowrap",
|
|
18
|
+
{
|
|
19
|
+
variants: s,
|
|
20
|
+
defaultVariants: { variant: "subtle", size: "sm" }
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
export {
|
|
24
|
+
s as codeVariantMap,
|
|
25
|
+
e as codeVariants
|
|
26
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as t, jsx as s } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as V } from "react";
|
|
4
|
+
import { astralisMerge as x } from "../../../utils/astralis-merge.js";
|
|
5
|
+
import { resolveStyleProps as r } from "../../../utils/responsive.js";
|
|
6
|
+
import { splitVariantProps as y } from "../../../utils/split-variant-props.js";
|
|
7
|
+
import { codeBlockBodyMap as i, codeBlockVariantMap as o, codeBlockBodyVariants as B, codeBlockVariants as h } from "./code-block.styles.js";
|
|
8
|
+
import { boxVariantMap as _, boxVariants as v } from "../../layout/box/box.styles.js";
|
|
9
|
+
import { BOX_VARIANT_KEYS as A } from "../../layout/box/box.js";
|
|
10
|
+
const O = Object.keys(o), P = Object.keys(i), T = () => /* @__PURE__ */ t("span", { className: "astralis:flex astralis:items-center astralis:gap-1.5 astralis:me-1", "aria-hidden": "true", children: [
|
|
11
|
+
/* @__PURE__ */ s("span", { className: "astralis:block astralis:size-3 astralis:rounded-full astralis:bg-red-400" }),
|
|
12
|
+
/* @__PURE__ */ s("span", { className: "astralis:block astralis:size-3 astralis:rounded-full astralis:bg-yellow-400" }),
|
|
13
|
+
/* @__PURE__ */ s("span", { className: "astralis:block astralis:size-3 astralis:rounded-full astralis:bg-green-400" })
|
|
14
|
+
] }), M = V(
|
|
15
|
+
({ as: n, className: c, children: m, language: a, windowControls: l, highlightedHtml: e, ...p }, d) => {
|
|
16
|
+
const f = n || "div", [b, u, k, N] = y(
|
|
17
|
+
p,
|
|
18
|
+
O,
|
|
19
|
+
P,
|
|
20
|
+
A
|
|
21
|
+
);
|
|
22
|
+
return /* @__PURE__ */ t(
|
|
23
|
+
f,
|
|
24
|
+
{
|
|
25
|
+
className: x(
|
|
26
|
+
r(b, { maps: o, variants: h }),
|
|
27
|
+
r(k, { maps: _, variants: v }),
|
|
28
|
+
c
|
|
29
|
+
),
|
|
30
|
+
ref: d,
|
|
31
|
+
...N,
|
|
32
|
+
children: [
|
|
33
|
+
(a != null || l) && // Divider uses the semantic stroke (theme-aware); the label inherits the
|
|
34
|
+
// variant's own text colour, so it stays legible on every surface.
|
|
35
|
+
/* @__PURE__ */ t("div", { className: "astralis:flex astralis:items-center astralis:gap-2 astralis:px-4 astralis:py-2.5 astralis:text-xs astralis:font-mono astralis:font-medium astralis:border-b astralis:border-stroke-base astralis:select-none", children: [
|
|
36
|
+
l && /* @__PURE__ */ s(T, {}),
|
|
37
|
+
a != null && /* @__PURE__ */ s("span", { className: "astralis:opacity-higher", children: a })
|
|
38
|
+
] }),
|
|
39
|
+
/* @__PURE__ */ s(
|
|
40
|
+
"pre",
|
|
41
|
+
{
|
|
42
|
+
className: r(u, {
|
|
43
|
+
maps: i,
|
|
44
|
+
variants: B
|
|
45
|
+
}),
|
|
46
|
+
children: e != null ? /* @__PURE__ */ s("code", { dangerouslySetInnerHTML: { __html: e } }) : /* @__PURE__ */ s("code", { children: m })
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
M.displayName = "CodeBlock";
|
|
55
|
+
export {
|
|
56
|
+
M as default
|
|
57
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cva as a } from "class-variance-authority";
|
|
3
|
+
const s = {
|
|
4
|
+
variant: {
|
|
5
|
+
subtle: "astralis:bg-surface-muted astralis:text-label-base",
|
|
6
|
+
// Same-polarity surface — tracks the active theme (dark block in dark
|
|
7
|
+
// mode) rather than inverting against it.
|
|
8
|
+
solid: "astralis:bg-surface-subtle astralis:text-label-base",
|
|
9
|
+
outline: "astralis:border-normal astralis:border-stroke-base astralis:text-label-base"
|
|
10
|
+
}
|
|
11
|
+
}, t = {
|
|
12
|
+
size: {
|
|
13
|
+
sm: "astralis:text-xs astralis:p-3",
|
|
14
|
+
md: "astralis:text-sm astralis:p-4",
|
|
15
|
+
lg: "astralis:text-md astralis:p-5"
|
|
16
|
+
}
|
|
17
|
+
}, r = a(
|
|
18
|
+
"astralis:block astralis:w-full astralis:rounded-md astralis:overflow-hidden",
|
|
19
|
+
{
|
|
20
|
+
variants: s,
|
|
21
|
+
defaultVariants: { variant: "subtle" }
|
|
22
|
+
}
|
|
23
|
+
), e = a(
|
|
24
|
+
// Whitespace preserved; long lines scroll horizontally rather than wrap.
|
|
25
|
+
"astralis:font-mono astralis:block astralis:m-0 astralis:overflow-x-auto astralis:whitespace-pre",
|
|
26
|
+
{
|
|
27
|
+
variants: t,
|
|
28
|
+
defaultVariants: { size: "md" }
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
export {
|
|
32
|
+
t as codeBlockBodyMap,
|
|
33
|
+
e as codeBlockBodyVariants,
|
|
34
|
+
s as codeBlockVariantMap,
|
|
35
|
+
r as codeBlockVariants
|
|
36
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as r } from "react";
|
|
4
|
+
import a from "../text/text.js";
|
|
5
|
+
const o = r(
|
|
6
|
+
({ as: t, ...e }, i) => /* @__PURE__ */ n(
|
|
7
|
+
a,
|
|
8
|
+
{
|
|
9
|
+
as: t || "h2",
|
|
10
|
+
ref: i,
|
|
11
|
+
fontFamily: "heading",
|
|
12
|
+
lineHeight: "tight",
|
|
13
|
+
letterSpacing: "tight",
|
|
14
|
+
...e
|
|
15
|
+
}
|
|
16
|
+
)
|
|
17
|
+
);
|
|
18
|
+
o.displayName = "Heading";
|
|
19
|
+
export {
|
|
20
|
+
o as default
|
|
21
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
3
|
+
import { Fragment as d } from "react";
|
|
4
|
+
import { astralisMerge as E } from "../../../utils/astralis-merge.js";
|
|
5
|
+
import { highlightMarkVariants as N } from "./highlight.styles.js";
|
|
6
|
+
const k = (r) => r.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
7
|
+
function x({
|
|
8
|
+
children: r,
|
|
9
|
+
query: i,
|
|
10
|
+
ignoreCase: l = !0,
|
|
11
|
+
variant: o,
|
|
12
|
+
markClassName: g,
|
|
13
|
+
className: p,
|
|
14
|
+
ref: c,
|
|
15
|
+
...h
|
|
16
|
+
}) {
|
|
17
|
+
const n = (Array.isArray(i) ? i : [i]).filter(Boolean).map(k);
|
|
18
|
+
let a = r;
|
|
19
|
+
if (typeof r != "string")
|
|
20
|
+
process.env.NODE_ENV !== "production" && console.warn("[astralis-ui] <Highlight> only highlights plain-string children; received a non-string child, rendering it as-is.");
|
|
21
|
+
else if (n.length > 0) {
|
|
22
|
+
const m = new RegExp(`(${n.join("|")})`, l ? "gi" : "g"), f = r.split(m), u = E(N({ variant: o }), g);
|
|
23
|
+
a = f.map((t, e) => t ? e % 2 === 1 ? /* @__PURE__ */ s("mark", { className: u, children: t }, e) : /* @__PURE__ */ s(d, { children: t }, e) : null);
|
|
24
|
+
}
|
|
25
|
+
return /* @__PURE__ */ s("span", { ref: c, className: p, ...h, children: a });
|
|
26
|
+
}
|
|
27
|
+
x.displayName = "Highlight";
|
|
28
|
+
export {
|
|
29
|
+
x as default
|
|
30
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cva as a } from "class-variance-authority";
|
|
3
|
+
const t = {
|
|
4
|
+
variant: {
|
|
5
|
+
subtle: "astralis:bg-yellow-subtle astralis:text-yellow-label",
|
|
6
|
+
solid: "astralis:bg-yellow-solid astralis:text-yellow-contrast"
|
|
7
|
+
}
|
|
8
|
+
}, l = a(
|
|
9
|
+
"astralis:rounded-xs astralis:px-1 astralis:font-medium",
|
|
10
|
+
{
|
|
11
|
+
variants: t,
|
|
12
|
+
defaultVariants: { variant: "subtle" }
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
export {
|
|
16
|
+
t as highlightMarkVariantMap,
|
|
17
|
+
l as highlightMarkVariants
|
|
18
|
+
};
|