@rimelight/ui 0.0.25 → 0.0.27

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.
@@ -1,181 +1,210 @@
1
- ---
2
- import { scv } from "css-variants"
3
- import { useUi, resolveClasses } from "../../utils"
4
- import type { ComponentVariants } from "../../types"
5
- import sectionTheme from "../../themes/section.theme"
6
-
7
- const section = scv(sectionTheme)
8
- type SectionVariants = ComponentVariants<typeof sectionTheme>
9
-
10
- export interface RLASectionProps {
11
- as?: string;
12
- variant?: SectionVariants['variant'];
13
- headline?: string;
14
- icon?: string;
15
- title?: string;
16
- description?: string;
17
- orientation?: SectionVariants['orientation'];
18
- reverse?: boolean;
19
- ctaVariant?: SectionVariants['ctaVariant'];
20
- ui?: Partial<Record<string, string>>;
21
- class?: string;
22
- [key: string]: unknown;
23
- }
24
-
25
- const {
26
- as = "section",
27
- variant = "default",
28
- orientation = "vertical",
29
- reverse = false,
30
- ctaVariant = "outline",
31
- class: className,
32
- ui: uiProp,
33
- ...rest
34
- } = Astro.props as RLASectionProps;
35
-
36
- const classes = resolveClasses(section, {
37
- variant,
38
- orientation,
39
- reverse,
40
- ...(variant === "cta" && { ctaVariant }),
41
- headline: Astro.slots.has("headline") || Astro.props.headline,
42
- title: Astro.slots.has("title") || Astro.props.title,
43
- description: Astro.slots.has("description") || Astro.props.description,
44
- body: Astro.slots.has("body") || Astro.slots.has("features")
45
- }, useUi("section", uiProp), className);
46
-
47
- const Tag = as;
48
- ---
49
-
50
- <Tag
51
- data-orientation={orientation}
52
- data-slot="rla-section"
53
- class:list={[classes.root]}
54
- {...rest}
55
- >
56
- <slot name="background">
57
- {Astro.slots.has("background") && (
58
- <div class:list={[classes.background]} data-slot="background">
59
- <slot name="background" />
60
- </div>
61
- )}
62
- </slot>
63
-
64
- <slot name="top" />
65
-
66
- <div
67
- data-slot="container"
68
- class:list={[classes.container]}
69
- >
70
- {(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.slots.has("features")) && (
71
- <div
72
- data-slot="wrapper"
73
- class:list={[classes.wrapper]}
74
- >
75
- {(Astro.slots.has("header") || Astro.props.icon || Astro.props.headline || Astro.props.title || Astro.props.description) && (
76
- <div
77
- data-slot="header"
78
- class:list={[classes.header]}
79
- >
80
- <slot name="header">
81
- {(Astro.props.icon || Astro.slots.has("leading")) && (
82
- <div
83
- data-slot="leading"
84
- class:list={[classes.leading]}
85
- >
86
- <slot name="leading" {...{ ui: classes }}>
87
- {Astro.props.icon && (
88
- <span
89
- class:list={[classes.leadingIcon]}
90
- data-slot="leading-icon"
91
- >
92
- <span class={Astro.props.icon} aria-hidden="true" />
93
- </span>
94
- )}
95
- </slot>
96
- </div>
97
- )}
98
-
99
- {(Astro.props.headline || Astro.slots.has("headline")) && (
100
- <div
101
- data-slot="headline"
102
- class:list={[classes.headline]}
103
- >
104
- <slot name="headline">
105
- {Astro.props.headline}
106
- </slot>
107
- </div>
108
- )}
109
-
110
- {(Astro.props.title || Astro.slots.has("title")) && (
111
- <component
112
- is={variant === "hero" ? "h1" : "h2"}
113
- data-slot="title"
114
- class:list={[classes.title]}
115
- >
116
- <slot name="title">
117
- {Astro.props.title}
118
- </slot>
119
- </component>
120
- )}
121
-
122
- {(Astro.props.description || Astro.slots.has("description")) && (
123
- <div
124
- data-slot="description"
125
- class:list={[classes.description]}
126
- >
127
- <slot name="description">
128
- {Astro.props.description}
129
- </slot>
130
- </div>
131
- )}
132
- </slot>
133
- </div>
134
- )}
135
-
136
- {(Astro.slots.has("body") || Astro.slots.has("features")) && (
137
- <div
138
- data-slot="body"
139
- class:list={[classes.body]}
140
- >
141
- <slot name="body">
142
- {Astro.slots.has("features") && (
143
- <ul
144
- data-slot="features"
145
- class:list={[classes.features]}
146
- >
147
- <slot name="features" />
148
- </ul>
149
- )}
150
- </slot>
151
- </div>
152
- )}
153
-
154
- {(Astro.slots.has("footer") || Astro.slots.has("links")) && (
155
- <div
156
- data-slot="footer"
157
- class:list={[classes.footer]}
158
- >
159
- <slot name="footer">
160
- {Astro.slots.has("links") && (
161
- <div
162
- data-slot="links"
163
- class:list={[classes.links]}
164
- >
165
- <slot name="links" />
166
- </div>
167
- )}
168
- </slot>
169
- </div>
170
- )}
171
- </div>
172
- )}
173
-
174
- <slot />
175
- {orientation === "horizontal" && (
176
- <div class="hidden lg:block" />
177
- )}
178
- </div>
179
-
180
- <slot name="bottom" />
181
- </Tag>
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>
@@ -2,7 +2,7 @@
2
2
  import { computed, useSlots } from "vue"
3
3
  import { scv } from "css-variants"
4
4
  import { useUi, resolveClasses } from "../../utils"
5
- import type { ComponentVariants } from "../../types"
5
+ import type { ComponentVariants, ComponentSlots } from "../../types"
6
6
  import buttonTheme from "../../themes/button.theme"
7
7
 
8
8
  const button = scv(buttonTheme)
@@ -64,8 +64,8 @@ export interface RLVButtonProps {
64
64
  /**
65
65
  * Component-specific CSS class overrides
66
66
  */
67
- ui?: Partial<Record<string, string>>
68
- class?: string
67
+ ui?: ComponentSlots<typeof buttonTheme>
68
+ class?: any
69
69
  [key: string]: unknown
70
70
  }
71
71
 
@@ -73,8 +73,6 @@ const {
73
73
  variant = "solid",
74
74
  color = "primary",
75
75
  size = "md",
76
- class: className,
77
- ui: uiProp,
78
76
  href,
79
77
  label,
80
78
  leadingIcon,
@@ -84,7 +82,9 @@ const {
84
82
  block = false,
85
83
  active = false,
86
84
  activeColor,
87
- activeVariant
85
+ activeVariant,
86
+ ui: uiProp,
87
+ class: className
88
88
  } = defineProps<RLVButtonProps>()
89
89
 
90
90
  const slots = useSlots()
@@ -141,13 +141,7 @@ const Tag = href ? "a" : "button"
141
141
  </script>
142
142
 
143
143
  <template>
144
- <component
145
- v-bind="$attrs"
146
- :is="Tag"
147
- :href="href"
148
- :class="resolvedClasses.root"
149
- data-slot="rlv-button"
150
- >
144
+ <component v-bind="$attrs" :is="Tag" :href="href" :class="resolvedClasses.root" data-slot="root">
151
145
  <slot name="leading" :ui="resolvedClasses">
152
146
  <span v-if="isLeading" :class="resolvedClasses.leadingIcon" data-slot="leading-icon">
153
147
  <span :class="[showLeadingIcon, leadingIconClass]" aria-hidden="true" />
@@ -2,7 +2,7 @@
2
2
  import { computed } from "vue"
3
3
  import { scv } from "css-variants"
4
4
  import { useUi, resolveClasses } from "../../utils"
5
- import type { ComponentVariants } from "../../types"
5
+ import type { ComponentVariants, ComponentSlots } from "../../types"
6
6
  import footerTheme from "../../themes/footer.theme"
7
7
 
8
8
  const footer = scv(footerTheme)
@@ -10,11 +10,11 @@ type FooterVariants = ComponentVariants<typeof footerTheme>
10
10
 
11
11
  export interface RLVFooterProps {
12
12
  contain?: FooterVariants["contain"]
13
- ui?: Partial<Record<string, string>>
14
- class?: string
13
+ ui?: ComponentSlots<typeof footerTheme>
14
+ class?: any
15
15
  }
16
16
 
17
- const { contain = false, class: className, ui: uiProp } = defineProps<RLVFooterProps>()
17
+ const { contain = false, ui: uiProp, class: className } = defineProps<RLVFooterProps>()
18
18
 
19
19
  defineSlots<{
20
20
  left(props: {}): any
@@ -28,15 +28,15 @@ const resolvedClasses = computed(() =>
28
28
  </script>
29
29
 
30
30
  <template>
31
- <footer :class="[resolvedClasses.root]" data-slot="rlv-footer" v-bind="$attrs">
31
+ <footer :class="[resolvedClasses.root]" data-slot="root" v-bind="$attrs">
32
32
  <div :class="resolvedClasses.container">
33
- <div :class="resolvedClasses.left" data-slot="footer-left">
33
+ <div :class="resolvedClasses.left" data-slot="left">
34
34
  <slot name="left" />
35
35
  </div>
36
- <div :class="resolvedClasses.center" data-slot="footer-center">
36
+ <div :class="resolvedClasses.center" data-slot="center">
37
37
  <slot name="center" />
38
38
  </div>
39
- <div :class="resolvedClasses.right" data-slot="footer-right">
39
+ <div :class="resolvedClasses.right" data-slot="right">
40
40
  <slot name="right" />
41
41
  </div>
42
42
  </div>
@@ -2,7 +2,7 @@
2
2
  import { computed, onMounted, onUnmounted, ref } from "vue"
3
3
  import { scv } from "css-variants"
4
4
  import { useUi, resolveClasses } from "../../utils"
5
- import type { ComponentVariants } from "../../types"
5
+ import type { ComponentVariants, ComponentSlots } from "../../types"
6
6
  import headerTheme from "../../themes/header.theme"
7
7
  import { getHeaderStack } from "../../utils/headerStack"
8
8
 
@@ -15,8 +15,8 @@ export interface RLVHeaderProps {
15
15
  fixed?: HeaderVariants["fixed"]
16
16
  stackIndex?: number
17
17
  hideOnScroll?: boolean
18
- ui?: Partial<Record<string, string>>
19
- class?: string
18
+ ui?: ComponentSlots<typeof headerTheme>
19
+ class?: any
20
20
  }
21
21
 
22
22
  const {
@@ -25,8 +25,8 @@ const {
25
25
  fixed = false,
26
26
  stackIndex = 0,
27
27
  hideOnScroll = false,
28
- class: className,
29
- ui: uiProp
28
+ ui: uiProp,
29
+ class: className
30
30
  } = defineProps<RLVHeaderProps>()
31
31
 
32
32
  defineSlots<{
@@ -112,18 +112,18 @@ onUnmounted(() => {
112
112
  :id="id"
113
113
  :class="[resolvedClasses.root]"
114
114
  :style="fixedStyle"
115
- data-slot="rlv-header"
115
+ data-slot="root"
116
116
  v-bind="$attrs"
117
117
  >
118
118
  <div ref="contentRef" :class="resolvedClasses.content">
119
119
  <div :class="resolvedClasses.container">
120
- <div :class="resolvedClasses.left" data-slot="header-left">
120
+ <div :class="resolvedClasses.left" data-slot="left">
121
121
  <slot name="left" />
122
122
  </div>
123
- <div :class="resolvedClasses.center" data-slot="header-center">
123
+ <div :class="resolvedClasses.center" data-slot="center">
124
124
  <slot name="center" />
125
125
  </div>
126
- <div :class="resolvedClasses.right" data-slot="header-right">
126
+ <div :class="resolvedClasses.right" data-slot="right">
127
127
  <slot name="right" />
128
128
  </div>
129
129
  </div>
@@ -2,7 +2,7 @@
2
2
  import { computed } from "vue"
3
3
  import { scv } from "css-variants"
4
4
  import { useUi, resolveClasses } from "../../utils"
5
- import type { ComponentVariants } from "../../types"
5
+ import type { ComponentVariants, ComponentSlots } from "../../types"
6
6
  import iconTheme from "../../themes/icon.theme"
7
7
 
8
8
  const icon = scv(iconTheme)
@@ -11,11 +11,11 @@ type IconVariants = ComponentVariants<typeof iconTheme>
11
11
  export interface RLVIconProps {
12
12
  name: string
13
13
  size?: IconVariants["size"]
14
- class?: string
15
- ui?: Partial<Record<string, string>>
14
+ ui?: ComponentSlots<typeof iconTheme>
15
+ class?: any
16
16
  }
17
17
 
18
- const { name, size = "md", class: className, ui: uiProp } = defineProps<RLVIconProps>()
18
+ const { name, size = "md", ui: uiProp, class: className } = defineProps<RLVIconProps>()
19
19
 
20
20
  const resolvedClasses = computed(() =>
21
21
  resolveClasses(icon, { size }, useUi("icon", uiProp), className)
@@ -27,12 +27,7 @@ defineSlots<{
27
27
  </script>
28
28
 
29
29
  <template>
30
- <span
31
- v-bind="$attrs"
32
- :class="[resolvedClasses.root, name]"
33
- data-slot="rlv-icon"
34
- aria-hidden="true"
35
- >
30
+ <span v-bind="$attrs" :class="[resolvedClasses.root, name]" data-slot="root" aria-hidden="true">
36
31
  <slot />
37
32
  </span>
38
33
  </template>
@@ -2,6 +2,7 @@
2
2
  import { computed } from "vue"
3
3
  import { scv } from "css-variants"
4
4
  import { useUi, resolveClasses } from "../../utils"
5
+ import type { ComponentSlots } from "../../types"
5
6
  import logoTheme from "../../themes/logo.theme"
6
7
  import { getUIConfig } from "virtual:rimelight-ui"
7
8
 
@@ -11,9 +12,9 @@ export interface RLVLogoProps {
11
12
  variant?: string
12
13
  mode?: "color" | "white" | "black"
13
14
  href?: string
14
- ui?: Partial<Record<string, string>>
15
- class?: string
16
15
  alt?: string
16
+ ui?: ComponentSlots<typeof logoTheme>
17
+ class?: any
17
18
  [key: string]: unknown
18
19
  }
19
20
 
@@ -64,7 +65,7 @@ const Tag = computed(() => (props.href ? "a" : "div"))
64
65
  :href="Tag === 'a' ? href : undefined"
65
66
  :aria-label="alt || variant"
66
67
  :class="resolvedClasses.root"
67
- data-slot="rlv-logo"
68
+ data-slot="root"
68
69
  >
69
70
  <template v-if="logoSrc">
70
71
  <span v-if="isIcon" :class="[logoSrc, 'size-full block shrink-0']" aria-hidden="true" />
@@ -2,17 +2,18 @@
2
2
  import { computed } from "vue"
3
3
  import { scv } from "css-variants"
4
4
  import { useUi, resolveClasses } from "../../utils"
5
+ import type { ComponentSlots } from "../../types"
5
6
  import placeholderTheme from "../../themes/placeholder.theme"
6
7
 
7
8
  const placeholder = scv(placeholderTheme)
8
9
 
9
10
  export interface RLVPlaceholderProps {
10
- ui?: Partial<Record<string, string>>
11
- class?: string
11
+ ui?: ComponentSlots<typeof placeholderTheme>
12
+ class?: any
12
13
  [key: string]: unknown
13
14
  }
14
15
 
15
- const { class: className, ui: uiProp } = defineProps<RLVPlaceholderProps>()
16
+ const { ui: uiProp, class: className } = defineProps<RLVPlaceholderProps>()
16
17
 
17
18
  defineSlots<{
18
19
  /**
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { scv } from "css-variants"
3
3
  import { useUi, resolveClasses } from "../../utils"
4
- import type { ComponentVariants } from "../../types"
4
+ import type { ComponentVariants, ComponentSlots } from "../../types"
5
5
  import scrollToTopTheme from "../../themes/scroll-to-top.theme"
6
6
  import { useScrollToTop } from "../../composables/useScrollToTop"
7
7
  import { computed } from "vue"
@@ -15,8 +15,8 @@ export interface RLVScrollToTopProps {
15
15
  duration?: number
16
16
  threshold?: number
17
17
  showProgress?: boolean
18
- ui?: Partial<Record<string, string>>
19
- class?: string
18
+ ui?: ComponentSlots<typeof scrollToTopTheme>
19
+ class?: any
20
20
  }
21
21
 
22
22
  const {