@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,82 @@
|
|
|
1
|
+
import { createMemo, For, Show, splitProps, type Component, type JSX } from "solid-js"
|
|
2
|
+
import type { DashboardSearchButtonProps } from "./dashboard-search-button"
|
|
3
|
+
import { dashboardSearchButtonTheme } from "./dashboard-search-button.theme"
|
|
4
|
+
import RLSIcon from "../icon/RLSIcon"
|
|
5
|
+
|
|
6
|
+
export interface RLSDashboardSearchButtonProps extends DashboardSearchButtonProps {
|
|
7
|
+
children?: JSX.Element
|
|
8
|
+
trailingSlot?: JSX.Element
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const RLSDashboardSearchButton: Component<RLSDashboardSearchButtonProps> = (allProps) => {
|
|
12
|
+
const [props, rest] = splitProps(allProps, [
|
|
13
|
+
"icon",
|
|
14
|
+
"label",
|
|
15
|
+
"kbds",
|
|
16
|
+
"collapsed",
|
|
17
|
+
"trailing",
|
|
18
|
+
"trailingSlot",
|
|
19
|
+
"ui",
|
|
20
|
+
"class",
|
|
21
|
+
"children"
|
|
22
|
+
])
|
|
23
|
+
|
|
24
|
+
const labelText = () => props.label ?? "Search"
|
|
25
|
+
const kbdsList = () => props.kbds ?? [{ value: "meta" }, { value: "k" }]
|
|
26
|
+
|
|
27
|
+
const resolvedClasses = createMemo(() =>
|
|
28
|
+
dashboardSearchButtonTheme({
|
|
29
|
+
collapsed: props.collapsed ?? false,
|
|
30
|
+
ui: props.ui,
|
|
31
|
+
class: props.class
|
|
32
|
+
})
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<button
|
|
37
|
+
type="button"
|
|
38
|
+
data-dashboard-search-button
|
|
39
|
+
class={resolvedClasses().base}
|
|
40
|
+
data-slot="root"
|
|
41
|
+
{...rest}
|
|
42
|
+
>
|
|
43
|
+
{props.icon !== false && (
|
|
44
|
+
<RLSIcon
|
|
45
|
+
name={typeof props.icon === "string" ? props.icon : "search"}
|
|
46
|
+
class="size-5 shrink-0 text-muted"
|
|
47
|
+
/>
|
|
48
|
+
)}
|
|
49
|
+
|
|
50
|
+
<span data-slot="label" class={resolvedClasses().label}>
|
|
51
|
+
{labelText()}
|
|
52
|
+
</span>
|
|
53
|
+
|
|
54
|
+
<span data-slot="trailing" class={resolvedClasses().trailing}>
|
|
55
|
+
{props.trailingSlot ? (
|
|
56
|
+
props.trailingSlot
|
|
57
|
+
) : props.trailing ? (
|
|
58
|
+
(props.trailing as JSX.Element)
|
|
59
|
+
) : (
|
|
60
|
+
<Show when={kbdsList().length > 0}>
|
|
61
|
+
<span class="flex items-center gap-0.5">
|
|
62
|
+
<For each={kbdsList()}>
|
|
63
|
+
{(kbd) => {
|
|
64
|
+
const val = typeof kbd === "string" ? kbd : kbd.value
|
|
65
|
+
const txt = val === "meta" ? "⌘" : val === "k" ? "K" : val
|
|
66
|
+
return (
|
|
67
|
+
<kbd class="inline-flex items-center justify-center rounded border border-default bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted min-w-[20px] h-5">
|
|
68
|
+
{txt}
|
|
69
|
+
</kbd>
|
|
70
|
+
)
|
|
71
|
+
}}
|
|
72
|
+
</For>
|
|
73
|
+
</span>
|
|
74
|
+
</Show>
|
|
75
|
+
)}
|
|
76
|
+
</span>
|
|
77
|
+
{props.children}
|
|
78
|
+
</button>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export default RLSDashboardSearchButton
|
|
@@ -62,7 +62,7 @@ const classes = dashboardSidebarTheme({
|
|
|
62
62
|
const sidebar = document.querySelector<HTMLElement>('[data-dashboard-sidebar]');
|
|
63
63
|
if (!sidebar) return;
|
|
64
64
|
|
|
65
|
-
const collapsible = sidebar.dataset
|
|
65
|
+
const collapsible = sidebar.dataset["collapsible"] === 'true';
|
|
66
66
|
const mobilePanel = document.querySelector<HTMLElement>('[data-dashboard-sidebar-mobile]');
|
|
67
67
|
const overlay = document.querySelector<HTMLElement>('[data-dashboard-sidebar-overlay]');
|
|
68
68
|
|
|
@@ -91,8 +91,8 @@ const classes = dashboardSidebarTheme({
|
|
|
91
91
|
|
|
92
92
|
const collapseSidebar = (val?: boolean) => {
|
|
93
93
|
if (!collapsible) return;
|
|
94
|
-
const isCollapsed = val !== undefined ? val : sidebar.dataset
|
|
95
|
-
sidebar.dataset
|
|
94
|
+
const isCollapsed = val !== undefined ? val : sidebar.dataset["collapsed"] !== 'true';
|
|
95
|
+
sidebar.dataset["collapsed"] = isCollapsed ? 'true' : 'false';
|
|
96
96
|
sidebar.setAttribute('data-collapsed', isCollapsed ? 'true' : 'false');
|
|
97
97
|
|
|
98
98
|
document.querySelectorAll('[data-dashboard-toggle="collapse"]').forEach(btn => {
|
|
@@ -109,7 +109,7 @@ const classes = dashboardSidebarTheme({
|
|
|
109
109
|
// Toggle buttons (mobile drawer + collapse)
|
|
110
110
|
const toggle = target.closest<HTMLElement>('[data-dashboard-toggle]');
|
|
111
111
|
if (toggle) {
|
|
112
|
-
const side = toggle.dataset
|
|
112
|
+
const side = toggle.dataset["dashboardToggle"];
|
|
113
113
|
if (side === 'mobile') toggleMobile();
|
|
114
114
|
if (side === 'collapse') collapseSidebar();
|
|
115
115
|
return;
|
|
@@ -0,0 +1,184 @@
|
|
|
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 { DashboardSidebarProps } from "./dashboard-sidebar"
|
|
13
|
+
import { dashboardSidebarTheme } from "./dashboard-sidebar.theme"
|
|
14
|
+
|
|
15
|
+
export interface RLSDashboardSidebarProps extends DashboardSidebarProps {
|
|
16
|
+
children?: JSX.Element
|
|
17
|
+
headerSlot?: JSX.Element
|
|
18
|
+
footerSlot?: JSX.Element
|
|
19
|
+
openMobile?: boolean
|
|
20
|
+
onOpenMobileChange?: (open: boolean) => void
|
|
21
|
+
onCollapseChange?: (collapsed: boolean) => void
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const RLSDashboardSidebar: Component<RLSDashboardSidebarProps> = (allProps) => {
|
|
25
|
+
const [props, rest] = splitProps(allProps, [
|
|
26
|
+
"side",
|
|
27
|
+
"collapsible",
|
|
28
|
+
"collapsed",
|
|
29
|
+
"openMobile",
|
|
30
|
+
"headerSlot",
|
|
31
|
+
"footerSlot",
|
|
32
|
+
"ui",
|
|
33
|
+
"class",
|
|
34
|
+
"children",
|
|
35
|
+
"onOpenMobileChange",
|
|
36
|
+
"onCollapseChange"
|
|
37
|
+
])
|
|
38
|
+
|
|
39
|
+
const side = () => props.side ?? "left"
|
|
40
|
+
const isCollapsible = () => props.collapsible ?? false
|
|
41
|
+
const [isCollapsed, setIsCollapsed] = createSignal(props.collapsed ?? false)
|
|
42
|
+
const [isMobileOpen, setIsMobileOpen] = createSignal(props.openMobile ?? false)
|
|
43
|
+
|
|
44
|
+
createEffect(() => {
|
|
45
|
+
if (props.collapsed !== undefined) {
|
|
46
|
+
setIsCollapsed(props.collapsed)
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
createEffect(() => {
|
|
51
|
+
if (props.openMobile !== undefined) {
|
|
52
|
+
setIsMobileOpen(props.openMobile)
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
const setCollapsedState = (collapsed: boolean) => {
|
|
57
|
+
if (props.collapsed === undefined) {
|
|
58
|
+
setIsCollapsed(collapsed)
|
|
59
|
+
}
|
|
60
|
+
props.onCollapseChange?.(collapsed)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const setMobileOpenState = (open: boolean) => {
|
|
64
|
+
if (props.openMobile === undefined) {
|
|
65
|
+
setIsMobileOpen(open)
|
|
66
|
+
}
|
|
67
|
+
props.onOpenMobileChange?.(open)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
onMount(() => {
|
|
71
|
+
const handleClick = (e: MouseEvent) => {
|
|
72
|
+
const target = e.target as Element | null
|
|
73
|
+
if (!target) return
|
|
74
|
+
|
|
75
|
+
const toggle = target.closest<HTMLElement>("[data-dashboard-toggle]")
|
|
76
|
+
if (toggle) {
|
|
77
|
+
const toggleType = toggle.dataset["dashboardToggle"]
|
|
78
|
+
if (toggleType === "mobile") {
|
|
79
|
+
setMobileOpenState(!isMobileOpen())
|
|
80
|
+
}
|
|
81
|
+
if (toggleType === "collapse" && isCollapsible()) {
|
|
82
|
+
setCollapsedState(!isCollapsed())
|
|
83
|
+
}
|
|
84
|
+
return
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (target.closest("[data-dashboard-sidebar-mobile] a")) {
|
|
88
|
+
setMobileOpenState(false)
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const handleKey = (e: KeyboardEvent) => {
|
|
93
|
+
if (e.key === "Escape" && isMobileOpen()) {
|
|
94
|
+
setMobileOpenState(false)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
document.addEventListener("click", handleClick)
|
|
99
|
+
document.addEventListener("keydown", handleKey)
|
|
100
|
+
|
|
101
|
+
onCleanup(() => {
|
|
102
|
+
document.removeEventListener("click", handleClick)
|
|
103
|
+
document.removeEventListener("keydown", handleKey)
|
|
104
|
+
})
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
const resolvedClasses = createMemo(() =>
|
|
108
|
+
dashboardSidebarTheme({
|
|
109
|
+
side: side(),
|
|
110
|
+
collapsed: isCollapsible() && isCollapsed(),
|
|
111
|
+
ui: props.ui,
|
|
112
|
+
class: props.class
|
|
113
|
+
})
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
<>
|
|
118
|
+
<div
|
|
119
|
+
data-dashboard-sidebar
|
|
120
|
+
data-side={side()}
|
|
121
|
+
data-collapsible={isCollapsible() ? "true" : "false"}
|
|
122
|
+
data-collapsed={isCollapsible() && isCollapsed() ? "true" : "false"}
|
|
123
|
+
data-slot="root"
|
|
124
|
+
class={resolvedClasses().root}
|
|
125
|
+
{...rest}
|
|
126
|
+
>
|
|
127
|
+
<Show when={props.headerSlot !== undefined}>
|
|
128
|
+
<div data-slot="header" class={resolvedClasses().header}>
|
|
129
|
+
{props.headerSlot}
|
|
130
|
+
</div>
|
|
131
|
+
</Show>
|
|
132
|
+
|
|
133
|
+
<div data-slot="body" class={resolvedClasses().body}>
|
|
134
|
+
{props.children}
|
|
135
|
+
</div>
|
|
136
|
+
|
|
137
|
+
<Show when={props.footerSlot !== undefined}>
|
|
138
|
+
<div data-slot="footer" class={resolvedClasses().footer}>
|
|
139
|
+
{props.footerSlot}
|
|
140
|
+
</div>
|
|
141
|
+
</Show>
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
<div
|
|
145
|
+
data-dashboard-sidebar-overlay
|
|
146
|
+
data-slot="overlay"
|
|
147
|
+
class={`${resolvedClasses().overlay} fixed inset-0 z-40 bg-default/80 backdrop-blur-sm transition-opacity duration-300 ${
|
|
148
|
+
isMobileOpen() ? "block" : "hidden"
|
|
149
|
+
}`}
|
|
150
|
+
onClick={() => setMobileOpenState(false)}
|
|
151
|
+
/>
|
|
152
|
+
|
|
153
|
+
<div
|
|
154
|
+
data-dashboard-sidebar-mobile
|
|
155
|
+
data-slot="content"
|
|
156
|
+
class={`${resolvedClasses().content} fixed inset-y-0 left-0 z-50 w-72 max-w-[85vw] bg-default shadow-2xl border-e border-default transform transition-transform duration-300 flex flex-col h-full ${
|
|
157
|
+
isMobileOpen() ? "translate-x-0" : "-translate-x-full"
|
|
158
|
+
}`}
|
|
159
|
+
>
|
|
160
|
+
<Show when={props.headerSlot !== undefined}>
|
|
161
|
+
<div data-slot="header" class={`${resolvedClasses().header} sm:px-6 shrink-0`} data-menu>
|
|
162
|
+
{props.headerSlot}
|
|
163
|
+
</div>
|
|
164
|
+
</Show>
|
|
165
|
+
|
|
166
|
+
<div
|
|
167
|
+
data-slot="body"
|
|
168
|
+
class={`${resolvedClasses().body} sm:px-6 overflow-y-auto flex-1`}
|
|
169
|
+
data-menu
|
|
170
|
+
>
|
|
171
|
+
{props.children}
|
|
172
|
+
</div>
|
|
173
|
+
|
|
174
|
+
<Show when={props.footerSlot !== undefined}>
|
|
175
|
+
<div data-slot="footer" class={`${resolvedClasses().footer} sm:px-6 shrink-0`} data-menu>
|
|
176
|
+
{props.footerSlot}
|
|
177
|
+
</div>
|
|
178
|
+
</Show>
|
|
179
|
+
</div>
|
|
180
|
+
</>
|
|
181
|
+
)
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export default RLSDashboardSidebar
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { createMemo, splitProps, type Component, type JSX } from "solid-js"
|
|
2
|
+
import type { DashboardSidebarCollapseProps } from "./dashboard-sidebar-collapse"
|
|
3
|
+
import { dashboardSidebarCollapseTheme } from "./dashboard-sidebar-collapse.theme"
|
|
4
|
+
import RLSIcon from "../icon/RLSIcon"
|
|
5
|
+
|
|
6
|
+
export interface RLSDashboardSidebarCollapseProps extends DashboardSidebarCollapseProps {
|
|
7
|
+
children?: JSX.Element
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const RLSDashboardSidebarCollapse: Component<RLSDashboardSidebarCollapseProps> = (allProps) => {
|
|
11
|
+
const [props, rest] = splitProps(allProps, ["icon", "ui", "class", "children"])
|
|
12
|
+
|
|
13
|
+
const resolvedClasses = createMemo(() =>
|
|
14
|
+
dashboardSidebarCollapseTheme({
|
|
15
|
+
ui: props.ui,
|
|
16
|
+
class: props.class
|
|
17
|
+
})
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<button
|
|
22
|
+
type="button"
|
|
23
|
+
data-dashboard-toggle="collapse"
|
|
24
|
+
class={resolvedClasses().root}
|
|
25
|
+
data-slot="root"
|
|
26
|
+
aria-label="Collapse sidebar"
|
|
27
|
+
{...rest}
|
|
28
|
+
>
|
|
29
|
+
<RLSIcon
|
|
30
|
+
name={props.icon || "i-lucide-panel-left"}
|
|
31
|
+
class="size-5"
|
|
32
|
+
data-dashboard-collapse-icon
|
|
33
|
+
data-expanded
|
|
34
|
+
/>
|
|
35
|
+
<RLSIcon
|
|
36
|
+
name="i-lucide-panel-right"
|
|
37
|
+
class="size-5 hidden"
|
|
38
|
+
data-dashboard-collapse-icon
|
|
39
|
+
data-collapsed
|
|
40
|
+
/>
|
|
41
|
+
{props.children}
|
|
42
|
+
</button>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default RLSDashboardSidebarCollapse
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createMemo, splitProps, type Component, type JSX } from "solid-js"
|
|
2
|
+
import type { DashboardSidebarToggleProps } from "./dashboard-sidebar-toggle"
|
|
3
|
+
import { dashboardSidebarToggleTheme } from "./dashboard-sidebar-toggle.theme"
|
|
4
|
+
import RLSIcon from "../icon/RLSIcon"
|
|
5
|
+
|
|
6
|
+
export interface RLSDashboardSidebarToggleProps extends DashboardSidebarToggleProps {
|
|
7
|
+
children?: JSX.Element
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const RLSDashboardSidebarToggle: Component<RLSDashboardSidebarToggleProps> = (allProps) => {
|
|
11
|
+
const [props, rest] = splitProps(allProps, ["icon", "ui", "class", "children"])
|
|
12
|
+
|
|
13
|
+
const resolvedClasses = createMemo(() =>
|
|
14
|
+
dashboardSidebarToggleTheme({
|
|
15
|
+
ui: props.ui,
|
|
16
|
+
class: props.class
|
|
17
|
+
})
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<button
|
|
22
|
+
type="button"
|
|
23
|
+
data-dashboard-toggle="mobile"
|
|
24
|
+
class={resolvedClasses().root}
|
|
25
|
+
data-slot="root"
|
|
26
|
+
aria-label="Toggle sidebar"
|
|
27
|
+
{...rest}
|
|
28
|
+
>
|
|
29
|
+
<RLSIcon name={props.icon || "menu"} class="size-5" />
|
|
30
|
+
{props.children}
|
|
31
|
+
</button>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default RLSDashboardSidebarToggle
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { createMemo, splitProps, type Component, type JSX } from "solid-js"
|
|
2
|
+
import { Dynamic } from "solid-js/web"
|
|
3
|
+
import type { DashboardToolbarProps } from "./dashboard-toolbar"
|
|
4
|
+
import { dashboardToolbarTheme } from "./dashboard-toolbar.theme"
|
|
5
|
+
|
|
6
|
+
export interface RLSDashboardToolbarProps extends DashboardToolbarProps {
|
|
7
|
+
children?: JSX.Element
|
|
8
|
+
leftSlot?: JSX.Element
|
|
9
|
+
rightSlot?: JSX.Element
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const RLSDashboardToolbar: Component<RLSDashboardToolbarProps> = (allProps) => {
|
|
13
|
+
const [props, rest] = splitProps(allProps, [
|
|
14
|
+
"as",
|
|
15
|
+
"ui",
|
|
16
|
+
"class",
|
|
17
|
+
"children",
|
|
18
|
+
"leftSlot",
|
|
19
|
+
"rightSlot"
|
|
20
|
+
])
|
|
21
|
+
|
|
22
|
+
const Tag = () => props.as || "div"
|
|
23
|
+
|
|
24
|
+
const resolvedClasses = createMemo(() =>
|
|
25
|
+
dashboardToolbarTheme({
|
|
26
|
+
ui: props.ui,
|
|
27
|
+
class: props.class
|
|
28
|
+
})
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<Dynamic component={Tag()} class={resolvedClasses().root} data-slot="root" {...rest}>
|
|
33
|
+
{props.children !== undefined ? (
|
|
34
|
+
props.children
|
|
35
|
+
) : (
|
|
36
|
+
<>
|
|
37
|
+
<div data-slot="left" class={resolvedClasses().left}>
|
|
38
|
+
{props.leftSlot}
|
|
39
|
+
</div>
|
|
40
|
+
<div data-slot="right" class={resolvedClasses().right}>
|
|
41
|
+
{props.rightSlot}
|
|
42
|
+
</div>
|
|
43
|
+
</>
|
|
44
|
+
)}
|
|
45
|
+
</Dynamic>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export default RLSDashboardToolbar
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { splitProps, type Component } from "solid-js"
|
|
2
|
+
|
|
3
|
+
export interface RLSDateProps {
|
|
4
|
+
date: Date | string | number
|
|
5
|
+
locale?: string
|
|
6
|
+
options?: Intl.DateTimeFormatOptions
|
|
7
|
+
class?: string
|
|
8
|
+
[key: string]: unknown
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const defaultOptions: Intl.DateTimeFormatOptions = {
|
|
12
|
+
year: "numeric",
|
|
13
|
+
month: "short",
|
|
14
|
+
day: "numeric"
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const RLSDate: Component<RLSDateProps> = (allProps) => {
|
|
18
|
+
const [props, rest] = splitProps(allProps, ["date", "locale", "options"])
|
|
19
|
+
|
|
20
|
+
const resolvedDate = props.date instanceof Date ? props.date : new Date(props.date)
|
|
21
|
+
const valid = !isNaN(resolvedDate.getTime())
|
|
22
|
+
const formatted = valid
|
|
23
|
+
? resolvedDate.toLocaleDateString(props.locale ?? "en-US", props.options ?? defaultOptions)
|
|
24
|
+
: ""
|
|
25
|
+
const datetime = valid ? resolvedDate.toISOString() : ""
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<time datetime={datetime} {...rest}>
|
|
29
|
+
{formatted}
|
|
30
|
+
</time>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export default RLSDate
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createMemo, splitProps, type Component, type JSX } from "solid-js"
|
|
2
|
+
import type { DockProps } from "./dock"
|
|
3
|
+
import { dockTheme } from "./dock.theme"
|
|
4
|
+
|
|
5
|
+
export interface RLSDockProps extends DockProps {
|
|
6
|
+
children?: JSX.Element
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const RLSDock: Component<RLSDockProps> = (allProps) => {
|
|
10
|
+
const [props, rest] = splitProps(allProps, ["ui", "class", "children"])
|
|
11
|
+
|
|
12
|
+
const resolvedClasses = createMemo(() =>
|
|
13
|
+
dockTheme({
|
|
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 RLSDock
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createEffect,
|
|
3
|
+
createMemo,
|
|
4
|
+
createSignal,
|
|
5
|
+
splitProps,
|
|
6
|
+
Show,
|
|
7
|
+
onMount,
|
|
8
|
+
onCleanup,
|
|
9
|
+
type Component,
|
|
10
|
+
type JSX
|
|
11
|
+
} from "solid-js"
|
|
12
|
+
import type { DrawerProps } from "./drawer"
|
|
13
|
+
import { drawerTheme } from "./drawer.theme"
|
|
14
|
+
import RLSIcon from "../icon/RLSIcon"
|
|
15
|
+
|
|
16
|
+
export interface RLSDrawerProps extends DrawerProps {
|
|
17
|
+
children?: JSX.Element
|
|
18
|
+
trigger?: JSX.Element
|
|
19
|
+
triggerSlot?: JSX.Element
|
|
20
|
+
titleSlot?: JSX.Element
|
|
21
|
+
descriptionSlot?: JSX.Element
|
|
22
|
+
footer?: JSX.Element
|
|
23
|
+
footerSlot?: JSX.Element
|
|
24
|
+
defaultOpen?: boolean
|
|
25
|
+
onOpenChange?: (open: boolean) => void
|
|
26
|
+
closeOnClickOutside?: boolean
|
|
27
|
+
closeOnEscape?: boolean
|
|
28
|
+
lockScroll?: boolean
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const RLSDrawer: Component<RLSDrawerProps> = (allProps) => {
|
|
32
|
+
const [props, rest] = splitProps(allProps, [
|
|
33
|
+
"open",
|
|
34
|
+
"defaultOpen",
|
|
35
|
+
"direction",
|
|
36
|
+
"title",
|
|
37
|
+
"description",
|
|
38
|
+
"triggerLabel",
|
|
39
|
+
"ui",
|
|
40
|
+
"class",
|
|
41
|
+
"children",
|
|
42
|
+
"trigger",
|
|
43
|
+
"triggerSlot",
|
|
44
|
+
"titleSlot",
|
|
45
|
+
"descriptionSlot",
|
|
46
|
+
"footer",
|
|
47
|
+
"footerSlot",
|
|
48
|
+
"onOpenChange",
|
|
49
|
+
"closeOnClickOutside",
|
|
50
|
+
"closeOnEscape",
|
|
51
|
+
"lockScroll"
|
|
52
|
+
])
|
|
53
|
+
|
|
54
|
+
const [isOpen, setIsOpen] = createSignal(props.open ?? props.defaultOpen ?? false)
|
|
55
|
+
|
|
56
|
+
const closeOnClickOutside = () => props.closeOnClickOutside !== false
|
|
57
|
+
const closeOnEscape = () => props.closeOnEscape !== false
|
|
58
|
+
const lockScroll = () => props.lockScroll !== false
|
|
59
|
+
|
|
60
|
+
const handleOpenChange = (next: boolean) => {
|
|
61
|
+
setIsOpen(next)
|
|
62
|
+
props.onOpenChange?.(next)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
let dialogRef: HTMLDialogElement | undefined
|
|
66
|
+
|
|
67
|
+
createEffect(() => {
|
|
68
|
+
if (isOpen()) {
|
|
69
|
+
if (lockScroll()) {
|
|
70
|
+
document.body.style.overflow = "hidden"
|
|
71
|
+
}
|
|
72
|
+
if (dialogRef && !dialogRef.open) dialogRef.showModal()
|
|
73
|
+
} else {
|
|
74
|
+
document.body.style.overflow = ""
|
|
75
|
+
if (dialogRef && dialogRef.open) dialogRef.close()
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
onMount(() => {
|
|
80
|
+
const handleCancel = (e: Event) => {
|
|
81
|
+
if (e.target !== dialogRef) return
|
|
82
|
+
e.preventDefault()
|
|
83
|
+
if (closeOnEscape()) handleOpenChange(false)
|
|
84
|
+
}
|
|
85
|
+
const handleClick = (e: MouseEvent) => {
|
|
86
|
+
if (closeOnClickOutside() && e.target === dialogRef) {
|
|
87
|
+
handleOpenChange(false)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
document.addEventListener("cancel", handleCancel)
|
|
91
|
+
document.addEventListener("click", handleClick)
|
|
92
|
+
onCleanup(() => {
|
|
93
|
+
document.removeEventListener("cancel", handleCancel)
|
|
94
|
+
document.removeEventListener("click", handleClick)
|
|
95
|
+
document.body.style.overflow = ""
|
|
96
|
+
})
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
const resolvedClasses = createMemo(() =>
|
|
100
|
+
drawerTheme({
|
|
101
|
+
direction: props.direction ?? "bottom",
|
|
102
|
+
ui: props.ui,
|
|
103
|
+
class: props.class
|
|
104
|
+
})
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
const triggerContent = () => props.trigger ?? props.triggerSlot
|
|
108
|
+
const footerContent = () => props.footer ?? props.footerSlot
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<div class={resolvedClasses().root} data-slot="drawer-container">
|
|
112
|
+
{props.triggerLabel ? (
|
|
113
|
+
<button
|
|
114
|
+
class={resolvedClasses().trigger}
|
|
115
|
+
data-slot="trigger"
|
|
116
|
+
type="button"
|
|
117
|
+
onClick={() => handleOpenChange(true)}
|
|
118
|
+
>
|
|
119
|
+
{props.triggerLabel}
|
|
120
|
+
</button>
|
|
121
|
+
) : triggerContent() ? (
|
|
122
|
+
<span onClick={() => handleOpenChange(true)}>{triggerContent()}</span>
|
|
123
|
+
) : null}
|
|
124
|
+
|
|
125
|
+
<Show when={isOpen()}>
|
|
126
|
+
<dialog
|
|
127
|
+
ref={(el) => (dialogRef = el)}
|
|
128
|
+
class={`${resolvedClasses().content} ${isOpen() ? "" : "hidden"}`}
|
|
129
|
+
data-slot="content"
|
|
130
|
+
aria-modal="true"
|
|
131
|
+
data-state={isOpen() ? "open" : "closed"}
|
|
132
|
+
{...rest}
|
|
133
|
+
>
|
|
134
|
+
<div class={resolvedClasses().handle} data-slot="handle" />
|
|
135
|
+
|
|
136
|
+
<button
|
|
137
|
+
class={resolvedClasses().closeButton}
|
|
138
|
+
data-slot="close-button"
|
|
139
|
+
type="button"
|
|
140
|
+
aria-label="Close drawer"
|
|
141
|
+
onClick={() => handleOpenChange(false)}
|
|
142
|
+
>
|
|
143
|
+
<RLSIcon name="close" size="sm" aria-hidden="true" />
|
|
144
|
+
</button>
|
|
145
|
+
|
|
146
|
+
<div class={resolvedClasses().header} data-slot="header">
|
|
147
|
+
{props.titleSlot ? (
|
|
148
|
+
props.titleSlot
|
|
149
|
+
) : props.title ? (
|
|
150
|
+
<h3 class={resolvedClasses().title} data-slot="title">
|
|
151
|
+
{props.title}
|
|
152
|
+
</h3>
|
|
153
|
+
) : null}
|
|
154
|
+
|
|
155
|
+
{props.descriptionSlot ? (
|
|
156
|
+
props.descriptionSlot
|
|
157
|
+
) : props.description ? (
|
|
158
|
+
<p class={resolvedClasses().description} data-slot="description">
|
|
159
|
+
{props.description}
|
|
160
|
+
</p>
|
|
161
|
+
) : null}
|
|
162
|
+
</div>
|
|
163
|
+
|
|
164
|
+
{props.children}
|
|
165
|
+
|
|
166
|
+
{footerContent() ? (
|
|
167
|
+
<div class={resolvedClasses().footer} data-slot="footer">
|
|
168
|
+
{footerContent()}
|
|
169
|
+
</div>
|
|
170
|
+
) : null}
|
|
171
|
+
</dialog>
|
|
172
|
+
</Show>
|
|
173
|
+
</div>
|
|
174
|
+
)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export default RLSDrawer
|