@refraction-ui/astro 0.4.0 → 0.4.4
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/dist/accordion/index.ts +1 -0
- package/dist/ai/ai-manager.ts +121 -0
- package/dist/ai/index.ts +23 -0
- package/dist/ai/mock-providers.ts +68 -0
- package/dist/ai/sanitizer.ts +174 -0
- package/dist/ai/tts-manager.ts +80 -0
- package/dist/ai/types.ts +72 -0
- package/dist/animated-text/animated-text.styles.ts +28 -0
- package/dist/animated-text/animated-text.ts +83 -0
- package/dist/animated-text/index.ts +15 -0
- package/dist/app-shell/app-shell.ts +252 -0
- package/dist/app-shell/auth-shell.ts +84 -0
- package/dist/app-shell/index.ts +22 -0
- package/dist/app-shell/page-shell.ts +125 -0
- package/dist/astro-accordion/Button.astro +55 -0
- package/dist/astro-accordion/index.ts +1 -0
- package/dist/astro-ai/AIScript.astro +69 -0
- package/dist/astro-ai/TTSScript.astro +60 -0
- package/dist/astro-ai/index.ts +16 -0
- package/dist/astro-animated-text/AnimatedText.astro +81 -0
- package/dist/astro-animated-text/TypewriterText.astro +90 -0
- package/dist/astro-animated-text/index.ts +1 -0
- package/dist/astro-app-shell/AppShell.astro +195 -0
- package/dist/astro-app-shell/AppShellContent.astro +29 -0
- package/dist/astro-app-shell/AppShellHeader.astro +54 -0
- package/dist/astro-app-shell/AppShellMain.astro +18 -0
- package/dist/astro-app-shell/AppShellMobileNav.astro +27 -0
- package/dist/astro-app-shell/AppShellOverlay.astro +21 -0
- package/dist/astro-app-shell/AppShellSidebar.astro +26 -0
- package/dist/astro-app-shell/AuthShell.astro +31 -0
- package/dist/astro-app-shell/AuthShellCard.astro +24 -0
- package/dist/astro-app-shell/PageShell.astro +36 -0
- package/dist/astro-app-shell/PageShellFooter.astro +30 -0
- package/dist/astro-app-shell/PageShellNav.astro +33 -0
- package/dist/astro-app-shell/PageShellSection.astro +32 -0
- package/dist/astro-app-shell/index.ts +21 -0
- package/dist/astro-auth/AuthGuard.astro +133 -0
- package/dist/astro-auth/index.ts +5 -0
- package/dist/astro-avatar/Avatar.astro +22 -0
- package/dist/astro-avatar/AvatarFallback.astro +18 -0
- package/dist/astro-avatar/AvatarImage.astro +48 -0
- package/dist/astro-avatar/index.ts +1 -0
- package/dist/astro-avatar-group/AvatarGroup.astro +42 -0
- package/dist/astro-avatar-group/index.ts +1 -0
- package/dist/astro-badge/Badge.astro +27 -0
- package/dist/astro-badge/index.ts +1 -0
- package/dist/astro-bottom-nav/BottomNav.astro +40 -0
- package/dist/astro-bottom-nav/index.ts +1 -0
- package/dist/astro-breadcrumbs/Breadcrumbs.astro +56 -0
- package/dist/astro-breadcrumbs/index.ts +1 -0
- package/dist/astro-button/Button.astro +55 -0
- package/dist/astro-button/index.ts +1 -0
- package/dist/astro-calendar/Calendar.astro +259 -0
- package/dist/astro-calendar/index.ts +1 -0
- package/dist/astro-callout/Callout.astro +3 -0
- package/dist/astro-callout/index.ts +1 -0
- package/dist/astro-card/Card.astro +20 -0
- package/dist/astro-card/CardContent.astro +13 -0
- package/dist/astro-card/CardDescription.astro +13 -0
- package/dist/astro-card/CardFooter.astro +13 -0
- package/dist/astro-card/CardHeader.astro +13 -0
- package/dist/astro-card/CardTitle.astro +15 -0
- package/dist/astro-card/index.ts +1 -0
- package/dist/astro-card-grid/CardGrid.astro +17 -0
- package/dist/astro-card-grid/index.ts +1 -0
- package/dist/astro-carousel/Button.astro +55 -0
- package/dist/astro-carousel/index.ts +1 -0
- package/dist/astro-charts/Bars.astro +53 -0
- package/dist/astro-charts/Chart.astro +31 -0
- package/dist/astro-charts/Circles.astro +48 -0
- package/dist/astro-charts/Gradient.astro +34 -0
- package/dist/astro-charts/Histogram.astro +107 -0
- package/dist/astro-charts/Line.astro +55 -0
- package/dist/astro-charts/PieChart.astro +63 -0
- package/dist/astro-charts/ScatterPlot.astro +95 -0
- package/dist/astro-charts/XAxis.astro +46 -0
- package/dist/astro-charts/YAxis.astro +44 -0
- package/dist/astro-charts/index.ts +26 -0
- package/dist/astro-checkbox/Checkbox.astro +129 -0
- package/dist/astro-checkbox/index.ts +1 -0
- package/dist/astro-code-block/CodeBlock.astro +3 -0
- package/dist/astro-code-block/index.ts +1 -0
- package/dist/astro-code-editor/CodeEditor.astro +123 -0
- package/dist/astro-code-editor/index.ts +1 -0
- package/dist/astro-collapsible/Collapsible.astro +58 -0
- package/dist/astro-collapsible/CollapsibleContent.astro +21 -0
- package/dist/astro-collapsible/CollapsibleTrigger.astro +17 -0
- package/dist/astro-collapsible/index.ts +1 -0
- package/dist/astro-command/Command.astro +170 -0
- package/dist/astro-command/CommandEmpty.astro +17 -0
- package/dist/astro-command/CommandGroup.astro +25 -0
- package/dist/astro-command/CommandInput.astro +21 -0
- package/dist/astro-command/CommandItem.astro +26 -0
- package/dist/astro-command/CommandList.astro +17 -0
- package/dist/astro-command/CommandSeparator.astro +14 -0
- package/dist/astro-command/index.ts +1 -0
- package/dist/astro-command-input/CommandInput.astro +6 -0
- package/dist/astro-command-input/index.ts +1 -0
- package/dist/astro-content-protection/ContentProtection.astro +104 -0
- package/dist/astro-content-protection/index.ts +1 -0
- package/dist/astro-data-table/DataTable.astro +263 -0
- package/dist/astro-data-table/index.ts +1 -0
- package/dist/astro-date-picker/DatePicker.astro +398 -0
- package/dist/astro-date-picker/index.ts +1 -0
- package/dist/astro-device-frame/DeviceFrame.astro +44 -0
- package/dist/astro-device-frame/index.ts +1 -0
- package/dist/astro-dialog/Dialog.astro +138 -0
- package/dist/astro-dialog/DialogClose.astro +16 -0
- package/dist/astro-dialog/DialogContent.astro +24 -0
- package/dist/astro-dialog/DialogDescription.astro +15 -0
- package/dist/astro-dialog/DialogFooter.astro +14 -0
- package/dist/astro-dialog/DialogHeader.astro +14 -0
- package/dist/astro-dialog/DialogOverlay.astro +17 -0
- package/dist/astro-dialog/DialogTitle.astro +15 -0
- package/dist/astro-dialog/DialogTrigger.astro +18 -0
- package/dist/astro-dialog/index.ts +1 -0
- package/dist/astro-diff-viewer/DiffViewer.astro +371 -0
- package/dist/astro-diff-viewer/index.ts +1 -0
- package/dist/astro-dropdown-menu/DropdownMenu.astro +138 -0
- package/dist/astro-dropdown-menu/DropdownMenuContent.astro +20 -0
- package/dist/astro-dropdown-menu/DropdownMenuItem.astro +21 -0
- package/dist/astro-dropdown-menu/DropdownMenuLabel.astro +14 -0
- package/dist/astro-dropdown-menu/DropdownMenuSeparator.astro +14 -0
- package/dist/astro-dropdown-menu/DropdownMenuTrigger.astro +18 -0
- package/dist/astro-dropdown-menu/index.ts +1 -0
- package/dist/astro-emoji-picker/EmojiPicker.astro +255 -0
- package/dist/astro-emoji-picker/index.ts +1 -0
- package/dist/astro-feedback-dialog/FeedbackDialog.astro +152 -0
- package/dist/astro-feedback-dialog/index.ts +1 -0
- package/dist/astro-file-tree/astro-file-tree.astro +4 -0
- package/dist/astro-file-tree/index.ts +1 -0
- package/dist/astro-file-upload/FileUpload.astro +306 -0
- package/dist/astro-file-upload/index.ts +1 -0
- package/dist/astro-footer/Footer.astro +61 -0
- package/dist/astro-footer/index.ts +1 -0
- package/dist/astro-icon-system/astro-icon-system.astro +4 -0
- package/dist/astro-icon-system/index.ts +1 -0
- package/dist/astro-inline-editor/InlineEditor.astro +169 -0
- package/dist/astro-inline-editor/index.ts +1 -0
- package/dist/astro-input/Input.astro +49 -0
- package/dist/astro-input/index.ts +1 -0
- package/dist/astro-input-group/InputGroup.astro +29 -0
- package/dist/astro-input-group/InputGroupAddon.astro +14 -0
- package/dist/astro-input-group/InputGroupButton.astro +19 -0
- package/dist/astro-input-group/InputGroupText.astro +11 -0
- package/dist/astro-input-group/index.ts +1 -0
- package/dist/astro-install-prompt/InstallPrompt.astro +115 -0
- package/dist/astro-install-prompt/index.ts +1 -0
- package/dist/astro-keyboard-shortcut/KeyboardShortcut.astro +83 -0
- package/dist/astro-keyboard-shortcut/ShortcutBadge.astro +41 -0
- package/dist/astro-keyboard-shortcut/index.ts +1 -0
- package/dist/astro-language-selector/LanguageSelector.astro +247 -0
- package/dist/astro-language-selector/index.ts +1 -0
- package/dist/astro-link-card/LinkCard.astro +17 -0
- package/dist/astro-link-card/index.ts +1 -0
- package/dist/astro-markdown-renderer/MarkdownRenderer.astro +62 -0
- package/dist/astro-markdown-renderer/index.ts +1 -0
- package/dist/astro-mobile-nav/MobileNav.astro +84 -0
- package/dist/astro-mobile-nav/MobileNavContent.astro +29 -0
- package/dist/astro-mobile-nav/MobileNavLink.astro +16 -0
- package/dist/astro-mobile-nav/MobileNavTrigger.astro +57 -0
- package/dist/astro-mobile-nav/index.ts +1 -0
- package/dist/astro-navbar/Navbar.astro +49 -0
- package/dist/astro-navbar/index.ts +1 -0
- package/dist/astro-otp-input/OtpInput.astro +253 -0
- package/dist/astro-otp-input/index.ts +1 -0
- package/dist/astro-pagination/Pagination.astro +3 -0
- package/dist/astro-pagination/index.ts +1 -0
- package/dist/astro-payment/Payment.astro +19 -0
- package/dist/astro-payment/index.ts +1 -0
- package/dist/astro-popover/Popover.astro +87 -0
- package/dist/astro-popover/PopoverClose.astro +16 -0
- package/dist/astro-popover/PopoverContent.astro +23 -0
- package/dist/astro-popover/PopoverTrigger.astro +18 -0
- package/dist/astro-popover/index.ts +1 -0
- package/dist/astro-presence-indicator/PresenceIndicator.astro +26 -0
- package/dist/astro-presence-indicator/index.ts +1 -0
- package/dist/astro-progress-display/BadgeDisplay.astro +33 -0
- package/dist/astro-progress-display/ProgressBar.astro +27 -0
- package/dist/astro-progress-display/StatsGrid.astro +32 -0
- package/dist/astro-progress-display/index.ts +1 -0
- package/dist/astro-radio/RadioGroup.astro +111 -0
- package/dist/astro-radio/RadioItem.astro +36 -0
- package/dist/astro-radio/index.ts +1 -0
- package/dist/astro-reaction-bar/ReactionBar.astro +117 -0
- package/dist/astro-reaction-bar/index.ts +1 -0
- package/dist/astro-resizable-layout/ResizableDivider.astro +27 -0
- package/dist/astro-resizable-layout/ResizableLayout.astro +162 -0
- package/dist/astro-resizable-layout/ResizablePane.astro +28 -0
- package/dist/astro-resizable-layout/index.ts +11 -0
- package/dist/astro-rich-editor/RichEditor.astro +260 -0
- package/dist/astro-rich-editor/index.ts +25 -0
- package/dist/astro-search-bar/SearchBar.astro +140 -0
- package/dist/astro-search-bar/SearchResultItem.astro +16 -0
- package/dist/astro-search-bar/SearchResults.astro +17 -0
- package/dist/astro-search-bar/index.ts +1 -0
- package/dist/astro-select/Select.astro +165 -0
- package/dist/astro-select/SelectContent.astro +19 -0
- package/dist/astro-select/SelectItem.astro +42 -0
- package/dist/astro-select/SelectTrigger.astro +36 -0
- package/dist/astro-select/index.ts +1 -0
- package/dist/astro-sidebar/Sidebar.astro +64 -0
- package/dist/astro-sidebar/index.ts +1 -0
- package/dist/astro-skeleton/Skeleton.astro +39 -0
- package/dist/astro-skeleton/SkeletonText.astro +22 -0
- package/dist/astro-skeleton/index.ts +1 -0
- package/dist/astro-skip-to-content/SkipToContent.astro +3 -0
- package/dist/astro-skip-to-content/index.ts +1 -0
- package/dist/astro-slide-viewer/SlideViewer.astro +231 -0
- package/dist/astro-slide-viewer/index.ts +1 -0
- package/dist/astro-slider/index.ts +1 -0
- package/dist/astro-status-indicator/StatusIndicator.astro +31 -0
- package/dist/astro-status-indicator/index.ts +1 -0
- package/dist/astro-steps/Steps.astro +3 -0
- package/dist/astro-steps/index.ts +1 -0
- package/dist/astro-switch/Switch.astro +89 -0
- package/dist/astro-switch/index.ts +1 -0
- package/dist/astro-table-of-contents/TableOfContents.astro +53 -0
- package/dist/astro-table-of-contents/index.ts +1 -0
- package/dist/astro-tabs/Tabs.astro +96 -0
- package/dist/astro-tabs/TabsContent.astro +20 -0
- package/dist/astro-tabs/TabsList.astro +16 -0
- package/dist/astro-tabs/TabsTrigger.astro +24 -0
- package/dist/astro-tabs/index.ts +1 -0
- package/dist/astro-textarea/Textarea.astro +51 -0
- package/dist/astro-textarea/index.ts +1 -0
- package/dist/astro-theme/ThemeScript.astro +13 -0
- package/dist/astro-theme/ThemeToggle.astro +279 -0
- package/dist/astro-theme/index.ts +1 -0
- package/dist/astro-thread-view/ThreadView.astro +159 -0
- package/dist/astro-thread-view/index.ts +1 -0
- package/dist/astro-toast/Toast.astro +49 -0
- package/dist/astro-toast/Toaster.astro +142 -0
- package/dist/astro-toast/index.ts +1 -0
- package/dist/astro-tooltip/Tooltip.astro +95 -0
- package/dist/astro-tooltip/TooltipContent.astro +22 -0
- package/dist/astro-tooltip/TooltipTrigger.astro +16 -0
- package/dist/astro-tooltip/index.ts +1 -0
- package/dist/astro-version-selector/VersionSelector.astro +174 -0
- package/dist/astro-version-selector/index.ts +1 -0
- package/dist/astro-video-player/VideoPlayer.astro +153 -0
- package/dist/astro-video-player/index.ts +1 -0
- package/dist/auth/adapters/mock.ts +74 -0
- package/dist/auth/auth-machine.ts +120 -0
- package/dist/auth/index.ts +22 -0
- package/dist/auth/rbac.ts +44 -0
- package/dist/auth/types.ts +44 -0
- package/dist/avatar/avatar.styles.ts +47 -0
- package/dist/avatar/avatar.ts +73 -0
- package/dist/avatar/index.ts +15 -0
- package/dist/avatar-group/avatar-group.styles.ts +63 -0
- package/dist/avatar-group/avatar-group.ts +106 -0
- package/dist/avatar-group/index.ts +18 -0
- package/dist/badge/badge.styles.ts +24 -0
- package/dist/badge/badge.ts +48 -0
- package/dist/badge/index.ts +10 -0
- package/dist/bottom-nav/bottom-nav.styles.ts +18 -0
- package/dist/bottom-nav/bottom-nav.ts +33 -0
- package/dist/bottom-nav/index.ts +2 -0
- package/dist/breadcrumbs/breadcrumbs.styles.ts +20 -0
- package/dist/breadcrumbs/breadcrumbs.ts +72 -0
- package/dist/breadcrumbs/index.ts +8 -0
- package/dist/button/button.styles.ts +38 -0
- package/dist/button/button.ts +64 -0
- package/dist/button/index.ts +10 -0
- package/dist/calendar/calendar.styles.ts +21 -0
- package/dist/calendar/calendar.ts +202 -0
- package/dist/calendar/index.ts +9 -0
- package/dist/callout/callout.ts +1 -0
- package/dist/callout/index.ts +1 -0
- package/dist/card/card.styles.ts +55 -0
- package/dist/card/card.ts +45 -0
- package/dist/card/index.ts +20 -0
- package/dist/card-grid/card-grid.ts +9 -0
- package/dist/card-grid/index.ts +1 -0
- package/dist/carousel/index.ts +1 -0
- package/dist/charts/axis.ts +50 -0
- package/dist/charts/chart.ts +73 -0
- package/dist/charts/colorblind.ts +100 -0
- package/dist/charts/data.ts +72 -0
- package/dist/charts/geometry.ts +54 -0
- package/dist/charts/index.ts +61 -0
- package/dist/charts/scales.ts +151 -0
- package/dist/checkbox/checkbox.styles.ts +33 -0
- package/dist/checkbox/checkbox.ts +73 -0
- package/dist/checkbox/index.ts +10 -0
- package/dist/code-block/code-block.ts +1 -0
- package/dist/code-block/index.ts +1 -0
- package/dist/code-editor/code-editor.styles.ts +32 -0
- package/dist/code-editor/code-editor.ts +140 -0
- package/dist/code-editor/index.ts +9 -0
- package/dist/collapsible/collapsible.styles.ts +14 -0
- package/dist/collapsible/collapsible.ts +93 -0
- package/dist/collapsible/index.ts +7 -0
- package/dist/command/command.styles.ts +27 -0
- package/dist/command/command.ts +179 -0
- package/dist/command/index.ts +14 -0
- package/dist/command-input/command-input.ts +176 -0
- package/dist/command-input/index.ts +1 -0
- package/dist/content-protection/content-protection.styles.ts +9 -0
- package/dist/content-protection/content-protection.ts +68 -0
- package/dist/content-protection/index.ts +8 -0
- package/dist/data-table/data-table.styles.ts +55 -0
- package/dist/data-table/data-table.ts +183 -0
- package/dist/data-table/index.ts +15 -0
- package/dist/date-picker/date-picker.styles.ts +31 -0
- package/dist/date-picker/date-picker.ts +333 -0
- package/dist/date-picker/index.ts +18 -0
- package/dist/device-frame/device-frame.styles.ts +21 -0
- package/dist/device-frame/device-frame.ts +112 -0
- package/dist/device-frame/index.ts +10 -0
- package/dist/dialog/dialog.styles.ts +8 -0
- package/dist/dialog/dialog.ts +133 -0
- package/dist/dialog/index.ts +8 -0
- package/dist/diff-viewer/diff-viewer.styles.ts +124 -0
- package/dist/diff-viewer/diff-viewer.ts +255 -0
- package/dist/diff-viewer/index.ts +20 -0
- package/dist/dropdown-menu/dropdown-menu.styles.ts +9 -0
- package/dist/dropdown-menu/dropdown-menu.ts +139 -0
- package/dist/dropdown-menu/index.ts +9 -0
- package/dist/emoji-picker/emoji-data.ts +282 -0
- package/dist/emoji-picker/emoji-picker.styles.ts +32 -0
- package/dist/emoji-picker/emoji-picker.ts +165 -0
- package/dist/emoji-picker/index.ts +25 -0
- package/dist/feedback-dialog/feedback-dialog.styles.ts +15 -0
- package/dist/feedback-dialog/feedback-dialog.ts +147 -0
- package/dist/feedback-dialog/index.ts +11 -0
- package/dist/file-upload/file-upload.styles.ts +30 -0
- package/dist/file-upload/file-upload.ts +260 -0
- package/dist/file-upload/index.ts +19 -0
- package/dist/footer/footer.styles.ts +5 -0
- package/dist/footer/footer.ts +32 -0
- package/dist/footer/index.ts +9 -0
- package/dist/index.ts +77 -0
- package/dist/inline-editor/index.ts +13 -0
- package/dist/inline-editor/inline-editor.styles.ts +42 -0
- package/dist/inline-editor/inline-editor.ts +96 -0
- package/dist/input/index.ts +9 -0
- package/dist/input/input.styles.ts +15 -0
- package/dist/input/input.ts +84 -0
- package/dist/input-group/index.ts +13 -0
- package/dist/input-group/input-group.styles.ts +50 -0
- package/dist/input-group/input-group.ts +44 -0
- package/dist/install-prompt/index.ts +9 -0
- package/dist/install-prompt/install-prompt.styles.ts +5 -0
- package/dist/install-prompt/install-prompt.ts +68 -0
- package/dist/keyboard-shortcut/index.ts +12 -0
- package/dist/keyboard-shortcut/keyboard-shortcut.styles.ts +8 -0
- package/dist/keyboard-shortcut/keyboard-shortcut.ts +153 -0
- package/dist/language-selector/index.ts +8 -0
- package/dist/language-selector/language-selector.styles.ts +28 -0
- package/dist/language-selector/language-selector.ts +149 -0
- package/dist/link-card/index.ts +1 -0
- package/dist/link-card/link-card.ts +9 -0
- package/dist/markdown-renderer/index.ts +8 -0
- package/dist/markdown-renderer/markdown-renderer.styles.ts +31 -0
- package/dist/markdown-renderer/markdown-renderer.ts +251 -0
- package/dist/mobile-nav/index.ts +14 -0
- package/dist/mobile-nav/mobile-nav.styles.ts +39 -0
- package/dist/mobile-nav/mobile-nav.ts +74 -0
- package/dist/navbar/index.ts +9 -0
- package/dist/navbar/navbar.styles.ts +29 -0
- package/dist/navbar/navbar.ts +39 -0
- package/dist/otp-input/index.ts +13 -0
- package/dist/otp-input/otp-input.styles.ts +51 -0
- package/dist/otp-input/otp-input.ts +198 -0
- package/dist/pagination/index.ts +1 -0
- package/dist/payment/index.ts +1 -0
- package/dist/payment/payment.ts +16 -0
- package/dist/popover/index.ts +7 -0
- package/dist/popover/popover.styles.ts +16 -0
- package/dist/popover/popover.ts +89 -0
- package/dist/presence-indicator/index.ts +14 -0
- package/dist/presence-indicator/presence-indicator.styles.ts +29 -0
- package/dist/presence-indicator/presence-indicator.ts +63 -0
- package/dist/progress-display/index.ts +15 -0
- package/dist/progress-display/progress-display.styles.ts +72 -0
- package/dist/progress-display/progress-display.ts +60 -0
- package/dist/radio/index.ts +8 -0
- package/dist/radio/radio.styles.ts +34 -0
- package/dist/radio/radio.ts +70 -0
- package/dist/reaction-bar/index.ts +14 -0
- package/dist/reaction-bar/reaction-bar.styles.ts +23 -0
- package/dist/reaction-bar/reaction-bar.ts +87 -0
- package/dist/resizable-layout/index.ts +12 -0
- package/dist/resizable-layout/resizable-layout.styles.ts +50 -0
- package/dist/resizable-layout/resizable-layout.ts +139 -0
- package/dist/rich-editor/editor.ts +342 -0
- package/dist/rich-editor/emoji.ts +175 -0
- package/dist/rich-editor/history.ts +79 -0
- package/dist/rich-editor/index.ts +106 -0
- package/dist/rich-editor/markdown-shortcuts.ts +248 -0
- package/dist/rich-editor/mentions.ts +162 -0
- package/dist/rich-editor/model.ts +206 -0
- package/dist/rich-editor/operations.ts +772 -0
- package/dist/rich-editor/selection.ts +157 -0
- package/dist/rich-editor/serialization.ts +711 -0
- package/dist/rich-editor/slash-commands.ts +212 -0
- package/dist/search-bar/index.ts +7 -0
- package/dist/search-bar/search-bar.styles.ts +29 -0
- package/dist/search-bar/search-bar.ts +130 -0
- package/dist/select/index.ts +13 -0
- package/dist/select/select.styles.ts +52 -0
- package/dist/select/select.ts +152 -0
- package/dist/shared/a11y.ts +33 -0
- package/dist/shared/aria.ts +30 -0
- package/dist/shared/cn.ts +35 -0
- package/dist/shared/cva.ts +79 -0
- package/dist/shared/engine-adapter.ts +10 -0
- package/dist/shared/focus-trap.ts +123 -0
- package/dist/shared/index.ts +60 -0
- package/dist/shared/keyboard.ts +36 -0
- package/dist/shared/live-region.ts +90 -0
- package/dist/shared/motion.ts +15 -0
- package/dist/shared/skip-link.ts +35 -0
- package/dist/shared/state-machine.ts +57 -0
- package/dist/shared/tokens.ts +16 -0
- package/dist/shared/types.ts +45 -0
- package/dist/shared/variants.ts +17 -0
- package/dist/sidebar/index.ts +9 -0
- package/dist/sidebar/sidebar.styles.ts +27 -0
- package/dist/sidebar/sidebar.ts +59 -0
- package/dist/skeleton/index.ts +8 -0
- package/dist/skeleton/skeleton.styles.ts +16 -0
- package/dist/skeleton/skeleton.ts +39 -0
- package/dist/skip-to-content/index.ts +1 -0
- package/dist/skip-to-content/skip-to-content.ts +1 -0
- package/dist/slide-viewer/index.ts +16 -0
- package/dist/slide-viewer/slide-viewer.styles.ts +57 -0
- package/dist/slide-viewer/slide-viewer.ts +152 -0
- package/dist/slider/index.ts +1 -0
- package/dist/slider/slider.ts +2 -0
- package/dist/status-indicator/index.ts +15 -0
- package/dist/status-indicator/status-indicator.styles.ts +41 -0
- package/dist/status-indicator/status-indicator.ts +66 -0
- package/dist/steps/index.ts +1 -0
- package/dist/steps/steps.ts +1 -0
- package/dist/switch/index.ts +7 -0
- package/dist/switch/switch.styles.ts +55 -0
- package/dist/switch/switch.ts +63 -0
- package/dist/table-of-contents/index.ts +1 -0
- package/dist/table-of-contents/table-of-contents.ts +37 -0
- package/dist/tabs/index.ts +8 -0
- package/dist/tabs/tabs.styles.ts +9 -0
- package/dist/tabs/tabs.ts +133 -0
- package/dist/textarea/index.ts +7 -0
- package/dist/textarea/textarea.styles.ts +15 -0
- package/dist/textarea/textarea.ts +59 -0
- package/dist/theme/dom-adapters.ts +60 -0
- package/dist/theme/index.ts +18 -0
- package/dist/theme/theme-machine.ts +130 -0
- package/dist/theme/theme-script.ts +18 -0
- package/dist/thread-view/index.ts +26 -0
- package/dist/thread-view/thread-view.styles.ts +35 -0
- package/dist/thread-view/thread-view.ts +176 -0
- package/dist/toast/index.ts +13 -0
- package/dist/toast/toast.styles.ts +19 -0
- package/dist/toast/toast.ts +203 -0
- package/dist/tooltip/index.ts +7 -0
- package/dist/tooltip/tooltip.styles.ts +16 -0
- package/dist/tooltip/tooltip.ts +109 -0
- package/dist/version-selector/index.ts +12 -0
- package/dist/version-selector/version-selector.styles.ts +41 -0
- package/dist/version-selector/version-selector.ts +136 -0
- package/dist/video-player/index.ts +12 -0
- package/dist/video-player/video-player.styles.ts +42 -0
- package/dist/video-player/video-player.ts +100 -0
- package/package.json +20 -19
- package/src/index.ts +0 -94
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* Histogram — standalone histogram chart.
|
|
4
|
+
* Accepts raw numeric data and renders binned bars with axes.
|
|
5
|
+
*/
|
|
6
|
+
import {
|
|
7
|
+
computeHistogramBins,
|
|
8
|
+
createLinearScale,
|
|
9
|
+
createBandScale,
|
|
10
|
+
combineDimensions,
|
|
11
|
+
formatTick,
|
|
12
|
+
type Margin,
|
|
13
|
+
} from '../charts/index.ts'
|
|
14
|
+
|
|
15
|
+
interface Props extends astroHTML.JSX.HTMLAttributes {
|
|
16
|
+
/** Raw numeric data */
|
|
17
|
+
data: number[]
|
|
18
|
+
/** Width of the SVG (default 600) */
|
|
19
|
+
width?: number
|
|
20
|
+
/** Height of the SVG (default 400) */
|
|
21
|
+
height?: number
|
|
22
|
+
/** Number of bins (default 10) */
|
|
23
|
+
bins?: number
|
|
24
|
+
/** Fill color (default 'steelblue') */
|
|
25
|
+
fill?: string
|
|
26
|
+
/** Custom margin */
|
|
27
|
+
margin?: Partial<Margin>
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const {
|
|
31
|
+
data,
|
|
32
|
+
width = 600,
|
|
33
|
+
height = 400,
|
|
34
|
+
bins: binCount = 10,
|
|
35
|
+
fill = 'steelblue',
|
|
36
|
+
margin,
|
|
37
|
+
class: className,
|
|
38
|
+
...props
|
|
39
|
+
} = Astro.props
|
|
40
|
+
|
|
41
|
+
const dimensions = combineDimensions({ width, height, margin })
|
|
42
|
+
const { boundedWidth, boundedHeight } = dimensions
|
|
43
|
+
|
|
44
|
+
const histBins = computeHistogramBins(data, binCount)
|
|
45
|
+
const maxCount = Math.max(...histBins.map((b) => b.count))
|
|
46
|
+
|
|
47
|
+
const labels = histBins.map((b) => `${formatTick(b.x0, 'number')}-${formatTick(b.x1, 'number')}`)
|
|
48
|
+
const xScale = createBandScale(labels, [0, boundedWidth], 0.05)
|
|
49
|
+
const yScale = createLinearScale([0, maxCount], [boundedHeight, 0])
|
|
50
|
+
|
|
51
|
+
const yTicks = yScale.ticks(5)
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
<svg
|
|
55
|
+
width={width}
|
|
56
|
+
height={height}
|
|
57
|
+
class={className}
|
|
58
|
+
data-rfr-chart-histogram
|
|
59
|
+
{...props}
|
|
60
|
+
>
|
|
61
|
+
<g transform={`translate(${dimensions.margin.left},${dimensions.margin.top})`}>
|
|
62
|
+
{histBins.map((bin, i) => {
|
|
63
|
+
const label = labels[i]
|
|
64
|
+
const barX = xScale(label)
|
|
65
|
+
const barY = yScale(bin.count)
|
|
66
|
+
const barHeight = boundedHeight - barY
|
|
67
|
+
const barWidth = xScale.bandwidth()
|
|
68
|
+
return (
|
|
69
|
+
<rect
|
|
70
|
+
x={barX}
|
|
71
|
+
y={barY}
|
|
72
|
+
width={barWidth}
|
|
73
|
+
height={barHeight}
|
|
74
|
+
fill={fill}
|
|
75
|
+
/>
|
|
76
|
+
)
|
|
77
|
+
})}
|
|
78
|
+
{/* X Axis */}
|
|
79
|
+
<g transform={`translate(0,${boundedHeight})`}>
|
|
80
|
+
{labels.map((label, i) => {
|
|
81
|
+
const x = xScale(label) + xScale.bandwidth() / 2
|
|
82
|
+
return (
|
|
83
|
+
<g transform={`translate(${x},0)`}>
|
|
84
|
+
<line y2={6} stroke="currentColor" />
|
|
85
|
+
<text y={18} text-anchor="middle" font-size={10} fill="currentColor">
|
|
86
|
+
{label}
|
|
87
|
+
</text>
|
|
88
|
+
</g>
|
|
89
|
+
)
|
|
90
|
+
})}
|
|
91
|
+
</g>
|
|
92
|
+
{/* Y Axis */}
|
|
93
|
+
<g>
|
|
94
|
+
{yTicks.map((tick) => {
|
|
95
|
+
const y = yScale(tick)
|
|
96
|
+
return (
|
|
97
|
+
<g transform={`translate(0,${y})`}>
|
|
98
|
+
<line x2={-6} stroke="currentColor" />
|
|
99
|
+
<text x={-9} dy="0.32em" text-anchor="end" font-size={10} fill="currentColor">
|
|
100
|
+
{formatTick(tick, 'number')}
|
|
101
|
+
</text>
|
|
102
|
+
</g>
|
|
103
|
+
)
|
|
104
|
+
})}
|
|
105
|
+
</g>
|
|
106
|
+
</g>
|
|
107
|
+
</svg>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* Line — line/area chart path, server-rendered as an SVG <path>.
|
|
4
|
+
* Accepts pre-computed x/y value arrays.
|
|
5
|
+
*/
|
|
6
|
+
import { createLinearScale, computeExtent, linePath } from '../charts/index.ts'
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
/** X values for each data point */
|
|
10
|
+
xValues: number[]
|
|
11
|
+
/** Y values for each data point */
|
|
12
|
+
yValues: number[]
|
|
13
|
+
/** Bounded width of the chart area */
|
|
14
|
+
boundedWidth: number
|
|
15
|
+
/** Bounded height of the chart area */
|
|
16
|
+
boundedHeight: number
|
|
17
|
+
/** Stroke color (default 'currentColor') */
|
|
18
|
+
stroke?: string
|
|
19
|
+
/** Stroke width (default 2) */
|
|
20
|
+
strokeWidth?: number
|
|
21
|
+
/** Fill (default 'none') */
|
|
22
|
+
fill?: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const {
|
|
26
|
+
xValues,
|
|
27
|
+
yValues,
|
|
28
|
+
boundedWidth,
|
|
29
|
+
boundedHeight,
|
|
30
|
+
stroke = 'currentColor',
|
|
31
|
+
strokeWidth = 2,
|
|
32
|
+
fill = 'none',
|
|
33
|
+
} = Astro.props
|
|
34
|
+
|
|
35
|
+
const [xMin, xMax] = computeExtent(xValues)
|
|
36
|
+
const [yMin, yMax] = computeExtent(yValues)
|
|
37
|
+
|
|
38
|
+
const xScale = createLinearScale([xMin, xMax], [0, boundedWidth])
|
|
39
|
+
const yScale = createLinearScale([yMin, yMax], [boundedHeight, 0])
|
|
40
|
+
|
|
41
|
+
const points = xValues.map((xv, i) => ({
|
|
42
|
+
x: xScale(xv),
|
|
43
|
+
y: yScale(yValues[i]),
|
|
44
|
+
}))
|
|
45
|
+
|
|
46
|
+
const d = linePath(points)
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
<path
|
|
50
|
+
d={d}
|
|
51
|
+
stroke={stroke}
|
|
52
|
+
stroke-width={strokeWidth}
|
|
53
|
+
fill={fill}
|
|
54
|
+
data-rfr-chart-line
|
|
55
|
+
/>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* PieChart — standalone pie/donut chart rendered as SVG arcs.
|
|
4
|
+
*/
|
|
5
|
+
import { arcPath } from '../charts/index.ts'
|
|
6
|
+
|
|
7
|
+
const DEFAULT_COLORS = [
|
|
8
|
+
'#4e79a7', '#f28e2b', '#e15759', '#76b7b2',
|
|
9
|
+
'#59a14f', '#edc948', '#b07aa1', '#ff9da7',
|
|
10
|
+
'#9c755f', '#bab0ac',
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
interface Props extends astroHTML.JSX.HTMLAttributes {
|
|
14
|
+
/** Numeric values for each slice */
|
|
15
|
+
values: number[]
|
|
16
|
+
/** Width of the SVG (default 300) */
|
|
17
|
+
width?: number
|
|
18
|
+
/** Height of the SVG (default 300) */
|
|
19
|
+
height?: number
|
|
20
|
+
/** Slice colors */
|
|
21
|
+
colors?: string[]
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const {
|
|
25
|
+
values,
|
|
26
|
+
width = 300,
|
|
27
|
+
height = 300,
|
|
28
|
+
colors = DEFAULT_COLORS,
|
|
29
|
+
class: className,
|
|
30
|
+
...props
|
|
31
|
+
} = Astro.props
|
|
32
|
+
|
|
33
|
+
const cx = width / 2
|
|
34
|
+
const cy = height / 2
|
|
35
|
+
const radius = Math.min(cx, cy) - 10
|
|
36
|
+
|
|
37
|
+
const total = values.reduce((sum, v) => sum + v, 0)
|
|
38
|
+
|
|
39
|
+
let currentAngle = -Math.PI / 2
|
|
40
|
+
|
|
41
|
+
const arcs = values.map((val, i) => {
|
|
42
|
+
const sliceAngle = (val / total) * Math.PI * 2
|
|
43
|
+
const startAngle = currentAngle
|
|
44
|
+
const endAngle = currentAngle + sliceAngle
|
|
45
|
+
currentAngle = endAngle
|
|
46
|
+
return { startAngle, endAngle, color: colors[i % colors.length] }
|
|
47
|
+
})
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
<svg
|
|
51
|
+
width={width}
|
|
52
|
+
height={height}
|
|
53
|
+
class={className}
|
|
54
|
+
data-rfr-chart-pie
|
|
55
|
+
{...props}
|
|
56
|
+
>
|
|
57
|
+
{arcs.map((arc) => (
|
|
58
|
+
<path
|
|
59
|
+
d={arcPath(cx, cy, radius, arc.startAngle, arc.endAngle)}
|
|
60
|
+
fill={arc.color}
|
|
61
|
+
/>
|
|
62
|
+
))}
|
|
63
|
+
</svg>
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* ScatterPlot — standalone scatter plot chart.
|
|
4
|
+
* Accepts pre-computed x/y arrays and renders circles with axes.
|
|
5
|
+
*/
|
|
6
|
+
import { createLinearScale, computeExtent, combineDimensions, formatTick, type Margin } from '../charts/index.ts'
|
|
7
|
+
|
|
8
|
+
interface Props extends astroHTML.JSX.HTMLAttributes {
|
|
9
|
+
/** X values for each data point */
|
|
10
|
+
xValues: number[]
|
|
11
|
+
/** Y values for each data point */
|
|
12
|
+
yValues: number[]
|
|
13
|
+
/** Width of the SVG (default 600) */
|
|
14
|
+
width?: number
|
|
15
|
+
/** Height of the SVG (default 400) */
|
|
16
|
+
height?: number
|
|
17
|
+
/** Circle radius (default 4) */
|
|
18
|
+
r?: number
|
|
19
|
+
/** Fill color (default 'steelblue') */
|
|
20
|
+
fill?: string
|
|
21
|
+
/** Custom margin */
|
|
22
|
+
margin?: Partial<Margin>
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const {
|
|
26
|
+
xValues,
|
|
27
|
+
yValues,
|
|
28
|
+
width = 600,
|
|
29
|
+
height = 400,
|
|
30
|
+
r = 4,
|
|
31
|
+
fill = 'steelblue',
|
|
32
|
+
margin,
|
|
33
|
+
class: className,
|
|
34
|
+
...props
|
|
35
|
+
} = Astro.props
|
|
36
|
+
|
|
37
|
+
const dimensions = combineDimensions({ width, height, margin })
|
|
38
|
+
const { boundedWidth, boundedHeight } = dimensions
|
|
39
|
+
|
|
40
|
+
const [xMin, xMax] = computeExtent(xValues)
|
|
41
|
+
const [yMin, yMax] = computeExtent(yValues)
|
|
42
|
+
|
|
43
|
+
const xScale = createLinearScale([xMin, xMax], [0, boundedWidth])
|
|
44
|
+
const yScale = createLinearScale([yMin, yMax], [boundedHeight, 0])
|
|
45
|
+
|
|
46
|
+
const xTicks = xScale.ticks(5)
|
|
47
|
+
const yTicks = yScale.ticks(5)
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
<svg
|
|
51
|
+
width={width}
|
|
52
|
+
height={height}
|
|
53
|
+
class={className}
|
|
54
|
+
data-rfr-chart-scatter
|
|
55
|
+
{...props}
|
|
56
|
+
>
|
|
57
|
+
<g transform={`translate(${dimensions.margin.left},${dimensions.margin.top})`}>
|
|
58
|
+
{xValues.map((xv, i) => (
|
|
59
|
+
<circle
|
|
60
|
+
cx={xScale(xv)}
|
|
61
|
+
cy={yScale(yValues[i])}
|
|
62
|
+
r={r}
|
|
63
|
+
fill={fill}
|
|
64
|
+
/>
|
|
65
|
+
))}
|
|
66
|
+
{/* X Axis */}
|
|
67
|
+
<g transform={`translate(0,${boundedHeight})`}>
|
|
68
|
+
{xTicks.map((tick) => {
|
|
69
|
+
const px = xScale(tick)
|
|
70
|
+
return (
|
|
71
|
+
<g transform={`translate(${px},0)`}>
|
|
72
|
+
<line y2={6} stroke="currentColor" />
|
|
73
|
+
<text y={18} text-anchor="middle" font-size={10} fill="currentColor">
|
|
74
|
+
{formatTick(tick, 'number')}
|
|
75
|
+
</text>
|
|
76
|
+
</g>
|
|
77
|
+
)
|
|
78
|
+
})}
|
|
79
|
+
</g>
|
|
80
|
+
{/* Y Axis */}
|
|
81
|
+
<g>
|
|
82
|
+
{yTicks.map((tick) => {
|
|
83
|
+
const py = yScale(tick)
|
|
84
|
+
return (
|
|
85
|
+
<g transform={`translate(0,${py})`}>
|
|
86
|
+
<line x2={-6} stroke="currentColor" />
|
|
87
|
+
<text x={-9} dy="0.32em" text-anchor="end" font-size={10} fill="currentColor">
|
|
88
|
+
{formatTick(tick, 'number')}
|
|
89
|
+
</text>
|
|
90
|
+
</g>
|
|
91
|
+
)
|
|
92
|
+
})}
|
|
93
|
+
</g>
|
|
94
|
+
</g>
|
|
95
|
+
</svg>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* XAxis — horizontal axis with tick marks and labels.
|
|
4
|
+
* Designed to be used inside a Chart's <g> element.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
/** Tick values (strings or numbers) */
|
|
9
|
+
ticks: (number | string)[]
|
|
10
|
+
/** Pixel positions for each tick value */
|
|
11
|
+
positions: number[]
|
|
12
|
+
/** Distance from top of bounded area to axis line */
|
|
13
|
+
height: number
|
|
14
|
+
/** Tick mark length (default 6) */
|
|
15
|
+
tickSize?: number
|
|
16
|
+
/** Font size for labels (default 12) */
|
|
17
|
+
fontSize?: number
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const {
|
|
21
|
+
ticks,
|
|
22
|
+
positions,
|
|
23
|
+
height,
|
|
24
|
+
tickSize = 6,
|
|
25
|
+
fontSize = 12,
|
|
26
|
+
} = Astro.props
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
<g transform={`translate(0,${height})`} data-rfr-chart-xaxis>
|
|
30
|
+
{ticks.map((tick, i) => {
|
|
31
|
+
const x = positions[i]
|
|
32
|
+
return (
|
|
33
|
+
<g transform={`translate(${x},0)`}>
|
|
34
|
+
<line y2={tickSize} stroke="currentColor" />
|
|
35
|
+
<text
|
|
36
|
+
y={tickSize + 9}
|
|
37
|
+
text-anchor="middle"
|
|
38
|
+
font-size={fontSize}
|
|
39
|
+
fill="currentColor"
|
|
40
|
+
>
|
|
41
|
+
{String(tick)}
|
|
42
|
+
</text>
|
|
43
|
+
</g>
|
|
44
|
+
)
|
|
45
|
+
})}
|
|
46
|
+
</g>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* YAxis — vertical axis with tick marks and labels.
|
|
4
|
+
* Designed to be used inside a Chart's <g> element.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
/** Tick values (strings or numbers) */
|
|
9
|
+
ticks: (number | string)[]
|
|
10
|
+
/** Pixel positions for each tick value */
|
|
11
|
+
positions: number[]
|
|
12
|
+
/** Tick mark length (default 6) */
|
|
13
|
+
tickSize?: number
|
|
14
|
+
/** Font size for labels (default 12) */
|
|
15
|
+
fontSize?: number
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const {
|
|
19
|
+
ticks,
|
|
20
|
+
positions,
|
|
21
|
+
tickSize = 6,
|
|
22
|
+
fontSize = 12,
|
|
23
|
+
} = Astro.props
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
<g data-rfr-chart-yaxis>
|
|
27
|
+
{ticks.map((tick, i) => {
|
|
28
|
+
const y = positions[i]
|
|
29
|
+
return (
|
|
30
|
+
<g transform={`translate(0,${y})`}>
|
|
31
|
+
<line x2={-tickSize} stroke="currentColor" />
|
|
32
|
+
<text
|
|
33
|
+
x={-tickSize - 4}
|
|
34
|
+
dy="0.32em"
|
|
35
|
+
text-anchor="end"
|
|
36
|
+
font-size={fontSize}
|
|
37
|
+
fill="currentColor"
|
|
38
|
+
>
|
|
39
|
+
{String(tick)}
|
|
40
|
+
</text>
|
|
41
|
+
</g>
|
|
42
|
+
)
|
|
43
|
+
})}
|
|
44
|
+
</g>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export { default as Chart } from './Chart.astro'
|
|
2
|
+
export { default as Bars } from './Bars.astro'
|
|
3
|
+
export { default as Line } from './Line.astro'
|
|
4
|
+
export { default as PieChart } from './PieChart.astro'
|
|
5
|
+
export { default as ScatterPlot } from './ScatterPlot.astro'
|
|
6
|
+
export { default as Histogram } from './Histogram.astro'
|
|
7
|
+
export { default as XAxis } from './XAxis.astro'
|
|
8
|
+
export { default as YAxis } from './YAxis.astro'
|
|
9
|
+
export { default as Gradient } from './Gradient.astro'
|
|
10
|
+
export { default as Circles } from './Circles.astro'
|
|
11
|
+
|
|
12
|
+
// Re-export core types and utilities
|
|
13
|
+
export {
|
|
14
|
+
combineDimensions,
|
|
15
|
+
createLinearScale,
|
|
16
|
+
createBandScale,
|
|
17
|
+
computeExtent,
|
|
18
|
+
computeHistogramBins,
|
|
19
|
+
linePath,
|
|
20
|
+
areaPath,
|
|
21
|
+
arcPath,
|
|
22
|
+
formatTick,
|
|
23
|
+
generateTicks,
|
|
24
|
+
COLORBLIND_SAFE_PALETTE,
|
|
25
|
+
getChartColor,
|
|
26
|
+
} from '../charts/index.ts'
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
---
|
|
2
|
+
import {
|
|
3
|
+
createCheckbox,
|
|
4
|
+
checkboxVariants,
|
|
5
|
+
checkIconPath,
|
|
6
|
+
indeterminateIconPath,
|
|
7
|
+
type CheckedState,
|
|
8
|
+
} from '../checkbox/index.ts'
|
|
9
|
+
import { cn } from '../shared/index.ts'
|
|
10
|
+
|
|
11
|
+
interface Props extends astroHTML.JSX.HTMLAttributes {
|
|
12
|
+
checked?: CheckedState
|
|
13
|
+
disabled?: boolean
|
|
14
|
+
size?: 'sm' | 'default' | 'lg'
|
|
15
|
+
name?: string
|
|
16
|
+
value?: string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const { checked = false, disabled = false, size = 'default', name, value, class: className, ...props } = Astro.props
|
|
20
|
+
const api = createCheckbox({ checked, disabled })
|
|
21
|
+
const checkedVariant = checked === 'indeterminate' ? 'indeterminate' : checked ? 'true' : 'false'
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
<button
|
|
25
|
+
type="button"
|
|
26
|
+
class={cn(checkboxVariants({ checked: checkedVariant, size }), className)}
|
|
27
|
+
disabled={disabled}
|
|
28
|
+
data-rfr-checkbox
|
|
29
|
+
{...api.ariaProps}
|
|
30
|
+
{...api.dataAttributes}
|
|
31
|
+
{...props}
|
|
32
|
+
>
|
|
33
|
+
{checked === true && (
|
|
34
|
+
<svg
|
|
35
|
+
class="h-full w-full"
|
|
36
|
+
viewBox="0 0 24 24"
|
|
37
|
+
fill="none"
|
|
38
|
+
stroke="currentColor"
|
|
39
|
+
stroke-width="3"
|
|
40
|
+
stroke-linecap="round"
|
|
41
|
+
stroke-linejoin="round"
|
|
42
|
+
aria-hidden="true"
|
|
43
|
+
>
|
|
44
|
+
<path d={checkIconPath} />
|
|
45
|
+
</svg>
|
|
46
|
+
)}
|
|
47
|
+
{checked === 'indeterminate' && (
|
|
48
|
+
<svg
|
|
49
|
+
class="h-full w-full"
|
|
50
|
+
viewBox="0 0 24 24"
|
|
51
|
+
fill="none"
|
|
52
|
+
stroke="currentColor"
|
|
53
|
+
stroke-width="3"
|
|
54
|
+
stroke-linecap="round"
|
|
55
|
+
stroke-linejoin="round"
|
|
56
|
+
aria-hidden="true"
|
|
57
|
+
>
|
|
58
|
+
<path d={indeterminateIconPath} />
|
|
59
|
+
</svg>
|
|
60
|
+
)}
|
|
61
|
+
{name && <input type="hidden" name={name} value={checked === 'indeterminate' ? 'indeterminate' : String(checked)} data-rfr-checkbox-input />}
|
|
62
|
+
</button>
|
|
63
|
+
|
|
64
|
+
<script>
|
|
65
|
+
document.querySelectorAll<HTMLButtonElement>('[data-rfr-checkbox]').forEach((el) => {
|
|
66
|
+
el.addEventListener('click', () => {
|
|
67
|
+
if (el.disabled) return
|
|
68
|
+
const currentState = el.getAttribute('aria-checked')
|
|
69
|
+
let newChecked: boolean
|
|
70
|
+
if (currentState === 'mixed') {
|
|
71
|
+
newChecked = true
|
|
72
|
+
} else {
|
|
73
|
+
newChecked = currentState !== 'true'
|
|
74
|
+
}
|
|
75
|
+
el.setAttribute('aria-checked', String(newChecked))
|
|
76
|
+
el.setAttribute('data-state', newChecked ? 'checked' : 'unchecked')
|
|
77
|
+
|
|
78
|
+
// Toggle check icon visibility
|
|
79
|
+
const svg = el.querySelector('svg')
|
|
80
|
+
if (newChecked) {
|
|
81
|
+
if (!svg) {
|
|
82
|
+
const newSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg')
|
|
83
|
+
newSvg.setAttribute('class', 'h-full w-full')
|
|
84
|
+
newSvg.setAttribute('viewBox', '0 0 24 24')
|
|
85
|
+
newSvg.setAttribute('fill', 'none')
|
|
86
|
+
newSvg.setAttribute('stroke', 'currentColor')
|
|
87
|
+
newSvg.setAttribute('stroke-width', '3')
|
|
88
|
+
newSvg.setAttribute('stroke-linecap', 'round')
|
|
89
|
+
newSvg.setAttribute('stroke-linejoin', 'round')
|
|
90
|
+
newSvg.setAttribute('aria-hidden', 'true')
|
|
91
|
+
const path = document.createElementNS('http://www.w3.org/2000/svg', 'path')
|
|
92
|
+
path.setAttribute('d', 'M20 6L9 17l-5-5')
|
|
93
|
+
newSvg.appendChild(path)
|
|
94
|
+
// Insert before the hidden input if it exists, otherwise append
|
|
95
|
+
const input = el.querySelector('[data-rfr-checkbox-input]')
|
|
96
|
+
if (input) {
|
|
97
|
+
el.insertBefore(newSvg, input)
|
|
98
|
+
} else {
|
|
99
|
+
el.appendChild(newSvg)
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
if (svg) svg.remove()
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Update CSS variant classes for checked state
|
|
107
|
+
if (newChecked) {
|
|
108
|
+
el.classList.add('bg-primary', 'text-primary-foreground')
|
|
109
|
+
el.classList.remove('bg-background')
|
|
110
|
+
} else {
|
|
111
|
+
el.classList.remove('bg-primary', 'text-primary-foreground')
|
|
112
|
+
el.classList.add('bg-background')
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Update hidden input
|
|
116
|
+
const input = el.querySelector('[data-rfr-checkbox-input]') as HTMLInputElement | null
|
|
117
|
+
if (input) input.value = String(newChecked)
|
|
118
|
+
|
|
119
|
+
el.dispatchEvent(new CustomEvent('change', { detail: { checked: newChecked } }))
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
el.addEventListener('keydown', (e) => {
|
|
123
|
+
if (e.key === ' ') {
|
|
124
|
+
e.preventDefault()
|
|
125
|
+
el.click()
|
|
126
|
+
}
|
|
127
|
+
})
|
|
128
|
+
})
|
|
129
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
---
|
|
2
|
+
import {
|
|
3
|
+
createCodeEditor,
|
|
4
|
+
codeEditorVariants,
|
|
5
|
+
type CodeEditorTheme,
|
|
6
|
+
} from '../code-editor/index.ts'
|
|
7
|
+
import { cn } from '../shared/index.ts'
|
|
8
|
+
|
|
9
|
+
interface Props extends astroHTML.JSX.HTMLAttributes {
|
|
10
|
+
value?: string
|
|
11
|
+
language?: string
|
|
12
|
+
readOnly?: boolean
|
|
13
|
+
theme?: CodeEditorTheme
|
|
14
|
+
placeholder?: string
|
|
15
|
+
/** Action button labels — click events are dispatched as custom events */
|
|
16
|
+
actions?: Array<{ label: string }>
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const {
|
|
20
|
+
value = '',
|
|
21
|
+
language = 'plaintext',
|
|
22
|
+
readOnly = false,
|
|
23
|
+
theme = 'light',
|
|
24
|
+
placeholder,
|
|
25
|
+
actions,
|
|
26
|
+
class: className,
|
|
27
|
+
...props
|
|
28
|
+
} = Astro.props
|
|
29
|
+
|
|
30
|
+
const api = createCodeEditor({ value, language, readOnly, theme })
|
|
31
|
+
const containerClasses = cn(codeEditorVariants({ theme }), className)
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
<div
|
|
35
|
+
data-rfr-code-editor
|
|
36
|
+
class={containerClasses}
|
|
37
|
+
{...api.dataAttributes}
|
|
38
|
+
{...props}
|
|
39
|
+
>
|
|
40
|
+
<div class="flex items-center justify-between px-3 py-2 border-b bg-muted/50 text-xs text-muted-foreground">
|
|
41
|
+
<span data-rfr-code-editor-lang>{api.getLanguageLabel()}</span>
|
|
42
|
+
{actions && actions.length > 0 && (
|
|
43
|
+
<div class="flex gap-1" data-rfr-code-editor-actions>
|
|
44
|
+
{actions.map((action) => (
|
|
45
|
+
<button
|
|
46
|
+
type="button"
|
|
47
|
+
data-rfr-code-editor-action={action.label}
|
|
48
|
+
class="px-2 py-1 rounded text-xs hover:bg-muted transition-colors"
|
|
49
|
+
>
|
|
50
|
+
{action.label}
|
|
51
|
+
</button>
|
|
52
|
+
))}
|
|
53
|
+
</div>
|
|
54
|
+
)}
|
|
55
|
+
</div>
|
|
56
|
+
<textarea
|
|
57
|
+
data-rfr-code-editor-textarea
|
|
58
|
+
value={value}
|
|
59
|
+
readonly={readOnly}
|
|
60
|
+
placeholder={placeholder}
|
|
61
|
+
class="flex-1 w-full p-4 bg-transparent resize-none outline-none font-mono min-h-[200px]"
|
|
62
|
+
spellcheck="false"
|
|
63
|
+
autocapitalize="off"
|
|
64
|
+
autocomplete="off"
|
|
65
|
+
autocorrect="off"
|
|
66
|
+
role={api.ariaProps.role}
|
|
67
|
+
aria-multiline={api.ariaProps['aria-multiline']}
|
|
68
|
+
aria-label={api.ariaProps['aria-label']}
|
|
69
|
+
aria-readonly={readOnly ? true : undefined}
|
|
70
|
+
/>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<script>
|
|
74
|
+
function initCodeEditors() {
|
|
75
|
+
document.querySelectorAll<HTMLElement>('[data-rfr-code-editor]').forEach((root) => {
|
|
76
|
+
if (root.hasAttribute('data-rfr-code-editor-init')) return
|
|
77
|
+
root.setAttribute('data-rfr-code-editor-init', '')
|
|
78
|
+
|
|
79
|
+
const textarea = root.querySelector<HTMLTextAreaElement>('[data-rfr-code-editor-textarea]')
|
|
80
|
+
if (!textarea) return
|
|
81
|
+
|
|
82
|
+
// Dispatch change events when textarea value changes
|
|
83
|
+
textarea.addEventListener('input', () => {
|
|
84
|
+
root.dispatchEvent(
|
|
85
|
+
new CustomEvent('rfr-code-editor-change', {
|
|
86
|
+
detail: { value: textarea.value },
|
|
87
|
+
bubbles: true,
|
|
88
|
+
}),
|
|
89
|
+
)
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
// Tab key support: insert tab character instead of moving focus
|
|
93
|
+
textarea.addEventListener('keydown', (e) => {
|
|
94
|
+
if (e.key === 'Tab') {
|
|
95
|
+
e.preventDefault()
|
|
96
|
+
const start = textarea.selectionStart
|
|
97
|
+
const end = textarea.selectionEnd
|
|
98
|
+
const value = textarea.value
|
|
99
|
+
textarea.value = value.substring(0, start) + ' ' + value.substring(end)
|
|
100
|
+
textarea.selectionStart = textarea.selectionEnd = start + 2
|
|
101
|
+
textarea.dispatchEvent(new Event('input', { bubbles: true }))
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
// Action button click handlers
|
|
106
|
+
const actionBtns = root.querySelectorAll<HTMLButtonElement>('[data-rfr-code-editor-action]')
|
|
107
|
+
actionBtns.forEach((btn) => {
|
|
108
|
+
btn.addEventListener('click', () => {
|
|
109
|
+
const label = btn.getAttribute('data-rfr-code-editor-action')
|
|
110
|
+
root.dispatchEvent(
|
|
111
|
+
new CustomEvent('rfr-code-editor-action', {
|
|
112
|
+
detail: { label },
|
|
113
|
+
bubbles: true,
|
|
114
|
+
}),
|
|
115
|
+
)
|
|
116
|
+
})
|
|
117
|
+
})
|
|
118
|
+
})
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
initCodeEditors()
|
|
122
|
+
document.addEventListener('astro:after-swap', initCodeEditors)
|
|
123
|
+
</script>
|