sv5ui 2.2.0 → 2.3.0
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/dist/components/Error/Error.svelte +89 -0
- package/dist/components/Error/Error.svelte.d.ts +5 -0
- package/dist/components/Error/error.types.d.ts +87 -0
- package/dist/components/Error/error.types.js +1 -0
- package/dist/components/Error/error.variants.d.ts +66 -0
- package/dist/components/Error/error.variants.js +16 -0
- package/dist/components/Error/index.d.ts +2 -0
- package/dist/components/Error/index.js +1 -0
- package/dist/components/Footer/Footer.svelte +71 -0
- package/dist/components/Footer/Footer.svelte.d.ts +5 -0
- package/dist/components/Footer/FooterColumns.svelte +110 -0
- package/dist/components/Footer/FooterColumns.svelte.d.ts +5 -0
- package/dist/components/Footer/footer-columns.types.d.ts +73 -0
- package/dist/components/Footer/footer-columns.types.js +1 -0
- package/dist/components/Footer/footer-columns.variants.d.ts +108 -0
- package/dist/components/Footer/footer-columns.variants.js +23 -0
- package/dist/components/Footer/footer.types.d.ts +46 -0
- package/dist/components/Footer/footer.types.js +1 -0
- package/dist/components/Footer/footer.variants.d.ts +66 -0
- package/dist/components/Footer/footer.variants.js +16 -0
- package/dist/components/Footer/index.d.ts +4 -0
- package/dist/components/Footer/index.js +2 -0
- package/dist/components/Header/Header.svelte +177 -0
- package/dist/components/Header/Header.svelte.d.ts +5 -0
- package/dist/components/Header/header.types.d.ts +124 -0
- package/dist/components/Header/header.types.js +1 -0
- package/dist/components/Header/header.variants.d.ts +108 -0
- package/dist/components/Header/header.variants.js +32 -0
- package/dist/components/Header/index.d.ts +2 -0
- package/dist/components/Header/index.js +1 -0
- package/dist/components/Main/Main.svelte +20 -0
- package/dist/components/Main/Main.svelte.d.ts +5 -0
- package/dist/components/Main/index.d.ts +2 -0
- package/dist/components/Main/index.js +1 -0
- package/dist/components/Main/main.types.d.ts +27 -0
- package/dist/components/Main/main.types.js +1 -0
- package/dist/components/Main/main.variants.d.ts +30 -0
- package/dist/components/Main/main.variants.js +10 -0
- package/dist/components/Tour/Tour.svelte +459 -0
- package/dist/components/Tour/Tour.svelte.d.ts +5 -0
- package/dist/components/Tour/index.d.ts +2 -0
- package/dist/components/Tour/index.js +1 -0
- package/dist/components/Tour/tour.types.d.ts +457 -0
- package/dist/components/Tour/tour.types.js +1 -0
- package/dist/components/Tour/tour.variants.d.ts +208 -0
- package/dist/components/Tour/tour.variants.js +56 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.js +2 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useTour/index.d.ts +1 -0
- package/dist/hooks/useTour/index.js +1 -0
- package/dist/hooks/useTour/useTour.svelte.d.ts +29 -0
- package/dist/hooks/useTour/useTour.svelte.js +194 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/theme.css +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
+
import type { FooterSlots } from './footer.variants.js';
|
|
5
|
+
export type FooterProps = Omit<HTMLAttributes<HTMLElement>, 'class'> & {
|
|
6
|
+
/**
|
|
7
|
+
* Bindable reference to the root DOM element.
|
|
8
|
+
*/
|
|
9
|
+
ref?: HTMLElement | null;
|
|
10
|
+
/**
|
|
11
|
+
* Renders the footer as a different HTML element.
|
|
12
|
+
* @default 'footer'
|
|
13
|
+
*/
|
|
14
|
+
as?: keyof HTMLElementTagNameMap;
|
|
15
|
+
/**
|
|
16
|
+
* Override styles for specific footer slots.
|
|
17
|
+
*/
|
|
18
|
+
ui?: Partial<Record<FooterSlots, ClassNameValue>>;
|
|
19
|
+
/**
|
|
20
|
+
* Additional CSS classes for the root element.
|
|
21
|
+
*/
|
|
22
|
+
class?: ClassNameValue;
|
|
23
|
+
/**
|
|
24
|
+
* Content rendered above the main footer row.
|
|
25
|
+
* Designed for FooterColumns.
|
|
26
|
+
*/
|
|
27
|
+
top?: Snippet;
|
|
28
|
+
/**
|
|
29
|
+
* Left area of the main row, typically copyright.
|
|
30
|
+
* Last in the mobile stack, first on lg+.
|
|
31
|
+
*/
|
|
32
|
+
left?: Snippet;
|
|
33
|
+
/**
|
|
34
|
+
* Center area of the main row, typically navigation links.
|
|
35
|
+
*/
|
|
36
|
+
children?: Snippet;
|
|
37
|
+
/**
|
|
38
|
+
* Right area of the main row, typically social buttons.
|
|
39
|
+
* First in the mobile stack, last on lg+.
|
|
40
|
+
*/
|
|
41
|
+
right?: Snippet;
|
|
42
|
+
/**
|
|
43
|
+
* Content rendered below the main footer row.
|
|
44
|
+
*/
|
|
45
|
+
bottom?: Snippet;
|
|
46
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export declare const footerVariants: import("tailwind-variants").TVReturnType<{
|
|
2
|
+
[key: string]: {
|
|
3
|
+
[key: string]: import("tailwind-merge").ClassNameValue | {
|
|
4
|
+
root?: import("tailwind-merge").ClassNameValue;
|
|
5
|
+
container?: import("tailwind-merge").ClassNameValue;
|
|
6
|
+
center?: import("tailwind-merge").ClassNameValue;
|
|
7
|
+
top?: import("tailwind-merge").ClassNameValue;
|
|
8
|
+
left?: import("tailwind-merge").ClassNameValue;
|
|
9
|
+
right?: import("tailwind-merge").ClassNameValue;
|
|
10
|
+
bottom?: import("tailwind-merge").ClassNameValue;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
} | {
|
|
14
|
+
[x: string]: {
|
|
15
|
+
[x: string]: import("tailwind-merge").ClassNameValue | {
|
|
16
|
+
root?: import("tailwind-merge").ClassNameValue;
|
|
17
|
+
container?: import("tailwind-merge").ClassNameValue;
|
|
18
|
+
center?: import("tailwind-merge").ClassNameValue;
|
|
19
|
+
top?: import("tailwind-merge").ClassNameValue;
|
|
20
|
+
left?: import("tailwind-merge").ClassNameValue;
|
|
21
|
+
right?: import("tailwind-merge").ClassNameValue;
|
|
22
|
+
bottom?: import("tailwind-merge").ClassNameValue;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
} | {}, {
|
|
26
|
+
root: string;
|
|
27
|
+
top: string;
|
|
28
|
+
container: string;
|
|
29
|
+
left: string;
|
|
30
|
+
center: string;
|
|
31
|
+
right: string;
|
|
32
|
+
bottom: string;
|
|
33
|
+
}, undefined, {
|
|
34
|
+
[key: string]: {
|
|
35
|
+
[key: string]: import("tailwind-merge").ClassNameValue | {
|
|
36
|
+
root?: import("tailwind-merge").ClassNameValue;
|
|
37
|
+
container?: import("tailwind-merge").ClassNameValue;
|
|
38
|
+
center?: import("tailwind-merge").ClassNameValue;
|
|
39
|
+
top?: import("tailwind-merge").ClassNameValue;
|
|
40
|
+
left?: import("tailwind-merge").ClassNameValue;
|
|
41
|
+
right?: import("tailwind-merge").ClassNameValue;
|
|
42
|
+
bottom?: import("tailwind-merge").ClassNameValue;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
} | {}, {
|
|
46
|
+
root: string;
|
|
47
|
+
top: string;
|
|
48
|
+
container: string;
|
|
49
|
+
left: string;
|
|
50
|
+
center: string;
|
|
51
|
+
right: string;
|
|
52
|
+
bottom: string;
|
|
53
|
+
}, import("tailwind-variants").TVReturnType<unknown, {
|
|
54
|
+
root: string;
|
|
55
|
+
top: string;
|
|
56
|
+
container: string;
|
|
57
|
+
left: string;
|
|
58
|
+
center: string;
|
|
59
|
+
right: string;
|
|
60
|
+
bottom: string;
|
|
61
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
62
|
+
export type FooterSlots = keyof ReturnType<typeof footerVariants>;
|
|
63
|
+
export declare const footerDefaults: {
|
|
64
|
+
defaultVariants: Record<string, never>;
|
|
65
|
+
slots: Partial<Record<FooterSlots, string>>;
|
|
66
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
export const footerVariants = tv({
|
|
3
|
+
slots: {
|
|
4
|
+
root: 'border-t border-outline-variant',
|
|
5
|
+
top: 'py-8 lg:py-12',
|
|
6
|
+
container: 'flex flex-col items-center gap-y-3 py-8 lg:flex-row lg:items-center lg:justify-between lg:gap-x-3 lg:py-4',
|
|
7
|
+
left: 'flex items-center justify-center gap-x-1.5 text-sm text-on-surface-variant lg:order-1 lg:flex-1 lg:justify-start',
|
|
8
|
+
center: 'flex items-center justify-center lg:order-2',
|
|
9
|
+
right: 'flex items-center justify-center gap-x-1.5 lg:order-3 lg:flex-1 lg:justify-end',
|
|
10
|
+
bottom: 'py-8 text-sm text-on-surface-variant lg:py-12'
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
export const footerDefaults = {
|
|
14
|
+
defaultVariants: {},
|
|
15
|
+
slots: {}
|
|
16
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as Footer } from './Footer.svelte';
|
|
2
|
+
export { default as FooterColumns } from './FooterColumns.svelte';
|
|
3
|
+
export type { FooterProps } from './footer.types.js';
|
|
4
|
+
export type { FooterColumnsProps, FooterColumn, FooterColumnLink } from './footer-columns.types.js';
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
<script lang="ts" module></script>
|
|
2
|
+
|
|
3
|
+
<script lang="ts">import { headerVariants, headerDefaults } from "./header.variants.js";
|
|
4
|
+
import { getComponentConfig, iconsDefaults } from "../../config.js";
|
|
5
|
+
import { page } from "$app/state";
|
|
6
|
+
import Container from "../Container/Container.svelte";
|
|
7
|
+
import Link from "../Link/Link.svelte";
|
|
8
|
+
import Button from "../Button/Button.svelte";
|
|
9
|
+
import Modal from "../Modal/Modal.svelte";
|
|
10
|
+
import Slideover from "../Slideover/Slideover.svelte";
|
|
11
|
+
import Drawer from "../Drawer/Drawer.svelte";
|
|
12
|
+
const config = getComponentConfig("header", headerDefaults);
|
|
13
|
+
const icons = getComponentConfig("icons", iconsDefaults);
|
|
14
|
+
let {
|
|
15
|
+
ref = $bindable(null),
|
|
16
|
+
as = "header",
|
|
17
|
+
ui,
|
|
18
|
+
title,
|
|
19
|
+
to = "/",
|
|
20
|
+
mode = "modal",
|
|
21
|
+
menu,
|
|
22
|
+
toggle = true,
|
|
23
|
+
toggleSide = config.defaultVariants.toggleSide,
|
|
24
|
+
open = $bindable(false),
|
|
25
|
+
autoClose = true,
|
|
26
|
+
class: className,
|
|
27
|
+
titleSlot,
|
|
28
|
+
left,
|
|
29
|
+
children,
|
|
30
|
+
right,
|
|
31
|
+
toggleSlot,
|
|
32
|
+
top,
|
|
33
|
+
bottom,
|
|
34
|
+
body,
|
|
35
|
+
content,
|
|
36
|
+
...restProps
|
|
37
|
+
} = $props();
|
|
38
|
+
const classes = $derived.by(() => {
|
|
39
|
+
const slots = headerVariants({ toggleSide });
|
|
40
|
+
const c = config.slots;
|
|
41
|
+
const u = ui ?? {};
|
|
42
|
+
return {
|
|
43
|
+
root: slots.root({ class: [c.root, className, u.root] }),
|
|
44
|
+
container: slots.container({ class: [c.container, u.container] }),
|
|
45
|
+
left: slots.left({ class: [c.left, u.left] }),
|
|
46
|
+
center: slots.center({ class: [c.center, u.center] }),
|
|
47
|
+
right: slots.right({ class: [c.right, u.right] }),
|
|
48
|
+
title: slots.title({ class: [c.title, u.title] }),
|
|
49
|
+
toggle: slots.toggle({ class: [c.toggle, u.toggle] }),
|
|
50
|
+
top: slots.top({ class: [c.top, u.top] }),
|
|
51
|
+
bottom: slots.bottom({ class: [c.bottom, u.bottom] }),
|
|
52
|
+
body: slots.body({ class: [c.body, u.body] })
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
const hasMenu = $derived(!!body || !!content);
|
|
56
|
+
const showToggle = $derived(toggle !== false && (!!toggleSlot || hasMenu));
|
|
57
|
+
const userToggle = $derived(typeof toggle === "object" ? toggle : {});
|
|
58
|
+
const toggleProps = $derived({
|
|
59
|
+
color: "secondary",
|
|
60
|
+
variant: "ghost",
|
|
61
|
+
icon: open ? icons.close : icons.menu,
|
|
62
|
+
"aria-label": open ? "Close menu" : "Open menu",
|
|
63
|
+
"aria-expanded": open,
|
|
64
|
+
...userToggle
|
|
65
|
+
});
|
|
66
|
+
const menuUi = $derived({ body: classes.body });
|
|
67
|
+
function handleToggle(event) {
|
|
68
|
+
userToggle.onclick?.(event);
|
|
69
|
+
if (!event.defaultPrevented) {
|
|
70
|
+
open = !open;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
let previousPath = page.url.pathname;
|
|
74
|
+
$effect(() => {
|
|
75
|
+
const path = page.url.pathname;
|
|
76
|
+
if (path !== previousPath) {
|
|
77
|
+
previousPath = path;
|
|
78
|
+
if (autoClose) {
|
|
79
|
+
open = false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
{#snippet toggleArea()}
|
|
86
|
+
{#if showToggle}
|
|
87
|
+
{#if toggleSlot}
|
|
88
|
+
{@render toggleSlot()}
|
|
89
|
+
{:else}
|
|
90
|
+
<Button
|
|
91
|
+
{...toggleProps}
|
|
92
|
+
onclick={handleToggle}
|
|
93
|
+
class={[classes.toggle, toggleProps.class]}
|
|
94
|
+
/>
|
|
95
|
+
{/if}
|
|
96
|
+
{/if}
|
|
97
|
+
{/snippet}
|
|
98
|
+
|
|
99
|
+
<svelte:element this={as} bind:this={ref} class={classes.root} {...restProps}>
|
|
100
|
+
{#if top}
|
|
101
|
+
<div class={classes.top}>
|
|
102
|
+
{@render top()}
|
|
103
|
+
</div>
|
|
104
|
+
{/if}
|
|
105
|
+
|
|
106
|
+
<Container class={classes.container}>
|
|
107
|
+
<div class={classes.left}>
|
|
108
|
+
{#if toggleSide === 'left'}
|
|
109
|
+
{@render toggleArea()}
|
|
110
|
+
{/if}
|
|
111
|
+
|
|
112
|
+
{#if titleSlot}
|
|
113
|
+
{@render titleSlot()}
|
|
114
|
+
{:else if title}
|
|
115
|
+
<Link href={to} raw aria-label={title} class={classes.title}>{title}</Link>
|
|
116
|
+
{/if}
|
|
117
|
+
|
|
118
|
+
{@render left?.()}
|
|
119
|
+
</div>
|
|
120
|
+
|
|
121
|
+
{#if children}
|
|
122
|
+
<div class={classes.center}>
|
|
123
|
+
{@render children()}
|
|
124
|
+
</div>
|
|
125
|
+
{/if}
|
|
126
|
+
|
|
127
|
+
<div class={classes.right}>
|
|
128
|
+
{@render right?.()}
|
|
129
|
+
|
|
130
|
+
{#if toggleSide === 'right'}
|
|
131
|
+
{@render toggleArea()}
|
|
132
|
+
{/if}
|
|
133
|
+
</div>
|
|
134
|
+
</Container>
|
|
135
|
+
|
|
136
|
+
{#if bottom}
|
|
137
|
+
<div class={classes.bottom}>
|
|
138
|
+
{@render bottom()}
|
|
139
|
+
</div>
|
|
140
|
+
{/if}
|
|
141
|
+
</svelte:element>
|
|
142
|
+
|
|
143
|
+
{#if hasMenu}
|
|
144
|
+
{#if mode === 'modal'}
|
|
145
|
+
<Modal
|
|
146
|
+
bind:open
|
|
147
|
+
{title}
|
|
148
|
+
fullscreen
|
|
149
|
+
overlay={menu?.overlay}
|
|
150
|
+
dismissible={menu?.dismissible}
|
|
151
|
+
{body}
|
|
152
|
+
{content}
|
|
153
|
+
ui={menuUi}
|
|
154
|
+
/>
|
|
155
|
+
{:else if mode === 'slideover'}
|
|
156
|
+
<Slideover
|
|
157
|
+
bind:open
|
|
158
|
+
{title}
|
|
159
|
+
side={menu?.side ?? 'right'}
|
|
160
|
+
overlay={menu?.overlay}
|
|
161
|
+
dismissible={menu?.dismissible}
|
|
162
|
+
{body}
|
|
163
|
+
{content}
|
|
164
|
+
ui={menuUi}
|
|
165
|
+
/>
|
|
166
|
+
{:else if mode === 'drawer'}
|
|
167
|
+
<Drawer
|
|
168
|
+
bind:open
|
|
169
|
+
{title}
|
|
170
|
+
direction={menu?.direction}
|
|
171
|
+
overlay={menu?.overlay}
|
|
172
|
+
{body}
|
|
173
|
+
{content}
|
|
174
|
+
ui={menuUi}
|
|
175
|
+
/>
|
|
176
|
+
{/if}
|
|
177
|
+
{/if}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
+
import type { HeaderSlots, HeaderVariantProps } from './header.variants.js';
|
|
5
|
+
import type { ButtonProps } from '../Button/button.types.js';
|
|
6
|
+
import type { SlideoverProps } from '../Slideover/slideover.types.js';
|
|
7
|
+
import type { DrawerProps } from '../Drawer/drawer.types.js';
|
|
8
|
+
export type HeaderMode = 'modal' | 'slideover' | 'drawer';
|
|
9
|
+
export type HeaderMenuProps = {
|
|
10
|
+
/**
|
|
11
|
+
* Side the menu opens from when mode is 'slideover'.
|
|
12
|
+
* @default 'right'
|
|
13
|
+
*/
|
|
14
|
+
side?: SlideoverProps['side'];
|
|
15
|
+
/**
|
|
16
|
+
* Direction the menu opens from when mode is 'drawer'.
|
|
17
|
+
*/
|
|
18
|
+
direction?: DrawerProps['direction'];
|
|
19
|
+
/**
|
|
20
|
+
* Render a backdrop overlay behind the menu.
|
|
21
|
+
*/
|
|
22
|
+
overlay?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Allow dismissing the menu by clicking outside or pressing Escape.
|
|
25
|
+
* Not supported by mode 'drawer'.
|
|
26
|
+
*/
|
|
27
|
+
dismissible?: boolean;
|
|
28
|
+
};
|
|
29
|
+
export type HeaderProps = Omit<HTMLAttributes<HTMLElement>, 'class' | 'title'> & {
|
|
30
|
+
/**
|
|
31
|
+
* Bindable reference to the root DOM element.
|
|
32
|
+
*/
|
|
33
|
+
ref?: HTMLElement | null;
|
|
34
|
+
/**
|
|
35
|
+
* Renders the header as a different HTML element.
|
|
36
|
+
* @default 'header'
|
|
37
|
+
*/
|
|
38
|
+
as?: keyof HTMLElementTagNameMap;
|
|
39
|
+
/**
|
|
40
|
+
* Override styles for specific header slots.
|
|
41
|
+
*/
|
|
42
|
+
ui?: Partial<Record<HeaderSlots, ClassNameValue>>;
|
|
43
|
+
/**
|
|
44
|
+
* Brand title text rendered as a link in the left area.
|
|
45
|
+
*/
|
|
46
|
+
title?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Navigation target of the brand title link.
|
|
49
|
+
* @default '/'
|
|
50
|
+
*/
|
|
51
|
+
to?: string;
|
|
52
|
+
/**
|
|
53
|
+
* How the mobile menu opens, composing the corresponding overlay component.
|
|
54
|
+
* @default 'modal'
|
|
55
|
+
*/
|
|
56
|
+
mode?: HeaderMode;
|
|
57
|
+
/**
|
|
58
|
+
* Options forwarded to the overlay the mobile menu is built from.
|
|
59
|
+
*/
|
|
60
|
+
menu?: HeaderMenuProps;
|
|
61
|
+
/**
|
|
62
|
+
* Mobile menu toggle button shown below the lg breakpoint.
|
|
63
|
+
* Customize with ButtonProps or hide with false.
|
|
64
|
+
* Not rendered when there is no body or content to show.
|
|
65
|
+
* @default true
|
|
66
|
+
*/
|
|
67
|
+
toggle?: boolean | ButtonProps;
|
|
68
|
+
/**
|
|
69
|
+
* Which side of the header the toggle button is placed on.
|
|
70
|
+
* @default 'right'
|
|
71
|
+
*/
|
|
72
|
+
toggleSide?: NonNullable<HeaderVariantProps['toggleSide']>;
|
|
73
|
+
/**
|
|
74
|
+
* Bindable open state of the mobile menu.
|
|
75
|
+
* @default false
|
|
76
|
+
*/
|
|
77
|
+
open?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Close the mobile menu automatically when the route changes.
|
|
80
|
+
* @default true
|
|
81
|
+
*/
|
|
82
|
+
autoClose?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Additional CSS classes for the root element.
|
|
85
|
+
*/
|
|
86
|
+
class?: ClassNameValue;
|
|
87
|
+
/**
|
|
88
|
+
* Custom content to replace the default brand title link.
|
|
89
|
+
*/
|
|
90
|
+
titleSlot?: Snippet;
|
|
91
|
+
/**
|
|
92
|
+
* Extra content in the left area, after the brand title.
|
|
93
|
+
*/
|
|
94
|
+
left?: Snippet;
|
|
95
|
+
/**
|
|
96
|
+
* Center area content, hidden below the lg breakpoint.
|
|
97
|
+
* Typically navigation links.
|
|
98
|
+
*/
|
|
99
|
+
children?: Snippet;
|
|
100
|
+
/**
|
|
101
|
+
* Content in the right area, before the toggle button.
|
|
102
|
+
*/
|
|
103
|
+
right?: Snippet;
|
|
104
|
+
/**
|
|
105
|
+
* Custom content to replace the default toggle button.
|
|
106
|
+
*/
|
|
107
|
+
toggleSlot?: Snippet;
|
|
108
|
+
/**
|
|
109
|
+
* Content rendered above the main header row.
|
|
110
|
+
*/
|
|
111
|
+
top?: Snippet;
|
|
112
|
+
/**
|
|
113
|
+
* Content rendered below the main header row.
|
|
114
|
+
*/
|
|
115
|
+
bottom?: Snippet;
|
|
116
|
+
/**
|
|
117
|
+
* Mobile menu content rendered inside the overlay body.
|
|
118
|
+
*/
|
|
119
|
+
body?: Snippet;
|
|
120
|
+
/**
|
|
121
|
+
* Custom content that replaces the entire mobile menu layout.
|
|
122
|
+
*/
|
|
123
|
+
content?: Snippet;
|
|
124
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
2
|
+
export declare const headerVariants: import("tailwind-variants").TVReturnType<{
|
|
3
|
+
toggleSide: {
|
|
4
|
+
left: {
|
|
5
|
+
toggle: string;
|
|
6
|
+
};
|
|
7
|
+
right: {
|
|
8
|
+
toggle: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
}, {
|
|
12
|
+
root: string;
|
|
13
|
+
container: string;
|
|
14
|
+
left: string;
|
|
15
|
+
center: string;
|
|
16
|
+
right: string;
|
|
17
|
+
title: string;
|
|
18
|
+
toggle: string;
|
|
19
|
+
top: string;
|
|
20
|
+
bottom: string;
|
|
21
|
+
body: string;
|
|
22
|
+
}, undefined, {
|
|
23
|
+
toggleSide: {
|
|
24
|
+
left: {
|
|
25
|
+
toggle: string;
|
|
26
|
+
};
|
|
27
|
+
right: {
|
|
28
|
+
toggle: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
}, {
|
|
32
|
+
root: string;
|
|
33
|
+
container: string;
|
|
34
|
+
left: string;
|
|
35
|
+
center: string;
|
|
36
|
+
right: string;
|
|
37
|
+
title: string;
|
|
38
|
+
toggle: string;
|
|
39
|
+
top: string;
|
|
40
|
+
bottom: string;
|
|
41
|
+
body: string;
|
|
42
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
43
|
+
toggleSide: {
|
|
44
|
+
left: {
|
|
45
|
+
toggle: string;
|
|
46
|
+
};
|
|
47
|
+
right: {
|
|
48
|
+
toggle: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
}, {
|
|
52
|
+
root: string;
|
|
53
|
+
container: string;
|
|
54
|
+
left: string;
|
|
55
|
+
center: string;
|
|
56
|
+
right: string;
|
|
57
|
+
title: string;
|
|
58
|
+
toggle: string;
|
|
59
|
+
top: string;
|
|
60
|
+
bottom: string;
|
|
61
|
+
body: string;
|
|
62
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
63
|
+
export type HeaderVariantProps = VariantProps<typeof headerVariants>;
|
|
64
|
+
export type HeaderSlots = keyof ReturnType<typeof headerVariants>;
|
|
65
|
+
export declare const headerDefaults: {
|
|
66
|
+
defaultVariants: import("tailwind-variants").TVDefaultVariants<{
|
|
67
|
+
toggleSide: {
|
|
68
|
+
left: {
|
|
69
|
+
toggle: string;
|
|
70
|
+
};
|
|
71
|
+
right: {
|
|
72
|
+
toggle: string;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
}, {
|
|
76
|
+
root: string;
|
|
77
|
+
container: string;
|
|
78
|
+
left: string;
|
|
79
|
+
center: string;
|
|
80
|
+
right: string;
|
|
81
|
+
title: string;
|
|
82
|
+
toggle: string;
|
|
83
|
+
top: string;
|
|
84
|
+
bottom: string;
|
|
85
|
+
body: string;
|
|
86
|
+
}, {
|
|
87
|
+
toggleSide: {
|
|
88
|
+
left: {
|
|
89
|
+
toggle: string;
|
|
90
|
+
};
|
|
91
|
+
right: {
|
|
92
|
+
toggle: string;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
}, {
|
|
96
|
+
root: string;
|
|
97
|
+
container: string;
|
|
98
|
+
left: string;
|
|
99
|
+
center: string;
|
|
100
|
+
right: string;
|
|
101
|
+
title: string;
|
|
102
|
+
toggle: string;
|
|
103
|
+
top: string;
|
|
104
|
+
bottom: string;
|
|
105
|
+
body: string;
|
|
106
|
+
}>;
|
|
107
|
+
slots: Partial<Record<HeaderSlots, string>>;
|
|
108
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
export const headerVariants = tv({
|
|
3
|
+
slots: {
|
|
4
|
+
root: 'sticky top-0 z-50 h-(--ui-header-height) border-b border-outline-variant bg-surface/75 backdrop-blur',
|
|
5
|
+
container: 'flex h-full items-center justify-between gap-3',
|
|
6
|
+
left: 'flex items-center gap-1.5 lg:flex-1',
|
|
7
|
+
center: 'hidden lg:flex',
|
|
8
|
+
right: 'flex items-center justify-end gap-1.5 lg:flex-1',
|
|
9
|
+
title: 'flex min-w-0 shrink-0 items-center gap-1.5 text-xl font-bold text-on-surface',
|
|
10
|
+
toggle: 'lg:hidden',
|
|
11
|
+
top: '',
|
|
12
|
+
bottom: '',
|
|
13
|
+
body: ''
|
|
14
|
+
},
|
|
15
|
+
variants: {
|
|
16
|
+
toggleSide: {
|
|
17
|
+
left: {
|
|
18
|
+
toggle: '-ms-1.5'
|
|
19
|
+
},
|
|
20
|
+
right: {
|
|
21
|
+
toggle: '-me-1.5'
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: {
|
|
26
|
+
toggleSide: 'right'
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
export const headerDefaults = {
|
|
30
|
+
defaultVariants: headerVariants.defaultVariants,
|
|
31
|
+
slots: {}
|
|
32
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Header } from './Header.svelte';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts" module></script>
|
|
2
|
+
|
|
3
|
+
<script lang="ts">import { mainVariants, mainDefaults } from "./main.variants.js";
|
|
4
|
+
import { getComponentConfig } from "../../config.js";
|
|
5
|
+
const config = getComponentConfig("main", mainDefaults);
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
as = "main",
|
|
9
|
+
ui,
|
|
10
|
+
class: className,
|
|
11
|
+
children,
|
|
12
|
+
...restProps
|
|
13
|
+
} = $props();
|
|
14
|
+
const slots = mainVariants();
|
|
15
|
+
const rootClass = $derived(slots.root({ class: [config.slots.root, className, ui?.root] }));
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<svelte:element this={as} bind:this={ref} class={rootClass} {...restProps}>
|
|
19
|
+
{@render children?.()}
|
|
20
|
+
</svelte:element>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Main } from './Main.svelte';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
+
import type { MainSlots } from './main.variants.js';
|
|
5
|
+
export type MainProps = Omit<HTMLAttributes<HTMLElement>, 'class'> & {
|
|
6
|
+
/**
|
|
7
|
+
* Bindable reference to the root DOM element.
|
|
8
|
+
*/
|
|
9
|
+
ref?: HTMLElement | null;
|
|
10
|
+
/**
|
|
11
|
+
* Renders the main container as a different HTML element.
|
|
12
|
+
* @default 'main'
|
|
13
|
+
*/
|
|
14
|
+
as?: keyof HTMLElementTagNameMap;
|
|
15
|
+
/**
|
|
16
|
+
* Override styles for specific main slots.
|
|
17
|
+
*/
|
|
18
|
+
ui?: Partial<Record<MainSlots, ClassNameValue>>;
|
|
19
|
+
/**
|
|
20
|
+
* Additional CSS classes for the root element.
|
|
21
|
+
*/
|
|
22
|
+
class?: ClassNameValue;
|
|
23
|
+
/**
|
|
24
|
+
* Content rendered inside the main container.
|
|
25
|
+
*/
|
|
26
|
+
children?: Snippet;
|
|
27
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|