horizon-design 0.0.5 → 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,17 +23,24 @@
19
23
  data-slot="scroll-area"
20
24
  {...rest}
21
25
  >
22
- <ScrollArea.Viewport
23
- class="size-full [scrollbar-width:none] rounded-[inherit] [&::-webkit-scrollbar]:hidden"
24
- >
25
- {@render children?.()}
26
- </ScrollArea.Viewport>
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="group/scrollbar flex w-2.5 touch-none border-l border-l-transparent p-px transition-colors select-none"
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
- 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"
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"
33
44
  />
34
45
  </ScrollArea.Scrollbar>
35
46
  <ScrollArea.Corner />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "horizon-design",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/horizon-engine/horizon-design"