horizon-design 0.0.6 → 0.0.7
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.
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
children?: Snippet;
|
|
13
13
|
[key: string]: unknown;
|
|
14
14
|
} = $props();
|
|
15
|
+
|
|
16
|
+
let viewportHeight = $state(0);
|
|
17
|
+
let contentHeight = $state(0);
|
|
18
|
+
let hasOverflow = $derived(contentHeight > viewportHeight);
|
|
15
19
|
</script>
|
|
16
20
|
|
|
17
21
|
<ScrollArea.Root
|
|
@@ -19,14 +23,21 @@
|
|
|
19
23
|
data-slot="scroll-area"
|
|
20
24
|
{...rest}
|
|
21
25
|
>
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
<div bind:clientHeight={viewportHeight} class="size-full">
|
|
27
|
+
<ScrollArea.Viewport
|
|
28
|
+
class="size-full scrollbar-none rounded-[inherit] [&::-webkit-scrollbar]:hidden"
|
|
29
|
+
>
|
|
30
|
+
<div bind:offsetHeight={contentHeight}>
|
|
31
|
+
{@render children?.()}
|
|
32
|
+
</div>
|
|
33
|
+
</ScrollArea.Viewport>
|
|
34
|
+
</div>
|
|
27
35
|
<ScrollArea.Scrollbar
|
|
28
36
|
orientation="vertical"
|
|
29
|
-
class=
|
|
37
|
+
class={cn(
|
|
38
|
+
'group/scrollbar w-2.5 touch-none border-l border-l-transparent p-px transition-colors select-none',
|
|
39
|
+
hasOverflow ? 'flex' : 'hidden'
|
|
40
|
+
)}
|
|
30
41
|
>
|
|
31
42
|
<ScrollArea.Thumb
|
|
32
43
|
class="bg-border hover:bg-scroll-thumb group-data-scrolling/scrollbar:bg-scroll-thumb-hover group-data-dragging/scrollbar:bg-scroll-thumb-active relative flex-1 rounded-full transition-colors"
|