sv5ui-plus 5.0.4 → 5.0.6
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/README.md +6 -6
- package/dist/adapters/notify.d.ts +1 -1
- package/dist/adapters/notify.js +18 -18
- package/dist/compat.d.ts +2 -2
- package/dist/compat.js +2 -2
- package/dist/components/BentoGrid/BentoCard.svelte +33 -33
- package/dist/components/BentoGrid/BentoCard.svelte.d.ts +1 -1
- package/dist/components/BentoGrid/BentoGrid.svelte +1 -1
- package/dist/components/BentoGrid/BentoGrid.svelte.d.ts +1 -1
- package/dist/components/BentoGrid/bento-grid.types.d.ts +2 -2
- package/dist/components/BentoGrid/bento-grid.variants.d.ts +1 -1
- package/dist/components/BentoGrid/bento-grid.variants.js +10 -10
- package/dist/components/BentoGrid/index.d.ts +4 -4
- package/dist/components/BentoGrid/index.js +4 -4
- package/dist/components/Chart/Chart.svelte +1 -1
- package/dist/components/Chart/Chart.svelte.d.ts +1 -1
- package/dist/components/Chart/chart.types.d.ts +3 -3
- package/dist/components/Chart/index.d.ts +2 -2
- package/dist/components/Chart/index.js +2 -2
- package/dist/components/Chat/ChatBubble.svelte +19 -19
- package/dist/components/Chat/ChatBubble.svelte.d.ts +1 -1
- package/dist/components/Chat/ChatInput.svelte +26 -27
- package/dist/components/Chat/ChatInput.svelte.d.ts +1 -1
- package/dist/components/Chat/ChatMessage.svelte +1 -1
- package/dist/components/Chat/ChatMessage.svelte.d.ts +1 -1
- package/dist/components/Chat/chat.types.d.ts +6 -6
- package/dist/components/Chat/chat.variants.d.ts +1 -1
- package/dist/components/Chat/chat.variants.js +29 -29
- package/dist/components/Chat/index.d.ts +5 -5
- package/dist/components/Chat/index.js +5 -5
- package/dist/components/CodeBlock/CodeBlock.svelte +15 -15
- package/dist/components/CodeBlock/CodeBlock.svelte.d.ts +1 -1
- package/dist/components/CodeBlock/code-block.types.d.ts +5 -5
- package/dist/components/CodeBlock/code-block.variants.d.ts +1 -1
- package/dist/components/CodeBlock/code-block.variants.js +40 -40
- package/dist/components/CodeBlock/index.d.ts +2 -2
- package/dist/components/CodeBlock/index.js +1 -1
- package/dist/components/ConfirmDialog/ConfirmDialog.svelte +93 -97
- package/dist/components/ConfirmDialog/ConfirmDialog.svelte.d.ts +1 -1
- package/dist/components/ConfirmDialog/confirm.d.ts +1 -1
- package/dist/components/ConfirmDialog/confirm.js +9 -9
- package/dist/components/ConfirmDialog/confirm.types.d.ts +4 -4
- package/dist/components/ConfirmDialog/index.d.ts +4 -4
- package/dist/components/ConfirmDialog/index.js +2 -2
- package/dist/components/DatePickerField/DatePickerField.svelte +11 -11
- package/dist/components/DatePickerField/DatePickerField.svelte.d.ts +2 -2
- package/dist/components/DatePickerField/date-picker-field.types.d.ts +1 -1
- package/dist/components/DatePickerField/index.d.ts +2 -2
- package/dist/components/DatePickerField/index.js +1 -1
- package/dist/components/DateRangePickerField/DateRangePickerField.svelte +26 -26
- package/dist/components/DateRangePickerField/DateRangePickerField.svelte.d.ts +2 -2
- package/dist/components/DateRangePickerField/date-range-picker-field.types.d.ts +1 -1
- package/dist/components/DateRangePickerField/index.d.ts +2 -2
- package/dist/components/DateRangePickerField/index.js +1 -1
- package/dist/components/Fonts/Fonts.svelte +12 -12
- package/dist/components/Fonts/Fonts.svelte.d.ts +1 -1
- package/dist/components/Fonts/fonts.d.ts +1 -1
- package/dist/components/Fonts/fonts.js +42 -42
- package/dist/components/Fonts/fonts.types.d.ts +6 -6
- package/dist/components/Fonts/index.d.ts +3 -3
- package/dist/components/Fonts/index.js +2 -2
- package/dist/components/FormSelect/FormSelect.svelte +4 -4
- package/dist/components/FormSelect/FormSelect.svelte.d.ts +2 -2
- package/dist/components/FormSelect/form-select.types.d.ts +3 -3
- package/dist/components/FormSelect/index.d.ts +2 -2
- package/dist/components/FormSelect/index.js +1 -1
- package/dist/components/List/List.svelte +1 -1
- package/dist/components/List/List.svelte.d.ts +1 -1
- package/dist/components/List/ListItem.svelte +31 -39
- package/dist/components/List/ListItem.svelte.d.ts +1 -1
- package/dist/components/List/index.d.ts +4 -4
- package/dist/components/List/index.js +4 -4
- package/dist/components/List/list.types.d.ts +4 -4
- package/dist/components/List/list.variants.d.ts +1 -1
- package/dist/components/List/list.variants.js +22 -22
- package/dist/components/LocaleButton/LocaleButton.svelte +104 -108
- package/dist/components/LocaleButton/LocaleButton.svelte.d.ts +1 -1
- package/dist/components/LocaleButton/index.d.ts +2 -2
- package/dist/components/LocaleButton/index.js +1 -1
- package/dist/components/LocaleButton/locale-button.types.d.ts +12 -12
- package/dist/components/LocaleButton/locale-button.variants.d.ts +2 -2
- package/dist/components/LocaleButton/locale-button.variants.js +68 -68
- package/dist/components/Marquee/Marquee.svelte +34 -34
- package/dist/components/Marquee/Marquee.svelte.d.ts +1 -1
- package/dist/components/Marquee/index.d.ts +3 -3
- package/dist/components/Marquee/index.js +3 -3
- package/dist/components/Marquee/marquee.types.d.ts +4 -4
- package/dist/components/Marquee/marquee.variants.d.ts +1 -1
- package/dist/components/Marquee/marquee.variants.js +15 -15
- package/dist/components/NavigationMenu/NavigationMenu.svelte +366 -379
- package/dist/components/NavigationMenu/NavigationMenu.svelte.d.ts +1 -1
- package/dist/components/NavigationMenu/index.d.ts +2 -2
- package/dist/components/NavigationMenu/index.js +1 -1
- package/dist/components/NavigationMenu/navigation-menu.types.d.ts +17 -17
- package/dist/components/NavigationMenu/navigation-menu.variants.d.ts +1 -1
- package/dist/components/NavigationMenu/navigation-menu.variants.js +177 -177
- package/dist/components/NumberTicker/NumberTicker.svelte +1 -5
- package/dist/components/NumberTicker/NumberTicker.svelte.d.ts +1 -1
- package/dist/components/NumberTicker/index.d.ts +3 -3
- package/dist/components/NumberTicker/index.js +3 -3
- package/dist/components/NumberTicker/number-ticker.types.d.ts +1 -1
- package/dist/components/NumberTicker/number-ticker.variants.d.ts +1 -1
- package/dist/components/NumberTicker/number-ticker.variants.js +3 -3
- package/dist/components/PasswordInput/PasswordInput.svelte +58 -58
- package/dist/components/PasswordInput/PasswordInput.svelte.d.ts +1 -1
- package/dist/components/PasswordInput/index.d.ts +2 -2
- package/dist/components/PasswordInput/index.js +1 -1
- package/dist/components/PasswordInput/password-input.types.d.ts +9 -9
- package/dist/components/PasswordInput/password-input.variants.d.ts +2 -2
- package/dist/components/PasswordInput/password-input.variants.js +62 -62
- package/dist/components/Prose/Prose.svelte +5 -5
- package/dist/components/Prose/Prose.svelte.d.ts +1 -1
- package/dist/components/Prose/index.d.ts +3 -3
- package/dist/components/Prose/index.js +3 -3
- package/dist/components/Prose/prose.types.d.ts +4 -4
- package/dist/components/Prose/prose.variants.d.ts +1 -1
- package/dist/components/Prose/prose.variants.js +27 -27
- package/dist/components/{Resizable/Resizable.svelte → ResizeContainer/ResizeContainer.svelte} +3 -3
- package/dist/components/ResizeContainer/ResizeContainer.svelte.d.ts +4 -0
- package/dist/components/ResizeContainer/index.d.ts +4 -0
- package/dist/components/ResizeContainer/index.js +4 -0
- package/dist/components/ResizeContainer/resize-container.types.d.ts +18 -0
- package/dist/components/ResizeContainer/resize-container.variants.d.ts +30 -0
- package/dist/components/ResizeContainer/resize-container.variants.js +17 -0
- package/dist/components/SafeTable/SafeTable.svelte +74 -74
- package/dist/components/SafeTable/SafeTable.svelte.d.ts +2 -2
- package/dist/components/SafeTable/index.d.ts +2 -2
- package/dist/components/SafeTable/index.js +1 -1
- package/dist/components/SafeTable/safe-table.types.d.ts +1 -1
- package/dist/components/Search/Search.svelte +63 -63
- package/dist/components/Search/Search.svelte.d.ts +1 -1
- package/dist/components/Search/index.d.ts +2 -2
- package/dist/components/Search/index.js +1 -1
- package/dist/components/Search/search.types.d.ts +5 -5
- package/dist/components/SortableGroup/SortableGroup.svelte +16 -10
- package/dist/components/SortableGroup/SortableGroup.svelte.d.ts +3 -3
- package/dist/components/SortableGroup/index.d.ts +1 -1
- package/dist/components/SortableGroup/index.js +1 -1
- package/dist/components/SortableList/SortableList.svelte +49 -46
- package/dist/components/SortableList/SortableList.svelte.d.ts +2 -2
- package/dist/components/SortableList/index.d.ts +2 -2
- package/dist/components/SortableList/index.js +1 -1
- package/dist/components/SortableList/sortable-list.types.d.ts +3 -3
- package/dist/components/Spotlight/Spotlight.svelte +13 -13
- package/dist/components/Spotlight/Spotlight.svelte.d.ts +1 -1
- package/dist/components/Spotlight/index.d.ts +3 -3
- package/dist/components/Spotlight/index.js +3 -3
- package/dist/components/Spotlight/spotlight.types.d.ts +2 -2
- package/dist/components/Spotlight/spotlight.variants.d.ts +1 -1
- package/dist/components/Spotlight/spotlight.variants.js +5 -5
- package/dist/components/TableBulkActionBar/TableBulkActionBar.svelte +23 -23
- package/dist/components/TableBulkActionBar/TableBulkActionBar.svelte.d.ts +1 -1
- package/dist/components/TableBulkActionBar/index.d.ts +2 -2
- package/dist/components/TableBulkActionBar/index.js +1 -1
- package/dist/components/TableBulkActionBar/table-bulk-action-bar.types.d.ts +3 -3
- package/dist/components/TableBulkActionBar/table-bulk-action-bar.variants.d.ts +1 -1
- package/dist/components/TableBulkActionBar/table-bulk-action-bar.variants.js +7 -7
- package/dist/components/TreeView/TreeView.svelte +59 -59
- package/dist/components/TreeView/TreeView.svelte.d.ts +1 -1
- package/dist/components/TreeView/index.d.ts +3 -3
- package/dist/components/TreeView/index.js +2 -2
- package/dist/components/TreeView/tree-view.types.d.ts +4 -4
- package/dist/components/TreeView/tree-view.variants.d.ts +1 -1
- package/dist/components/TreeView/tree-view.variants.js +19 -19
- package/dist/config.d.ts +1 -1
- package/dist/config.js +28 -28
- package/dist/editor.d.ts +1 -1
- package/dist/editor.js +1 -1
- package/dist/form/resolve-form-field-name.js +1 -1
- package/dist/hooks/internal/DragDropProviderScope.svelte +1 -1
- package/dist/hooks/internal/DragDropProviderScope.svelte.d.ts +1 -1
- package/dist/hooks/internal/SortableProvider.svelte +16 -11
- package/dist/hooks/internal/SortableProvider.svelte.d.ts +1 -1
- package/dist/hooks/internal/drag-drop-context.d.ts +1 -1
- package/dist/hooks/internal/drag-drop-context.js +1 -1
- package/dist/hooks/internal/sortable-context.d.ts +6 -6
- package/dist/hooks/internal/sortable-context.js +2 -2
- package/dist/hooks/useDragDrop/index.d.ts +1 -1
- package/dist/hooks/useDragDrop/index.js +1 -1
- package/dist/hooks/useDragDrop/useDragDrop.svelte.d.ts +3 -3
- package/dist/hooks/useDragDrop/useDragDrop.svelte.js +15 -15
- package/dist/hooks/useSortable/index.d.ts +2 -2
- package/dist/hooks/useSortable/index.js +2 -2
- package/dist/hooks/useSortable/useSortable.svelte.d.ts +4 -4
- package/dist/hooks/useSortable/useSortable.svelte.js +23 -23
- package/dist/hooks/utils.js +1 -1
- package/dist/index.d.ts +29 -31
- package/dist/index.js +28 -30
- package/dist/mcp/install-template.mjs +44 -44
- package/dist/mcp/server.mjs +262 -263
- package/dist/mcp/sv5ui-plus-docs.data.json +4 -10
- package/package.json +17 -14
- package/dist/components/ColorPicker/ColorPicker.svelte +0 -109
- package/dist/components/ColorPicker/ColorPicker.svelte.d.ts +0 -4
- package/dist/components/ColorPicker/color-picker.types.d.ts +0 -26
- package/dist/components/ColorPicker/color-picker.variants.d.ts +0 -69
- package/dist/components/ColorPicker/color-picker.variants.js +0 -13
- package/dist/components/ColorPicker/index.d.ts +0 -4
- package/dist/components/ColorPicker/index.js +0 -4
- package/dist/components/Resizable/Resizable.svelte.d.ts +0 -4
- package/dist/components/Resizable/index.d.ts +0 -4
- package/dist/components/Resizable/index.js +0 -4
- package/dist/components/Resizable/resizable.types.d.ts +0 -18
- package/dist/components/Resizable/resizable.types.js +0 -1
- package/dist/components/Resizable/resizable.variants.d.ts +0 -48
- package/dist/components/Resizable/resizable.variants.js +0 -17
- package/dist/components/ScrollArea/ScrollArea.svelte +0 -54
- package/dist/components/ScrollArea/ScrollArea.svelte.d.ts +0 -4
- package/dist/components/ScrollArea/index.d.ts +0 -4
- package/dist/components/ScrollArea/index.js +0 -4
- package/dist/components/ScrollArea/scroll-area.types.d.ts +0 -27
- package/dist/components/ScrollArea/scroll-area.types.js +0 -1
- package/dist/components/ScrollArea/scroll-area.variants.d.ts +0 -45
- package/dist/components/ScrollArea/scroll-area.variants.js +0 -27
- /package/dist/components/{ColorPicker/color-picker.types.js → ResizeContainer/resize-container.types.js} +0 -0
|
@@ -65,117 +65,113 @@ async function handleItemClick(event, item, close) {
|
|
|
65
65
|
</script>
|
|
66
66
|
|
|
67
67
|
<DropdownMenu
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
68
|
+
bind:open
|
|
69
|
+
{onOpenChange}
|
|
70
|
+
{side}
|
|
71
|
+
{sideOffset}
|
|
72
|
+
{align}
|
|
73
|
+
{alignOffset}
|
|
74
|
+
{avoidCollisions}
|
|
75
|
+
{collisionBoundary}
|
|
76
|
+
{collisionPadding}
|
|
77
|
+
{sticky}
|
|
78
|
+
{hideWhenDetached}
|
|
79
|
+
{onEscapeKeydown}
|
|
80
|
+
{onInteractOutside}
|
|
81
|
+
{onCloseAutoFocus}
|
|
82
|
+
{forceMount}
|
|
83
|
+
{loop}
|
|
84
|
+
{portal}
|
|
85
|
+
{arrow}
|
|
86
|
+
{size}
|
|
87
|
+
ui={fit ? { content: "w-fit min-w-0" } : undefined}
|
|
88
88
|
>
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
89
|
+
{#snippet children({ open: isOpen, props })}
|
|
90
|
+
<Button
|
|
91
|
+
{...props}
|
|
92
|
+
bind:ref
|
|
93
|
+
{variant}
|
|
94
|
+
{color}
|
|
95
|
+
{size}
|
|
96
|
+
{loading}
|
|
97
|
+
disabled={triggerDisabled}
|
|
98
|
+
{block}
|
|
99
|
+
{square}
|
|
100
|
+
class={classes.base}
|
|
101
|
+
aria-label={ariaLabel}
|
|
102
|
+
{...restProps}
|
|
103
|
+
>
|
|
104
|
+
{#if triggerContent}
|
|
105
|
+
{@render triggerContent({ open: isOpen, currentLocale })}
|
|
106
|
+
{:else}
|
|
107
|
+
{#if showIcon}
|
|
108
|
+
<span class={classes.triggerIcon}>
|
|
109
|
+
<Icon name={icon} />
|
|
110
|
+
</span>
|
|
111
|
+
{/if}
|
|
112
|
+
<span class={classes.triggerLabel}>{triggerLabel}</span>
|
|
113
|
+
{#if showChevron}
|
|
114
|
+
<span class={classes.triggerChevron}>
|
|
115
|
+
<Icon name={chevronIcon} />
|
|
116
|
+
</span>
|
|
117
|
+
{/if}
|
|
118
|
+
{/if}
|
|
119
|
+
</Button>
|
|
120
|
+
{/snippet}
|
|
121
121
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
122
|
+
{#snippet content({ close })}
|
|
123
|
+
{#if menuSnippet}
|
|
124
|
+
{@render menuSnippet({ close })}
|
|
125
|
+
{:else}
|
|
126
|
+
<div class={classes.menu}>
|
|
127
|
+
{#if menuLabel}
|
|
128
|
+
<p class={classes.menuLabel}>{menuLabel}</p>
|
|
129
|
+
{/if}
|
|
130
130
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
131
|
+
{#each locales as item (item.code)}
|
|
132
|
+
{@const current = isCurrentLocale(item)}
|
|
133
|
+
{@const href = getResolvedHref(item)}
|
|
134
|
+
{@const itemDisabled = isItemDisabled(item)}
|
|
135
135
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
<span class={classes.itemDescription}>{item.description}</span>
|
|
161
|
-
{/if}
|
|
162
|
-
</span>
|
|
163
|
-
</span>
|
|
136
|
+
{#if itemSnippet}
|
|
137
|
+
{@render itemSnippet({ item, current, disabled: itemDisabled, close })}
|
|
138
|
+
{:else}
|
|
139
|
+
<Link
|
|
140
|
+
{href}
|
|
141
|
+
hreflang={item.hreflang ?? item.code}
|
|
142
|
+
raw
|
|
143
|
+
role="menuitemradio"
|
|
144
|
+
aria-checked={current}
|
|
145
|
+
disabled={itemDisabled}
|
|
146
|
+
class={[classes.item, current ? classes.itemCurrent : classes.itemIdle, item.class]}
|
|
147
|
+
onclick={(event) => handleItemClick(event, item, close)}
|
|
148
|
+
>
|
|
149
|
+
<span class={classes.itemLeading}>
|
|
150
|
+
{#if item.icon}
|
|
151
|
+
<Icon name={item.icon} />
|
|
152
|
+
{/if}
|
|
153
|
+
<span class={classes.itemText}>
|
|
154
|
+
<span class={classes.itemLabel}>{item.label}</span>
|
|
155
|
+
{#if item.description}
|
|
156
|
+
<span class={classes.itemDescription}>{item.description}</span>
|
|
157
|
+
{/if}
|
|
158
|
+
</span>
|
|
159
|
+
</span>
|
|
164
160
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
161
|
+
<span class="flex items-center gap-2">
|
|
162
|
+
{#if showCode}
|
|
163
|
+
<span class={classes.itemCode}>{item.shortLabel ?? item.code}</span>
|
|
164
|
+
{/if}
|
|
165
|
+
{#if showIndicator && current}
|
|
166
|
+
<span class={classes.itemIndicator}>
|
|
167
|
+
<Icon name={icons.check} />
|
|
168
|
+
</span>
|
|
169
|
+
{/if}
|
|
170
|
+
</span>
|
|
171
|
+
</Link>
|
|
172
|
+
{/if}
|
|
173
|
+
{/each}
|
|
174
|
+
</div>
|
|
175
|
+
{/if}
|
|
176
|
+
{/snippet}
|
|
181
177
|
</DropdownMenu>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LocaleButtonProps } from
|
|
1
|
+
import type { LocaleButtonProps } from "./locale-button.types.js";
|
|
2
2
|
export type Props = LocaleButtonProps;
|
|
3
3
|
declare const LocaleButton: import("svelte").Component<LocaleButtonProps, {}, "ref" | "open">;
|
|
4
4
|
type LocaleButton = ReturnType<typeof LocaleButton>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default as LocaleButton } from
|
|
2
|
-
export type { LocaleButtonLocale, LocaleButtonProps } from
|
|
1
|
+
export { default as LocaleButton } from "./LocaleButton.svelte";
|
|
2
|
+
export type { LocaleButtonLocale, LocaleButtonProps } from "./locale-button.types.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as LocaleButton } from
|
|
1
|
+
export { default as LocaleButton } from "./LocaleButton.svelte";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { DropdownMenuContentPropsWithoutHTML, DropdownMenuRootPropsWithoutHTML } from
|
|
2
|
-
import type { Snippet } from
|
|
3
|
-
import type { HTMLAttributes } from
|
|
4
|
-
import type { ClassNameValue } from
|
|
5
|
-
import type { ButtonProps } from
|
|
6
|
-
import type { LocaleButtonSlots } from
|
|
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
7
|
export type LocaleButtonLocale = {
|
|
8
8
|
/**
|
|
9
9
|
* Locale code used by your i18n layer, for example `en` or `th`.
|
|
@@ -43,9 +43,9 @@ export type LocaleButtonLocale = {
|
|
|
43
43
|
*/
|
|
44
44
|
class?: ClassNameValue;
|
|
45
45
|
};
|
|
46
|
-
type RootProps = Pick<DropdownMenuRootPropsWithoutHTML,
|
|
47
|
-
type ContentProps = Pick<DropdownMenuContentPropsWithoutHTML,
|
|
48
|
-
export type LocaleButtonProps = Omit<HTMLAttributes<HTMLElement>,
|
|
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
49
|
/**
|
|
50
50
|
* Bind a reference to the underlying trigger HTMLButtonElement.
|
|
51
51
|
*/
|
|
@@ -62,17 +62,17 @@ export type LocaleButtonProps = Omit<HTMLAttributes<HTMLElement>, 'children' | '
|
|
|
62
62
|
* Controls the visual style of the trigger button.
|
|
63
63
|
* @default 'outline'
|
|
64
64
|
*/
|
|
65
|
-
variant?: NonNullable<ButtonProps[
|
|
65
|
+
variant?: NonNullable<ButtonProps["variant"]>;
|
|
66
66
|
/**
|
|
67
67
|
* Sets the color scheme of the trigger button.
|
|
68
68
|
* @default 'surface'
|
|
69
69
|
*/
|
|
70
|
-
color?: NonNullable<ButtonProps[
|
|
70
|
+
color?: NonNullable<ButtonProps["color"]>;
|
|
71
71
|
/**
|
|
72
72
|
* Controls the trigger button size.
|
|
73
73
|
* @default 'md'
|
|
74
74
|
*/
|
|
75
|
-
size?: NonNullable<ButtonProps[
|
|
75
|
+
size?: NonNullable<ButtonProps["size"]>;
|
|
76
76
|
/**
|
|
77
77
|
* Shrinks the dropdown menu width to fit its content (`w-fit min-w-0`).
|
|
78
78
|
* @default false
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type VariantProps } from
|
|
2
|
-
import type { ButtonProps } from
|
|
1
|
+
import { type VariantProps } from "tailwind-variants";
|
|
2
|
+
import type { ButtonProps } from "sv5ui";
|
|
3
3
|
export declare const localeButtonVariants: import("tailwind-variants").TVReturnType<{
|
|
4
4
|
fit: {
|
|
5
5
|
true: {
|
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
import { tv } from
|
|
1
|
+
import { tv } from "tailwind-variants";
|
|
2
2
|
export const localeButtonVariants = tv({
|
|
3
3
|
slots: {
|
|
4
|
-
base:
|
|
5
|
-
triggerLabel:
|
|
6
|
-
triggerIcon:
|
|
7
|
-
triggerChevron:
|
|
8
|
-
menu:
|
|
9
|
-
menuLabel:
|
|
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
10
|
item: [
|
|
11
|
-
|
|
12
|
-
|
|
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
13
|
],
|
|
14
|
-
itemIdle:
|
|
15
|
-
itemCurrent:
|
|
16
|
-
itemLeading:
|
|
17
|
-
itemText:
|
|
18
|
-
itemLabel:
|
|
19
|
-
itemDescription:
|
|
20
|
-
itemCode:
|
|
21
|
-
itemIndicator:
|
|
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
22
|
},
|
|
23
23
|
variants: {
|
|
24
24
|
fit: {
|
|
25
25
|
true: {
|
|
26
|
-
menu:
|
|
26
|
+
menu: "w-fit min-w-0",
|
|
27
27
|
},
|
|
28
28
|
false: {
|
|
29
|
-
menu:
|
|
30
|
-
}
|
|
29
|
+
menu: "min-w-52",
|
|
30
|
+
},
|
|
31
31
|
},
|
|
32
32
|
size: {
|
|
33
33
|
xs: {
|
|
34
|
-
triggerIcon:
|
|
35
|
-
triggerChevron:
|
|
36
|
-
menuLabel:
|
|
37
|
-
item:
|
|
38
|
-
itemLabel:
|
|
39
|
-
itemDescription:
|
|
40
|
-
itemCode:
|
|
41
|
-
itemIndicator:
|
|
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
42
|
},
|
|
43
43
|
sm: {
|
|
44
|
-
triggerIcon:
|
|
45
|
-
triggerChevron:
|
|
46
|
-
menuLabel:
|
|
47
|
-
item:
|
|
48
|
-
itemLabel:
|
|
49
|
-
itemDescription:
|
|
50
|
-
itemCode:
|
|
51
|
-
itemIndicator:
|
|
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
52
|
},
|
|
53
53
|
md: {
|
|
54
|
-
triggerIcon:
|
|
55
|
-
triggerChevron:
|
|
56
|
-
menuLabel:
|
|
57
|
-
item:
|
|
58
|
-
itemLabel:
|
|
59
|
-
itemDescription:
|
|
60
|
-
itemCode:
|
|
61
|
-
itemIndicator:
|
|
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
62
|
},
|
|
63
63
|
lg: {
|
|
64
|
-
triggerIcon:
|
|
65
|
-
triggerChevron:
|
|
66
|
-
menuLabel:
|
|
67
|
-
item:
|
|
68
|
-
itemLabel:
|
|
69
|
-
itemDescription:
|
|
70
|
-
itemCode:
|
|
71
|
-
itemIndicator:
|
|
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
72
|
},
|
|
73
73
|
xl: {
|
|
74
|
-
triggerIcon:
|
|
75
|
-
triggerChevron:
|
|
76
|
-
menuLabel:
|
|
77
|
-
item:
|
|
78
|
-
itemLabel:
|
|
79
|
-
itemDescription:
|
|
80
|
-
itemCode:
|
|
81
|
-
itemIndicator:
|
|
82
|
-
}
|
|
83
|
-
}
|
|
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
84
|
},
|
|
85
85
|
defaultVariants: {
|
|
86
86
|
fit: false,
|
|
87
|
-
size:
|
|
88
|
-
}
|
|
87
|
+
size: "md",
|
|
88
|
+
},
|
|
89
89
|
});
|
|
90
90
|
export const localeButtonDefaults = {
|
|
91
91
|
defaultVariants: {
|
|
92
92
|
...localeButtonVariants.defaultVariants,
|
|
93
|
-
color:
|
|
94
|
-
variant:
|
|
95
|
-
size:
|
|
93
|
+
color: "surface",
|
|
94
|
+
variant: "outline",
|
|
95
|
+
size: "md",
|
|
96
96
|
},
|
|
97
|
-
slots: {}
|
|
97
|
+
slots: {},
|
|
98
98
|
};
|
|
@@ -7,44 +7,44 @@ let styles = $derived(marqueeVariants({
|
|
|
7
7
|
}));
|
|
8
8
|
</script>
|
|
9
9
|
|
|
10
|
-
<div
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
<div
|
|
11
|
+
class={twMerge(styles.root() as string, className)}
|
|
12
|
+
style:--gap={gap}
|
|
13
|
+
style:--duration={duration}
|
|
14
|
+
{...restProps}
|
|
15
15
|
>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
{#each Array(Math.max(2, repeat)) as _}
|
|
17
|
+
<div class={styles.content() as string}>
|
|
18
|
+
{@render children?.()}
|
|
19
|
+
</div>
|
|
20
|
+
{/each}
|
|
21
21
|
</div>
|
|
22
22
|
|
|
23
23
|
<style>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
:global(.animate-marquee-vertical) {
|
|
30
|
-
animation: marquee-vertical var(--duration) linear infinite;
|
|
31
|
-
}
|
|
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
|
+
}
|
|
32
28
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
100% {
|
|
38
|
-
transform: translateX(calc(-100% - var(--gap)));
|
|
39
|
-
}
|
|
40
|
-
}
|
|
29
|
+
:global(.animate-marquee-vertical) {
|
|
30
|
+
animation: marquee-vertical var(--duration) linear infinite;
|
|
31
|
+
}
|
|
41
32
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
50
|
</style>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Marquee from
|
|
1
|
+
import Marquee from "./Marquee.svelte";
|
|
2
2
|
export { Marquee };
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
3
|
+
export * from "./marquee.types.js";
|
|
4
|
+
export * from "./marquee.variants.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Marquee from
|
|
1
|
+
import Marquee from "./Marquee.svelte";
|
|
2
2
|
export { Marquee };
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
3
|
+
export * from "./marquee.types.js";
|
|
4
|
+
export * from "./marquee.variants.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { Snippet } from
|
|
2
|
-
import type { HTMLAttributes } from
|
|
3
|
-
import type { MarqueeVariantProps } from
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import type { MarqueeVariantProps } from "./marquee.variants.js";
|
|
4
4
|
export interface MarqueeProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
5
|
/**
|
|
6
6
|
* Direction of the marquee animation.
|
|
7
7
|
* @default 'left'
|
|
8
8
|
*/
|
|
9
|
-
direction?: MarqueeVariantProps[
|
|
9
|
+
direction?: MarqueeVariantProps["direction"];
|
|
10
10
|
/**
|
|
11
11
|
* Whether to pause the animation when hovered.
|
|
12
12
|
* @default false
|