@rimelight/ui 0.0.46 → 0.0.48
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/icons-DPnFQCts.d.mts +72 -0
- package/dist/icons.d.mts +1 -1
- package/dist/index.d.mts +5 -6
- package/dist/preset.d.mts +1 -1
- package/dist/preset.mjs +73 -1
- package/dist/resolver.d.mts +4 -5
- package/dist/resolver.mjs +2 -4
- package/dist/shortcuts.d.mts +10 -11
- package/dist/stores.d.mts +3 -4
- package/dist/{types-DqAgCNcm.d.mts → types-DWmKMcYC.d.mts} +1 -1
- package/dist/types.d.mts +1 -1
- package/package.json +8 -6
- package/src/components/3d-hover/RLS3dHover.tsx +21 -0
- package/src/components/accordion/RLSAccordion.tsx +112 -0
- package/src/components/app/RLSApp.tsx +21 -0
- package/src/components/aspect-ratio/RLSAspectRatio.tsx +30 -0
- package/src/components/audio/RLSAudio.tsx +27 -0
- package/src/components/avatar/RLSAvatar.tsx +142 -0
- package/src/components/avatar/avatar.ts +22 -21
- package/src/components/avatar-group/RLSAvatarGroup.tsx +163 -0
- package/src/components/badge/RLSBadge.tsx +1 -1
- package/src/components/badge/RLVBadge.vue +5 -3
- package/src/components/banner/RLABanner.astro +1 -1
- package/src/components/banner/RLSBanner.tsx +151 -0
- package/src/components/breadcrumb/RLSBreadcrumb.tsx +194 -0
- package/src/components/browser-mockup/RLSBrowserMockup.tsx +21 -0
- package/src/components/button/RLSButton.tsx +53 -38
- package/src/components/button/RLVButton.vue +44 -32
- package/src/components/calendar/RLSCalendar.tsx +26 -0
- package/src/components/callout/RLSCallout.tsx +151 -0
- package/src/components/card/RLSCard.tsx +4 -0
- package/src/components/card/RLVCard.vue +4 -0
- package/src/components/card/card.ts +10 -0
- package/src/components/carousel/RLACarousel.astro +14 -1
- package/src/components/carousel/RLSCarousel.tsx +260 -0
- package/src/components/chart/RLSChart.tsx +299 -0
- package/src/components/chat/RLSChat.tsx +27 -0
- package/src/components/chat-message/RLSChatMessage.tsx +27 -0
- package/src/components/chat-messages/RLSChatMessages.tsx +27 -0
- package/src/components/chat-palette/RLSChatPalette.tsx +27 -0
- package/src/components/chat-prompt/RLSChatPrompt.tsx +27 -0
- package/src/components/chat-prompt-submit/RLSChatPromptSubmit.tsx +27 -0
- package/src/components/chat-reasoning/RLSChatReasoning.tsx +27 -0
- package/src/components/chat-shimmer/RLSChatShimmer.tsx +27 -0
- package/src/components/chat-tool/RLSChatTool.tsx +27 -0
- package/src/components/checkbox/RLACheckbox.astro +1 -0
- package/src/components/checkbox/RLSCheckbox.tsx +1 -1
- package/src/components/checkbox/checkbox.theme.ts +2 -2
- package/src/components/chip/RLSChip.tsx +65 -0
- package/src/components/collapsible/RLSCollapsible.tsx +89 -0
- package/src/components/color-area/RLSColorArea.tsx +554 -0
- package/src/components/color-field/RLSColorField.tsx +236 -0
- package/src/components/color-picker/RLSColorPicker.tsx +26 -0
- package/src/components/color-slider/RLSColorSlider.tsx +373 -0
- package/src/components/command-palette/RLSCommandPalette.tsx +26 -0
- package/src/components/compare/RLSCompare.tsx +26 -0
- package/src/components/confirm/RLSConfirm.tsx +173 -0
- package/src/components/container/RLSContainer.tsx +24 -0
- package/src/components/context-menu/RLSContextMenu.tsx +26 -0
- package/src/components/copy-markdown/RLSCopyMarkdown.tsx +57 -0
- package/src/components/dashboard-group/RLSDashboardGroup.tsx +29 -0
- package/src/components/dashboard-navbar/RLSDashboardNavbar.tsx +116 -0
- package/src/components/dashboard-panel/RLSDashboardPanel.tsx +84 -0
- package/src/components/dashboard-resize-handle/RLSDashboardResizeHandle.tsx +35 -0
- package/src/components/dashboard-search/RLADashboardSearch.astro +1 -1
- package/src/components/dashboard-search/RLSDashboardSearch.tsx +125 -0
- package/src/components/dashboard-search-button/RLSDashboardSearchButton.tsx +82 -0
- package/src/components/dashboard-sidebar/RLADashboardSidebar.astro +4 -4
- package/src/components/dashboard-sidebar/RLSDashboardSidebar.tsx +184 -0
- package/src/components/dashboard-sidebar-collapse/RLSDashboardSidebarCollapse.tsx +46 -0
- package/src/components/dashboard-sidebar-toggle/RLSDashboardSidebarToggle.tsx +35 -0
- package/src/components/dashboard-toolbar/RLSDashboardToolbar.tsx +49 -0
- package/src/components/date/RLSDate.tsx +34 -0
- package/src/components/dock/RLSDock.tsx +26 -0
- package/src/components/drawer/RLSDrawer.tsx +177 -0
- package/src/components/dropdown-menu/RLADropdownMenu.astro +250 -241
- package/src/components/dropdown-menu/RLSDropdownMenu.tsx +183 -86
- package/src/components/editor/RLSEditor.tsx +26 -0
- package/src/components/empty/RLSEmpty.tsx +132 -0
- package/src/components/error/RLSError.tsx +26 -0
- package/src/components/field-group/RLSFieldGroup.tsx +46 -0
- package/src/components/fieldset/RLSFieldset.tsx +26 -0
- package/src/components/file-upload/RLAFileUpload.astro +1 -1
- package/src/components/file-upload/RLSFileUpload.tsx +163 -0
- package/src/components/floating-action/RLSFloatingAction.tsx +26 -0
- package/src/components/footer/RLSFooter.tsx +56 -0
- package/src/components/form/RLSForm.tsx +34 -0
- package/src/components/gallery/RLSGallery.tsx +21 -0
- package/src/components/gamepad/RLSGamepad.tsx +269 -0
- package/src/components/grid/RLSGrid.tsx +29 -0
- package/src/components/head/RLAHead.astro +9 -0
- package/src/components/head/RLSHead.tsx +42 -0
- package/src/components/head/UIHead.astro +3 -0
- package/src/components/header/HeaderLayer.astro +1 -1
- package/src/components/header/RLSHeader.tsx +87 -0
- package/src/components/hover-card/RLSHoverCard.tsx +72 -0
- package/src/components/icon/RLSIcon.tsx +3 -1
- package/src/components/image/RLAImage.astro +447 -138
- package/src/components/image/RLSImage.tsx +545 -0
- package/src/components/image/image.theme.ts +19 -3
- package/src/components/image/image.ts +31 -1
- package/src/components/input/RLAInput.astro +62 -51
- package/src/components/input/RLSInput.tsx +1 -1
- package/src/components/input-date/RLSInputDate.tsx +92 -0
- package/src/components/input-menu/RLAInputMenu.astro +3 -3
- package/src/components/input-menu/RLSInputMenu.tsx +199 -0
- package/src/components/input-number/RLSInputNumber.tsx +184 -0
- package/src/components/input-pin/RLSInputPin.tsx +185 -0
- package/src/components/input-rating/RLAInputRating.astro +8 -8
- package/src/components/input-rating/RLSInputRating.tsx +198 -0
- package/src/components/input-rating/input-rating.ts +4 -0
- package/src/components/input-tags/RLSInputTags.tsx +94 -0
- package/src/components/input-time/RLSInputTime.tsx +92 -0
- package/src/components/kbd/RLSKbd.tsx +37 -0
- package/src/components/keyboard/RLSKeyboard.tsx +476 -0
- package/src/components/knob/RLSKnob.tsx +27 -0
- package/src/components/label/RLSLabel.tsx +27 -0
- package/src/components/layout-grid/RLALayoutGrid.astro +29 -29
- package/src/components/layout-grid/RLSLayoutGrid.tsx +402 -0
- package/src/components/layout-grid/layout-grid.ts +25 -1
- package/src/components/link/RLALink.astro +5 -5
- package/src/components/link/RLSLink.tsx +6 -5
- package/src/components/link/link.ts +21 -12
- package/src/components/link-group/RLSLinkGroup.tsx +76 -0
- package/src/components/listbox/RLSListbox.tsx +27 -0
- package/src/components/locale-selector/RLALocaleSelector.astro +110 -102
- package/src/components/locale-selector/RLSLocaleSelector.tsx +178 -0
- package/src/components/locale-selector/locale-selector.ts +2 -7
- package/src/components/logo/RLALogo.astro +153 -102
- package/src/components/logo/RLSLogo.tsx +129 -0
- package/src/components/main/RLSMain.tsx +40 -0
- package/src/components/marquee/RLSMarquee.tsx +80 -0
- package/src/components/meter/RLSMeter.tsx +27 -0
- package/src/components/modal/RLAModal.astro +1 -1
- package/src/components/modal/RLSModal.tsx +109 -72
- package/src/components/navigation-menu/RLANavigationMenu.astro +6 -6
- package/src/components/navigation-menu/RLSNavigationMenu.tsx +228 -0
- package/src/components/navigation-menu/navigation-menu.ts +2 -2
- package/src/components/package-managers/RLSPackageManagers.tsx +204 -0
- package/src/components/page/RLSPage.tsx +21 -0
- package/src/components/page-aside/RLSPageAside.tsx +21 -0
- package/src/components/page-body/RLSPageBody.tsx +21 -0
- package/src/components/page-header/RLSPageHeader.tsx +21 -0
- package/src/components/page-section/RLSPageSection.tsx +201 -0
- package/src/components/pagination/RLSPagination.tsx +114 -0
- package/src/components/password/RLSPassword.tsx +27 -0
- package/src/components/phone-mockup/RLSPhoneMockup.tsx +27 -0
- package/src/components/placeholder/RLSPlaceholder.tsx +47 -0
- package/src/components/popover/RLAPopover.astro +2 -2
- package/src/components/popover/RLSPopover.tsx +124 -0
- package/src/components/post/RLSPost.tsx +134 -0
- package/src/components/pricing-plan/RLSPricingPlan.tsx +26 -0
- package/src/components/pricing-table/RLSPricingTable.tsx +26 -0
- package/src/components/progress/RLSProgress.tsx +53 -0
- package/src/components/prose/RLSProse.tsx +26 -0
- package/src/components/qr-code/RLSQrCode.tsx +26 -0
- package/src/components/quote/RLAQuote.astro +10 -6
- package/src/components/quote/RLSQuote.tsx +37 -0
- package/src/components/quote/quote.theme.ts +5 -2
- package/src/components/radio-group/RLSRadioGroup.tsx +37 -0
- package/src/components/rating/RLSRating.tsx +27 -0
- package/src/components/scroll-area/RLAScrollArea.astro +1 -1
- package/src/components/scroll-area/RLSScrollArea.tsx +210 -0
- package/src/components/scroll-to-top/RLAScrollToTop.astro +5 -4
- package/src/components/scroll-to-top/RLSScrollToTop.tsx +145 -0
- package/src/components/search/RLASearch.astro +6 -6
- package/src/components/search/RLSSearch.tsx +237 -0
- package/src/components/select/RLASelect.astro +67 -4
- package/src/components/select/RLSSelect.tsx +107 -39
- package/src/components/select/RLVSelect.vue +50 -1
- package/src/components/select/select.theme.ts +30 -10
- package/src/components/select/select.ts +20 -1
- package/src/components/separator/RLSSeparator.tsx +92 -0
- package/src/components/share/RLSShare.tsx +66 -0
- package/src/components/shortcuts/RLAShortcuts.astro +2 -2
- package/src/components/shortcuts/RLSShortcuts.tsx +393 -0
- package/src/components/sidebar/RLASidebar.astro +1 -1
- package/src/components/sidebar/RLSSidebar.tsx +271 -0
- package/src/components/skeleton/RLSSkeleton.tsx +21 -0
- package/src/components/slideover/RLASlideover.astro +1 -1
- package/src/components/slideover/RLSSlideover.tsx +159 -0
- package/src/components/slider/RLSSlider.tsx +112 -0
- package/src/components/speed-dial/RLSSpeedDial.tsx +27 -0
- package/src/components/spinner/RLSSpinner.tsx +22 -0
- package/src/components/splitter/RLASplitter.astro +1 -1
- package/src/components/splitter/RLSSplitter.tsx +178 -0
- package/src/components/spoiler/RLSSpoiler.tsx +26 -0
- package/src/components/stepper/RLAStepper.astro +9 -9
- package/src/components/stepper/RLSStepper.tsx +205 -0
- package/src/components/steps/RLSSteps.tsx +108 -0
- package/src/components/sticky-surface/RLSStickySurface.tsx +63 -0
- package/src/components/surround/RLSSurround.tsx +57 -0
- package/src/components/switch/RLSSwitch.tsx +56 -0
- package/src/components/table/RLATable.astro +1044 -579
- package/src/components/table/RLSTable.tsx +893 -0
- package/src/components/table/table.theme.ts +47 -16
- package/src/components/table/table.ts +104 -66
- package/src/components/table-of-contents/RLSTableOfContents.tsx +196 -0
- package/src/components/tabs/RLATabs.astro +8 -8
- package/src/components/tabs/RLSTabs.tsx +298 -0
- package/src/components/textarea/RLATextarea.astro +1 -0
- package/src/components/textarea/RLSTextarea.tsx +3 -1
- package/src/components/theme-selector/RLAThemeSelector.astro +85 -56
- package/src/components/theme-selector/RLSThemeSelector.tsx +131 -0
- package/src/components/theme-selector/theme-selector.theme.ts +5 -7
- package/src/components/theme-selector/theme-selector.ts +11 -1
- package/src/components/timeline/RLSTimeline.tsx +171 -0
- package/src/components/toast/RLAToast.astro +2 -2
- package/src/components/toast/RLSToast.tsx +179 -0
- package/src/components/toaster/RLSToaster.tsx +82 -0
- package/src/components/tooltip/RLSTooltip.tsx +48 -0
- package/src/components/tour/RLSTour.tsx +26 -0
- package/src/components/tree/RLSTree.tsx +26 -0
- package/src/components/user/RLSUser.tsx +26 -0
- package/src/components/video/RLAVideo.astro +4 -1
- package/src/components/video/RLSVideo.tsx +158 -0
- package/src/components/watermark/RLSWatermark.tsx +27 -0
- package/src/components/window-mockup/RLSWindowMockup.tsx +27 -0
- package/src/preset.ts +73 -1
- package/src/resolver.ts +6 -1
- package/src/virtual.d.ts +6 -0
- package/dist/icons--RzV1RTU.d.mts +0 -72
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createEffect,
|
|
3
|
+
createMemo,
|
|
4
|
+
createSignal,
|
|
5
|
+
splitProps,
|
|
6
|
+
type Component,
|
|
7
|
+
type JSX
|
|
8
|
+
} from "solid-js"
|
|
9
|
+
import type { ConfirmProps } from "./confirm"
|
|
10
|
+
import { confirmTheme } from "./confirm.theme"
|
|
11
|
+
import RLSButton from "../button/RLSButton"
|
|
12
|
+
|
|
13
|
+
export interface RLSConfirmProps extends ConfirmProps {
|
|
14
|
+
children?: JSX.Element
|
|
15
|
+
trigger?: JSX.Element
|
|
16
|
+
titleSlot?: JSX.Element
|
|
17
|
+
descriptionSlot?: JSX.Element
|
|
18
|
+
footer?: JSX.Element
|
|
19
|
+
footerSlot?: JSX.Element
|
|
20
|
+
onOpenChange?: (open: boolean) => void
|
|
21
|
+
onConfirm?: () => void
|
|
22
|
+
onCancel?: () => void
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const RLSConfirm: Component<RLSConfirmProps> = (allProps) => {
|
|
26
|
+
const [props, rest] = splitProps(allProps, [
|
|
27
|
+
"variant",
|
|
28
|
+
"title",
|
|
29
|
+
"description",
|
|
30
|
+
"actionLabel",
|
|
31
|
+
"cancelLabel",
|
|
32
|
+
"triggerLabel",
|
|
33
|
+
"open",
|
|
34
|
+
"ui",
|
|
35
|
+
"class",
|
|
36
|
+
"children",
|
|
37
|
+
"trigger",
|
|
38
|
+
"titleSlot",
|
|
39
|
+
"descriptionSlot",
|
|
40
|
+
"footer",
|
|
41
|
+
"footerSlot",
|
|
42
|
+
"onOpenChange",
|
|
43
|
+
"onConfirm",
|
|
44
|
+
"onCancel"
|
|
45
|
+
])
|
|
46
|
+
|
|
47
|
+
const [isOpen, setIsOpen] = createSignal(props.open ?? false)
|
|
48
|
+
let dialogRef: HTMLDialogElement | undefined
|
|
49
|
+
|
|
50
|
+
const resolvedClasses = createMemo(() =>
|
|
51
|
+
confirmTheme({
|
|
52
|
+
variant: props.variant ?? "default",
|
|
53
|
+
ui: props.ui,
|
|
54
|
+
class: props.class
|
|
55
|
+
})
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
createEffect(() => {
|
|
59
|
+
if (!dialogRef) return
|
|
60
|
+
if (isOpen()) {
|
|
61
|
+
if (!dialogRef.open) dialogRef.showModal()
|
|
62
|
+
} else {
|
|
63
|
+
if (dialogRef.open) dialogRef.close()
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
createEffect(() => {
|
|
68
|
+
if (props.open !== undefined) {
|
|
69
|
+
setIsOpen(props.open)
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
const openDialog = () => {
|
|
74
|
+
setIsOpen(true)
|
|
75
|
+
props.onOpenChange?.(true)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const handleCancel = () => {
|
|
79
|
+
setIsOpen(false)
|
|
80
|
+
props.onOpenChange?.(false)
|
|
81
|
+
props.onCancel?.()
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const handleAction = () => {
|
|
85
|
+
setIsOpen(false)
|
|
86
|
+
props.onOpenChange?.(false)
|
|
87
|
+
props.onConfirm?.()
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const isDestructive = () => props.variant === "destructive"
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<div class={resolvedClasses().root} data-slot="alert-dialog-container">
|
|
94
|
+
{props.triggerLabel ? (
|
|
95
|
+
<RLSButton
|
|
96
|
+
class={resolvedClasses().trigger}
|
|
97
|
+
data-slot="trigger"
|
|
98
|
+
type="button"
|
|
99
|
+
onClick={openDialog}
|
|
100
|
+
>
|
|
101
|
+
{props.triggerLabel}
|
|
102
|
+
</RLSButton>
|
|
103
|
+
) : props.trigger ? (
|
|
104
|
+
<span onClick={openDialog}>{props.trigger}</span>
|
|
105
|
+
) : null}
|
|
106
|
+
|
|
107
|
+
<dialog
|
|
108
|
+
ref={(el) => (dialogRef = el)}
|
|
109
|
+
class={resolvedClasses().content}
|
|
110
|
+
data-slot="content"
|
|
111
|
+
aria-modal="true"
|
|
112
|
+
data-lock-scroll="true"
|
|
113
|
+
data-state={isOpen() ? "open" : "closed"}
|
|
114
|
+
onCancel={(e) => {
|
|
115
|
+
e.preventDefault()
|
|
116
|
+
handleCancel()
|
|
117
|
+
}}
|
|
118
|
+
onClick={(e) => {
|
|
119
|
+
if (e.target === dialogRef) handleCancel()
|
|
120
|
+
}}
|
|
121
|
+
{...rest}
|
|
122
|
+
>
|
|
123
|
+
<div class={resolvedClasses().header} data-slot="header">
|
|
124
|
+
{props.title ? (
|
|
125
|
+
<h3 class={resolvedClasses().title} data-slot="title">
|
|
126
|
+
{props.title}
|
|
127
|
+
</h3>
|
|
128
|
+
) : null}
|
|
129
|
+
{props.titleSlot}
|
|
130
|
+
{props.description ? (
|
|
131
|
+
<p class={resolvedClasses().description} data-slot="description">
|
|
132
|
+
{props.description}
|
|
133
|
+
</p>
|
|
134
|
+
) : null}
|
|
135
|
+
{props.descriptionSlot}
|
|
136
|
+
</div>
|
|
137
|
+
|
|
138
|
+
{props.children}
|
|
139
|
+
|
|
140
|
+
<div class={resolvedClasses().footer} data-slot="footer">
|
|
141
|
+
{props.footer !== undefined || props.footerSlot !== undefined ? (
|
|
142
|
+
(props.footer ?? props.footerSlot)
|
|
143
|
+
) : (
|
|
144
|
+
<>
|
|
145
|
+
<RLSButton
|
|
146
|
+
class={resolvedClasses().cancelButton}
|
|
147
|
+
data-slot="cancel"
|
|
148
|
+
variant="outline"
|
|
149
|
+
color={isDestructive() ? "error" : "neutral"}
|
|
150
|
+
type="button"
|
|
151
|
+
onClick={handleCancel}
|
|
152
|
+
>
|
|
153
|
+
{props.cancelLabel ?? "Cancel"}
|
|
154
|
+
</RLSButton>
|
|
155
|
+
<RLSButton
|
|
156
|
+
class={resolvedClasses().actionButton}
|
|
157
|
+
data-slot="action"
|
|
158
|
+
color={isDestructive() ? "error" : "primary"}
|
|
159
|
+
variant={isDestructive() ? "subtle" : "solid"}
|
|
160
|
+
type="button"
|
|
161
|
+
onClick={handleAction}
|
|
162
|
+
>
|
|
163
|
+
{props.actionLabel ?? "Confirm"}
|
|
164
|
+
</RLSButton>
|
|
165
|
+
</>
|
|
166
|
+
)}
|
|
167
|
+
</div>
|
|
168
|
+
</dialog>
|
|
169
|
+
</div>
|
|
170
|
+
)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export default RLSConfirm
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createMemo, splitProps, type Component, type JSX } from "solid-js"
|
|
2
|
+
import { Dynamic } from "solid-js/web"
|
|
3
|
+
import type { ContainerProps } from "./container"
|
|
4
|
+
import { containerTheme } from "./container.theme"
|
|
5
|
+
|
|
6
|
+
export interface RLSContainerProps extends ContainerProps {
|
|
7
|
+
children?: JSX.Element
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const RLSContainer: Component<RLSContainerProps> = (allProps) => {
|
|
11
|
+
const [props, rest] = splitProps(allProps, ["as", "ui", "class", "children"])
|
|
12
|
+
|
|
13
|
+
const tag = () => props.as ?? "div"
|
|
14
|
+
|
|
15
|
+
const resolvedClasses = createMemo(() => containerTheme({ ui: props.ui, class: props.class }))
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Dynamic component={tag()} class={resolvedClasses().root} data-slot="root" {...rest}>
|
|
19
|
+
{props.children}
|
|
20
|
+
</Dynamic>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default RLSContainer
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createMemo, splitProps, type Component, type JSX } from "solid-js"
|
|
2
|
+
import type { ContextMenuProps } from "./context-menu"
|
|
3
|
+
import { contextMenuTheme } from "./context-menu.theme"
|
|
4
|
+
|
|
5
|
+
export interface RLSContextMenuProps extends ContextMenuProps {
|
|
6
|
+
children?: JSX.Element
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const RLSContextMenu: Component<RLSContextMenuProps> = (allProps) => {
|
|
10
|
+
const [props, rest] = splitProps(allProps, ["ui", "class", "children"])
|
|
11
|
+
|
|
12
|
+
const resolvedClasses = createMemo(() =>
|
|
13
|
+
contextMenuTheme({
|
|
14
|
+
ui: props.ui,
|
|
15
|
+
class: props.class
|
|
16
|
+
})
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div class={resolvedClasses().root} data-slot="root" {...rest}>
|
|
21
|
+
{props.children}
|
|
22
|
+
</div>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default RLSContextMenu
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { createSignal, onCleanup, splitProps, type Component } from "solid-js"
|
|
2
|
+
import type { ButtonProps } from "../button/button"
|
|
3
|
+
import RLSButton from "../button/RLSButton"
|
|
4
|
+
|
|
5
|
+
export interface RLSCopyMarkdownProps extends Omit<
|
|
6
|
+
ButtonProps,
|
|
7
|
+
| "href"
|
|
8
|
+
| "label"
|
|
9
|
+
| "leadingIcon"
|
|
10
|
+
| "trailingIcon"
|
|
11
|
+
| "loading"
|
|
12
|
+
| "loadingAuto"
|
|
13
|
+
| "square"
|
|
14
|
+
| "active"
|
|
15
|
+
| "activeColor"
|
|
16
|
+
| "activeVariant"
|
|
17
|
+
> {
|
|
18
|
+
raw: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const RLSCopyMarkdown: Component<RLSCopyMarkdownProps> = (allProps) => {
|
|
22
|
+
const [props, rest] = splitProps(allProps, ["raw", "class", "ui"])
|
|
23
|
+
const [copied, setCopied] = createSignal(false)
|
|
24
|
+
let timeoutId: ReturnType<typeof setTimeout> | undefined
|
|
25
|
+
|
|
26
|
+
onCleanup(() => {
|
|
27
|
+
if (timeoutId !== undefined) clearTimeout(timeoutId)
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
const handleCopy = async () => {
|
|
31
|
+
try {
|
|
32
|
+
await navigator.clipboard.writeText(props.raw)
|
|
33
|
+
setCopied(true)
|
|
34
|
+
if (timeoutId !== undefined) clearTimeout(timeoutId)
|
|
35
|
+
timeoutId = setTimeout(() => setCopied(false), 2000)
|
|
36
|
+
} catch (err) {
|
|
37
|
+
console.error("Failed to copy:", err)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<RLSButton
|
|
43
|
+
class={`rl-copy-markdown ${typeof props.class === "string" ? props.class : ""}`.trim()}
|
|
44
|
+
color="neutral"
|
|
45
|
+
variant="outline"
|
|
46
|
+
size="sm"
|
|
47
|
+
leadingIcon="copy"
|
|
48
|
+
label={copied() ? "Copied!" : "Copy Markdown"}
|
|
49
|
+
data-raw={props.raw}
|
|
50
|
+
ui={props.ui}
|
|
51
|
+
onClick={handleCopy}
|
|
52
|
+
{...rest}
|
|
53
|
+
/>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export default RLSCopyMarkdown
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createMemo, splitProps, type Component, type JSX } from "solid-js"
|
|
2
|
+
import { Dynamic } from "solid-js/web"
|
|
3
|
+
import type { DashboardGroupProps } from "./dashboard-group"
|
|
4
|
+
import { dashboardGroupTheme } from "./dashboard-group.theme"
|
|
5
|
+
|
|
6
|
+
export interface RLSDashboardGroupProps extends DashboardGroupProps {
|
|
7
|
+
children?: JSX.Element
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const RLSDashboardGroup: Component<RLSDashboardGroupProps> = (allProps) => {
|
|
11
|
+
const [props, rest] = splitProps(allProps, ["as", "ui", "class", "children"])
|
|
12
|
+
|
|
13
|
+
const Tag = () => props.as || "div"
|
|
14
|
+
|
|
15
|
+
const resolvedClasses = createMemo(() =>
|
|
16
|
+
dashboardGroupTheme({
|
|
17
|
+
ui: props.ui,
|
|
18
|
+
class: props.class
|
|
19
|
+
})
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Dynamic component={Tag()} class={resolvedClasses().root} data-slot="root" {...rest}>
|
|
24
|
+
{props.children}
|
|
25
|
+
</Dynamic>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default RLSDashboardGroup
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { createMemo, Show, splitProps, type Component, type JSX } from "solid-js"
|
|
2
|
+
import { Dynamic } from "solid-js/web"
|
|
3
|
+
import type { DashboardNavbarProps } from "./dashboard-navbar"
|
|
4
|
+
import { dashboardNavbarTheme } from "./dashboard-navbar.theme"
|
|
5
|
+
import RLSIcon from "../icon/RLSIcon"
|
|
6
|
+
|
|
7
|
+
export interface RLSDashboardNavbarProps extends DashboardNavbarProps {
|
|
8
|
+
children?: JSX.Element
|
|
9
|
+
leftSlot?: JSX.Element
|
|
10
|
+
rightSlot?: JSX.Element
|
|
11
|
+
centerSlot?: JSX.Element
|
|
12
|
+
titleSlot?: JSX.Element
|
|
13
|
+
leadingSlot?: JSX.Element
|
|
14
|
+
trailingSlot?: JSX.Element
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const RLSDashboardNavbar: Component<RLSDashboardNavbarProps> = (allProps) => {
|
|
18
|
+
const [props, rest] = splitProps(allProps, [
|
|
19
|
+
"as",
|
|
20
|
+
"icon",
|
|
21
|
+
"title",
|
|
22
|
+
"toggle",
|
|
23
|
+
"toggleSide",
|
|
24
|
+
"ui",
|
|
25
|
+
"class",
|
|
26
|
+
"children",
|
|
27
|
+
"leftSlot",
|
|
28
|
+
"rightSlot",
|
|
29
|
+
"centerSlot",
|
|
30
|
+
"titleSlot",
|
|
31
|
+
"leadingSlot",
|
|
32
|
+
"trailingSlot"
|
|
33
|
+
])
|
|
34
|
+
|
|
35
|
+
const Tag = () => props.as || "header"
|
|
36
|
+
const showToggle = () => props.toggle ?? true
|
|
37
|
+
const toggleSide = () => props.toggleSide ?? "left"
|
|
38
|
+
|
|
39
|
+
const resolvedClasses = createMemo(() =>
|
|
40
|
+
dashboardNavbarTheme({
|
|
41
|
+
toggleSide: toggleSide(),
|
|
42
|
+
ui: props.ui,
|
|
43
|
+
class: props.class
|
|
44
|
+
})
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Dynamic
|
|
49
|
+
component={Tag()}
|
|
50
|
+
class={resolvedClasses().root}
|
|
51
|
+
data-slot="root"
|
|
52
|
+
style={{
|
|
53
|
+
"height": "4rem",
|
|
54
|
+
"min-height": "4rem",
|
|
55
|
+
"padding": "1rem 1.5rem",
|
|
56
|
+
"display": "flex",
|
|
57
|
+
"align-items": "center",
|
|
58
|
+
"justify-content": "space-between",
|
|
59
|
+
"box-sizing": "border-box"
|
|
60
|
+
}}
|
|
61
|
+
{...rest}
|
|
62
|
+
>
|
|
63
|
+
<div data-slot="left" class={resolvedClasses().left}>
|
|
64
|
+
<Show when={showToggle() && toggleSide() === "left"}>
|
|
65
|
+
<button
|
|
66
|
+
type="button"
|
|
67
|
+
data-dashboard-toggle="mobile"
|
|
68
|
+
class={`${resolvedClasses().toggle} lg:hidden`}
|
|
69
|
+
data-slot="toggle"
|
|
70
|
+
aria-label="Toggle sidebar"
|
|
71
|
+
>
|
|
72
|
+
<RLSIcon name="menu" class="size-5" />
|
|
73
|
+
</button>
|
|
74
|
+
</Show>
|
|
75
|
+
|
|
76
|
+
<Show when={props.leftSlot === undefined} fallback={props.leftSlot}>
|
|
77
|
+
{props.leadingSlot !== undefined ? (
|
|
78
|
+
props.leadingSlot
|
|
79
|
+
) : props.icon ? (
|
|
80
|
+
<RLSIcon name={props.icon} class={resolvedClasses().icon} data-slot="icon" />
|
|
81
|
+
) : null}
|
|
82
|
+
|
|
83
|
+
<h1 data-slot="title" class={resolvedClasses().title}>
|
|
84
|
+
{props.titleSlot !== undefined ? props.titleSlot : props.title}
|
|
85
|
+
</h1>
|
|
86
|
+
|
|
87
|
+
{props.trailingSlot}
|
|
88
|
+
</Show>
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
<Show when={props.children !== undefined || props.centerSlot !== undefined}>
|
|
92
|
+
<div data-slot="center" class={resolvedClasses().center}>
|
|
93
|
+
{props.centerSlot !== undefined ? props.centerSlot : props.children}
|
|
94
|
+
</div>
|
|
95
|
+
</Show>
|
|
96
|
+
|
|
97
|
+
<div data-slot="right" class={resolvedClasses().right}>
|
|
98
|
+
{props.rightSlot}
|
|
99
|
+
|
|
100
|
+
<Show when={showToggle() && toggleSide() === "right"}>
|
|
101
|
+
<button
|
|
102
|
+
type="button"
|
|
103
|
+
data-dashboard-toggle="mobile"
|
|
104
|
+
class={`${resolvedClasses().toggle} lg:hidden`}
|
|
105
|
+
data-slot="toggle"
|
|
106
|
+
aria-label="Toggle sidebar"
|
|
107
|
+
>
|
|
108
|
+
<RLSIcon name="menu" class="size-5" />
|
|
109
|
+
</button>
|
|
110
|
+
</Show>
|
|
111
|
+
</div>
|
|
112
|
+
</Dynamic>
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export default RLSDashboardNavbar
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { createMemo, Show, splitProps, type Component, type JSX } from "solid-js"
|
|
2
|
+
import type { DashboardPanelProps } from "./dashboard-panel"
|
|
3
|
+
import { dashboardPanelTheme } from "./dashboard-panel.theme"
|
|
4
|
+
|
|
5
|
+
export interface RLSDashboardPanelProps extends DashboardPanelProps {
|
|
6
|
+
children?: JSX.Element
|
|
7
|
+
header?: JSX.Element
|
|
8
|
+
headerSlot?: JSX.Element
|
|
9
|
+
body?: JSX.Element
|
|
10
|
+
bodySlot?: JSX.Element
|
|
11
|
+
footer?: JSX.Element
|
|
12
|
+
footerSlot?: JSX.Element
|
|
13
|
+
resizeHandle?: JSX.Element
|
|
14
|
+
resizeHandleSlot?: JSX.Element
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const RLSDashboardPanel: Component<RLSDashboardPanelProps> = (allProps) => {
|
|
18
|
+
const [props, rest] = splitProps(allProps, [
|
|
19
|
+
"resizable",
|
|
20
|
+
"ui",
|
|
21
|
+
"class",
|
|
22
|
+
"children",
|
|
23
|
+
"header",
|
|
24
|
+
"headerSlot",
|
|
25
|
+
"body",
|
|
26
|
+
"bodySlot",
|
|
27
|
+
"footer",
|
|
28
|
+
"footerSlot",
|
|
29
|
+
"resizeHandle",
|
|
30
|
+
"resizeHandleSlot"
|
|
31
|
+
])
|
|
32
|
+
|
|
33
|
+
const resizable = () => props.resizable ?? false
|
|
34
|
+
|
|
35
|
+
const resolvedClasses = createMemo(() =>
|
|
36
|
+
dashboardPanelTheme({
|
|
37
|
+
size: false,
|
|
38
|
+
ui: props.ui,
|
|
39
|
+
class: props.class
|
|
40
|
+
})
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
const headerContent = () => props.header ?? props.headerSlot
|
|
44
|
+
const bodyContent = () =>
|
|
45
|
+
props.body !== undefined
|
|
46
|
+
? props.body
|
|
47
|
+
: props.bodySlot !== undefined
|
|
48
|
+
? props.bodySlot
|
|
49
|
+
: props.children
|
|
50
|
+
const footerContent = () => props.footer ?? props.footerSlot
|
|
51
|
+
const resizeHandleContent = () => props.resizeHandle ?? props.resizeHandleSlot
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<>
|
|
55
|
+
<div
|
|
56
|
+
class={resolvedClasses().root}
|
|
57
|
+
data-slot="root"
|
|
58
|
+
style={{ "flex": "1 1 0%", "min-width": "0" }}
|
|
59
|
+
{...rest}
|
|
60
|
+
>
|
|
61
|
+
{headerContent()}
|
|
62
|
+
|
|
63
|
+
<div data-slot="body" class={resolvedClasses().body}>
|
|
64
|
+
{bodyContent()}
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
{footerContent()}
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
<Show when={resizable()}>
|
|
71
|
+
{resizeHandleContent() !== undefined ? (
|
|
72
|
+
resizeHandleContent()
|
|
73
|
+
) : (
|
|
74
|
+
<div
|
|
75
|
+
data-slot="handle"
|
|
76
|
+
class={`${resolvedClasses().handle} hidden lg:block touch-none select-none cursor-ew-resize relative before:absolute before:inset-y-0 before:-left-1.5 before:-right-1.5 before:z-1`}
|
|
77
|
+
/>
|
|
78
|
+
)}
|
|
79
|
+
</Show>
|
|
80
|
+
</>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export default RLSDashboardPanel
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createMemo, splitProps, type Component, type JSX } from "solid-js"
|
|
2
|
+
import { Dynamic } from "solid-js/web"
|
|
3
|
+
import type { DashboardResizeHandleProps } from "./dashboard-resize-handle"
|
|
4
|
+
import { dashboardResizeHandleTheme } from "./dashboard-resize-handle.theme"
|
|
5
|
+
|
|
6
|
+
export interface RLSDashboardResizeHandleProps extends DashboardResizeHandleProps {
|
|
7
|
+
children?: JSX.Element
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const RLSDashboardResizeHandle: Component<RLSDashboardResizeHandleProps> = (allProps) => {
|
|
11
|
+
const [props, rest] = splitProps(allProps, ["as", "ui", "class", "children"])
|
|
12
|
+
|
|
13
|
+
const Tag = () => props.as || "div"
|
|
14
|
+
|
|
15
|
+
const resolvedClasses = createMemo(() =>
|
|
16
|
+
dashboardResizeHandleTheme({
|
|
17
|
+
ui: props.ui,
|
|
18
|
+
class: props.class
|
|
19
|
+
})
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Dynamic
|
|
24
|
+
component={Tag()}
|
|
25
|
+
data-slot="root"
|
|
26
|
+
class={resolvedClasses().root}
|
|
27
|
+
role="separator"
|
|
28
|
+
{...rest}
|
|
29
|
+
>
|
|
30
|
+
{props.children}
|
|
31
|
+
</Dynamic>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default RLSDashboardResizeHandle
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createEffect,
|
|
3
|
+
createMemo,
|
|
4
|
+
createSignal,
|
|
5
|
+
onCleanup,
|
|
6
|
+
onMount,
|
|
7
|
+
Show,
|
|
8
|
+
splitProps,
|
|
9
|
+
type Component,
|
|
10
|
+
type JSX
|
|
11
|
+
} from "solid-js"
|
|
12
|
+
import type { DashboardSearchProps } from "./dashboard-search"
|
|
13
|
+
import { dashboardSearchTheme } from "./dashboard-search.theme"
|
|
14
|
+
import RLSIcon from "../icon/RLSIcon"
|
|
15
|
+
|
|
16
|
+
export interface RLSDashboardSearchProps extends DashboardSearchProps {
|
|
17
|
+
children?: JSX.Element
|
|
18
|
+
open?: boolean
|
|
19
|
+
onOpenChange?: (open: boolean) => void
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const RLSDashboardSearch: Component<RLSDashboardSearchProps> = (allProps) => {
|
|
23
|
+
const [props, rest] = splitProps(allProps, ["ui", "class", "children", "open", "onOpenChange"])
|
|
24
|
+
|
|
25
|
+
const [isOpen, setIsOpen] = createSignal(props.open ?? false)
|
|
26
|
+
let inputRef: HTMLInputElement | null = null
|
|
27
|
+
|
|
28
|
+
createEffect(() => {
|
|
29
|
+
if (props.open !== undefined) {
|
|
30
|
+
setIsOpen(props.open)
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const setOpenState = (open: boolean) => {
|
|
35
|
+
if (props.open === undefined) {
|
|
36
|
+
setIsOpen(open)
|
|
37
|
+
}
|
|
38
|
+
props.onOpenChange?.(open)
|
|
39
|
+
if (open) {
|
|
40
|
+
setTimeout(() => inputRef?.focus(), 50)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
onMount(() => {
|
|
45
|
+
const onKeyDown = (e: KeyboardEvent) => {
|
|
46
|
+
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k") {
|
|
47
|
+
e.preventDefault()
|
|
48
|
+
setOpenState(!isOpen())
|
|
49
|
+
} else if (e.key === "Escape" && isOpen()) {
|
|
50
|
+
setOpenState(false)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const onClick = (e: MouseEvent) => {
|
|
55
|
+
const target = e.target as Element | null
|
|
56
|
+
const btn = target?.closest("[data-dashboard-search-button]")
|
|
57
|
+
if (btn) {
|
|
58
|
+
setOpenState(!isOpen())
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
document.addEventListener("keydown", onKeyDown)
|
|
63
|
+
document.addEventListener("click", onClick)
|
|
64
|
+
|
|
65
|
+
onCleanup(() => {
|
|
66
|
+
document.removeEventListener("keydown", onKeyDown)
|
|
67
|
+
document.removeEventListener("click", onClick)
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
const resolvedClasses = createMemo(() =>
|
|
72
|
+
dashboardSearchTheme({
|
|
73
|
+
ui: props.ui,
|
|
74
|
+
class: props.class,
|
|
75
|
+
fullscreen: false,
|
|
76
|
+
size: "md"
|
|
77
|
+
})
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<div data-dashboard-search-target data-slot="root" {...rest}>
|
|
82
|
+
{props.children}
|
|
83
|
+
|
|
84
|
+
<Show when={isOpen()}>
|
|
85
|
+
<div
|
|
86
|
+
data-dashboard-search
|
|
87
|
+
data-slot="modal"
|
|
88
|
+
class={`${resolvedClasses().modal} fixed inset-0 z-50 flex items-start justify-center sm:pt-16`}
|
|
89
|
+
onClick={(e) => {
|
|
90
|
+
if (e.target === e.currentTarget) setOpenState(false)
|
|
91
|
+
}}
|
|
92
|
+
>
|
|
93
|
+
<div
|
|
94
|
+
class="fixed inset-0 bg-default/80 backdrop-blur-sm"
|
|
95
|
+
onClick={() => setOpenState(false)}
|
|
96
|
+
/>
|
|
97
|
+
<div
|
|
98
|
+
class={`relative w-full bg-default border border-default sm:rounded-xl shadow-2xl overflow-hidden ${resolvedClasses().modal}`}
|
|
99
|
+
>
|
|
100
|
+
<div class="flex items-center gap-2 border-b border-default px-4">
|
|
101
|
+
<RLSIcon name="search" class="size-5 shrink-0 text-muted" />
|
|
102
|
+
<input
|
|
103
|
+
ref={(el) => (inputRef = el)}
|
|
104
|
+
type="text"
|
|
105
|
+
data-dashboard-search-input
|
|
106
|
+
placeholder="Search..."
|
|
107
|
+
class="flex-1 h-12 bg-transparent border-0 outline-none text-default placeholder:text-muted"
|
|
108
|
+
/>
|
|
109
|
+
<button
|
|
110
|
+
type="button"
|
|
111
|
+
class="shrink-0 size-8 flex items-center justify-center rounded-md hover:bg-muted text-muted"
|
|
112
|
+
onClick={() => setOpenState(false)}
|
|
113
|
+
>
|
|
114
|
+
<RLSIcon name="close" class="size-4" />
|
|
115
|
+
</button>
|
|
116
|
+
</div>
|
|
117
|
+
<div class="p-4 text-sm text-muted text-center">Type to search...</div>
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
</Show>
|
|
121
|
+
</div>
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export default RLSDashboardSearch
|