@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,205 @@
|
|
|
1
|
+
import { createMemo, createSignal, For, splitProps, type Component, type JSX } from "solid-js"
|
|
2
|
+
import type { StepperProps, StepperItem } from "./stepper"
|
|
3
|
+
import { stepperTheme } from "./stepper.theme"
|
|
4
|
+
import RLSIcon from "../icon/RLSIcon"
|
|
5
|
+
|
|
6
|
+
export interface RLSStepperProps extends StepperProps {
|
|
7
|
+
children?: JSX.Element
|
|
8
|
+
indicator?: (ctx: {
|
|
9
|
+
item: StepperItem
|
|
10
|
+
index: number
|
|
11
|
+
state: "completed" | "active" | "inactive"
|
|
12
|
+
}) => JSX.Element
|
|
13
|
+
wrapper?: (ctx: { item: StepperItem; index: number }) => JSX.Element
|
|
14
|
+
onChange?: (ctx: { index: number; value: string | number }) => void
|
|
15
|
+
onNext?: (ctx: { index: number; value: string | number }) => void
|
|
16
|
+
onPrev?: (ctx: { index: number; value: string | number }) => void
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const RLSStepper: Component<RLSStepperProps> = (allProps) => {
|
|
20
|
+
const [props, rest] = splitProps(allProps, [
|
|
21
|
+
"items",
|
|
22
|
+
"value",
|
|
23
|
+
"defaultValue",
|
|
24
|
+
"modelValue",
|
|
25
|
+
"valueKey",
|
|
26
|
+
"linear",
|
|
27
|
+
"disabled",
|
|
28
|
+
"orientation",
|
|
29
|
+
"size",
|
|
30
|
+
"color",
|
|
31
|
+
"ui",
|
|
32
|
+
"class",
|
|
33
|
+
"children",
|
|
34
|
+
"indicator",
|
|
35
|
+
"wrapper",
|
|
36
|
+
"onChange",
|
|
37
|
+
"onNext",
|
|
38
|
+
"onPrev"
|
|
39
|
+
])
|
|
40
|
+
|
|
41
|
+
const items = (): StepperItem[] => props.items ?? []
|
|
42
|
+
const valueKey = (): string => props.valueKey ?? "value"
|
|
43
|
+
const linear = (): boolean => props.linear !== false
|
|
44
|
+
const isDisabled = (): boolean => props.disabled === true
|
|
45
|
+
|
|
46
|
+
const initialActiveValue =
|
|
47
|
+
props.value ??
|
|
48
|
+
props.modelValue ??
|
|
49
|
+
props.defaultValue ??
|
|
50
|
+
(items().length > 0 ? (items()[0]?.[valueKey()] ?? items()[0]?.value ?? 0) : 0)
|
|
51
|
+
|
|
52
|
+
const activeIndex = items().findIndex((item, idx) => {
|
|
53
|
+
const val = item[valueKey()] ?? item.value ?? idx
|
|
54
|
+
return String(val) === String(initialActiveValue)
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
const [currentIndex, setCurrentIndex] = createSignal(activeIndex >= 0 ? activeIndex : 0)
|
|
58
|
+
|
|
59
|
+
const itemValue = (item: StepperItem, index: number): string | number =>
|
|
60
|
+
item[valueKey()] ?? item.value ?? index
|
|
61
|
+
|
|
62
|
+
const goTo = (index: number) => {
|
|
63
|
+
if (isDisabled()) return
|
|
64
|
+
if (index < 0 || index >= items().length) return
|
|
65
|
+
if (linear() && index > currentIndex() + 1) return
|
|
66
|
+
|
|
67
|
+
const oldIndex = currentIndex()
|
|
68
|
+
setCurrentIndex(index)
|
|
69
|
+
const value = itemValue(items()[index]!, index)
|
|
70
|
+
|
|
71
|
+
if (index > oldIndex) {
|
|
72
|
+
props.onNext?.({ index, value })
|
|
73
|
+
} else if (index < oldIndex) {
|
|
74
|
+
props.onPrev?.({ index, value })
|
|
75
|
+
}
|
|
76
|
+
props.onChange?.({ index, value })
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const resolvedClasses = createMemo(() =>
|
|
80
|
+
stepperTheme({
|
|
81
|
+
size: props.size ?? "sm",
|
|
82
|
+
color: props.color ?? "primary",
|
|
83
|
+
orientation: props.orientation ?? "horizontal",
|
|
84
|
+
ui: props.ui,
|
|
85
|
+
class: props.class
|
|
86
|
+
})
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<div class={resolvedClasses().root} data-slot="root" {...rest}>
|
|
91
|
+
<div class={resolvedClasses().header} data-slot="header">
|
|
92
|
+
<For each={items()}>
|
|
93
|
+
{(item, index) => {
|
|
94
|
+
const isCompleted = index() < currentIndex()
|
|
95
|
+
const isActive = index() === currentIndex()
|
|
96
|
+
const isItemDisabled =
|
|
97
|
+
isDisabled() || item.disabled || (linear() && index() > currentIndex())
|
|
98
|
+
const state: "completed" | "active" | "inactive" = isCompleted
|
|
99
|
+
? "completed"
|
|
100
|
+
: isActive
|
|
101
|
+
? "active"
|
|
102
|
+
: "inactive"
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<>
|
|
106
|
+
<div
|
|
107
|
+
class={`${resolvedClasses().item} ${item.class || ""}`}
|
|
108
|
+
data-slot="item"
|
|
109
|
+
data-index={index()}
|
|
110
|
+
data-value={itemValue(item, index())}
|
|
111
|
+
data-state={state}
|
|
112
|
+
data-disabled={isItemDisabled ? "true" : undefined}
|
|
113
|
+
>
|
|
114
|
+
<div class={resolvedClasses().container} data-slot="container">
|
|
115
|
+
<button
|
|
116
|
+
type="button"
|
|
117
|
+
class={`${resolvedClasses().trigger} ${
|
|
118
|
+
isActive || isCompleted
|
|
119
|
+
? "!bg-primary-600 !border-primary-600 !text-white"
|
|
120
|
+
: ""
|
|
121
|
+
}`}
|
|
122
|
+
data-slot="trigger"
|
|
123
|
+
disabled={isItemDisabled}
|
|
124
|
+
data-step-trigger={index()}
|
|
125
|
+
onClick={() => goTo(index())}
|
|
126
|
+
>
|
|
127
|
+
<span class={resolvedClasses().indicator} data-slot="indicator">
|
|
128
|
+
{props.indicator ? (
|
|
129
|
+
props.indicator({ item, index: index(), state })
|
|
130
|
+
) : item.icon ? (
|
|
131
|
+
<RLSIcon
|
|
132
|
+
name={item.icon}
|
|
133
|
+
size="sm"
|
|
134
|
+
class={`${resolvedClasses().icon} ${
|
|
135
|
+
isActive || isCompleted ? "!text-white" : "text-neutral-400"
|
|
136
|
+
}`}
|
|
137
|
+
data-slot="icon"
|
|
138
|
+
/>
|
|
139
|
+
) : (
|
|
140
|
+
<span>{index() + 1}</span>
|
|
141
|
+
)}
|
|
142
|
+
</span>
|
|
143
|
+
</button>
|
|
144
|
+
</div>
|
|
145
|
+
|
|
146
|
+
{item.title || item.description ? (
|
|
147
|
+
<div class={resolvedClasses().wrapper} data-slot="wrapper">
|
|
148
|
+
{props.wrapper ? (
|
|
149
|
+
props.wrapper({ item, index: index() })
|
|
150
|
+
) : (
|
|
151
|
+
<>
|
|
152
|
+
{item.title ? (
|
|
153
|
+
<div class={resolvedClasses().title} data-slot="title">
|
|
154
|
+
{item.title}
|
|
155
|
+
</div>
|
|
156
|
+
) : null}
|
|
157
|
+
{item.description ? (
|
|
158
|
+
<div class={resolvedClasses().description} data-slot="description">
|
|
159
|
+
{item.description}
|
|
160
|
+
</div>
|
|
161
|
+
) : null}
|
|
162
|
+
</>
|
|
163
|
+
)}
|
|
164
|
+
</div>
|
|
165
|
+
) : null}
|
|
166
|
+
</div>
|
|
167
|
+
|
|
168
|
+
{index() < items().length - 1 ? (
|
|
169
|
+
<div
|
|
170
|
+
class={`${resolvedClasses().separator} flex-1 h-0.5 mx-2 self-start mt-4 transition-colors ${
|
|
171
|
+
index() < currentIndex() ? "bg-primary-600" : "bg-neutral-200"
|
|
172
|
+
}`}
|
|
173
|
+
data-slot="separator"
|
|
174
|
+
data-separator-index={index()}
|
|
175
|
+
/>
|
|
176
|
+
) : null}
|
|
177
|
+
</>
|
|
178
|
+
)
|
|
179
|
+
}}
|
|
180
|
+
</For>
|
|
181
|
+
</div>
|
|
182
|
+
|
|
183
|
+
<div class={resolvedClasses().content} data-slot="content">
|
|
184
|
+
{props.children}
|
|
185
|
+
<For each={items()}>
|
|
186
|
+
{(item, index) => {
|
|
187
|
+
const panelActive = index() === currentIndex()
|
|
188
|
+
return (
|
|
189
|
+
<div
|
|
190
|
+
data-stepper-panel={index()}
|
|
191
|
+
data-value={itemValue(item, index())}
|
|
192
|
+
hidden={panelActive ? undefined : "until-found"}
|
|
193
|
+
class="w-full"
|
|
194
|
+
>
|
|
195
|
+
{item.content ? <div>{item.content}</div> : null}
|
|
196
|
+
</div>
|
|
197
|
+
)
|
|
198
|
+
}}
|
|
199
|
+
</For>
|
|
200
|
+
</div>
|
|
201
|
+
</div>
|
|
202
|
+
)
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export default RLSStepper
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { createMemo, splitProps, type Component, type JSX } from "solid-js"
|
|
2
|
+
import type { StepsProps } from "./steps"
|
|
3
|
+
import { stepsTheme } from "./steps.theme"
|
|
4
|
+
|
|
5
|
+
export interface RLSStepsProps extends StepsProps {
|
|
6
|
+
children?: JSX.Element
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const RLSSteps: Component<RLSStepsProps> = (allProps) => {
|
|
10
|
+
const [props, rest] = splitProps(allProps, ["size", "ui", "class", "children"])
|
|
11
|
+
|
|
12
|
+
const size = () => props.size || "md"
|
|
13
|
+
|
|
14
|
+
const resolvedClasses = createMemo(() =>
|
|
15
|
+
stepsTheme({
|
|
16
|
+
ui: props.ui,
|
|
17
|
+
class: props.class
|
|
18
|
+
})
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<div class={`${resolvedClasses().root} rl-steps`} data-slot="root" data-size={size()} {...rest}>
|
|
23
|
+
<ol class="rl-steps-list">{props.children}</ol>
|
|
24
|
+
<style>{`
|
|
25
|
+
.rl-steps-list {
|
|
26
|
+
list-style: none;
|
|
27
|
+
counter-reset: rl-step 0;
|
|
28
|
+
padding: 0;
|
|
29
|
+
margin: 0;
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
}
|
|
33
|
+
.rl-steps-list > li {
|
|
34
|
+
counter-increment: rl-step;
|
|
35
|
+
position: relative;
|
|
36
|
+
padding-left: 2.625rem;
|
|
37
|
+
padding-bottom: 1.75rem;
|
|
38
|
+
margin: 0;
|
|
39
|
+
}
|
|
40
|
+
.rl-steps-list > li:last-child {
|
|
41
|
+
padding-bottom: 0;
|
|
42
|
+
}
|
|
43
|
+
.rl-steps-list > li::before {
|
|
44
|
+
content: counter(rl-step);
|
|
45
|
+
position: absolute;
|
|
46
|
+
left: 0;
|
|
47
|
+
top: 0.125rem;
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
justify-content: center;
|
|
51
|
+
width: 1.75rem;
|
|
52
|
+
height: 1.75rem;
|
|
53
|
+
border-radius: 9999px;
|
|
54
|
+
font-size: 0.75rem;
|
|
55
|
+
font-weight: 700;
|
|
56
|
+
line-height: 1;
|
|
57
|
+
color: var(--rl-neutral-50);
|
|
58
|
+
background-color: var(--primary, #3b82f6);
|
|
59
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
60
|
+
z-index: 1;
|
|
61
|
+
}
|
|
62
|
+
.rl-steps-list > li::after {
|
|
63
|
+
content: '';
|
|
64
|
+
position: absolute;
|
|
65
|
+
left: calc(0.875rem - 1px);
|
|
66
|
+
top: calc(1.75rem + 0.375rem);
|
|
67
|
+
bottom: 0;
|
|
68
|
+
width: 2px;
|
|
69
|
+
background-color: var(--rl-neutral-200);
|
|
70
|
+
}
|
|
71
|
+
.rl-steps-list > li:last-child::after {
|
|
72
|
+
display: none;
|
|
73
|
+
}
|
|
74
|
+
.rl-steps-list > li > :first-child {
|
|
75
|
+
margin-top: 0;
|
|
76
|
+
}
|
|
77
|
+
[data-size="sm"] .rl-steps-list > li {
|
|
78
|
+
padding-left: 2rem;
|
|
79
|
+
padding-bottom: 1.25rem;
|
|
80
|
+
}
|
|
81
|
+
[data-size="sm"] .rl-steps-list > li::before {
|
|
82
|
+
width: 1.375rem;
|
|
83
|
+
height: 1.375rem;
|
|
84
|
+
font-size: 0.625rem;
|
|
85
|
+
}
|
|
86
|
+
[data-size="sm"] .rl-steps-list > li::after {
|
|
87
|
+
left: calc(0.6875rem - 1px);
|
|
88
|
+
top: calc(1.375rem + 0.375rem);
|
|
89
|
+
}
|
|
90
|
+
[data-size="lg"] .rl-steps-list > li {
|
|
91
|
+
padding-left: 3.25rem;
|
|
92
|
+
padding-bottom: 2.25rem;
|
|
93
|
+
}
|
|
94
|
+
[data-size="lg"] .rl-steps-list > li::before {
|
|
95
|
+
width: 2.25rem;
|
|
96
|
+
height: 2.25rem;
|
|
97
|
+
font-size: 0.875rem;
|
|
98
|
+
}
|
|
99
|
+
[data-size="lg"] .rl-steps-list > li::after {
|
|
100
|
+
left: calc(1.125rem - 1px);
|
|
101
|
+
top: calc(2.25rem + 0.375rem);
|
|
102
|
+
}
|
|
103
|
+
`}</style>
|
|
104
|
+
</div>
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export default RLSSteps
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { createMemo, splitProps, type Component, type JSX } from "solid-js"
|
|
2
|
+
import type { StickySurfaceProps } from "./sticky-surface"
|
|
3
|
+
import { stickySurfaceTheme } from "./sticky-surface.theme"
|
|
4
|
+
|
|
5
|
+
export interface RLSStickySurfaceProps extends StickySurfaceProps {
|
|
6
|
+
children?: JSX.Element
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const RLSStickySurface: Component<RLSStickySurfaceProps> = (allProps) => {
|
|
10
|
+
const [props, rest] = splitProps(allProps, [
|
|
11
|
+
"stuckShadow",
|
|
12
|
+
"offsetTop",
|
|
13
|
+
"zIndex",
|
|
14
|
+
"ui",
|
|
15
|
+
"class",
|
|
16
|
+
"children"
|
|
17
|
+
])
|
|
18
|
+
|
|
19
|
+
const stuckShadow = () => props.stuckShadow ?? true
|
|
20
|
+
|
|
21
|
+
const id = `sticky-${Math.random().toString(36).substring(2, 9)}`
|
|
22
|
+
|
|
23
|
+
const resolvedClasses = createMemo(() => stickySurfaceTheme({ ui: props.ui, class: props.class }))
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div
|
|
27
|
+
class={`${resolvedClasses().root} ${id} ${stuckShadow() ? "rla-sticky-shadow" : ""}`}
|
|
28
|
+
data-slot="root"
|
|
29
|
+
{...rest}
|
|
30
|
+
>
|
|
31
|
+
{props.children}
|
|
32
|
+
<style>{`
|
|
33
|
+
.${id} {
|
|
34
|
+
top: ${props.offsetTop ?? 0}px !important;
|
|
35
|
+
z-index: ${props.zIndex ?? 10} !important;
|
|
36
|
+
container-type: scroll-state;
|
|
37
|
+
container-name: rla-sticky-${id};
|
|
38
|
+
}
|
|
39
|
+
`}</style>
|
|
40
|
+
{stuckShadow() ? (
|
|
41
|
+
<style>{`
|
|
42
|
+
@container rla-sticky-${id} scroll-state(stuck: top) {
|
|
43
|
+
.${id} {
|
|
44
|
+
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.10), 0 1px 4px 0 rgba(0, 0, 0, 0.06);
|
|
45
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@media (prefers-color-scheme: dark) {
|
|
50
|
+
@container rla-sticky-${id} scroll-state(stuck: top) {
|
|
51
|
+
.${id} {
|
|
52
|
+
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.40), 0 1px 4px 0 rgba(0, 0, 0, 0.20);
|
|
53
|
+
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
`}</style>
|
|
58
|
+
) : null}
|
|
59
|
+
</div>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default RLSStickySurface
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Show, type Component } from "solid-js"
|
|
2
|
+
import RLSIcon from "../icon/RLSIcon"
|
|
3
|
+
|
|
4
|
+
export interface RLSSurroundItem {
|
|
5
|
+
label: string
|
|
6
|
+
href: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface RLSSurroundProps {
|
|
10
|
+
prev?: RLSSurroundItem | null
|
|
11
|
+
next?: RLSSurroundItem | null
|
|
12
|
+
class?: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const RLSSurround: Component<RLSSurroundProps> = (props) => {
|
|
16
|
+
return (
|
|
17
|
+
<Show when={props.prev || props.next}>
|
|
18
|
+
<div
|
|
19
|
+
class={`mt-12 pt-6 border-t border-default flex justify-between gap-4 ${props.class ?? ""}`}
|
|
20
|
+
>
|
|
21
|
+
<Show when={props.prev} fallback={<div />}>
|
|
22
|
+
{(prev) => (
|
|
23
|
+
<a
|
|
24
|
+
href={prev().href}
|
|
25
|
+
class="flex flex-col gap-1 text-left group no-underline max-w-[45%]"
|
|
26
|
+
>
|
|
27
|
+
<span class="text-xs text-muted font-medium flex items-center gap-1 group-hover:text-primary transition-colors">
|
|
28
|
+
<RLSIcon name="arrowLeft" class="size-3" /> Previous
|
|
29
|
+
</span>
|
|
30
|
+
<span class="text-sm font-semibold text-highlighted group-hover:text-primary transition-colors truncate">
|
|
31
|
+
{prev().label}
|
|
32
|
+
</span>
|
|
33
|
+
</a>
|
|
34
|
+
)}
|
|
35
|
+
</Show>
|
|
36
|
+
|
|
37
|
+
<Show when={props.next} fallback={<div />}>
|
|
38
|
+
{(next) => (
|
|
39
|
+
<a
|
|
40
|
+
href={next().href}
|
|
41
|
+
class="flex flex-col gap-1 text-right group no-underline max-w-[45%]"
|
|
42
|
+
>
|
|
43
|
+
<span class="text-xs text-muted font-medium flex items-center justify-end gap-1 group-hover:text-primary transition-colors">
|
|
44
|
+
Next <RLSIcon name="arrowRight" class="size-3" />
|
|
45
|
+
</span>
|
|
46
|
+
<span class="text-sm font-semibold text-highlighted group-hover:text-primary transition-colors truncate">
|
|
47
|
+
{next().label}
|
|
48
|
+
</span>
|
|
49
|
+
</a>
|
|
50
|
+
)}
|
|
51
|
+
</Show>
|
|
52
|
+
</div>
|
|
53
|
+
</Show>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export default RLSSurround
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { createMemo, splitProps, type Component, type JSX } from "solid-js"
|
|
2
|
+
import type { SwitchProps } from "./switch"
|
|
3
|
+
import { switchTheme } from "./switch.theme"
|
|
4
|
+
|
|
5
|
+
export interface RLSSwitchProps extends SwitchProps {
|
|
6
|
+
children?: JSX.Element
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const RLSSwitch: Component<RLSSwitchProps> = (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
|
+
"theme"
|
|
21
|
+
])
|
|
22
|
+
|
|
23
|
+
const resolvedClasses = createMemo(() =>
|
|
24
|
+
switchTheme({
|
|
25
|
+
ui: props.ui,
|
|
26
|
+
class: props.class,
|
|
27
|
+
...allProps
|
|
28
|
+
})
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<label class={resolvedClasses().root} data-slot="root" data-theme={props.theme} {...rest}>
|
|
33
|
+
<input
|
|
34
|
+
type="checkbox"
|
|
35
|
+
class={resolvedClasses().input}
|
|
36
|
+
checked={!!props.checked}
|
|
37
|
+
disabled={props.disabled}
|
|
38
|
+
name={props.name}
|
|
39
|
+
/>
|
|
40
|
+
<div class={resolvedClasses().track} data-slot="track">
|
|
41
|
+
<div class={resolvedClasses().thumb} data-slot="thumb" />
|
|
42
|
+
</div>
|
|
43
|
+
{props.label !== undefined && props.label !== null ? (
|
|
44
|
+
<span class={resolvedClasses().label} data-slot="label">
|
|
45
|
+
{props.label}
|
|
46
|
+
</span>
|
|
47
|
+
) : props.children ? (
|
|
48
|
+
<span class={resolvedClasses().label} data-slot="label">
|
|
49
|
+
{props.children}
|
|
50
|
+
</span>
|
|
51
|
+
) : null}
|
|
52
|
+
</label>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export default RLSSwitch
|