@rimelight/ui 0.0.47 → 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/index.d.mts +4 -5
- package/dist/preset.mjs +73 -1
- package/dist/resolver.d.mts +3 -4
- package/dist/resolver.mjs +2 -4
- package/dist/shortcuts.d.mts +10 -11
- package/dist/stores.d.mts +3 -4
- 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/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 +49 -40
- 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/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/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/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/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/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/RLSLayoutGrid.tsx +402 -0
- package/src/components/layout-grid/layout-grid.ts +25 -1
- package/src/components/link/RLSLink.tsx +2 -1
- 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 +2 -1
- package/src/components/locale-selector/RLSLocaleSelector.tsx +178 -0
- package/src/components/logo/RLALogo.astro +69 -4
- 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/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/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/RLSScrollArea.tsx +210 -0
- package/src/components/scroll-to-top/RLAScrollToTop.astro +1 -0
- package/src/components/scroll-to-top/RLSScrollToTop.tsx +145 -0
- 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/RLSShortcuts.tsx +393 -0
- 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/RLSSplitter.tsx +178 -0
- package/src/components/spoiler/RLSSpoiler.tsx +26 -0
- 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/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/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
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { createMemo, splitProps, type Component, type JSX } from "solid-js"
|
|
2
|
+
import type { PostProps } from "./post"
|
|
3
|
+
import { postTheme } from "./post.theme"
|
|
4
|
+
import RLSBadge from "../badge/RLSBadge"
|
|
5
|
+
|
|
6
|
+
export interface RLSPostProps extends PostProps {
|
|
7
|
+
children?: JSX.Element
|
|
8
|
+
imageSlot?: JSX.Element
|
|
9
|
+
titleSlot?: JSX.Element
|
|
10
|
+
descriptionSlot?: JSX.Element
|
|
11
|
+
badgeSlot?: JSX.Element
|
|
12
|
+
dateSlot?: JSX.Element
|
|
13
|
+
footerSlot?: JSX.Element
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const RLSPost: Component<RLSPostProps> = (allProps) => {
|
|
17
|
+
const [props, rest] = splitProps(allProps, [
|
|
18
|
+
"title",
|
|
19
|
+
"description",
|
|
20
|
+
"date",
|
|
21
|
+
"image",
|
|
22
|
+
"to",
|
|
23
|
+
"badge",
|
|
24
|
+
"badgeColor",
|
|
25
|
+
"variant",
|
|
26
|
+
"orientation",
|
|
27
|
+
"ui",
|
|
28
|
+
"class",
|
|
29
|
+
"children",
|
|
30
|
+
"imageSlot",
|
|
31
|
+
"titleSlot",
|
|
32
|
+
"descriptionSlot",
|
|
33
|
+
"badgeSlot",
|
|
34
|
+
"dateSlot",
|
|
35
|
+
"footerSlot"
|
|
36
|
+
])
|
|
37
|
+
|
|
38
|
+
const classes = createMemo(() =>
|
|
39
|
+
postTheme({
|
|
40
|
+
variant: props.variant ?? "soft",
|
|
41
|
+
orientation: props.orientation ?? "vertical",
|
|
42
|
+
ui: props.ui,
|
|
43
|
+
class: props.class
|
|
44
|
+
})
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
const formattedDate = props.date
|
|
48
|
+
? props.date instanceof Date
|
|
49
|
+
? props.date.toLocaleDateString()
|
|
50
|
+
: props.date
|
|
51
|
+
: null
|
|
52
|
+
|
|
53
|
+
const imageSrc = () =>
|
|
54
|
+
typeof props.image === "string"
|
|
55
|
+
? props.image
|
|
56
|
+
: (props.image as { src?: string } | undefined)?.src
|
|
57
|
+
|
|
58
|
+
const body = () => (
|
|
59
|
+
<>
|
|
60
|
+
{props.imageSlot !== undefined ? (
|
|
61
|
+
props.imageSlot
|
|
62
|
+
) : props.image ? (
|
|
63
|
+
<div class={classes()["imageWrapper"]} data-slot="image-wrapper">
|
|
64
|
+
<img
|
|
65
|
+
src={imageSrc()}
|
|
66
|
+
alt={props.title || ""}
|
|
67
|
+
class={classes()["image"]}
|
|
68
|
+
data-slot="image"
|
|
69
|
+
/>
|
|
70
|
+
</div>
|
|
71
|
+
) : null}
|
|
72
|
+
|
|
73
|
+
<div class={classes()["content"]} data-slot="content">
|
|
74
|
+
{props.titleSlot !== undefined ? (
|
|
75
|
+
props.titleSlot
|
|
76
|
+
) : props.title ? (
|
|
77
|
+
<h3 class={classes()["title"]} data-slot="title">
|
|
78
|
+
{props.title}
|
|
79
|
+
</h3>
|
|
80
|
+
) : null}
|
|
81
|
+
|
|
82
|
+
{props.descriptionSlot !== undefined ? (
|
|
83
|
+
props.descriptionSlot
|
|
84
|
+
) : props.description ? (
|
|
85
|
+
<p class={classes()["description"]} data-slot="description">
|
|
86
|
+
{props.description}
|
|
87
|
+
</p>
|
|
88
|
+
) : null}
|
|
89
|
+
|
|
90
|
+
{props.badgeSlot !== undefined ? (
|
|
91
|
+
props.badgeSlot
|
|
92
|
+
) : props.badge ? (
|
|
93
|
+
<RLSBadge
|
|
94
|
+
color={(props.badgeColor ?? "primary") as any}
|
|
95
|
+
size="sm"
|
|
96
|
+
shape="pill"
|
|
97
|
+
class={classes()["badge"]}
|
|
98
|
+
data-slot="badge"
|
|
99
|
+
>
|
|
100
|
+
{props.badge}
|
|
101
|
+
</RLSBadge>
|
|
102
|
+
) : null}
|
|
103
|
+
|
|
104
|
+
{props.dateSlot !== undefined ? (
|
|
105
|
+
props.dateSlot
|
|
106
|
+
) : formattedDate ? (
|
|
107
|
+
<time class={classes()["date"]} data-slot="date">
|
|
108
|
+
{formattedDate}
|
|
109
|
+
</time>
|
|
110
|
+
) : null}
|
|
111
|
+
|
|
112
|
+
{props.children}
|
|
113
|
+
</div>
|
|
114
|
+
|
|
115
|
+
{props.footerSlot !== undefined && (
|
|
116
|
+
<div class={classes()["footer"]} data-slot="footer">
|
|
117
|
+
{props.footerSlot}
|
|
118
|
+
</div>
|
|
119
|
+
)}
|
|
120
|
+
</>
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
return props.to ? (
|
|
124
|
+
<a href={props.to} class={classes()["root"]} data-slot="root" {...rest}>
|
|
125
|
+
{body()}
|
|
126
|
+
</a>
|
|
127
|
+
) : (
|
|
128
|
+
<div class={classes()["root"]} data-slot="root" {...rest}>
|
|
129
|
+
{body()}
|
|
130
|
+
</div>
|
|
131
|
+
)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export default RLSPost
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createMemo, splitProps, type Component, type JSX } from "solid-js"
|
|
2
|
+
import type { PricingPlanProps } from "./pricing-plan"
|
|
3
|
+
import { pricingPlanTheme } from "./pricing-plan.theme"
|
|
4
|
+
|
|
5
|
+
export interface RLSPricingPlanProps extends PricingPlanProps {
|
|
6
|
+
children?: JSX.Element
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const RLSPricingPlan: Component<RLSPricingPlanProps> = (allProps) => {
|
|
10
|
+
const [props, rest] = splitProps(allProps, ["ui", "class", "children"])
|
|
11
|
+
|
|
12
|
+
const resolvedClasses = createMemo(() =>
|
|
13
|
+
pricingPlanTheme({
|
|
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 RLSPricingPlan
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createMemo, splitProps, type Component, type JSX } from "solid-js"
|
|
2
|
+
import type { PricingTableProps } from "./pricing-table"
|
|
3
|
+
import { pricingTableTheme } from "./pricing-table.theme"
|
|
4
|
+
|
|
5
|
+
export interface RLSPricingTableProps extends PricingTableProps {
|
|
6
|
+
children?: JSX.Element
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const RLSPricingTable: Component<RLSPricingTableProps> = (allProps) => {
|
|
10
|
+
const [props, rest] = splitProps(allProps, ["ui", "class", "children"])
|
|
11
|
+
|
|
12
|
+
const resolvedClasses = createMemo(() =>
|
|
13
|
+
pricingTableTheme({
|
|
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 RLSPricingTable
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { createMemo, splitProps, type Component, type JSX } from "solid-js"
|
|
2
|
+
import type { ProgressProps } from "./progress"
|
|
3
|
+
import { progressTheme } from "./progress.theme"
|
|
4
|
+
|
|
5
|
+
export interface RLSProgressProps extends ProgressProps {
|
|
6
|
+
children?: JSX.Element
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const RLSProgress: Component<RLSProgressProps> = (allProps) => {
|
|
10
|
+
const [props, rest] = splitProps(allProps, [
|
|
11
|
+
"value",
|
|
12
|
+
"max",
|
|
13
|
+
"theme",
|
|
14
|
+
"color",
|
|
15
|
+
"ui",
|
|
16
|
+
"class",
|
|
17
|
+
"children"
|
|
18
|
+
])
|
|
19
|
+
|
|
20
|
+
const value = () => props.value ?? 0
|
|
21
|
+
const max = () => props.max ?? 100
|
|
22
|
+
const percentage = createMemo(() => Math.min(100, Math.max(0, (value() / max()) * 100)))
|
|
23
|
+
|
|
24
|
+
const resolvedClasses = createMemo(() =>
|
|
25
|
+
progressTheme({
|
|
26
|
+
color: props.color,
|
|
27
|
+
ui: props.ui,
|
|
28
|
+
class: props.class
|
|
29
|
+
})
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<div
|
|
34
|
+
class={resolvedClasses().root}
|
|
35
|
+
data-slot="progress-root"
|
|
36
|
+
role="progressbar"
|
|
37
|
+
aria-valuemin={0}
|
|
38
|
+
aria-valuemax={max()}
|
|
39
|
+
aria-valuenow={value()}
|
|
40
|
+
data-theme={props.theme}
|
|
41
|
+
{...rest}
|
|
42
|
+
>
|
|
43
|
+
<div
|
|
44
|
+
class={resolvedClasses().indicator}
|
|
45
|
+
data-slot="indicator"
|
|
46
|
+
style={{ transform: `translateX(-${100 - percentage()}%)` }}
|
|
47
|
+
/>
|
|
48
|
+
{props.children}
|
|
49
|
+
</div>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export default RLSProgress
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createMemo, splitProps, type Component, type JSX } from "solid-js"
|
|
2
|
+
import type { ProseProps } from "./prose"
|
|
3
|
+
import { proseTheme } from "./prose.theme"
|
|
4
|
+
|
|
5
|
+
export interface RLSProseProps extends ProseProps {
|
|
6
|
+
children?: JSX.Element
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const RLSProse: Component<RLSProseProps> = (allProps) => {
|
|
10
|
+
const [props, rest] = splitProps(allProps, ["ui", "class", "children"])
|
|
11
|
+
|
|
12
|
+
const classes = createMemo(() =>
|
|
13
|
+
proseTheme({
|
|
14
|
+
ui: props.ui,
|
|
15
|
+
class: props.class
|
|
16
|
+
})
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div class={classes()["root"]} data-slot="root" {...rest}>
|
|
21
|
+
{props.children}
|
|
22
|
+
</div>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default RLSProse
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createMemo, splitProps, type Component, type JSX } from "solid-js"
|
|
2
|
+
import type { QrCodeProps } from "./qr-code"
|
|
3
|
+
import { qrCodeTheme } from "./qr-code.theme"
|
|
4
|
+
|
|
5
|
+
export interface RLSQrCodeProps extends QrCodeProps {
|
|
6
|
+
children?: JSX.Element
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const RLSQrCode: Component<RLSQrCodeProps> = (allProps) => {
|
|
10
|
+
const [props, rest] = splitProps(allProps, ["ui", "class", "children"])
|
|
11
|
+
|
|
12
|
+
const resolvedClasses = createMemo(() =>
|
|
13
|
+
qrCodeTheme({
|
|
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 RLSQrCode
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
---
|
|
2
2
|
import RLAIcon from "../icon/RLAIcon.astro"
|
|
3
|
+
import type { QuoteProps } from "./quote"
|
|
4
|
+
import { quoteTheme } from "./quote.theme"
|
|
5
|
+
|
|
6
|
+
export interface Props extends QuoteProps {}
|
|
7
|
+
|
|
8
|
+
const classes = quoteTheme(Astro.props)
|
|
3
9
|
---
|
|
4
10
|
|
|
5
|
-
<figure class=
|
|
6
|
-
<RLAIcon name="quote" class=
|
|
7
|
-
<blockquote
|
|
8
|
-
class="font-heading heading-3 text-xl font-medium text-white md:text-[32px] md:leading-[40px]"
|
|
9
|
-
>
|
|
11
|
+
<figure class={classes.root} data-slot="root" {...Astro.props}>
|
|
12
|
+
<RLAIcon name="quote" class={classes.icon} data-slot="icon" />
|
|
13
|
+
<blockquote class={classes.quote} data-slot="quote">
|
|
10
14
|
<slot name="quote" />
|
|
11
15
|
</blockquote>
|
|
12
|
-
<figcaption class=
|
|
16
|
+
<figcaption class={classes.caption} data-slot="caption">
|
|
13
17
|
<slot name="caption" />
|
|
14
18
|
</figcaption>
|
|
15
19
|
</figure>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createMemo, splitProps, type Component, type JSX } from "solid-js"
|
|
2
|
+
import type { QuoteProps } from "./quote"
|
|
3
|
+
import { quoteTheme } from "./quote.theme"
|
|
4
|
+
import RLSIcon from "../icon/RLSIcon"
|
|
5
|
+
|
|
6
|
+
export interface RLSQuoteProps extends QuoteProps {
|
|
7
|
+
children?: JSX.Element
|
|
8
|
+
quote?: JSX.Element
|
|
9
|
+
caption?: JSX.Element
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const RLSQuote: Component<RLSQuoteProps> = (allProps) => {
|
|
13
|
+
const [props, rest] = splitProps(allProps, ["quote", "caption", "children", "ui", "class"])
|
|
14
|
+
|
|
15
|
+
const resolvedClasses = createMemo(() =>
|
|
16
|
+
quoteTheme({
|
|
17
|
+
ui: props.ui,
|
|
18
|
+
class: props.class
|
|
19
|
+
})
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<figure class={resolvedClasses().root} data-slot="root" {...rest}>
|
|
24
|
+
<RLSIcon name="quote" class={resolvedClasses().icon} data-slot="icon" />
|
|
25
|
+
<blockquote class={resolvedClasses().quote} data-slot="quote">
|
|
26
|
+
{props.quote !== undefined ? props.quote : props.children}
|
|
27
|
+
</blockquote>
|
|
28
|
+
{props.caption ? (
|
|
29
|
+
<figcaption class={resolvedClasses().caption} data-slot="caption">
|
|
30
|
+
{props.caption}
|
|
31
|
+
</figcaption>
|
|
32
|
+
) : null}
|
|
33
|
+
</figure>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default RLSQuote
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { defineTheme } from "../../resolver"
|
|
2
2
|
|
|
3
3
|
export const quoteTheme = defineTheme("quote", {
|
|
4
|
-
slots: ["root"],
|
|
4
|
+
slots: ["root", "icon", "quote", "caption"],
|
|
5
5
|
base: {
|
|
6
|
-
root: ""
|
|
6
|
+
root: "relative my-8 border-y-[3px] border-astro-gray-500 py-4",
|
|
7
|
+
icon: "mb-2 s-10 md:absolute md:right-[calc(100%+1rem)] md:top-6",
|
|
8
|
+
quote: "font-heading heading-3 text-xl font-medium text-white md:text-[32px] md:leading-[40px]",
|
|
9
|
+
caption: "font-mono mt-4 text-right text-astro-pink-light"
|
|
7
10
|
},
|
|
8
11
|
variants: {},
|
|
9
12
|
defaultVariants: {}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createMemo, splitProps, type Component, type JSX } from "solid-js"
|
|
2
|
+
import type { RadioGroupProps } from "./radio-group"
|
|
3
|
+
import { radioGroupTheme } from "./radio-group.theme"
|
|
4
|
+
|
|
5
|
+
export interface RLSRadioGroupProps extends RadioGroupProps {
|
|
6
|
+
children?: JSX.Element
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const RLSRadioGroup: Component<RLSRadioGroupProps> = (allProps) => {
|
|
10
|
+
const [props, rest] = splitProps(allProps, [
|
|
11
|
+
"ui",
|
|
12
|
+
"class",
|
|
13
|
+
"children",
|
|
14
|
+
"checked",
|
|
15
|
+
"disabled",
|
|
16
|
+
"name",
|
|
17
|
+
"label",
|
|
18
|
+
"value",
|
|
19
|
+
"trailing"
|
|
20
|
+
])
|
|
21
|
+
|
|
22
|
+
const resolvedClasses = createMemo(() =>
|
|
23
|
+
radioGroupTheme({
|
|
24
|
+
ui: props.ui,
|
|
25
|
+
class: props.class,
|
|
26
|
+
...allProps
|
|
27
|
+
})
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<div class={resolvedClasses().root} data-slot="root" {...rest}>
|
|
32
|
+
{props.children}
|
|
33
|
+
</div>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default RLSRadioGroup
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createMemo, splitProps, type Component, type JSX } from "solid-js"
|
|
2
|
+
import type { RatingProps } from "./rating"
|
|
3
|
+
import { ratingTheme } from "./rating.theme"
|
|
4
|
+
|
|
5
|
+
export interface RLSRatingProps extends RatingProps {
|
|
6
|
+
children?: JSX.Element
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const RLSRating: Component<RLSRatingProps> = (allProps) => {
|
|
10
|
+
const [props, rest] = splitProps(allProps, ["ui", "class", "children"])
|
|
11
|
+
|
|
12
|
+
const resolvedClasses = createMemo(() =>
|
|
13
|
+
ratingTheme({
|
|
14
|
+
ui: props.ui,
|
|
15
|
+
class: props.class,
|
|
16
|
+
...allProps
|
|
17
|
+
})
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div class={resolvedClasses().root} data-slot="root" {...rest}>
|
|
22
|
+
{props.children}
|
|
23
|
+
</div>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default RLSRating
|
|
@@ -0,0 +1,210 @@
|
|
|
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 { ScrollAreaProps } from "./scroll-area"
|
|
13
|
+
import { scrollAreaTheme } from "./scroll-area.theme"
|
|
14
|
+
|
|
15
|
+
export interface RLSScrollAreaProps extends ScrollAreaProps {
|
|
16
|
+
children?: JSX.Element
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const RLSScrollArea: Component<RLSScrollAreaProps> = (allProps) => {
|
|
20
|
+
const [props, rest] = splitProps(allProps, [
|
|
21
|
+
"orientation",
|
|
22
|
+
"scrollHideDelay",
|
|
23
|
+
"height",
|
|
24
|
+
"ui",
|
|
25
|
+
"class",
|
|
26
|
+
"children"
|
|
27
|
+
])
|
|
28
|
+
|
|
29
|
+
const orientation = () => props.orientation ?? "vertical"
|
|
30
|
+
const hideDelay = () => props.scrollHideDelay ?? 600
|
|
31
|
+
|
|
32
|
+
let viewportRef: HTMLDivElement | null = null
|
|
33
|
+
let vBarRef: HTMLDivElement | null = null
|
|
34
|
+
let hBarRef: HTMLDivElement | null = null
|
|
35
|
+
let vThumbRef: HTMLDivElement | null = null
|
|
36
|
+
let hThumbRef: HTMLDivElement | null = null
|
|
37
|
+
|
|
38
|
+
const [barsVisible, setBarsVisible] = createSignal(false)
|
|
39
|
+
let hideTimer: ReturnType<typeof setTimeout> | undefined
|
|
40
|
+
|
|
41
|
+
const showBars = () => {
|
|
42
|
+
setBarsVisible(true)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const hideBars = () => {
|
|
46
|
+
if (hideTimer) clearTimeout(hideTimer)
|
|
47
|
+
hideTimer = setTimeout(() => {
|
|
48
|
+
setBarsVisible(false)
|
|
49
|
+
}, hideDelay())
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const updateThumbs = () => {
|
|
53
|
+
const vp = viewportRef
|
|
54
|
+
if (!vp) return
|
|
55
|
+
|
|
56
|
+
if (vThumbRef && vBarRef) {
|
|
57
|
+
const ratio = vp.clientHeight / vp.scrollHeight
|
|
58
|
+
const thumbH = Math.max(ratio * vBarRef.clientHeight, 20)
|
|
59
|
+
const thumbTop = (vp.scrollTop / vp.scrollHeight) * vBarRef.clientHeight
|
|
60
|
+
vThumbRef.style.height = `${thumbH}px`
|
|
61
|
+
vThumbRef.style.transform = `translateY(${thumbTop}px)`
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (hThumbRef && hBarRef) {
|
|
65
|
+
const ratio = vp.clientWidth / vp.scrollWidth
|
|
66
|
+
const thumbW = Math.max(ratio * hBarRef.clientWidth, 20)
|
|
67
|
+
const thumbLeft = (vp.scrollLeft / vp.scrollWidth) * hBarRef.clientWidth
|
|
68
|
+
hThumbRef.style.width = `${thumbW}px`
|
|
69
|
+
hThumbRef.style.transform = `translateX(${thumbLeft}px)`
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const handleScroll = () => {
|
|
74
|
+
if (hideTimer) clearTimeout(hideTimer)
|
|
75
|
+
showBars()
|
|
76
|
+
updateThumbs()
|
|
77
|
+
hideBars()
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const setupDraggable = (
|
|
81
|
+
thumb: HTMLDivElement | null,
|
|
82
|
+
scrollProp: "scrollTop" | "scrollLeft",
|
|
83
|
+
clientProp: "clientY" | "clientX",
|
|
84
|
+
sizeProp: "scrollHeight" | "scrollWidth",
|
|
85
|
+
clientSizeProp: "clientHeight" | "clientWidth"
|
|
86
|
+
) => {
|
|
87
|
+
if (!thumb) return () => {}
|
|
88
|
+
let startPos = 0
|
|
89
|
+
let startScroll = 0
|
|
90
|
+
|
|
91
|
+
const onMouseDown = (e: MouseEvent) => {
|
|
92
|
+
const vp = viewportRef
|
|
93
|
+
if (!vp) return
|
|
94
|
+
e.preventDefault()
|
|
95
|
+
startPos = e[clientProp]
|
|
96
|
+
startScroll = vp[scrollProp]
|
|
97
|
+
|
|
98
|
+
const onMouseMove = (ev: MouseEvent) => {
|
|
99
|
+
const vpCurrent = viewportRef
|
|
100
|
+
if (!vpCurrent) return
|
|
101
|
+
const delta = ev[clientProp] - startPos
|
|
102
|
+
const ratio = vpCurrent[sizeProp] / vpCurrent[clientSizeProp]
|
|
103
|
+
vpCurrent[scrollProp] = startScroll + delta * ratio
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const onMouseUp = () => {
|
|
107
|
+
document.removeEventListener("mousemove", onMouseMove)
|
|
108
|
+
document.removeEventListener("mouseup", onMouseUp)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
document.addEventListener("mousemove", onMouseMove)
|
|
112
|
+
document.addEventListener("mouseup", onMouseUp)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
thumb.addEventListener("mousedown", onMouseDown)
|
|
116
|
+
return () => thumb.removeEventListener("mousedown", onMouseDown)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
onMount(() => {
|
|
120
|
+
updateThumbs()
|
|
121
|
+
const cleanV = setupDraggable(vThumbRef, "scrollTop", "clientY", "scrollHeight", "clientHeight")
|
|
122
|
+
const cleanH = setupDraggable(hThumbRef, "scrollLeft", "clientX", "scrollWidth", "clientWidth")
|
|
123
|
+
|
|
124
|
+
onCleanup(() => {
|
|
125
|
+
if (hideTimer) clearTimeout(hideTimer)
|
|
126
|
+
cleanV()
|
|
127
|
+
cleanH()
|
|
128
|
+
})
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
createEffect(() => {
|
|
132
|
+
void props.children
|
|
133
|
+
requestAnimationFrame(() => updateThumbs())
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
const resolvedClasses = createMemo(() =>
|
|
137
|
+
scrollAreaTheme({
|
|
138
|
+
orientation: orientation(),
|
|
139
|
+
ui: props.ui,
|
|
140
|
+
class: props.class
|
|
141
|
+
})
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
const heightStyle = () =>
|
|
145
|
+
props.height
|
|
146
|
+
? typeof props.height === "number"
|
|
147
|
+
? `${props.height}px`
|
|
148
|
+
: props.height
|
|
149
|
+
: undefined
|
|
150
|
+
|
|
151
|
+
return (
|
|
152
|
+
<div
|
|
153
|
+
class={resolvedClasses().root}
|
|
154
|
+
data-slot="root"
|
|
155
|
+
data-scroll-area
|
|
156
|
+
data-orientation={orientation()}
|
|
157
|
+
data-hide-delay={hideDelay()}
|
|
158
|
+
style={{ height: heightStyle() }}
|
|
159
|
+
{...rest}
|
|
160
|
+
>
|
|
161
|
+
<div
|
|
162
|
+
ref={(el) => (viewportRef = el)}
|
|
163
|
+
class={resolvedClasses().viewport}
|
|
164
|
+
data-slot="viewport"
|
|
165
|
+
data-scroll-viewport
|
|
166
|
+
onScroll={handleScroll}
|
|
167
|
+
>
|
|
168
|
+
{props.children}
|
|
169
|
+
</div>
|
|
170
|
+
|
|
171
|
+
<Show when={orientation() === "vertical" || orientation() === "both"}>
|
|
172
|
+
<div
|
|
173
|
+
ref={(el) => (vBarRef = el)}
|
|
174
|
+
class={`${resolvedClasses().scrollbar} transition-opacity ${
|
|
175
|
+
barsVisible() ? "opacity-100" : "opacity-0"
|
|
176
|
+
}`}
|
|
177
|
+
data-slot="scrollbar"
|
|
178
|
+
data-scroll-bar="vertical"
|
|
179
|
+
aria-hidden="true"
|
|
180
|
+
>
|
|
181
|
+
<div
|
|
182
|
+
ref={(el) => (vThumbRef = el)}
|
|
183
|
+
class={resolvedClasses().thumb}
|
|
184
|
+
data-scroll-thumb="vertical"
|
|
185
|
+
/>
|
|
186
|
+
</div>
|
|
187
|
+
</Show>
|
|
188
|
+
|
|
189
|
+
<Show when={orientation() === "horizontal" || orientation() === "both"}>
|
|
190
|
+
<div
|
|
191
|
+
ref={(el) => (hBarRef = el)}
|
|
192
|
+
class={`absolute bottom-0 left-0 right-0 h-2.5 flex-row flex p-0.5 bg-transparent transition-colors duration-150 ease-out hover:bg-muted/10 transition-opacity ${
|
|
193
|
+
barsVisible() ? "opacity-100" : "opacity-0"
|
|
194
|
+
}`}
|
|
195
|
+
data-slot="scrollbar"
|
|
196
|
+
data-scroll-bar="horizontal"
|
|
197
|
+
aria-hidden="true"
|
|
198
|
+
>
|
|
199
|
+
<div
|
|
200
|
+
ref={(el) => (hThumbRef = el)}
|
|
201
|
+
class={resolvedClasses().thumb}
|
|
202
|
+
data-scroll-thumb="horizontal"
|
|
203
|
+
/>
|
|
204
|
+
</div>
|
|
205
|
+
</Show>
|
|
206
|
+
</div>
|
|
207
|
+
)
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export default RLSScrollArea
|
|
@@ -21,6 +21,7 @@ const classes = scrollToTopTheme(Astro.props)
|
|
|
21
21
|
<rla-scroll-to-top data-threshold={threshold} data-duration={duration} data-color={color} data-progress-width={progressWidth} data-theme={theme} {...rest}>
|
|
22
22
|
<div
|
|
23
23
|
class:list={["rla-scroll-to-top-inner", "fixed bottom-6 right-6 z-50", classes.root]}
|
|
24
|
+
data-slot="root"
|
|
24
25
|
>
|
|
25
26
|
<button
|
|
26
27
|
type="button"
|