@valerius_petrini/corekit-ui 0.1.60 → 0.1.61
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.
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { SideNavbarProps } from "../types/Navbar.js";
|
|
3
|
+
import { twMerge } from "tailwind-merge";
|
|
4
|
+
import Button from "./Button.svelte";
|
|
5
|
+
import Text from "./Text.svelte";
|
|
6
|
+
import { page } from '$app/state';
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
children = undefined,
|
|
10
|
+
class: className = "",
|
|
11
|
+
items = [],
|
|
12
|
+
...restProps
|
|
13
|
+
}: SideNavbarProps = $props();
|
|
14
|
+
|
|
15
|
+
let expanded = $state(false);
|
|
16
|
+
|
|
17
|
+
const defaultClass = "transition-[width] duration-300 overflow-hidden fixed left-0 h-full mt-14 z-[100] py-2 flex flex-col items-center gap-1 bg-sub-background/99 border-r border-box border-r-sub-background-hover";
|
|
18
|
+
const expandedClass = $derived(expanded ? "w-48" : "w-12");
|
|
19
|
+
|
|
20
|
+
const combinedClass = $derived(twMerge(
|
|
21
|
+
defaultClass,
|
|
22
|
+
expandedClass,
|
|
23
|
+
className,
|
|
24
|
+
));
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<nav class={combinedClass} {...restProps} onmouseenter={() => expanded = true} onmouseleave={() => expanded = false}>
|
|
28
|
+
{#each items as item}
|
|
29
|
+
{@const isActive = page.url.pathname === item.href}
|
|
30
|
+
<Button size="xs" class="{isActive ? 'bg-form-background text-main-text' : 'text-sub-text'} hover:text-main-text py-1 text-nowrap flex justify-start gap-2 overflow-hidden mx-1 w-[calc(100%-16px)] hover:bg-form-background px-1.5" href={item.href}>
|
|
31
|
+
<item.icon class="w-5 h-5 shrink-0"/>
|
|
32
|
+
<Text tag="span" class="transition-opacity duration-200 text-sm text-inherit {expanded ? 'w-auto opacity-100 pr-3' : 'w-0 opacity-0'}">
|
|
33
|
+
{item.label}
|
|
34
|
+
</Text>
|
|
35
|
+
</Button>
|
|
36
|
+
{/each}
|
|
37
|
+
</nav>
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export { default as Modal } from "./components/Modal.svelte";
|
|
|
16
16
|
export { default as Table } from "./components/Table.svelte";
|
|
17
17
|
export { default as Toast } from "./components/Toast.svelte";
|
|
18
18
|
export { default as Toaster } from "./components/Toaster.svelte";
|
|
19
|
+
export { default as SideNavbar } from "./components/SideNavbar.svelte";
|
|
19
20
|
export { fbmBackground } from "./actions/fbm.ts";
|
|
20
21
|
export { toast } from "./actions/toast.svelte.ts";
|
|
21
22
|
export type { TypewriterAction, DisplaySegment } from "./types/Typewriter.ts";
|
package/dist/index.js
CHANGED
|
@@ -16,5 +16,6 @@ export { default as Modal } from "./components/Modal.svelte";
|
|
|
16
16
|
export { default as Table } from "./components/Table.svelte";
|
|
17
17
|
export { default as Toast } from "./components/Toast.svelte";
|
|
18
18
|
export { default as Toaster } from "./components/Toaster.svelte";
|
|
19
|
+
export { default as SideNavbar } from "./components/SideNavbar.svelte";
|
|
19
20
|
export { fbmBackground } from "./actions/fbm.js";
|
|
20
21
|
export { toast } from "./actions/toast.svelte.js";
|
package/dist/types/Navbar.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Component } from "svelte";
|
|
1
2
|
import type { BaseComponentProps } from "./BaseComponent.ts";
|
|
2
3
|
export interface NavbarProps extends BaseComponentProps {
|
|
3
4
|
classTop?: string;
|
|
@@ -9,3 +10,11 @@ export interface NavbarElementProps extends BaseComponentProps {
|
|
|
9
10
|
href?: string;
|
|
10
11
|
threshold?: number;
|
|
11
12
|
}
|
|
13
|
+
export interface SideNavbarProps extends BaseComponentProps {
|
|
14
|
+
items?: SideNavbarItem[];
|
|
15
|
+
}
|
|
16
|
+
export interface SideNavbarItem {
|
|
17
|
+
href: string;
|
|
18
|
+
label: string;
|
|
19
|
+
icon: Component;
|
|
20
|
+
}
|
package/dist/types/Navbar.js
CHANGED