svelora 3.0.7 → 3.0.8
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 +212 -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 +121 -0
- package/dist/NavigationMenu/navigation-menu.variants.js +64 -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/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 +10 -8
- 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
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<script lang="ts">import { twMerge } from "tailwind-merge";
|
|
2
|
+
import Input from "../Input/Input.svelte";
|
|
3
|
+
import Button from "../Button/Button.svelte";
|
|
4
|
+
import Modal from "../Modal/Modal.svelte";
|
|
5
|
+
import Command from "../Command/Command.svelte";
|
|
6
|
+
import Kbd from "../Kbd/Kbd.svelte";
|
|
7
|
+
import { onMount } from "svelte";
|
|
8
|
+
let { variant = "input", value = $bindable(""), kbd = [], groups = [], onSelect, placeholder = "Search...", class: className, ...rest } = $props();
|
|
9
|
+
let open = $state(false);
|
|
10
|
+
onMount(() => {
|
|
11
|
+
if (kbd.length > 0 && (variant === "modal" || variant === "button")) {
|
|
12
|
+
const handleKeydown = (e) => {
|
|
13
|
+
const isMac = navigator.userAgent.toLowerCase().includes("mac");
|
|
14
|
+
const isMeta = kbd.includes("meta") || kbd.includes("ctrl");
|
|
15
|
+
const key = kbd.find((k) => k.length === 1)?.toLowerCase();
|
|
16
|
+
if (isMeta && key) {
|
|
17
|
+
if ((isMac ? e.metaKey : e.ctrlKey) && e.key.toLowerCase() === key) {
|
|
18
|
+
e.preventDefault();
|
|
19
|
+
open = true;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
window.addEventListener("keydown", handleKeydown);
|
|
24
|
+
return () => window.removeEventListener("keydown", handleKeydown);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
{#if variant === 'input'}
|
|
30
|
+
<Input
|
|
31
|
+
type="search"
|
|
32
|
+
{placeholder}
|
|
33
|
+
bind:value
|
|
34
|
+
leadingIcon="lucide:search"
|
|
35
|
+
class={className}
|
|
36
|
+
{...(rest as any)}
|
|
37
|
+
>
|
|
38
|
+
{#snippet trailingSlot()}
|
|
39
|
+
{#if kbd.length > 0}
|
|
40
|
+
<div class="pointer-events-none flex items-center gap-1">
|
|
41
|
+
{#each kbd as key}
|
|
42
|
+
<Kbd value={key} size="sm" />
|
|
43
|
+
{/each}
|
|
44
|
+
</div>
|
|
45
|
+
{/if}
|
|
46
|
+
{/snippet}
|
|
47
|
+
</Input>
|
|
48
|
+
{:else if variant === 'modal'}
|
|
49
|
+
<button
|
|
50
|
+
type="button"
|
|
51
|
+
class={twMerge(
|
|
52
|
+
'flex h-10 w-full items-center justify-between rounded-md border border-outline-variant bg-surface px-3 py-2 text-sm text-on-surface-variant shadow-sm transition-colors hover:bg-surface-container hover:text-on-surface focus:outline-none focus:ring-2 focus:ring-primary',
|
|
53
|
+
className
|
|
54
|
+
)}
|
|
55
|
+
onclick={() => (open = true)}
|
|
56
|
+
{...(rest as any)}
|
|
57
|
+
>
|
|
58
|
+
<span class="flex items-center gap-2">
|
|
59
|
+
<span class="iconify lucide--search text-lg"></span>
|
|
60
|
+
<span>{placeholder}</span>
|
|
61
|
+
</span>
|
|
62
|
+
{#if kbd.length > 0}
|
|
63
|
+
<span class="flex items-center gap-1">
|
|
64
|
+
{#each kbd as key}
|
|
65
|
+
<Kbd value={key} size="sm" />
|
|
66
|
+
{/each}
|
|
67
|
+
</span>
|
|
68
|
+
{/if}
|
|
69
|
+
</button>
|
|
70
|
+
{:else if variant === 'button'}
|
|
71
|
+
<Button
|
|
72
|
+
variant="ghost"
|
|
73
|
+
color="surface"
|
|
74
|
+
leadingIcon="lucide:search"
|
|
75
|
+
class={className}
|
|
76
|
+
onclick={() => (open = true)}
|
|
77
|
+
{...(rest as any)}
|
|
78
|
+
/>
|
|
79
|
+
{/if}
|
|
80
|
+
|
|
81
|
+
{#if variant === 'modal' || variant === 'button'}
|
|
82
|
+
<Modal bind:open size="lg">
|
|
83
|
+
{#snippet content()}
|
|
84
|
+
<Command
|
|
85
|
+
{groups}
|
|
86
|
+
bind:search={value}
|
|
87
|
+
placeholder="Type a command or search..."
|
|
88
|
+
ui={{
|
|
89
|
+
root: 'border-0 shadow-none'
|
|
90
|
+
}}
|
|
91
|
+
/>
|
|
92
|
+
{/snippet}
|
|
93
|
+
</Modal>
|
|
94
|
+
{/if}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Search } from './Search.svelte';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
3
|
+
import type { CommandGroup } from '../Command/command.types.js';
|
|
4
|
+
export type SearchVariant = 'input' | 'modal' | 'button';
|
|
5
|
+
export interface SearchProps extends Omit<HTMLAttributes<HTMLInputElement | HTMLButtonElement>, 'class'> {
|
|
6
|
+
/**
|
|
7
|
+
* Determines the visual style and behavior of the search component.
|
|
8
|
+
* - `input`: A standard input box.
|
|
9
|
+
* - `modal`: A fake input that opens a modal containing a Command palette when clicked.
|
|
10
|
+
* - `button`: A simple icon button that opens a modal containing a Command palette.
|
|
11
|
+
* @default 'input'
|
|
12
|
+
*/
|
|
13
|
+
variant?: SearchVariant;
|
|
14
|
+
/**
|
|
15
|
+
* The value of the search input (when variant is 'input' or internal modal search).
|
|
16
|
+
*/
|
|
17
|
+
value?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Keyboard shortcut to display (and listen to) for opening the modal.
|
|
20
|
+
* E.g. `['meta', 'K']` or `['ctrl', '/']`
|
|
21
|
+
*/
|
|
22
|
+
kbd?: string[];
|
|
23
|
+
/**
|
|
24
|
+
* Data groups to display in the Command palette (used when variant is 'modal' or 'button').
|
|
25
|
+
*/
|
|
26
|
+
groups?: CommandGroup[];
|
|
27
|
+
/**
|
|
28
|
+
* Callback fired when an item is selected from the Command palette.
|
|
29
|
+
*/
|
|
30
|
+
onSelect?: (value: string) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Placeholder text for the input or fake input.
|
|
33
|
+
* @default 'Search...'
|
|
34
|
+
*/
|
|
35
|
+
placeholder?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Additional CSS classes for the root element.
|
|
38
|
+
*/
|
|
39
|
+
class?: ClassNameValue;
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/docs/navigation.js
CHANGED
|
@@ -146,10 +146,27 @@ export const docsComponentGroups = [
|
|
|
146
146
|
icon: 'lucide:layout-panel-left-right'
|
|
147
147
|
},
|
|
148
148
|
{
|
|
149
|
-
title: '
|
|
149
|
+
title: 'Modal',
|
|
150
|
+
href: '/docs/components/modal',
|
|
151
|
+
icon: 'lucide:layout-panel-left-right'
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
title: 'Navigation Menu',
|
|
155
|
+
href: '/docs/components/navigation-menu',
|
|
156
|
+
icon: 'lucide:compass',
|
|
157
|
+
description: 'A horizontal list of links with optional nested dropdowns.'
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
title: 'Scroll Area',
|
|
150
161
|
href: '/docs/components/scroll-area',
|
|
151
|
-
|
|
152
|
-
|
|
162
|
+
icon: 'lucide:scroll-text',
|
|
163
|
+
description: 'A customizable scrollable area with custom scrollbars.'
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
title: 'Search',
|
|
167
|
+
href: '/docs/components/search',
|
|
168
|
+
icon: 'lucide:search',
|
|
169
|
+
description: 'A flexible search input or command palette modal.'
|
|
153
170
|
},
|
|
154
171
|
{
|
|
155
172
|
title: 'Separator',
|
|
@@ -435,12 +452,6 @@ export const docsComponentGroups = [
|
|
|
435
452
|
legacyHref: '/pagination',
|
|
436
453
|
icon: 'lucide:ellipsis'
|
|
437
454
|
},
|
|
438
|
-
{
|
|
439
|
-
title: 'Menu',
|
|
440
|
-
href: '/docs/components/menu',
|
|
441
|
-
legacyHref: '/menu',
|
|
442
|
-
icon: 'lucide:menu-square'
|
|
443
|
-
},
|
|
444
455
|
{
|
|
445
456
|
title: 'Sidebar',
|
|
446
457
|
href: '/docs/components/sidebar',
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export { ModeWatcher, createInitialModeExpression, generateSetInitialModeExpression, mode, resetMode, setMode, setTheme, systemPrefersMode, theme, themeStorageKey, toggleMode, userPrefersMode, modeStorageKey } from 'mode-watcher';
|
|
2
|
-
export type { SystemModeValue, SystemPrefersMode, UserPrefersMode } from 'mode-watcher';
|
|
3
1
|
export * from './Accordion/index.js';
|
|
4
2
|
export * from './Alert/index.js';
|
|
5
3
|
export * from './Avatar/index.js';
|
|
@@ -40,8 +38,8 @@ export * from './Link/index.js';
|
|
|
40
38
|
export * from './List/index.js';
|
|
41
39
|
export * from './LocaleButton/index.js';
|
|
42
40
|
export * from './Marquee/index.js';
|
|
43
|
-
export * from './Menu/index.js';
|
|
44
41
|
export * from './Modal/index.js';
|
|
42
|
+
export * from './NavigationMenu/index.js';
|
|
45
43
|
export * from './NumberTicker/index.js';
|
|
46
44
|
export * from './Pagination/index.js';
|
|
47
45
|
export * from './PasswordInput/index.js';
|
|
@@ -53,6 +51,7 @@ export * from './RadioGroup/index.js';
|
|
|
53
51
|
export * from './Rating/index.js';
|
|
54
52
|
export * from './Resizable/index.js';
|
|
55
53
|
export * from './ScrollArea/index.js';
|
|
54
|
+
export * from './Search/index.js';
|
|
56
55
|
export * from './Select/index.js';
|
|
57
56
|
export * from './SelectMenu/index.js';
|
|
58
57
|
export * from './Separator/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// Components
|
|
2
|
-
export { ModeWatcher, createInitialModeExpression, generateSetInitialModeExpression, mode, resetMode, setMode, setTheme, systemPrefersMode, theme, themeStorageKey, toggleMode, userPrefersMode, modeStorageKey } from 'mode-watcher';
|
|
3
2
|
export * from './Accordion/index.js';
|
|
4
3
|
export * from './Alert/index.js';
|
|
5
4
|
export * from './Avatar/index.js';
|
|
@@ -41,8 +40,8 @@ export * from './Link/index.js';
|
|
|
41
40
|
export * from './List/index.js';
|
|
42
41
|
export * from './LocaleButton/index.js';
|
|
43
42
|
export * from './Marquee/index.js';
|
|
44
|
-
export * from './Menu/index.js';
|
|
45
43
|
export * from './Modal/index.js';
|
|
44
|
+
export * from './NavigationMenu/index.js';
|
|
46
45
|
export * from './NumberTicker/index.js';
|
|
47
46
|
export * from './Pagination/index.js';
|
|
48
47
|
export * from './PasswordInput/index.js';
|
|
@@ -54,6 +53,7 @@ export * from './RadioGroup/index.js';
|
|
|
54
53
|
export * from './Rating/index.js';
|
|
55
54
|
export * from './Resizable/index.js';
|
|
56
55
|
export * from './ScrollArea/index.js';
|
|
56
|
+
export * from './Search/index.js';
|
|
57
57
|
export * from './Select/index.js';
|
|
58
58
|
export * from './SelectMenu/index.js';
|
|
59
59
|
export * from './Separator/index.js';
|