sv5ui 1.7.0 → 2.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/dist/Alert/alert.types.d.ts +1 -1
- package/dist/AvatarGroup/AvatarGroup.svelte +5 -3
- package/dist/Banner/Banner.svelte +162 -0
- package/dist/Banner/Banner.svelte.d.ts +5 -0
- package/dist/Banner/banner.types.d.ts +148 -0
- package/dist/Banner/banner.types.js +1 -0
- package/dist/Banner/banner.variants.d.ts +293 -0
- package/dist/Banner/banner.variants.js +86 -0
- package/dist/Banner/index.d.ts +2 -0
- package/dist/Banner/index.js +1 -0
- package/dist/Button/Button.svelte +7 -6
- package/dist/Button/button.types.d.ts +3 -3
- package/dist/Collapsible/collapsible.types.d.ts +4 -2
- package/dist/Drawer/Drawer.svelte +3 -1
- package/dist/DropdownMenu/DropdownMenu.svelte +1 -3
- package/dist/DropdownMenu/DropdownMenuTriggerTestWrapper.svelte +12 -0
- package/dist/DropdownMenu/DropdownMenuTriggerTestWrapper.svelte.d.ts +7 -0
- package/dist/DropdownMenu/dropdown-menu.types.d.ts +17 -9
- package/dist/Editor/Editor.svelte +738 -0
- package/dist/Editor/Editor.svelte.d.ts +6 -0
- package/dist/Editor/EditorUrlPrompt.svelte +111 -0
- package/dist/Editor/EditorUrlPrompt.svelte.d.ts +15 -0
- package/dist/Editor/SlashPopup.svelte +67 -0
- package/dist/Editor/SlashPopup.svelte.d.ts +9 -0
- package/dist/Editor/editor.extensions.d.ts +23 -0
- package/dist/Editor/editor.extensions.js +123 -0
- package/dist/Editor/editor.schemas.d.ts +4 -0
- package/dist/Editor/editor.schemas.js +3 -0
- package/dist/Editor/editor.slash.svelte.d.ts +34 -0
- package/dist/Editor/editor.slash.svelte.js +273 -0
- package/dist/Editor/editor.suggestion.d.ts +7 -0
- package/dist/Editor/editor.suggestion.js +142 -0
- package/dist/Editor/editor.toolbar.d.ts +11 -0
- package/dist/Editor/editor.toolbar.js +212 -0
- package/dist/Editor/editor.types.d.ts +347 -0
- package/dist/Editor/editor.types.js +1 -0
- package/dist/Editor/editor.variants.d.ts +308 -0
- package/dist/Editor/editor.variants.js +150 -0
- package/dist/Editor/index.d.ts +53 -0
- package/dist/Editor/index.js +52 -0
- package/dist/Icon/icon.types.d.ts +4 -1
- package/dist/Input/Input.svelte +22 -16
- package/dist/Input/input.variants.d.ts +0 -15
- package/dist/Input/input.variants.js +1 -20
- package/dist/Link/Link.svelte +4 -3
- package/dist/Link/link.types.d.ts +2 -2
- package/dist/Pagination/Pagination.svelte +7 -1
- package/dist/Pagination/pagination.types.d.ts +4 -1
- package/dist/Pagination/pagination.variants.d.ts +0 -72
- package/dist/Pagination/pagination.variants.js +6 -30
- package/dist/Select/Select.svelte +3 -1
- package/dist/Select/select.types.d.ts +5 -9
- package/dist/SelectMenu/SelectMenu.svelte +6 -5
- package/dist/SelectMenu/SelectMenuFormFieldTestWrapper.svelte +11 -0
- package/dist/SelectMenu/SelectMenuFormFieldTestWrapper.svelte.d.ts +7 -0
- package/dist/SelectMenu/select-menu.types.d.ts +5 -2
- package/dist/SelectMenu/select-menu.variants.d.ts +12 -2
- package/dist/SelectMenu/select-menu.variants.js +10 -1
- package/dist/Separator/Separator.svelte +9 -2
- package/dist/Separator/separator.types.d.ts +5 -0
- package/dist/Separator/separator.variants.d.ts +25 -0
- package/dist/Separator/separator.variants.js +7 -1
- package/dist/Stepper/Stepper.svelte +292 -0
- package/dist/Stepper/Stepper.svelte.d.ts +5 -0
- package/dist/Stepper/index.d.ts +2 -0
- package/dist/Stepper/index.js +1 -0
- package/dist/Stepper/stepper.types.d.ts +223 -0
- package/dist/Stepper/stepper.types.js +1 -0
- package/dist/Stepper/stepper.variants.d.ts +428 -0
- package/dist/Stepper/stepper.variants.js +204 -0
- package/dist/Tabs/Tabs.svelte +4 -2
- package/dist/Tabs/tabs.types.d.ts +4 -6
- package/dist/hooks/HookContextProbe.svelte +7 -0
- package/dist/hooks/HookContextProbe.svelte.d.ts +18 -0
- package/dist/hooks/HookContextProvider.svelte +9 -0
- package/dist/hooks/HookContextProvider.svelte.d.ts +18 -0
- package/dist/hooks/HookEmitProbe.svelte +14 -0
- package/dist/hooks/HookEmitProbe.svelte.d.ts +18 -0
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useFormField.svelte.d.ts +0 -31
- package/dist/hooks/useFormField.svelte.js +0 -21
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/package.json +97 -1
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
export const bannerVariants = tv({
|
|
3
|
+
slots: {
|
|
4
|
+
root: 'relative z-30 w-full transition-colors',
|
|
5
|
+
container: 'flex items-center justify-between gap-3 min-h-12 px-4 py-2',
|
|
6
|
+
left: 'hidden lg:flex lg:flex-1 lg:items-center',
|
|
7
|
+
center: 'flex items-center gap-2 min-w-0',
|
|
8
|
+
right: 'flex items-center justify-end gap-2 lg:flex-1',
|
|
9
|
+
icon: 'size-5 shrink-0 pointer-events-none',
|
|
10
|
+
title: 'text-sm font-medium truncate',
|
|
11
|
+
actions: [
|
|
12
|
+
'flex items-center gap-2 ms-2',
|
|
13
|
+
'[&_button]:text-inherit [&_button]:border-current/30 [&_button]:hover:bg-current/10'
|
|
14
|
+
],
|
|
15
|
+
close: 'shrink-0 text-inherit hover:bg-current/10'
|
|
16
|
+
},
|
|
17
|
+
variants: {
|
|
18
|
+
color: {
|
|
19
|
+
primary: {
|
|
20
|
+
root: 'bg-primary text-on-primary',
|
|
21
|
+
icon: 'text-on-primary',
|
|
22
|
+
title: 'text-on-primary'
|
|
23
|
+
},
|
|
24
|
+
secondary: {
|
|
25
|
+
root: 'bg-secondary text-on-secondary',
|
|
26
|
+
icon: 'text-on-secondary',
|
|
27
|
+
title: 'text-on-secondary'
|
|
28
|
+
},
|
|
29
|
+
tertiary: {
|
|
30
|
+
root: 'bg-tertiary text-on-tertiary',
|
|
31
|
+
icon: 'text-on-tertiary',
|
|
32
|
+
title: 'text-on-tertiary'
|
|
33
|
+
},
|
|
34
|
+
success: {
|
|
35
|
+
root: 'bg-success text-on-success',
|
|
36
|
+
icon: 'text-on-success',
|
|
37
|
+
title: 'text-on-success'
|
|
38
|
+
},
|
|
39
|
+
warning: {
|
|
40
|
+
root: 'bg-warning text-on-warning',
|
|
41
|
+
icon: 'text-on-warning',
|
|
42
|
+
title: 'text-on-warning'
|
|
43
|
+
},
|
|
44
|
+
error: {
|
|
45
|
+
root: 'bg-error text-on-error',
|
|
46
|
+
icon: 'text-on-error',
|
|
47
|
+
title: 'text-on-error'
|
|
48
|
+
},
|
|
49
|
+
info: {
|
|
50
|
+
root: 'bg-info text-on-info',
|
|
51
|
+
icon: 'text-on-info',
|
|
52
|
+
title: 'text-on-info'
|
|
53
|
+
},
|
|
54
|
+
surface: {
|
|
55
|
+
root: 'bg-inverse-surface text-inverse-on-surface',
|
|
56
|
+
icon: 'text-inverse-on-surface',
|
|
57
|
+
title: 'text-inverse-on-surface'
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
to: {
|
|
61
|
+
true: '',
|
|
62
|
+
false: ''
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
compoundVariants: [
|
|
66
|
+
// -------------------------------------------------------------------
|
|
67
|
+
// Hover effects when banner is clickable (`to` is set)
|
|
68
|
+
// -------------------------------------------------------------------
|
|
69
|
+
{ color: 'primary', to: true, class: { root: 'hover:bg-primary/90' } },
|
|
70
|
+
{ color: 'secondary', to: true, class: { root: 'hover:bg-secondary/90' } },
|
|
71
|
+
{ color: 'tertiary', to: true, class: { root: 'hover:bg-tertiary/90' } },
|
|
72
|
+
{ color: 'success', to: true, class: { root: 'hover:bg-success/90' } },
|
|
73
|
+
{ color: 'warning', to: true, class: { root: 'hover:bg-warning/90' } },
|
|
74
|
+
{ color: 'error', to: true, class: { root: 'hover:bg-error/90' } },
|
|
75
|
+
{ color: 'info', to: true, class: { root: 'hover:bg-info/90' } },
|
|
76
|
+
{ color: 'surface', to: true, class: { root: 'hover:bg-inverse-surface/90' } }
|
|
77
|
+
],
|
|
78
|
+
defaultVariants: {
|
|
79
|
+
color: 'primary',
|
|
80
|
+
to: false
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
export const bannerDefaults = {
|
|
84
|
+
defaultVariants: bannerVariants.defaultVariants,
|
|
85
|
+
slots: {}
|
|
86
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Banner } from './Banner.svelte';
|
|
@@ -76,13 +76,14 @@
|
|
|
76
76
|
const isLeading = $derived((!!icon && !trailing) || (isLoading && !trailing) || !!leadingIcon)
|
|
77
77
|
const isTrailing = $derived((!!icon && trailing) || (isLoading && trailing) || !!trailingIcon)
|
|
78
78
|
|
|
79
|
+
const spinLeading = $derived(isLoading && !trailing)
|
|
80
|
+
const spinTrailing = $derived(isLoading && trailing)
|
|
81
|
+
|
|
79
82
|
const leadingIconName = $derived(
|
|
80
|
-
|
|
81
|
-
? loadingIcon
|
|
82
|
-
: leadingIcon || (isLeading && !trailing ? icon : undefined)
|
|
83
|
+
spinLeading ? loadingIcon : leadingIcon || (!trailing ? icon : undefined)
|
|
83
84
|
)
|
|
84
85
|
const trailingIconName = $derived(
|
|
85
|
-
|
|
86
|
+
spinTrailing ? loadingIcon : trailingIcon || (trailing ? icon : undefined)
|
|
86
87
|
)
|
|
87
88
|
|
|
88
89
|
const resolvedColor = $derived(active && activeColor ? activeColor : color)
|
|
@@ -96,8 +97,8 @@
|
|
|
96
97
|
block,
|
|
97
98
|
square: isIconOnly,
|
|
98
99
|
loading: isLoading,
|
|
99
|
-
leading:
|
|
100
|
-
trailing:
|
|
100
|
+
leading: spinLeading,
|
|
101
|
+
trailing: spinTrailing
|
|
101
102
|
})
|
|
102
103
|
return {
|
|
103
104
|
base: slots.base({ class: [config.slots.base, fieldGroupClass, className, ui?.base] }),
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import type { HTMLAttributes, HTMLButtonAttributes, HTMLAnchorAttributes } from 'svelte/elements';
|
|
3
3
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
4
|
import type { ButtonVariantProps, ButtonSlots } from './button.variants.js';
|
|
5
5
|
import type { AvatarProps } from '../Avatar/avatar.types.js';
|
|
6
|
-
export type ButtonProps = Omit<HTMLAttributes<HTMLElement>, 'class' | 'color'> & {
|
|
6
|
+
export type ButtonProps = Omit<HTMLAttributes<HTMLElement>, 'class' | 'color'> & Pick<HTMLButtonAttributes, 'name' | 'value' | 'form' | 'formaction' | 'formenctype' | 'formmethod' | 'formnovalidate' | 'formtarget' | 'popovertarget' | 'popovertargetaction'> & Pick<HTMLAnchorAttributes, 'download' | 'hreflang' | 'ping' | 'media' | 'referrerpolicy'> & {
|
|
7
7
|
/**
|
|
8
8
|
* Bindable reference to the root DOM element.
|
|
9
9
|
*/
|
|
@@ -147,5 +147,5 @@ export type ButtonProps = Omit<HTMLAttributes<HTMLElement>, 'class' | 'color'> &
|
|
|
147
147
|
/**
|
|
148
148
|
* Override styles for specific button slots.
|
|
149
149
|
*/
|
|
150
|
-
ui?: Partial<Record<ButtonSlots, ClassNameValue>>;
|
|
150
|
+
ui?: Partial<Record<Exclude<ButtonSlots, 'leadingAvatarSize'>, ClassNameValue>>;
|
|
151
151
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
3
|
-
import type { CollapsibleRootPropsWithoutHTML } from 'bits-ui';
|
|
3
|
+
import type { CollapsibleRootProps, CollapsibleRootPropsWithoutHTML } from 'bits-ui';
|
|
4
4
|
import type { CollapsibleSlots } from './collapsible.variants.js';
|
|
5
5
|
/**
|
|
6
6
|
* Props for the Collapsible component.
|
|
@@ -21,7 +21,9 @@ import type { CollapsibleSlots } from './collapsible.variants.js';
|
|
|
21
21
|
*
|
|
22
22
|
* @see https://bits-ui.com/docs/components/collapsible
|
|
23
23
|
*/
|
|
24
|
-
export interface CollapsibleProps extends Pick<CollapsibleRootPropsWithoutHTML, 'open' | 'onOpenChange' | 'onOpenChangeComplete' | 'disabled'> {
|
|
24
|
+
export interface CollapsibleProps extends Pick<CollapsibleRootPropsWithoutHTML, 'open' | 'onOpenChange' | 'onOpenChangeComplete' | 'disabled'>, Pick<CollapsibleRootProps, 'id' | 'style' | 'title' | 'role' | 'tabindex' | 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'onclick' | 'onkeydown' | 'onmouseenter' | 'onmouseleave' | 'onfocus' | 'onblur'> {
|
|
25
|
+
/** Custom data attributes are forwarded to the root element. */
|
|
26
|
+
[key: `data-${string}`]: unknown;
|
|
25
27
|
/**
|
|
26
28
|
* Bindable reference to the root DOM element.
|
|
27
29
|
*/
|
|
@@ -44,7 +44,8 @@
|
|
|
44
44
|
titleSlot,
|
|
45
45
|
descriptionSlot,
|
|
46
46
|
body: bodySlot,
|
|
47
|
-
footer: footerSlot
|
|
47
|
+
footer: footerSlot,
|
|
48
|
+
...rest
|
|
48
49
|
}: Props = $props()
|
|
49
50
|
|
|
50
51
|
const hasTitle = $derived(!!title || !!titleSlot)
|
|
@@ -81,6 +82,7 @@
|
|
|
81
82
|
|
|
82
83
|
const rootProps = $derived.by(() => {
|
|
83
84
|
const base = {
|
|
85
|
+
...rest,
|
|
84
86
|
open,
|
|
85
87
|
onOpenChange: handleOpenChange,
|
|
86
88
|
direction,
|
|
@@ -348,9 +348,7 @@
|
|
|
348
348
|
{#if children}
|
|
349
349
|
<DropdownMenu.Trigger>
|
|
350
350
|
{#snippet child({ props })}
|
|
351
|
-
|
|
352
|
-
{@render children({ open })}
|
|
353
|
-
</span>
|
|
351
|
+
{@render children({ open, props })}
|
|
354
352
|
{/snippet}
|
|
355
353
|
</DropdownMenu.Trigger>
|
|
356
354
|
{/if}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import DropdownMenu from './DropdownMenu.svelte'
|
|
3
|
+
import type { DropdownMenuItem } from './dropdown-menu.types.js'
|
|
4
|
+
|
|
5
|
+
let { items = [] }: { items?: DropdownMenuItem[] } = $props()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<DropdownMenu {items}>
|
|
9
|
+
{#snippet children({ open, props })}
|
|
10
|
+
<button data-testid="trigger" data-open={open} {...props}>Open</button>
|
|
11
|
+
{/snippet}
|
|
12
|
+
</DropdownMenu>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DropdownMenuItem } from './dropdown-menu.types.js';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
items?: DropdownMenuItem[];
|
|
4
|
+
};
|
|
5
|
+
declare const DropdownMenuTriggerTestWrapper: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
+
type DropdownMenuTriggerTestWrapper = ReturnType<typeof DropdownMenuTriggerTestWrapper>;
|
|
7
|
+
export default DropdownMenuTriggerTestWrapper;
|
|
@@ -129,10 +129,6 @@ export type DropdownMenuItem = DropdownMenuItemAction | DropdownMenuItemCheckbox
|
|
|
129
129
|
* Configuration for a radio group within the dropdown menu.
|
|
130
130
|
*/
|
|
131
131
|
export interface DropdownMenuRadioGroup {
|
|
132
|
-
/**
|
|
133
|
-
* Unique identifier for the radio group.
|
|
134
|
-
*/
|
|
135
|
-
name: string;
|
|
136
132
|
/**
|
|
137
133
|
* Currently selected value in the group.
|
|
138
134
|
*/
|
|
@@ -178,8 +174,9 @@ export interface DropdownMenuProps extends RootProps, ContentProps {
|
|
|
178
174
|
*/
|
|
179
175
|
items?: DropdownMenuItem[];
|
|
180
176
|
/**
|
|
181
|
-
* Radio
|
|
182
|
-
*
|
|
177
|
+
* Radio group configuration for managing radio item selections.
|
|
178
|
+
* Only the first entry is used — all `type: 'radio'` items belong to it.
|
|
179
|
+
* @example [{ value: 'dark', onValueChange: (v) => theme = v }]
|
|
183
180
|
*/
|
|
184
181
|
radioGroups?: DropdownMenuRadioGroup[];
|
|
185
182
|
/**
|
|
@@ -214,7 +211,9 @@ export interface DropdownMenuProps extends RootProps, ContentProps {
|
|
|
214
211
|
*/
|
|
215
212
|
size?: NonNullable<DropdownMenuVariantProps['size']>;
|
|
216
213
|
/**
|
|
217
|
-
* Additional CSS class for the
|
|
214
|
+
* Additional CSS class for the dropdown content.
|
|
215
|
+
* Applied only when no trigger `children` are provided (style your own
|
|
216
|
+
* trigger element directly otherwise).
|
|
218
217
|
*/
|
|
219
218
|
class?: ClassNameValue;
|
|
220
219
|
/**
|
|
@@ -222,11 +221,20 @@ export interface DropdownMenuProps extends RootProps, ContentProps {
|
|
|
222
221
|
*/
|
|
223
222
|
ui?: Partial<Record<DropdownMenuSlots, ClassNameValue>>;
|
|
224
223
|
/**
|
|
225
|
-
*
|
|
226
|
-
*
|
|
224
|
+
* Trigger content. Spread the provided `props` onto your own focusable
|
|
225
|
+
* element (e.g. a `<Button>`) so the trigger's ARIA and event handlers land
|
|
226
|
+
* on the real control.
|
|
227
|
+
*
|
|
228
|
+
* @example
|
|
229
|
+
* ```svelte
|
|
230
|
+
* {#snippet children({ open, props })}
|
|
231
|
+
* <Button {...props}>{open ? 'Close' : 'Open'}</Button>
|
|
232
|
+
* {/snippet}
|
|
233
|
+
* ```
|
|
227
234
|
*/
|
|
228
235
|
children?: Snippet<[{
|
|
229
236
|
open: boolean;
|
|
237
|
+
props: Record<string, unknown>;
|
|
230
238
|
}]>;
|
|
231
239
|
/**
|
|
232
240
|
* Custom content to render at the top of the dropdown menu.
|