@rimelight/ui 0.0.57 → 0.0.60

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.
Files changed (46) hide show
  1. package/package.json +3 -4
  2. package/src/components/avatar/avatar.theme.ts +58 -1
  3. package/src/components/avatar/avatar.ts +21 -1
  4. package/src/components/avatar-group/RLAAvatarGroup.astro +37 -161
  5. package/src/components/avatar-group/RLSAvatarGroup.tsx +37 -121
  6. package/src/components/breadcrumb/RLABreadcrumb.astro +59 -196
  7. package/src/components/breadcrumb/RLSBreadcrumb.tsx +57 -120
  8. package/src/components/card/RLSCard.tsx +1 -2
  9. package/src/components/card/RLVCard.vue +1 -2
  10. package/src/components/carousel/RLACarousel.astro +2 -1
  11. package/src/components/carousel/RLSCarousel.tsx +3 -11
  12. package/src/components/chart/RLAChart.astro +211 -219
  13. package/src/components/dashboard-navbar/RLADashboardNavbar.astro +1 -1
  14. package/src/components/dashboard-navbar/RLSDashboardNavbar.tsx +1 -15
  15. package/src/components/dashboard-panel/RLADashboardPanel.astro +1 -1
  16. package/src/components/dashboard-panel/RLSDashboardPanel.tsx +1 -6
  17. package/src/components/dashboard-search/RLADashboardSearch.astro +1 -1
  18. package/src/components/head/UIHead.astro +1 -12
  19. package/src/components/image/RLAImage.astro +15 -20
  20. package/src/components/image/RLSImage.tsx +5 -12
  21. package/src/components/image/image.theme.ts +4 -4
  22. package/src/components/input-rating/RLAInputRating.astro +19 -14
  23. package/src/components/input-rating/RLSInputRating.tsx +39 -32
  24. package/src/components/input-tags/RLAInputTags.astro +27 -137
  25. package/src/components/layout-grid/RLALayoutGrid.astro +4 -4
  26. package/src/components/logo/RLALogo.astro +0 -16
  27. package/src/components/logo/RLSLogo.tsx +1 -8
  28. package/src/components/marquee/RLAMarquee.astro +55 -62
  29. package/src/components/page-section/RLAPageSection.astro +2 -2
  30. package/src/components/progress/RLAProgress.astro +39 -38
  31. package/src/components/progress/RLSProgress.tsx +16 -5
  32. package/src/components/progress/progress.theme.ts +1 -1
  33. package/src/components/scroll-area/RLAScrollArea.astro +4 -5
  34. package/src/components/scroll-area/RLSScrollArea.tsx +5 -6
  35. package/src/components/splitter/RLASplitter.astro +217 -230
  36. package/src/components/splitter/RLSSplitter.tsx +2 -6
  37. package/src/components/steps/RLASteps.astro +110 -110
  38. package/src/components/sticky-surface/RLAStickySurface.astro +49 -67
  39. package/src/components/table/RLATable.astro +16 -46
  40. package/src/components/tabs/RLATabs.astro +352 -385
  41. package/src/components/textarea/RLATextarea.astro +1 -2
  42. package/src/components/theme-selector/RLAThemeSelector.astro +6 -6
  43. package/src/components/timeline/RLATimeline.astro +49 -23
  44. package/src/components/timeline/RLSTimeline.tsx +38 -13
  45. package/src/components/timeline/timeline.ts +10 -0
  46. package/src/components/tooltip/RLATooltip.astro +7 -11
@@ -33,7 +33,7 @@ const classes = textareaTheme({
33
33
  back to the min-height defined in textarea.theme.ts.
34
34
  -->
35
35
  <textarea
36
- class={classes.textarea}
36
+ class:list={[classes.textarea, autoGrow && "[field-sizing:content] min-h-unset"]}
37
37
  data-slot="textarea"
38
38
  placeholder={placeholder}
39
39
  disabled={disabled}
@@ -41,7 +41,6 @@ const classes = textareaTheme({
41
41
  name={name}
42
42
  required={required}
43
43
  rows={autoGrow ? undefined : rows}
44
- style={autoGrow ? "field-sizing: content; min-height: unset;" : undefined}
45
44
  {...rest}
46
45
  >{value}</textarea>
47
46
  </div>
@@ -34,9 +34,9 @@ const items = [
34
34
  class={classes.select}
35
35
  >
36
36
  <span slot="leading" class="flex items-center">
37
- <RLAIcon name="i-lucide-laptop" class="rla-theme-icon-system size-4" style="display: block;" />
38
- <RLAIcon name="i-rl-sun" class="rla-theme-icon-light size-4" style="display: none;" />
39
- <RLAIcon name="i-rl-moon" class="rla-theme-icon-dark size-4" style="display: none;" />
37
+ <RLAIcon name="i-lucide-laptop" class="rla-theme-icon-system size-4 block" />
38
+ <RLAIcon name="i-rl-sun" class="rla-theme-icon-light size-4 hidden" />
39
+ <RLAIcon name="i-rl-moon" class="rla-theme-icon-dark size-4 hidden" />
40
40
  </span>
41
41
  </RLASelect>
42
42
  </div>
@@ -72,9 +72,9 @@ const items = [
72
72
  const sysIcons = this.querySelectorAll('.rla-theme-icon-system');
73
73
  const lightIcons = this.querySelectorAll('.rla-theme-icon-light');
74
74
  const darkIcons = this.querySelectorAll('.rla-theme-icon-dark');
75
- sysIcons.forEach(el => ((el as HTMLElement).style.display = next === 'system' ? 'block' : 'none'));
76
- lightIcons.forEach(el => ((el as HTMLElement).style.display = next === 'light' ? 'block' : 'none'));
77
- darkIcons.forEach(el => ((el as HTMLElement).style.display = next === 'dark' ? 'block' : 'none'));
75
+ sysIcons.forEach(el => el.classList.toggle('hidden', next !== 'system'));
76
+ lightIcons.forEach(el => el.classList.toggle('hidden', next !== 'light'));
77
+ darkIcons.forEach(el => el.classList.toggle('hidden', next !== 'dark'));
78
78
 
79
79
  const resolved = next === 'system'
80
80
  ? window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
@@ -62,7 +62,7 @@ function getSlotName(item: TimelineItem, base: string) {
62
62
  {...rest}
63
63
  >
64
64
  {items && items.length > 0 ? (
65
- items.map((item, index) => {
65
+ items.map(async (item, index) => {
66
66
  const state = getItemState(item, index)
67
67
  const isLast = index === items.length - 1
68
68
 
@@ -72,6 +72,7 @@ function getSlotName(item: TimelineItem, base: string) {
72
72
  const itemTitleSlot = getSlotName(item, "title")
73
73
  const itemDescriptionSlot = getSlotName(item, "description")
74
74
 
75
+ const hasDefaultSlot = Astro.slots.has("default")
75
76
  const hasCustomIndicator = Astro.slots.has(itemIndicatorSlot) || (item.slot && Astro.slots.has("indicator"))
76
77
  const hasCustomWrapper = Astro.slots.has(itemWrapperSlot) || (item.slot && Astro.slots.has("wrapper"))
77
78
  const hasCustomDate = Astro.slots.has(itemDateSlot) || (item.slot && Astro.slots.has("date"))
@@ -98,9 +99,12 @@ function getSlotName(item: TimelineItem, base: string) {
98
99
  ui={{ icon: "text-highlighted group-data-[state=completed]:text-inverted group-data-[state=active]:text-inverted", fallback: "text-highlighted group-data-[state=completed]:text-inverted group-data-[state=active]:text-inverted" }}
99
100
  >
100
101
  {hasCustomIndicator ? (
101
- <slot name={itemIndicatorSlot}>
102
- <slot name="indicator" />
103
- </slot>
102
+ <Fragment
103
+ set:html={await Astro.slots.render(
104
+ Astro.slots.has(itemIndicatorSlot) ? itemIndicatorSlot : "indicator",
105
+ [item, index]
106
+ )}
107
+ />
104
108
  ) : item.icon ? (
105
109
  <RLAIcon name={item.icon} class="text-inherit" />
106
110
  ) : null}
@@ -120,9 +124,12 @@ function getSlotName(item: TimelineItem, base: string) {
120
124
  class:list={[classes.wrapper, item.ui?.wrapper]}
121
125
  >
122
126
  {hasCustomWrapper ? (
123
- <slot name={itemWrapperSlot}>
124
- <slot name="wrapper" />
125
- </slot>
127
+ <Fragment
128
+ set:html={await Astro.slots.render(
129
+ Astro.slots.has(itemWrapperSlot) ? itemWrapperSlot : "wrapper",
130
+ [item, index]
131
+ )}
132
+ />
126
133
  ) : (
127
134
  <>
128
135
  {(item.date || hasCustomDate) && (
@@ -130,11 +137,16 @@ function getSlotName(item: TimelineItem, base: string) {
130
137
  data-slot="date"
131
138
  class:list={[classes.date, item.ui?.date]}
132
139
  >
133
- <slot name={itemDateSlot}>
134
- <slot name="date">
135
- {item.date}
136
- </slot>
137
- </slot>
140
+ {hasCustomDate ? (
141
+ <Fragment
142
+ set:html={await Astro.slots.render(
143
+ Astro.slots.has(itemDateSlot) ? itemDateSlot : "date",
144
+ [item, index]
145
+ )}
146
+ />
147
+ ) : (
148
+ item.date
149
+ )}
138
150
  </div>
139
151
  )}
140
152
 
@@ -143,24 +155,38 @@ function getSlotName(item: TimelineItem, base: string) {
143
155
  data-slot="title"
144
156
  class:list={[classes.title, item.ui?.title]}
145
157
  >
146
- <slot name={itemTitleSlot}>
147
- <slot name="title">
148
- {item.title}
149
- </slot>
150
- </slot>
158
+ {hasCustomTitle ? (
159
+ <Fragment
160
+ set:html={await Astro.slots.render(
161
+ Astro.slots.has(itemTitleSlot) ? itemTitleSlot : "title",
162
+ [item, index]
163
+ )}
164
+ />
165
+ ) : (
166
+ item.title
167
+ )}
151
168
  </div>
152
169
  )}
153
170
 
154
- {(item.description || hasCustomDescription) && (
171
+ {(item.description || hasCustomDescription || hasDefaultSlot) && (
155
172
  <div
156
173
  data-slot="description"
157
174
  class:list={[classes.description, item.ui?.description]}
158
175
  >
159
- <slot name={itemDescriptionSlot}>
160
- <slot name="description">
161
- {item.description}
162
- </slot>
163
- </slot>
176
+ {hasDefaultSlot ? (
177
+ <Fragment
178
+ set:html={await Astro.slots.render("default", [item, index])}
179
+ />
180
+ ) : hasCustomDescription ? (
181
+ <Fragment
182
+ set:html={await Astro.slots.render(
183
+ Astro.slots.has(itemDescriptionSlot) ? itemDescriptionSlot : "description",
184
+ [item, index]
185
+ )}
186
+ />
187
+ ) : (
188
+ item.description
189
+ )}
164
190
  </div>
165
191
  )}
166
192
  </>
@@ -6,9 +6,14 @@ import RLSAvatar from "../avatar/RLSAvatar"
6
6
  import RLSIcon from "../icon/RLSIcon"
7
7
 
8
8
  export interface RLSTimelineProps extends TimelineProps {
9
- children?: JSX.Element
10
- indicator?: (ctx: { item: TimelineItem; index: number }) => JSX.Element
11
- wrapper?: (ctx: { item: TimelineItem; index: number }) => JSX.Element
9
+ children?:
10
+ | JSX.Element
11
+ | ((ctx: { item: TimelineItem; index: number } & TimelineItem) => JSX.Element)
12
+ indicator?: (ctx: { item: TimelineItem; index: number } & TimelineItem) => JSX.Element
13
+ wrapper?: (ctx: { item: TimelineItem; index: number } & TimelineItem) => JSX.Element
14
+ date?: (ctx: { item: TimelineItem; index: number } & TimelineItem) => JSX.Element
15
+ title?: (ctx: { item: TimelineItem; index: number } & TimelineItem) => JSX.Element
16
+ description?: (ctx: { item: TimelineItem; index: number } & TimelineItem) => JSX.Element
12
17
  }
13
18
 
14
19
  const RLSTimeline: Component<RLSTimelineProps> = (allProps) => {
@@ -26,7 +31,10 @@ const RLSTimeline: Component<RLSTimelineProps> = (allProps) => {
26
31
  "class",
27
32
  "children",
28
33
  "indicator",
29
- "wrapper"
34
+ "wrapper",
35
+ "date",
36
+ "title",
37
+ "description"
30
38
  ])
31
39
 
32
40
  const items = (): TimelineItem[] => props.items ?? []
@@ -67,6 +75,19 @@ const RLSTimeline: Component<RLSTimelineProps> = (allProps) => {
67
75
  })
68
76
  )
69
77
 
78
+ const renderSlot = (
79
+ slotFn: any,
80
+ item: TimelineItem,
81
+ index: number,
82
+ fallback?: () => JSX.Element
83
+ ) => {
84
+ if (typeof slotFn === "function") {
85
+ const ctx = { ...item, item, index }
86
+ return slotFn(ctx)
87
+ }
88
+ return fallback ? fallback() : null
89
+ }
90
+
70
91
  return (
71
92
  <Dynamic
72
93
  component={props.as || "div"}
@@ -107,7 +128,7 @@ const RLSTimeline: Component<RLSTimelineProps> = (allProps) => {
107
128
  }}
108
129
  >
109
130
  {props.indicator ? (
110
- props.indicator({ item, index: index() })
131
+ renderSlot(props.indicator, item, index())
111
132
  ) : item.icon ? (
112
133
  <RLSIcon name={item.icon} class="text-inherit" />
113
134
  ) : null}
@@ -127,31 +148,35 @@ const RLSTimeline: Component<RLSTimelineProps> = (allProps) => {
127
148
  class={`${resolvedClasses().wrapper} ${item.ui?.wrapper || ""}`}
128
149
  >
129
150
  {props.wrapper ? (
130
- props.wrapper({ item, index: index() })
151
+ renderSlot(props.wrapper, item, index())
131
152
  ) : (
132
153
  <>
133
- {item.date ? (
154
+ {item.date || props.date ? (
134
155
  <div
135
156
  data-slot="date"
136
157
  class={`${resolvedClasses().date} ${item.ui?.date || ""}`}
137
158
  >
138
- {item.date}
159
+ {renderSlot(props.date, item, index(), () => item.date)}
139
160
  </div>
140
161
  ) : null}
141
- {item.title ? (
162
+ {item.title || props.title ? (
142
163
  <div
143
164
  data-slot="title"
144
165
  class={`${resolvedClasses().title} ${item.ui?.title || ""}`}
145
166
  >
146
- {item.title}
167
+ {renderSlot(props.title, item, index(), () => item.title)}
147
168
  </div>
148
169
  ) : null}
149
- {item.description ? (
170
+ {item.description ||
171
+ props.description ||
172
+ typeof props.children === "function" ? (
150
173
  <div
151
174
  data-slot="description"
152
175
  class={`${resolvedClasses().description} ${item.ui?.description || ""}`}
153
176
  >
154
- {item.description}
177
+ {typeof props.children === "function"
178
+ ? renderSlot(props.children, item, index(), () => item.description)
179
+ : renderSlot(props.description, item, index(), () => item.description)}
155
180
  </div>
156
181
  ) : null}
157
182
  </>
@@ -161,7 +186,7 @@ const RLSTimeline: Component<RLSTimelineProps> = (allProps) => {
161
186
  )
162
187
  }}
163
188
  </For>
164
- ) : props.children ? (
189
+ ) : typeof props.children !== "function" ? (
165
190
  props.children
166
191
  ) : null}
167
192
  </Dynamic>
@@ -21,6 +21,16 @@ export interface TimelineItem {
21
21
  [key: string]: any
22
22
  }
23
23
 
24
+ export interface TimelineItemProps extends TimelineItem {
25
+ as?: any
26
+ isLast?: boolean
27
+ state?: "active" | "completed"
28
+ size?: "3xs" | "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl"
29
+ color?: "primary" | "secondary" | "success" | "info" | "warning" | "error" | "neutral"
30
+ orientation?: "horizontal" | "vertical"
31
+ class?: any
32
+ }
33
+
24
34
  export interface TimelineProps<T extends TimelineItem = TimelineItem> {
25
35
  /**
26
36
  * The element or component this component should render as.
@@ -12,23 +12,20 @@ const {
12
12
 
13
13
  const classes = tooltipTheme(Astro.props)
14
14
 
15
- const anchorName = `--rla-tt-${Math.random().toString(36).substring(2, 9)}`
16
15
  ---
17
16
  <div class={classes.root} data-slot="tooltip-container" data-placement={placement} {...rest}>
18
17
  <div
19
- class={classes.trigger}
18
+ class:list={[classes.trigger, "rla-tt-trigger"]}
20
19
  data-slot="trigger"
21
20
  tabindex="0"
22
- style={`anchor-name: ${anchorName}`}
23
21
  >
24
22
  <slot />
25
23
  </div>
26
24
 
27
25
  <div
28
- class={classes.content}
26
+ class:list={[classes.content, "rla-tt-content"]}
29
27
  data-slot="content"
30
28
  role="tooltip"
31
- style={`position-anchor: ${anchorName}`}
32
29
  >
33
30
  <slot name="content">
34
31
  {content}
@@ -44,15 +41,14 @@ const anchorName = `--rla-tt-${Math.random().toString(36).substring(2, 9)}`
44
41
  * fall back to the existing absolute + translate-based placement
45
42
  * defined in tooltip.theme.ts. No JavaScript needed in either path.
46
43
  */
44
+ .rla-tt-trigger {
45
+ anchor-name: --rla-tooltip-anchor;
46
+ }
47
+
47
48
  @supports (anchor-name: --x) {
48
49
  [data-slot="tooltip-container"] [data-slot="content"] {
49
- /*
50
- * Switch from the theme's translate-based absolute positioning
51
- * to anchor-relative positioning so the browser handles overflow
52
- * and viewport clipping automatically.
53
- */
54
50
  position: absolute;
55
- position-anchor: inherit; /* resolved from inline style */
51
+ position-anchor: --rla-tooltip-anchor;
56
52
 
57
53
  /* Reset theme's translate hacks — anchor() handles the math */
58
54
  transform: none !important;