svelora 3.0.7 → 3.0.10
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/Chart/Chart.svelte +45 -44
- package/dist/Chart/chart.types.d.ts +9 -13
- package/dist/Chart/index.d.ts +1 -3
- package/dist/Chart/index.js +1 -3
- package/dist/NavigationMenu/NavigationMenu.svelte +255 -0
- package/dist/NavigationMenu/NavigationMenu.svelte.d.ts +4 -0
- package/dist/NavigationMenu/index.d.ts +3 -0
- package/dist/NavigationMenu/index.js +3 -0
- package/dist/NavigationMenu/navigation-menu.types.d.ts +104 -0
- package/dist/NavigationMenu/navigation-menu.variants.d.ts +142 -0
- package/dist/NavigationMenu/navigation-menu.variants.js +71 -0
- package/dist/Search/Search.svelte +94 -0
- package/dist/Search/Search.svelte.d.ts +4 -0
- package/dist/Search/index.d.ts +2 -0
- package/dist/Search/index.js +1 -0
- package/dist/Search/search.types.d.ts +40 -0
- package/dist/Search/search.types.js +1 -0
- package/dist/Sidebar/Sidebar.svelte +5 -5
- package/dist/Sidebar/sidebar.types.d.ts +10 -4
- package/dist/Sidebar/sidebar.variants.d.ts +18 -0
- package/dist/Sidebar/sidebar.variants.js +16 -6
- package/dist/docs/navigation.js +20 -9
- package/dist/index.d.ts +2 -3
- package/dist/index.js +2 -2
- package/dist/mcp/svelora-docs.data.json +11 -9
- package/package.json +4 -5
- package/dist/Chart/chart.variants.d.ts +0 -3
- package/dist/Chart/chart.variants.js +0 -4
- package/dist/Menu/Menu.svelte +0 -134
- package/dist/Menu/Menu.svelte.d.ts +0 -4
- package/dist/Menu/index.d.ts +0 -4
- package/dist/Menu/index.js +0 -4
- package/dist/Menu/menu.types.d.ts +0 -82
- package/dist/Menu/menu.variants.d.ts +0 -46
- package/dist/Menu/menu.variants.js +0 -32
- /package/dist/{Menu/menu.types.js → NavigationMenu/navigation-menu.types.js} +0 -0
package/dist/Chart/Chart.svelte
CHANGED
|
@@ -1,47 +1,48 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
//
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
1
|
+
<script lang="ts">import { onMount, onDestroy } from "svelte";
|
|
2
|
+
import { twMerge } from "tailwind-merge";
|
|
3
|
+
let { options, series, class: className } = $props();
|
|
4
|
+
let chartContainer;
|
|
5
|
+
let chartInstance = null;
|
|
6
|
+
// Helper to dynamically load apexcharts only on the client
|
|
7
|
+
onMount(async () => {
|
|
8
|
+
// Dynamic import so it doesn't break SSR
|
|
9
|
+
const ApexCharts = (await import("apexcharts")).default;
|
|
10
|
+
// Inject series if provided separately
|
|
11
|
+
const initialOptions = series ? {
|
|
12
|
+
...options,
|
|
13
|
+
series
|
|
14
|
+
} : options;
|
|
15
|
+
// Default styling to match theme
|
|
16
|
+
const mergedOptions = {
|
|
17
|
+
chart: {
|
|
18
|
+
background: "transparent",
|
|
19
|
+
toolbar: { show: false },
|
|
20
|
+
fontFamily: "inherit",
|
|
21
|
+
...initialOptions.chart
|
|
22
|
+
},
|
|
23
|
+
theme: { ...initialOptions.theme },
|
|
24
|
+
tooltip: {
|
|
25
|
+
theme: "dark",
|
|
26
|
+
...initialOptions.tooltip
|
|
27
|
+
},
|
|
28
|
+
...initialOptions
|
|
29
|
+
};
|
|
30
|
+
chartInstance = new ApexCharts(chartContainer, mergedOptions);
|
|
31
|
+
chartInstance.render();
|
|
32
|
+
});
|
|
33
|
+
onDestroy(() => {
|
|
34
|
+
if (chartInstance) {
|
|
35
|
+
chartInstance.destroy();
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
// React to options/series changes
|
|
39
|
+
$effect(() => {
|
|
40
|
+
if (chartInstance) {
|
|
41
|
+
if (series) {
|
|
42
|
+
chartInstance.updateSeries(series);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
37
45
|
});
|
|
38
|
-
// We must use "as any" or "as typeof SvelteComponent" because svelte-chartjs types
|
|
39
|
-
// are sometimes tricky with svelte:component in Svelte 5.
|
|
40
|
-
const ChartComponent = $derived(components[type]);
|
|
41
46
|
</script>
|
|
42
47
|
|
|
43
|
-
<div class={twMerge(
|
|
44
|
-
{#if ChartComponent}
|
|
45
|
-
<ChartComponent data={data as any} options={mergedOptions as any} />
|
|
46
|
-
{/if}
|
|
47
|
-
</div>
|
|
48
|
+
<div class={twMerge('w-full', className)} bind:this={chartContainer}></div>
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
export interface ChartProps
|
|
1
|
+
import type { ApexOptions } from 'apexcharts';
|
|
2
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
3
|
+
export interface ChartProps {
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Configuration options for ApexCharts.
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
options: ApexOptions;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Series data. If provided, overrides options.series.
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
series?: ApexOptions['series'];
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Tailwind class to apply to the chart container wrapper.
|
|
14
14
|
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Additional CSS classes.
|
|
18
|
-
*/
|
|
19
|
-
class?: string;
|
|
15
|
+
class?: ClassNameValue;
|
|
20
16
|
}
|
package/dist/Chart/index.d.ts
CHANGED
package/dist/Chart/index.js
CHANGED
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
<script lang="ts">import { untrack, getContext } from "svelte";
|
|
2
|
+
import { twMerge } from "tailwind-merge";
|
|
3
|
+
import { Icon } from "../Icon/index.js";
|
|
4
|
+
import Badge from "../Badge/Badge.svelte";
|
|
5
|
+
import Kbd from "../Kbd/Kbd.svelte";
|
|
6
|
+
import { DropdownMenu } from "../DropdownMenu/index.js";
|
|
7
|
+
import { Tooltip } from "../Tooltip/index.js";
|
|
8
|
+
import { navigationMenuVariants } from "./navigation-menu.variants.js";
|
|
9
|
+
let { items = [], variant = "default", orientation = "horizontal", accordion = false, class: className, ui, children } = $props();
|
|
10
|
+
const sidebarCollapsedFn = getContext("sidebar-collapsed");
|
|
11
|
+
let isCollapsed = $derived(sidebarCollapsedFn ? sidebarCollapsedFn() : false);
|
|
12
|
+
const sidebarPositionFn = getContext("sidebar-position");
|
|
13
|
+
let sidebarPosition = $derived(sidebarPositionFn ? sidebarPositionFn() : "left");
|
|
14
|
+
let styles = $derived(navigationMenuVariants({
|
|
15
|
+
variant,
|
|
16
|
+
orientation,
|
|
17
|
+
collapsed: isCollapsed
|
|
18
|
+
}));
|
|
19
|
+
let normalizedItems = $derived.by(() => {
|
|
20
|
+
if (!items || items.length === 0) return [];
|
|
21
|
+
if (Array.isArray(items[0])) {
|
|
22
|
+
return items;
|
|
23
|
+
}
|
|
24
|
+
return [items];
|
|
25
|
+
});
|
|
26
|
+
// --- Accordion State (for vertical) ---
|
|
27
|
+
function getInitialOpenGroups() {
|
|
28
|
+
const opened = [];
|
|
29
|
+
for (const group of normalizedItems) {
|
|
30
|
+
for (const item of group) {
|
|
31
|
+
if (item.defaultOpen && item.label) opened.push(item.label);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return opened;
|
|
35
|
+
}
|
|
36
|
+
let openGroupLabel = $state(untrack(() => accordion ? getInitialOpenGroups()[0] ?? null : null));
|
|
37
|
+
let openGroups = $state(untrack(() => !accordion ? getInitialOpenGroups() : []));
|
|
38
|
+
function handleGroupToggle(item) {
|
|
39
|
+
if (!item.label) return;
|
|
40
|
+
if (accordion) {
|
|
41
|
+
openGroupLabel = openGroupLabel === item.label ? null : item.label;
|
|
42
|
+
} else {
|
|
43
|
+
if (openGroups.includes(item.label)) {
|
|
44
|
+
openGroups = openGroups.filter((l) => l !== item.label);
|
|
45
|
+
} else {
|
|
46
|
+
openGroups = [...openGroups, item.label];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function isGroupOpen(item) {
|
|
51
|
+
if (accordion) return openGroupLabel === item.label;
|
|
52
|
+
if (!item.label) return false;
|
|
53
|
+
return openGroups.includes(item.label);
|
|
54
|
+
}
|
|
55
|
+
// --- Auto Active State ---
|
|
56
|
+
let currentPath = $state("");
|
|
57
|
+
$effect(() => {
|
|
58
|
+
if (typeof window !== "undefined") {
|
|
59
|
+
currentPath = window.location.pathname;
|
|
60
|
+
const onPopState = () => {
|
|
61
|
+
currentPath = window.location.pathname;
|
|
62
|
+
};
|
|
63
|
+
window.addEventListener("popstate", onPopState);
|
|
64
|
+
return () => window.removeEventListener("popstate", onPopState);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
function isActive(item) {
|
|
68
|
+
if (item.active) return true;
|
|
69
|
+
if (item.href) {
|
|
70
|
+
return currentPath === item.href || currentPath.startsWith(item.href + "/");
|
|
71
|
+
}
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
// Helper for keyboard shortcuts
|
|
75
|
+
function getKbds(item) {
|
|
76
|
+
return item.kbds || item.shortcut || [];
|
|
77
|
+
}
|
|
78
|
+
</script>
|
|
79
|
+
|
|
80
|
+
{#snippet renderItem(item: NavigationMenuItemType)}
|
|
81
|
+
<li class={orientation === 'vertical' ? 'w-full' : ''}>
|
|
82
|
+
{#if item.type === 'separator'}
|
|
83
|
+
<!-- SEPARATOR -->
|
|
84
|
+
<div class={orientation === 'horizontal' ? 'w-px h-6 bg-outline-variant mx-1' : 'h-px w-full bg-outline-variant my-1'}></div>
|
|
85
|
+
{:else if (item.items && item.items.length > 0) || (item.children && item.children.length > 0)}
|
|
86
|
+
{@const subItems = item.items || item.children || []}
|
|
87
|
+
|
|
88
|
+
{#if orientation === 'horizontal'}
|
|
89
|
+
<!-- HORIZONTAL: Dropdown -->
|
|
90
|
+
<DropdownMenu
|
|
91
|
+
items={subItems as any}
|
|
92
|
+
side="bottom"
|
|
93
|
+
align="start"
|
|
94
|
+
sideOffset={4}
|
|
95
|
+
>
|
|
96
|
+
{#snippet children({ props, open })}
|
|
97
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
98
|
+
{#snippet buttonContent()}
|
|
99
|
+
<button
|
|
100
|
+
type="button"
|
|
101
|
+
{...props}
|
|
102
|
+
class={twMerge(styles.item({ active: isActive(item), collapsed: isCollapsed }), item.class)}
|
|
103
|
+
disabled={item.disabled}
|
|
104
|
+
>
|
|
105
|
+
{#if item.icon}
|
|
106
|
+
<Icon name={item.icon} class={styles.icon({ active: isActive(item), collapsed: isCollapsed })} />
|
|
107
|
+
{/if}
|
|
108
|
+
{#if !isCollapsed}
|
|
109
|
+
<span>{item.label}</span>
|
|
110
|
+
{#if item.badge !== undefined}
|
|
111
|
+
<Badge label={String(item.badge)} color={item.badgeColor || 'primary'} size="sm" class="ml-1" />
|
|
112
|
+
{/if}
|
|
113
|
+
<span class="ml-auto flex items-center">
|
|
114
|
+
<Icon
|
|
115
|
+
name="lucide:chevron-down"
|
|
116
|
+
class={twMerge(styles.chevron(), open ? 'rotate-180' : '')}
|
|
117
|
+
/>
|
|
118
|
+
</span>
|
|
119
|
+
{/if}
|
|
120
|
+
</button>
|
|
121
|
+
{/snippet}
|
|
122
|
+
|
|
123
|
+
{#if isCollapsed}
|
|
124
|
+
<Tooltip text={item.label} side={sidebarPosition === 'right' ? 'left' : 'right'}>
|
|
125
|
+
{@render buttonContent()}
|
|
126
|
+
</Tooltip>
|
|
127
|
+
{:else}
|
|
128
|
+
{@render buttonContent()}
|
|
129
|
+
{/if}
|
|
130
|
+
{/snippet}
|
|
131
|
+
</DropdownMenu>
|
|
132
|
+
{:else}
|
|
133
|
+
<!-- VERTICAL: Accordion -->
|
|
134
|
+
{#snippet accordionButton()}
|
|
135
|
+
<button
|
|
136
|
+
type="button"
|
|
137
|
+
class={twMerge(
|
|
138
|
+
styles.accordionTrigger(),
|
|
139
|
+
isGroupOpen(item) ? styles.item({ active: true, collapsed: isCollapsed }) : '',
|
|
140
|
+
isCollapsed ? styles.item({ collapsed: true }) : '',
|
|
141
|
+
item.class
|
|
142
|
+
)}
|
|
143
|
+
disabled={item.disabled}
|
|
144
|
+
onclick={() => handleGroupToggle(item)}
|
|
145
|
+
>
|
|
146
|
+
<div class="flex flex-1 items-center truncate">
|
|
147
|
+
{#if item.icon}
|
|
148
|
+
<Icon name={item.icon} class={styles.icon({ active: isActive(item), collapsed: isCollapsed })} />
|
|
149
|
+
{/if}
|
|
150
|
+
{#if !isCollapsed}
|
|
151
|
+
<span class="truncate ml-1.5">{item.label}</span>
|
|
152
|
+
{/if}
|
|
153
|
+
</div>
|
|
154
|
+
{#if !isCollapsed}
|
|
155
|
+
<div class="flex items-center gap-2">
|
|
156
|
+
{#if item.badge !== undefined || getKbds(item).length > 0}
|
|
157
|
+
<span class="flex items-center gap-2">
|
|
158
|
+
{#if item.badge !== undefined}
|
|
159
|
+
<Badge label={String(item.badge)} color={item.badgeColor || 'primary'} size="sm" />
|
|
160
|
+
{/if}
|
|
161
|
+
{#if getKbds(item).length > 0}
|
|
162
|
+
<span class="flex items-center gap-0.5">
|
|
163
|
+
{#each getKbds(item) as key}
|
|
164
|
+
<Kbd value={typeof key === 'string' ? key : key.value} size="sm" />
|
|
165
|
+
{/each}
|
|
166
|
+
</span>
|
|
167
|
+
{/if}
|
|
168
|
+
</span>
|
|
169
|
+
{/if}
|
|
170
|
+
<Icon
|
|
171
|
+
name="lucide:chevron-down"
|
|
172
|
+
class={twMerge(styles.chevron(), isGroupOpen(item) ? 'rotate-180' : '')}
|
|
173
|
+
/>
|
|
174
|
+
</div>
|
|
175
|
+
{/if}
|
|
176
|
+
</button>
|
|
177
|
+
{/snippet}
|
|
178
|
+
|
|
179
|
+
{#if isCollapsed}
|
|
180
|
+
<Tooltip text={item.label} side={sidebarPosition === 'right' ? 'left' : 'right'}>
|
|
181
|
+
{@render accordionButton()}
|
|
182
|
+
</Tooltip>
|
|
183
|
+
{:else}
|
|
184
|
+
{@render accordionButton()}
|
|
185
|
+
{/if}
|
|
186
|
+
{#if isGroupOpen(item)}
|
|
187
|
+
<ul class={styles.accordionGroupContent()}>
|
|
188
|
+
{#each subItems as subItem}
|
|
189
|
+
{@render renderItem(subItem)}
|
|
190
|
+
{/each}
|
|
191
|
+
</ul>
|
|
192
|
+
{/if}
|
|
193
|
+
{/if}
|
|
194
|
+
{:else}
|
|
195
|
+
<!-- STANDARD LINK -->
|
|
196
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
197
|
+
{#snippet linkContent()}
|
|
198
|
+
<svelte:element
|
|
199
|
+
this={item.href ? 'a' : 'button'}
|
|
200
|
+
href={item.href}
|
|
201
|
+
target={item.target}
|
|
202
|
+
type={!item.href ? 'button' : undefined}
|
|
203
|
+
class={twMerge(styles.item({ active: isActive(item), collapsed: isCollapsed }), item.class)}
|
|
204
|
+
disabled={item.disabled}
|
|
205
|
+
onclick={item.onClick}
|
|
206
|
+
>
|
|
207
|
+
<div class="flex flex-1 items-center truncate gap-1.5">
|
|
208
|
+
{#if item.icon}
|
|
209
|
+
<Icon name={item.icon} class={styles.icon({ active: isActive(item), collapsed: isCollapsed })} />
|
|
210
|
+
{/if}
|
|
211
|
+
{#if !isCollapsed && item.label}
|
|
212
|
+
<span class="truncate">{item.label}</span>
|
|
213
|
+
{/if}
|
|
214
|
+
</div>
|
|
215
|
+
{#if !isCollapsed && (item.badge !== undefined || getKbds(item).length > 0)}
|
|
216
|
+
<span class="ml-auto flex items-center gap-2">
|
|
217
|
+
{#if item.badge !== undefined}
|
|
218
|
+
<Badge label={String(item.badge)} color={item.badgeColor || 'primary'} size="sm" />
|
|
219
|
+
{/if}
|
|
220
|
+
{#if getKbds(item).length > 0}
|
|
221
|
+
<span class="flex items-center gap-0.5">
|
|
222
|
+
{#each getKbds(item) as key}
|
|
223
|
+
<Kbd value={typeof key === 'string' ? key : key.value} size="sm" />
|
|
224
|
+
{/each}
|
|
225
|
+
</span>
|
|
226
|
+
{/if}
|
|
227
|
+
</span>
|
|
228
|
+
{/if}
|
|
229
|
+
</svelte:element>
|
|
230
|
+
{/snippet}
|
|
231
|
+
|
|
232
|
+
{#if isCollapsed}
|
|
233
|
+
<Tooltip text={item.label} side={sidebarPosition === 'right' ? 'left' : 'right'}>
|
|
234
|
+
{@render linkContent()}
|
|
235
|
+
</Tooltip>
|
|
236
|
+
{:else}
|
|
237
|
+
{@render linkContent()}
|
|
238
|
+
{/if}
|
|
239
|
+
{/if}
|
|
240
|
+
</li>
|
|
241
|
+
{/snippet}
|
|
242
|
+
|
|
243
|
+
<nav class={twMerge(styles.base(), className)}>
|
|
244
|
+
{#if children}
|
|
245
|
+
{@render children()}
|
|
246
|
+
{:else}
|
|
247
|
+
{#each normalizedItems as group}
|
|
248
|
+
<ul class={styles.group()}>
|
|
249
|
+
{#each group as item}
|
|
250
|
+
{@render renderItem(item)}
|
|
251
|
+
{/each}
|
|
252
|
+
</ul>
|
|
253
|
+
{/each}
|
|
254
|
+
{/if}
|
|
255
|
+
</nav>
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
3
|
+
import type { BadgeProps } from '../Badge/badge.types.js';
|
|
4
|
+
import type { KbdProps } from '../Kbd/kbd.types.js';
|
|
5
|
+
import type { NavigationMenuVariantProps, NavigationMenuSlots } from './navigation-menu.variants.js';
|
|
6
|
+
export type NavigationMenuItemType = {
|
|
7
|
+
/**
|
|
8
|
+
* Item type for compatibility with DropdownMenu.
|
|
9
|
+
*/
|
|
10
|
+
type?: 'item' | 'label' | 'separator' | 'sub';
|
|
11
|
+
/**
|
|
12
|
+
* The visible text displayed in the menu item.
|
|
13
|
+
*/
|
|
14
|
+
label?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Optional icon to display before the label.
|
|
17
|
+
*/
|
|
18
|
+
icon?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Optional badge text/number to display after the label.
|
|
21
|
+
*/
|
|
22
|
+
badge?: string | number;
|
|
23
|
+
/**
|
|
24
|
+
* Badge color (e.g. 'primary', 'error', 'success').
|
|
25
|
+
*/
|
|
26
|
+
badgeColor?: BadgeProps['color'];
|
|
27
|
+
/**
|
|
28
|
+
* URL to navigate to when clicked.
|
|
29
|
+
*/
|
|
30
|
+
href?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Target attribute for the link (e.g., '_blank').
|
|
33
|
+
*/
|
|
34
|
+
target?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Force the active state styling.
|
|
37
|
+
*/
|
|
38
|
+
active?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Disable interaction for this item.
|
|
41
|
+
*/
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Whether this group should be open by default (when orientation="vertical").
|
|
45
|
+
*/
|
|
46
|
+
defaultOpen?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Keyboard shortcuts to display.
|
|
49
|
+
*/
|
|
50
|
+
shortcut?: string[];
|
|
51
|
+
kbds?: (string | Pick<KbdProps, 'value' | 'size' | 'variant' | 'color'>)[];
|
|
52
|
+
/**
|
|
53
|
+
* Sub-items for this menu item (Svelora standard).
|
|
54
|
+
* If provided, the item renders as a dropdown trigger or accordion.
|
|
55
|
+
*/
|
|
56
|
+
items?: NavigationMenuItemType[];
|
|
57
|
+
/**
|
|
58
|
+
* Alias for sub-items (Nuxt UI style compatibility).
|
|
59
|
+
*/
|
|
60
|
+
children?: NavigationMenuItemType[];
|
|
61
|
+
/**
|
|
62
|
+
* Custom click handler for standard items.
|
|
63
|
+
*/
|
|
64
|
+
onClick?: () => void;
|
|
65
|
+
/**
|
|
66
|
+
* Custom class for this specific item.
|
|
67
|
+
*/
|
|
68
|
+
class?: ClassNameValue;
|
|
69
|
+
};
|
|
70
|
+
export type NavigationMenuProps = {
|
|
71
|
+
/**
|
|
72
|
+
* Array of navigation items. Supports 1D or 2D arrays for grouping.
|
|
73
|
+
*/
|
|
74
|
+
items?: NavigationMenuItemType[] | NavigationMenuItemType[][];
|
|
75
|
+
/**
|
|
76
|
+
* Visual variant of the navigation menu.
|
|
77
|
+
* @default 'default'
|
|
78
|
+
*/
|
|
79
|
+
variant?: NonNullable<NavigationMenuVariantProps['variant']>;
|
|
80
|
+
/**
|
|
81
|
+
* Orientation of the navigation menu.
|
|
82
|
+
* @default 'horizontal'
|
|
83
|
+
*/
|
|
84
|
+
orientation?: NonNullable<NavigationMenuVariantProps['orientation']>;
|
|
85
|
+
/**
|
|
86
|
+
* Enable accordion mode (only affects orientation="vertical").
|
|
87
|
+
* If true, only one group can be open at a time.
|
|
88
|
+
* @default false
|
|
89
|
+
*/
|
|
90
|
+
accordion?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Additional CSS classes.
|
|
93
|
+
*/
|
|
94
|
+
class?: ClassNameValue;
|
|
95
|
+
/**
|
|
96
|
+
* Override specific slot classes.
|
|
97
|
+
*/
|
|
98
|
+
ui?: Partial<Record<NavigationMenuSlots, ClassNameValue>>;
|
|
99
|
+
/**
|
|
100
|
+
* Custom snippet for rendering the entire list.
|
|
101
|
+
* Overrides `items` if provided.
|
|
102
|
+
*/
|
|
103
|
+
children?: Snippet;
|
|
104
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
2
|
+
export declare const navigationMenuVariants: import("tailwind-variants").TVReturnType<{
|
|
3
|
+
orientation: {
|
|
4
|
+
horizontal: {
|
|
5
|
+
base: string;
|
|
6
|
+
group: string;
|
|
7
|
+
item: string;
|
|
8
|
+
};
|
|
9
|
+
vertical: {
|
|
10
|
+
base: string;
|
|
11
|
+
group: string;
|
|
12
|
+
item: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
variant: {
|
|
16
|
+
default: {
|
|
17
|
+
item: string[];
|
|
18
|
+
icon: string;
|
|
19
|
+
};
|
|
20
|
+
ghost: {
|
|
21
|
+
item: string[];
|
|
22
|
+
icon: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
active: {
|
|
26
|
+
true: {
|
|
27
|
+
item: string;
|
|
28
|
+
icon: string;
|
|
29
|
+
accordionTrigger: string;
|
|
30
|
+
};
|
|
31
|
+
false: {};
|
|
32
|
+
};
|
|
33
|
+
collapsed: {
|
|
34
|
+
true: {
|
|
35
|
+
item: string;
|
|
36
|
+
icon: string;
|
|
37
|
+
};
|
|
38
|
+
false: {};
|
|
39
|
+
};
|
|
40
|
+
}, {
|
|
41
|
+
base: string;
|
|
42
|
+
group: string;
|
|
43
|
+
item: string[];
|
|
44
|
+
icon: string;
|
|
45
|
+
chevron: string;
|
|
46
|
+
accordionGroupContent: string;
|
|
47
|
+
accordionTrigger: string[];
|
|
48
|
+
}, undefined, {
|
|
49
|
+
orientation: {
|
|
50
|
+
horizontal: {
|
|
51
|
+
base: string;
|
|
52
|
+
group: string;
|
|
53
|
+
item: string;
|
|
54
|
+
};
|
|
55
|
+
vertical: {
|
|
56
|
+
base: string;
|
|
57
|
+
group: string;
|
|
58
|
+
item: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
variant: {
|
|
62
|
+
default: {
|
|
63
|
+
item: string[];
|
|
64
|
+
icon: string;
|
|
65
|
+
};
|
|
66
|
+
ghost: {
|
|
67
|
+
item: string[];
|
|
68
|
+
icon: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
active: {
|
|
72
|
+
true: {
|
|
73
|
+
item: string;
|
|
74
|
+
icon: string;
|
|
75
|
+
accordionTrigger: string;
|
|
76
|
+
};
|
|
77
|
+
false: {};
|
|
78
|
+
};
|
|
79
|
+
collapsed: {
|
|
80
|
+
true: {
|
|
81
|
+
item: string;
|
|
82
|
+
icon: string;
|
|
83
|
+
};
|
|
84
|
+
false: {};
|
|
85
|
+
};
|
|
86
|
+
}, {
|
|
87
|
+
base: string;
|
|
88
|
+
group: string;
|
|
89
|
+
item: string[];
|
|
90
|
+
icon: string;
|
|
91
|
+
chevron: string;
|
|
92
|
+
accordionGroupContent: string;
|
|
93
|
+
accordionTrigger: string[];
|
|
94
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
95
|
+
orientation: {
|
|
96
|
+
horizontal: {
|
|
97
|
+
base: string;
|
|
98
|
+
group: string;
|
|
99
|
+
item: string;
|
|
100
|
+
};
|
|
101
|
+
vertical: {
|
|
102
|
+
base: string;
|
|
103
|
+
group: string;
|
|
104
|
+
item: string;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
variant: {
|
|
108
|
+
default: {
|
|
109
|
+
item: string[];
|
|
110
|
+
icon: string;
|
|
111
|
+
};
|
|
112
|
+
ghost: {
|
|
113
|
+
item: string[];
|
|
114
|
+
icon: string;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
active: {
|
|
118
|
+
true: {
|
|
119
|
+
item: string;
|
|
120
|
+
icon: string;
|
|
121
|
+
accordionTrigger: string;
|
|
122
|
+
};
|
|
123
|
+
false: {};
|
|
124
|
+
};
|
|
125
|
+
collapsed: {
|
|
126
|
+
true: {
|
|
127
|
+
item: string;
|
|
128
|
+
icon: string;
|
|
129
|
+
};
|
|
130
|
+
false: {};
|
|
131
|
+
};
|
|
132
|
+
}, {
|
|
133
|
+
base: string;
|
|
134
|
+
group: string;
|
|
135
|
+
item: string[];
|
|
136
|
+
icon: string;
|
|
137
|
+
chevron: string;
|
|
138
|
+
accordionGroupContent: string;
|
|
139
|
+
accordionTrigger: string[];
|
|
140
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
141
|
+
export type NavigationMenuVariantProps = VariantProps<typeof navigationMenuVariants>;
|
|
142
|
+
export type NavigationMenuSlots = keyof ReturnType<typeof navigationMenuVariants>;
|