@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
@@ -136,7 +136,7 @@ const baseImageProps: Record<string, any> = {
136
136
  ---
137
137
 
138
138
  <rla-image {...rest}>
139
- <div class={classes.root} data-slot="root" data-theme={theme} style={theme ? `color-scheme: ${theme};` : undefined}>
139
+ <div class={classes.root} data-slot="root" data-theme={theme}>
140
140
  {isFigure ? (
141
141
  <figure class={classes.figure} data-slot="figure">
142
142
  <slot name="trigger">
@@ -154,18 +154,17 @@ const baseImageProps: Record<string, any> = {
154
154
  </picture>
155
155
  ) : hasColorMode ? (
156
156
  <div
157
- class="rla-image-color-mode w-full h-full relative overflow-hidden rounded-lg flex items-center justify-center"
158
- style={`--rla-img-light: url('${lightUrl}'); --rla-img-dark: url('${darkUrl}');`}
157
+ class="rla-image-color-mode w-full h-full relative overflow-hidden rounded-[inherit] flex items-center justify-center"
159
158
  >
160
159
  <Image
161
160
  {...(baseImageProps as any)}
162
161
  src={effectiveLight as any}
163
- class:list={[classes.triggerImage, "rla-img-light w-full h-full object-cover rounded-lg"]}
162
+ class:list={[classes.triggerImage, "rla-img-light w-full h-full object-cover rounded-[inherit]"]}
164
163
  />
165
164
  <Image
166
165
  {...(baseImageProps as any)}
167
166
  src={effectiveDark as any}
168
- class:list={[classes.triggerImage, "rla-img-dark w-full h-full object-cover rounded-lg hidden"]}
167
+ class:list={[classes.triggerImage, "rla-img-dark w-full h-full object-cover rounded-[inherit] hidden"]}
169
168
  />
170
169
  </div>
171
170
  ) : isFormatFallback ? (
@@ -182,7 +181,7 @@ const baseImageProps: Record<string, any> = {
182
181
  )}
183
182
  </button>
184
183
  ) : (
185
- <div class="overflow-hidden rounded-lg block">
184
+ <div class="overflow-hidden rounded-[inherit] block">
186
185
  {isResponsive && mobileImg && desktopImg ? (
187
186
  <picture>
188
187
  <source media={`(max-width: ${breakpointVal - 1}px)`} srcset={mobileImg.src} />
@@ -191,18 +190,17 @@ const baseImageProps: Record<string, any> = {
191
190
  </picture>
192
191
  ) : hasColorMode ? (
193
192
  <div
194
- class="rla-image-color-mode w-full h-full relative overflow-hidden rounded-lg flex items-center justify-center"
195
- style={`--rla-img-light: url('${lightUrl}'); --rla-img-dark: url('${darkUrl}');`}
193
+ class="rla-image-color-mode w-full h-full relative overflow-hidden rounded-[inherit] flex items-center justify-center"
196
194
  >
197
195
  <Image
198
196
  {...(baseImageProps as any)}
199
197
  src={effectiveLight as any}
200
- class:list={[classes.triggerImage, "rla-img-light w-full h-full object-cover rounded-lg"]}
198
+ class:list={[classes.triggerImage, "rla-img-light w-full h-full object-cover rounded-[inherit]"]}
201
199
  />
202
200
  <Image
203
201
  {...(baseImageProps as any)}
204
202
  src={effectiveDark as any}
205
- class:list={[classes.triggerImage, "rla-img-dark w-full h-full object-cover rounded-lg hidden"]}
203
+ class:list={[classes.triggerImage, "rla-img-dark w-full h-full object-cover rounded-[inherit] hidden"]}
206
204
  />
207
205
  </div>
208
206
  ) : isFormatFallback ? (
@@ -240,18 +238,17 @@ const baseImageProps: Record<string, any> = {
240
238
  </picture>
241
239
  ) : hasColorMode ? (
242
240
  <div
243
- class="rla-image-color-mode w-full h-full relative overflow-hidden rounded-lg flex items-center justify-center"
244
- style={`--rla-img-light: url('${lightUrl}'); --rla-img-dark: url('${darkUrl}');`}
241
+ class="rla-image-color-mode w-full h-full relative overflow-hidden rounded-[inherit] flex items-center justify-center"
245
242
  >
246
243
  <Image
247
244
  {...(baseImageProps as any)}
248
245
  src={effectiveLight as any}
249
- class:list={[classes.triggerImage, "rla-img-light w-full h-full object-cover rounded-lg"]}
246
+ class:list={[classes.triggerImage, "rla-img-light w-full h-full object-cover rounded-[inherit]"]}
250
247
  />
251
248
  <Image
252
249
  {...(baseImageProps as any)}
253
250
  src={effectiveDark as any}
254
- class:list={[classes.triggerImage, "rla-img-dark w-full h-full object-cover rounded-lg hidden"]}
251
+ class:list={[classes.triggerImage, "rla-img-dark w-full h-full object-cover rounded-[inherit] hidden"]}
255
252
  />
256
253
  </div>
257
254
  ) : isFormatFallback ? (
@@ -268,7 +265,7 @@ const baseImageProps: Record<string, any> = {
268
265
  )}
269
266
  </button>
270
267
  ) : (
271
- <div class="overflow-hidden rounded-lg block">
268
+ <div class="overflow-hidden rounded-[inherit] block">
272
269
  {isResponsive && mobileImg && desktopImg ? (
273
270
  <picture>
274
271
  <source media={`(max-width: ${breakpointVal - 1}px)`} srcset={mobileImg.src} />
@@ -277,18 +274,17 @@ const baseImageProps: Record<string, any> = {
277
274
  </picture>
278
275
  ) : hasColorMode ? (
279
276
  <div
280
- class="rla-image-color-mode w-full h-full relative overflow-hidden rounded-lg flex items-center justify-center"
281
- style={`--rla-img-light: url('${lightUrl}'); --rla-img-dark: url('${darkUrl}');`}
277
+ class="rla-image-color-mode w-full h-full relative overflow-hidden rounded-[inherit] flex items-center justify-center"
282
278
  >
283
279
  <Image
284
280
  {...(baseImageProps as any)}
285
281
  src={effectiveLight as any}
286
- class:list={[classes.triggerImage, "rla-img-light w-full h-full object-cover rounded-lg"]}
282
+ class:list={[classes.triggerImage, "rla-img-light w-full h-full object-cover rounded-[inherit]"]}
287
283
  />
288
284
  <Image
289
285
  {...(baseImageProps as any)}
290
286
  src={effectiveDark as any}
291
- class:list={[classes.triggerImage, "rla-img-dark w-full h-full object-cover rounded-lg hidden"]}
287
+ class:list={[classes.triggerImage, "rla-img-dark w-full h-full object-cover rounded-[inherit] hidden"]}
292
288
  />
293
289
  </div>
294
290
  ) : isFormatFallback ? (
@@ -327,7 +323,6 @@ const baseImageProps: Record<string, any> = {
327
323
  ) : hasColorMode ? (
328
324
  <div
329
325
  class="rla-image-color-mode max-w-full max-h-[65vh] relative flex items-center justify-center overflow-hidden"
330
- style={`--rla-img-light: url('${lightUrl}'); --rla-img-dark: url('${darkUrl}');`}
331
326
  >
332
327
  <img
333
328
  src={lightUrl}
@@ -236,16 +236,13 @@ const RLSImage: Component<RLSImageProps> = (allProps) => {
236
236
 
237
237
  if (hasColorMode) {
238
238
  return (
239
- <div
240
- class="rla-image-color-mode w-full h-full relative overflow-hidden rounded-lg flex items-center justify-center"
241
- style={`--rla-img-light: url('${lightUrl}'); --rla-img-dark: url('${darkUrl}');`}
242
- >
239
+ <div class="rla-image-color-mode w-full h-full relative overflow-hidden rounded-[inherit] flex items-center justify-center">
243
240
  <img
244
241
  src={show() ? lightUrl : undefined}
245
242
  alt={alt}
246
243
  loading={loading}
247
244
  decoding={decoding}
248
- class={`${resolvedClasses().triggerImage} rla-img-light w-full h-full object-cover rounded-lg`}
245
+ class={`${resolvedClasses().triggerImage} rla-img-light w-full h-full object-cover rounded-[inherit]`}
249
246
  onError={handleError}
250
247
  onLoad={handleLoad}
251
248
  />
@@ -254,7 +251,7 @@ const RLSImage: Component<RLSImageProps> = (allProps) => {
254
251
  alt={alt}
255
252
  loading={loading}
256
253
  decoding={decoding}
257
- class={`${resolvedClasses().triggerImage} rla-img-dark w-full h-full object-cover rounded-lg hidden`}
254
+ class={`${resolvedClasses().triggerImage} rla-img-dark w-full h-full object-cover rounded-[inherit] hidden`}
258
255
  />
259
256
  </div>
260
257
  )
@@ -289,7 +286,7 @@ const RLSImage: Component<RLSImageProps> = (allProps) => {
289
286
  {triggerImage()}
290
287
  </button>
291
288
  ) : (
292
- <div class="overflow-hidden rounded-lg block">{triggerImage()}</div>
289
+ <div class="overflow-hidden rounded-[inherit] block">{triggerImage()}</div>
293
290
  )
294
291
 
295
292
  return (
@@ -298,7 +295,6 @@ const RLSImage: Component<RLSImageProps> = (allProps) => {
298
295
  class={resolvedClasses().root}
299
296
  data-slot="root"
300
297
  data-theme={props.theme}
301
- style={props.theme ? `color-scheme: ${props.theme};` : undefined}
302
298
  {...rest}
303
299
  >
304
300
  {isFigure ? (
@@ -357,10 +353,7 @@ const RLSImage: Component<RLSImageProps> = (allProps) => {
357
353
  />
358
354
  </picture>
359
355
  ) : hasColorMode ? (
360
- <div
361
- class="rla-image-color-mode max-w-full max-h-[65vh] relative flex items-center justify-center overflow-hidden"
362
- style={`--rla-img-light: url('${lightUrl}'); --rla-img-dark: url('${darkUrl}');`}
363
- >
356
+ <div class="rla-image-color-mode max-w-full max-h-[65vh] relative flex items-center justify-center overflow-hidden">
364
357
  <img
365
358
  src={show() ? lightUrl : undefined}
366
359
  alt={alt}
@@ -14,12 +14,12 @@ export const imageTheme = defineTheme("image", {
14
14
  "closeButton"
15
15
  ],
16
16
  base: {
17
- root: "relative inline-block group/image",
18
- figure: "m-0 p-0 inline-flex flex-col max-w-full",
17
+ root: "relative inline-block group/image overflow-hidden rounded-lg",
18
+ figure: "m-0 p-0 inline-flex flex-col max-w-full rounded-[inherit] overflow-hidden",
19
19
  caption: "mt-2 text-xs text-muted text-center italic",
20
20
  trigger:
21
- "cursor-pointer overflow-hidden rounded-lg block hover:scale-[1.02] active:scale-95 transition-transform duration-300",
22
- triggerImage: "max-w-full h-auto object-cover rounded-lg",
21
+ "cursor-pointer overflow-hidden rounded-[inherit] block hover:scale-[1.02] active:scale-95 transition-transform duration-300",
22
+ triggerImage: "max-w-full h-auto object-cover rounded-[inherit]",
23
23
  dialog:
24
24
  "backdrop:bg-black/60 max-w-[98vw] sm:max-w-[95vw] w-fit max-h-[90vh] rounded-xl p-0 overflow-hidden border-0 m-auto",
25
25
  image: "object-contain max-w-full max-h-[65vh] rounded-lg",
@@ -24,20 +24,27 @@ const {
24
24
 
25
25
  const classes = inputRatingTheme(Astro.props)
26
26
 
27
- const sizeMap = {
28
- xs: "0.75rem",
29
- sm: "1rem",
30
- md: "1.25rem",
31
- lg: "1.5rem",
32
- xl: "1.75rem"
27
+ const sizeClassMap: Record<string, string> = {
28
+ xs: "size-3",
29
+ sm: "size-4",
30
+ md: "size-5",
31
+ lg: "size-6",
32
+ xl: "size-7"
33
33
  }
34
- const itemSize = sizeMap[size] || "1.25rem"
34
+ const itemSizeClass = sizeClassMap[size] || "size-5"
35
35
 
36
36
  const ratingItems = Array.from({ length }, (_, idx) => {
37
37
  const i = idx + 1;
38
- const initWidth = defaultValue >= i ? "100%" : defaultValue <= i - 1 ? "0%" : `${(defaultValue - (i - 1)) * 100}%`;
38
+ const pct = defaultValue >= i ? 100 : defaultValue <= i - 1 ? 0 : Math.round((defaultValue - (i - 1)) * 100);
39
+ const widthClass =
40
+ pct === 100 ? "w-full" :
41
+ pct === 75 ? "w-3/4" :
42
+ pct === 50 ? "w-1/2" :
43
+ pct === 25 ? "w-1/4" :
44
+ pct === 0 ? "w-0" :
45
+ `w-[${pct}%]`;
39
46
  const isActive = defaultValue >= i - 0.99 ? "active" : "inactive";
40
- return { i, initWidth, isActive };
47
+ return { i, widthClass, isActive };
41
48
  });
42
49
  ---
43
50
 
@@ -71,12 +78,11 @@ const ratingItems = Array.from({ length }, (_, idx) => {
71
78
  class="rating-hidden-input"
72
79
  />
73
80
 
74
- {ratingItems.map(({ i, initWidth, isActive }) => (
81
+ {ratingItems.map(({ i, widthClass, isActive }) => (
75
82
  <div
76
- class:list={["input-rating-item", classes.item]}
83
+ class:list={["input-rating-item", classes.item, itemSizeClass]}
77
84
  data-slot="item"
78
85
  data-index={i}
79
- style={`--item-size: ${itemSize}; width: ${itemSize}; height: ${itemSize};`}
80
86
  >
81
87
  <div class={classes.emptyIcon} data-slot="emptyIcon">
82
88
  <slot name="item">
@@ -85,9 +91,8 @@ const ratingItems = Array.from({ length }, (_, idx) => {
85
91
  </div>
86
92
 
87
93
  <div
88
- class:list={["rating-item-indicator", classes.indicator]}
94
+ class:list={["rating-item-indicator", classes.indicator, widthClass]}
89
95
  data-slot="indicator"
90
- style={`width: ${initWidth}`}
91
96
  data-state={isActive}
92
97
  >
93
98
  <slot name="item">
@@ -45,15 +45,17 @@ const RLSInputRating: Component<RLSInputRatingProps> = (allProps) => {
45
45
 
46
46
  const step = () => props.step ?? 1
47
47
  const length = () => props.length ?? 5
48
- const itemSize = () => {
48
+ const hoverable = () => !!props.hoverable
49
+ const clearable = () => !!props.clearable
50
+ const itemSizeClass = () => {
49
51
  const map: Record<string, string> = {
50
- xs: "0.75rem",
51
- sm: "1rem",
52
- md: "1.25rem",
53
- lg: "1.5rem",
54
- xl: "1.75rem"
52
+ xs: "size-3",
53
+ sm: "size-4",
54
+ md: "size-5",
55
+ lg: "size-6",
56
+ xl: "size-7"
55
57
  }
56
- return map[props.size ?? "md"] ?? "1.25rem"
58
+ return map[props.size ?? "md"] || "size-5"
57
59
  }
58
60
 
59
61
  const [internalValue, setInternalValue] = createSignal<number>(
@@ -75,10 +77,11 @@ const RLSInputRating: Component<RLSInputRatingProps> = (allProps) => {
75
77
 
76
78
  const items = createMemo(() => Array.from({ length: length() }, (_, idx) => idx + 1))
77
79
 
78
- const getWidthForVal = (val: number, itemIndex: number) => {
79
- if (val >= itemIndex) return "100%"
80
- if (val <= itemIndex - 1) return "0%"
81
- return `${(val - (itemIndex - 1)) * 100}%`
80
+ const getWidthClass = (val: number, itemIndex: number) => {
81
+ if (val >= itemIndex) return "w-full"
82
+ if (val <= itemIndex - 1) return "w-0"
83
+ const pct = Math.round((val - (itemIndex - 1)) * 100)
84
+ return pct === 75 ? "w-3/4" : pct === 50 ? "w-1/2" : pct === 25 ? "w-1/4" : `w-[${pct}%]`
82
85
  }
83
86
 
84
87
  const getValueFromEvent = (e: MouseEvent, el: HTMLElement, index: number) => {
@@ -89,8 +92,9 @@ const RLSInputRating: Component<RLSInputRatingProps> = (allProps) => {
89
92
  }
90
93
 
91
94
  const handleMouseMove = (e: MouseEvent, el: HTMLElement, index: number) => {
92
- if (props.disabled || props.readonly) return
93
- if (props.hoverable) setHoverValue(getValueFromEvent(e, el, index))
95
+ if (!hoverable()) return
96
+ const val = getValueFromEvent(e, el, index)
97
+ setHoverValue(val)
94
98
  }
95
99
 
96
100
  const handleMouseLeave = () => {
@@ -98,31 +102,36 @@ const RLSInputRating: Component<RLSInputRatingProps> = (allProps) => {
98
102
  }
99
103
 
100
104
  const handleClick = (e: MouseEvent, el: HTMLElement, index: number) => {
101
- if (props.disabled || props.readonly) return
102
105
  const val = getValueFromEvent(e, el, index)
103
- let finalVal = val
104
- if (props.clearable && value() === val) finalVal = 0
105
- if (props.value === undefined && props.modelValue === undefined) setInternalValue(finalVal)
106
- props.onValueChange?.(finalVal)
106
+ let next = val
107
+ if (clearable() && value() === val) {
108
+ next = 0
109
+ }
110
+ setInternalValue(next)
111
+ props.onValueChange?.(next)
112
+ setHoverValue(null)
107
113
  }
108
114
 
109
115
  const handleKeyDown = (e: KeyboardEvent) => {
110
116
  if (props.disabled || props.readonly) return
111
- let newVal = value()
117
+ let next = value()
112
118
  if (e.key === "ArrowRight" || e.key === "ArrowUp") {
113
- newVal = Math.min(value() + step(), length())
119
+ next = Math.min(value() + step(), length())
120
+ e.preventDefault()
114
121
  } else if (e.key === "ArrowLeft" || e.key === "ArrowDown") {
115
- newVal = Math.max(value() - step(), 0)
122
+ next = Math.max(value() - step(), 0)
123
+ e.preventDefault()
116
124
  } else if (e.key === "Home") {
117
- newVal = 0
125
+ next = 0
126
+ e.preventDefault()
118
127
  } else if (e.key === "End") {
119
- newVal = length()
120
- } else {
121
- return
128
+ next = length()
129
+ e.preventDefault()
130
+ }
131
+ if (next !== value()) {
132
+ setInternalValue(next)
133
+ props.onValueChange?.(next)
122
134
  }
123
- e.preventDefault()
124
- if (props.value === undefined && props.modelValue === undefined) setInternalValue(newVal)
125
- props.onValueChange?.(newVal)
126
135
  }
127
136
 
128
137
  return (
@@ -158,10 +167,9 @@ const RLSInputRating: Component<RLSInputRatingProps> = (allProps) => {
158
167
  <For each={items()}>
159
168
  {(i) => (
160
169
  <div
161
- class={`input-rating-item ${resolvedClasses().item}`}
170
+ class={`input-rating-item ${resolvedClasses().item} ${itemSizeClass()}`}
162
171
  data-slot="item"
163
172
  data-index={i}
164
- style={{ "--item-size": itemSize(), "width": itemSize(), "height": itemSize() }}
165
173
  onMouseMove={(e) => handleMouseMove(e, e.currentTarget, i)}
166
174
  onMouseLeave={handleMouseLeave}
167
175
  onClick={(e) => handleClick(e, e.currentTarget, i)}
@@ -176,10 +184,9 @@ const RLSInputRating: Component<RLSInputRatingProps> = (allProps) => {
176
184
  </div>
177
185
 
178
186
  <div
179
- class={`rating-item-indicator ${resolvedClasses().indicator}`}
187
+ class={`rating-item-indicator ${resolvedClasses().indicator} ${getWidthClass(display(), i)}`}
180
188
  data-slot="indicator"
181
189
  data-state={display() >= i - 0.99 ? "active" : "inactive"}
182
- style={{ width: getWidthForVal(display(), i) }}
183
190
  >
184
191
  <RLSIcon
185
192
  name={props.icon || "star"}
@@ -2,12 +2,9 @@
2
2
  import type { InputTagsProps, TagItem } from "./input-tags"
3
3
  import { inputTagsTheme } from "./input-tags.theme"
4
4
 
5
-
6
-
7
5
  const {
8
6
  items,
9
7
  displayLimit = 4,
10
- estimatedTagWidth = 80,
11
8
  showInput = false,
12
9
  name,
13
10
  placeholder = "Add tag…",
@@ -16,109 +13,39 @@ const {
16
13
 
17
14
  const classes = inputTagsTheme(Astro.props)
18
15
 
19
- // ─── Responsive CSS Item Counter ────────────────────────────────────────────
20
- //
21
- // Each tag is a flat DOM sibling. Container queries hide tags from the right
22
- // as the container shrinks and set --hidden-items. CSS counters combine it
23
- // with the server-side --base-hidden to render "+N more" — no resize observer.
24
- //
25
- // Unlike AvatarGroup (fixed-size items), tags have variable widths. We use
26
- // `estimatedTagWidth` as the per-tag width approximation for breakpoints.
27
- // Users can tune this prop for label-length mismatches.
28
- // ─────────────────────────────────────────────────────────────────────────────
29
-
30
- const uid = Math.random().toString(36).substring(2, 9)
31
- const cName = `rla-it-${uid}`
32
-
33
- // Normalize items to TagItem objects
34
16
  const normalizedItems: TagItem[] = (items ?? []).map(item =>
35
17
  typeof item === "string" ? { label: item, value: item } : item
36
18
  )
37
19
 
38
- const renderedItems = normalizedItems.slice(0, displayLimit)
39
- const baseHiddenCount = Math.max(0, normalizedItems.length - displayLimit)
40
- const needsOverflow = normalizedItems.length >= displayLimit
41
-
42
- // Gap between tags in px (gap-1.5 = 6px)
43
- const tagGapPx = 6
44
- // Width of the "+N more" chip
45
- const morePx = 56
46
-
47
- // Generate per-instance container-query CSS
48
- // Same cascade-based approach as AvatarGroup:
49
- // each breakpoint hides ONE new nth-child, smaller containers match more rules.
50
- let instanceCss = ""
51
- if (needsOverflow && renderedItems.length > 1) {
52
- const maxBreaks = renderedItems.length - 1 // keep at least the first tag
53
- for (let i = 0; i < maxBreaks; i++) {
54
- const hiddenItems = i + 1
55
- const visibleCount = renderedItems.length - hiddenItems
56
- // Min container width for visibleCount tags + more chip + gaps
57
- const maxWidth = visibleCount * estimatedTagWidth + (visibleCount) * tagGapPx + morePx + tagGapPx
58
- const hideNthChild = renderedItems.length - i // counting from the end
59
-
60
- instanceCss += `\n@container ${cName} (max-width: ${maxWidth}px) {`
61
- instanceCss += `\n [data-it="${uid}"] { --hidden-items: ${hiddenItems}; }`
62
- instanceCss += `\n [data-it="${uid}"] > .rla-it-tag.hidable:nth-child(${hideNthChild}) { display: none; }`
63
- if (baseHiddenCount === 0) {
64
- instanceCss += `\n [data-it="${uid}"] > .rla-it-more-hidden { display: inline-flex; }`
65
- }
66
- instanceCss += `\n}`
67
- }
68
- }
20
+ const renderedItems = normalizedItems.slice(0, displayLimit)
21
+ const hiddenCount = normalizedItems.length - displayLimit
69
22
  ---
70
23
 
71
24
  {normalizedItems.length > 0 ? (
72
- <div
73
- class="rla-it-host"
74
- style={`container-type: inline-size; container-name: ${cName};`}
75
- {...rest}
76
- >
77
- <div
78
- class:list={[classes.root, "rla-it-list"]}
79
- data-slot="root"
80
- data-it={uid}
81
- style={`--base-hidden: ${baseHiddenCount}; --hidden-items: 0;`}
82
- >
83
- {renderedItems.map((item, idx) => (
84
- <span
85
- class:list={[
86
- classes.tag,
87
- "rla-it-tag",
88
- needsOverflow && idx > 0 && "hidable"
89
- ]}
90
- data-slot="tag"
91
- >
92
- <span class={classes.tagLabel}>{item.label}</span>
93
- {name && <input type="hidden" name={name} value={item.value ?? item.label} />}
94
- </span>
95
- ))}
96
-
97
- {needsOverflow && (
98
- <span
99
- class:list={[
100
- classes.more,
101
- "rla-it-more",
102
- baseHiddenCount === 0 && "rla-it-more-hidden"
103
- ]}
104
- aria-hidden="true"
105
- data-slot="more"
106
- >
107
- +<span class="rla-it-count" /> more
108
- </span>
109
- )}
25
+ <div class={classes.root} data-slot="root" {...rest}>
26
+ {renderedItems.map((item) => (
27
+ <span class={classes.tag} data-slot="tag">
28
+ <span class={classes.tagLabel}>{item.label}</span>
29
+ {name && <input type="hidden" name={name} value={item.value ?? item.label} />}
30
+ </span>
31
+ ))}
32
+
33
+ {hiddenCount > 0 && (
34
+ <span class={classes.more} aria-hidden="true" data-slot="more">
35
+ +{hiddenCount} more
36
+ </span>
37
+ )}
110
38
 
111
- {showInput && (
112
- <input
113
- type="text"
114
- name={name ? `${name}__input` : undefined}
115
- placeholder={placeholder}
116
- class:list={[classes.input]}
117
- data-slot="input"
118
- autocomplete="off"
119
- />
120
- )}
121
- </div>
39
+ {showInput && (
40
+ <input
41
+ type="text"
42
+ name={name ? `${name}__input` : undefined}
43
+ placeholder={placeholder}
44
+ class={classes.input}
45
+ data-slot="input"
46
+ autocomplete="off"
47
+ />
48
+ )}
122
49
  </div>
123
50
  ) : (
124
51
  <div class={classes.root} data-slot="root" {...rest}>
@@ -128,47 +55,10 @@ if (needsOverflow && renderedItems.length > 1) {
128
55
  type="text"
129
56
  name={name ? `${name}__input` : undefined}
130
57
  placeholder={placeholder}
131
- class:list={[classes.input]}
58
+ class={classes.input}
132
59
  data-slot="input"
133
60
  autocomplete="off"
134
61
  />
135
62
  )}
136
63
  </div>
137
- )}
138
-
139
- <!-- Per-instance CSS scoped via unique data-it attribute -->
140
- <style is:inline set:html={instanceCss} />
141
-
142
- <style>
143
- .rla-it-host {
144
- display: block;
145
- width: 100%;
146
- }
147
-
148
- .rla-it-tag {
149
- display: inline-flex;
150
- flex-shrink: 0;
151
- }
152
-
153
- /* "+more" chip — flex, visible by default when base-hidden > 0 */
154
- .rla-it-more {
155
- display: inline-flex;
156
- flex-shrink: 0;
157
- align-items: center;
158
- gap: 0.125rem;
159
- }
160
-
161
- /* Hidden by default when base-hidden is 0 (revealed by container queries) */
162
- .rla-it-more-hidden {
163
- display: none;
164
- }
165
-
166
- /*
167
- * CSS Counter — sums --base-hidden (render-time) + --hidden-items (CSS queries).
168
- * Zero JS. The browser does the arithmetic via counter-reset: calc().
169
- */
170
- .rla-it-count::after {
171
- counter-reset: rla-it-cnt calc(var(--base-hidden, 0) + var(--hidden-items, 0));
172
- content: counter(rla-it-cnt);
173
- }
174
- </style>
64
+ )}
@@ -82,10 +82,10 @@ const classes = layoutGridTheme(Astro.props)
82
82
  data-shortcut={shortcut}
83
83
  {...rest}
84
84
  >
85
- <aside class={classes.overlay} data-slot="overlay" style={`z-index: ${zIndex}; display: none;`} id="rla-layout-grid-overlay">
85
+ <aside class:list={[classes.overlay, `z-[${zIndex}]`, "hidden"]} data-slot="overlay" id="rla-layout-grid-overlay">
86
86
  <!-- Container holding absolutely-positioned viewport columns -->
87
- <div style="position: relative; width: 100%; height: 100%;" data-slot="columns-container"></div>
88
- <div data-slot="indicator" style="position: fixed; bottom: 20px; right: 20px; background: rgba(0,0,0,0.85); color: #fff; padding: 6px 12px; border-radius: 6px; font-family: var(--font-mono, monospace); font-size: 11px; font-weight: bold; pointer-events: none; border: 1px solid rgba(255,255,255,0.15); box-shadow: 0 4px 12px rgba(0,0,0,0.5); letter-spacing: 0.05em; display: flex; align-items: center; gap: 8px;"></div>
87
+ <div class="relative w-full h-full" data-slot="columns-container"></div>
88
+ <div data-slot="indicator" class="fixed bottom-5 right-5 bg-black/85 text-white px-3 py-1.5 rounded-md font-mono text-[11px] font-bold pointer-events-none border border-white/15 shadow-xl tracking-wider flex items-center gap-2"></div>
89
89
  </aside>
90
90
  </rla-layout-grid>
91
91
  )}
@@ -302,7 +302,7 @@ const classes = layoutGridTheme(Astro.props)
302
302
  }
303
303
 
304
304
  if (this.indicatorElement) {
305
- this.indicatorElement.innerHTML = `<span style="color: #3b82f6;">${this.currentBreakpoint.toUpperCase()} (${breakpointThreshold}px)</span> <span style="opacity: 0.35;">|</span> <span>${width}px</span> <span style="opacity: 0.35;">|</span> <span style="color: #ef4444;">${totalCols} Cols</span>`
305
+ this.indicatorElement.innerHTML = `<span class="text-blue-500">${this.currentBreakpoint.toUpperCase()} (${breakpointThreshold}px)</span> <span class="opacity-35">|</span> <span>${width}px</span> <span class="opacity-35">|</span> <span class="text-red-500">${totalCols} Cols</span>`
306
306
  }
307
307
 
308
308
 
@@ -59,7 +59,6 @@ const hasAutoMode = darkSrc && lightSrc && darkSrc !== lightSrc && !mode;
59
59
  aria-label={alt || variant}
60
60
  data-slot="root"
61
61
  data-theme={theme}
62
- style={theme ? `color-scheme: ${theme};` : undefined}
63
62
  {...rest}
64
63
  >
65
64
  {logoSrc ? (
@@ -68,7 +67,6 @@ const hasAutoMode = darkSrc && lightSrc && darkSrc !== lightSrc && !mode;
68
67
  ) : hasAutoMode ? (
69
68
  <span
70
69
  class="rla-logo-image size-full flex items-center justify-center shrink-0"
71
- style={`--rla-logo-light: url('${lightSrc}'); --rla-logo-dark: url('${darkSrc}');`}
72
70
  >
73
71
  <img
74
72
  src={lightSrc}
@@ -136,18 +134,4 @@ const hasAutoMode = darkSrc && lightSrc && darkSrc !== lightSrc && !mode;
136
134
  display: none !important;
137
135
  }
138
136
  }
139
-
140
- @supports (background-image: light-dark(none, none)) {
141
- .rla-logo-image {
142
- background-image: light-dark(var(--rla-logo-light), var(--rla-logo-dark));
143
- background-size: contain;
144
- background-position: center;
145
- background-repeat: no-repeat;
146
- }
147
- .rla-logo-image > .rla-logo-light,
148
- .rla-logo-image > .rla-logo-dark {
149
- opacity: 0 !important;
150
- visibility: hidden !important;
151
- }
152
- }
153
137
  </style>