@skeletonlabs/skeleton-svelte 1.0.0-next.15 → 1.0.0-next.17
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 +1 -1
- package/dist/components/Accordion/Accordion.svelte.d.ts +1 -0
- package/dist/components/Accordion/Accordion.test.svelte.d.ts +1 -0
- package/dist/components/Accordion/AccordionItem.svelte.d.ts +1 -0
- package/dist/components/AppBar/AppBar.svelte.d.ts +1 -0
- package/dist/components/Avatar/Avatar.svelte.d.ts +1 -0
- package/dist/components/Combobox/Combobox.svelte +14 -9
- package/dist/components/Combobox/Combobox.svelte.d.ts +1 -0
- package/dist/components/Combobox/types.d.ts +12 -6
- package/dist/components/FileUpload/FileUpload.svelte.d.ts +1 -0
- package/dist/components/FileUpload/types.d.ts +1 -2
- package/dist/components/Modal/Modal.svelte +14 -8
- package/dist/components/Modal/Modal.svelte.d.ts +1 -0
- package/dist/components/Modal/types.d.ts +13 -1
- package/dist/components/Navigation/NavBar.svelte +1 -1
- package/dist/components/Navigation/NavBar.svelte.d.ts +1 -0
- package/dist/components/Navigation/NavBar.test.svelte.d.ts +1 -0
- package/dist/components/Navigation/NavRail.svelte.d.ts +1 -0
- package/dist/components/Navigation/NavRail.test.svelte.d.ts +1 -0
- package/dist/components/Navigation/NavTile.svelte.d.ts +1 -0
- package/dist/components/Pagination/Pagination.svelte +2 -1
- package/dist/components/Pagination/Pagination.svelte.d.ts +1 -0
- package/dist/components/Pagination/types.d.ts +5 -1
- package/dist/components/Popover/Popover.svelte +18 -4
- package/dist/components/Popover/Popover.svelte.d.ts +1 -0
- package/dist/components/Popover/types.d.ts +22 -10
- package/dist/components/Progress/Progress.svelte.d.ts +1 -0
- package/dist/components/ProgressRing/ProgressRing.svelte.d.ts +1 -0
- package/dist/components/Rating/Rating.svelte +1 -1
- package/dist/components/Rating/Rating.svelte.d.ts +1 -0
- package/dist/components/Segment/Segment.svelte +5 -0
- package/dist/components/Segment/Segment.svelte.d.ts +1 -0
- package/dist/components/Segment/Segment.test.js +4 -4
- package/dist/components/Segment/Segment.test.svelte.d.ts +1 -0
- package/dist/components/Segment/SegmentItem.svelte.d.ts +1 -0
- package/dist/components/Segment/types.d.ts +8 -6
- package/dist/components/Slider/Slider.svelte +1 -2
- package/dist/components/Slider/Slider.svelte.d.ts +1 -0
- package/dist/components/Slider/types.d.ts +0 -2
- package/dist/components/Switch/Switch.svelte +8 -6
- package/dist/components/Switch/Switch.svelte.d.ts +1 -0
- package/dist/components/Tabs/Tabs.svelte.d.ts +1 -0
- package/dist/components/Tabs/Tabs.test.svelte.d.ts +1 -0
- package/dist/components/Tabs/TabsControl.svelte.d.ts +1 -0
- package/dist/components/Tabs/TabsPanel.svelte.d.ts +1 -0
- package/dist/components/TagsInput/TagsInput.svelte.d.ts +1 -0
- package/dist/components/Toast/ToastProvider.svelte.d.ts +1 -0
- package/dist/components/Tooltip/Tooltip.svelte +15 -4
- package/dist/components/Tooltip/Tooltip.svelte.d.ts +1 -0
- package/dist/components/Tooltip/types.d.ts +15 -1
- package/dist/internal/snippets.js +8 -3
- package/package.json +35 -35
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { fade } from 'svelte/transition';
|
|
3
3
|
|
|
4
4
|
import * as combobox from '@zag-js/combobox';
|
|
5
|
-
import { useMachine, normalizeProps } from '@zag-js/svelte';
|
|
5
|
+
import { useMachine, normalizeProps, mergeProps } from '@zag-js/svelte';
|
|
6
6
|
import type { ComboboxProps } from './types.js';
|
|
7
7
|
import { useId } from '../../internal/use-id.js';
|
|
8
8
|
|
|
@@ -24,13 +24,15 @@
|
|
|
24
24
|
inputGroupButton = 'input-group-cell',
|
|
25
25
|
inputGroupArrow = '',
|
|
26
26
|
inputGroupClasses = '',
|
|
27
|
+
// Positioner
|
|
28
|
+
positionerBase = '',
|
|
29
|
+
positionerZIndex = '',
|
|
30
|
+
positionerClasses = '',
|
|
27
31
|
// Content
|
|
28
32
|
contentBase = 'card p-2',
|
|
29
33
|
contentBackground = 'preset-outlined-surface-200-800 bg-surface-50-950',
|
|
34
|
+
contentSpaceY = 'space-y-1',
|
|
30
35
|
contentClasses = '',
|
|
31
|
-
// List
|
|
32
|
-
listBase = 'space-y-1',
|
|
33
|
-
listClasses = '',
|
|
34
36
|
// Option
|
|
35
37
|
optionBase = 'btn justify-start w-full',
|
|
36
38
|
optionHover = 'hover:preset-tonal',
|
|
@@ -38,6 +40,8 @@
|
|
|
38
40
|
optionClasses = '',
|
|
39
41
|
// Snippets
|
|
40
42
|
arrow,
|
|
43
|
+
// Events
|
|
44
|
+
onclick,
|
|
41
45
|
// Zag ---
|
|
42
46
|
...zagProps
|
|
43
47
|
}: ComboboxProps = $props();
|
|
@@ -82,6 +86,7 @@
|
|
|
82
86
|
}
|
|
83
87
|
);
|
|
84
88
|
const api = $derived(combobox.connect(snapshot, send, normalizeProps));
|
|
89
|
+
const triggerProps = $derived(mergeProps(api.getTriggerProps(), { onclick }));
|
|
85
90
|
</script>
|
|
86
91
|
|
|
87
92
|
<span {...api.getRootProps()} class="{base} {width} {classes}" data-testid="combobox">
|
|
@@ -93,7 +98,7 @@
|
|
|
93
98
|
<!-- Input -->
|
|
94
99
|
<input {...api.getInputProps()} class={inputGroupInput} />
|
|
95
100
|
<!-- Arrow -->
|
|
96
|
-
<button {...
|
|
101
|
+
<button {...triggerProps} class={inputGroupButton}>
|
|
97
102
|
{#if arrow}
|
|
98
103
|
{@render arrow()}
|
|
99
104
|
{:else}
|
|
@@ -116,12 +121,12 @@
|
|
|
116
121
|
</button>
|
|
117
122
|
</div>
|
|
118
123
|
</label>
|
|
119
|
-
<!--
|
|
124
|
+
<!-- Menu -->
|
|
120
125
|
{#if api.open}
|
|
121
|
-
<div {...api.getPositionerProps()} transition:fade={{ duration: 100 }} class="{
|
|
126
|
+
<div {...api.getPositionerProps()} transition:fade={{ duration: 100 }} class="{positionerBase} {positionerZIndex} {positionerClasses}">
|
|
122
127
|
{#if options.length > 0}
|
|
123
|
-
<!--
|
|
124
|
-
<nav {...api.getContentProps()} class="{
|
|
128
|
+
<!-- Content (list) -->
|
|
129
|
+
<nav {...api.getContentProps()} class="{contentBase} {contentBackground} {contentSpaceY} {contentClasses}">
|
|
125
130
|
{#each options as item}
|
|
126
131
|
{@const isChecked = api.getItemProps({ item })['data-state'] === 'checked'}
|
|
127
132
|
{@const displayClass = isChecked ? optionActive : optionHover}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import * as combobox from '@zag-js/combobox';
|
|
3
|
-
export interface ComboboxProps extends Omit<combobox.Context, 'id' | 'collection' | 'value' | 'label'> {
|
|
3
|
+
export interface ComboboxProps extends Omit<combobox.Context, 'id' | 'collection' | 'value' | 'label' | 'multiple'> {
|
|
4
4
|
/** Provide the list of label and value data */
|
|
5
5
|
data?: {
|
|
6
6
|
label: string;
|
|
@@ -32,20 +32,24 @@ export interface ComboboxProps extends Omit<combobox.Context, 'id' | 'collection
|
|
|
32
32
|
inputGroupArrow?: string;
|
|
33
33
|
/** Provide arbitrary classes for the input group. */
|
|
34
34
|
inputGroupClasses?: string;
|
|
35
|
+
/** Set base classes for the positioner. */
|
|
36
|
+
positionerBase?: string;
|
|
37
|
+
/** Set z-index classes for the positioner. */
|
|
38
|
+
positionerZIndex?: string;
|
|
39
|
+
/** Provide arbitrary classes for the positioner. */
|
|
40
|
+
positionerClasses?: string;
|
|
35
41
|
/** Set base classes for the content. */
|
|
36
42
|
contentBase?: string;
|
|
37
43
|
/** Set background classes for the content. */
|
|
38
44
|
contentBackground?: string;
|
|
45
|
+
/** Set space-y classes for the content. */
|
|
46
|
+
contentSpaceY?: string;
|
|
39
47
|
/** Provide arbitrary classes for the content. */
|
|
40
48
|
contentClasses?: string;
|
|
41
|
-
/** Set base classes for the list. */
|
|
42
|
-
listBase?: string;
|
|
43
|
-
/** Provide arbitrary classes for the list. */
|
|
44
|
-
listClasses?: string;
|
|
45
49
|
/** Set base classes for the option. */
|
|
46
50
|
optionBase?: string;
|
|
47
51
|
/** Set focus classes for the option. */
|
|
48
|
-
|
|
52
|
+
optionFocus?: string;
|
|
49
53
|
/** Set hover classes for the option. */
|
|
50
54
|
optionHover?: string;
|
|
51
55
|
/** Set active classes for the option. */
|
|
@@ -54,4 +58,6 @@ export interface ComboboxProps extends Omit<combobox.Context, 'id' | 'collection
|
|
|
54
58
|
optionClasses?: string;
|
|
55
59
|
/** Provide a custom arrow icon. */
|
|
56
60
|
arrow?: Snippet;
|
|
61
|
+
/** Handle the combobox dropdown button click event. */
|
|
62
|
+
onclick?: (event: Event) => void;
|
|
57
63
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FileUploadProps } from './types.js';
|
|
2
2
|
/** A form component for handling file uploads. */
|
|
3
3
|
declare const FileUpload: import("svelte").Component<FileUploadProps, {}, "internalApi">;
|
|
4
|
+
type FileUpload = ReturnType<typeof FileUpload>;
|
|
4
5
|
export default FileUpload;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import * as fileUpload from '@zag-js/file-upload';
|
|
3
3
|
import type { PropTypes } from '@zag-js/svelte';
|
|
4
|
-
export
|
|
5
|
-
}
|
|
4
|
+
export type FileUploadApi = fileUpload.Api<PropTypes>;
|
|
6
5
|
export interface FileUploadProps extends Omit<fileUpload.Context, 'id' | 'value'> {
|
|
7
6
|
/** Set the interface text value. */
|
|
8
7
|
label?: string;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { fly, fade } from 'svelte/transition';
|
|
3
3
|
import * as dialog from '@zag-js/dialog';
|
|
4
|
-
import { portal, normalizeProps, useMachine } from '@zag-js/svelte';
|
|
4
|
+
import { portal, normalizeProps, useMachine, mergeProps } from '@zag-js/svelte';
|
|
5
5
|
import type { ModalProps } from './types.js';
|
|
6
6
|
import { useId } from '../../internal/use-id.js';
|
|
7
7
|
|
|
8
8
|
let {
|
|
9
9
|
open = $bindable(false),
|
|
10
|
+
// Base
|
|
11
|
+
base = '',
|
|
12
|
+
classes = '',
|
|
10
13
|
// Trigger
|
|
11
14
|
triggerBase = '',
|
|
12
15
|
triggerBackground = '',
|
|
@@ -21,6 +24,7 @@
|
|
|
21
24
|
positionerJustify = 'justify-center',
|
|
22
25
|
positionerAlign = 'items-center',
|
|
23
26
|
positionerPadding = 'p-4',
|
|
27
|
+
positionerZIndex = '',
|
|
24
28
|
positionerClasses = '',
|
|
25
29
|
// Content
|
|
26
30
|
contentBase = '',
|
|
@@ -34,6 +38,8 @@
|
|
|
34
38
|
// Snippets
|
|
35
39
|
trigger,
|
|
36
40
|
content,
|
|
41
|
+
// Events
|
|
42
|
+
onclick,
|
|
37
43
|
// Zag ---
|
|
38
44
|
...zagProps
|
|
39
45
|
}: ModalProps = $props();
|
|
@@ -58,15 +64,15 @@
|
|
|
58
64
|
}
|
|
59
65
|
);
|
|
60
66
|
const api = $derived(dialog.connect(snapshot, send, normalizeProps));
|
|
67
|
+
const triggerProps = $derived(mergeProps(api.getTriggerProps(), { onclick }));
|
|
61
68
|
</script>
|
|
62
69
|
|
|
63
|
-
<span data-testid="modal">
|
|
70
|
+
<span class="{base} {classes}" data-testid="modal">
|
|
64
71
|
<!-- Trigger -->
|
|
65
|
-
{
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
{/if}
|
|
72
|
+
<button {...triggerProps} class="{triggerBase} {triggerBackground} {triggerClasses}">
|
|
73
|
+
{@render trigger?.()}
|
|
74
|
+
</button>
|
|
75
|
+
|
|
70
76
|
{#if api.open}
|
|
71
77
|
<!-- Backdrop -->
|
|
72
78
|
<div
|
|
@@ -80,7 +86,7 @@
|
|
|
80
86
|
<div
|
|
81
87
|
use:portal
|
|
82
88
|
{...api.getPositionerProps()}
|
|
83
|
-
class="{positionerBase} {positionerDisplay} {positionerJustify} {positionerAlign} {positionerPadding} {positionerClasses}"
|
|
89
|
+
class="{positionerBase} {positionerDisplay} {positionerJustify} {positionerAlign} {positionerPadding} {positionerZIndex} {positionerClasses}"
|
|
84
90
|
in:fly={transitionsPositionerIn}
|
|
85
91
|
out:fly={transitionsPositionerOut}
|
|
86
92
|
>
|
|
@@ -4,6 +4,10 @@ import type { FlyParams, FadeParams } from 'svelte/transition';
|
|
|
4
4
|
export interface ModalProps extends Omit<dialog.Context, 'id' | 'open'> {
|
|
5
5
|
/** Set the open state of the dialog. */
|
|
6
6
|
open?: boolean;
|
|
7
|
+
/** Set base classes for the root element. */
|
|
8
|
+
base?: string;
|
|
9
|
+
/** Provide arbitrary classes for the root element. */
|
|
10
|
+
classes?: string;
|
|
7
11
|
/** Set base classes for the trigger. */
|
|
8
12
|
triggerBase?: string;
|
|
9
13
|
/** Set background classes for the trigger. */
|
|
@@ -26,6 +30,8 @@ export interface ModalProps extends Omit<dialog.Context, 'id' | 'open'> {
|
|
|
26
30
|
positionerAlign?: string;
|
|
27
31
|
/** Set padding classes for the positioner. */
|
|
28
32
|
positionerPadding?: string;
|
|
33
|
+
/** Set z-index classes for the positioner. */
|
|
34
|
+
positionerZIndex?: string;
|
|
29
35
|
/** Provide arbitrary classes for the positioner. */
|
|
30
36
|
positionerClasses?: string;
|
|
31
37
|
/** Set base classes for the content. */
|
|
@@ -34,12 +40,18 @@ export interface ModalProps extends Omit<dialog.Context, 'id' | 'open'> {
|
|
|
34
40
|
contentBackground?: string;
|
|
35
41
|
/** Provide arbitrary classes for the content. */
|
|
36
42
|
contentClasses?: string;
|
|
43
|
+
/** Provide transition for backdrop in */
|
|
37
44
|
transitionsBackdropIn?: FadeParams;
|
|
45
|
+
/** Provide transition for backdrop out */
|
|
38
46
|
transitionsBackdropOut?: FadeParams;
|
|
47
|
+
/** Provide transition for dialog in */
|
|
39
48
|
transitionsPositionerIn?: FlyParams;
|
|
49
|
+
/** Provide transition for dialog out */
|
|
40
50
|
transitionsPositionerOut?: FlyParams;
|
|
41
|
-
/** Provide the template contents
|
|
51
|
+
/** Provide the template contents inside the trigger button. */
|
|
42
52
|
trigger?: Snippet;
|
|
43
53
|
/** Provide the template contents of the dialog itself. */
|
|
44
54
|
content?: Snippet;
|
|
55
|
+
/** Handle the dialog button click event. */
|
|
56
|
+
onclick?: () => void;
|
|
45
57
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import * as pagination from '@zag-js/pagination';
|
|
3
3
|
export interface PaginationProps extends Omit<pagination.Context, 'id' | 'page' | 'pageSize' | 'count'> {
|
|
4
|
+
/** Provide source data as an array. */
|
|
5
|
+
data: unknown[];
|
|
6
|
+
/** Total number of data items. Required for server-side pagination. */
|
|
7
|
+
count?: number;
|
|
4
8
|
/** Bind the current page. */
|
|
5
9
|
page: number;
|
|
6
10
|
/** Bind the number of data items to display. */
|
|
7
11
|
pageSize: number;
|
|
8
|
-
|
|
12
|
+
/** Enables alternative display with stats and first/last buttons. */
|
|
9
13
|
alternative?: boolean;
|
|
10
14
|
/** Set the separator text or character, such as "of" in "X of Y". */
|
|
11
15
|
textSeparator?: string;
|
|
@@ -2,17 +2,24 @@
|
|
|
2
2
|
import { fade } from 'svelte/transition';
|
|
3
3
|
|
|
4
4
|
import * as popover from '@zag-js/popover';
|
|
5
|
-
import { portal, useMachine, normalizeProps } from '@zag-js/svelte';
|
|
5
|
+
import { portal, useMachine, normalizeProps, mergeProps } from '@zag-js/svelte';
|
|
6
6
|
import type { PopoverProps } from './types.js';
|
|
7
7
|
import { useId } from '../../internal/use-id.js';
|
|
8
8
|
|
|
9
9
|
let {
|
|
10
10
|
open = $bindable(false),
|
|
11
11
|
arrow = false,
|
|
12
|
+
// Base
|
|
13
|
+
base = '',
|
|
14
|
+
classes = '',
|
|
12
15
|
// Trigger
|
|
13
16
|
triggerBase = '',
|
|
14
17
|
triggerBackground = '',
|
|
15
18
|
triggerClasses = '',
|
|
19
|
+
// Positioner
|
|
20
|
+
positionerBase = '',
|
|
21
|
+
positionerZIndex = '',
|
|
22
|
+
positionerClasses = '',
|
|
16
23
|
// Content
|
|
17
24
|
contentBase = '',
|
|
18
25
|
contentBackground = '',
|
|
@@ -24,6 +31,8 @@
|
|
|
24
31
|
// Snippets
|
|
25
32
|
trigger,
|
|
26
33
|
content,
|
|
34
|
+
// Events
|
|
35
|
+
onclick,
|
|
27
36
|
// Zag ---
|
|
28
37
|
...zagProps
|
|
29
38
|
}: PopoverProps = $props();
|
|
@@ -47,15 +56,20 @@
|
|
|
47
56
|
}
|
|
48
57
|
);
|
|
49
58
|
const api = $derived(popover.connect(snapshot, send, normalizeProps));
|
|
59
|
+
const triggerProps = $derived(mergeProps(api.getTriggerProps(), { onclick }));
|
|
50
60
|
</script>
|
|
51
61
|
|
|
52
|
-
<span data-testid="popover">
|
|
62
|
+
<span class="{base} {classes}" data-testid="popover">
|
|
53
63
|
<!-- Snippet: Trigger -->
|
|
54
|
-
<button {...
|
|
64
|
+
<button {...triggerProps} class="{triggerBase} {triggerBackground} {triggerClasses}">
|
|
55
65
|
{@render trigger?.()}
|
|
56
66
|
</button>
|
|
57
67
|
<!-- Portal -->
|
|
58
|
-
<div
|
|
68
|
+
<div
|
|
69
|
+
use:portal={{ disabled: !api.portalled }}
|
|
70
|
+
{...api.getPositionerProps()}
|
|
71
|
+
class="{positionerBase} {positionerZIndex} {positionerClasses}"
|
|
72
|
+
>
|
|
59
73
|
<!-- Popover -->
|
|
60
74
|
{#if api.open}
|
|
61
75
|
<div {...api.getContentProps()} transition:fade={{ duration: 100 }}>
|
|
@@ -5,26 +5,38 @@ export interface PopoverProps extends Omit<popover.Context, 'id' | 'open'> {
|
|
|
5
5
|
open?: boolean;
|
|
6
6
|
/** Enable display of the popover arrow. */
|
|
7
7
|
arrow?: boolean;
|
|
8
|
-
/** Set base
|
|
8
|
+
/** Set base classes for the root element. */
|
|
9
|
+
base?: string;
|
|
10
|
+
/** Provide arbitrary classes for the root element. */
|
|
11
|
+
classes?: string;
|
|
12
|
+
/** Set base classes for the trigger. */
|
|
9
13
|
triggerBase?: string;
|
|
10
|
-
/** Set background
|
|
14
|
+
/** Set background classes for the trigger. */
|
|
11
15
|
triggerBackground?: string;
|
|
12
|
-
/** Provide arbitrary
|
|
16
|
+
/** Provide arbitrary classes for the trigger. */
|
|
13
17
|
triggerClasses?: string;
|
|
14
|
-
/** Set base
|
|
18
|
+
/** Set base classes for the positioner. */
|
|
19
|
+
positionerBase?: string;
|
|
20
|
+
/** Set z-index classes for the positioner. */
|
|
21
|
+
positionerZIndex?: string;
|
|
22
|
+
/** Provide arbitrary classes for the positioner. */
|
|
23
|
+
positionerClasses?: string;
|
|
24
|
+
/** Set base classes for the content. */
|
|
15
25
|
contentBase?: string;
|
|
16
|
-
/** Set background
|
|
26
|
+
/** Set background classes for the content. */
|
|
17
27
|
contentBackground?: string;
|
|
18
|
-
/** Provide arbitrary
|
|
28
|
+
/** Provide arbitrary classes for the content. */
|
|
19
29
|
contentClasses?: string;
|
|
20
|
-
/** Set base
|
|
30
|
+
/** Set base classes for the arrow. */
|
|
21
31
|
arrowBase?: string;
|
|
22
|
-
/** Set background
|
|
32
|
+
/** Set background classes for the arrow. */
|
|
23
33
|
arrowBackground?: string;
|
|
24
|
-
/** Provide arbitrary
|
|
34
|
+
/** Provide arbitrary classes for the arrow. */
|
|
25
35
|
arrowClasses?: string;
|
|
26
|
-
/** Provide the
|
|
36
|
+
/** Provide the template contents inside the trigger button. */
|
|
27
37
|
trigger?: Snippet;
|
|
28
38
|
/** Provide the template contents of the popover itself. */
|
|
29
39
|
content?: Snippet;
|
|
40
|
+
/** Handle the popover button click event. */
|
|
41
|
+
onclick?: () => void;
|
|
30
42
|
}
|
|
@@ -28,6 +28,10 @@
|
|
|
28
28
|
indicatorText = 'text-surface-contrast-950 dark:text-surface-contrast-50',
|
|
29
29
|
indicatorRounded = 'rounded',
|
|
30
30
|
indicatorClasses = '',
|
|
31
|
+
|
|
32
|
+
// Label
|
|
33
|
+
labelledby = '',
|
|
34
|
+
|
|
31
35
|
// Snippets
|
|
32
36
|
children,
|
|
33
37
|
// Zag
|
|
@@ -75,6 +79,7 @@
|
|
|
75
79
|
<div
|
|
76
80
|
{...api.getRootProps()}
|
|
77
81
|
class="{base} {rxOrientation} {background} {border} {padding} {gap} {rounded} {width} {rxDisabled} {rxReadOnly} {classes}"
|
|
82
|
+
aria-labelledby={labelledby}
|
|
78
83
|
data-testid="segment"
|
|
79
84
|
>
|
|
80
85
|
<!-- Indicator -->
|
|
@@ -46,14 +46,14 @@ describe('SegmentItem', () => {
|
|
|
46
46
|
it('should render in the checked state', () => {
|
|
47
47
|
render(SegmentTest, {});
|
|
48
48
|
const component = screen.getAllByTestId(testIds.root)[0];
|
|
49
|
-
const
|
|
50
|
-
expect(
|
|
49
|
+
const attrDataState = component.getAttribute('data-state');
|
|
50
|
+
expect(attrDataState).toBe('checked');
|
|
51
51
|
});
|
|
52
52
|
it('should render in the unchecked state', () => {
|
|
53
53
|
render(SegmentTest, {});
|
|
54
54
|
const component = screen.getAllByTestId(testIds.root)[1];
|
|
55
|
-
const
|
|
56
|
-
expect(
|
|
55
|
+
const attrDataState = component.getAttribute('data-state');
|
|
56
|
+
expect(attrDataState).toBe('unchecked');
|
|
57
57
|
});
|
|
58
58
|
it('should render in the disabled state', () => {
|
|
59
59
|
render(SegmentTest, {});
|
|
@@ -8,7 +8,7 @@ export interface SegmentProps extends Omit<radio.Context, 'id' | 'orientation' |
|
|
|
8
8
|
/** Set the active value. */
|
|
9
9
|
value?: string;
|
|
10
10
|
/** Set the orientation. */
|
|
11
|
-
orientation?: 'horizontal' | 'vertical'
|
|
11
|
+
orientation?: 'horizontal' | 'vertical';
|
|
12
12
|
/** Sets base classes. */
|
|
13
13
|
base?: string;
|
|
14
14
|
/** Set background classes. */
|
|
@@ -29,11 +29,11 @@ export interface SegmentProps extends Omit<radio.Context, 'id' | 'orientation' |
|
|
|
29
29
|
classes?: string;
|
|
30
30
|
/** Set classes to provide a vertical layout. */
|
|
31
31
|
orientVertical?: string;
|
|
32
|
-
/** Set classes to provide a
|
|
32
|
+
/** Set classes to provide a horizontal layout. */
|
|
33
33
|
orientHorizontal?: string;
|
|
34
|
-
/** Set
|
|
34
|
+
/** Set classes for the disabled state. */
|
|
35
35
|
stateDisabled?: string;
|
|
36
|
-
/** Set
|
|
36
|
+
/** Set classes for the read-only state. */
|
|
37
37
|
stateReadOnly?: string;
|
|
38
38
|
/** Sets base classes to the indicator. */
|
|
39
39
|
indicatorBase?: string;
|
|
@@ -45,6 +45,8 @@ export interface SegmentProps extends Omit<radio.Context, 'id' | 'orientation' |
|
|
|
45
45
|
indicatorRounded?: string;
|
|
46
46
|
/** Provide arbitrary CSS classes to the indicator. */
|
|
47
47
|
indicatorClasses?: string;
|
|
48
|
+
/** Set aria-labelledby for element */
|
|
49
|
+
labelledby?: string;
|
|
48
50
|
/** The default child slot. */
|
|
49
51
|
children?: Snippet;
|
|
50
52
|
}
|
|
@@ -53,9 +55,9 @@ export interface SegmentItemProps extends Omit<radio.ItemProps, 'invalid'> {
|
|
|
53
55
|
base?: string;
|
|
54
56
|
/** Provide arbitrary CSS classes. */
|
|
55
57
|
classes?: string;
|
|
56
|
-
/** Set
|
|
58
|
+
/** Set classes for the disabled state. */
|
|
57
59
|
stateDisabled?: string;
|
|
58
|
-
/** Set
|
|
60
|
+
/** Set classes for the focus state. */
|
|
59
61
|
stateFocused?: string;
|
|
60
62
|
/** Sets base classes for the label element. */
|
|
61
63
|
labelBase?: string;
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
thumbRingSize = 'ring-2',
|
|
34
34
|
thumbRingColor = 'ring-surface-950-50',
|
|
35
35
|
thumbRounded = 'rounded-full',
|
|
36
|
-
thumbScale = 'hover:scale-125',
|
|
37
36
|
thumbCursor = 'hover:cursor-pointer',
|
|
38
37
|
thumbClasses = '',
|
|
39
38
|
// Markers ---
|
|
@@ -74,7 +73,7 @@
|
|
|
74
73
|
|
|
75
74
|
// Reactive
|
|
76
75
|
const rxDisabled = $derived(snapshot.context.disabled ? stateDisabled : '');
|
|
77
|
-
const rxReadOnly = $derived(snapshot.context.readOnly ? stateReadOnly :
|
|
76
|
+
const rxReadOnly = $derived(snapshot.context.readOnly ? stateReadOnly : thumbCursor);
|
|
78
77
|
</script>
|
|
79
78
|
|
|
80
79
|
<div {...api.getRootProps()} class="{base} {height} {spaceY} {rxDisabled} {classes}" data-testid="slider">
|
|
@@ -45,8 +45,6 @@ export interface SliderProps extends Omit<slider.Context, 'id' | 'thumbSize'> {
|
|
|
45
45
|
thumbRingColor?: string;
|
|
46
46
|
/** Set border-radius classes for the thumb. */
|
|
47
47
|
thumbRounded?: string;
|
|
48
|
-
/** Set scale classes for the thumb. */
|
|
49
|
-
thumbScale?: string;
|
|
50
48
|
/** Set cursor classes for the thumb. */
|
|
51
49
|
thumbCursor?: string;
|
|
52
50
|
/** Provide arbitrary classes for the thumb. */
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
base = 'inline-flex items-center gap-4',
|
|
13
13
|
classes = '',
|
|
14
14
|
// State
|
|
15
|
-
stateFocused = '[
|
|
15
|
+
stateFocused = 'data-[focus-visible]:focused',
|
|
16
16
|
// Control
|
|
17
17
|
controlBase = 'cursor-pointer transition duration-200',
|
|
18
18
|
controlInactive = 'preset-filled-surface-200-800',
|
|
@@ -98,13 +98,13 @@
|
|
|
98
98
|
|
|
99
99
|
<!-- @component A control for toggling between checked states. -->
|
|
100
100
|
|
|
101
|
-
<label {...api.getRootProps()} class="{base} {
|
|
101
|
+
<label {...api.getRootProps()} class="{base} {classes}" data-testid="switch">
|
|
102
102
|
<!-- Input -->
|
|
103
103
|
<input {...api.getHiddenInputProps()} data-testid="switch-input" />
|
|
104
104
|
<!-- Control -->
|
|
105
105
|
<span
|
|
106
106
|
{...api.getControlProps()}
|
|
107
|
-
class="{controlBase} {rxTrackState} {controlWidth} {controlHeight} {controlPadding} {controlRounded} {controlHover} {rxDisabled} {controlClasses}"
|
|
107
|
+
class="{controlBase} {rxTrackState} {rxFocused} {controlWidth} {controlHeight} {controlPadding} {controlRounded} {controlHover} {rxDisabled} {controlClasses}"
|
|
108
108
|
data-testid="switch-control"
|
|
109
109
|
>
|
|
110
110
|
<!-- Thumb -->
|
|
@@ -124,7 +124,9 @@
|
|
|
124
124
|
</span>
|
|
125
125
|
</span>
|
|
126
126
|
<!-- Label -->
|
|
127
|
-
|
|
128
|
-
{
|
|
129
|
-
|
|
127
|
+
{#if children}
|
|
128
|
+
<span {...api.getLabelProps()} class="{labelBase} {labelClasses}" data-testid="switch-label">
|
|
129
|
+
{@render children()}
|
|
130
|
+
</span>
|
|
131
|
+
{/if}
|
|
130
132
|
</label>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SwitchProps } from './types.js';
|
|
2
2
|
/** A control for toggling between checked states. */
|
|
3
3
|
declare const Switch: import("svelte").Component<SwitchProps, {}, "disabled" | "checked" | "compact">;
|
|
4
|
+
type Switch = ReturnType<typeof Switch>;
|
|
4
5
|
export default Switch;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TagsInputProps } from './types.js';
|
|
2
2
|
/** Capture a set of values from users via input and suggestions. */
|
|
3
3
|
declare const TagsInput: import("svelte").Component<TagsInputProps, {}, "value">;
|
|
4
|
+
type TagsInput = ReturnType<typeof TagsInput>;
|
|
4
5
|
export default TagsInput;
|
|
@@ -2,16 +2,23 @@
|
|
|
2
2
|
import { fade } from 'svelte/transition';
|
|
3
3
|
|
|
4
4
|
import * as tooltip from '@zag-js/tooltip';
|
|
5
|
-
import { useMachine, normalizeProps } from '@zag-js/svelte';
|
|
5
|
+
import { useMachine, normalizeProps, mergeProps } from '@zag-js/svelte';
|
|
6
6
|
import type { TooltipProps } from './types.js';
|
|
7
7
|
import { useId } from '../../internal/use-id.js';
|
|
8
8
|
|
|
9
9
|
let {
|
|
10
10
|
open = $bindable(false),
|
|
11
|
+
// Base
|
|
12
|
+
base = '',
|
|
13
|
+
classes = '',
|
|
11
14
|
// Trigger
|
|
12
15
|
triggerBase = '',
|
|
13
16
|
triggerBackground = '',
|
|
14
17
|
triggerClasses = '',
|
|
18
|
+
// Positioner
|
|
19
|
+
positionerBase = '',
|
|
20
|
+
positionerZIndex = '',
|
|
21
|
+
positionerClasses = '',
|
|
15
22
|
// Content
|
|
16
23
|
contentBase = '',
|
|
17
24
|
contentBackground = '',
|
|
@@ -19,6 +26,9 @@
|
|
|
19
26
|
// Snippets
|
|
20
27
|
trigger,
|
|
21
28
|
content,
|
|
29
|
+
// Events
|
|
30
|
+
onmouseover,
|
|
31
|
+
onclick,
|
|
22
32
|
// Zag ---
|
|
23
33
|
...zagProps
|
|
24
34
|
}: TooltipProps = $props();
|
|
@@ -42,16 +52,17 @@
|
|
|
42
52
|
}
|
|
43
53
|
);
|
|
44
54
|
const api = $derived(tooltip.connect(snapshot, send, normalizeProps));
|
|
55
|
+
const triggerProps = $derived(mergeProps(api.getTriggerProps(), { onmouseover, onclick }));
|
|
45
56
|
</script>
|
|
46
57
|
|
|
47
|
-
<span data-testid="tooltip">
|
|
58
|
+
<span class="{base} {classes}" data-testid="tooltip">
|
|
48
59
|
<!-- Snippet: Trigger -->
|
|
49
|
-
<button {...
|
|
60
|
+
<button {...triggerProps} class="{triggerBase} {triggerBackground} {triggerClasses}">
|
|
50
61
|
{@render trigger?.()}
|
|
51
62
|
</button>
|
|
52
63
|
<!-- Tooltip Content -->
|
|
53
64
|
{#if api.open}
|
|
54
|
-
<div {...api.getPositionerProps()} transition:fade={{ duration: 100 }}>
|
|
65
|
+
<div {...api.getPositionerProps()} transition:fade={{ duration: 100 }} class="{positionerBase} {positionerZIndex} {positionerClasses}">
|
|
55
66
|
<!-- Snippet Content -->
|
|
56
67
|
<div {...api.getContentProps()} class="{contentBase} {contentBackground} {contentClasses}">
|
|
57
68
|
{@render content?.()}
|
|
@@ -3,20 +3,34 @@ import * as tooltip from '@zag-js/tooltip';
|
|
|
3
3
|
export interface TooltipProps extends Omit<tooltip.Context, 'id' | 'open'> {
|
|
4
4
|
/** Set the open state of the tooltip. */
|
|
5
5
|
open?: boolean;
|
|
6
|
+
/** Set base classes for the root element. */
|
|
7
|
+
base?: string;
|
|
8
|
+
/** Provide arbitrary classes for the root element. */
|
|
9
|
+
classes?: string;
|
|
6
10
|
/** Set base styles for the trigger. */
|
|
7
11
|
triggerBase?: string;
|
|
8
12
|
/** Set background styles for the trigger. */
|
|
9
13
|
triggerBackground?: string;
|
|
10
14
|
/** Provide arbitrary styles for the trigger. */
|
|
11
15
|
triggerClasses?: string;
|
|
16
|
+
/** Set base classes for the positioner. */
|
|
17
|
+
positionerBase?: string;
|
|
18
|
+
/** Set z-index classes for the positioner. */
|
|
19
|
+
positionerZIndex?: string;
|
|
20
|
+
/** Provide arbitrary classes for the positioner. */
|
|
21
|
+
positionerClasses?: string;
|
|
12
22
|
/** Set base styles for the content. */
|
|
13
23
|
contentBase?: string;
|
|
14
24
|
/** Set background styles for the content. */
|
|
15
25
|
contentBackground?: string;
|
|
16
26
|
/** Provide arbitrary styles for the content. */
|
|
17
27
|
contentClasses?: string;
|
|
18
|
-
/** Provide the
|
|
28
|
+
/** Provide the template contents inside the trigger button. */
|
|
19
29
|
trigger?: Snippet;
|
|
20
30
|
/** Provide the template contents of the tooltip itself. */
|
|
21
31
|
content?: Snippet;
|
|
32
|
+
/** Handle the tooltip button hover event. */
|
|
33
|
+
onmouseover?: () => void;
|
|
34
|
+
/** Handle the tooltip button click event. */
|
|
35
|
+
onclick?: () => void;
|
|
22
36
|
}
|
|
@@ -15,8 +15,13 @@ export const starEmpty = createRawSnippet(() => {
|
|
|
15
15
|
export const starHalf = createRawSnippet(() => {
|
|
16
16
|
return {
|
|
17
17
|
render: () => /*html*/ `
|
|
18
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"
|
|
19
|
-
<
|
|
18
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" height="24" width="24">
|
|
19
|
+
<path
|
|
20
|
+
stroke-linecap="round"
|
|
21
|
+
stroke-linejoin="round"
|
|
22
|
+
d="M11.48 3.499a.562.562 0 0 1 1.04 0l2.125 5.111a.563.563 0 0 0 .475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 0 0-.182.557l1.285 5.385a.562.562 0 0 1-.84.61l-4.725-2.885a.562.562 0 0 0-.586 0L6.982 20.54a.562.562 0 0 1-.84-.61l1.285-5.386a.562.562 0 0 0-.182-.557l-4.204-3.602a.562.562 0 0 1 .321-.988l5.518-.442a.563.563 0 0 0 .475-.345L11.48 3.5Z"
|
|
23
|
+
/>
|
|
24
|
+
<defs>
|
|
20
25
|
<linearGradient id="half-fill">
|
|
21
26
|
<stop offset="50%" stop-color="currentColor" />
|
|
22
27
|
<stop offset="50%" stop-color="transparent" />
|
|
@@ -26,7 +31,7 @@ export const starHalf = createRawSnippet(() => {
|
|
|
26
31
|
fill="url(#half-fill)"
|
|
27
32
|
d="M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.006 5.404.434c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.434 2.082-5.005Z"
|
|
28
33
|
/>
|
|
29
|
-
|
|
34
|
+
</svg>
|
|
30
35
|
`
|
|
31
36
|
};
|
|
32
37
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skeletonlabs/skeleton-svelte",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.17",
|
|
4
4
|
"description": "The Svelte package for Skeleton.",
|
|
5
5
|
"author": "endigo9740 <chris@skeletonlabs.dev>",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -22,48 +22,48 @@
|
|
|
22
22
|
"./dist/**/*.d.cts"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@zag-js/accordion": "^0.
|
|
26
|
-
"@zag-js/avatar": "^0.
|
|
27
|
-
"@zag-js/combobox": "^0.
|
|
28
|
-
"@zag-js/dialog": "^0.
|
|
29
|
-
"@zag-js/file-upload": "^0.
|
|
30
|
-
"@zag-js/pagination": "^0.
|
|
31
|
-
"@zag-js/popover": "^0.
|
|
32
|
-
"@zag-js/progress": "^0.
|
|
33
|
-
"@zag-js/radio-group": "^0.
|
|
34
|
-
"@zag-js/rating-group": "^0.
|
|
35
|
-
"@zag-js/slider": "^0.
|
|
36
|
-
"@zag-js/svelte": "^0.
|
|
37
|
-
"@zag-js/switch": "^0.
|
|
38
|
-
"@zag-js/tabs": "^0.
|
|
39
|
-
"@zag-js/tags-input": "^0.
|
|
40
|
-
"@zag-js/tooltip": "^0.
|
|
25
|
+
"@zag-js/accordion": "^0.78.3",
|
|
26
|
+
"@zag-js/avatar": "^0.78.3",
|
|
27
|
+
"@zag-js/combobox": "^0.78.3",
|
|
28
|
+
"@zag-js/dialog": "^0.78.3",
|
|
29
|
+
"@zag-js/file-upload": "^0.78.3",
|
|
30
|
+
"@zag-js/pagination": "^0.78.3",
|
|
31
|
+
"@zag-js/popover": "^0.78.3",
|
|
32
|
+
"@zag-js/progress": "^0.78.3",
|
|
33
|
+
"@zag-js/radio-group": "^0.78.3",
|
|
34
|
+
"@zag-js/rating-group": "^0.78.3",
|
|
35
|
+
"@zag-js/slider": "^0.78.3",
|
|
36
|
+
"@zag-js/svelte": "^0.78.3",
|
|
37
|
+
"@zag-js/switch": "^0.78.3",
|
|
38
|
+
"@zag-js/tabs": "^0.78.3",
|
|
39
|
+
"@zag-js/tags-input": "^0.78.3",
|
|
40
|
+
"@zag-js/tooltip": "^0.78.3"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"svelte": "^5.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@sveltejs/adapter-auto": "^3.
|
|
47
|
-
"@sveltejs/kit": "^2.
|
|
48
|
-
"@sveltejs/package": "^2.3.
|
|
49
|
-
"@sveltejs/vite-plugin-svelte": "^
|
|
46
|
+
"@sveltejs/adapter-auto": "^3.3.1",
|
|
47
|
+
"@sveltejs/kit": "^2.9.0",
|
|
48
|
+
"@sveltejs/package": "^2.3.7",
|
|
49
|
+
"@sveltejs/vite-plugin-svelte": "^5.0.1",
|
|
50
50
|
"@tailwindcss/forms": "^0.5.7",
|
|
51
|
-
"@testing-library/jest-dom": "^6.6.
|
|
52
|
-
"@testing-library/svelte": "^5.2.
|
|
51
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
52
|
+
"@testing-library/svelte": "^5.2.6",
|
|
53
53
|
"autoprefixer": "^10.4.19",
|
|
54
54
|
"jsdom": "^25.0.1",
|
|
55
|
-
"lucide-svelte": "^0.
|
|
56
|
-
"postcss": "^8.4.
|
|
57
|
-
"postcss-load-config": "^
|
|
58
|
-
"publint": "^0.
|
|
59
|
-
"svelte": "^5.
|
|
60
|
-
"svelte-check": "^
|
|
61
|
-
"tailwindcss": "^3.4.
|
|
62
|
-
"tslib": "^2.
|
|
55
|
+
"lucide-svelte": "^0.465.0",
|
|
56
|
+
"postcss": "^8.4.49",
|
|
57
|
+
"postcss-load-config": "^6.0.1",
|
|
58
|
+
"publint": "^0.2.12",
|
|
59
|
+
"svelte": "^5.6.2",
|
|
60
|
+
"svelte-check": "^4.1.1",
|
|
61
|
+
"tailwindcss": "^3.4.16",
|
|
62
|
+
"tslib": "^2.8.1",
|
|
63
63
|
"typescript": "^5.6.3",
|
|
64
|
-
"vite": "^
|
|
65
|
-
"vitest": "
|
|
66
|
-
"@skeletonlabs/skeleton": "3.0.0-next.
|
|
64
|
+
"vite": "^6.0.2",
|
|
65
|
+
"vitest": "3.0.0-beta.1",
|
|
66
|
+
"@skeletonlabs/skeleton": "3.0.0-next.10",
|
|
67
67
|
"vite-plugin-tw-plugin-watcher": "0.0.1-next.0"
|
|
68
68
|
},
|
|
69
69
|
"type": "module",
|
|
@@ -74,6 +74,6 @@
|
|
|
74
74
|
"package": "svelte-package",
|
|
75
75
|
"package:watch": "svelte-package --watch",
|
|
76
76
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
77
|
-
"test": "vitest"
|
|
77
|
+
"test": "vitest run"
|
|
78
78
|
}
|
|
79
79
|
}
|