@skeletonlabs/skeleton-svelte 1.0.0-next.7 → 1.0.0-next.8
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/FileUpload/FileUpload.svelte +15 -12
- package/dist/components/FileUpload/FileUpload.svelte.d.ts +1 -1
- package/dist/components/FileUpload/types.d.ts +6 -1
- package/dist/components/Pagination/Pagination.svelte +155 -0
- package/dist/components/Pagination/Pagination.svelte.d.ts +16 -0
- package/dist/components/Pagination/types.d.ts +56 -0
- package/dist/components/Pagination/types.js +1 -0
- package/dist/components/Segment/Segment.svelte +6 -0
- package/dist/components/TagsInput/TagsInput.svelte +100 -0
- package/dist/components/TagsInput/TagsInput.svelte.d.ts +17 -0
- package/dist/components/TagsInput/types.d.ts +44 -0
- package/dist/components/TagsInput/types.js +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/package.json +5 -3
|
@@ -23,7 +23,7 @@ let {
|
|
|
23
23
|
filesListBase = "mt-2 space-y-2",
|
|
24
24
|
filesListClasses = "",
|
|
25
25
|
// File
|
|
26
|
-
fileBase = "grid grid-cols-[
|
|
26
|
+
fileBase = "grid grid-cols-[auto_1fr_auto] rtl:grid-cols-[1fr_auto_auto] items-center",
|
|
27
27
|
fileBg = "preset-tonal",
|
|
28
28
|
fileGap = "gap-4 px-4",
|
|
29
29
|
filePadding = "py-2",
|
|
@@ -31,7 +31,7 @@ let {
|
|
|
31
31
|
fileClasses = "",
|
|
32
32
|
// File (content)
|
|
33
33
|
fileIcon = "",
|
|
34
|
-
fileName = "type-scale-2",
|
|
34
|
+
fileName = "type-scale-2 flex items-center gap-4",
|
|
35
35
|
fileSize = "type-scale-1 opacity-60",
|
|
36
36
|
fileButton = "",
|
|
37
37
|
// State
|
|
@@ -44,10 +44,19 @@ let {
|
|
|
44
44
|
iconFile,
|
|
45
45
|
iconFileRemove,
|
|
46
46
|
// Zag
|
|
47
|
+
internalApi = $bindable(),
|
|
47
48
|
...zagProps
|
|
48
49
|
} = $props();
|
|
49
|
-
const [snapshot, send] = useMachine(
|
|
50
|
+
const [snapshot, send] = useMachine(
|
|
51
|
+
fileUpload.machine({
|
|
52
|
+
id: useId()
|
|
53
|
+
}),
|
|
54
|
+
{ context: { ...zagProps } }
|
|
55
|
+
);
|
|
50
56
|
const api = $derived(fileUpload.connect(snapshot, send, normalizeProps));
|
|
57
|
+
$effect(() => {
|
|
58
|
+
internalApi = api;
|
|
59
|
+
});
|
|
51
60
|
const rxDisabled = $derived(snapshot.context.disabled ? stateDisabled : "");
|
|
52
61
|
const rxInvalid = $derived(api.rejectedFiles.length > 0 ? stateInvalid : interfaceBorderColor);
|
|
53
62
|
const rxDragging = $derived(api.dragging && !children ? stateDragging : "");
|
|
@@ -92,20 +101,14 @@ const rxDragging = $derived(api.dragging && !children ? stateDragging : "");
|
|
|
92
101
|
class="{fileBase} {fileBg} {fileGap} {filePadding} {fileRounded} {fileClasses}"
|
|
93
102
|
data-testid="uploader-file"
|
|
94
103
|
>
|
|
95
|
-
<span class={fileIcon} data-testid="uploader-file-icon">
|
|
96
|
-
{#if iconFile}
|
|
97
|
-
{@render iconFile()}
|
|
98
|
-
{:else}
|
|
99
|
-
•
|
|
100
|
-
{/if}
|
|
101
|
-
</span>
|
|
102
104
|
<!-- Name -->
|
|
103
105
|
<p {...api.getItemNameProps({ file })} class={fileName} data-testid="uploader-file-name">
|
|
104
|
-
{file
|
|
106
|
+
{#if iconFile}<span class={fileIcon} data-testid="uploader-file-icon">{@render iconFile()}</span>{/if}
|
|
107
|
+
<span>{file.name}</span>
|
|
105
108
|
</p>
|
|
106
109
|
<!-- Size -->
|
|
107
110
|
<p {...api.getItemNameProps({ file })} class={fileSize} data-testid="uploader-file-size">
|
|
108
|
-
{(file
|
|
111
|
+
{api.getFileSize(file)}
|
|
109
112
|
</p>
|
|
110
113
|
<!-- Button -->
|
|
111
114
|
<button {...api.getItemDeleteTriggerProps({ file })} class={fileButton} data-testid="uploader-file-button">
|
|
@@ -12,6 +12,6 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
|
12
12
|
/** A form component for handling file uploads. */
|
|
13
13
|
declare const FileUpload: $$__sveltets_2_IsomorphicComponent<FileUploadProps, {
|
|
14
14
|
[evt: string]: CustomEvent<any>;
|
|
15
|
-
}, {}, {}, "">;
|
|
15
|
+
}, {}, {}, "internalApi">;
|
|
16
16
|
type FileUpload = InstanceType<typeof FileUpload>;
|
|
17
17
|
export default FileUpload;
|
|
@@ -1,6 +1,9 @@
|
|
|
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 interface FileUploadApi extends fileUpload.Api<PropTypes> {
|
|
5
|
+
}
|
|
6
|
+
export interface FileUploadProps extends Omit<fileUpload.Context, 'id' | 'value'> {
|
|
4
7
|
/** Set the interface text value. */
|
|
5
8
|
label?: string;
|
|
6
9
|
/** Set the interface subtext value. */
|
|
@@ -67,4 +70,6 @@ export interface FileUploadProps extends Omit<fileUpload.Context, 'id'> {
|
|
|
67
70
|
iconFile?: Snippet;
|
|
68
71
|
/** Provide an icon for the remove file action. */
|
|
69
72
|
iconFileRemove?: Snippet;
|
|
73
|
+
/** Binds the Zag API for external use. */
|
|
74
|
+
internalApi?: FileUploadApi;
|
|
70
75
|
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
<script lang="ts">import * as pagination from "@zag-js/pagination";
|
|
2
|
+
import { normalizeProps, useMachine } from "@zag-js/svelte";
|
|
3
|
+
import { useId } from "../../internal/use-id.js";
|
|
4
|
+
let {
|
|
5
|
+
page = $bindable(1),
|
|
6
|
+
pageSize = $bindable(10),
|
|
7
|
+
data,
|
|
8
|
+
alternative = false,
|
|
9
|
+
textSeparator = "of",
|
|
10
|
+
// Titles
|
|
11
|
+
titleFirst,
|
|
12
|
+
titlePrevious,
|
|
13
|
+
titleNumeral,
|
|
14
|
+
titleNext,
|
|
15
|
+
titleLast,
|
|
16
|
+
// Root
|
|
17
|
+
base = "inline-flex items-stretch overflow-hidden",
|
|
18
|
+
background = "preset-outlined-surface-200-800",
|
|
19
|
+
border = "p-2",
|
|
20
|
+
gap = "gap-2",
|
|
21
|
+
padding = "",
|
|
22
|
+
rounded = "rounded-container",
|
|
23
|
+
classes = "",
|
|
24
|
+
// Buttons
|
|
25
|
+
buttonBase = "btn",
|
|
26
|
+
buttonActive = "preset-filled",
|
|
27
|
+
buttonInactive = "preset-tonal",
|
|
28
|
+
buttonHover = "hover:preset-filled",
|
|
29
|
+
buttonClasses = "",
|
|
30
|
+
// Children
|
|
31
|
+
labelFirst,
|
|
32
|
+
labelPrevious,
|
|
33
|
+
labelEllipsis,
|
|
34
|
+
labelNext,
|
|
35
|
+
labelLast,
|
|
36
|
+
// Zag ---
|
|
37
|
+
...zagProps
|
|
38
|
+
} = $props();
|
|
39
|
+
const [snapshot, send] = useMachine(
|
|
40
|
+
pagination.machine({
|
|
41
|
+
id: useId(),
|
|
42
|
+
count: data.length,
|
|
43
|
+
onPageChange(details) {
|
|
44
|
+
page = details.page;
|
|
45
|
+
}
|
|
46
|
+
}),
|
|
47
|
+
{
|
|
48
|
+
context: {
|
|
49
|
+
...zagProps,
|
|
50
|
+
get page() {
|
|
51
|
+
return page;
|
|
52
|
+
},
|
|
53
|
+
get pageSize() {
|
|
54
|
+
return pageSize;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
const api = $derived(pagination.connect(snapshot, send, normalizeProps));
|
|
60
|
+
const rxButtonActive = (page2) => {
|
|
61
|
+
return snapshot.context.page === page2.value ? buttonActive : `${buttonInactive} ${buttonHover}`;
|
|
62
|
+
};
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
{#if api.totalPages > 1}
|
|
66
|
+
<div {...api.getRootProps()} class="{base} {background} {border} {gap} {padding} {rounded} {classes}" data-testid="pagination">
|
|
67
|
+
<!-- Button: First Page -->
|
|
68
|
+
{#if alternative}
|
|
69
|
+
<button
|
|
70
|
+
type="button"
|
|
71
|
+
onclick={api.goToFirstPage}
|
|
72
|
+
class="{buttonBase} {buttonInactive} {buttonHover} {buttonClasses}"
|
|
73
|
+
title={titleFirst}
|
|
74
|
+
disabled={api.page === 1}
|
|
75
|
+
data-testid="pagination-button-previous"
|
|
76
|
+
>
|
|
77
|
+
{#if labelFirst}{@render labelFirst()}{:else}«{/if}
|
|
78
|
+
</button>
|
|
79
|
+
{/if}
|
|
80
|
+
<!-- Button: Previous Page -->
|
|
81
|
+
<button
|
|
82
|
+
type="button"
|
|
83
|
+
{...api.getPrevTriggerProps()}
|
|
84
|
+
class="{buttonBase} {buttonInactive} {buttonHover} {buttonClasses}"
|
|
85
|
+
title={titlePrevious}
|
|
86
|
+
disabled={api.page === 1}
|
|
87
|
+
data-testid="pagination-button-previous"
|
|
88
|
+
>
|
|
89
|
+
{#if labelPrevious}{@render labelPrevious()}{:else}←{/if}
|
|
90
|
+
</button>
|
|
91
|
+
<!-- Numeral List -->
|
|
92
|
+
{#if !alternative}
|
|
93
|
+
{#each api.pages as page, i}
|
|
94
|
+
{#if page.type === 'page'}
|
|
95
|
+
<!-- Numeral -->
|
|
96
|
+
<button
|
|
97
|
+
type="button"
|
|
98
|
+
{...api.getItemProps(page)}
|
|
99
|
+
class="{buttonBase} {rxButtonActive(page)} {buttonClasses}"
|
|
100
|
+
title={titleNumeral && `${titleNumeral} ${page.value}`}
|
|
101
|
+
data-testid="pagination-button-numeral"
|
|
102
|
+
>
|
|
103
|
+
{page.value}
|
|
104
|
+
</button>
|
|
105
|
+
{:else}
|
|
106
|
+
<!-- Ellipsis -->
|
|
107
|
+
<span
|
|
108
|
+
{...api.getEllipsisProps({ index: i })}
|
|
109
|
+
class="{buttonBase} {buttonInactive} {buttonClasses}"
|
|
110
|
+
data-testid="pagination-ellipsis"
|
|
111
|
+
>
|
|
112
|
+
{#if labelEllipsis}{@render labelEllipsis()}{:else}⋯{/if}
|
|
113
|
+
</span>
|
|
114
|
+
{/if}
|
|
115
|
+
{/each}
|
|
116
|
+
{/if}
|
|
117
|
+
<!-- Alternative Interface -->
|
|
118
|
+
{#if alternative}
|
|
119
|
+
<span class="{buttonBase} {buttonInactive} {buttonClasses}" data-testid="pagination-alt-ui">
|
|
120
|
+
<span>
|
|
121
|
+
{api.pageRange.start + 1} - {api.pageRange.end}
|
|
122
|
+
</span>
|
|
123
|
+
<span class="opacity-60">
|
|
124
|
+
{api.page}
|
|
125
|
+
{textSeparator}
|
|
126
|
+
{api.count}
|
|
127
|
+
</span>
|
|
128
|
+
</span>
|
|
129
|
+
{/if}
|
|
130
|
+
<!-- Button: Next Page -->
|
|
131
|
+
<button
|
|
132
|
+
type="button"
|
|
133
|
+
{...api.getNextTriggerProps()}
|
|
134
|
+
class="{buttonBase} {buttonInactive} {buttonHover} {buttonClasses}"
|
|
135
|
+
title={titleNext}
|
|
136
|
+
disabled={!api.nextPage}
|
|
137
|
+
data-testid="pagination-button-next"
|
|
138
|
+
>
|
|
139
|
+
{#if labelNext}{@render labelNext()}{:else}→{/if}
|
|
140
|
+
</button>
|
|
141
|
+
<!-- Button: Last Page -->
|
|
142
|
+
{#if alternative}
|
|
143
|
+
<button
|
|
144
|
+
type="button"
|
|
145
|
+
onclick={api.goToLastPage}
|
|
146
|
+
class="{buttonBase} {buttonInactive} {buttonHover} {buttonClasses}"
|
|
147
|
+
title={titleLast}
|
|
148
|
+
disabled={!api.nextPage}
|
|
149
|
+
data-testid="pagination-button-previous"
|
|
150
|
+
>
|
|
151
|
+
{#if labelLast}{@render labelLast()}{:else}»{/if}
|
|
152
|
+
</button>
|
|
153
|
+
{/if}
|
|
154
|
+
</div>
|
|
155
|
+
{/if}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PaginationProps } from './types.js';
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: Props & {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports;
|
|
10
|
+
z_$$bindings?: Bindings;
|
|
11
|
+
}
|
|
12
|
+
declare const Pagination: $$__sveltets_2_IsomorphicComponent<PaginationProps, {
|
|
13
|
+
[evt: string]: CustomEvent<any>;
|
|
14
|
+
}, {}, {}, "pageSize" | "page">;
|
|
15
|
+
type Pagination = InstanceType<typeof Pagination>;
|
|
16
|
+
export default Pagination;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import * as pagination from '@zag-js/pagination';
|
|
3
|
+
export interface PaginationProps extends Omit<pagination.Context, 'id' | 'page' | 'pageSize'> {
|
|
4
|
+
/** Bind the current page. */
|
|
5
|
+
page: number;
|
|
6
|
+
/** Bind the number of data items to display. */
|
|
7
|
+
pageSize: number;
|
|
8
|
+
data: unknown[];
|
|
9
|
+
alternative?: boolean;
|
|
10
|
+
/** Set the separator text or character, such as "of" in "X of Y". */
|
|
11
|
+
textSeparator?: string;
|
|
12
|
+
/** Set an optional title for the first button. */
|
|
13
|
+
titleFirst?: string;
|
|
14
|
+
/** Set an optional title for the previous button. */
|
|
15
|
+
titlePrevious?: string;
|
|
16
|
+
/** Set an optional title for the numeral buttons (ex: Page 1). */
|
|
17
|
+
titleNumeral?: string;
|
|
18
|
+
/** Set an optional title for the next button. */
|
|
19
|
+
titleNext?: string;
|
|
20
|
+
/** Set an optional title for the last button. */
|
|
21
|
+
titleLast?: string;
|
|
22
|
+
/** Sets base classes for the list. */
|
|
23
|
+
base?: string;
|
|
24
|
+
/** Sets background classes for the list. */
|
|
25
|
+
background?: string;
|
|
26
|
+
/** Sets border classes for the list. */
|
|
27
|
+
border?: string;
|
|
28
|
+
/** Sets gap classes for the list. */
|
|
29
|
+
gap?: string;
|
|
30
|
+
/** Sets padding classes for the list. */
|
|
31
|
+
padding?: string;
|
|
32
|
+
/** Sets border radius classes for the list. */
|
|
33
|
+
rounded?: string;
|
|
34
|
+
/** Provide arbitrary CSS classes for the root. */
|
|
35
|
+
classes?: string;
|
|
36
|
+
/** Sets base classes for buttons. */
|
|
37
|
+
buttonBase?: string;
|
|
38
|
+
/** Sets active state classes for buttons. */
|
|
39
|
+
buttonActive?: string;
|
|
40
|
+
/** Sets inactive state classes for buttons. */
|
|
41
|
+
buttonInactive?: string;
|
|
42
|
+
/** Sets hover state classes for buttons. */
|
|
43
|
+
buttonHover?: string;
|
|
44
|
+
/** Provide arbitrary CSS classes for buttons. */
|
|
45
|
+
buttonClasses?: string;
|
|
46
|
+
/** Set button icon or label for first button. */
|
|
47
|
+
labelFirst?: Snippet;
|
|
48
|
+
/** Set button icon or label for previous button. */
|
|
49
|
+
labelPrevious?: Snippet;
|
|
50
|
+
/** Set button icon or label for ellipsis. */
|
|
51
|
+
labelEllipsis?: Snippet;
|
|
52
|
+
/** Set button icon or label for next button. */
|
|
53
|
+
labelNext?: Snippet;
|
|
54
|
+
/** Set button icon or label for last button. */
|
|
55
|
+
labelLast?: Snippet;
|
|
56
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import * as pagination from '@zag-js/pagination';
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { useMachine, normalizeProps } from "@zag-js/svelte";
|
|
3
3
|
import { setSegmentContext } from "./context.js";
|
|
4
4
|
import { useId } from "../../internal/use-id.js";
|
|
5
|
+
import { on } from "svelte/events";
|
|
5
6
|
let {
|
|
6
7
|
value = $bindable(""),
|
|
7
8
|
orientation = "horizontal",
|
|
@@ -59,6 +60,11 @@ setSegmentContext({
|
|
|
59
60
|
const rxOrientation = $derived(snapshot.context.orientation === "vertical" ? orientVertical : orientHorizontal);
|
|
60
61
|
const rxDisabled = $derived(snapshot.context.disabled ? stateDisabled : "");
|
|
61
62
|
const rxReadOnly = $derived(snapshot.context.readOnly ? stateReadOnly : "");
|
|
63
|
+
$effect(() => {
|
|
64
|
+
return on(document, "focusin", () => {
|
|
65
|
+
console.log(document.activeElement);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
62
68
|
</script>
|
|
63
69
|
|
|
64
70
|
<!-- @component Capture input for a limited set of options. -->
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<script lang="ts">import * as tagsInput from "@zag-js/tags-input";
|
|
2
|
+
import { useMachine, normalizeProps } from "@zag-js/svelte";
|
|
3
|
+
import { useId } from "../../internal/use-id.js";
|
|
4
|
+
let {
|
|
5
|
+
value = $bindable(),
|
|
6
|
+
placeholder = "",
|
|
7
|
+
// Root
|
|
8
|
+
base = "grid input",
|
|
9
|
+
gap = "gap-2",
|
|
10
|
+
padding = "p-3",
|
|
11
|
+
classes = "",
|
|
12
|
+
// Input: Add
|
|
13
|
+
inputBase = "input-ghost",
|
|
14
|
+
inputClasses = "",
|
|
15
|
+
// Tag List
|
|
16
|
+
tagListBase = "flex gap-2",
|
|
17
|
+
tagListClasses = "",
|
|
18
|
+
// Tag
|
|
19
|
+
tagBase = "chip",
|
|
20
|
+
tagBackground = "preset-filled",
|
|
21
|
+
tagClasses = "",
|
|
22
|
+
// Input: Edit
|
|
23
|
+
inputEditBase = "chip-input -translate-y-0.25",
|
|
24
|
+
tagEditBackground = "preset-outlined-surface-200-800",
|
|
25
|
+
inputEditClasses,
|
|
26
|
+
// Delete Button
|
|
27
|
+
buttonDeleteBase = "",
|
|
28
|
+
buttonDeleteClasses = "",
|
|
29
|
+
// State
|
|
30
|
+
stateDisabled = "disabled",
|
|
31
|
+
// Snippets
|
|
32
|
+
buttonDelete,
|
|
33
|
+
// Zag
|
|
34
|
+
...zagProps
|
|
35
|
+
} = $props();
|
|
36
|
+
const [snapshot, send] = useMachine(
|
|
37
|
+
tagsInput.machine({
|
|
38
|
+
id: useId(),
|
|
39
|
+
onValueChange: (details) => {
|
|
40
|
+
value = details.value;
|
|
41
|
+
}
|
|
42
|
+
}),
|
|
43
|
+
{
|
|
44
|
+
context: {
|
|
45
|
+
...zagProps,
|
|
46
|
+
get value() {
|
|
47
|
+
return $state.snapshot(value);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
const api = $derived(tagsInput.connect(snapshot, send, normalizeProps));
|
|
53
|
+
const rxDisabled = $derived(snapshot.context.disabled ? stateDisabled : "");
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<!-- @component Capture a set of values from users via input and suggestions. -->
|
|
57
|
+
|
|
58
|
+
<div {...api.getRootProps()} class="{base} {padding} {gap} {rxDisabled} {classes}" data-testid="tags">
|
|
59
|
+
<!-- Input -->
|
|
60
|
+
<input {...api.getInputProps()} {placeholder} class="{inputBase} {inputClasses}" data-testid="tags-input-add" />
|
|
61
|
+
<!-- Tag List -->
|
|
62
|
+
{#if api.value.length > 0}
|
|
63
|
+
<div class="{tagListBase} {tagListClasses}" data-testid="tags-list">
|
|
64
|
+
{#each api.value as value, index (value)}
|
|
65
|
+
{@const itemState = api.getItemState({ index, value })}
|
|
66
|
+
<!-- Tag -->
|
|
67
|
+
<div {...api.getItemProps({ value, index })} data-testid="tags-tag">
|
|
68
|
+
<!-- Display -->
|
|
69
|
+
<div
|
|
70
|
+
{...api.getItemPreviewProps({ index, value })}
|
|
71
|
+
class="{tagBase} {tagBackground} {tagClasses}"
|
|
72
|
+
style:display={itemState.editing ? 'none' : ''}
|
|
73
|
+
data-testid="tag-display"
|
|
74
|
+
>
|
|
75
|
+
<span>{value}</span>
|
|
76
|
+
<!-- Delete Button -->
|
|
77
|
+
<button
|
|
78
|
+
{...api.getItemDeleteTriggerProps({ index, value })}
|
|
79
|
+
class="{buttonDeleteBase} {buttonDeleteClasses}"
|
|
80
|
+
data-testid="tag-delete"
|
|
81
|
+
>
|
|
82
|
+
{#if buttonDelete}
|
|
83
|
+
{@render buttonDelete()}
|
|
84
|
+
{:else}
|
|
85
|
+
<strong>×</strong>
|
|
86
|
+
{/if}
|
|
87
|
+
</button>
|
|
88
|
+
</div>
|
|
89
|
+
<!-- Editing -->
|
|
90
|
+
<input
|
|
91
|
+
{...api.getItemInputProps({ index, value })}
|
|
92
|
+
class="{inputEditBase} {tagEditBackground} {inputEditClasses}"
|
|
93
|
+
style:display={itemState.editing ? '' : 'none'}
|
|
94
|
+
data-testid="tags-input-edit"
|
|
95
|
+
/>
|
|
96
|
+
</div>
|
|
97
|
+
{/each}
|
|
98
|
+
</div>
|
|
99
|
+
{/if}
|
|
100
|
+
</div>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TagsInputProps } from './types.js';
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: Props & {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports;
|
|
10
|
+
z_$$bindings?: Bindings;
|
|
11
|
+
}
|
|
12
|
+
/** Capture a set of values from users via input and suggestions. */
|
|
13
|
+
declare const TagsInput: $$__sveltets_2_IsomorphicComponent<TagsInputProps, {
|
|
14
|
+
[evt: string]: CustomEvent<any>;
|
|
15
|
+
}, {}, {}, "value">;
|
|
16
|
+
type TagsInput = InstanceType<typeof TagsInput>;
|
|
17
|
+
export default TagsInput;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as tagsInput from '@zag-js/tags-input';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
export interface TagsInputProps extends Omit<tagsInput.Context, 'id' | 'value'> {
|
|
4
|
+
/** Set the tag values. */
|
|
5
|
+
value?: tagsInput.Context['value'];
|
|
6
|
+
/** Set the add tag input placeholder. */
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
/** Set base classes for the root. */
|
|
9
|
+
base?: string;
|
|
10
|
+
/** Set gap classes for the root. */
|
|
11
|
+
gap?: string;
|
|
12
|
+
/** Set padding classes for the root. */
|
|
13
|
+
padding?: string;
|
|
14
|
+
/** Provide arbitrary classes to the root. */
|
|
15
|
+
classes?: string;
|
|
16
|
+
/** Set base classes for the add tag input. */
|
|
17
|
+
inputBase?: string;
|
|
18
|
+
/** Provide arbitrary classes to the add tag input. */
|
|
19
|
+
inputClasses?: string;
|
|
20
|
+
/** Set base classes for the tag list. */
|
|
21
|
+
tagListBase?: string;
|
|
22
|
+
/** Provide arbitrary classes to the tag list. */
|
|
23
|
+
tagListClasses?: string;
|
|
24
|
+
/** Set base classes for each tag. */
|
|
25
|
+
tagBase?: string;
|
|
26
|
+
/** Set background classes for each tag. */
|
|
27
|
+
tagBackground?: string;
|
|
28
|
+
/** Provide arbitrary classes to each tag. */
|
|
29
|
+
tagClasses?: string;
|
|
30
|
+
/** Set base classes for the edit tag input. */
|
|
31
|
+
inputEditBase?: string;
|
|
32
|
+
/** Set background classes for the edit tag input. */
|
|
33
|
+
tagEditBackground?: string;
|
|
34
|
+
/** Provide arbitrary classes to the edit tag input. */
|
|
35
|
+
inputEditClasses?: string;
|
|
36
|
+
/** Set base classes for the delete button. */
|
|
37
|
+
buttonDeleteBase?: string;
|
|
38
|
+
/** Provide arbitrary classes to the delete button. */
|
|
39
|
+
buttonDeleteClasses?: string;
|
|
40
|
+
/** Set the component disabled state. */
|
|
41
|
+
stateDisabled?: string;
|
|
42
|
+
/** The delete button label snippet. */
|
|
43
|
+
buttonDelete?: Snippet;
|
|
44
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import * as tagsInput from '@zag-js/tags-input';
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { default as Accordion } from './components/Accordion/index.js';
|
|
|
2
2
|
export { default as AppBar } from './components/AppBar/AppBar.svelte';
|
|
3
3
|
export { default as Avatar } from './components/Avatar/Avatar.svelte';
|
|
4
4
|
export { default as FileUpload } from './components/FileUpload/FileUpload.svelte';
|
|
5
|
+
export { default as Pagination } from './components/Pagination/Pagination.svelte';
|
|
5
6
|
export { default as Progress } from './components/Progress/Progress.svelte';
|
|
6
7
|
export { default as ProgressRing } from './components/ProgressRing/ProgressRing.svelte';
|
|
7
8
|
export { default as Nav } from './components/Nav/index.js';
|
|
@@ -9,4 +10,6 @@ export { default as Segment } from './components/Segment/index.js';
|
|
|
9
10
|
export { default as Slider } from './components/Slider/Slider.svelte';
|
|
10
11
|
export { default as Switch } from './components/Switch/Switch.svelte';
|
|
11
12
|
export { default as Tabs } from './components/Tab/index.js';
|
|
13
|
+
export { default as TagsInput } from './components/TagsInput/TagsInput.svelte';
|
|
12
14
|
export { default as Rating } from './components/Rating/index.js';
|
|
15
|
+
export type { FileUploadApi } from './components/FileUpload/types.js';
|
package/dist/index.js
CHANGED
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
// Do not export parent/child components. Use the dot-notation composition pattern:
|
|
4
4
|
// https://next.skeleton.dev/docs/resources/contribute/components#dot-notation-syntax
|
|
5
5
|
// (See Accordion, Nav, and Tabs for examples)
|
|
6
|
+
// Components
|
|
6
7
|
export { default as Accordion } from './components/Accordion/index.js';
|
|
7
8
|
export { default as AppBar } from './components/AppBar/AppBar.svelte';
|
|
8
9
|
export { default as Avatar } from './components/Avatar/Avatar.svelte';
|
|
9
10
|
export { default as FileUpload } from './components/FileUpload/FileUpload.svelte';
|
|
11
|
+
export { default as Pagination } from './components/Pagination/Pagination.svelte';
|
|
10
12
|
export { default as Progress } from './components/Progress/Progress.svelte';
|
|
11
13
|
export { default as ProgressRing } from './components/ProgressRing/ProgressRing.svelte';
|
|
12
14
|
export { default as Nav } from './components/Nav/index.js';
|
|
@@ -14,4 +16,5 @@ export { default as Segment } from './components/Segment/index.js';
|
|
|
14
16
|
export { default as Slider } from './components/Slider/Slider.svelte';
|
|
15
17
|
export { default as Switch } from './components/Switch/Switch.svelte';
|
|
16
18
|
export { default as Tabs } from './components/Tab/index.js';
|
|
19
|
+
export { default as TagsInput } from './components/TagsInput/TagsInput.svelte';
|
|
17
20
|
export { default as Rating } from './components/Rating/index.js';
|
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.8",
|
|
4
4
|
"description": "The Svelte package for Skeleton.",
|
|
5
5
|
"author": "endigo9740 <chris@skeletonlabs.dev>",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -25,13 +25,15 @@
|
|
|
25
25
|
"@zag-js/accordion": "^0.65.1",
|
|
26
26
|
"@zag-js/avatar": "^0.65.1",
|
|
27
27
|
"@zag-js/file-upload": "^0.65.1",
|
|
28
|
+
"@zag-js/pagination": "^0.65.1",
|
|
28
29
|
"@zag-js/progress": "^0.65.1",
|
|
29
30
|
"@zag-js/radio-group": "^0.65.1",
|
|
30
31
|
"@zag-js/rating-group": "^0.65.1",
|
|
31
32
|
"@zag-js/slider": "^0.65.1",
|
|
32
33
|
"@zag-js/svelte": "^0.65.1",
|
|
33
34
|
"@zag-js/switch": "^0.65.1",
|
|
34
|
-
"@zag-js/tabs": "^0.65.1"
|
|
35
|
+
"@zag-js/tabs": "^0.65.1",
|
|
36
|
+
"@zag-js/tags-input": "^0.65.1"
|
|
35
37
|
},
|
|
36
38
|
"peerDependencies": {
|
|
37
39
|
"svelte": "^5.0.0-next.193"
|
|
@@ -47,7 +49,7 @@
|
|
|
47
49
|
"@testing-library/svelte": "^4.2.3",
|
|
48
50
|
"autoprefixer": "^10.4.19",
|
|
49
51
|
"jsdom": "^24.1.1",
|
|
50
|
-
"lucide-svelte": "^0.
|
|
52
|
+
"lucide-svelte": "^0.436.0",
|
|
51
53
|
"postcss": "^8.4.39",
|
|
52
54
|
"postcss-load-config": "^5.1.0",
|
|
53
55
|
"publint": "^0.1.16",
|