@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,27 @@
|
|
|
1
|
+
import { createMemo, splitProps, type Component, type JSX } from "solid-js"
|
|
2
|
+
import type { ChatPromptSubmitProps } from "./chat-prompt-submit"
|
|
3
|
+
import { chatPromptSubmitTheme } from "./chat-prompt-submit.theme"
|
|
4
|
+
|
|
5
|
+
export interface RLSChatPromptSubmitProps extends ChatPromptSubmitProps {
|
|
6
|
+
children?: JSX.Element
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const RLSChatPromptSubmit: Component<RLSChatPromptSubmitProps> = (allProps) => {
|
|
10
|
+
const [props, rest] = splitProps(allProps, ["ui", "class", "children"])
|
|
11
|
+
|
|
12
|
+
const resolvedClasses = createMemo(() =>
|
|
13
|
+
chatPromptSubmitTheme({
|
|
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 RLSChatPromptSubmit
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createMemo, splitProps, type Component, type JSX } from "solid-js"
|
|
2
|
+
import type { ChatReasoningProps } from "./chat-reasoning"
|
|
3
|
+
import { chatReasoningTheme } from "./chat-reasoning.theme"
|
|
4
|
+
|
|
5
|
+
export interface RLSChatReasoningProps extends ChatReasoningProps {
|
|
6
|
+
children?: JSX.Element
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const RLSChatReasoning: Component<RLSChatReasoningProps> = (allProps) => {
|
|
10
|
+
const [props, rest] = splitProps(allProps, ["ui", "class", "children"])
|
|
11
|
+
|
|
12
|
+
const resolvedClasses = createMemo(() =>
|
|
13
|
+
chatReasoningTheme({
|
|
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 RLSChatReasoning
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createMemo, splitProps, type Component, type JSX } from "solid-js"
|
|
2
|
+
import type { ChatShimmerProps } from "./chat-shimmer"
|
|
3
|
+
import { chatShimmerTheme } from "./chat-shimmer.theme"
|
|
4
|
+
|
|
5
|
+
export interface RLSChatShimmerProps extends ChatShimmerProps {
|
|
6
|
+
children?: JSX.Element
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const RLSChatShimmer: Component<RLSChatShimmerProps> = (allProps) => {
|
|
10
|
+
const [props, rest] = splitProps(allProps, ["ui", "class", "children"])
|
|
11
|
+
|
|
12
|
+
const resolvedClasses = createMemo(() =>
|
|
13
|
+
chatShimmerTheme({
|
|
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 RLSChatShimmer
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createMemo, splitProps, type Component, type JSX } from "solid-js"
|
|
2
|
+
import type { ChatToolProps } from "./chat-tool"
|
|
3
|
+
import { chatToolTheme } from "./chat-tool.theme"
|
|
4
|
+
|
|
5
|
+
export interface RLSChatToolProps extends ChatToolProps {
|
|
6
|
+
children?: JSX.Element
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const RLSChatTool: Component<RLSChatToolProps> = (allProps) => {
|
|
10
|
+
const [props, rest] = splitProps(allProps, ["ui", "class", "children"])
|
|
11
|
+
|
|
12
|
+
const resolvedClasses = createMemo(() =>
|
|
13
|
+
chatToolTheme({
|
|
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 RLSChatTool
|
|
@@ -36,7 +36,7 @@ const RLSCheckbox: Component<RLSCheckboxProps> = (allProps) => {
|
|
|
36
36
|
)
|
|
37
37
|
|
|
38
38
|
return (
|
|
39
|
-
<label class={resolvedClasses().root} data-slot="root">
|
|
39
|
+
<label class={resolvedClasses().root} data-slot="root" data-theme={props.theme}>
|
|
40
40
|
<input
|
|
41
41
|
id={props.id}
|
|
42
42
|
type="checkbox"
|
|
@@ -3,8 +3,8 @@ import { defineTheme } from "../../resolver"
|
|
|
3
3
|
export const checkboxTheme = defineTheme("checkbox", {
|
|
4
4
|
slots: ["root", "input", "box", "indicator", "label"],
|
|
5
5
|
base: {
|
|
6
|
-
root: "inline-flex items-center gap-2 cursor-pointer select-none",
|
|
7
|
-
input: "
|
|
6
|
+
root: "relative inline-flex items-center gap-2 cursor-pointer select-none",
|
|
7
|
+
input: "sr-only peer",
|
|
8
8
|
box: [
|
|
9
9
|
"size-4 shrink-0 rounded border border-default bg-default transition-all focus-within:ring-2 focus-within:ring-[var(--rl-ring)]/50 focus-within:ring-offset-2",
|
|
10
10
|
"peer-checked:bg-[var(--rl-bg)] peer-checked:border-[var(--rl-border)] peer-checked:[&_[data-slot=indicator]]:scale-100",
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { createMemo, splitProps, Show, type Component, type JSX } from "solid-js"
|
|
2
|
+
import type { ChipProps } from "./chip"
|
|
3
|
+
import { chipTheme } from "./chip.theme"
|
|
4
|
+
|
|
5
|
+
export interface RLSChipProps extends ChipProps {
|
|
6
|
+
children?: JSX.Element
|
|
7
|
+
content?: JSX.Element
|
|
8
|
+
text?: any
|
|
9
|
+
standalone?: boolean
|
|
10
|
+
show?: boolean
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const RLSChip: Component<RLSChipProps> = (allProps) => {
|
|
14
|
+
const [props, rest] = splitProps(allProps, [
|
|
15
|
+
"text",
|
|
16
|
+
"standalone",
|
|
17
|
+
"show",
|
|
18
|
+
"theme",
|
|
19
|
+
"color",
|
|
20
|
+
"size",
|
|
21
|
+
"position",
|
|
22
|
+
"inset",
|
|
23
|
+
"ui",
|
|
24
|
+
"class",
|
|
25
|
+
"children",
|
|
26
|
+
"content"
|
|
27
|
+
])
|
|
28
|
+
|
|
29
|
+
const classes = createMemo(() =>
|
|
30
|
+
chipTheme({
|
|
31
|
+
color: props.color,
|
|
32
|
+
size: props.size,
|
|
33
|
+
position: props.position,
|
|
34
|
+
inset: props.inset,
|
|
35
|
+
standalone: props.standalone ?? false,
|
|
36
|
+
ui: props.ui,
|
|
37
|
+
class: props.class
|
|
38
|
+
})
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
const show = props.show ?? true
|
|
42
|
+
|
|
43
|
+
if (props.standalone) {
|
|
44
|
+
return (
|
|
45
|
+
<Show when={show}>
|
|
46
|
+
<span class={classes()["base"]} data-slot="base">
|
|
47
|
+
{props.children !== undefined ? props.children : props.text}
|
|
48
|
+
</span>
|
|
49
|
+
</Show>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<div class={classes()["root"]} data-slot="root" data-theme={props.theme} {...rest}>
|
|
55
|
+
{props.children}
|
|
56
|
+
{show && (
|
|
57
|
+
<span class={classes()["base"]} data-slot="base">
|
|
58
|
+
{props.content !== undefined ? props.content : props.text}
|
|
59
|
+
</span>
|
|
60
|
+
)}
|
|
61
|
+
</div>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export default RLSChip
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createEffect,
|
|
3
|
+
createMemo,
|
|
4
|
+
createSignal,
|
|
5
|
+
splitProps,
|
|
6
|
+
type Component,
|
|
7
|
+
type JSX
|
|
8
|
+
} from "solid-js"
|
|
9
|
+
import type { CollapsibleProps } from "./collapsible"
|
|
10
|
+
import { collapsibleTheme } from "./collapsible.theme"
|
|
11
|
+
import RLSIcon from "../icon/RLSIcon"
|
|
12
|
+
|
|
13
|
+
export interface RLSCollapsibleProps extends CollapsibleProps {
|
|
14
|
+
children?: JSX.Element
|
|
15
|
+
triggerSlot?: JSX.Element
|
|
16
|
+
defaultOpen?: boolean
|
|
17
|
+
onOpenChange?: (open: boolean) => void
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const RLSCollapsible: Component<RLSCollapsibleProps> = (allProps) => {
|
|
21
|
+
const [props, rest] = splitProps(allProps, [
|
|
22
|
+
"open",
|
|
23
|
+
"defaultOpen",
|
|
24
|
+
"label",
|
|
25
|
+
"icon",
|
|
26
|
+
"size",
|
|
27
|
+
"color",
|
|
28
|
+
"ui",
|
|
29
|
+
"class",
|
|
30
|
+
"children",
|
|
31
|
+
"triggerSlot",
|
|
32
|
+
"onOpenChange"
|
|
33
|
+
])
|
|
34
|
+
|
|
35
|
+
const [isOpen, setIsOpen] = createSignal(props.open ?? props.defaultOpen ?? false)
|
|
36
|
+
|
|
37
|
+
createEffect(() => {
|
|
38
|
+
if (props.open !== undefined) setIsOpen(props.open)
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
const resolvedClasses = createMemo(() =>
|
|
42
|
+
collapsibleTheme({
|
|
43
|
+
open: isOpen(),
|
|
44
|
+
size: props.size,
|
|
45
|
+
color: props.color,
|
|
46
|
+
ui: props.ui,
|
|
47
|
+
class: props.class
|
|
48
|
+
})
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
const handleToggle = (e: Event) => {
|
|
52
|
+
const target = e.currentTarget as HTMLDetailsElement
|
|
53
|
+
setIsOpen(target.open)
|
|
54
|
+
props.onOpenChange?.(target.open)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<details
|
|
59
|
+
class={resolvedClasses().root}
|
|
60
|
+
open={isOpen()}
|
|
61
|
+
onToggle={handleToggle}
|
|
62
|
+
data-slot="root"
|
|
63
|
+
{...rest}
|
|
64
|
+
>
|
|
65
|
+
<summary class={resolvedClasses().trigger} data-slot="trigger">
|
|
66
|
+
{props.triggerSlot ? (
|
|
67
|
+
props.triggerSlot
|
|
68
|
+
) : (
|
|
69
|
+
<>
|
|
70
|
+
<span class="flex items-center gap-2">
|
|
71
|
+
{props.icon ? <span class={props.icon} aria-hidden="true" /> : null}
|
|
72
|
+
{props.label ?? "Toggle"}
|
|
73
|
+
</span>
|
|
74
|
+
<RLSIcon
|
|
75
|
+
name="chevronDown"
|
|
76
|
+
size="sm"
|
|
77
|
+
class={`transition-transform duration-200 ${isOpen() ? "rotate-180" : ""}`}
|
|
78
|
+
/>
|
|
79
|
+
</>
|
|
80
|
+
)}
|
|
81
|
+
</summary>
|
|
82
|
+
<div class={resolvedClasses().content} data-slot="content">
|
|
83
|
+
{props.children}
|
|
84
|
+
</div>
|
|
85
|
+
</details>
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export default RLSCollapsible
|