@rimelight/ui 0.0.30 → 0.0.32
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/package.json +1 -1
- package/src/components/astro/RLA3dHover.astro +19 -0
- package/src/components/astro/RLAAlert.astro +62 -0
- package/src/components/astro/RLAApp.astro +19 -0
- package/src/components/astro/RLAAspectRatio.astro +23 -0
- package/src/components/astro/RLAAudio.astro +19 -0
- package/src/components/astro/RLAAvatar.astro +56 -0
- package/src/components/astro/RLAAvatarGroup.astro +19 -0
- package/src/components/astro/RLABadge.astro +33 -0
- package/src/components/astro/RLABanner.astro +19 -0
- package/src/components/astro/RLABreadcrumb.astro +44 -0
- package/src/components/astro/RLABrowserMockup.astro +19 -0
- package/src/components/astro/RLAButton.astro +3 -1
- package/src/components/astro/RLACalendar.astro +19 -0
- package/src/components/astro/RLACard.astro +74 -0
- package/src/components/astro/RLACarousel.astro +71 -0
- package/src/components/astro/RLAChangelog.astro +19 -0
- package/src/components/astro/RLAChart.astro +239 -0
- package/src/components/astro/RLAChat.astro +19 -0
- package/src/components/astro/RLAChatMessage.astro +19 -0
- package/src/components/astro/RLAChatMessages.astro +19 -0
- package/src/components/astro/RLAChatPalette.astro +19 -0
- package/src/components/astro/RLAChatPrompt.astro +19 -0
- package/src/components/astro/RLAChatPromptSubmit.astro +19 -0
- package/src/components/astro/RLAChatReasoning.astro +19 -0
- package/src/components/astro/RLAChatShimmer.astro +19 -0
- package/src/components/astro/RLAChatTool.astro +19 -0
- package/src/components/astro/RLACheckbox.astro +53 -0
- package/src/components/astro/RLAChip.astro +20 -0
- package/src/components/astro/RLACollapsible.astro +38 -0
- package/src/components/astro/RLAColorPicker.astro +19 -0
- package/src/components/astro/RLACommandPalette.astro +19 -0
- package/src/components/astro/RLACompare.astro +19 -0
- package/src/components/astro/RLAConfirm.astro +86 -0
- package/src/components/astro/RLAContainer.astro +19 -0
- package/src/components/astro/RLAContextMenu.astro +19 -0
- package/src/components/astro/RLADashboardGroup.astro +19 -0
- package/src/components/astro/RLADashboardNavbar.astro +19 -0
- package/src/components/astro/RLADashboardPanel.astro +19 -0
- package/src/components/astro/RLADashboardResizeHandle.astro +19 -0
- package/src/components/astro/RLADashboardSearch.astro +19 -0
- package/src/components/astro/RLADashboardSearchButton.astro +19 -0
- package/src/components/astro/RLADashboardSidebar.astro +19 -0
- package/src/components/astro/RLADashboardSidebarCollapse.astro +19 -0
- package/src/components/astro/RLADashboardSidebarToggle.astro +19 -0
- package/src/components/astro/RLADashboardToolbar.astro +19 -0
- package/src/components/astro/RLADock.astro +19 -0
- package/src/components/astro/RLADrawer.astro +74 -0
- package/src/components/astro/RLADropdownMenu.astro +82 -0
- package/src/components/astro/RLAEditor.astro +19 -0
- package/src/components/astro/RLAEmpty.astro +19 -0
- package/src/components/astro/RLAError.astro +19 -0
- package/src/components/astro/RLAFieldGroup.astro +35 -0
- package/src/components/astro/RLAFieldset.astro +19 -0
- package/src/components/astro/RLAFileUpload.astro +134 -0
- package/src/components/astro/RLAFloatingAction.astro +19 -0
- package/src/components/astro/RLAForm.astro +19 -0
- package/src/components/astro/RLAFormField.astro +43 -0
- package/src/components/astro/RLAGallery.astro +19 -0
- package/src/components/{Head.astro → astro/RLAHead.astro} +181 -199
- package/src/components/astro/RLAHoverCard.astro +31 -0
- package/src/components/astro/RLAImage.astro +19 -0
- package/src/components/astro/RLAInput.astro +62 -0
- package/src/components/astro/RLAInputDate.astro +19 -0
- package/src/components/astro/RLAInputMenu.astro +131 -0
- package/src/components/astro/RLAInputNumber.astro +19 -0
- package/src/components/astro/RLAInputPin.astro +19 -0
- package/src/components/astro/RLAInputTags.astro +19 -0
- package/src/components/astro/RLAInputTime.astro +19 -0
- package/src/components/astro/RLAKbd.astro +22 -0
- package/src/components/astro/RLAKnob.astro +19 -0
- package/src/components/astro/RLALabel.astro +23 -0
- package/src/components/astro/RLALink.astro +19 -0
- package/src/components/astro/RLALinkGroup.astro +19 -0
- package/src/components/astro/RLAListbox.astro +19 -0
- package/src/components/astro/RLALocaleSelector.astro +110 -0
- package/src/components/astro/RLAMarquee.astro +32 -0
- package/src/components/astro/RLAMegamenu.astro +19 -0
- package/src/components/astro/RLAMeter.astro +19 -0
- package/src/components/astro/RLAModal.astro +95 -0
- package/src/components/astro/RLANavigationMenu.astro +136 -0
- package/src/components/astro/RLAPage.astro +19 -0
- package/src/components/astro/RLAPageAside.astro +19 -0
- package/src/components/astro/RLAPageBody.astro +19 -0
- package/src/components/astro/RLAPageHeader.astro +19 -0
- package/src/components/astro/{RLASection.astro → RLAPageSection.astro} +6 -6
- package/src/components/astro/RLAPagination.astro +94 -0
- package/src/components/astro/RLAPassword.astro +19 -0
- package/src/components/astro/RLAPhoneMockup.astro +19 -0
- package/src/components/astro/RLAPopover.astro +31 -0
- package/src/components/astro/RLAPost.astro +19 -0
- package/src/components/astro/RLAPricingPlan.astro +19 -0
- package/src/components/astro/RLAPricingTable.astro +19 -0
- package/src/components/astro/RLAProgress.astro +45 -0
- package/src/components/astro/RLAProse.astro +19 -0
- package/src/components/astro/RLAQrCode.astro +19 -0
- package/src/components/astro/RLARadioGroup.astro +19 -0
- package/src/components/astro/RLARating.astro +19 -0
- package/src/components/astro/RLAScrollArea.astro +157 -0
- package/src/components/astro/RLAScrollToTop.astro +172 -159
- package/src/components/astro/RLASelect.astro +109 -0
- package/src/components/astro/RLASeparator.astro +27 -0
- package/src/components/astro/RLASidebar.astro +135 -0
- package/src/components/astro/RLASkeleton.astro +20 -0
- package/src/components/astro/RLASlideover.astro +72 -0
- package/src/components/astro/RLASlider.astro +58 -0
- package/src/components/astro/RLASpeedDial.astro +19 -0
- package/src/components/astro/RLASpinner.astro +27 -0
- package/src/components/astro/RLASplitter.astro +177 -0
- package/src/components/astro/RLASpoiler.astro +19 -0
- package/src/components/astro/RLAStepper.astro +19 -0
- package/src/components/astro/RLAStickySurface.astro +27 -0
- package/src/components/astro/RLASwitch.astro +51 -0
- package/src/components/astro/RLATable.astro +60 -0
- package/src/components/astro/RLATableOfContents.astro +19 -0
- package/src/components/astro/RLATabs.astro +92 -0
- package/src/components/astro/RLATextarea.astro +42 -0
- package/src/components/astro/RLAThemeSelector.astro +73 -0
- package/src/components/astro/RLATimeline.astro +19 -0
- package/src/components/astro/RLAToast.astro +107 -0
- package/src/components/astro/RLATooltip.astro +31 -0
- package/src/components/astro/RLATour.astro +19 -0
- package/src/components/astro/RLATree.astro +19 -0
- package/src/components/astro/RLAUser.astro +19 -0
- package/src/components/astro/{RLAEmbedYoutube.astro → RLAVideo.astro} +6 -6
- package/src/components/astro/RLAWatermark.astro +19 -0
- package/src/components/astro/RLAWindowMockup.astro +19 -0
- package/src/integrations/ui.ts +208 -142
- package/src/presets/defaults.ts +285 -0
- package/src/presets/index.ts +537 -256
- package/src/styles/index.css +6 -0
- package/src/themes/3d-hover.theme.ts +10 -0
- package/src/themes/accordion.theme.ts +10 -0
- package/src/themes/alert.theme.ts +56 -0
- package/src/themes/app.theme.ts +10 -0
- package/src/themes/aspect-ratio.theme.ts +11 -0
- package/src/themes/audio.theme.ts +10 -0
- package/src/themes/avatar-group.theme.ts +10 -0
- package/src/themes/avatar.theme.ts +28 -0
- package/src/themes/badge.theme.ts +66 -0
- package/src/themes/banner.theme.ts +10 -0
- package/src/themes/breadcrumb.theme.ts +15 -0
- package/src/themes/browser-mockup.theme.ts +10 -0
- package/src/themes/button.theme.ts +195 -190
- package/src/themes/calendar.theme.ts +10 -0
- package/src/themes/card.theme.ts +34 -0
- package/src/themes/carousel.theme.ts +32 -0
- package/src/themes/changelog.theme.ts +10 -0
- package/src/themes/chart.theme.ts +21 -0
- package/src/themes/chat-message.theme.ts +10 -0
- package/src/themes/chat-messages.theme.ts +10 -0
- package/src/themes/chat-palette.theme.ts +10 -0
- package/src/themes/chat-prompt-submit.theme.ts +10 -0
- package/src/themes/chat-prompt.theme.ts +10 -0
- package/src/themes/chat-reasoning.theme.ts +10 -0
- package/src/themes/chat-shimmer.theme.ts +10 -0
- package/src/themes/chat-tool.theme.ts +10 -0
- package/src/themes/chat.theme.ts +10 -0
- package/src/themes/checkbox.theme.ts +48 -0
- package/src/themes/chip.theme.ts +16 -0
- package/src/themes/collapsible.theme.ts +22 -0
- package/src/themes/color-picker.theme.ts +10 -0
- package/src/themes/command-palette.theme.ts +10 -0
- package/src/themes/compare.theme.ts +10 -0
- package/src/themes/confirm.theme.ts +33 -0
- package/src/themes/container.theme.ts +10 -0
- package/src/themes/context-menu.theme.ts +10 -0
- package/src/themes/dashboard-group.theme.ts +10 -0
- package/src/themes/dashboard-navbar.theme.ts +10 -0
- package/src/themes/dashboard-panel.theme.ts +10 -0
- package/src/themes/dashboard-resize-handle.theme.ts +10 -0
- package/src/themes/dashboard-search-button.theme.ts +10 -0
- package/src/themes/dashboard-search.theme.ts +10 -0
- package/src/themes/dashboard-sidebar-collapse.theme.ts +10 -0
- package/src/themes/dashboard-sidebar-toggle.theme.ts +10 -0
- package/src/themes/dashboard-sidebar.theme.ts +10 -0
- package/src/themes/dashboard-toolbar.theme.ts +10 -0
- package/src/themes/dock.theme.ts +10 -0
- package/src/themes/drawer.theme.ts +44 -0
- package/src/themes/dropdown-menu.theme.ts +27 -0
- package/src/themes/editor.theme.ts +10 -0
- package/src/themes/empty.theme.ts +10 -0
- package/src/themes/error.theme.ts +10 -0
- package/src/themes/field-group.theme.ts +23 -0
- package/src/themes/fieldset.theme.ts +10 -0
- package/src/themes/file-upload.theme.ts +24 -0
- package/src/themes/floating-action.theme.ts +10 -0
- package/src/themes/form-field.theme.ts +24 -0
- package/src/themes/form.theme.ts +10 -0
- package/src/themes/gallery.theme.ts +10 -0
- package/src/themes/head.theme.ts +10 -0
- package/src/themes/hover-card.theme.ts +27 -0
- package/src/themes/image.theme.ts +10 -0
- package/src/themes/input-date.theme.ts +10 -0
- package/src/themes/input-menu.theme.ts +28 -0
- package/src/themes/input-number.theme.ts +10 -0
- package/src/themes/input-pin.theme.ts +10 -0
- package/src/themes/input-tags.theme.ts +10 -0
- package/src/themes/input-time.theme.ts +10 -0
- package/src/themes/input.theme.ts +41 -0
- package/src/themes/kbd.theme.ts +24 -0
- package/src/themes/knob.theme.ts +10 -0
- package/src/themes/label.theme.ts +20 -0
- package/src/themes/link-group.theme.ts +10 -0
- package/src/themes/link.theme.ts +10 -0
- package/src/themes/listbox.theme.ts +10 -0
- package/src/themes/locale-selector.theme.ts +50 -0
- package/src/themes/marquee.theme.ts +27 -0
- package/src/themes/megamenu.theme.ts +10 -0
- package/src/themes/meter.theme.ts +10 -0
- package/src/themes/modal.theme.ts +37 -0
- package/src/themes/navigation-menu.theme.ts +19 -0
- package/src/themes/page-aside.theme.ts +10 -0
- package/src/themes/page-body.theme.ts +10 -0
- package/src/themes/page-header.theme.ts +10 -0
- package/src/themes/{section.theme.ts → page-section.theme.ts} +1 -2
- package/src/themes/page.theme.ts +10 -0
- package/src/themes/pagination.theme.ts +26 -0
- package/src/themes/password.theme.ts +10 -0
- package/src/themes/phone-mockup.theme.ts +10 -0
- package/src/themes/popover.theme.ts +28 -0
- package/src/themes/post.theme.ts +10 -0
- package/src/themes/pricing-plan.theme.ts +10 -0
- package/src/themes/pricing-table.theme.ts +10 -0
- package/src/themes/progress.theme.ts +37 -0
- package/src/themes/prose.theme.ts +10 -0
- package/src/themes/qr-code.theme.ts +10 -0
- package/src/themes/quote.theme.ts +10 -0
- package/src/themes/radio-group.theme.ts +10 -0
- package/src/themes/rating.theme.ts +10 -0
- package/src/themes/scroll-area.theme.ts +24 -0
- package/src/themes/scroll-to-top.theme.ts +44 -40
- package/src/themes/select.theme.ts +27 -0
- package/src/themes/separator.theme.ts +19 -0
- package/src/themes/sidebar.theme.ts +33 -0
- package/src/themes/skeleton.theme.ts +20 -0
- package/src/themes/slideover.theme.ts +43 -0
- package/src/themes/slider.theme.ts +34 -0
- package/src/themes/speed-dial.theme.ts +10 -0
- package/src/themes/spinner.theme.ts +35 -0
- package/src/themes/splitter.theme.ts +22 -0
- package/src/themes/spoiler.theme.ts +10 -0
- package/src/themes/stepper.theme.ts +10 -0
- package/src/themes/sticky-surface.theme.ts +10 -0
- package/src/themes/switch.theme.ts +65 -0
- package/src/themes/table-of-contents.theme.ts +10 -0
- package/src/themes/table.theme.ts +36 -0
- package/src/themes/tabs.theme.ts +44 -0
- package/src/themes/textarea.theme.ts +26 -0
- package/src/themes/theme-selector.theme.ts +16 -0
- package/src/themes/timeline.theme.ts +10 -0
- package/src/themes/toast.theme.ts +25 -0
- package/src/themes/tooltip.theme.ts +27 -0
- package/src/themes/tour.theme.ts +10 -0
- package/src/themes/tree.theme.ts +10 -0
- package/src/themes/user.theme.ts +10 -0
- package/src/themes/watermark.theme.ts +10 -0
- package/src/themes/window-mockup.theme.ts +10 -0
- package/src/types/components/3d-hover.ts +11 -0
- package/src/types/components/accordion.ts +1 -1
- package/src/types/components/alert.ts +37 -0
- package/src/types/components/app.ts +11 -0
- package/src/types/components/aspect-ratio.ts +15 -0
- package/src/types/components/audio.ts +11 -0
- package/src/types/components/avatar-group.ts +12 -0
- package/src/types/components/avatar.ts +35 -0
- package/src/types/components/badge.ts +33 -0
- package/src/types/components/banner.ts +11 -0
- package/src/types/components/breadcrumb.ts +24 -0
- package/src/types/components/browser-mockup.ts +11 -0
- package/src/types/components/button.ts +7 -1
- package/src/types/components/calendar.ts +11 -0
- package/src/types/components/card.ts +31 -0
- package/src/types/components/carousel.ts +25 -0
- package/src/types/components/changelog.ts +11 -0
- package/src/types/components/chart.ts +38 -0
- package/src/types/components/chat-message.ts +11 -0
- package/src/types/components/chat-messages.ts +11 -0
- package/src/types/components/chat-palette.ts +11 -0
- package/src/types/components/chat-prompt-submit.ts +11 -0
- package/src/types/components/chat-prompt.ts +11 -0
- package/src/types/components/chat-reasoning.ts +11 -0
- package/src/types/components/chat-shimmer.ts +11 -0
- package/src/types/components/chat-tool.ts +11 -0
- package/src/types/components/chat.ts +11 -0
- package/src/types/components/checkbox.ts +41 -0
- package/src/types/components/chip.ts +17 -0
- package/src/types/components/collapsible.ts +31 -0
- package/src/types/components/color-picker.ts +11 -0
- package/src/types/components/command-palette.ts +11 -0
- package/src/types/components/compare.ts +11 -0
- package/src/types/components/confirm.ts +35 -0
- package/src/types/components/container.ts +11 -0
- package/src/types/components/context-menu.ts +11 -0
- package/src/types/components/dashboard-group.ts +11 -0
- package/src/types/components/dashboard-navbar.ts +11 -0
- package/src/types/components/dashboard-panel.ts +11 -0
- package/src/types/components/dashboard-resize-handle.ts +11 -0
- package/src/types/components/dashboard-search-button.ts +11 -0
- package/src/types/components/dashboard-search.ts +11 -0
- package/src/types/components/dashboard-sidebar-collapse.ts +11 -0
- package/src/types/components/dashboard-sidebar-toggle.ts +11 -0
- package/src/types/components/dashboard-sidebar.ts +11 -0
- package/src/types/components/dashboard-toolbar.ts +11 -0
- package/src/types/components/dock.ts +11 -0
- package/src/types/components/drawer.ts +31 -0
- package/src/types/components/dropdown-menu.ts +42 -0
- package/src/types/components/editor.ts +11 -0
- package/src/types/components/empty.ts +11 -0
- package/src/types/components/error.ts +11 -0
- package/src/types/components/field-group.ts +23 -0
- package/src/types/components/fieldset.ts +11 -0
- package/src/types/components/file-upload.ts +39 -0
- package/src/types/components/floating-action.ts +11 -0
- package/src/types/components/footer.ts +1 -1
- package/src/types/components/form-field.ts +31 -0
- package/src/types/components/form.ts +11 -0
- package/src/types/components/gallery.ts +11 -0
- package/src/types/components/header.ts +1 -1
- package/src/types/components/hover-card.ts +19 -0
- package/src/types/components/icon.ts +2 -1
- package/src/types/components/image.ts +11 -0
- package/src/types/components/index.ts +134 -13
- package/src/types/components/input-date.ts +11 -0
- package/src/types/components/input-menu.ts +44 -0
- package/src/types/components/input-number.ts +11 -0
- package/src/types/components/input-pin.ts +11 -0
- package/src/types/components/input-tags.ts +11 -0
- package/src/types/components/input-time.ts +11 -0
- package/src/types/components/input.ts +65 -0
- package/src/types/components/kbd.ts +15 -0
- package/src/types/components/knob.ts +11 -0
- package/src/types/components/label.ts +19 -0
- package/src/types/components/link-group.ts +11 -0
- package/src/types/components/link.ts +1 -1
- package/src/types/components/listbox.ts +11 -0
- package/src/types/components/locale-selector.ts +33 -0
- package/src/types/components/logo.ts +1 -1
- package/src/types/components/main.ts +1 -1
- package/src/types/components/marquee.ts +23 -0
- package/src/types/components/megamenu.ts +11 -0
- package/src/types/components/meter.ts +11 -0
- package/src/types/components/modal.ts +40 -0
- package/src/types/components/{navigation.ts → navigation-menu.ts} +22 -2
- package/src/types/components/page-aside.ts +11 -0
- package/src/types/components/page-body.ts +11 -0
- package/src/types/components/page-header.ts +11 -0
- package/src/types/components/{section.ts → page-section.ts} +2 -2
- package/src/types/components/page.ts +11 -0
- package/src/types/components/pagination.ts +23 -0
- package/src/types/components/password.ts +11 -0
- package/src/types/components/phone-mockup.ts +5 -0
- package/src/types/components/placeholder.ts +1 -1
- package/src/types/components/popover.ts +24 -0
- package/src/types/components/post.ts +11 -0
- package/src/types/components/pricing-plan.ts +11 -0
- package/src/types/components/pricing-table.ts +11 -0
- package/src/types/components/progress.ts +34 -0
- package/src/types/components/prose.ts +11 -0
- package/src/types/components/qr-code.ts +11 -0
- package/src/types/components/quote.ts +11 -0
- package/src/types/components/radio-group.ts +11 -0
- package/src/types/components/rating.ts +11 -0
- package/src/types/components/scroll-area.ts +24 -0
- package/src/types/components/scroll-to-top.ts +7 -1
- package/src/types/components/select.ts +43 -0
- package/src/types/components/separator.ts +20 -0
- package/src/types/components/sidebar.ts +37 -0
- package/src/types/components/skeleton.ts +15 -0
- package/src/types/components/slideover.ts +32 -0
- package/src/types/components/slider.ts +41 -0
- package/src/types/components/speed-dial.ts +11 -0
- package/src/types/components/spinner.ts +26 -0
- package/src/types/components/splitter.ts +20 -0
- package/src/types/components/spoiler.ts +11 -0
- package/src/types/components/stepper.ts +11 -0
- package/src/types/components/sticky-surface.ts +20 -0
- package/src/types/components/switch.ts +42 -0
- package/src/types/components/table-of-contents.ts +11 -0
- package/src/types/components/table.ts +31 -0
- package/src/types/components/tabs.ts +43 -0
- package/src/types/components/textarea.ts +51 -0
- package/src/types/components/theme-selector.ts +15 -0
- package/src/types/components/timeline.ts +11 -0
- package/src/types/components/toast.ts +35 -0
- package/src/types/components/tooltip.ts +24 -0
- package/src/types/components/tour.ts +11 -0
- package/src/types/components/tree.ts +11 -0
- package/src/types/components/user.ts +11 -0
- package/src/types/components/{embed-youtube.ts → video.ts} +2 -2
- package/src/types/components/watermark.ts +11 -0
- package/src/types/components/window-mockup.ts +11 -0
- package/src/types/index.ts +2 -1
- package/src/types/theme.ts +1 -0
- package/src/components/ThemeToggle.astro +0 -57
- package/src/preset.ts +0 -393
- /package/src/themes/{embedYoutube.theme.ts → video.theme.ts} +0 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { scv } from "css-variants"
|
|
3
|
+
import { useUi, resolveClasses } from "../../utils"
|
|
4
|
+
import type { ChartProps, ChartDataPoint } from "../../types"
|
|
5
|
+
import chartThemeDefault, { createChartTheme } from "../../themes/chart.theme"
|
|
6
|
+
|
|
7
|
+
const chartTheme = chartThemeDefault
|
|
8
|
+
const chart = scv(chartTheme)
|
|
9
|
+
|
|
10
|
+
const {
|
|
11
|
+
type = "bar",
|
|
12
|
+
data = [],
|
|
13
|
+
title,
|
|
14
|
+
height = 280,
|
|
15
|
+
color = "primary",
|
|
16
|
+
ui: uiProp,
|
|
17
|
+
class: className,
|
|
18
|
+
...rest
|
|
19
|
+
} = Astro.props as ChartProps
|
|
20
|
+
|
|
21
|
+
const classes = resolveClasses(chart, {}, useUi("chart", uiProp), className)
|
|
22
|
+
|
|
23
|
+
// Unique instance ID to prevent CSS collisions between multiple charts
|
|
24
|
+
const instanceId = Math.random().toString(36).substring(2, 8)
|
|
25
|
+
|
|
26
|
+
// Compute derived values on the server so we don't do heavy JS on the client
|
|
27
|
+
const max = data.length > 0 ? Math.max(...data.map(d => d.value)) : 1
|
|
28
|
+
const total = data.reduce((sum, d) => sum + d.value, 0)
|
|
29
|
+
|
|
30
|
+
// Palette for chart segments/bars when no per-item color given
|
|
31
|
+
const palette = [
|
|
32
|
+
"hsl(221 83% 53%)", // blue
|
|
33
|
+
"hsl(262 83% 58%)", // violet
|
|
34
|
+
"hsl(142 76% 36%)", // green
|
|
35
|
+
"hsl(32 95% 44%)", // amber
|
|
36
|
+
"hsl(0 84% 60%)", // red
|
|
37
|
+
"hsl(187 85% 43%)", // cyan
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
const getColor = (item: ChartDataPoint, index: number) =>
|
|
41
|
+
item.color ?? palette[index % palette.length]
|
|
42
|
+
|
|
43
|
+
// Strip angle brackets from color values to prevent XSS via </style> breakout
|
|
44
|
+
const cssColor = (item: ChartDataPoint, index: number) =>
|
|
45
|
+
getColor(item, index).replace(/[<>]/g, "")
|
|
46
|
+
|
|
47
|
+
// Build per-item CSS rules to avoid inline styles (CSP compliance)
|
|
48
|
+
const itemCssRules: string[] = []
|
|
49
|
+
data.forEach((item, i) => {
|
|
50
|
+
if (type === "bar") {
|
|
51
|
+
const pct = max > 0 ? (item.value / max) * 100 : 0
|
|
52
|
+
itemCssRules.push(`.rlc-${instanceId}-b-${i}{height:${pct}%;background:${cssColor(item, i)};min-height:4px;width:100%}`)
|
|
53
|
+
}
|
|
54
|
+
itemCssRules.push(`.rlc-${instanceId}-s-${i}{background:${cssColor(item, i)}}`)
|
|
55
|
+
})
|
|
56
|
+
const chartItemStyles = itemCssRules.join("")
|
|
57
|
+
|
|
58
|
+
// Build pie/donut SVG path segments
|
|
59
|
+
const PIE_R = 80
|
|
60
|
+
const PIE_CX = 100
|
|
61
|
+
const PIE_CY = 100
|
|
62
|
+
const DONUT_INNER_R = 45
|
|
63
|
+
|
|
64
|
+
const polarToCartesian = (cx: number, cy: number, r: number, angleDeg: number) => {
|
|
65
|
+
const rad = (angleDeg - 90) * (Math.PI / 180)
|
|
66
|
+
return { x: cx + r * Math.cos(rad), y: cy + r * Math.sin(rad) }
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const describeArc = (cx: number, cy: number, r: number, start: number, end: number) => {
|
|
70
|
+
const s = polarToCartesian(cx, cy, r, start)
|
|
71
|
+
const e = polarToCartesian(cx, cy, r, end)
|
|
72
|
+
const largeArc = end - start > 180 ? 1 : 0
|
|
73
|
+
return `M ${s.x} ${s.y} A ${r} ${r} 0 ${largeArc} 1 ${e.x} ${e.y}`
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
let pieCursor = 0
|
|
77
|
+
const pieSlices = data.map((item, i) => {
|
|
78
|
+
const angle = (item.value / (total || 1)) * 360
|
|
79
|
+
const start = pieCursor
|
|
80
|
+
const end = pieCursor + angle
|
|
81
|
+
pieCursor = end
|
|
82
|
+
return { item, i, start, end }
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
// Build line chart SVG points
|
|
86
|
+
const LINE_W = 400
|
|
87
|
+
const LINE_H = 160
|
|
88
|
+
const LINE_PAD = 32
|
|
89
|
+
const linePoints = data.map((d, i) => {
|
|
90
|
+
const x = data.length < 2
|
|
91
|
+
? LINE_PAD
|
|
92
|
+
: LINE_PAD + (i / (data.length - 1)) * (LINE_W - LINE_PAD * 2)
|
|
93
|
+
const y = LINE_H - LINE_PAD - ((d.value / (max || 1)) * (LINE_H - LINE_PAD * 2))
|
|
94
|
+
return { x, y, d, i }
|
|
95
|
+
})
|
|
96
|
+
const linePath = linePoints.map((p, i) => `${i === 0 ? "M" : "L"} ${p.x} ${p.y}`).join(" ")
|
|
97
|
+
const areaPath = linePoints.length > 0
|
|
98
|
+
? linePath +
|
|
99
|
+
` L ${linePoints[linePoints.length - 1]!.x} ${LINE_H - LINE_PAD}` +
|
|
100
|
+
` L ${linePoints[0]!.x} ${LINE_H - LINE_PAD} Z`
|
|
101
|
+
: ""
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
<style define:vars={{ chartH: `${height}px`, chartInnerH: `${height - 60}px` }}>
|
|
105
|
+
[data-slot="root"] { min-height: var(--chart-h); }
|
|
106
|
+
[data-slot="container"] { height: var(--chart-inner-h); gap: 6px; align-items: flex-end; }
|
|
107
|
+
.rla-chart-line-wrap { height: var(--chart-inner-h); }
|
|
108
|
+
.rla-chart-pie-wrap { height: var(--chart-inner-h); }
|
|
109
|
+
</style>
|
|
110
|
+
<style set:html={chartItemStyles}></style>
|
|
111
|
+
|
|
112
|
+
<div class={classes.root} data-slot="root" {...rest}>
|
|
113
|
+
{title && <div class={classes.title} data-slot="title">{title}</div>}
|
|
114
|
+
|
|
115
|
+
{/* Bar Chart */}
|
|
116
|
+
{type === "bar" && (
|
|
117
|
+
<div class={classes.container} data-slot="container">
|
|
118
|
+
{data.map((item, i) => {
|
|
119
|
+
const pct = max > 0 ? (item.value / max) * 100 : 0
|
|
120
|
+
return (
|
|
121
|
+
<div class="flex flex-col items-center gap-1 flex-1 group">
|
|
122
|
+
<span class="text-[10px] text-muted-foreground font-mono opacity-0 group-hover:opacity-100 transition-opacity">
|
|
123
|
+
{item.value}
|
|
124
|
+
</span>
|
|
125
|
+
<div
|
|
126
|
+
class={`${classes.bar} rlc-${instanceId}-b-${i}`}
|
|
127
|
+
title={`${item.label}: ${item.value}`}
|
|
128
|
+
/>
|
|
129
|
+
<span class={classes.axis}>{item.label}</span>
|
|
130
|
+
</div>
|
|
131
|
+
)
|
|
132
|
+
})}
|
|
133
|
+
</div>
|
|
134
|
+
)}
|
|
135
|
+
|
|
136
|
+
{/* Line / Area Chart */}
|
|
137
|
+
{(type === "line" || type === "area") && (
|
|
138
|
+
<div class="relative w-full rla-chart-line-wrap">
|
|
139
|
+
<svg
|
|
140
|
+
class={classes.svg}
|
|
141
|
+
viewBox={`0 0 ${LINE_W} ${LINE_H}`}
|
|
142
|
+
preserveAspectRatio="none"
|
|
143
|
+
aria-label={title ?? "Line chart"}
|
|
144
|
+
>
|
|
145
|
+
{/* Grid lines */}
|
|
146
|
+
{[0, 0.25, 0.5, 0.75, 1].map(t => {
|
|
147
|
+
const y = LINE_PAD + t * (LINE_H - LINE_PAD * 2)
|
|
148
|
+
return <line x1={LINE_PAD} y1={y} x2={LINE_W - LINE_PAD} y2={y} stroke="currentColor" stroke-opacity="0.08" />
|
|
149
|
+
})}
|
|
150
|
+
|
|
151
|
+
{/* Area fill */}
|
|
152
|
+
{type === "area" && (
|
|
153
|
+
<path d={areaPath} fill={palette[0]!} fill-opacity="0.15" />
|
|
154
|
+
)}
|
|
155
|
+
|
|
156
|
+
{/* Line */}
|
|
157
|
+
<path d={linePath} class={classes.line} stroke={palette[0]!} stroke-width="2.5" />
|
|
158
|
+
|
|
159
|
+
{/* Dots */}
|
|
160
|
+
{linePoints.map(p => (
|
|
161
|
+
<circle
|
|
162
|
+
cx={p.x}
|
|
163
|
+
cy={p.y}
|
|
164
|
+
r="4"
|
|
165
|
+
fill={getColor(p.d, p.i)}
|
|
166
|
+
stroke="white"
|
|
167
|
+
stroke-width="1.5"
|
|
168
|
+
>
|
|
169
|
+
<title>{p.d.label}: {p.d.value}</title>
|
|
170
|
+
</circle>
|
|
171
|
+
))}
|
|
172
|
+
|
|
173
|
+
{/* X axis labels */}
|
|
174
|
+
{linePoints.map(p => (
|
|
175
|
+
<text x={p.x} y={LINE_H - 4} text-anchor="middle" class={classes.axis}>{p.d.label}</text>
|
|
176
|
+
))}
|
|
177
|
+
</svg>
|
|
178
|
+
</div>
|
|
179
|
+
)}
|
|
180
|
+
|
|
181
|
+
{/* Pie / Donut Chart */}
|
|
182
|
+
{(type === "pie" || type === "donut") && (
|
|
183
|
+
<div class="flex items-center gap-6 justify-center rla-chart-pie-wrap">
|
|
184
|
+
<svg
|
|
185
|
+
viewBox="0 0 200 200"
|
|
186
|
+
class="h-full w-auto max-h-48"
|
|
187
|
+
aria-label={title ?? "Pie chart"}
|
|
188
|
+
>
|
|
189
|
+
{pieSlices.map(({ item, i, start, end }) => {
|
|
190
|
+
const isFullCircle = Math.abs(end - start - 360) < 0.01
|
|
191
|
+
const d = isFullCircle
|
|
192
|
+
? `M ${PIE_CX} ${PIE_CY - PIE_R} A ${PIE_R} ${PIE_R} 0 1 1 ${PIE_CX - 0.001} ${PIE_CY - PIE_R} Z`
|
|
193
|
+
: describeArc(PIE_CX, PIE_CY, PIE_R, start, end) +
|
|
194
|
+
` L ${PIE_CX} ${PIE_CY} Z`
|
|
195
|
+
return (
|
|
196
|
+
<path
|
|
197
|
+
d={d}
|
|
198
|
+
fill={getColor(item, i)}
|
|
199
|
+
class="transition-opacity hover:opacity-85 cursor-pointer"
|
|
200
|
+
>
|
|
201
|
+
<title>{item.label}: {item.value}</title>
|
|
202
|
+
</path>
|
|
203
|
+
)
|
|
204
|
+
})}
|
|
205
|
+
{type === "donut" && (
|
|
206
|
+
<circle cx={PIE_CX} cy={PIE_CY} r={DONUT_INNER_R} fill="var(--color-card, white)" />
|
|
207
|
+
)}
|
|
208
|
+
</svg>
|
|
209
|
+
|
|
210
|
+
{/* Legend */}
|
|
211
|
+
<div class="flex flex-col gap-1.5">
|
|
212
|
+
{data.map((item, i) => (
|
|
213
|
+
<div class="flex items-center gap-2 text-xs text-muted-foreground">
|
|
214
|
+
<span
|
|
215
|
+
class={`size-3 rounded-sm shrink-0 rlc-${instanceId}-s-${i}`}
|
|
216
|
+
/>
|
|
217
|
+
<span>{item.label}</span>
|
|
218
|
+
<span class="ml-1 font-mono text-foreground">{item.value}</span>
|
|
219
|
+
</div>
|
|
220
|
+
))}
|
|
221
|
+
</div>
|
|
222
|
+
</div>
|
|
223
|
+
)}
|
|
224
|
+
|
|
225
|
+
{/* Custom slot for fully custom chart content */}
|
|
226
|
+
<slot />
|
|
227
|
+
|
|
228
|
+
{/* Legend row for bar/line */}
|
|
229
|
+
{(type === "bar" || type === "line" || type === "area") && data.length > 0 && (
|
|
230
|
+
<div class={classes.legend} data-slot="legend">
|
|
231
|
+
{data.map((item, i) => (
|
|
232
|
+
<div class="flex items-center gap-1.5">
|
|
233
|
+
<span class={`size-2.5 rounded-full shrink-0 rlc-${instanceId}-s-${i}`} />
|
|
234
|
+
<span>{item.label}</span>
|
|
235
|
+
</div>
|
|
236
|
+
))}
|
|
237
|
+
</div>
|
|
238
|
+
)}
|
|
239
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { scv } from "css-variants"
|
|
3
|
+
import { useUi, resolveClasses } from "../../utils"
|
|
4
|
+
import type { ChatProps } from "../../types"
|
|
5
|
+
import chatThemeDefault from "../../themes/chat.theme"
|
|
6
|
+
|
|
7
|
+
const chat = scv(chatThemeDefault)
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
ui: uiProp,
|
|
11
|
+
class: className,
|
|
12
|
+
...rest
|
|
13
|
+
} = Astro.props as ChatProps
|
|
14
|
+
|
|
15
|
+
const classes = resolveClasses(chat, {}, useUi("chat", uiProp), className);
|
|
16
|
+
---
|
|
17
|
+
<div class={classes.root} data-slot="root" {...rest}>
|
|
18
|
+
<slot />
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { scv } from "css-variants"
|
|
3
|
+
import { useUi, resolveClasses } from "../../utils"
|
|
4
|
+
import type { ChatMessageProps } from "../../types"
|
|
5
|
+
import chatMessageThemeDefault from "../../themes/chat-message.theme"
|
|
6
|
+
|
|
7
|
+
const chatMessage = scv(chatMessageThemeDefault)
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
ui: uiProp,
|
|
11
|
+
class: className,
|
|
12
|
+
...rest
|
|
13
|
+
} = Astro.props as ChatMessageProps
|
|
14
|
+
|
|
15
|
+
const classes = resolveClasses(chatMessage, {}, useUi("chatMessage", uiProp), className);
|
|
16
|
+
---
|
|
17
|
+
<div class={classes.root} data-slot="root" {...rest}>
|
|
18
|
+
<slot />
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { scv } from "css-variants"
|
|
3
|
+
import { useUi, resolveClasses } from "../../utils"
|
|
4
|
+
import type { ChatMessagesProps } from "../../types"
|
|
5
|
+
import chatMessagesThemeDefault from "../../themes/chat-messages.theme"
|
|
6
|
+
|
|
7
|
+
const chatMessages = scv(chatMessagesThemeDefault)
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
ui: uiProp,
|
|
11
|
+
class: className,
|
|
12
|
+
...rest
|
|
13
|
+
} = Astro.props as ChatMessagesProps
|
|
14
|
+
|
|
15
|
+
const classes = resolveClasses(chatMessages, {}, useUi("chatMessages", uiProp), className);
|
|
16
|
+
---
|
|
17
|
+
<div class={classes.root} data-slot="root" {...rest}>
|
|
18
|
+
<slot />
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { scv } from "css-variants"
|
|
3
|
+
import { useUi, resolveClasses } from "../../utils"
|
|
4
|
+
import type { ChatPaletteProps } from "../../types"
|
|
5
|
+
import chatPaletteThemeDefault from "../../themes/chat-palette.theme"
|
|
6
|
+
|
|
7
|
+
const chatPalette = scv(chatPaletteThemeDefault)
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
ui: uiProp,
|
|
11
|
+
class: className,
|
|
12
|
+
...rest
|
|
13
|
+
} = Astro.props as ChatPaletteProps
|
|
14
|
+
|
|
15
|
+
const classes = resolveClasses(chatPalette, {}, useUi("chatPalette", uiProp), className);
|
|
16
|
+
---
|
|
17
|
+
<div class={classes.root} data-slot="root" {...rest}>
|
|
18
|
+
<slot />
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { scv } from "css-variants"
|
|
3
|
+
import { useUi, resolveClasses } from "../../utils"
|
|
4
|
+
import type { ChatPromptProps } from "../../types"
|
|
5
|
+
import chatPromptThemeDefault from "../../themes/chat-prompt.theme"
|
|
6
|
+
|
|
7
|
+
const chatPrompt = scv(chatPromptThemeDefault)
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
ui: uiProp,
|
|
11
|
+
class: className,
|
|
12
|
+
...rest
|
|
13
|
+
} = Astro.props as ChatPromptProps
|
|
14
|
+
|
|
15
|
+
const classes = resolveClasses(chatPrompt, {}, useUi("chatPrompt", uiProp), className);
|
|
16
|
+
---
|
|
17
|
+
<div class={classes.root} data-slot="root" {...rest}>
|
|
18
|
+
<slot />
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { scv } from "css-variants"
|
|
3
|
+
import { useUi, resolveClasses } from "../../utils"
|
|
4
|
+
import type { ChatPromptSubmitProps } from "../../types"
|
|
5
|
+
import chatPromptSubmitThemeDefault from "../../themes/chat-prompt-submit.theme"
|
|
6
|
+
|
|
7
|
+
const chatPromptSubmit = scv(chatPromptSubmitThemeDefault)
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
ui: uiProp,
|
|
11
|
+
class: className,
|
|
12
|
+
...rest
|
|
13
|
+
} = Astro.props as ChatPromptSubmitProps
|
|
14
|
+
|
|
15
|
+
const classes = resolveClasses(chatPromptSubmit, {}, useUi("chatPromptSubmit", uiProp), className);
|
|
16
|
+
---
|
|
17
|
+
<div class={classes.root} data-slot="root" {...rest}>
|
|
18
|
+
<slot />
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { scv } from "css-variants"
|
|
3
|
+
import { useUi, resolveClasses } from "../../utils"
|
|
4
|
+
import type { ChatReasoningProps } from "../../types"
|
|
5
|
+
import chatReasoningThemeDefault from "../../themes/chat-reasoning.theme"
|
|
6
|
+
|
|
7
|
+
const chatReasoning = scv(chatReasoningThemeDefault)
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
ui: uiProp,
|
|
11
|
+
class: className,
|
|
12
|
+
...rest
|
|
13
|
+
} = Astro.props as ChatReasoningProps
|
|
14
|
+
|
|
15
|
+
const classes = resolveClasses(chatReasoning, {}, useUi("chatReasoning", uiProp), className);
|
|
16
|
+
---
|
|
17
|
+
<div class={classes.root} data-slot="root" {...rest}>
|
|
18
|
+
<slot />
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { scv } from "css-variants"
|
|
3
|
+
import { useUi, resolveClasses } from "../../utils"
|
|
4
|
+
import type { ChatShimmerProps } from "../../types"
|
|
5
|
+
import chatShimmerThemeDefault from "../../themes/chat-shimmer.theme"
|
|
6
|
+
|
|
7
|
+
const chatShimmer = scv(chatShimmerThemeDefault)
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
ui: uiProp,
|
|
11
|
+
class: className,
|
|
12
|
+
...rest
|
|
13
|
+
} = Astro.props as ChatShimmerProps
|
|
14
|
+
|
|
15
|
+
const classes = resolveClasses(chatShimmer, {}, useUi("chatShimmer", uiProp), className);
|
|
16
|
+
---
|
|
17
|
+
<div class={classes.root} data-slot="root" {...rest}>
|
|
18
|
+
<slot />
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { scv } from "css-variants"
|
|
3
|
+
import { useUi, resolveClasses } from "../../utils"
|
|
4
|
+
import type { ChatToolProps } from "../../types"
|
|
5
|
+
import chatToolThemeDefault from "../../themes/chat-tool.theme"
|
|
6
|
+
|
|
7
|
+
const chatTool = scv(chatToolThemeDefault)
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
ui: uiProp,
|
|
11
|
+
class: className,
|
|
12
|
+
...rest
|
|
13
|
+
} = Astro.props as ChatToolProps
|
|
14
|
+
|
|
15
|
+
const classes = resolveClasses(chatTool, {}, useUi("chatTool", uiProp), className);
|
|
16
|
+
---
|
|
17
|
+
<div class={classes.root} data-slot="root" {...rest}>
|
|
18
|
+
<slot />
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { scv } from "css-variants"
|
|
3
|
+
import { useUi, resolveClasses } from "../../utils"
|
|
4
|
+
import type { CheckboxProps } from "../../types"
|
|
5
|
+
import checkboxThemeDefault, { createCheckboxTheme } from "../../themes/checkbox.theme"
|
|
6
|
+
import { getUIConfig } from "virtual:rimelight-ui"
|
|
7
|
+
|
|
8
|
+
const uiConfig = getUIConfig()
|
|
9
|
+
const checkboxTheme = uiConfig.colors ? createCheckboxTheme(uiConfig.colors) : checkboxThemeDefault
|
|
10
|
+
|
|
11
|
+
const checkbox = scv(checkboxTheme)
|
|
12
|
+
|
|
13
|
+
const {
|
|
14
|
+
checked = false,
|
|
15
|
+
disabled = false,
|
|
16
|
+
name,
|
|
17
|
+
label,
|
|
18
|
+
color = "primary",
|
|
19
|
+
size = "md",
|
|
20
|
+
theme,
|
|
21
|
+
ui: uiProp,
|
|
22
|
+
class: className,
|
|
23
|
+
...rest
|
|
24
|
+
} = Astro.props as CheckboxProps
|
|
25
|
+
|
|
26
|
+
const classes = resolveClasses(checkbox, {
|
|
27
|
+
color,
|
|
28
|
+
size,
|
|
29
|
+
checked,
|
|
30
|
+
theme
|
|
31
|
+
}, useUi("checkbox", uiProp), className);
|
|
32
|
+
---
|
|
33
|
+
<label class={classes.root} data-slot="root">
|
|
34
|
+
<input
|
|
35
|
+
type="checkbox"
|
|
36
|
+
class={classes.input}
|
|
37
|
+
checked={checked}
|
|
38
|
+
disabled={disabled}
|
|
39
|
+
name={name}
|
|
40
|
+
{...rest}
|
|
41
|
+
/>
|
|
42
|
+
<div class={classes.box} data-slot="box">
|
|
43
|
+
<div class={classes.indicator} data-slot="indicator">
|
|
44
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" class="size-3"><path d="M20 6 9 17l-5-5"/></svg>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
{label !== undefined && label !== null && (
|
|
48
|
+
<span class={classes.label} data-slot="label">
|
|
49
|
+
{label}
|
|
50
|
+
</span>
|
|
51
|
+
)}
|
|
52
|
+
{!label && <slot />}
|
|
53
|
+
</label>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { scv } from "css-variants"
|
|
3
|
+
import { useUi, resolveClasses } from "../../utils"
|
|
4
|
+
import type { ChipProps } from "../../types"
|
|
5
|
+
import chipThemeDefault from "../../themes/chip.theme"
|
|
6
|
+
|
|
7
|
+
const chip = scv(chipThemeDefault)
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
theme,
|
|
11
|
+
ui: uiProp,
|
|
12
|
+
class: className,
|
|
13
|
+
...rest
|
|
14
|
+
} = Astro.props as ChipProps
|
|
15
|
+
|
|
16
|
+
const classes = resolveClasses(chip, { theme }, useUi("chip", uiProp), className);
|
|
17
|
+
---
|
|
18
|
+
<div class={classes.root} data-slot="root" {...rest}>
|
|
19
|
+
<slot />
|
|
20
|
+
</div>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { scv } from "css-variants"
|
|
3
|
+
import { useUi, resolveClasses } from "../../utils"
|
|
4
|
+
import type { CollapsibleProps } from "../../types"
|
|
5
|
+
import collapsibleThemeDefault, { createCollapsibleTheme } from "../../themes/collapsible.theme"
|
|
6
|
+
|
|
7
|
+
const collapsibleTheme = collapsibleThemeDefault
|
|
8
|
+
const collapsible = scv(collapsibleTheme)
|
|
9
|
+
|
|
10
|
+
const {
|
|
11
|
+
open = false,
|
|
12
|
+
label = "Toggle",
|
|
13
|
+
icon,
|
|
14
|
+
size = "md",
|
|
15
|
+
color = "primary",
|
|
16
|
+
ui: uiProp,
|
|
17
|
+
class: className,
|
|
18
|
+
...rest
|
|
19
|
+
} = Astro.props as CollapsibleProps
|
|
20
|
+
|
|
21
|
+
const classes = resolveClasses(collapsible, {
|
|
22
|
+
open
|
|
23
|
+
}, useUi("collapsible", uiProp), className);
|
|
24
|
+
---
|
|
25
|
+
<details class={classes.root} open={open ? true : undefined} data-slot="root" {...rest}>
|
|
26
|
+
<summary class={classes.trigger} data-slot="trigger">
|
|
27
|
+
<slot name="trigger">
|
|
28
|
+
<span class="flex items-center gap-2">
|
|
29
|
+
{icon && <span class={icon} />}
|
|
30
|
+
{label}
|
|
31
|
+
</span>
|
|
32
|
+
<span class="i-lucide-chevron-down transition-transform duration-200 group-open:rotate-180" />
|
|
33
|
+
</slot>
|
|
34
|
+
</summary>
|
|
35
|
+
<div class={classes.content} data-slot="content">
|
|
36
|
+
<slot />
|
|
37
|
+
</div>
|
|
38
|
+
</details>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { scv } from "css-variants"
|
|
3
|
+
import { useUi, resolveClasses } from "../../utils"
|
|
4
|
+
import type { ColorPickerProps } from "../../types"
|
|
5
|
+
import colorPickerThemeDefault from "../../themes/color-picker.theme"
|
|
6
|
+
|
|
7
|
+
const colorPicker = scv(colorPickerThemeDefault)
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
ui: uiProp,
|
|
11
|
+
class: className,
|
|
12
|
+
...rest
|
|
13
|
+
} = Astro.props as ColorPickerProps
|
|
14
|
+
|
|
15
|
+
const classes = resolveClasses(colorPicker, {}, useUi("colorPicker", uiProp), className);
|
|
16
|
+
---
|
|
17
|
+
<div class={classes.root} data-slot="root" {...rest}>
|
|
18
|
+
<slot />
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { scv } from "css-variants"
|
|
3
|
+
import { useUi, resolveClasses } from "../../utils"
|
|
4
|
+
import type { CommandPaletteProps } from "../../types"
|
|
5
|
+
import commandPaletteThemeDefault from "../../themes/command-palette.theme"
|
|
6
|
+
|
|
7
|
+
const commandPalette = scv(commandPaletteThemeDefault)
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
ui: uiProp,
|
|
11
|
+
class: className,
|
|
12
|
+
...rest
|
|
13
|
+
} = Astro.props as CommandPaletteProps
|
|
14
|
+
|
|
15
|
+
const classes = resolveClasses(commandPalette, {}, useUi("commandPalette", uiProp), className);
|
|
16
|
+
---
|
|
17
|
+
<div class={classes.root} data-slot="root" {...rest}>
|
|
18
|
+
<slot />
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { scv } from "css-variants"
|
|
3
|
+
import { useUi, resolveClasses } from "../../utils"
|
|
4
|
+
import type { CompareProps } from "../../types"
|
|
5
|
+
import compareThemeDefault from "../../themes/compare.theme"
|
|
6
|
+
|
|
7
|
+
const compare = scv(compareThemeDefault)
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
ui: uiProp,
|
|
11
|
+
class: className,
|
|
12
|
+
...rest
|
|
13
|
+
} = Astro.props as CompareProps
|
|
14
|
+
|
|
15
|
+
const classes = resolveClasses(compare, {}, useUi("compare", uiProp), className);
|
|
16
|
+
---
|
|
17
|
+
<div class={classes.root} data-slot="root" {...rest}>
|
|
18
|
+
<slot />
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { scv } from "css-variants"
|
|
3
|
+
import { useUi, resolveClasses } from "../../utils"
|
|
4
|
+
import type { AlertDialogProps } from "../../types"
|
|
5
|
+
import alertDialogTheme from "../../themes/confirm.theme"
|
|
6
|
+
import RLAButton from "./RLAButton.astro"
|
|
7
|
+
|
|
8
|
+
const alertDialog = scv(alertDialogTheme)
|
|
9
|
+
|
|
10
|
+
const {
|
|
11
|
+
variant = "default",
|
|
12
|
+
title,
|
|
13
|
+
description,
|
|
14
|
+
actionLabel = "Confirm",
|
|
15
|
+
cancelLabel = "Cancel",
|
|
16
|
+
triggerLabel,
|
|
17
|
+
ui: uiProp,
|
|
18
|
+
class: className,
|
|
19
|
+
...rest
|
|
20
|
+
} = Astro.props as AlertDialogProps
|
|
21
|
+
|
|
22
|
+
const classes = resolveClasses(alertDialog, {
|
|
23
|
+
variant
|
|
24
|
+
}, useUi("alertDialog", uiProp), className)
|
|
25
|
+
|
|
26
|
+
const dialogId = `rla-alert-dialog-${Math.random().toString(36).substring(2, 9)}`
|
|
27
|
+
---
|
|
28
|
+
<div class={classes.root} data-slot="alert-dialog-container">
|
|
29
|
+
{triggerLabel ? (
|
|
30
|
+
<RLAButton
|
|
31
|
+
class={classes.trigger}
|
|
32
|
+
data-slot="trigger"
|
|
33
|
+
type="button"
|
|
34
|
+
onclick={`document.getElementById('${dialogId}').showModal()`}
|
|
35
|
+
>
|
|
36
|
+
{triggerLabel}
|
|
37
|
+
</RLAButton>
|
|
38
|
+
) : (
|
|
39
|
+
<span onclick={`document.getElementById('${dialogId}').showModal()`}>
|
|
40
|
+
<slot name="trigger" />
|
|
41
|
+
</span>
|
|
42
|
+
)}
|
|
43
|
+
|
|
44
|
+
<dialog
|
|
45
|
+
id={dialogId}
|
|
46
|
+
class={classes.content}
|
|
47
|
+
data-slot="content"
|
|
48
|
+
data-lock-scroll="true"
|
|
49
|
+
data-close-on-escape="false"
|
|
50
|
+
data-close-on-click-outside="false"
|
|
51
|
+
{...rest}
|
|
52
|
+
>
|
|
53
|
+
<div class={classes.header} data-slot="header">
|
|
54
|
+
{title && <h3 class={classes.title} data-slot="title">{title}</h3>}
|
|
55
|
+
<slot name="title" />
|
|
56
|
+
|
|
57
|
+
{description && <p class={classes.description} data-slot="description">{description}</p>}
|
|
58
|
+
<slot name="description" />
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
<slot />
|
|
62
|
+
|
|
63
|
+
<div class={classes.footer} data-slot="footer">
|
|
64
|
+
<slot name="footer">
|
|
65
|
+
<RLAButton
|
|
66
|
+
class={classes.cancelButton}
|
|
67
|
+
data-slot="cancel"
|
|
68
|
+
variant="outline"
|
|
69
|
+
type="button"
|
|
70
|
+
onclick={`document.getElementById('${dialogId}').close()`}
|
|
71
|
+
>
|
|
72
|
+
{cancelLabel}
|
|
73
|
+
</RLAButton>
|
|
74
|
+
<RLAButton
|
|
75
|
+
class={classes.actionButton}
|
|
76
|
+
data-slot="action"
|
|
77
|
+
color={variant === "destructive" ? "error" : "primary"}
|
|
78
|
+
type="button"
|
|
79
|
+
onclick={`document.getElementById('${dialogId}').close()`}
|
|
80
|
+
>
|
|
81
|
+
{actionLabel}
|
|
82
|
+
</RLAButton>
|
|
83
|
+
</slot>
|
|
84
|
+
</div>
|
|
85
|
+
</dialog>
|
|
86
|
+
</div>
|