@skeletonlabs/skeleton-svelte 1.5.0 → 1.6.0-next.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/components/Combobox/Combobox.svelte +19 -8
- package/dist/components/Combobox/types.d.ts +2 -0
- package/dist/composed/accordion/anatomy/accordion-content.svelte +2 -1
- package/dist/composed/accordion/anatomy/accordion-heading.svelte +12 -2
- package/dist/composed/accordion/anatomy/accordion-indicator.svelte +10 -1
- package/dist/composed/accordion/anatomy/accordion-item.svelte +2 -1
- package/dist/composed/accordion/anatomy/accordion-root.svelte +2 -1
- package/dist/composed/accordion/anatomy/accordion-trigger.svelte +2 -2
- package/dist/composed/avatar/anatomy/avatar-fallback.svelte +2 -1
- package/dist/composed/avatar/anatomy/avatar-image.svelte +2 -1
- package/dist/composed/avatar/anatomy/avatar-root.svelte +2 -1
- package/package.json +4 -3
|
@@ -26,9 +26,10 @@
|
|
|
26
26
|
positionerBase = '',
|
|
27
27
|
positionerClasses = '',
|
|
28
28
|
// Content
|
|
29
|
-
contentBase = 'card p-2',
|
|
29
|
+
contentBase = 'card p-2 overflow-y-auto',
|
|
30
30
|
contentBackground = 'preset-outlined-surface-200-800 bg-surface-50-950',
|
|
31
31
|
contentSpaceY = 'space-y-1',
|
|
32
|
+
contentMaxHeight = 'max-h-80',
|
|
32
33
|
contentClasses = '',
|
|
33
34
|
// Option
|
|
34
35
|
optionBase = 'btn justify-start w-full',
|
|
@@ -45,7 +46,8 @@
|
|
|
45
46
|
}: ComboboxProps<T> = $props();
|
|
46
47
|
|
|
47
48
|
// Zag
|
|
48
|
-
let options = $
|
|
49
|
+
let options = $derived(data);
|
|
50
|
+
|
|
49
51
|
const collection = $derived(
|
|
50
52
|
combobox.collection({
|
|
51
53
|
items: options,
|
|
@@ -58,18 +60,27 @@
|
|
|
58
60
|
const id = $props.id();
|
|
59
61
|
const service = useMachine(combobox.machine, () => ({
|
|
60
62
|
id: id,
|
|
61
|
-
collection
|
|
63
|
+
get collection() {
|
|
64
|
+
return collection;
|
|
65
|
+
},
|
|
62
66
|
...zagProps,
|
|
63
|
-
onOpenChange(event) {
|
|
67
|
+
async onOpenChange(event) {
|
|
68
|
+
if (zagProps.onOpenChange) {
|
|
69
|
+
zagProps.onOpenChange(event);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
64
72
|
options = data;
|
|
65
|
-
zagProps.onOpenChange?.(event);
|
|
66
73
|
},
|
|
67
|
-
onInputValueChange(event) {
|
|
74
|
+
async onInputValueChange(event) {
|
|
75
|
+
if (zagProps.onInputValueChange) {
|
|
76
|
+
zagProps.onInputValueChange(event);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
68
79
|
const filtered = data.filter((item) => item.label.toLowerCase().includes(event.inputValue.toLowerCase()));
|
|
69
80
|
options = filtered;
|
|
70
|
-
zagProps.onInputValueChange?.(event);
|
|
71
81
|
}
|
|
72
82
|
}));
|
|
83
|
+
|
|
73
84
|
const api = $derived(combobox.connect(service, normalizeProps));
|
|
74
85
|
const triggerProps = $derived(mergeProps(api.getTriggerProps(), { onclick }));
|
|
75
86
|
</script>
|
|
@@ -113,7 +124,7 @@
|
|
|
113
124
|
<!-- Content (list) -->
|
|
114
125
|
<nav
|
|
115
126
|
{...api.getContentProps()}
|
|
116
|
-
class="{contentBase} {contentBackground} {contentSpaceY} {contentClasses}"
|
|
127
|
+
class="{contentBase} {contentBackground} {contentSpaceY} {contentClasses} {contentMaxHeight}"
|
|
117
128
|
style="z-index: {zIndex}"
|
|
118
129
|
>
|
|
119
130
|
{#each options as option (option.label)}
|
|
@@ -39,6 +39,8 @@ export interface ComboboxProps<T extends ComboboxItem> extends Omit<combobox.Pro
|
|
|
39
39
|
contentBackground?: string;
|
|
40
40
|
/** Set space-y classes for the content. */
|
|
41
41
|
contentSpaceY?: string;
|
|
42
|
+
/** Set max-h classes for the content. */
|
|
43
|
+
contentMaxHeight?: string;
|
|
42
44
|
/** Provide arbitrary classes for the content. */
|
|
43
45
|
contentClasses?: string;
|
|
44
46
|
/** Set base classes for the option. */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { mergeProps } from '@zag-js/svelte';
|
|
3
3
|
import { AccordionItemContext, AccordionRootContext } from '../modules/context.js';
|
|
4
|
+
import { classesAccordion } from '@skeletonlabs/skeleton-common';
|
|
4
5
|
import type { AccordionContentProps } from '../modules/types.js';
|
|
5
6
|
|
|
6
7
|
const rootContext = AccordionRootContext.consume();
|
|
@@ -11,7 +12,7 @@
|
|
|
11
12
|
mergeProps(
|
|
12
13
|
rootContext.api.getItemContentProps(itemContext.itemProps),
|
|
13
14
|
{
|
|
14
|
-
class:
|
|
15
|
+
class: classesAccordion.content
|
|
15
16
|
},
|
|
16
17
|
restAttributes
|
|
17
18
|
)
|
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
3
|
+
import { classesAccordion } from '@skeletonlabs/skeleton-common';
|
|
2
4
|
import type { AccordionHeadingProps } from '../modules/types.js';
|
|
3
5
|
|
|
4
6
|
const props: AccordionHeadingProps = $props();
|
|
5
7
|
const { level = 3, element, children, ...restAttributes } = $derived(props);
|
|
8
|
+
const attributes = $derived(
|
|
9
|
+
mergeProps(
|
|
10
|
+
{
|
|
11
|
+
class: classesAccordion.heading
|
|
12
|
+
},
|
|
13
|
+
restAttributes
|
|
14
|
+
)
|
|
15
|
+
);
|
|
6
16
|
const tag = $derived(`h${level}`);
|
|
7
17
|
</script>
|
|
8
18
|
|
|
9
19
|
{#if element}
|
|
10
|
-
{@render element({ attributes
|
|
20
|
+
{@render element({ attributes })}
|
|
11
21
|
{:else}
|
|
12
|
-
<svelte:element this={tag} {...
|
|
22
|
+
<svelte:element this={tag} {...attributes}>
|
|
13
23
|
{@render children?.()}
|
|
14
24
|
</svelte:element>
|
|
15
25
|
{/if}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { mergeProps } from '@zag-js/svelte';
|
|
3
|
+
import { classesAccordion } from '@skeletonlabs/skeleton-common';
|
|
3
4
|
import { AccordionRootContext, AccordionItemContext } from '../modules/context.js';
|
|
4
5
|
import type { AccordionIndicatorProps } from '../modules/types.js';
|
|
5
6
|
|
|
@@ -7,7 +8,15 @@
|
|
|
7
8
|
const itemContext = AccordionItemContext.consume();
|
|
8
9
|
const props: AccordionIndicatorProps = $props();
|
|
9
10
|
const { element, children, ...restAttributes } = $derived(props);
|
|
10
|
-
const attributes = $derived(
|
|
11
|
+
const attributes = $derived(
|
|
12
|
+
mergeProps(
|
|
13
|
+
rootContext.api.getItemIndicatorProps(itemContext.itemProps),
|
|
14
|
+
{
|
|
15
|
+
class: classesAccordion.indicator
|
|
16
|
+
},
|
|
17
|
+
restAttributes
|
|
18
|
+
)
|
|
19
|
+
);
|
|
11
20
|
</script>
|
|
12
21
|
|
|
13
22
|
{#if element}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { mergeProps } from '@zag-js/svelte';
|
|
3
3
|
import * as accordion from '@zag-js/accordion';
|
|
4
|
+
import { classesAccordion } from '@skeletonlabs/skeleton-common';
|
|
4
5
|
import { AccordionItemContext, AccordionRootContext } from '../modules/context.js';
|
|
5
6
|
import type { AccordionItemProps } from '../modules/types.js';
|
|
6
7
|
|
|
@@ -12,7 +13,7 @@
|
|
|
12
13
|
mergeProps(
|
|
13
14
|
rootContext.api.getItemProps(itemProps),
|
|
14
15
|
{
|
|
15
|
-
class:
|
|
16
|
+
class: classesAccordion.item
|
|
16
17
|
},
|
|
17
18
|
restAttributes
|
|
18
19
|
)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { mergeProps, normalizeProps, useMachine } from '@zag-js/svelte';
|
|
3
3
|
import * as accordion from '@zag-js/accordion';
|
|
4
|
+
import { classesAccordion } from '@skeletonlabs/skeleton-common';
|
|
4
5
|
import { AccordionRootContext } from '../modules/context.js';
|
|
5
6
|
import type { AccordionRootProps } from '../modules/types.js';
|
|
6
7
|
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
mergeProps(
|
|
18
19
|
api.getRootProps(),
|
|
19
20
|
{
|
|
20
|
-
class:
|
|
21
|
+
class: classesAccordion.root
|
|
21
22
|
},
|
|
22
23
|
restAttributes
|
|
23
24
|
)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { mergeProps } from '@zag-js/svelte';
|
|
3
3
|
import { AccordionItemContext, AccordionRootContext } from '../modules/context.js';
|
|
4
|
+
import { classesAccordion } from '@skeletonlabs/skeleton-common';
|
|
4
5
|
import type { AccordionTriggerProps } from '../modules/types.js';
|
|
5
6
|
|
|
6
7
|
const rootContext = AccordionRootContext.consume();
|
|
@@ -11,8 +12,7 @@
|
|
|
11
12
|
mergeProps(
|
|
12
13
|
rootContext.api.getItemTriggerProps(itemContext.itemProps),
|
|
13
14
|
{
|
|
14
|
-
class:
|
|
15
|
-
'skb:w-full skb:grid skb:items-center skb:gap-4 skb:py-2 skb:px-4 skb:rounded-base skb:text-left skb:hover:preset-tonal-primary'
|
|
15
|
+
class: classesAccordion.trigger
|
|
16
16
|
},
|
|
17
17
|
restAttributes
|
|
18
18
|
)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { mergeProps } from '@zag-js/svelte';
|
|
3
|
+
import { classesAvatar } from '@skeletonlabs/skeleton-common';
|
|
3
4
|
import { AvatarRootContext } from '../modules/context.js';
|
|
4
5
|
import type { AvatarFallbackProps } from '../modules/types.js';
|
|
5
6
|
|
|
@@ -10,7 +11,7 @@
|
|
|
10
11
|
mergeProps(
|
|
11
12
|
rootContext.api.getFallbackProps(),
|
|
12
13
|
{
|
|
13
|
-
class:
|
|
14
|
+
class: classesAvatar.fallback
|
|
14
15
|
},
|
|
15
16
|
restAttributes
|
|
16
17
|
)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { mergeProps } from '@zag-js/svelte';
|
|
3
|
+
import { classesAvatar } from '@skeletonlabs/skeleton-common';
|
|
3
4
|
import { AvatarRootContext } from '../modules/context.js';
|
|
4
5
|
import type { AvatarImageProps } from '../modules/types.js';
|
|
5
6
|
|
|
@@ -10,7 +11,7 @@
|
|
|
10
11
|
mergeProps(
|
|
11
12
|
rootContext.api.getImageProps(),
|
|
12
13
|
{
|
|
13
|
-
class:
|
|
14
|
+
class: classesAvatar.image
|
|
14
15
|
},
|
|
15
16
|
restAttributes
|
|
16
17
|
)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import * as avatar from '@zag-js/avatar';
|
|
3
3
|
import { useMachine, normalizeProps, mergeProps } from '@zag-js/svelte';
|
|
4
|
+
import { classesAvatar } from '@skeletonlabs/skeleton-common';
|
|
4
5
|
import { AvatarRootContext } from '../modules/context.js';
|
|
5
6
|
import type { AvatarRootProps } from '../modules/types.js';
|
|
6
7
|
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
mergeProps(
|
|
18
19
|
api.getRootProps(),
|
|
19
20
|
{
|
|
20
|
-
class:
|
|
21
|
+
class: classesAvatar.root
|
|
21
22
|
},
|
|
22
23
|
restAttributes
|
|
23
24
|
)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skeletonlabs/skeleton-svelte",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0-next.0",
|
|
4
4
|
"description": "The Svelte package for Skeleton.",
|
|
5
5
|
"author": "endigo9740 <chris@skeletonlabs.dev>",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
"@zag-js/tabs": "^1.18.3",
|
|
38
38
|
"@zag-js/tags-input": "^1.18.3",
|
|
39
39
|
"@zag-js/toast": "^1.18.3",
|
|
40
|
-
"@zag-js/tooltip": "^1.18.3"
|
|
40
|
+
"@zag-js/tooltip": "^1.18.3",
|
|
41
|
+
"@skeletonlabs/skeleton-common": "0.0.1-next.0"
|
|
41
42
|
},
|
|
42
43
|
"peerDependencies": {
|
|
43
44
|
"svelte": "^5.20.0"
|
|
@@ -60,7 +61,7 @@
|
|
|
60
61
|
"typescript": "^5.8.3",
|
|
61
62
|
"vite": "^7.0.4",
|
|
62
63
|
"vitest": "3.2.4",
|
|
63
|
-
"@skeletonlabs/skeleton": "3.
|
|
64
|
+
"@skeletonlabs/skeleton": "3.3.0-next.0"
|
|
64
65
|
},
|
|
65
66
|
"type": "module",
|
|
66
67
|
"scripts": {
|