@valerius_petrini/corekit-ui 0.1.80 → 0.1.82
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.
- package/README.md +2 -64
- package/dist/components/display/Card/index.svelte +2 -4
- package/dist/components/display/Card/types.d.ts +6 -0
- package/dist/components/display/Card/variant.js +1 -1
- package/dist/components/display/KBD/index.svelte +2 -1
- package/dist/components/display/Skeleton/index.svelte +1 -2
- package/dist/components/feedback/Loader/index.svelte +1 -3
- package/dist/components/feedback/Modal/index.svelte +17 -29
- package/dist/components/navigation/Navbar/NavbarDropdown.svelte +7 -4
- package/dist/components/navigation/Navbar/NavbarElement.svelte +0 -6
- package/dist/components/navigation/Navbar/NavbarStoryWrapper.svelte +10 -0
- package/dist/components/navigation/Navbar/NavbarStoryWrapper.svelte.d.ts +26 -0
- package/dist/components/navigation/Navbar/index.stories.svelte +11 -2
- package/dist/components/navigation/Navbar/index.svelte +8 -7
- package/dist/components/navigation/Navbar/types.d.ts +3 -2
- package/dist/components/navigation/SideNavbar/SideNavbarStoryWrapper.svelte +3 -0
- package/dist/components/navigation/SideNavbar/SideNavbarStoryWrapper.svelte.d.ts +26 -0
- package/dist/components/navigation/SideNavbar/index.stories.svelte +22 -0
- package/dist/components/navigation/SideNavbar/index.stories.svelte.d.ts +18 -0
- package/dist/components/navigation/SideNavbar/index.svelte +5 -4
- package/dist/components/navigation/SideNavbar/types.d.ts +2 -0
- package/dist/components/typography/Text/index.svelte +7 -7
- package/dist/styles/layout.css +15 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,65 +1,3 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Corekit UI
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Read more about creating a library [in the docs](https://svelte.dev/docs/kit/packaging).
|
|
6
|
-
|
|
7
|
-
## Creating a project
|
|
8
|
-
|
|
9
|
-
If you're seeing this, you've probably already done this step. Congrats!
|
|
10
|
-
|
|
11
|
-
```sh
|
|
12
|
-
# create a new project in the current directory
|
|
13
|
-
npx sv create
|
|
14
|
-
|
|
15
|
-
# create a new project in my-app
|
|
16
|
-
npx sv create my-app
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
To recreate this project with the same configuration:
|
|
20
|
-
|
|
21
|
-
```sh
|
|
22
|
-
# recreate this project
|
|
23
|
-
npx sv@0.12.5 create --template library --types ts --add tailwindcss="plugins:typography,forms" --install npm ./
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Developing
|
|
27
|
-
|
|
28
|
-
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
|
29
|
-
|
|
30
|
-
```sh
|
|
31
|
-
npm run dev
|
|
32
|
-
|
|
33
|
-
# or start the server and open the app in a new browser tab
|
|
34
|
-
npm run dev -- --open
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Everything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.
|
|
38
|
-
|
|
39
|
-
## Building
|
|
40
|
-
|
|
41
|
-
To build your library:
|
|
42
|
-
|
|
43
|
-
```sh
|
|
44
|
-
npm pack
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
To create a production version of your showcase app:
|
|
48
|
-
|
|
49
|
-
```sh
|
|
50
|
-
npm run build
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
You can preview the production build with `npm run preview`.
|
|
54
|
-
|
|
55
|
-
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
|
|
56
|
-
|
|
57
|
-
## Publishing
|
|
58
|
-
|
|
59
|
-
Go into the `package.json` and give your package the desired name through the `"name"` option. Also consider adding a `"license"` field and point it to a `LICENSE` file which you can create from a template (one popular option is the [MIT license](https://opensource.org/license/mit/)).
|
|
60
|
-
|
|
61
|
-
To publish your library to [npm](https://www.npmjs.com):
|
|
62
|
-
|
|
63
|
-
```sh
|
|
64
|
-
npm publish
|
|
65
|
-
```
|
|
3
|
+
Corekit UI is a component library written in Svelte 5
|
|
@@ -17,11 +17,9 @@
|
|
|
17
17
|
...restProps
|
|
18
18
|
}: CardProps = $props();
|
|
19
19
|
|
|
20
|
-
let defaultClass = "text-main-text rounded-lg transition-colors ease-in-out bg-sub-background p-4 w-full";
|
|
21
|
-
let linkClass = "block hover:bg-sub-background-hover cursor-pointer";
|
|
22
20
|
let combinedClass = $derived(twMerge(
|
|
23
|
-
|
|
24
|
-
href &&
|
|
21
|
+
"text-main-text rounded-lg transition-all ease-in-out bg-gradient-to-br from-sub-background to-sub-background-accent p-4 w-full",
|
|
22
|
+
href && "block hover:bg-sub-background-hover cursor-pointer",
|
|
25
23
|
cardVariantStyles[variant],
|
|
26
24
|
getSizeStyleClass(size, "card"),
|
|
27
25
|
getSizeStyleClass(radius, "radius"),
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { SizeStyle } from "../../../styles/size";
|
|
2
2
|
import type { BaseComponentProps } from "../../../types/BaseComponent";
|
|
3
3
|
export type CardVariant = "bordered" | "elevated";
|
|
4
|
+
/**
|
|
5
|
+
* <Corekit UI> A Card component
|
|
6
|
+
*
|
|
7
|
+
* @prop `href` Defines the website the card will link to
|
|
8
|
+
* @prop `external` Opens the website in a new tab. Only works if `href` is defined.
|
|
9
|
+
*/
|
|
4
10
|
export interface CardProps extends BaseComponentProps {
|
|
5
11
|
href?: string;
|
|
6
12
|
external?: boolean;
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
}: any = $props();
|
|
11
11
|
|
|
12
12
|
const defaultClass = "inline-flex flex-col items-center justify-center rounded bg-sub-background px-1.5 py-0.5 text-xs font-mono text-main-text border-sub-background-hover border-1";
|
|
13
|
+
const subtextClass = "text-sub-text text-[10px] mt-0.5";
|
|
13
14
|
|
|
14
15
|
const combinedClass = $derived(twMerge(defaultClass, className));
|
|
15
16
|
</script>
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
<kbd class={combinedClass} {...restProps} bind:this={element}>
|
|
18
19
|
{@render children?.()}
|
|
19
20
|
{#if subtext}
|
|
20
|
-
<span class=
|
|
21
|
+
<span class={subtextClass}>
|
|
21
22
|
{@render subtext?.()}
|
|
22
23
|
</span>
|
|
23
24
|
{/if}
|
|
@@ -16,9 +16,8 @@
|
|
|
16
16
|
const defaultWidths = [21, 19, 24, 15, 10, 30, 22, 17, 26, 20, 28, 10, 22, 45, 16, 23, 37, 25, 25];
|
|
17
17
|
const widths = $derived(Array.from({ length: count }, (_, i) => defaultWidths[i % defaultWidths.length]));
|
|
18
18
|
|
|
19
|
-
const defaultContainerClass = "animate-pulse duration-100 w-lg flex flex-col gap-2";
|
|
20
19
|
const combinedContainerClass = $derived(twMerge(
|
|
21
|
-
|
|
20
|
+
"animate-pulse duration-100 w-lg flex flex-col gap-2",
|
|
22
21
|
getSizeStyleClass(size, "card"),
|
|
23
22
|
className
|
|
24
23
|
));
|
|
@@ -12,10 +12,8 @@
|
|
|
12
12
|
...restProps
|
|
13
13
|
}: LoaderProps = $props();
|
|
14
14
|
|
|
15
|
-
const defaultClass = "loader rounded-full border-main-text border-4";
|
|
16
|
-
|
|
17
15
|
let sizeClass = $derived(twMerge(
|
|
18
|
-
|
|
16
|
+
"loader rounded-full border-main-text border-4",
|
|
19
17
|
getSizeStyleClass(size, "loader"),
|
|
20
18
|
className,
|
|
21
19
|
generateColorStyle(color, "loader"),
|
|
@@ -9,26 +9,13 @@
|
|
|
9
9
|
let {
|
|
10
10
|
children = undefined,
|
|
11
11
|
class: className = "",
|
|
12
|
-
element = $bindable
|
|
13
|
-
open = $bindable(
|
|
12
|
+
element = $bindable(),
|
|
13
|
+
open = $bindable(),
|
|
14
14
|
position = "center",
|
|
15
15
|
size = "md",
|
|
16
16
|
...restProps
|
|
17
17
|
}: ModalProps = $props();
|
|
18
18
|
|
|
19
|
-
$effect(() => {
|
|
20
|
-
if (!element) return;
|
|
21
|
-
if (open) {
|
|
22
|
-
(element as HTMLDialogElement).showModal();
|
|
23
|
-
} else {
|
|
24
|
-
(element as HTMLDialogElement).close();
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
function onclose() {
|
|
29
|
-
open = false;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
19
|
const outerClass = $derived(twMerge(
|
|
33
20
|
"inset-0 flex flex-col w-[calc(100%-1rem)] h-[calc(100%-1rem)] p-4",
|
|
34
21
|
modalPositionParts[position]
|
|
@@ -41,19 +28,20 @@
|
|
|
41
28
|
));
|
|
42
29
|
</script>
|
|
43
30
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
>
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
31
|
+
{#if open}
|
|
32
|
+
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
33
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
34
|
+
<div
|
|
35
|
+
class="w-full h-screen bg-black/50 z-300 fixed top-0 left-0"
|
|
36
|
+
transition:fade={{ duration: 200 }}
|
|
37
|
+
onclick={() => open = false}
|
|
38
|
+
bind:this={element}>
|
|
39
|
+
<div
|
|
40
|
+
class={outerClass}
|
|
41
|
+
transition:fly={{ y: -20, duration: 200 }}>
|
|
42
|
+
<Card class={cardClass} {...restProps} onclick={(e: MouseEvent) => e.stopPropagation()}>
|
|
43
|
+
{@render children()}
|
|
56
44
|
</Card>
|
|
57
45
|
</div>
|
|
58
|
-
|
|
59
|
-
|
|
46
|
+
</div>
|
|
47
|
+
{/if}
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
wrapperClass = "",
|
|
23
23
|
label = "",
|
|
24
24
|
navelement = undefined,
|
|
25
|
+
showArrow = true,
|
|
25
26
|
...restProps
|
|
26
27
|
}: NavbarDropdownProps = $props();
|
|
27
28
|
|
|
@@ -90,10 +91,12 @@
|
|
|
90
91
|
{#if navelement}
|
|
91
92
|
{@render navelement()}
|
|
92
93
|
{/if}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
{#if showArrow}
|
|
95
|
+
<span class="sr-only">{open ? 'Close' : 'Open'} dropdown</span>
|
|
96
|
+
<ChevronDown
|
|
97
|
+
class="mt-0.5 transition-transform ease-out duration-150 {open ? 'rotate-180' : 'rotate-0'}"
|
|
98
|
+
size="16"/>
|
|
99
|
+
{/if}
|
|
97
100
|
</NavbarElement>
|
|
98
101
|
|
|
99
102
|
{#if open}
|
|
@@ -18,19 +18,13 @@
|
|
|
18
18
|
|
|
19
19
|
let defaultClass = "navbar-element w-fit h-fit mx-2 px-2.5 py-1.5 rounded text-main-text";
|
|
20
20
|
|
|
21
|
-
let scrollY = $state(0);
|
|
22
|
-
let isAtTop = $derived(scrollY <= threshold);
|
|
23
|
-
|
|
24
21
|
const combinedClass = $derived(twMerge(
|
|
25
22
|
defaultClass,
|
|
26
23
|
className,
|
|
27
24
|
active ? activeClass : "",
|
|
28
|
-
isAtTop ? classTop : "",
|
|
29
25
|
));
|
|
30
26
|
</script>
|
|
31
27
|
|
|
32
|
-
<svelte:window bind:scrollY={scrollY}/>
|
|
33
|
-
|
|
34
28
|
<Button bind:element radius="none" {href} {color} class={combinedClass} {...restProps} aria-current={active ? 'page' : undefined}>
|
|
35
29
|
{@render children?.()}
|
|
36
30
|
</Button>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { fbmBackground } from "../../../actions/fbm";
|
|
3
|
+
import Text from "../../typography/Text/index.svelte";
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<div class="h-screen w-full">
|
|
7
|
+
<slot />
|
|
8
|
+
<canvas class="w-full h-screen" use:fbmBackground></canvas>
|
|
9
|
+
<Text class="p-3">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</Text>
|
|
10
|
+
</div>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default NavbarStoryWrapper;
|
|
2
|
+
type NavbarStoryWrapper = SvelteComponent<any, {
|
|
3
|
+
[evt: string]: CustomEvent<any>;
|
|
4
|
+
}, {
|
|
5
|
+
default: {};
|
|
6
|
+
}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const NavbarStoryWrapper: $$__sveltets_2_IsomorphicComponent<any, {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
}, {
|
|
12
|
+
default: {};
|
|
13
|
+
}, {}, string>;
|
|
14
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
import { defineMeta } from "@storybook/addon-svelte-csf";
|
|
3
3
|
import Navbar from "./index.svelte";
|
|
4
4
|
import NavbarElement from "./NavbarElement.svelte";
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import NavbarSeparator from "./NavbarSeparator.svelte";
|
|
6
|
+
import NavbarDropdown from "./NavbarDropdown.svelte";
|
|
7
|
+
import NavbarStoryWrapper from "./NavbarStoryWrapper.svelte";
|
|
8
|
+
import type { Component } from "svelte";
|
|
9
|
+
import type { NavbarProps } from "./types";
|
|
7
10
|
|
|
8
11
|
const { Story } = defineMeta({
|
|
9
12
|
title: "Components/Navigation/Navbar",
|
|
@@ -11,6 +14,12 @@
|
|
|
11
14
|
argTypes: {
|
|
12
15
|
|
|
13
16
|
},
|
|
17
|
+
parameters: {
|
|
18
|
+
layout: "fullscreen",
|
|
19
|
+
},
|
|
20
|
+
decorators: [
|
|
21
|
+
() => ({ Component: NavbarStoryWrapper as unknown as Component<NavbarProps, {}, "element"> })
|
|
22
|
+
]
|
|
14
23
|
});
|
|
15
24
|
</script>
|
|
16
25
|
|
|
@@ -5,21 +5,22 @@
|
|
|
5
5
|
let {
|
|
6
6
|
children = undefined,
|
|
7
7
|
class: className = "",
|
|
8
|
-
|
|
9
|
-
threshold = 10,
|
|
8
|
+
scrollThreshold = 10,
|
|
10
9
|
element = $bindable(),
|
|
10
|
+
variant = "default",
|
|
11
11
|
...restProps
|
|
12
12
|
}: NavbarProps = $props();
|
|
13
13
|
|
|
14
|
-
let defaultClass = "transition-colors duration-300 fixed top-0 left-0 w-full h-14 z-[100] flex items-center bg-sub-background
|
|
14
|
+
let defaultClass = "transition-colors duration-300 fixed top-0 left-0 w-full h-14 z-[100] flex items-center bg-sub-background border-b border-box border-b-sub-background-hover px-4 md:px-6 lg:px-8 backdrop-blur-sm";
|
|
15
|
+
let topClass = "bg-transparent border-b-transparent [&>_.navbar-element]:bg-transparent!";
|
|
15
16
|
|
|
16
|
-
let scrollY = $state(0);
|
|
17
|
-
let isAtTop = $derived(scrollY <=
|
|
17
|
+
let scrollY = $state(typeof window !== "undefined" ? window.scrollY : 0);
|
|
18
|
+
let isAtTop = $derived(scrollY <= scrollThreshold);
|
|
18
19
|
|
|
19
20
|
const combinedClass = $derived(twMerge(
|
|
20
21
|
defaultClass,
|
|
21
22
|
className,
|
|
22
|
-
isAtTop
|
|
23
|
+
(isAtTop && variant === "hero") && topClass
|
|
23
24
|
));
|
|
24
25
|
</script>
|
|
25
26
|
|
|
@@ -27,4 +28,4 @@
|
|
|
27
28
|
|
|
28
29
|
<nav class={combinedClass} {...restProps} bind:this={element}>
|
|
29
30
|
{@render children?.()}
|
|
30
|
-
</nav>
|
|
31
|
+
</nav>
|
|
@@ -3,14 +3,14 @@ import type { BaseComponentProps } from "../../../types/BaseComponent.ts";
|
|
|
3
3
|
import type { ColorStyle } from "../../../styles/color.ts";
|
|
4
4
|
export interface NavbarProps extends BaseComponentProps {
|
|
5
5
|
classTop?: string;
|
|
6
|
-
|
|
6
|
+
scrollThreshold?: number;
|
|
7
|
+
variant?: "default" | "hero";
|
|
7
8
|
}
|
|
8
9
|
export interface NavbarElementProps extends BaseComponentProps {
|
|
9
10
|
classTop?: string;
|
|
10
11
|
activeClass?: string;
|
|
11
12
|
active?: boolean;
|
|
12
13
|
href?: string;
|
|
13
|
-
threshold?: number;
|
|
14
14
|
color?: ColorStyle;
|
|
15
15
|
}
|
|
16
16
|
export type NavbarSeparatorVariant = "vertical" | "horizontal" | "dynamic";
|
|
@@ -25,4 +25,5 @@ export interface NavbarDropdownProps extends BaseComponentProps {
|
|
|
25
25
|
wrapperClass?: string;
|
|
26
26
|
activeClass?: string;
|
|
27
27
|
threshold?: number;
|
|
28
|
+
showArrow?: boolean;
|
|
28
29
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default SideNavbarStoryWrapper;
|
|
2
|
+
type SideNavbarStoryWrapper = SvelteComponent<any, {
|
|
3
|
+
[evt: string]: CustomEvent<any>;
|
|
4
|
+
}, {
|
|
5
|
+
default: {};
|
|
6
|
+
}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const SideNavbarStoryWrapper: $$__sveltets_2_IsomorphicComponent<any, {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
}, {
|
|
12
|
+
default: {};
|
|
13
|
+
}, {}, string>;
|
|
14
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from "@storybook/addon-svelte-csf";
|
|
3
|
+
import SideNavbar from "./index.svelte";
|
|
4
|
+
|
|
5
|
+
import Home from "@lucide/svelte/icons/home";
|
|
6
|
+
import Book from "@lucide/svelte/icons/book";
|
|
7
|
+
import Database from "@lucide/svelte/icons/database";
|
|
8
|
+
|
|
9
|
+
const { Story } = defineMeta({
|
|
10
|
+
title: "Components/Navigation/SideNavbar",
|
|
11
|
+
component: SideNavbar,
|
|
12
|
+
parameters: {
|
|
13
|
+
layout: "fullscreen",
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<Story name="Default" args={{ items: [
|
|
19
|
+
{ label: "Home", href: "/", icon: Home },
|
|
20
|
+
{ label: "Library", href: "/library", icon: Book },
|
|
21
|
+
{ label: "Data", href: "/data", icon: Database },
|
|
22
|
+
], offset: "0" }}></Story>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const Index: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type Index = InstanceType<typeof Index>;
|
|
18
|
+
export default Index;
|
|
@@ -3,19 +3,20 @@
|
|
|
3
3
|
import { twMerge } from "tailwind-merge";
|
|
4
4
|
import Button from "../../inputs/Button/index.svelte";
|
|
5
5
|
import Text from "../../typography/Text/index.svelte";
|
|
6
|
-
import { page } from '$app/state';
|
|
7
6
|
|
|
8
7
|
let {
|
|
9
8
|
children = undefined,
|
|
10
9
|
class: className = "",
|
|
11
10
|
element = $bindable(),
|
|
12
11
|
items = [],
|
|
12
|
+
currentPath = "",
|
|
13
|
+
offset = "3.5rem",
|
|
13
14
|
...restProps
|
|
14
15
|
}: SideNavbarProps = $props();
|
|
15
16
|
|
|
16
17
|
let expanded = $state(false);
|
|
17
18
|
|
|
18
|
-
const defaultClass = "transition-[width] duration-300 overflow-hidden fixed left-0 h-full
|
|
19
|
+
const defaultClass = "transition-[width] duration-300 overflow-hidden fixed left-0 h-full z-[100] py-2 flex flex-col items-center gap-1 bg-sub-background border-r border-box border-r-sub-background-hover";
|
|
19
20
|
const expandedClass = $derived(expanded ? "w-48" : "w-12");
|
|
20
21
|
|
|
21
22
|
const combinedClass = $derived(twMerge(
|
|
@@ -25,9 +26,9 @@
|
|
|
25
26
|
));
|
|
26
27
|
</script>
|
|
27
28
|
|
|
28
|
-
<nav class={combinedClass} {...restProps} onmouseenter={() => expanded = true} onmouseleave={() => expanded = false} bind:this={element}>
|
|
29
|
+
<nav style="margin-top: {offset}" class={combinedClass} {...restProps} onmouseenter={() => expanded = true} onmouseleave={() => expanded = false} bind:this={element}>
|
|
29
30
|
{#each items as item}
|
|
30
|
-
{@const isActive =
|
|
31
|
+
{@const isActive = currentPath === item.href}
|
|
31
32
|
<Button size="xs" color="none" 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}>
|
|
32
33
|
<item.icon class="w-5 h-5 shrink-0"/>
|
|
33
34
|
<Text tag="span" class="transition-opacity duration-200 text-sm text-inherit {expanded ? 'w-auto opacity-100 pr-3' : 'w-0 opacity-0'}">
|
|
@@ -2,6 +2,8 @@ import type { BaseComponentProps } from "../../../types/BaseComponent";
|
|
|
2
2
|
import type { Component } from "svelte";
|
|
3
3
|
export interface SideNavbarProps extends BaseComponentProps {
|
|
4
4
|
items?: SideNavbarItem[];
|
|
5
|
+
currentPath?: string;
|
|
6
|
+
offset?: string;
|
|
5
7
|
}
|
|
6
8
|
export interface SideNavbarItem {
|
|
7
9
|
href: string;
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
"code": { class: "font-mono bg-sub-background px-1 rounded inline-block", size: "text-base" },
|
|
30
30
|
"a": { class: "text-blue-400 decoration-blue-400/0 underline underline-offset-2 transition-all cursor-pointer duration-150 hover:decoration-blue-400 ", size: "text-base" },
|
|
31
31
|
"li": { class: "text-base list-disc list-inside", size: "text-base" },
|
|
32
|
-
"h1": { class: "font-bold", size: "text-4xl" },
|
|
33
|
-
"h2": { class: "font-bold", size: "text-3xl" },
|
|
34
|
-
"h3": { class: "font-semibold", size: "text-2xl" },
|
|
35
|
-
"h4": { class: "font-semibold", size: "text-xl" },
|
|
36
|
-
"h5": { class: "font-medium", size: "text-lg" },
|
|
37
|
-
"h6": { class: "font-normal", size: "text-base" }
|
|
32
|
+
"h1": { class: "font-bold font-display", size: "text-4xl" },
|
|
33
|
+
"h2": { class: "font-bold font-display", size: "text-3xl" },
|
|
34
|
+
"h3": { class: "font-semibold font-display", size: "text-2xl" },
|
|
35
|
+
"h4": { class: "font-semibold font-display", size: "text-xl" },
|
|
36
|
+
"h5": { class: "font-medium font-display", size: "text-lg" },
|
|
37
|
+
"h6": { class: "font-normal font-display", size: "text-base" }
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
function getTextSizeInRem(): string {
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
: ""
|
|
52
52
|
);
|
|
53
53
|
|
|
54
|
-
let defaultClass = "text-main-text";
|
|
54
|
+
let defaultClass = "text-main-text font-body";
|
|
55
55
|
let combinedClass = $derived(twMerge(
|
|
56
56
|
defaultClass,
|
|
57
57
|
tagStyles[tag]?.class || "",
|
package/dist/styles/layout.css
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
--color-main-background: var(--vpcui-main-background);
|
|
11
11
|
--color-sub-background: var(--vpcui-sub-background);
|
|
12
12
|
--color-sub-background-hover: var(--vpcui-sub-background-hover);
|
|
13
|
+
--color-sub-background-border: var(--vpcui-sub-background-border);
|
|
14
|
+
--color-sub-background-accent: var(--vpcui-sub-background-accent);
|
|
13
15
|
--color-main-text: var(--vpcui-main-text);
|
|
14
16
|
--color-sub-text: var(--vpcui-sub-text);
|
|
15
17
|
--color-contrast-text: var(--vpcui-contrast-text);
|
|
@@ -58,6 +60,10 @@
|
|
|
58
60
|
--color-accent-800: #164e63;
|
|
59
61
|
--color-accent-900: #0c2f3d;
|
|
60
62
|
--color-accent-950: #061e28;
|
|
63
|
+
|
|
64
|
+
--font-display: var(--vpcui-font-display);
|
|
65
|
+
--font-body: var(--vpcui-font-body);
|
|
66
|
+
--font-mono: var(--vpcui-font-mono);
|
|
61
67
|
}
|
|
62
68
|
|
|
63
69
|
:root {
|
|
@@ -73,6 +79,8 @@
|
|
|
73
79
|
--vpcui-main-background: var(--vpcui-light-50);
|
|
74
80
|
--vpcui-sub-background: var(--vpcui-light-100);
|
|
75
81
|
--vpcui-sub-background-hover: var(--vpcui-light-150);
|
|
82
|
+
--vpcui-sub-background-border: var(--vpcui-light-150);
|
|
83
|
+
--vpcui-sub-background-accent: var(--vpcui-light-150);
|
|
76
84
|
--vpcui-main-text: var(--vpcui-light-950);
|
|
77
85
|
--vpcui-sub-text: var(--vpcui-light-300);
|
|
78
86
|
--vpcui-contrast-text: var(--vpcui-light-950);
|
|
@@ -81,11 +89,16 @@
|
|
|
81
89
|
--vpcui-form-border: var(--vpcui-light-250);
|
|
82
90
|
|
|
83
91
|
--vpcui-loader-btn-color: rgba(255, 255, 255, 0.25);
|
|
92
|
+
|
|
93
|
+
--vpcui-font-display: ui-serif, Georgia, serif;
|
|
94
|
+
--vpcui-font-body: ui-sans-serif, system-ui sans-serif;
|
|
95
|
+
--vpcui-font-mono: ui-monospace, monospace;
|
|
84
96
|
}
|
|
85
97
|
|
|
86
98
|
html.dark {
|
|
87
99
|
--vpcui-dark-50: #121212;
|
|
88
100
|
--vpcui-dark-100: #1E1E1E;
|
|
101
|
+
--vpcui-dark-125: #212121;
|
|
89
102
|
--vpcui-dark-150: #2A2A2A;
|
|
90
103
|
--vpcui-dark-200: #3A3A3A;
|
|
91
104
|
--vpcui-dark-250: #4A4A4A;
|
|
@@ -96,6 +109,8 @@ html.dark {
|
|
|
96
109
|
--vpcui-main-background: var(--vpcui-dark-50);
|
|
97
110
|
--vpcui-sub-background: var(--vpcui-dark-100);
|
|
98
111
|
--vpcui-sub-background-hover: var(--vpcui-dark-150);
|
|
112
|
+
--vpcui-sub-background-border: var(--vpcui-dark-150);
|
|
113
|
+
--vpcui-sub-background-accent: var(--vpcui-dark-125);
|
|
99
114
|
--vpcui-main-text: var(--vpcui-dark-950);
|
|
100
115
|
--vpcui-sub-text: var(--vpcui-dark-300);
|
|
101
116
|
--vpcui-contrast-text: var(--vpcui-dark-50);
|