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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Paul Andrew
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Astralis UI
|
|
2
|
+
|
|
3
|
+
React 19 component library built on semantic design tokens — precompiled CSS,
|
|
4
|
+
runtime brand theming, first-class dark mode and responsive props on every
|
|
5
|
+
layout primitive. **62 components across 9 categories.**
|
|
6
|
+
|
|
7
|
+
**Docs & live demos:** https://astralis-zeta.vercel.app
|
|
8
|
+
|
|
9
|
+
## Why Astralis
|
|
10
|
+
|
|
11
|
+
- **Zero build step.** The library ships precompiled CSS — import one
|
|
12
|
+
stylesheet and every component works. Your app never runs Tailwind, PostCSS
|
|
13
|
+
plugins or a theme compiler. Internals are prefixed (`astralis:*`), so it
|
|
14
|
+
coexists with your own Tailwind without collisions.
|
|
15
|
+
- **Runtime theming.** Hand the provider a single brand color and the full
|
|
16
|
+
shade scale, hover states and a readable contrast color are derived at
|
|
17
|
+
runtime with OKLCH color math:
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
<AstralisProvider tokens={{ brandColor: "#8b5cf6" }}>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
- **One accent channel, eleven hues.** Every themeable component takes a
|
|
24
|
+
`colorScheme` prop backed by CSS-variable indirection — any component
|
|
25
|
+
recolors to any palette without per-hue CSS.
|
|
26
|
+
- **Responsive props.** Layout and typography accept breakpoint maps —
|
|
27
|
+
`p={{ base: "4", md: "8" }}` — resolved to precompiled classes, zero
|
|
28
|
+
runtime style computation.
|
|
29
|
+
- **Verified CSS.** A build gate asserts that every class the components can
|
|
30
|
+
emit exists in the shipped stylesheet — silent styling breakage is a build
|
|
31
|
+
failure, not a runtime surprise.
|
|
32
|
+
- **Light dependencies.** Four small runtime deps; no Radix, no Floating UI,
|
|
33
|
+
no animation library. Behavior lives in ~5 small in-house hooks.
|
|
34
|
+
|
|
35
|
+
## Install
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pnpm add astralis-ui # or npm / yarn
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Requires React 19.
|
|
42
|
+
|
|
43
|
+
## Setup
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
import { AstralisProvider } from "astralis-ui";
|
|
47
|
+
import "astralis-ui/styles.css"; // once, at your entry point
|
|
48
|
+
|
|
49
|
+
export function App({ children }) {
|
|
50
|
+
return <AstralisProvider defaultTheme="system">{children}</AstralisProvider>;
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Use
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
import { Button, Card, Field, Input, VStack } from "astralis-ui";
|
|
58
|
+
|
|
59
|
+
<Card>
|
|
60
|
+
<Card.Header>
|
|
61
|
+
<Card.Title>Create account</Card.Title>
|
|
62
|
+
</Card.Header>
|
|
63
|
+
<Card.Body>
|
|
64
|
+
<VStack gap="4" alignItems="stretch">
|
|
65
|
+
<Field required>
|
|
66
|
+
<Field.Label>Email</Field.Label>
|
|
67
|
+
<Input type="email" placeholder="you@example.com" />
|
|
68
|
+
</Field>
|
|
69
|
+
<Button colorScheme="blue" fullWidth>Sign up</Button>
|
|
70
|
+
</VStack>
|
|
71
|
+
</Card.Body>
|
|
72
|
+
</Card>;
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
- [Installation guide](https://astralis-zeta.vercel.app/docs/installation)
|
|
76
|
+
- [Quick start](https://astralis-zeta.vercel.app/docs/quick-start)
|
|
77
|
+
- [Theming](https://astralis-zeta.vercel.app/docs/theming)
|
|
78
|
+
- [All 62 components](https://astralis-zeta.vercel.app/docs)
|
|
79
|
+
|
|
80
|
+
## For AI agents
|
|
81
|
+
|
|
82
|
+
The docs are machine-readable: [`/llms.txt`](https://astralis-zeta.vercel.app/llms.txt)
|
|
83
|
+
indexes every page, and each page is available as plain markdown (e.g.
|
|
84
|
+
[`/docs/components/button.md`](https://astralis-zeta.vercel.app/docs/components/button.md))
|
|
85
|
+
with full demo source included.
|
|
86
|
+
|
|
87
|
+
## License
|
|
88
|
+
|
|
89
|
+
MIT © Paul Andrew
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as p, jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as H } from "react";
|
|
4
|
+
import { buttonVariants as L, buttonColorClasses as P } from "./button.styles.js";
|
|
5
|
+
import { astralisMerge as R } from "../../../utils/astralis-merge.js";
|
|
6
|
+
import { accentClass as W } from "../../../const/color-schemes.js";
|
|
7
|
+
import { useButtonGroup as _ } from "../button-group/button-group.context.js";
|
|
8
|
+
const $ = {
|
|
9
|
+
xs: "astralis:h-3 astralis:w-3",
|
|
10
|
+
sm: "astralis:h-3.5 astralis:w-3.5",
|
|
11
|
+
md: "astralis:h-4 astralis:w-4",
|
|
12
|
+
lg: "astralis:h-5 astralis:w-5",
|
|
13
|
+
xl: "astralis:h-6 astralis:w-6"
|
|
14
|
+
}, b = H(
|
|
15
|
+
({
|
|
16
|
+
as: f,
|
|
17
|
+
children: w,
|
|
18
|
+
variant: N,
|
|
19
|
+
colorScheme: x,
|
|
20
|
+
size: v,
|
|
21
|
+
disabled: y,
|
|
22
|
+
loading: s = !1,
|
|
23
|
+
loadingText: o,
|
|
24
|
+
loaderPlacement: c = "start",
|
|
25
|
+
loader: B,
|
|
26
|
+
rounded: S = "lg",
|
|
27
|
+
leftIcon: l,
|
|
28
|
+
rightIcon: i,
|
|
29
|
+
fullWidth: k = !1,
|
|
30
|
+
className: z = "",
|
|
31
|
+
...r
|
|
32
|
+
}, C) => {
|
|
33
|
+
const t = _(), E = N ?? t?.variant ?? "solid", O = x ?? t?.colorScheme ?? "brand", m = v ?? t?.size ?? "md", V = y ?? t?.disabled ?? !1, d = f || "button", j = d === "button", e = V || s, n = s && o != null ? o : w, h = !n && (!!l || !!i || s), A = /* @__PURE__ */ p(
|
|
34
|
+
"svg",
|
|
35
|
+
{
|
|
36
|
+
className: `astralis:animate-spin ${$[m]} astralis:shrink-0`,
|
|
37
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
38
|
+
fill: "none",
|
|
39
|
+
viewBox: "0 0 24 24",
|
|
40
|
+
"aria-hidden": "true",
|
|
41
|
+
children: [
|
|
42
|
+
/* @__PURE__ */ a("circle", { className: "astralis:opacity-low", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
43
|
+
/* @__PURE__ */ a(
|
|
44
|
+
"path",
|
|
45
|
+
{
|
|
46
|
+
className: "astralis:opacity-high",
|
|
47
|
+
fill: "currentColor",
|
|
48
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
), u = s ? /* @__PURE__ */ a("span", { className: "astralis:inline-flex astralis:shrink-0", children: B ?? A }) : null, D = s && c === "start" ? u : !s && l ? /* @__PURE__ */ a("span", { className: "astralis:inline-flex astralis:shrink-0", children: l }) : null, M = s && c === "end" ? u : !s && i ? /* @__PURE__ */ a("span", { className: "astralis:inline-flex astralis:shrink-0", children: i }) : null;
|
|
54
|
+
process.env.NODE_ENV !== "production" && h && !r["aria-label"] && !r["aria-labelledby"] && console.warn(
|
|
55
|
+
"[Astralis] Icon-only Button has no accessible name. Pass `aria-label` so assistive tech can announce it."
|
|
56
|
+
);
|
|
57
|
+
const G = j ? { disabled: e } : e ? { "aria-disabled": !0, tabIndex: -1 } : {};
|
|
58
|
+
return /* @__PURE__ */ p(
|
|
59
|
+
d,
|
|
60
|
+
{
|
|
61
|
+
ref: C,
|
|
62
|
+
className: R(
|
|
63
|
+
L({ size: m, rounded: S, fullWidth: k, isDisabledOrLoading: e, isIconOnly: h }),
|
|
64
|
+
P(E),
|
|
65
|
+
W(O),
|
|
66
|
+
z
|
|
67
|
+
),
|
|
68
|
+
...G,
|
|
69
|
+
...r,
|
|
70
|
+
children: [
|
|
71
|
+
D,
|
|
72
|
+
n && /* @__PURE__ */ a("span", { className: "astralis:inline-flex astralis:items-center", children: n }),
|
|
73
|
+
M
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
b.displayName = "Button";
|
|
80
|
+
const Q = b;
|
|
81
|
+
export {
|
|
82
|
+
Q as Button
|
|
83
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cva as a } from "class-variance-authority";
|
|
3
|
+
const i = a(
|
|
4
|
+
"astralis:inline-flex astralis:items-center astralis:justify-center astralis:font-medium astralis:cursor-pointer astralis:transition-all astralis:outline-none astralis:focus-visible:outline-2 astralis:focus-visible:outline-offset-2",
|
|
5
|
+
{
|
|
6
|
+
variants: {
|
|
7
|
+
size: {
|
|
8
|
+
xs: "astralis:h-7 astralis:text-xs astralis:gap-1 astralis:px-2.5",
|
|
9
|
+
sm: "astralis:h-8 astralis:text-sm astralis:gap-1.5 astralis:px-3",
|
|
10
|
+
md: "astralis:h-10 astralis:text-base astralis:gap-2 astralis:px-4",
|
|
11
|
+
lg: "astralis:h-12 astralis:text-lg astralis:gap-2.5 astralis:px-5",
|
|
12
|
+
xl: "astralis:h-14 astralis:text-xl astralis:gap-3 astralis:px-7"
|
|
13
|
+
},
|
|
14
|
+
rounded: {
|
|
15
|
+
none: "astralis:rounded-none",
|
|
16
|
+
sm: "astralis:rounded-sm",
|
|
17
|
+
md: "astralis:rounded-md",
|
|
18
|
+
lg: "astralis:rounded-lg",
|
|
19
|
+
xl: "astralis:rounded-xl",
|
|
20
|
+
"2xl": "astralis:rounded-2xl",
|
|
21
|
+
full: "astralis:rounded-full"
|
|
22
|
+
},
|
|
23
|
+
fullWidth: {
|
|
24
|
+
true: "astralis:w-full",
|
|
25
|
+
false: ""
|
|
26
|
+
},
|
|
27
|
+
isDisabledOrLoading: {
|
|
28
|
+
true: "astralis:opacity-moderate astralis:cursor-not-allowed astralis:pointer-events-none",
|
|
29
|
+
false: "astralis:active:scale-[0.98]"
|
|
30
|
+
},
|
|
31
|
+
isIconOnly: {
|
|
32
|
+
true: "",
|
|
33
|
+
false: ""
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
compoundVariants: [
|
|
37
|
+
{ isIconOnly: !0, size: "xs", className: "astralis:w-7 astralis:px-0" },
|
|
38
|
+
{ isIconOnly: !0, size: "sm", className: "astralis:w-8 astralis:px-0" },
|
|
39
|
+
{ isIconOnly: !0, size: "md", className: "astralis:w-10 astralis:px-0" },
|
|
40
|
+
{ isIconOnly: !0, size: "lg", className: "astralis:w-12 astralis:px-0" },
|
|
41
|
+
{ isIconOnly: !0, size: "xl", className: "astralis:w-14 astralis:px-0" }
|
|
42
|
+
],
|
|
43
|
+
defaultVariants: {
|
|
44
|
+
size: "md",
|
|
45
|
+
rounded: "lg",
|
|
46
|
+
fullWidth: !1
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
), t = {
|
|
50
|
+
// Signature fill; readable foreground from the accent `contrast` role.
|
|
51
|
+
solid: "astralis:bg-accent-solid astralis:text-accent-contrast astralis:hover:opacity-higher astralis:focus-visible:outline-accent-ring",
|
|
52
|
+
// Tinted fill, no border.
|
|
53
|
+
subtle: "astralis:bg-accent-subtle astralis:text-accent-label astralis:hover:bg-accent-muted astralis:focus-visible:outline-accent-ring",
|
|
54
|
+
// Tinted fill + matching border (the bordered sibling of `subtle`).
|
|
55
|
+
surface: "astralis:bg-accent-subtle astralis:text-accent-label astralis:border-normal astralis:border-accent-stroke astralis:hover:bg-accent-muted astralis:focus-visible:outline-accent-ring",
|
|
56
|
+
// Border only; fills with a faint tint on hover.
|
|
57
|
+
outline: "astralis:bg-transparent astralis:border-normal astralis:border-accent-stroke astralis:text-accent-label astralis:hover:bg-accent-subtle astralis:focus-visible:outline-accent-ring",
|
|
58
|
+
// No chrome until hover (a.k.a. "ghost").
|
|
59
|
+
text: "astralis:bg-transparent astralis:text-accent-label astralis:hover:bg-accent-subtle astralis:focus-visible:outline-accent-ring",
|
|
60
|
+
// Inline-link affordance.
|
|
61
|
+
link: "astralis:bg-transparent astralis:text-accent-label astralis:hover:underline astralis:underline-offset-2 astralis:focus-visible:outline-accent-ring"
|
|
62
|
+
};
|
|
63
|
+
function r(s) {
|
|
64
|
+
return t[s];
|
|
65
|
+
}
|
|
66
|
+
export {
|
|
67
|
+
r as buttonColorClasses,
|
|
68
|
+
i as buttonVariants
|
|
69
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo as G } from "react";
|
|
4
|
+
import { buttonGroupVariants as c } from "./button-group.styles.js";
|
|
5
|
+
import { ButtonGroupContext as x } from "./button-group.context.js";
|
|
6
|
+
import { astralisMerge as B } from "../../../utils/astralis-merge.js";
|
|
7
|
+
function g({
|
|
8
|
+
children: e,
|
|
9
|
+
orientation: n = "horizontal",
|
|
10
|
+
attached: p = !1,
|
|
11
|
+
spacing: i = "md",
|
|
12
|
+
size: o,
|
|
13
|
+
variant: r,
|
|
14
|
+
colorScheme: t,
|
|
15
|
+
disabled: u,
|
|
16
|
+
className: s = "",
|
|
17
|
+
role: a = "group",
|
|
18
|
+
ref: f,
|
|
19
|
+
...l
|
|
20
|
+
}) {
|
|
21
|
+
const d = G(
|
|
22
|
+
() => ({ size: o, variant: r, colorScheme: t, disabled: u }),
|
|
23
|
+
[o, r, t, u]
|
|
24
|
+
);
|
|
25
|
+
return /* @__PURE__ */ m(x.Provider, { value: d, children: /* @__PURE__ */ m(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
ref: f,
|
|
29
|
+
role: a,
|
|
30
|
+
className: B(
|
|
31
|
+
c({ orientation: n, attached: p, spacing: i }),
|
|
32
|
+
s
|
|
33
|
+
),
|
|
34
|
+
...l,
|
|
35
|
+
children: e
|
|
36
|
+
}
|
|
37
|
+
) });
|
|
38
|
+
}
|
|
39
|
+
g.displayName = "ButtonGroup";
|
|
40
|
+
export {
|
|
41
|
+
g as ButtonGroup
|
|
42
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cva as a } from "class-variance-authority";
|
|
3
|
+
const s = a("astralis:inline-flex", {
|
|
4
|
+
variants: {
|
|
5
|
+
orientation: {
|
|
6
|
+
horizontal: "astralis:flex-row",
|
|
7
|
+
vertical: "astralis:flex-col"
|
|
8
|
+
},
|
|
9
|
+
attached: { true: "", false: "" },
|
|
10
|
+
spacing: {
|
|
11
|
+
none: "astralis:gap-0",
|
|
12
|
+
sm: "astralis:gap-1.5",
|
|
13
|
+
md: "astralis:gap-2",
|
|
14
|
+
lg: "astralis:gap-3"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
compoundVariants: [
|
|
18
|
+
// Attached → no gap; spacing is ignored.
|
|
19
|
+
{ attached: !0, class: "astralis:gap-0" },
|
|
20
|
+
{
|
|
21
|
+
attached: !0,
|
|
22
|
+
orientation: "horizontal",
|
|
23
|
+
class: "astralis:[&>*:not(:first-child)]:rounded-s-none astralis:[&>*:not(:last-child)]:rounded-e-none astralis:[&>*:not(:first-child)]:-ms-px"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
attached: !0,
|
|
27
|
+
orientation: "vertical",
|
|
28
|
+
class: "astralis:[&>*:not(:first-child)]:rounded-t-none astralis:[&>*:not(:last-child)]:rounded-b-none astralis:[&>*:not(:first-child)]:-mt-px"
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
defaultVariants: {
|
|
32
|
+
orientation: "horizontal",
|
|
33
|
+
attached: !1,
|
|
34
|
+
spacing: "md"
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
export {
|
|
38
|
+
s as buttonGroupVariants
|
|
39
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as s, jsxs as u } from "react/jsx-runtime";
|
|
3
|
+
import { Button as x } from "../button/button.js";
|
|
4
|
+
import { useTheme as k } from "../../../theme/provider.js";
|
|
5
|
+
import r from "../../icon/icon.js";
|
|
6
|
+
import { MoonIcon as y, SunIcon as I } from "../../icon/internal-icons.js";
|
|
7
|
+
function $({
|
|
8
|
+
variant: l = "outline",
|
|
9
|
+
size: t = "md",
|
|
10
|
+
showLabel: o = !1,
|
|
11
|
+
className: n = "",
|
|
12
|
+
ref: c,
|
|
13
|
+
...m
|
|
14
|
+
}) {
|
|
15
|
+
const { resolvedTheme: d, setTheme: p } = k(), a = d === "dark", e = t === "xs" || t === "sm" ? "xs" : "sm", g = e === "xs" ? "astralis:size-4" : "astralis:size-5", h = a ? "Light Mode" : "Dark Mode", T = () => {
|
|
16
|
+
p(a ? "light" : "dark");
|
|
17
|
+
}, i = "astralis:absolute astralis:inset-0 astralis:transition-all astralis:duration-moderate", f = /* @__PURE__ */ u("span", { className: `astralis:relative astralis:inline-flex ${g}`, children: [
|
|
18
|
+
/* @__PURE__ */ s(
|
|
19
|
+
r,
|
|
20
|
+
{
|
|
21
|
+
size: e,
|
|
22
|
+
className: `${i} ${a ? "astralis:rotate-90 astralis:opacity-0" : "astralis:rotate-0 astralis:opacity-100"}`,
|
|
23
|
+
children: /* @__PURE__ */ s(y, {})
|
|
24
|
+
}
|
|
25
|
+
),
|
|
26
|
+
/* @__PURE__ */ s(
|
|
27
|
+
r,
|
|
28
|
+
{
|
|
29
|
+
size: e,
|
|
30
|
+
className: `${i} ${a ? "astralis:rotate-0 astralis:opacity-100" : "astralis:-rotate-90 astralis:opacity-0"}`,
|
|
31
|
+
children: /* @__PURE__ */ s(I, {})
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
] });
|
|
35
|
+
return /* @__PURE__ */ s(
|
|
36
|
+
x,
|
|
37
|
+
{
|
|
38
|
+
ref: c,
|
|
39
|
+
variant: l,
|
|
40
|
+
size: t,
|
|
41
|
+
onClick: T,
|
|
42
|
+
leftIcon: f,
|
|
43
|
+
className: n,
|
|
44
|
+
"aria-label": o ? void 0 : "Toggle theme",
|
|
45
|
+
...m,
|
|
46
|
+
children: o ? h : void 0
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
$.displayName = "ThemeToggle";
|
|
51
|
+
export {
|
|
52
|
+
$ as ThemeToggle
|
|
53
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cva as s } from "class-variance-authority";
|
|
3
|
+
const i = s(
|
|
4
|
+
"astralis:relative astralis:inline-flex astralis:items-center astralis:justify-center astralis:font-semibold astralis:select-none astralis:shrink-0 astralis:overflow-hidden",
|
|
5
|
+
{
|
|
6
|
+
variants: {
|
|
7
|
+
size: {
|
|
8
|
+
xs: "astralis:size-6 astralis:text-xs",
|
|
9
|
+
sm: "astralis:size-8 astralis:text-xs",
|
|
10
|
+
md: "astralis:size-10 astralis:text-sm",
|
|
11
|
+
lg: "astralis:size-12 astralis:text-base",
|
|
12
|
+
xl: "astralis:size-16 astralis:text-xl",
|
|
13
|
+
"2xl": "astralis:size-20 astralis:text-2xl"
|
|
14
|
+
},
|
|
15
|
+
shape: {
|
|
16
|
+
circle: "astralis:rounded-full",
|
|
17
|
+
rounded: "astralis:rounded-lg",
|
|
18
|
+
square: "astralis:rounded-none"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
defaultVariants: { size: "md", shape: "circle" }
|
|
22
|
+
}
|
|
23
|
+
), t = {
|
|
24
|
+
xs: "astralis:size-1.5",
|
|
25
|
+
sm: "astralis:size-2",
|
|
26
|
+
md: "astralis:size-2.5",
|
|
27
|
+
lg: "astralis:size-3",
|
|
28
|
+
xl: "astralis:size-3.5",
|
|
29
|
+
"2xl": "astralis:size-4"
|
|
30
|
+
}, l = {
|
|
31
|
+
online: "astralis:bg-green-solid",
|
|
32
|
+
away: "astralis:bg-yellow-solid",
|
|
33
|
+
busy: "astralis:bg-red-solid",
|
|
34
|
+
offline: "astralis:bg-gray-solid"
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
t as avatarBadgeSize,
|
|
38
|
+
l as avatarStatusColor,
|
|
39
|
+
i as avatarVariants
|
|
40
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
3
|
+
import { useAvatarGroupContext as m } from "../avatar.context.js";
|
|
4
|
+
import { avatarStatusColor as s, avatarBadgeSize as u } from "../avatar.styles.js";
|
|
5
|
+
import { astralisMerge as d } from "../../../../utils/astralis-merge.js";
|
|
6
|
+
function g({ status: t = "online", color: a, size: e, className: o = "", style: r }) {
|
|
7
|
+
const i = m(), l = e ?? i?.size ?? "md";
|
|
8
|
+
return /* @__PURE__ */ n(
|
|
9
|
+
"span",
|
|
10
|
+
{
|
|
11
|
+
className: d(
|
|
12
|
+
"astralis:absolute astralis:bottom-0 astralis:right-0 astralis:block astralis:rounded-full astralis:ring-2 astralis:ring-surface-base",
|
|
13
|
+
u[l],
|
|
14
|
+
a ? "" : s[t] ?? s.online,
|
|
15
|
+
o
|
|
16
|
+
),
|
|
17
|
+
style: a ? { backgroundColor: a, ...r } : r
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
g.displayName = "Avatar.Badge";
|
|
22
|
+
export {
|
|
23
|
+
g as AvatarBadge
|
|
24
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as l, jsxs as o } from "react/jsx-runtime";
|
|
3
|
+
import { Children as u, isValidElement as p } from "react";
|
|
4
|
+
import { AvatarGroupContext as g } from "../avatar.context.js";
|
|
5
|
+
import { avatarVariants as h } from "../avatar.styles.js";
|
|
6
|
+
import { astralisMerge as n } from "../../../../utils/astralis-merge.js";
|
|
7
|
+
function b({ children: m, max: r, spacing: t = -8, size: a = "md", className: c = "", style: d }) {
|
|
8
|
+
const e = u.toArray(m).filter(p), f = r !== void 0 ? e.slice(0, r) : e, i = r !== void 0 ? e.length - r : 0;
|
|
9
|
+
return /* @__PURE__ */ l(g.Provider, { value: { size: a, ring: !0 }, children: /* @__PURE__ */ o("div", { className: n("astralis:inline-flex astralis:items-center", c), style: d, children: [
|
|
10
|
+
f.map((v, s) => /* @__PURE__ */ l("div", { style: { marginLeft: s === 0 ? 0 : t }, children: v }, s)),
|
|
11
|
+
i > 0 && /* @__PURE__ */ o(
|
|
12
|
+
"div",
|
|
13
|
+
{
|
|
14
|
+
className: n(
|
|
15
|
+
h({ size: a, shape: "circle" }),
|
|
16
|
+
"astralis:bg-surface-muted astralis:text-label-muted astralis:ring-2 astralis:ring-surface-base"
|
|
17
|
+
),
|
|
18
|
+
style: { marginLeft: t },
|
|
19
|
+
children: [
|
|
20
|
+
"+",
|
|
21
|
+
i
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
)
|
|
25
|
+
] }) });
|
|
26
|
+
}
|
|
27
|
+
b.displayName = "Avatar.Group";
|
|
28
|
+
export {
|
|
29
|
+
b as AvatarGroup
|
|
30
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as C, jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import { useState as E } from "react";
|
|
4
|
+
import { useAvatarGroupContext as j } from "../avatar.context.js";
|
|
5
|
+
import { avatarVariants as N } from "../avatar.styles.js";
|
|
6
|
+
import { astralisMerge as S } from "../../../../utils/astralis-merge.js";
|
|
7
|
+
import { accentClass as w } from "../../../../const/color-schemes.js";
|
|
8
|
+
const n = ["blue", "purple", "green", "teal", "orange", "pink", "red", "cyan"];
|
|
9
|
+
function M(e) {
|
|
10
|
+
let t = 0;
|
|
11
|
+
for (let r = 0; r < e.length; r++) t = e.charCodeAt(r) + ((t << 5) - t);
|
|
12
|
+
return n[Math.abs(t) % n.length];
|
|
13
|
+
}
|
|
14
|
+
function B({
|
|
15
|
+
src: e,
|
|
16
|
+
alt: t,
|
|
17
|
+
name: r,
|
|
18
|
+
icon: o,
|
|
19
|
+
size: c,
|
|
20
|
+
shape: p,
|
|
21
|
+
colorScheme: h,
|
|
22
|
+
ring: m,
|
|
23
|
+
children: u,
|
|
24
|
+
className: g = "",
|
|
25
|
+
style: f
|
|
26
|
+
}) {
|
|
27
|
+
const [d, v] = E(!1), s = j(), b = c ?? s?.size ?? "md", x = p ?? s?.shape ?? "circle", z = m ?? s?.ring ?? !1, A = h ?? (r ? M(r) : "gray"), i = r ? r.split(" ").filter(Boolean).map((y) => y[0]).slice(0, 2).join("").toUpperCase() : null, l = e && !d;
|
|
28
|
+
return /* @__PURE__ */ C(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
className: S(
|
|
32
|
+
N({ size: b, shape: x }),
|
|
33
|
+
w(A),
|
|
34
|
+
l ? "" : "astralis:bg-accent-muted astralis:text-accent-label",
|
|
35
|
+
z ? "astralis:ring-2 astralis:ring-surface-base" : "",
|
|
36
|
+
g
|
|
37
|
+
),
|
|
38
|
+
style: f,
|
|
39
|
+
children: [
|
|
40
|
+
l ? /* @__PURE__ */ a(
|
|
41
|
+
"img",
|
|
42
|
+
{
|
|
43
|
+
src: e,
|
|
44
|
+
alt: t ?? r ?? "Avatar",
|
|
45
|
+
onError: () => v(!0),
|
|
46
|
+
className: "astralis:size-full astralis:object-cover"
|
|
47
|
+
}
|
|
48
|
+
) : i ? /* @__PURE__ */ a("span", { children: i }) : o || /* @__PURE__ */ a("svg", { viewBox: "0 0 24 24", fill: "currentColor", style: { width: "60%", height: "60%", opacity: 0.6 }, children: /* @__PURE__ */ a("path", { d: "M12 12c2.7 0 4.8-2.1 4.8-4.8S14.7 2.4 12 2.4 7.2 4.5 7.2 7.2 9.3 12 12 12zm0 2.4c-3.2 0-9.6 1.6-9.6 4.8v2.4h19.2v-2.4c0-3.2-6.4-4.8-9.6-4.8z" }) }),
|
|
49
|
+
u
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
B.displayName = "Avatar";
|
|
55
|
+
export {
|
|
56
|
+
B as AvatarRoot
|
|
57
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { AvatarRoot as r } from "./components/avatar-root.js";
|
|
3
|
+
import { AvatarGroup as o } from "./components/avatar-group.js";
|
|
4
|
+
import { AvatarBadge as t } from "./components/avatar-badge.js";
|
|
5
|
+
const p = Object.assign(r, {
|
|
6
|
+
Group: o,
|
|
7
|
+
Badge: t
|
|
8
|
+
});
|
|
9
|
+
export {
|
|
10
|
+
p as Avatar,
|
|
11
|
+
t as AvatarBadge,
|
|
12
|
+
o as AvatarGroup
|
|
13
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import { badgeVariants as i } from "./badge.styles.js";
|
|
4
|
+
import { astralisMerge as n } from "../../../utils/astralis-merge.js";
|
|
5
|
+
import { accentClass as p } from "../../../const/color-schemes.js";
|
|
6
|
+
function l({ children: a, variant: r = "subtle", colorScheme: e = "gray", size: s = "sm", className: t = "", ...m }) {
|
|
7
|
+
return /* @__PURE__ */ o("span", { className: n(i({ variant: r, size: s }), p(e), t), ...m, children: a });
|
|
8
|
+
}
|
|
9
|
+
l.displayName = "Badge";
|
|
10
|
+
export {
|
|
11
|
+
l as Badge
|
|
12
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cva as a } from "class-variance-authority";
|
|
3
|
+
const t = a(
|
|
4
|
+
"astralis:inline-flex astralis:items-center astralis:gap-1 astralis:rounded-full astralis:font-medium astralis:leading-none astralis:whitespace-nowrap",
|
|
5
|
+
{
|
|
6
|
+
variants: {
|
|
7
|
+
size: {
|
|
8
|
+
xs: "astralis:text-xs astralis:px-1.5 astralis:py-0.5",
|
|
9
|
+
sm: "astralis:text-xs astralis:px-2 astralis:py-1",
|
|
10
|
+
md: "astralis:text-sm astralis:px-2.5 astralis:py-1",
|
|
11
|
+
lg: "astralis:text-sm astralis:px-3 astralis:py-1.5"
|
|
12
|
+
},
|
|
13
|
+
variant: {
|
|
14
|
+
solid: "astralis:bg-accent-solid astralis:text-accent-contrast",
|
|
15
|
+
subtle: "astralis:bg-accent-subtle astralis:text-accent-label",
|
|
16
|
+
surface: "astralis:bg-accent-subtle astralis:text-accent-label astralis:border-normal astralis:border-accent-stroke",
|
|
17
|
+
outline: "astralis:bg-transparent astralis:border-normal astralis:border-accent-stroke astralis:text-accent-label"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
defaultVariants: { size: "sm", variant: "subtle" }
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
export {
|
|
24
|
+
t as badgeVariants
|
|
25
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useContext as t, createContext as n } from "react";
|
|
3
|
+
const o = n(null);
|
|
4
|
+
function a() {
|
|
5
|
+
const e = t(o);
|
|
6
|
+
if (!e)
|
|
7
|
+
throw new Error("Calendar components must be used inside <Calendar.Root>");
|
|
8
|
+
return e;
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
o as CalendarContext,
|
|
12
|
+
a as useCalendarContext
|
|
13
|
+
};
|