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 @@
|
|
|
1
|
+
export { default as LocaleButton } from './LocaleButton.svelte';
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import type { DropdownMenuContentPropsWithoutHTML, DropdownMenuRootPropsWithoutHTML } from 'bits-ui';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
5
|
+
import type { ButtonProps } from 'sv5ui';
|
|
6
|
+
import type { LocaleButtonSlots } from './locale-button.variants.js';
|
|
7
|
+
export type LocaleButtonLocale = {
|
|
8
|
+
/**
|
|
9
|
+
* Locale code used by your i18n layer, for example `en` or `th`.
|
|
10
|
+
*/
|
|
11
|
+
code: string;
|
|
12
|
+
/**
|
|
13
|
+
* Full label rendered in the dropdown menu.
|
|
14
|
+
*/
|
|
15
|
+
label: string;
|
|
16
|
+
/**
|
|
17
|
+
* Optional short label for the trigger, such as `EN` or `TH`.
|
|
18
|
+
*/
|
|
19
|
+
shortLabel?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Optional helper text shown below the label.
|
|
22
|
+
*/
|
|
23
|
+
description?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Optional static href for this locale.
|
|
26
|
+
*/
|
|
27
|
+
href?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Optional language tag forwarded to anchor items.
|
|
30
|
+
*/
|
|
31
|
+
hreflang?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Optional leading icon for the locale item.
|
|
34
|
+
*/
|
|
35
|
+
icon?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Disables this locale in the dropdown.
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Additional CSS classes for the locale item.
|
|
43
|
+
*/
|
|
44
|
+
class?: ClassNameValue;
|
|
45
|
+
};
|
|
46
|
+
type RootProps = Pick<DropdownMenuRootPropsWithoutHTML, 'open' | 'onOpenChange'>;
|
|
47
|
+
type ContentProps = Pick<DropdownMenuContentPropsWithoutHTML, 'side' | 'sideOffset' | 'align' | 'alignOffset' | 'avoidCollisions' | 'collisionBoundary' | 'collisionPadding' | 'sticky' | 'hideWhenDetached' | 'onEscapeKeydown' | 'onInteractOutside' | 'onCloseAutoFocus' | 'forceMount' | 'loop'>;
|
|
48
|
+
export type LocaleButtonProps = Omit<HTMLAttributes<HTMLElement>, 'children' | 'class' | 'color'> & RootProps & ContentProps & {
|
|
49
|
+
/**
|
|
50
|
+
* Bind a reference to the underlying trigger HTMLButtonElement.
|
|
51
|
+
*/
|
|
52
|
+
ref?: HTMLButtonElement | null;
|
|
53
|
+
/**
|
|
54
|
+
* Available locales shown in the menu.
|
|
55
|
+
*/
|
|
56
|
+
locales: LocaleButtonLocale[];
|
|
57
|
+
/**
|
|
58
|
+
* Current active locale code.
|
|
59
|
+
*/
|
|
60
|
+
locale?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Controls the visual style of the trigger button.
|
|
63
|
+
* @default 'outline'
|
|
64
|
+
*/
|
|
65
|
+
variant?: NonNullable<ButtonProps['variant']>;
|
|
66
|
+
/**
|
|
67
|
+
* Sets the color scheme of the trigger button.
|
|
68
|
+
* @default 'surface'
|
|
69
|
+
*/
|
|
70
|
+
color?: NonNullable<ButtonProps['color']>;
|
|
71
|
+
/**
|
|
72
|
+
* Controls the trigger button size.
|
|
73
|
+
* @default 'md'
|
|
74
|
+
*/
|
|
75
|
+
size?: NonNullable<ButtonProps['size']>;
|
|
76
|
+
/**
|
|
77
|
+
* Shrinks the dropdown menu width to fit its content (`w-fit min-w-0`).
|
|
78
|
+
* @default false
|
|
79
|
+
*/
|
|
80
|
+
fit?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Renders a loading spinner and disables interaction.
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
85
|
+
loading?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Disables the trigger and all locale actions.
|
|
88
|
+
* @default false
|
|
89
|
+
*/
|
|
90
|
+
disabled?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Stretches the trigger to fill the available width.
|
|
93
|
+
* @default false
|
|
94
|
+
*/
|
|
95
|
+
block?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Forces equal width and height for the trigger button.
|
|
98
|
+
* @default false
|
|
99
|
+
*/
|
|
100
|
+
square?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Fallback text shown when no current locale is matched.
|
|
103
|
+
* @default 'Select language'
|
|
104
|
+
*/
|
|
105
|
+
placeholder?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Accessible label for the trigger button.
|
|
108
|
+
* @default 'Change language'
|
|
109
|
+
*/
|
|
110
|
+
ariaLabel?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Optional heading rendered above the locale list.
|
|
113
|
+
* @default 'Language'
|
|
114
|
+
*/
|
|
115
|
+
menuLabel?: string;
|
|
116
|
+
/**
|
|
117
|
+
* Leading icon displayed in the trigger.
|
|
118
|
+
* @default 'lucide:languages'
|
|
119
|
+
*/
|
|
120
|
+
icon?: string;
|
|
121
|
+
/**
|
|
122
|
+
* Trailing chevron icon displayed in the trigger.
|
|
123
|
+
* @default Uses `icons.chevronDown` from app config
|
|
124
|
+
*/
|
|
125
|
+
chevronIcon?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Whether to render the leading trigger icon.
|
|
128
|
+
* @default true
|
|
129
|
+
*/
|
|
130
|
+
showIcon?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Whether to render the trailing chevron icon.
|
|
133
|
+
* @default true
|
|
134
|
+
*/
|
|
135
|
+
showChevron?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Whether to render the locale code badge inside the menu.
|
|
138
|
+
* @default true
|
|
139
|
+
*/
|
|
140
|
+
showCode?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Whether to render the selected locale check icon.
|
|
143
|
+
* @default true
|
|
144
|
+
*/
|
|
145
|
+
showIndicator?: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Disables the currently active locale item.
|
|
148
|
+
* @default true
|
|
149
|
+
*/
|
|
150
|
+
disableCurrentLocale?: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Closes the menu after selecting a locale without href navigation.
|
|
153
|
+
* @default true
|
|
154
|
+
*/
|
|
155
|
+
closeOnSelect?: boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Resolves a locale-specific href, useful for Paraglide URL strategies.
|
|
158
|
+
*/
|
|
159
|
+
getLocaleHref?: (locale: string, item: LocaleButtonLocale) => string | undefined;
|
|
160
|
+
/**
|
|
161
|
+
* Called when a locale is selected.
|
|
162
|
+
* Use this for integrations like `setLocale(...)`.
|
|
163
|
+
*/
|
|
164
|
+
onLocaleChange?: (locale: string, item: LocaleButtonLocale) => void | Promise<void>;
|
|
165
|
+
/**
|
|
166
|
+
* Render custom trigger content.
|
|
167
|
+
*/
|
|
168
|
+
children?: Snippet<[{
|
|
169
|
+
open: boolean;
|
|
170
|
+
currentLocale: LocaleButtonLocale | undefined;
|
|
171
|
+
}]>;
|
|
172
|
+
/**
|
|
173
|
+
* Render custom content for each locale item in the menu.
|
|
174
|
+
*/
|
|
175
|
+
item?: Snippet<[
|
|
176
|
+
{
|
|
177
|
+
item: LocaleButtonLocale;
|
|
178
|
+
current: boolean;
|
|
179
|
+
disabled: boolean;
|
|
180
|
+
close: () => void;
|
|
181
|
+
}
|
|
182
|
+
]>;
|
|
183
|
+
/**
|
|
184
|
+
* Render a custom menu layout entirely.
|
|
185
|
+
*/
|
|
186
|
+
menu?: Snippet<[{
|
|
187
|
+
close: () => void;
|
|
188
|
+
}]>;
|
|
189
|
+
/**
|
|
190
|
+
* Whether to render the menu in a portal.
|
|
191
|
+
* @default true
|
|
192
|
+
*/
|
|
193
|
+
portal?: boolean;
|
|
194
|
+
/**
|
|
195
|
+
* Display an arrow alongside the dropdown.
|
|
196
|
+
* @default false
|
|
197
|
+
*/
|
|
198
|
+
arrow?: boolean;
|
|
199
|
+
/**
|
|
200
|
+
* Additional CSS classes for the trigger element.
|
|
201
|
+
*/
|
|
202
|
+
class?: ClassNameValue;
|
|
203
|
+
/**
|
|
204
|
+
* Override classes for LocaleButton slots.
|
|
205
|
+
*/
|
|
206
|
+
ui?: Partial<Record<LocaleButtonSlots, ClassNameValue>>;
|
|
207
|
+
};
|
|
208
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
2
|
+
import type { ButtonProps } from 'sv5ui';
|
|
3
|
+
export declare const localeButtonVariants: import("tailwind-variants").TVReturnType<{
|
|
4
|
+
fit: {
|
|
5
|
+
true: {
|
|
6
|
+
menu: string;
|
|
7
|
+
};
|
|
8
|
+
false: {
|
|
9
|
+
menu: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
size: {
|
|
13
|
+
xs: {
|
|
14
|
+
triggerIcon: string;
|
|
15
|
+
triggerChevron: string;
|
|
16
|
+
menuLabel: string;
|
|
17
|
+
item: string;
|
|
18
|
+
itemLabel: string;
|
|
19
|
+
itemDescription: string;
|
|
20
|
+
itemCode: string;
|
|
21
|
+
itemIndicator: string;
|
|
22
|
+
};
|
|
23
|
+
sm: {
|
|
24
|
+
triggerIcon: string;
|
|
25
|
+
triggerChevron: string;
|
|
26
|
+
menuLabel: string;
|
|
27
|
+
item: string;
|
|
28
|
+
itemLabel: string;
|
|
29
|
+
itemDescription: string;
|
|
30
|
+
itemCode: string;
|
|
31
|
+
itemIndicator: string;
|
|
32
|
+
};
|
|
33
|
+
md: {
|
|
34
|
+
triggerIcon: string;
|
|
35
|
+
triggerChevron: string;
|
|
36
|
+
menuLabel: string;
|
|
37
|
+
item: string;
|
|
38
|
+
itemLabel: string;
|
|
39
|
+
itemDescription: string;
|
|
40
|
+
itemCode: string;
|
|
41
|
+
itemIndicator: string;
|
|
42
|
+
};
|
|
43
|
+
lg: {
|
|
44
|
+
triggerIcon: string;
|
|
45
|
+
triggerChevron: string;
|
|
46
|
+
menuLabel: string;
|
|
47
|
+
item: string;
|
|
48
|
+
itemLabel: string;
|
|
49
|
+
itemDescription: string;
|
|
50
|
+
itemCode: string;
|
|
51
|
+
itemIndicator: string;
|
|
52
|
+
};
|
|
53
|
+
xl: {
|
|
54
|
+
triggerIcon: string;
|
|
55
|
+
triggerChevron: string;
|
|
56
|
+
menuLabel: string;
|
|
57
|
+
item: string;
|
|
58
|
+
itemLabel: string;
|
|
59
|
+
itemDescription: string;
|
|
60
|
+
itemCode: string;
|
|
61
|
+
itemIndicator: string;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
}, {
|
|
65
|
+
base: string;
|
|
66
|
+
triggerLabel: string;
|
|
67
|
+
triggerIcon: string;
|
|
68
|
+
triggerChevron: string;
|
|
69
|
+
menu: string;
|
|
70
|
+
menuLabel: string;
|
|
71
|
+
item: string[];
|
|
72
|
+
itemIdle: string;
|
|
73
|
+
itemCurrent: string;
|
|
74
|
+
itemLeading: string;
|
|
75
|
+
itemText: string;
|
|
76
|
+
itemLabel: string;
|
|
77
|
+
itemDescription: string;
|
|
78
|
+
itemCode: string;
|
|
79
|
+
itemIndicator: string;
|
|
80
|
+
}, undefined, {
|
|
81
|
+
fit: {
|
|
82
|
+
true: {
|
|
83
|
+
menu: string;
|
|
84
|
+
};
|
|
85
|
+
false: {
|
|
86
|
+
menu: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
size: {
|
|
90
|
+
xs: {
|
|
91
|
+
triggerIcon: string;
|
|
92
|
+
triggerChevron: string;
|
|
93
|
+
menuLabel: string;
|
|
94
|
+
item: string;
|
|
95
|
+
itemLabel: string;
|
|
96
|
+
itemDescription: string;
|
|
97
|
+
itemCode: string;
|
|
98
|
+
itemIndicator: string;
|
|
99
|
+
};
|
|
100
|
+
sm: {
|
|
101
|
+
triggerIcon: string;
|
|
102
|
+
triggerChevron: string;
|
|
103
|
+
menuLabel: string;
|
|
104
|
+
item: string;
|
|
105
|
+
itemLabel: string;
|
|
106
|
+
itemDescription: string;
|
|
107
|
+
itemCode: string;
|
|
108
|
+
itemIndicator: string;
|
|
109
|
+
};
|
|
110
|
+
md: {
|
|
111
|
+
triggerIcon: string;
|
|
112
|
+
triggerChevron: string;
|
|
113
|
+
menuLabel: string;
|
|
114
|
+
item: string;
|
|
115
|
+
itemLabel: string;
|
|
116
|
+
itemDescription: string;
|
|
117
|
+
itemCode: string;
|
|
118
|
+
itemIndicator: string;
|
|
119
|
+
};
|
|
120
|
+
lg: {
|
|
121
|
+
triggerIcon: string;
|
|
122
|
+
triggerChevron: string;
|
|
123
|
+
menuLabel: string;
|
|
124
|
+
item: string;
|
|
125
|
+
itemLabel: string;
|
|
126
|
+
itemDescription: string;
|
|
127
|
+
itemCode: string;
|
|
128
|
+
itemIndicator: string;
|
|
129
|
+
};
|
|
130
|
+
xl: {
|
|
131
|
+
triggerIcon: string;
|
|
132
|
+
triggerChevron: string;
|
|
133
|
+
menuLabel: string;
|
|
134
|
+
item: string;
|
|
135
|
+
itemLabel: string;
|
|
136
|
+
itemDescription: string;
|
|
137
|
+
itemCode: string;
|
|
138
|
+
itemIndicator: string;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
}, {
|
|
142
|
+
base: string;
|
|
143
|
+
triggerLabel: string;
|
|
144
|
+
triggerIcon: string;
|
|
145
|
+
triggerChevron: string;
|
|
146
|
+
menu: string;
|
|
147
|
+
menuLabel: string;
|
|
148
|
+
item: string[];
|
|
149
|
+
itemIdle: string;
|
|
150
|
+
itemCurrent: string;
|
|
151
|
+
itemLeading: string;
|
|
152
|
+
itemText: string;
|
|
153
|
+
itemLabel: string;
|
|
154
|
+
itemDescription: string;
|
|
155
|
+
itemCode: string;
|
|
156
|
+
itemIndicator: string;
|
|
157
|
+
}, import("tailwind-variants").TVReturnTypeLike<{
|
|
158
|
+
fit: {
|
|
159
|
+
true: {
|
|
160
|
+
menu: string;
|
|
161
|
+
};
|
|
162
|
+
false: {
|
|
163
|
+
menu: string;
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
size: {
|
|
167
|
+
xs: {
|
|
168
|
+
triggerIcon: string;
|
|
169
|
+
triggerChevron: string;
|
|
170
|
+
menuLabel: string;
|
|
171
|
+
item: string;
|
|
172
|
+
itemLabel: string;
|
|
173
|
+
itemDescription: string;
|
|
174
|
+
itemCode: string;
|
|
175
|
+
itemIndicator: string;
|
|
176
|
+
};
|
|
177
|
+
sm: {
|
|
178
|
+
triggerIcon: string;
|
|
179
|
+
triggerChevron: string;
|
|
180
|
+
menuLabel: string;
|
|
181
|
+
item: string;
|
|
182
|
+
itemLabel: string;
|
|
183
|
+
itemDescription: string;
|
|
184
|
+
itemCode: string;
|
|
185
|
+
itemIndicator: string;
|
|
186
|
+
};
|
|
187
|
+
md: {
|
|
188
|
+
triggerIcon: string;
|
|
189
|
+
triggerChevron: string;
|
|
190
|
+
menuLabel: string;
|
|
191
|
+
item: string;
|
|
192
|
+
itemLabel: string;
|
|
193
|
+
itemDescription: string;
|
|
194
|
+
itemCode: string;
|
|
195
|
+
itemIndicator: string;
|
|
196
|
+
};
|
|
197
|
+
lg: {
|
|
198
|
+
triggerIcon: string;
|
|
199
|
+
triggerChevron: string;
|
|
200
|
+
menuLabel: string;
|
|
201
|
+
item: string;
|
|
202
|
+
itemLabel: string;
|
|
203
|
+
itemDescription: string;
|
|
204
|
+
itemCode: string;
|
|
205
|
+
itemIndicator: string;
|
|
206
|
+
};
|
|
207
|
+
xl: {
|
|
208
|
+
triggerIcon: string;
|
|
209
|
+
triggerChevron: string;
|
|
210
|
+
menuLabel: string;
|
|
211
|
+
item: string;
|
|
212
|
+
itemLabel: string;
|
|
213
|
+
itemDescription: string;
|
|
214
|
+
itemCode: string;
|
|
215
|
+
itemIndicator: string;
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
}, {
|
|
219
|
+
base: string;
|
|
220
|
+
triggerLabel: string;
|
|
221
|
+
triggerIcon: string;
|
|
222
|
+
triggerChevron: string;
|
|
223
|
+
menu: string;
|
|
224
|
+
menuLabel: string;
|
|
225
|
+
item: string[];
|
|
226
|
+
itemIdle: string;
|
|
227
|
+
itemCurrent: string;
|
|
228
|
+
itemLeading: string;
|
|
229
|
+
itemText: string;
|
|
230
|
+
itemLabel: string;
|
|
231
|
+
itemDescription: string;
|
|
232
|
+
itemCode: string;
|
|
233
|
+
itemIndicator: string;
|
|
234
|
+
}>>;
|
|
235
|
+
export type LocaleButtonVariantProps = VariantProps<typeof localeButtonVariants>;
|
|
236
|
+
export type LocaleButtonSlots = keyof ReturnType<typeof localeButtonVariants>;
|
|
237
|
+
export declare const localeButtonDefaults: {
|
|
238
|
+
defaultVariants: {
|
|
239
|
+
color: NonNullable<ButtonProps["color"]>;
|
|
240
|
+
variant: NonNullable<ButtonProps["variant"]>;
|
|
241
|
+
size: NonNullable<ButtonProps["size"]>;
|
|
242
|
+
fit?: boolean | undefined;
|
|
243
|
+
};
|
|
244
|
+
slots: Partial<Record<LocaleButtonSlots, string>>;
|
|
245
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
export const localeButtonVariants = tv({
|
|
3
|
+
slots: {
|
|
4
|
+
base: '',
|
|
5
|
+
triggerLabel: 'truncate',
|
|
6
|
+
triggerIcon: 'shrink-0',
|
|
7
|
+
triggerChevron: 'shrink-0 opacity-70',
|
|
8
|
+
menu: 'space-y-1 rounded-xl p-1',
|
|
9
|
+
menuLabel: 'font-semibold tracking-[0.14em] text-on-surface-variant uppercase',
|
|
10
|
+
item: [
|
|
11
|
+
'flex w-full items-center justify-between text-left transition-colors',
|
|
12
|
+
'focus-visible:ring-primary/40 focus-visible:outline-none focus-visible:ring-2'
|
|
13
|
+
],
|
|
14
|
+
itemIdle: 'text-on-surface hover:bg-surface-container-high',
|
|
15
|
+
itemCurrent: 'bg-primary/10 text-primary',
|
|
16
|
+
itemLeading: 'flex min-w-0 items-start gap-2',
|
|
17
|
+
itemText: 'min-w-0 space-y-0.5',
|
|
18
|
+
itemLabel: 'truncate font-medium',
|
|
19
|
+
itemDescription: 'text-on-surface-variant',
|
|
20
|
+
itemCode: 'shrink-0 rounded-md bg-surface-container font-medium text-on-surface-variant uppercase',
|
|
21
|
+
itemIndicator: 'shrink-0 text-primary'
|
|
22
|
+
},
|
|
23
|
+
variants: {
|
|
24
|
+
fit: {
|
|
25
|
+
true: {
|
|
26
|
+
menu: 'w-fit min-w-0'
|
|
27
|
+
},
|
|
28
|
+
false: {
|
|
29
|
+
menu: 'min-w-52'
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
size: {
|
|
33
|
+
xs: {
|
|
34
|
+
triggerIcon: 'size-3.5',
|
|
35
|
+
triggerChevron: 'size-3.5',
|
|
36
|
+
menuLabel: 'px-2 pt-1.5 pb-0.5 text-[10px]',
|
|
37
|
+
item: 'px-2 py-1 text-xs gap-1.5 rounded-md',
|
|
38
|
+
itemLabel: 'text-xs',
|
|
39
|
+
itemDescription: 'text-[10px]',
|
|
40
|
+
itemCode: 'px-1 py-0.5 text-[9px]',
|
|
41
|
+
itemIndicator: 'size-3'
|
|
42
|
+
},
|
|
43
|
+
sm: {
|
|
44
|
+
triggerIcon: 'size-4',
|
|
45
|
+
triggerChevron: 'size-4',
|
|
46
|
+
menuLabel: 'px-2.5 pt-2 pb-0.5 text-[11px]',
|
|
47
|
+
item: 'px-2.5 py-1.5 text-xs gap-2 rounded-md',
|
|
48
|
+
itemLabel: 'text-xs',
|
|
49
|
+
itemDescription: 'text-[11px]',
|
|
50
|
+
itemCode: 'px-1 py-0.5 text-[10px]',
|
|
51
|
+
itemIndicator: 'size-3.5'
|
|
52
|
+
},
|
|
53
|
+
md: {
|
|
54
|
+
triggerIcon: 'size-5',
|
|
55
|
+
triggerChevron: 'size-5',
|
|
56
|
+
menuLabel: 'px-3 pt-2 pb-1 text-xs',
|
|
57
|
+
item: 'px-3 py-2 text-sm gap-3 rounded-lg',
|
|
58
|
+
itemLabel: 'text-sm',
|
|
59
|
+
itemDescription: 'text-xs',
|
|
60
|
+
itemCode: 'px-1.5 py-0.5 text-[11px]',
|
|
61
|
+
itemIndicator: 'size-4'
|
|
62
|
+
},
|
|
63
|
+
lg: {
|
|
64
|
+
triggerIcon: 'size-5',
|
|
65
|
+
triggerChevron: 'size-5',
|
|
66
|
+
menuLabel: 'px-3.5 pt-2.5 pb-1 text-sm',
|
|
67
|
+
item: 'px-3.5 py-2.5 text-base gap-3.5 rounded-lg',
|
|
68
|
+
itemLabel: 'text-base',
|
|
69
|
+
itemDescription: 'text-xs',
|
|
70
|
+
itemCode: 'px-2 py-0.5 text-xs',
|
|
71
|
+
itemIndicator: 'size-5'
|
|
72
|
+
},
|
|
73
|
+
xl: {
|
|
74
|
+
triggerIcon: 'size-6',
|
|
75
|
+
triggerChevron: 'size-6',
|
|
76
|
+
menuLabel: 'px-4 pt-3 pb-1 text-sm',
|
|
77
|
+
item: 'px-4 py-3 text-lg gap-4 rounded-xl',
|
|
78
|
+
itemLabel: 'text-lg',
|
|
79
|
+
itemDescription: 'text-sm',
|
|
80
|
+
itemCode: 'px-2 py-1 text-sm',
|
|
81
|
+
itemIndicator: 'size-6'
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
defaultVariants: {
|
|
86
|
+
fit: false,
|
|
87
|
+
size: 'md'
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
export const localeButtonDefaults = {
|
|
91
|
+
defaultVariants: {
|
|
92
|
+
...localeButtonVariants.defaultVariants,
|
|
93
|
+
color: 'surface',
|
|
94
|
+
variant: 'outline',
|
|
95
|
+
size: 'md'
|
|
96
|
+
},
|
|
97
|
+
slots: {}
|
|
98
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script lang="ts">import { twMerge } from "tailwind-merge";
|
|
2
|
+
import { marqueeVariants } from "./marquee.variants.js";
|
|
3
|
+
let { direction = "left", pauseOnHover = false, duration = "40s", gap = "1rem", repeat = 2, class: className, children, ...restProps } = $props();
|
|
4
|
+
let styles = $derived(marqueeVariants({
|
|
5
|
+
direction,
|
|
6
|
+
pauseOnHover
|
|
7
|
+
}));
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<div
|
|
11
|
+
class={twMerge(styles.root() as string, className)}
|
|
12
|
+
style:--gap={gap}
|
|
13
|
+
style:--duration={duration}
|
|
14
|
+
{...restProps}
|
|
15
|
+
>
|
|
16
|
+
{#each Array(Math.max(2, repeat)) as _}
|
|
17
|
+
<div class={styles.content() as string}>
|
|
18
|
+
{@render children?.()}
|
|
19
|
+
</div>
|
|
20
|
+
{/each}
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<style>
|
|
24
|
+
/* Injected keyframes for marquee animation since it might not be in tailwind config */
|
|
25
|
+
:global(.animate-marquee) {
|
|
26
|
+
animation: marquee var(--duration) linear infinite;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
:global(.animate-marquee-vertical) {
|
|
30
|
+
animation: marquee-vertical var(--duration) linear infinite;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@keyframes marquee {
|
|
34
|
+
0% {
|
|
35
|
+
transform: translateX(0);
|
|
36
|
+
}
|
|
37
|
+
100% {
|
|
38
|
+
transform: translateX(calc(-100% - var(--gap)));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@keyframes marquee-vertical {
|
|
43
|
+
0% {
|
|
44
|
+
transform: translateY(0);
|
|
45
|
+
}
|
|
46
|
+
100% {
|
|
47
|
+
transform: translateY(calc(-100% - var(--gap)));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
</style>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import type { MarqueeVariantProps } from './marquee.variants.js';
|
|
4
|
+
export interface MarqueeProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/**
|
|
6
|
+
* Direction of the marquee animation.
|
|
7
|
+
* @default 'left'
|
|
8
|
+
*/
|
|
9
|
+
direction?: MarqueeVariantProps['direction'];
|
|
10
|
+
/**
|
|
11
|
+
* Whether to pause the animation when hovered.
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
pauseOnHover?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Duration of the animation loop (e.g. '20s', '40s').
|
|
17
|
+
* @default '40s'
|
|
18
|
+
*/
|
|
19
|
+
duration?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Gap between items.
|
|
22
|
+
* @default '1rem'
|
|
23
|
+
*/
|
|
24
|
+
gap?: string;
|
|
25
|
+
/**
|
|
26
|
+
* How many times to repeat the content. To ensure smooth looping, it should be at least 2.
|
|
27
|
+
* @default 2
|
|
28
|
+
*/
|
|
29
|
+
repeat?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Additional CSS classes.
|
|
32
|
+
*/
|
|
33
|
+
class?: string;
|
|
34
|
+
/**
|
|
35
|
+
* The content to scroll.
|
|
36
|
+
*/
|
|
37
|
+
children?: Snippet;
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|