@rimelight/ui 0.0.24 → 0.0.26
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/package.json +7 -3
- package/src/components/Head.astro +199 -156
- package/src/components/ThemeToggle.astro +2 -2
- package/src/components/astro/RLAAccordion.astro +22 -0
- package/src/components/astro/RLAButton.astro +104 -118
- package/src/components/astro/RLAFooter.astro +17 -43
- package/src/components/astro/RLAHeader.astro +21 -80
- package/src/components/astro/RLAIcon.astro +14 -39
- package/src/components/astro/RLALogo.astro +14 -48
- package/src/components/astro/RLAPlaceholder.astro +11 -35
- package/src/components/astro/RLAQuote.astro +15 -0
- package/src/components/astro/RLAScrollToTop.astro +171 -221
- package/src/components/astro/RLASection.astro +210 -0
- package/src/components/vue/RLVButton.vue +166 -139
- package/src/components/vue/RLVFooter.vue +17 -54
- package/src/components/vue/RLVHeader.vue +22 -105
- package/src/components/vue/RLVIcon.vue +14 -45
- package/src/components/vue/RLVLogo.vue +11 -58
- package/src/components/vue/RLVPlaceholder.vue +14 -35
- package/src/components/vue/RLVScrollToTop.vue +18 -89
- package/src/components/vue/RLVSection.vue +166 -0
- package/src/composables/index.ts +0 -1
- package/src/env.d.ts +5 -0
- package/src/integrations/ui.ts +2 -6
- package/src/plugins/index.ts +5 -2
- package/src/plugins/starlightAddons/index.ts +3 -64
- package/src/plugins/starlightDocsApi/components/ApiEmits.astro +46 -0
- package/src/plugins/starlightDocsApi/components/ApiProps.astro +47 -0
- package/src/plugins/starlightDocsApi/components/ApiSlots.astro +50 -0
- package/src/plugins/starlightDocsApi/components/ApiTheme.astro +27 -0
- package/src/plugins/starlightDocsApi/extract-vue.ts +286 -0
- package/src/plugins/starlightDocsApi/index.ts +265 -0
- package/src/plugins/starlightDocsApi/types.ts +40 -0
- package/src/plugins/starlightDocsApi/utils.ts +45 -0
- package/src/themes/button.theme.ts +29 -14
- package/src/themes/footer.theme.ts +4 -6
- package/src/themes/header.theme.ts +4 -28
- package/src/themes/icon.theme.ts +4 -2
- package/src/themes/index.ts +15 -20
- package/src/themes/logo.theme.ts +4 -2
- package/src/themes/placeholder.theme.ts +4 -6
- package/src/themes/scroll-to-top.theme.ts +4 -6
- package/src/themes/section.theme.ts +187 -0
- package/src/types/componentVariant.ts +14 -0
- package/src/types/index.ts +1 -0
- package/src/utils/defineTheme.ts +11 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/resolveClasses.ts +21 -0
- package/src/utils/useUi.ts +19 -0
- package/src/composables/useUi.ts +0 -27
- package/src/plugins/starlightAddons/Sidebar.astro +0 -89
- package/src/plugins/starlightAddons/data.ts +0 -39
- package/src/plugins/starlightAddons/libs/config.ts +0 -107
- package/src/plugins/starlightAddons/libs/content.ts +0 -20
- package/src/plugins/starlightAddons/libs/i18n.ts +0 -51
- package/src/plugins/starlightAddons/libs/locals.ts +0 -12
- package/src/plugins/starlightAddons/libs/pathname.ts +0 -22
- package/src/plugins/starlightAddons/libs/plugin.ts +0 -9
- package/src/plugins/starlightAddons/libs/sidebar.ts +0 -183
- package/src/plugins/starlightAddons/libs/vite.ts +0 -46
- package/src/plugins/starlightAddons/locals.d.ts +0 -14
- package/src/plugins/starlightAddons/middleware.ts +0 -132
- package/src/plugins/starlightAddons/overrides/Sidebar.astro +0 -8
- package/src/plugins/starlightAddons/schema.ts +0 -13
- package/src/plugins/starlightAddons/virtual.d.ts +0 -13
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { scv } from "css-variants"
|
|
3
|
+
import { useUi, resolveClasses } from "../../utils"
|
|
4
|
+
import type { ComponentVariants, ComponentSlots } from "../../types"
|
|
5
|
+
import sectionTheme from "../../themes/section.theme"
|
|
6
|
+
import type { RLAIconProps } from "./RLAIcon.astro"
|
|
7
|
+
import type { RLAButtonProps } from "./RLAButton.astro"
|
|
8
|
+
import RLAIcon from "./RLAIcon.astro"
|
|
9
|
+
import RLAButton from "./RLAButton.astro"
|
|
10
|
+
|
|
11
|
+
const section = scv(sectionTheme)
|
|
12
|
+
type SectionVariants = ComponentVariants<typeof sectionTheme>
|
|
13
|
+
|
|
14
|
+
export interface RLASectionProps {
|
|
15
|
+
/**
|
|
16
|
+
* The element or component this component should render as.
|
|
17
|
+
* @default 'section'
|
|
18
|
+
*/
|
|
19
|
+
as?: any;
|
|
20
|
+
/**
|
|
21
|
+
* The variant of the section.
|
|
22
|
+
* @default 'default'
|
|
23
|
+
*/
|
|
24
|
+
variant?: SectionVariants['variant'];
|
|
25
|
+
/** The variant of the section when it's a CTA.
|
|
26
|
+
* @default 'solid'
|
|
27
|
+
*/
|
|
28
|
+
ctaVariant?: SectionVariants['ctaVariant'];
|
|
29
|
+
/**
|
|
30
|
+
* The headline displayed above the title.
|
|
31
|
+
*/
|
|
32
|
+
headline?: string;
|
|
33
|
+
/**
|
|
34
|
+
* The icon displayed above the title.
|
|
35
|
+
*/
|
|
36
|
+
icon?: RLAIconProps["name"];
|
|
37
|
+
/**
|
|
38
|
+
* The section's title, displayed as a <h1> for the hero variant or <h2> otherwise.
|
|
39
|
+
*/
|
|
40
|
+
title?: string;
|
|
41
|
+
/**
|
|
42
|
+
* The section's description, displayed under the title.
|
|
43
|
+
*/
|
|
44
|
+
description?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Display a list of buttons under the description.
|
|
47
|
+
*/
|
|
48
|
+
links?: RLAButtonProps[]
|
|
49
|
+
/**
|
|
50
|
+
* The orientation of the section.
|
|
51
|
+
* @default 'vertical'
|
|
52
|
+
*/
|
|
53
|
+
orientation?: SectionVariants['orientation'];
|
|
54
|
+
/**
|
|
55
|
+
* Reverse the order of the default slot.
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
reverse?: boolean;
|
|
59
|
+
ui?: ComponentSlots<typeof sectionTheme>;
|
|
60
|
+
class?: any;
|
|
61
|
+
[key: string]: unknown;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const {
|
|
65
|
+
as = "section",
|
|
66
|
+
variant = "default",
|
|
67
|
+
orientation = "vertical",
|
|
68
|
+
reverse = false,
|
|
69
|
+
ctaVariant = "solid",
|
|
70
|
+
ui: uiProp,
|
|
71
|
+
class: className,
|
|
72
|
+
...rest
|
|
73
|
+
} = Astro.props as RLASectionProps;
|
|
74
|
+
|
|
75
|
+
const classes = resolveClasses(section, {
|
|
76
|
+
variant,
|
|
77
|
+
orientation,
|
|
78
|
+
reverse,
|
|
79
|
+
...(variant === "cta" && { ctaVariant }),
|
|
80
|
+
headline: !!(Astro.slots.has("headline") || Astro.props.headline),
|
|
81
|
+
title: !!(Astro.slots.has("title") || Astro.props.title),
|
|
82
|
+
description: !!(Astro.slots.has("description") || Astro.props.description),
|
|
83
|
+
body: Astro.slots.has("body")
|
|
84
|
+
}, useUi("section", uiProp), className);
|
|
85
|
+
|
|
86
|
+
const hasDefaultSlot = Astro.slots.has("default");
|
|
87
|
+
|
|
88
|
+
const Tag = as;
|
|
89
|
+
const TitleTag = variant === "hero" ? "h1" : "h2";
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
<Tag
|
|
93
|
+
data-orientation={orientation}
|
|
94
|
+
data-slot="root"
|
|
95
|
+
class:list={[classes.root]}
|
|
96
|
+
{...rest}
|
|
97
|
+
>
|
|
98
|
+
{Astro.slots.has("background") && (
|
|
99
|
+
<div class:list={[classes.background]} data-slot="background">
|
|
100
|
+
<slot name="background" />
|
|
101
|
+
</div>
|
|
102
|
+
)}
|
|
103
|
+
|
|
104
|
+
<slot name="top" />
|
|
105
|
+
|
|
106
|
+
<div
|
|
107
|
+
data-slot="container"
|
|
108
|
+
class:list={[classes.container]}
|
|
109
|
+
>
|
|
110
|
+
{(Astro.slots.has("header") || Astro.props.icon || Astro.props.headline || Astro.props.title || Astro.props.description || Astro.slots.has("body") || Astro.slots.has("footer") || Astro.slots.has("links") || Astro.props.links?.length) && (
|
|
111
|
+
<div
|
|
112
|
+
data-slot="wrapper"
|
|
113
|
+
class:list={[classes.wrapper]}
|
|
114
|
+
>
|
|
115
|
+
{(Astro.slots.has("header") || Astro.props.icon || Astro.props.headline || Astro.props.title || Astro.props.description) && (
|
|
116
|
+
<div
|
|
117
|
+
data-slot="header"
|
|
118
|
+
class:list={[classes.header]}
|
|
119
|
+
>
|
|
120
|
+
<slot name="header">
|
|
121
|
+
{(Astro.props.icon || Astro.slots.has("leading")) && (
|
|
122
|
+
<div
|
|
123
|
+
data-slot="leading"
|
|
124
|
+
class:list={[classes.leading]}
|
|
125
|
+
>
|
|
126
|
+
<slot name="leading" {...{ ui: classes }}>
|
|
127
|
+
{Astro.props.icon && (
|
|
128
|
+
<RLAIcon name={Astro.props.icon} size="md" ui={{ root: classes.leadingIcon }} />
|
|
129
|
+
)}
|
|
130
|
+
</slot>
|
|
131
|
+
</div>
|
|
132
|
+
)}
|
|
133
|
+
|
|
134
|
+
{(Astro.props.headline || Astro.slots.has("headline")) && (
|
|
135
|
+
<div
|
|
136
|
+
data-slot="headline"
|
|
137
|
+
class:list={[classes.headline]}
|
|
138
|
+
>
|
|
139
|
+
<slot name="headline">
|
|
140
|
+
{Astro.props.headline}
|
|
141
|
+
</slot>
|
|
142
|
+
</div>
|
|
143
|
+
)}
|
|
144
|
+
|
|
145
|
+
{(Astro.props.title || Astro.slots.has("title")) && (
|
|
146
|
+
<TitleTag
|
|
147
|
+
data-slot="title"
|
|
148
|
+
class:list={[classes.title]}
|
|
149
|
+
>
|
|
150
|
+
<slot name="title">
|
|
151
|
+
{Astro.props.title}
|
|
152
|
+
</slot>
|
|
153
|
+
</TitleTag>
|
|
154
|
+
)}
|
|
155
|
+
|
|
156
|
+
{(Astro.props.description || Astro.slots.has("description")) && (
|
|
157
|
+
<div
|
|
158
|
+
data-slot="description"
|
|
159
|
+
class:list={[classes.description]}
|
|
160
|
+
>
|
|
161
|
+
<slot name="description">
|
|
162
|
+
{Astro.props.description}
|
|
163
|
+
</slot>
|
|
164
|
+
</div>
|
|
165
|
+
)}
|
|
166
|
+
</slot>
|
|
167
|
+
</div>
|
|
168
|
+
)}
|
|
169
|
+
|
|
170
|
+
{Astro.slots.has("body") && (
|
|
171
|
+
<div
|
|
172
|
+
data-slot="body"
|
|
173
|
+
class:list={[classes.body]}
|
|
174
|
+
>
|
|
175
|
+
<slot name="body" />
|
|
176
|
+
</div>
|
|
177
|
+
)}
|
|
178
|
+
|
|
179
|
+
{(Astro.slots.has("footer") || Astro.slots.has("links") || Astro.props.links?.length) && (
|
|
180
|
+
<div
|
|
181
|
+
data-slot="footer"
|
|
182
|
+
class:list={[classes.footer]}
|
|
183
|
+
>
|
|
184
|
+
<slot name="footer">
|
|
185
|
+
{(Astro.props.links?.length || Astro.slots.has("links")) && (
|
|
186
|
+
<div
|
|
187
|
+
data-slot="links"
|
|
188
|
+
class:list={[classes.links]}
|
|
189
|
+
>
|
|
190
|
+
{Astro.props.links?.map((link) => (
|
|
191
|
+
<RLAButton size="lg" {...link} />
|
|
192
|
+
))}
|
|
193
|
+
<slot name="links" />
|
|
194
|
+
</div>
|
|
195
|
+
)}
|
|
196
|
+
</slot>
|
|
197
|
+
</div>
|
|
198
|
+
)}
|
|
199
|
+
</div>
|
|
200
|
+
)}
|
|
201
|
+
|
|
202
|
+
{hasDefaultSlot ? (
|
|
203
|
+
<slot />
|
|
204
|
+
) : orientation === "horizontal" ? (
|
|
205
|
+
<div class="hidden lg:block" />
|
|
206
|
+
) : null}
|
|
207
|
+
</div>
|
|
208
|
+
|
|
209
|
+
<slot name="bottom" />
|
|
210
|
+
</Tag>
|
|
@@ -1,139 +1,166 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed, useSlots } from "vue"
|
|
3
|
-
import { scv
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, useSlots } from "vue"
|
|
3
|
+
import { scv } from "css-variants"
|
|
4
|
+
import { useUi, resolveClasses } from "../../utils"
|
|
5
|
+
import type { ComponentVariants, ComponentSlots } from "../../types"
|
|
6
|
+
import buttonTheme from "../../themes/button.theme"
|
|
7
|
+
|
|
8
|
+
const button = scv(buttonTheme)
|
|
9
|
+
type ButtonVariants = ComponentVariants<typeof buttonTheme>
|
|
10
|
+
|
|
11
|
+
export interface RLVButtonProps {
|
|
12
|
+
/**
|
|
13
|
+
* The visual style variant of the button
|
|
14
|
+
*/
|
|
15
|
+
variant?: ButtonVariants["variant"]
|
|
16
|
+
/**
|
|
17
|
+
* The color scheme applied to the button
|
|
18
|
+
*/
|
|
19
|
+
color?: ButtonVariants["color"]
|
|
20
|
+
/**
|
|
21
|
+
* The size scale of the button
|
|
22
|
+
*/
|
|
23
|
+
size?: ButtonVariants["size"]
|
|
24
|
+
/**
|
|
25
|
+
* When provided, renders the button as an anchor link
|
|
26
|
+
*/
|
|
27
|
+
href?: string
|
|
28
|
+
/**
|
|
29
|
+
* The text label displayed inside the button
|
|
30
|
+
*/
|
|
31
|
+
label?: string
|
|
32
|
+
/**
|
|
33
|
+
* Icon name displayed before the label
|
|
34
|
+
*/
|
|
35
|
+
leadingIcon?: string
|
|
36
|
+
/**
|
|
37
|
+
* Icon name displayed after the label
|
|
38
|
+
*/
|
|
39
|
+
trailingIcon?: string
|
|
40
|
+
/**
|
|
41
|
+
* Shows a loading spinner animation
|
|
42
|
+
*/
|
|
43
|
+
loading?: boolean
|
|
44
|
+
/**
|
|
45
|
+
* Renders a square button with equal padding
|
|
46
|
+
*/
|
|
47
|
+
square?: boolean
|
|
48
|
+
/**
|
|
49
|
+
* Makes the button stretch to full width
|
|
50
|
+
*/
|
|
51
|
+
block?: boolean
|
|
52
|
+
/**
|
|
53
|
+
* Applies active state styling
|
|
54
|
+
*/
|
|
55
|
+
active?: boolean
|
|
56
|
+
/**
|
|
57
|
+
* Color used when button is in active state
|
|
58
|
+
*/
|
|
59
|
+
activeColor?: ButtonVariants["color"]
|
|
60
|
+
/**
|
|
61
|
+
* Variant used when button is in active state
|
|
62
|
+
*/
|
|
63
|
+
activeVariant?: ButtonVariants["variant"]
|
|
64
|
+
/**
|
|
65
|
+
* Component-specific CSS class overrides
|
|
66
|
+
*/
|
|
67
|
+
ui?: ComponentSlots<typeof buttonTheme>
|
|
68
|
+
class?: any
|
|
69
|
+
[key: string]: unknown
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const {
|
|
73
|
+
variant = "solid",
|
|
74
|
+
color = "primary",
|
|
75
|
+
size = "md",
|
|
76
|
+
href,
|
|
77
|
+
label,
|
|
78
|
+
leadingIcon,
|
|
79
|
+
trailingIcon,
|
|
80
|
+
loading = false,
|
|
81
|
+
square = false,
|
|
82
|
+
block = false,
|
|
83
|
+
active = false,
|
|
84
|
+
activeColor,
|
|
85
|
+
activeVariant,
|
|
86
|
+
ui: uiProp,
|
|
87
|
+
class: className
|
|
88
|
+
} = defineProps<RLVButtonProps>()
|
|
89
|
+
|
|
90
|
+
const slots = useSlots()
|
|
91
|
+
|
|
92
|
+
const isLeading = computed(() => !!(leadingIcon || slots.leading) || loading)
|
|
93
|
+
const isTrailing = computed(
|
|
94
|
+
() => !!(trailingIcon || slots.trailing) || (loading && !isLeading.value)
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
const showLeadingIcon = computed(() => {
|
|
98
|
+
if (loading) return "i-lucide-loader-circle"
|
|
99
|
+
return leadingIcon
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
const showTrailingIcon = computed(() => {
|
|
103
|
+
if (loading) return "i-lucide-loader-circle"
|
|
104
|
+
return trailingIcon
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
const leadingIconClass = computed(() => {
|
|
108
|
+
return loading && isLeading.value ? "animate-spin" : ""
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
const trailingIconClass = computed(() => {
|
|
112
|
+
return loading && isTrailing.value ? "animate-spin" : ""
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
defineSlots<{
|
|
116
|
+
default(props: { ui: Record<string, string> }): any
|
|
117
|
+
leading(props: { ui: Record<string, string> }): any
|
|
118
|
+
trailing(props: { ui: Record<string, string> }): any
|
|
119
|
+
}>()
|
|
120
|
+
|
|
121
|
+
const resolvedClasses = computed(() =>
|
|
122
|
+
resolveClasses(
|
|
123
|
+
button,
|
|
124
|
+
{
|
|
125
|
+
variant: active && activeVariant ? activeVariant : variant,
|
|
126
|
+
color: active && activeColor ? activeColor : color,
|
|
127
|
+
size,
|
|
128
|
+
block,
|
|
129
|
+
square: square || (!label && !slots.default),
|
|
130
|
+
leading: isLeading.value,
|
|
131
|
+
trailing: isTrailing.value,
|
|
132
|
+
loading,
|
|
133
|
+
active
|
|
134
|
+
},
|
|
135
|
+
useUi("button", uiProp),
|
|
136
|
+
className
|
|
137
|
+
)
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
const Tag = href ? "a" : "button"
|
|
141
|
+
</script>
|
|
142
|
+
|
|
143
|
+
<template>
|
|
144
|
+
<component v-bind="$attrs" :is="Tag" :href="href" :class="resolvedClasses.root" data-slot="root">
|
|
145
|
+
<slot name="leading" :ui="resolvedClasses">
|
|
146
|
+
<span v-if="isLeading" :class="resolvedClasses.leadingIcon" data-slot="leading-icon">
|
|
147
|
+
<span :class="[showLeadingIcon, leadingIconClass]" aria-hidden="true" />
|
|
148
|
+
</span>
|
|
149
|
+
</slot>
|
|
150
|
+
|
|
151
|
+
<span
|
|
152
|
+
v-if="label !== undefined && label !== null"
|
|
153
|
+
:class="resolvedClasses.label"
|
|
154
|
+
data-slot="label"
|
|
155
|
+
>
|
|
156
|
+
{{ label }}
|
|
157
|
+
</span>
|
|
158
|
+
<slot v-else />
|
|
159
|
+
|
|
160
|
+
<slot name="trailing" :ui="resolvedClasses">
|
|
161
|
+
<span v-if="isTrailing" :class="resolvedClasses.trailingIcon" data-slot="trailing-icon">
|
|
162
|
+
<span :class="[showTrailingIcon, trailingIconClass]" aria-hidden="true" />
|
|
163
|
+
</span>
|
|
164
|
+
</slot>
|
|
165
|
+
</component>
|
|
166
|
+
</template>
|
|
@@ -1,79 +1,42 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed } from "vue"
|
|
3
|
-
import { scv
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
3
|
+
import { scv } from "css-variants"
|
|
4
|
+
import { useUi, resolveClasses } from "../../utils"
|
|
5
|
+
import type { ComponentVariants, ComponentSlots } from "../../types"
|
|
6
|
+
import footerTheme from "../../themes/footer.theme"
|
|
7
7
|
|
|
8
|
-
const footer = scv(
|
|
9
|
-
|
|
10
|
-
base: footerTheme.base,
|
|
11
|
-
variants: footerTheme.variants,
|
|
12
|
-
defaultVariants: footerTheme.defaultVariants,
|
|
13
|
-
classNameResolver: (...args) => twMerge(cx(...args))
|
|
14
|
-
})
|
|
8
|
+
const footer = scv(footerTheme)
|
|
9
|
+
type FooterVariants = ComponentVariants<typeof footerTheme>
|
|
15
10
|
|
|
16
11
|
export interface RLVFooterProps {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
* @default false
|
|
21
|
-
*/
|
|
22
|
-
contain?: boolean
|
|
23
|
-
/**
|
|
24
|
-
* UI overrides for individual slots, derived from the footer theme.
|
|
25
|
-
*/
|
|
26
|
-
ui?: Partial<Record<keyof typeof footerTheme.base, string>>
|
|
27
|
-
/**
|
|
28
|
-
* External class — applied to the root element.
|
|
29
|
-
*/
|
|
30
|
-
class?: string
|
|
12
|
+
contain?: FooterVariants["contain"]
|
|
13
|
+
ui?: ComponentSlots<typeof footerTheme>
|
|
14
|
+
class?: any
|
|
31
15
|
}
|
|
32
16
|
|
|
33
|
-
const { contain = false,
|
|
17
|
+
const { contain = false, ui: uiProp, class: className } = defineProps<RLVFooterProps>()
|
|
34
18
|
|
|
35
19
|
defineSlots<{
|
|
36
|
-
/**
|
|
37
|
-
* Content to display on the left side of the footer.
|
|
38
|
-
*/
|
|
39
20
|
left(props: {}): any
|
|
40
|
-
/**
|
|
41
|
-
* Content to display in the center of the footer.
|
|
42
|
-
*/
|
|
43
21
|
center(props: {}): any
|
|
44
|
-
/**
|
|
45
|
-
* Content to display on the right side of the footer.
|
|
46
|
-
*/
|
|
47
22
|
right(props: {}): any
|
|
48
23
|
}>()
|
|
49
24
|
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const classes = footer({
|
|
54
|
-
contain
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
return {
|
|
58
|
-
root: twMerge(classes.root, mergedUI.value.root as string | undefined),
|
|
59
|
-
container: twMerge(classes.container, mergedUI.value.container as string | undefined),
|
|
60
|
-
left: twMerge(classes.left, mergedUI.value.left as string | undefined),
|
|
61
|
-
center: twMerge(classes.center, mergedUI.value.center as string | undefined),
|
|
62
|
-
right: twMerge(classes.right, mergedUI.value.right as string | undefined)
|
|
63
|
-
}
|
|
64
|
-
})
|
|
25
|
+
const resolvedClasses = computed(() =>
|
|
26
|
+
resolveClasses(footer, { contain }, useUi("footer", uiProp), className)
|
|
27
|
+
)
|
|
65
28
|
</script>
|
|
66
29
|
|
|
67
30
|
<template>
|
|
68
|
-
<footer :class="[resolvedClasses.root
|
|
31
|
+
<footer :class="[resolvedClasses.root]" data-slot="root" v-bind="$attrs">
|
|
69
32
|
<div :class="resolvedClasses.container">
|
|
70
|
-
<div :class="resolvedClasses.left" data-slot="
|
|
33
|
+
<div :class="resolvedClasses.left" data-slot="left">
|
|
71
34
|
<slot name="left" />
|
|
72
35
|
</div>
|
|
73
|
-
<div :class="resolvedClasses.center" data-slot="
|
|
36
|
+
<div :class="resolvedClasses.center" data-slot="center">
|
|
74
37
|
<slot name="center" />
|
|
75
38
|
</div>
|
|
76
|
-
<div :class="resolvedClasses.right" data-slot="
|
|
39
|
+
<div :class="resolvedClasses.right" data-slot="right">
|
|
77
40
|
<slot name="right" />
|
|
78
41
|
</div>
|
|
79
42
|
</div>
|