horizon-design 0.0.6 → 0.0.8

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.
@@ -236,17 +236,28 @@
236
236
  style="bottom: -2.5px"
237
237
  ></div>
238
238
  {/if}
239
- <!-- Header -->
240
- <div class="hover:bg-muted/50 flex items-center rounded-sm px-2 py-1.5 transition-colors">
239
+ <div
240
+ role="button"
241
+ tabindex="0"
242
+ class="hover:bg-muted/50 flex cursor-default items-center rounded-sm px-2 py-1.5 transition-colors"
243
+ onclick={() => {
244
+ cursorId = card.id;
245
+ isKeyboardMode = false;
246
+ toggleExpanded(card.id);
247
+ }}
248
+ onkeydown={(e) => {
249
+ if (e.key === 'Enter' || e.key === ' ') {
250
+ e.preventDefault();
251
+ cursorId = card.id;
252
+ isKeyboardMode = true;
253
+ toggleExpanded(card.id);
254
+ }
255
+ }}
256
+ >
241
257
  <button
242
258
  tabindex="-1"
243
259
  aria-expanded={isExpanded}
244
- class="flex flex-1 cursor-default items-center gap-1.5 text-left"
245
- onclick={() => {
246
- cursorId = card.id;
247
- isKeyboardMode = false;
248
- toggleExpanded(card.id);
249
- }}
260
+ class="flex flex-1 items-center gap-1.5 text-left"
250
261
  >
251
262
  <MingcuteRightLine
252
263
  class={cn(
@@ -277,7 +288,6 @@
277
288
  </button>
278
289
  </div>
279
290
 
280
- <!-- Content -->
281
291
  <div
282
292
  class={cn(
283
293
  'grid transition-[grid-template-rows] duration-200 ease-out',
@@ -12,6 +12,25 @@
12
12
  children?: Snippet;
13
13
  [key: string]: unknown;
14
14
  } = $props();
15
+
16
+ let contentEl = $state<HTMLElement | null>(null);
17
+ let hasOverflow = $state(false);
18
+
19
+ $effect(() => {
20
+ if (!contentEl) return;
21
+ const viewport = contentEl.parentElement as HTMLElement;
22
+
23
+ const check = () => {
24
+ hasOverflow = contentEl!.offsetHeight > viewport.clientHeight;
25
+ };
26
+
27
+ const ro = new ResizeObserver(check);
28
+ ro.observe(contentEl);
29
+ ro.observe(viewport);
30
+ check();
31
+
32
+ return () => ro.disconnect();
33
+ });
15
34
  </script>
16
35
 
17
36
  <ScrollArea.Root
@@ -22,11 +41,16 @@
22
41
  <ScrollArea.Viewport
23
42
  class="size-full scrollbar-none rounded-[inherit] [&::-webkit-scrollbar]:hidden"
24
43
  >
25
- {@render children?.()}
44
+ <div bind:this={contentEl}>
45
+ {@render children?.()}
46
+ </div>
26
47
  </ScrollArea.Viewport>
27
48
  <ScrollArea.Scrollbar
28
49
  orientation="vertical"
29
- class="group/scrollbar hidden data-overflow-y:flex w-2.5 touch-none border-l border-l-transparent p-px transition-colors select-none"
50
+ class={cn(
51
+ 'group/scrollbar w-2.5 touch-none border-l border-l-transparent p-px transition-colors select-none',
52
+ hasOverflow ? 'flex' : 'hidden'
53
+ )}
30
54
  >
31
55
  <ScrollArea.Thumb
32
56
  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"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "horizon-design",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/horizon-engine/horizon-design"