sv5ui-plus 4.0.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/LICENSE +21 -0
- package/README.md +62 -0
- package/dist/adapters/notify.d.ts +29 -0
- package/dist/adapters/notify.js +88 -0
- package/dist/compat.d.ts +6 -0
- package/dist/compat.js +6 -0
- package/dist/components/BentoGrid/BentoCard.svelte +45 -0
- package/dist/components/BentoGrid/BentoCard.svelte.d.ts +4 -0
- package/dist/components/BentoGrid/BentoGrid.svelte +9 -0
- package/dist/components/BentoGrid/BentoGrid.svelte.d.ts +4 -0
- package/dist/components/BentoGrid/bento-grid.types.d.ts +47 -0
- package/dist/components/BentoGrid/bento-grid.types.js +1 -0
- package/dist/components/BentoGrid/bento-grid.variants.d.ts +30 -0
- package/dist/components/BentoGrid/bento-grid.variants.js +16 -0
- package/dist/components/BentoGrid/index.d.ts +5 -0
- package/dist/components/BentoGrid/index.js +5 -0
- package/dist/components/Chart/Chart.svelte +62 -0
- package/dist/components/Chart/Chart.svelte.d.ts +4 -0
- package/dist/components/Chart/chart.types.d.ts +16 -0
- package/dist/components/Chart/chart.types.js +1 -0
- package/dist/components/Chart/index.d.ts +2 -0
- package/dist/components/Chart/index.js +2 -0
- package/dist/components/Chat/ChatBubble.svelte +30 -0
- package/dist/components/Chat/ChatBubble.svelte.d.ts +4 -0
- package/dist/components/Chat/ChatInput.svelte +50 -0
- package/dist/components/Chat/ChatInput.svelte.d.ts +4 -0
- package/dist/components/Chat/ChatMessage.svelte +15 -0
- package/dist/components/Chat/ChatMessage.svelte.d.ts +4 -0
- package/dist/components/Chat/chat.types.d.ts +63 -0
- package/dist/components/Chat/chat.types.js +1 -0
- package/dist/components/Chat/chat.variants.d.ts +117 -0
- package/dist/components/Chat/chat.variants.js +47 -0
- package/dist/components/Chat/index.d.ts +6 -0
- package/dist/components/Chat/index.js +6 -0
- package/dist/components/CodeBlock/CodeBlock.svelte +66 -0
- package/dist/components/CodeBlock/CodeBlock.svelte.d.ts +5 -0
- package/dist/components/CodeBlock/code-block.types.d.ts +15 -0
- package/dist/components/CodeBlock/code-block.types.js +1 -0
- package/dist/components/CodeBlock/code-block.variants.d.ts +288 -0
- package/dist/components/CodeBlock/code-block.variants.js +69 -0
- package/dist/components/CodeBlock/index.d.ts +2 -0
- package/dist/components/CodeBlock/index.js +1 -0
- package/dist/components/ColorPicker/ColorPicker.svelte +109 -0
- package/dist/components/ColorPicker/ColorPicker.svelte.d.ts +4 -0
- package/dist/components/ColorPicker/color-picker.types.d.ts +26 -0
- package/dist/components/ColorPicker/color-picker.types.js +1 -0
- package/dist/components/ColorPicker/color-picker.variants.d.ts +69 -0
- package/dist/components/ColorPicker/color-picker.variants.js +13 -0
- package/dist/components/ColorPicker/index.d.ts +4 -0
- package/dist/components/ColorPicker/index.js +4 -0
- package/dist/components/ConfirmDialog/ConfirmDialog.svelte +175 -0
- package/dist/components/ConfirmDialog/ConfirmDialog.svelte.d.ts +10 -0
- package/dist/components/ConfirmDialog/confirm.d.ts +9 -0
- package/dist/components/ConfirmDialog/confirm.js +24 -0
- package/dist/components/ConfirmDialog/confirm.types.d.ts +21 -0
- package/dist/components/ConfirmDialog/confirm.types.js +1 -0
- package/dist/components/ConfirmDialog/index.d.ts +4 -0
- package/dist/components/ConfirmDialog/index.js +2 -0
- package/dist/components/Fonts/Fonts.svelte +32 -0
- package/dist/components/Fonts/Fonts.svelte.d.ts +5 -0
- package/dist/components/Fonts/fonts.d.ts +12 -0
- package/dist/components/Fonts/fonts.js +126 -0
- package/dist/components/Fonts/fonts.types.d.ts +40 -0
- package/dist/components/Fonts/fonts.types.js +1 -0
- package/dist/components/Fonts/index.d.ts +3 -0
- package/dist/components/Fonts/index.js +2 -0
- package/dist/components/List/List.svelte +14 -0
- package/dist/components/List/List.svelte.d.ts +4 -0
- package/dist/components/List/ListItem.svelte +64 -0
- package/dist/components/List/ListItem.svelte.d.ts +4 -0
- package/dist/components/List/index.d.ts +5 -0
- package/dist/components/List/index.js +5 -0
- package/dist/components/List/list.types.d.ts +62 -0
- package/dist/components/List/list.types.js +1 -0
- package/dist/components/List/list.variants.d.ts +99 -0
- package/dist/components/List/list.variants.js +42 -0
- package/dist/components/LocaleButton/LocaleButton.svelte +181 -0
- package/dist/components/LocaleButton/LocaleButton.svelte.d.ts +5 -0
- package/dist/components/LocaleButton/index.d.ts +2 -0
- package/dist/components/LocaleButton/index.js +1 -0
- package/dist/components/LocaleButton/locale-button.types.d.ts +208 -0
- package/dist/components/LocaleButton/locale-button.types.js +1 -0
- package/dist/components/LocaleButton/locale-button.variants.d.ts +245 -0
- package/dist/components/LocaleButton/locale-button.variants.js +98 -0
- package/dist/components/Marquee/Marquee.svelte +50 -0
- package/dist/components/Marquee/Marquee.svelte.d.ts +4 -0
- package/dist/components/Marquee/index.d.ts +4 -0
- package/dist/components/Marquee/index.js +4 -0
- package/dist/components/Marquee/marquee.types.d.ts +38 -0
- package/dist/components/Marquee/marquee.types.js +1 -0
- package/dist/components/Marquee/marquee.variants.d.ts +78 -0
- package/dist/components/Marquee/marquee.variants.js +28 -0
- package/dist/components/NavigationMenu/NavigationMenu.svelte +623 -0
- package/dist/components/NavigationMenu/NavigationMenu.svelte.d.ts +5 -0
- package/dist/components/NavigationMenu/index.d.ts +2 -0
- package/dist/components/NavigationMenu/index.js +1 -0
- package/dist/components/NavigationMenu/navigation-menu.types.d.ts +245 -0
- package/dist/components/NavigationMenu/navigation-menu.types.js +1 -0
- package/dist/components/NavigationMenu/navigation-menu.variants.d.ts +543 -0
- package/dist/components/NavigationMenu/navigation-menu.variants.js +287 -0
- package/dist/components/NumberTicker/NumberTicker.svelte +59 -0
- package/dist/components/NumberTicker/NumberTicker.svelte.d.ts +4 -0
- package/dist/components/NumberTicker/index.d.ts +4 -0
- package/dist/components/NumberTicker/index.js +4 -0
- package/dist/components/NumberTicker/number-ticker.types.d.ts +26 -0
- package/dist/components/NumberTicker/number-ticker.types.js +1 -0
- package/dist/components/NumberTicker/number-ticker.variants.d.ts +27 -0
- package/dist/components/NumberTicker/number-ticker.variants.js +6 -0
- package/dist/components/PasswordInput/PasswordInput.svelte +182 -0
- package/dist/components/PasswordInput/PasswordInput.svelte.d.ts +5 -0
- package/dist/components/PasswordInput/index.d.ts +2 -0
- package/dist/components/PasswordInput/index.js +1 -0
- package/dist/components/PasswordInput/password-input.types.d.ts +111 -0
- package/dist/components/PasswordInput/password-input.types.js +1 -0
- package/dist/components/PasswordInput/password-input.variants.d.ts +273 -0
- package/dist/components/PasswordInput/password-input.variants.js +105 -0
- package/dist/components/Prose/Prose.svelte +13 -0
- package/dist/components/Prose/Prose.svelte.d.ts +4 -0
- package/dist/components/Prose/index.d.ts +4 -0
- package/dist/components/Prose/index.js +4 -0
- package/dist/components/Prose/prose.types.d.ts +22 -0
- package/dist/components/Prose/prose.types.js +1 -0
- package/dist/components/Prose/prose.variants.d.ts +45 -0
- package/dist/components/Prose/prose.variants.js +45 -0
- package/dist/components/Resizable/Resizable.svelte +9 -0
- package/dist/components/Resizable/Resizable.svelte.d.ts +4 -0
- package/dist/components/Resizable/index.d.ts +4 -0
- package/dist/components/Resizable/index.js +4 -0
- package/dist/components/Resizable/resizable.types.d.ts +18 -0
- package/dist/components/Resizable/resizable.types.js +1 -0
- package/dist/components/Resizable/resizable.variants.d.ts +48 -0
- package/dist/components/Resizable/resizable.variants.js +17 -0
- package/dist/components/ScrollArea/ScrollArea.svelte +54 -0
- package/dist/components/ScrollArea/ScrollArea.svelte.d.ts +4 -0
- package/dist/components/ScrollArea/index.d.ts +4 -0
- package/dist/components/ScrollArea/index.js +4 -0
- package/dist/components/ScrollArea/scroll-area.types.d.ts +27 -0
- package/dist/components/ScrollArea/scroll-area.types.js +1 -0
- package/dist/components/ScrollArea/scroll-area.variants.d.ts +45 -0
- package/dist/components/ScrollArea/scroll-area.variants.js +27 -0
- package/dist/components/Search/Search.svelte +94 -0
- package/dist/components/Search/Search.svelte.d.ts +4 -0
- package/dist/components/Search/index.d.ts +2 -0
- package/dist/components/Search/index.js +1 -0
- package/dist/components/Search/search.types.d.ts +40 -0
- package/dist/components/Search/search.types.js +1 -0
- package/dist/components/SortableGroup/SortableGroup.svelte +53 -0
- package/dist/components/SortableGroup/SortableGroup.svelte.d.ts +13 -0
- package/dist/components/SortableGroup/index.d.ts +1 -0
- package/dist/components/SortableGroup/index.js +1 -0
- package/dist/components/SortableList/SortableList.svelte +81 -0
- package/dist/components/SortableList/SortableList.svelte.d.ts +26 -0
- package/dist/components/SortableList/index.d.ts +2 -0
- package/dist/components/SortableList/index.js +1 -0
- package/dist/components/SortableList/sortable-list.types.d.ts +21 -0
- package/dist/components/SortableList/sortable-list.types.js +1 -0
- package/dist/components/Spotlight/Spotlight.svelte +31 -0
- package/dist/components/Spotlight/Spotlight.svelte.d.ts +4 -0
- package/dist/components/Spotlight/index.d.ts +4 -0
- package/dist/components/Spotlight/index.js +4 -0
- package/dist/components/Spotlight/spotlight.types.d.ts +22 -0
- package/dist/components/Spotlight/spotlight.types.js +1 -0
- package/dist/components/Spotlight/spotlight.variants.d.ts +39 -0
- package/dist/components/Spotlight/spotlight.variants.js +8 -0
- package/dist/components/TableBulkActionBar/TableBulkActionBar.svelte +38 -0
- package/dist/components/TableBulkActionBar/TableBulkActionBar.svelte.d.ts +5 -0
- package/dist/components/TableBulkActionBar/index.d.ts +2 -0
- package/dist/components/TableBulkActionBar/index.js +1 -0
- package/dist/components/TableBulkActionBar/table-bulk-action-bar.types.d.ts +31 -0
- package/dist/components/TableBulkActionBar/table-bulk-action-bar.types.js +1 -0
- package/dist/components/TableBulkActionBar/table-bulk-action-bar.variants.d.ts +52 -0
- package/dist/components/TableBulkActionBar/table-bulk-action-bar.variants.js +10 -0
- package/dist/components/TreeView/TreeView.svelte +95 -0
- package/dist/components/TreeView/TreeView.svelte.d.ts +4 -0
- package/dist/components/TreeView/index.d.ts +4 -0
- package/dist/components/TreeView/index.js +3 -0
- package/dist/components/TreeView/tree-view.types.d.ts +68 -0
- package/dist/components/TreeView/tree-view.types.js +1 -0
- package/dist/components/TreeView/tree-view.variants.d.ts +69 -0
- package/dist/components/TreeView/tree-view.variants.js +30 -0
- package/dist/config.d.ts +91 -0
- package/dist/config.js +124 -0
- package/dist/editor.d.ts +2 -0
- package/dist/editor.js +2 -0
- package/dist/form/resolve-form-field-name.d.ts +5 -0
- package/dist/form/resolve-form-field-name.js +11 -0
- package/dist/hooks/internal/DragDropProviderScope.svelte +29 -0
- package/dist/hooks/internal/DragDropProviderScope.svelte.d.ts +7 -0
- package/dist/hooks/internal/SortableProvider.svelte +68 -0
- package/dist/hooks/internal/SortableProvider.svelte.d.ts +30 -0
- package/dist/hooks/internal/drag-drop-context.d.ts +12 -0
- package/dist/hooks/internal/drag-drop-context.js +1 -0
- package/dist/hooks/internal/sortable-context.d.ts +26 -0
- package/dist/hooks/internal/sortable-context.js +2 -0
- package/dist/hooks/useDragDrop/index.d.ts +1 -0
- package/dist/hooks/useDragDrop/index.js +1 -0
- package/dist/hooks/useDragDrop/useDragDrop.svelte.d.ts +40 -0
- package/dist/hooks/useDragDrop/useDragDrop.svelte.js +128 -0
- package/dist/hooks/useSortable/index.d.ts +2 -0
- package/dist/hooks/useSortable/index.js +2 -0
- package/dist/hooks/useSortable/sortable-utils.d.ts +1 -0
- package/dist/hooks/useSortable/sortable-utils.js +13 -0
- package/dist/hooks/useSortable/useSortable.svelte.d.ts +60 -0
- package/dist/hooks/useSortable/useSortable.svelte.js +151 -0
- package/dist/hooks/utils.d.ts +1 -0
- package/dist/hooks/utils.js +3 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +30 -0
- package/dist/mcp/cursor.mcp.json +12 -0
- package/dist/mcp/install-template.mjs +55 -0
- package/dist/mcp/server.mjs +338 -0
- package/dist/mcp/sv5ui-plus-docs.data.json +17 -0
- package/dist/theme.css +64 -0
- package/package.json +176 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
export interface SpotlightProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/**
|
|
5
|
+
* Size of the spotlight in pixels.
|
|
6
|
+
* @default 400
|
|
7
|
+
*/
|
|
8
|
+
size?: number;
|
|
9
|
+
/**
|
|
10
|
+
* Color of the spotlight in rgba, hex, or CSS variable.
|
|
11
|
+
* @default 'rgba(255, 255, 255, 0.1)'
|
|
12
|
+
*/
|
|
13
|
+
color?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Additional CSS classes.
|
|
16
|
+
*/
|
|
17
|
+
class?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Content to render inside the spotlight container.
|
|
20
|
+
*/
|
|
21
|
+
children?: Snippet;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
2
|
+
export declare const spotlightVariants: import("tailwind-variants").TVReturnType<{
|
|
3
|
+
[key: string]: {
|
|
4
|
+
[key: string]: import("tailwind-variants").ClassValue | {
|
|
5
|
+
root?: import("tailwind-variants").ClassValue;
|
|
6
|
+
content?: import("tailwind-variants").ClassValue;
|
|
7
|
+
spotlight?: import("tailwind-variants").ClassValue;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
} | {
|
|
11
|
+
[x: string]: {
|
|
12
|
+
[x: string]: import("tailwind-variants").ClassValue | {
|
|
13
|
+
root?: import("tailwind-variants").ClassValue;
|
|
14
|
+
content?: import("tailwind-variants").ClassValue;
|
|
15
|
+
spotlight?: import("tailwind-variants").ClassValue;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
} | {}, {
|
|
19
|
+
root: string;
|
|
20
|
+
spotlight: string;
|
|
21
|
+
content: string;
|
|
22
|
+
}, undefined, {
|
|
23
|
+
[key: string]: {
|
|
24
|
+
[key: string]: import("tailwind-variants").ClassValue | {
|
|
25
|
+
root?: import("tailwind-variants").ClassValue;
|
|
26
|
+
content?: import("tailwind-variants").ClassValue;
|
|
27
|
+
spotlight?: import("tailwind-variants").ClassValue;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
} | {}, {
|
|
31
|
+
root: string;
|
|
32
|
+
spotlight: string;
|
|
33
|
+
content: string;
|
|
34
|
+
}, import("tailwind-variants").TVReturnTypeLike<unknown, {
|
|
35
|
+
root: string;
|
|
36
|
+
spotlight: string;
|
|
37
|
+
content: string;
|
|
38
|
+
}>>;
|
|
39
|
+
export type SpotlightVariantProps = VariantProps<typeof spotlightVariants>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
export const spotlightVariants = tv({
|
|
3
|
+
slots: {
|
|
4
|
+
root: 'relative overflow-hidden group',
|
|
5
|
+
spotlight: 'pointer-events-none absolute -inset-px rounded-xl opacity-0 transition-opacity duration-300 group-hover:opacity-100',
|
|
6
|
+
content: 'relative z-10 h-full w-full'
|
|
7
|
+
}
|
|
8
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script lang="ts" module>export {};
|
|
2
|
+
</script>
|
|
3
|
+
|
|
4
|
+
<script lang="ts">import { fly } from "svelte/transition";
|
|
5
|
+
import { tableBulkActionBarVariants } from "./table-bulk-action-bar.variants.js";
|
|
6
|
+
import { Button } from "sv5ui";
|
|
7
|
+
let { count, onClear, text = "items selected", class: className, ui, children, ...restProps } = $props();
|
|
8
|
+
const slots = $derived(tableBulkActionBarVariants());
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<div
|
|
12
|
+
class={slots.root({ class: [ui?.root, className] })}
|
|
13
|
+
transition:fly={{ y: 20, duration: 250 }}
|
|
14
|
+
{...restProps}
|
|
15
|
+
>
|
|
16
|
+
<div class={slots.content({ class: ui?.content })}>
|
|
17
|
+
<span class={slots.countBadge({ class: ui?.countBadge })}>{count}</span>
|
|
18
|
+
<span class="opacity-90">{text}</span>
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
{#if children}
|
|
22
|
+
<div class={slots.actions({ class: ui?.actions })}>
|
|
23
|
+
{@render children()}
|
|
24
|
+
</div>
|
|
25
|
+
{/if}
|
|
26
|
+
|
|
27
|
+
<div class={slots.clearButton({ class: ui?.clearButton })}>
|
|
28
|
+
<Button
|
|
29
|
+
variant="ghost"
|
|
30
|
+
color="surface"
|
|
31
|
+
size="sm"
|
|
32
|
+
icon="lucide:x"
|
|
33
|
+
onclick={onClear}
|
|
34
|
+
class="h-8 w-8 !p-0 rounded-full"
|
|
35
|
+
aria-label="Clear selection"
|
|
36
|
+
/>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { TableBulkActionBarProps } from './table-bulk-action-bar.types.js';
|
|
2
|
+
export type Props = TableBulkActionBarProps;
|
|
3
|
+
declare const TableBulkActionBar: import("svelte").Component<TableBulkActionBarProps, {}, "">;
|
|
4
|
+
type TableBulkActionBar = ReturnType<typeof TableBulkActionBar>;
|
|
5
|
+
export default TableBulkActionBar;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as TableBulkActionBar } from './TableBulkActionBar.svelte';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
3
|
+
import type { TableBulkActionBarSlots } from './table-bulk-action-bar.variants.js';
|
|
4
|
+
export type TableBulkActionBarProps = {
|
|
5
|
+
/**
|
|
6
|
+
* The number of selected items to display.
|
|
7
|
+
*/
|
|
8
|
+
count: number;
|
|
9
|
+
/**
|
|
10
|
+
* Callback when the clear/close button is clicked.
|
|
11
|
+
* This is usually where you clear the selection state (`selectedRows = []`).
|
|
12
|
+
*/
|
|
13
|
+
onClear?: () => void;
|
|
14
|
+
/**
|
|
15
|
+
* Text to display next to the count.
|
|
16
|
+
* @default 'items selected'
|
|
17
|
+
*/
|
|
18
|
+
text?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Additional CSS classes.
|
|
21
|
+
*/
|
|
22
|
+
class?: ClassNameValue;
|
|
23
|
+
/**
|
|
24
|
+
* Override specific slot classes.
|
|
25
|
+
*/
|
|
26
|
+
ui?: Partial<Record<TableBulkActionBarSlots, ClassNameValue>>;
|
|
27
|
+
/**
|
|
28
|
+
* The action buttons to display.
|
|
29
|
+
*/
|
|
30
|
+
children?: Snippet;
|
|
31
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
2
|
+
export declare const tableBulkActionBarVariants: import("tailwind-variants").TVReturnType<{
|
|
3
|
+
[key: string]: {
|
|
4
|
+
[key: string]: import("tailwind-variants").ClassValue | {
|
|
5
|
+
root?: import("tailwind-variants").ClassValue;
|
|
6
|
+
content?: import("tailwind-variants").ClassValue;
|
|
7
|
+
countBadge?: import("tailwind-variants").ClassValue;
|
|
8
|
+
actions?: import("tailwind-variants").ClassValue;
|
|
9
|
+
clearButton?: import("tailwind-variants").ClassValue;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
} | {
|
|
13
|
+
[x: string]: {
|
|
14
|
+
[x: string]: import("tailwind-variants").ClassValue | {
|
|
15
|
+
root?: import("tailwind-variants").ClassValue;
|
|
16
|
+
content?: import("tailwind-variants").ClassValue;
|
|
17
|
+
countBadge?: import("tailwind-variants").ClassValue;
|
|
18
|
+
actions?: import("tailwind-variants").ClassValue;
|
|
19
|
+
clearButton?: import("tailwind-variants").ClassValue;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
} | {}, {
|
|
23
|
+
root: string;
|
|
24
|
+
content: string;
|
|
25
|
+
countBadge: string;
|
|
26
|
+
actions: string;
|
|
27
|
+
clearButton: string;
|
|
28
|
+
}, undefined, {
|
|
29
|
+
[key: string]: {
|
|
30
|
+
[key: string]: import("tailwind-variants").ClassValue | {
|
|
31
|
+
root?: import("tailwind-variants").ClassValue;
|
|
32
|
+
content?: import("tailwind-variants").ClassValue;
|
|
33
|
+
countBadge?: import("tailwind-variants").ClassValue;
|
|
34
|
+
actions?: import("tailwind-variants").ClassValue;
|
|
35
|
+
clearButton?: import("tailwind-variants").ClassValue;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
} | {}, {
|
|
39
|
+
root: string;
|
|
40
|
+
content: string;
|
|
41
|
+
countBadge: string;
|
|
42
|
+
actions: string;
|
|
43
|
+
clearButton: string;
|
|
44
|
+
}, import("tailwind-variants").TVReturnTypeLike<unknown, {
|
|
45
|
+
root: string;
|
|
46
|
+
content: string;
|
|
47
|
+
countBadge: string;
|
|
48
|
+
actions: string;
|
|
49
|
+
clearButton: string;
|
|
50
|
+
}>>;
|
|
51
|
+
export type TableBulkActionBarVariantProps = VariantProps<typeof tableBulkActionBarVariants>;
|
|
52
|
+
export type TableBulkActionBarSlots = keyof ReturnType<typeof tableBulkActionBarVariants>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
export const tableBulkActionBarVariants = tv({
|
|
3
|
+
slots: {
|
|
4
|
+
root: 'fixed bottom-6 left-1/2 -translate-x-1/2 z-50 flex items-center justify-between gap-6 rounded-2xl border border-outline-variant/50 bg-surface/95 px-4 py-3 shadow-xl shadow-surface-container-highest/20 backdrop-blur-md',
|
|
5
|
+
content: 'flex items-center gap-3 text-sm text-on-surface whitespace-nowrap',
|
|
6
|
+
countBadge: 'font-semibold bg-primary text-on-primary px-2 py-0.5 rounded-full text-xs flex items-center justify-center min-w-[20px]',
|
|
7
|
+
actions: 'flex items-center gap-2 border-l border-outline-variant/50 pl-4',
|
|
8
|
+
clearButton: ''
|
|
9
|
+
}
|
|
10
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<script lang="ts">import { twMerge } from "tailwind-merge";
|
|
2
|
+
import { Icon } from "sv5ui";
|
|
3
|
+
import { treeViewVariants } from "./tree-view.variants.js";
|
|
4
|
+
let { items = [], selectedIds = [], expandedIds = $bindable([]), size = "md", expandOnRowClick = true, class: className, onItemClick, onItemExpand, labelSnippet, ...restProps } = $props();
|
|
5
|
+
let styles = $derived(treeViewVariants({ size }));
|
|
6
|
+
// Internal state tracking for faster lookup
|
|
7
|
+
let expandedSet = $derived(new Set(expandedIds));
|
|
8
|
+
let selectedSet = $derived(new Set(selectedIds));
|
|
9
|
+
function toggleExpand(e, item) {
|
|
10
|
+
e.stopPropagation();
|
|
11
|
+
if (item.disabled || !item.children?.length) return;
|
|
12
|
+
const isExpanded = expandedSet.has(item.id);
|
|
13
|
+
if (isExpanded) {
|
|
14
|
+
expandedIds = expandedIds.filter((id) => id !== item.id);
|
|
15
|
+
} else {
|
|
16
|
+
expandedIds = [...expandedIds, item.id];
|
|
17
|
+
}
|
|
18
|
+
onItemExpand?.(item, !isExpanded);
|
|
19
|
+
}
|
|
20
|
+
function handleRowClick(e, item) {
|
|
21
|
+
if (item.disabled) return;
|
|
22
|
+
if (expandOnRowClick && item.children?.length) {
|
|
23
|
+
toggleExpand(e, item);
|
|
24
|
+
}
|
|
25
|
+
onItemClick?.(item);
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
{#snippet renderTree(treeItems: TreeItem[])}
|
|
30
|
+
<div class={styles.root()}>
|
|
31
|
+
{#each treeItems as item}
|
|
32
|
+
{@const hasChildren = item.children && item.children.length > 0}
|
|
33
|
+
{@const isExpanded = expandedSet.has(item.id)}
|
|
34
|
+
{@const isSelected = selectedSet.has(item.id)}
|
|
35
|
+
|
|
36
|
+
<div class={styles.item()}>
|
|
37
|
+
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
38
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
39
|
+
<div
|
|
40
|
+
class={twMerge(
|
|
41
|
+
styles.itemRow(),
|
|
42
|
+
isSelected && styles.itemRowActive(),
|
|
43
|
+
item.disabled && styles.itemRowDisabled()
|
|
44
|
+
)}
|
|
45
|
+
onclick={(e) => handleRowClick(e, item)}
|
|
46
|
+
>
|
|
47
|
+
<!-- Chevron / Spacer -->
|
|
48
|
+
<div class={styles.chevronWrapper()}>
|
|
49
|
+
{#if hasChildren}
|
|
50
|
+
<button
|
|
51
|
+
type="button"
|
|
52
|
+
class="w-full h-full flex items-center justify-center outline-none"
|
|
53
|
+
onclick={(e) => {
|
|
54
|
+
if (!expandOnRowClick) toggleExpand(e, item)
|
|
55
|
+
}}
|
|
56
|
+
tabindex="-1"
|
|
57
|
+
disabled={item.disabled}
|
|
58
|
+
>
|
|
59
|
+
<Icon
|
|
60
|
+
name="lucide:chevron-right"
|
|
61
|
+
class={twMerge(styles.chevron(), isExpanded && 'rotate-90')}
|
|
62
|
+
/>
|
|
63
|
+
</button>
|
|
64
|
+
{/if}
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
<!-- Icon -->
|
|
68
|
+
{#if item.icon}
|
|
69
|
+
<Icon name={item.icon} class={styles.icon()} />
|
|
70
|
+
{/if}
|
|
71
|
+
|
|
72
|
+
<!-- Label -->
|
|
73
|
+
<div class={styles.label()}>
|
|
74
|
+
{#if labelSnippet}
|
|
75
|
+
{@render labelSnippet(item)}
|
|
76
|
+
{:else}
|
|
77
|
+
{item.label}
|
|
78
|
+
{/if}
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
<!-- Children -->
|
|
83
|
+
{#if hasChildren && isExpanded}
|
|
84
|
+
<div class={styles.childrenWrapper()}>
|
|
85
|
+
{@render renderTree(item.children!)}
|
|
86
|
+
</div>
|
|
87
|
+
{/if}
|
|
88
|
+
</div>
|
|
89
|
+
{/each}
|
|
90
|
+
</div>
|
|
91
|
+
{/snippet}
|
|
92
|
+
|
|
93
|
+
<div class={className} {...restProps}>
|
|
94
|
+
{@render renderTree(items)}
|
|
95
|
+
</div>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import type { TreeViewVariantProps } from './tree-view.variants.js';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
export interface TreeItem {
|
|
5
|
+
/**
|
|
6
|
+
* Unique identifier for the item.
|
|
7
|
+
*/
|
|
8
|
+
id: string | number;
|
|
9
|
+
/**
|
|
10
|
+
* Text label to display.
|
|
11
|
+
*/
|
|
12
|
+
label: string;
|
|
13
|
+
/**
|
|
14
|
+
* Optional icon name.
|
|
15
|
+
*/
|
|
16
|
+
icon?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Whether the item is disabled.
|
|
19
|
+
*/
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Child items (for nested trees).
|
|
23
|
+
*/
|
|
24
|
+
children?: TreeItem[];
|
|
25
|
+
/**
|
|
26
|
+
* Any other custom data you want to attach.
|
|
27
|
+
*/
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
}
|
|
30
|
+
export interface TreeViewProps extends HTMLAttributes<HTMLDivElement> {
|
|
31
|
+
/**
|
|
32
|
+
* Array of tree items to display.
|
|
33
|
+
*/
|
|
34
|
+
items: TreeItem[];
|
|
35
|
+
/**
|
|
36
|
+
* Currently selected item IDs.
|
|
37
|
+
*/
|
|
38
|
+
selectedIds?: (string | number)[];
|
|
39
|
+
/**
|
|
40
|
+
* Currently expanded item IDs.
|
|
41
|
+
*/
|
|
42
|
+
expandedIds?: (string | number)[];
|
|
43
|
+
/**
|
|
44
|
+
* Component size.
|
|
45
|
+
*/
|
|
46
|
+
size?: TreeViewVariantProps['size'];
|
|
47
|
+
/**
|
|
48
|
+
* Whether clicking the row expands the item, or only clicking the chevron expands it.
|
|
49
|
+
* @default true
|
|
50
|
+
*/
|
|
51
|
+
expandOnRowClick?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Additional CSS classes.
|
|
54
|
+
*/
|
|
55
|
+
class?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Event fired when an item is clicked.
|
|
58
|
+
*/
|
|
59
|
+
onItemClick?: (item: TreeItem) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Event fired when an item's expanded state changes.
|
|
62
|
+
*/
|
|
63
|
+
onItemExpand?: (item: TreeItem, isExpanded: boolean) => void;
|
|
64
|
+
/**
|
|
65
|
+
* Custom snippet for rendering the label part of the item.
|
|
66
|
+
*/
|
|
67
|
+
labelSnippet?: Snippet<[TreeItem]>;
|
|
68
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
2
|
+
export declare const treeViewVariants: import("tailwind-variants").TVReturnType<{
|
|
3
|
+
size: {
|
|
4
|
+
sm: {
|
|
5
|
+
itemRow: string;
|
|
6
|
+
chevron: string;
|
|
7
|
+
icon: string;
|
|
8
|
+
};
|
|
9
|
+
md: {
|
|
10
|
+
itemRow: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
}, {
|
|
14
|
+
root: string;
|
|
15
|
+
item: string;
|
|
16
|
+
itemRow: string;
|
|
17
|
+
itemRowActive: string;
|
|
18
|
+
itemRowDisabled: string;
|
|
19
|
+
chevronWrapper: string;
|
|
20
|
+
chevron: string;
|
|
21
|
+
icon: string;
|
|
22
|
+
label: string;
|
|
23
|
+
childrenWrapper: string;
|
|
24
|
+
}, undefined, {
|
|
25
|
+
size: {
|
|
26
|
+
sm: {
|
|
27
|
+
itemRow: string;
|
|
28
|
+
chevron: string;
|
|
29
|
+
icon: string;
|
|
30
|
+
};
|
|
31
|
+
md: {
|
|
32
|
+
itemRow: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
}, {
|
|
36
|
+
root: string;
|
|
37
|
+
item: string;
|
|
38
|
+
itemRow: string;
|
|
39
|
+
itemRowActive: string;
|
|
40
|
+
itemRowDisabled: string;
|
|
41
|
+
chevronWrapper: string;
|
|
42
|
+
chevron: string;
|
|
43
|
+
icon: string;
|
|
44
|
+
label: string;
|
|
45
|
+
childrenWrapper: string;
|
|
46
|
+
}, import("tailwind-variants").TVReturnTypeLike<{
|
|
47
|
+
size: {
|
|
48
|
+
sm: {
|
|
49
|
+
itemRow: string;
|
|
50
|
+
chevron: string;
|
|
51
|
+
icon: string;
|
|
52
|
+
};
|
|
53
|
+
md: {
|
|
54
|
+
itemRow: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
}, {
|
|
58
|
+
root: string;
|
|
59
|
+
item: string;
|
|
60
|
+
itemRow: string;
|
|
61
|
+
itemRowActive: string;
|
|
62
|
+
itemRowDisabled: string;
|
|
63
|
+
chevronWrapper: string;
|
|
64
|
+
chevron: string;
|
|
65
|
+
icon: string;
|
|
66
|
+
label: string;
|
|
67
|
+
childrenWrapper: string;
|
|
68
|
+
}>>;
|
|
69
|
+
export type TreeViewVariantProps = VariantProps<typeof treeViewVariants>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
export const treeViewVariants = tv({
|
|
3
|
+
slots: {
|
|
4
|
+
root: 'flex flex-col text-sm',
|
|
5
|
+
item: 'flex flex-col',
|
|
6
|
+
itemRow: 'flex items-center gap-1.5 py-1.5 px-2 rounded-md hover:bg-surface-100 dark:hover:bg-surface-800 cursor-pointer select-none transition-colors text-surface-900 dark:text-surface-50',
|
|
7
|
+
itemRowActive: 'bg-primary-50 dark:bg-primary-900/30 text-primary-900 dark:text-primary-100',
|
|
8
|
+
itemRowDisabled: 'opacity-50 cursor-not-allowed hover:bg-transparent dark:hover:bg-transparent',
|
|
9
|
+
chevronWrapper: 'flex items-center justify-center w-5 h-5 shrink-0 rounded hover:bg-surface-200 dark:hover:bg-surface-700 transition-colors',
|
|
10
|
+
chevron: 'w-4 h-4 transition-transform duration-200',
|
|
11
|
+
icon: 'w-4 h-4 shrink-0 text-surface-500 dark:text-surface-400',
|
|
12
|
+
label: 'truncate flex-1',
|
|
13
|
+
childrenWrapper: 'flex flex-col pl-4 ml-2.5 border-l border-outline-variant/50 mt-1'
|
|
14
|
+
},
|
|
15
|
+
variants: {
|
|
16
|
+
size: {
|
|
17
|
+
sm: {
|
|
18
|
+
itemRow: 'py-1 text-xs',
|
|
19
|
+
chevron: 'w-3 h-3',
|
|
20
|
+
icon: 'w-3 h-3'
|
|
21
|
+
},
|
|
22
|
+
md: {
|
|
23
|
+
itemRow: 'py-1.5 text-sm'
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
defaultVariants: {
|
|
28
|
+
size: 'md'
|
|
29
|
+
}
|
|
30
|
+
});
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { FontsConfig } from './components/Fonts/fonts.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* SV5UI Plus Global Configuration
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { defineSV5UIPlusConfig } from 'sv5ui-plus'
|
|
8
|
+
*
|
|
9
|
+
* defineSV5UIPlusConfig({
|
|
10
|
+
* fonts: {
|
|
11
|
+
* families: [
|
|
12
|
+
* {
|
|
13
|
+
* name: 'Inter',
|
|
14
|
+
* variable: '--font-sans-family',
|
|
15
|
+
* weights: [400, 500, 600, 700]
|
|
16
|
+
* }
|
|
17
|
+
* ]
|
|
18
|
+
* },
|
|
19
|
+
* button: {
|
|
20
|
+
* defaultVariants: { variant: 'outline', color: 'secondary' },
|
|
21
|
+
* slots: { base: 'shadow-md', label: 'font-bold' }
|
|
22
|
+
* },
|
|
23
|
+
* avatar: {
|
|
24
|
+
* defaultVariants: { size: 'lg' },
|
|
25
|
+
* slots: { root: 'ring-2 ring-primary' }
|
|
26
|
+
* },
|
|
27
|
+
* icons: { loading: 'svg-spinners:ring-resize' }
|
|
28
|
+
* })
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* Default icons used across components
|
|
33
|
+
*/
|
|
34
|
+
export declare const iconsDefaults: {
|
|
35
|
+
loading: string;
|
|
36
|
+
chevronDown: string;
|
|
37
|
+
chevronLeft: string;
|
|
38
|
+
chevronRight: string;
|
|
39
|
+
chevronsLeft: string;
|
|
40
|
+
chevronsRight: string;
|
|
41
|
+
ellipsis: string;
|
|
42
|
+
close: string;
|
|
43
|
+
menu: string;
|
|
44
|
+
external: string;
|
|
45
|
+
check: string;
|
|
46
|
+
light: string;
|
|
47
|
+
dark: string;
|
|
48
|
+
upload: string;
|
|
49
|
+
file: string;
|
|
50
|
+
zoomIn: string;
|
|
51
|
+
trash: string;
|
|
52
|
+
search: string;
|
|
53
|
+
star: string;
|
|
54
|
+
folder: string;
|
|
55
|
+
folderOpen: string;
|
|
56
|
+
sortAsc: string;
|
|
57
|
+
sortDesc: string;
|
|
58
|
+
sortDefault: string;
|
|
59
|
+
panelLeft: string;
|
|
60
|
+
dragHandle: string;
|
|
61
|
+
};
|
|
62
|
+
/** Deep partial type for config objects */
|
|
63
|
+
type DeepPartial<T> = {
|
|
64
|
+
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
65
|
+
};
|
|
66
|
+
/** Generic component config shape */
|
|
67
|
+
export type UIConfig = {
|
|
68
|
+
[key: string]: DeepPartial<Record<string, unknown>> | FontsConfig | undefined;
|
|
69
|
+
icons?: DeepPartial<typeof iconsDefaults>;
|
|
70
|
+
fonts?: FontsConfig;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Define global configuration for SV5UI Plus components
|
|
74
|
+
*/
|
|
75
|
+
export declare function defineConfig(config: UIConfig): void;
|
|
76
|
+
/**
|
|
77
|
+
* Get the current global configuration
|
|
78
|
+
*/
|
|
79
|
+
export declare function getConfig(): UIConfig;
|
|
80
|
+
/**
|
|
81
|
+
* Reset configuration to defaults
|
|
82
|
+
*/
|
|
83
|
+
export declare function resetConfig(): void;
|
|
84
|
+
/**
|
|
85
|
+
* Get merged config for a component (memoized).
|
|
86
|
+
* Each component passes its own defaults, so config.ts doesn't import any variant files.
|
|
87
|
+
* This enables proper tree-shaking: unused components are excluded from the bundle.
|
|
88
|
+
* @internal
|
|
89
|
+
*/
|
|
90
|
+
export declare function getComponentConfig<T extends Record<string, unknown>>(component: string, defaults: T): T;
|
|
91
|
+
export {};
|