@classic-homes/theme-svelte 1.22.2 → 1.22.3
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.
|
@@ -45,6 +45,8 @@
|
|
|
45
45
|
autoCollapse?: boolean;
|
|
46
46
|
/** IDs of expandable items alongside this one */
|
|
47
47
|
siblingIds?: string[];
|
|
48
|
+
/** Rendered inside another item's submenu panel (internal) */
|
|
49
|
+
nested?: boolean;
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
let {
|
|
@@ -62,6 +64,7 @@
|
|
|
62
64
|
onMouseLeave,
|
|
63
65
|
autoCollapse = false,
|
|
64
66
|
siblingIds = [],
|
|
67
|
+
nested = false,
|
|
65
68
|
}: Props = $props();
|
|
66
69
|
|
|
67
70
|
// Highlight matching text in item names
|
|
@@ -99,11 +102,11 @@
|
|
|
99
102
|
return cn(
|
|
100
103
|
isLight &&
|
|
101
104
|
!active &&
|
|
102
|
-
'text-foreground bg-
|
|
105
|
+
'text-foreground bg-transparent hover:bg-accent hover:text-accent-foreground',
|
|
103
106
|
isLight && active && 'bg-primary/10 text-primary',
|
|
104
107
|
!isLight &&
|
|
105
108
|
!active &&
|
|
106
|
-
'text-sidebar-foreground bg-
|
|
109
|
+
'text-sidebar-foreground bg-transparent hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',
|
|
107
110
|
!isLight && active && 'bg-sidebar-primary text-sidebar-primary-foreground',
|
|
108
111
|
disabled && 'opacity-50 pointer-events-none cursor-not-allowed'
|
|
109
112
|
);
|
|
@@ -266,9 +269,12 @@
|
|
|
266
269
|
<div
|
|
267
270
|
class={cn(
|
|
268
271
|
'group flex w-full items-center rounded-md',
|
|
269
|
-
|
|
272
|
+
// Inside a submenu panel rows sit on the panel's grey, so no rest fill
|
|
273
|
+
isLight && !item.active && (nested ? 'bg-transparent' : 'bg-background'),
|
|
274
|
+
isLight && !item.active && 'hover:bg-accent',
|
|
270
275
|
isLight && item.active && 'bg-primary/10',
|
|
271
|
-
!isLight && !item.active && 'bg-
|
|
276
|
+
!isLight && !item.active && (nested ? 'bg-transparent' : 'bg-sidebar'),
|
|
277
|
+
!isLight && !item.active && 'hover:bg-sidebar-accent',
|
|
272
278
|
!isLight && item.active && 'bg-sidebar-primary'
|
|
273
279
|
)}
|
|
274
280
|
>
|
|
@@ -372,54 +378,64 @@
|
|
|
372
378
|
</div>
|
|
373
379
|
|
|
374
380
|
{#if isExpanded}
|
|
375
|
-
|
|
376
|
-
|
|
381
|
+
<!-- Submenu panel: an inset grey surface at the top level so open children
|
|
382
|
+
read as separate from the main list. Deeper levels get a left rail
|
|
383
|
+
instead, so the grey never stacks darker -->
|
|
384
|
+
<div
|
|
385
|
+
class={cn(
|
|
386
|
+
'mt-1 overflow-hidden',
|
|
387
|
+
!nested && 'ml-3 rounded-md p-1',
|
|
388
|
+
!nested && (isLight ? 'bg-muted/50' : 'bg-sidebar-accent/30')
|
|
389
|
+
)}
|
|
377
390
|
transition:slide={{ duration: sidebarStore.animate ? 200 : 0 }}
|
|
378
391
|
>
|
|
379
|
-
{
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
392
|
+
<ul class={cn('space-y-1', nested && 'ml-3 border-l border-outline/40 pl-1')}>
|
|
393
|
+
{#each item.children ?? [] as child (child.id)}
|
|
394
|
+
<li>
|
|
395
|
+
{#if child.children?.length}
|
|
396
|
+
<!-- A nested category: same expandable row, one level deeper -->
|
|
397
|
+
<SidebarNavItem
|
|
398
|
+
item={child}
|
|
399
|
+
{isLight}
|
|
400
|
+
{isMobile}
|
|
401
|
+
{icon}
|
|
402
|
+
{searchQuery}
|
|
403
|
+
{onNavigate}
|
|
404
|
+
{autoCollapse}
|
|
405
|
+
siblingIds={expandableChildIds}
|
|
406
|
+
nested
|
|
407
|
+
/>
|
|
408
|
+
{:else}
|
|
409
|
+
<a
|
|
410
|
+
href={child.disabled ? undefined : child.href}
|
|
411
|
+
class={cn(
|
|
412
|
+
'flex min-w-0 items-center gap-3 rounded-md px-3 py-2 text-sm font-medium',
|
|
413
|
+
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1',
|
|
414
|
+
getItemStateClasses(child.active, child.disabled)
|
|
415
|
+
)}
|
|
416
|
+
target={child.external ? '_blank' : undefined}
|
|
417
|
+
rel={child.external ? 'noopener noreferrer' : undefined}
|
|
418
|
+
aria-current={child.active ? 'page' : undefined}
|
|
419
|
+
aria-disabled={child.disabled || undefined}
|
|
420
|
+
tabindex={child.disabled ? -1 : undefined}
|
|
421
|
+
onclick={(e) => {
|
|
422
|
+
if (child.disabled) {
|
|
423
|
+
e.preventDefault();
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
onNavigate?.(child);
|
|
427
|
+
}}
|
|
428
|
+
>
|
|
429
|
+
{@render navIcon(child)}
|
|
430
|
+
{@render highlightedName(child.name, highlightText(child.name, searchQuery))}
|
|
431
|
+
{@render navBadge(child.badge)}
|
|
432
|
+
{#if child.external}{@render externalIndicator()}{/if}
|
|
433
|
+
</a>
|
|
434
|
+
{/if}
|
|
435
|
+
</li>
|
|
436
|
+
{/each}
|
|
437
|
+
</ul>
|
|
438
|
+
</div>
|
|
423
439
|
{/if}
|
|
424
440
|
</div>
|
|
425
441
|
{:else}
|
|
@@ -32,6 +32,8 @@ interface Props {
|
|
|
32
32
|
autoCollapse?: boolean;
|
|
33
33
|
/** IDs of expandable items alongside this one */
|
|
34
34
|
siblingIds?: string[];
|
|
35
|
+
/** Rendered inside another item's submenu panel (internal) */
|
|
36
|
+
nested?: boolean;
|
|
35
37
|
}
|
|
36
38
|
declare const SidebarNavItem: import("svelte").Component<Props, {}, "">;
|
|
37
39
|
type SidebarNavItem = ReturnType<typeof SidebarNavItem>;
|