@skeletonlabs/skeleton-svelte 1.0.0-next.16 → 1.0.0-next.18
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 +1 -0
- package/dist/components/Avatar/Avatar.svelte +2 -0
- package/dist/components/Avatar/Avatar.test.js +6 -0
- package/dist/components/Avatar/types.d.ts +2 -0
- package/dist/components/Combobox/Combobox.svelte +6 -3
- package/dist/components/Navigation/NavBar.svelte +1 -1
- package/dist/components/Navigation/NavBar.test.svelte +1 -1
- package/dist/components/Navigation/NavRail.test.svelte +1 -1
- package/dist/components/Navigation/NavTile.svelte +3 -2
- package/dist/components/Navigation/NavTile.svelte.d.ts +1 -1
- package/dist/components/Pagination/Pagination.svelte +22 -15
- package/dist/components/Popover/Popover.svelte +1 -0
- package/dist/components/Rating/Rating.svelte +1 -4
- package/dist/components/Rating/types.d.ts +1 -3
- package/dist/components/Segment/Segment.svelte +1 -0
- package/dist/components/Segment/types.d.ts +1 -1
- package/dist/components/Slider/Slider.svelte +1 -0
- package/dist/components/Tabs/Tabs.svelte +1 -0
- package/dist/components/Tabs/types.d.ts +1 -1
- package/dist/components/TagsInput/TagsInput.svelte +1 -0
- package/dist/components/TagsInput/TagsInput.test.js +1 -1
- package/dist/components/Toast/types.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.svelte +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
// Image
|
|
22
22
|
imageBase = 'w-full object-cover',
|
|
23
23
|
imageClasses = '',
|
|
24
|
+
style = '',
|
|
24
25
|
// Fallback
|
|
25
26
|
fallbackBase = 'w-full h-full flex justify-center items-center',
|
|
26
27
|
fallbackClasses = '',
|
|
@@ -54,6 +55,7 @@
|
|
|
54
55
|
class="{imageBase} {imageClasses}"
|
|
55
56
|
style:filter={filter && `url(${filter})`}
|
|
56
57
|
data-testid="avatar-image"
|
|
58
|
+
{style}
|
|
57
59
|
/>
|
|
58
60
|
{/if}
|
|
59
61
|
<!-- Fallback -->
|
|
@@ -40,6 +40,12 @@ describe('Avatar', () => {
|
|
|
40
40
|
expect(component).toHaveClass(value);
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
+
it('Correctly applies the `style` prop', () => {
|
|
44
|
+
const value = 'background-color: rgb(0, 128, 0); opacity: 0.5;';
|
|
45
|
+
render(Avatar, { src: test.src, name: test.name, style: value });
|
|
46
|
+
const component = screen.getByTestId(testIds.image);
|
|
47
|
+
expect(component).toHaveStyle(value);
|
|
48
|
+
});
|
|
43
49
|
});
|
|
44
50
|
describe('Fallback', () => {
|
|
45
51
|
it('Renders fallback initials', () => {
|
|
@@ -28,6 +28,8 @@ export interface AvatarProps {
|
|
|
28
28
|
imageBase?: string;
|
|
29
29
|
/** Provide avatar image arbitrary CSS classes. */
|
|
30
30
|
imageClasses?: string;
|
|
31
|
+
/** Set avatar image styles. */
|
|
32
|
+
style?: string;
|
|
31
33
|
/** Set base classes for the fallback element. */
|
|
32
34
|
fallbackBase?: string;
|
|
33
35
|
/** Provide arbitrary CSS classes to fallback element. */
|
|
@@ -60,16 +60,19 @@
|
|
|
60
60
|
collection,
|
|
61
61
|
value: $state.snapshot(value),
|
|
62
62
|
loopFocus: true,
|
|
63
|
-
onOpenChange() {
|
|
63
|
+
onOpenChange(details) {
|
|
64
|
+
zagProps.onOpenChange?.(details);
|
|
64
65
|
options = data;
|
|
65
66
|
},
|
|
66
|
-
onInputValueChange(
|
|
67
|
-
|
|
67
|
+
onInputValueChange(details) {
|
|
68
|
+
zagProps.onInputValueChange?.(details);
|
|
69
|
+
const filtered = data.filter((item) => item.label.toLowerCase().includes(details.inputValue.toLowerCase()));
|
|
68
70
|
const newOptions = filtered.length > 0 ? filtered : data;
|
|
69
71
|
collection.setItems(newOptions);
|
|
70
72
|
options = newOptions;
|
|
71
73
|
},
|
|
72
74
|
onValueChange(event) {
|
|
75
|
+
zagProps.onValueChange?.(event);
|
|
73
76
|
value = event.value;
|
|
74
77
|
}
|
|
75
78
|
}),
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { useId } from '../../internal/use-id.js';
|
|
2
3
|
import { getNavigationContext } from './context.js';
|
|
3
4
|
import type { NavTileProps } from './types.js';
|
|
4
5
|
|
|
5
6
|
let {
|
|
6
|
-
id,
|
|
7
|
+
id = useId(),
|
|
7
8
|
href,
|
|
8
9
|
target,
|
|
9
10
|
label,
|
|
@@ -57,7 +58,7 @@
|
|
|
57
58
|
}
|
|
58
59
|
</script>
|
|
59
60
|
|
|
60
|
-
<!-- @component An individual
|
|
61
|
+
<!-- @component An individual Navigation component tile. -->
|
|
61
62
|
|
|
62
63
|
<svelte:element
|
|
63
64
|
this={element}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { NavTileProps } from './types.js';
|
|
2
|
-
/** An individual
|
|
2
|
+
/** An individual Navigation component tile. */
|
|
3
3
|
declare const NavTile: import("svelte").Component<NavTileProps, {}, "">;
|
|
4
4
|
type NavTile = ReturnType<typeof NavTile>;
|
|
5
5
|
export default NavTile;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import type { PaginationProps } from './types.js';
|
|
6
6
|
import { useId } from '../../internal/use-id.js';
|
|
7
|
+
import { untrack } from 'svelte';
|
|
7
8
|
|
|
8
9
|
let {
|
|
9
10
|
page = $bindable(1),
|
|
@@ -46,32 +47,38 @@
|
|
|
46
47
|
const [snapshot, send] = useMachine(
|
|
47
48
|
pagination.machine({
|
|
48
49
|
id: useId(),
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
onPageSizeChange(details) {
|
|
54
|
-
pageSize = details.pageSize;
|
|
55
|
-
}
|
|
50
|
+
page: page,
|
|
51
|
+
pageSize: pageSize,
|
|
52
|
+
count: zagProps.count ?? data.length
|
|
56
53
|
}),
|
|
57
54
|
{
|
|
58
55
|
context: {
|
|
59
56
|
...zagProps,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
get pageSize() {
|
|
64
|
-
return pageSize;
|
|
57
|
+
onPageChange(details) {
|
|
58
|
+
zagProps.onPageChange?.(details);
|
|
59
|
+
page = details.page;
|
|
65
60
|
},
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
61
|
+
onPageSizeChange(details) {
|
|
62
|
+
zagProps.onPageSizeChange?.(details);
|
|
63
|
+
pageSize = details.pageSize;
|
|
69
64
|
}
|
|
70
65
|
}
|
|
71
66
|
}
|
|
72
67
|
);
|
|
73
68
|
const api = $derived(pagination.connect(snapshot, send, normalizeProps));
|
|
74
69
|
|
|
70
|
+
$effect.pre(() => {
|
|
71
|
+
untrack(() => api).setPage(page);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
$effect.pre(() => {
|
|
75
|
+
untrack(() => api).setPageSize(pageSize);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
$effect.pre(() => {
|
|
79
|
+
untrack(() => api).setCount(zagProps.count ?? data.length);
|
|
80
|
+
});
|
|
81
|
+
|
|
75
82
|
// Reactive
|
|
76
83
|
const rxButtonActive = (page: { value: number }) => {
|
|
77
84
|
return snapshot.context.page === page.value ? buttonActive : `${buttonInactive} ${buttonHover}`;
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
import { useId } from '../../internal/use-id.js';
|
|
5
5
|
import { starEmpty, starHalf, starFull } from '../../internal/snippets.js';
|
|
6
6
|
import type { RatingProps } from './types.js';
|
|
7
|
-
import { noop } from '../../internal/noop.js';
|
|
8
7
|
|
|
9
8
|
// Props
|
|
10
9
|
let {
|
|
@@ -32,8 +31,6 @@
|
|
|
32
31
|
iconFull = starFull,
|
|
33
32
|
// Children
|
|
34
33
|
label,
|
|
35
|
-
// Events
|
|
36
|
-
onValueChange = noop,
|
|
37
34
|
// Zag
|
|
38
35
|
...zagProps
|
|
39
36
|
}: RatingProps = $props();
|
|
@@ -43,8 +40,8 @@
|
|
|
43
40
|
rating.machine({
|
|
44
41
|
id: useId(),
|
|
45
42
|
onValueChange: (details) => {
|
|
43
|
+
zagProps.onValueChange?.(details);
|
|
46
44
|
value = details.value;
|
|
47
|
-
onValueChange(details.value);
|
|
48
45
|
}
|
|
49
46
|
}),
|
|
50
47
|
{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as rating from '@zag-js/rating-group';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
export interface RatingProps extends Omit<rating.Context, 'id'
|
|
3
|
+
export interface RatingProps extends Omit<rating.Context, 'id'> {
|
|
4
4
|
/** Set root base classes */
|
|
5
5
|
base?: string;
|
|
6
6
|
/** Set root gap classes */
|
|
@@ -35,6 +35,4 @@ export interface RatingProps extends Omit<rating.Context, 'id' | 'onValueChange'
|
|
|
35
35
|
iconFull?: Snippet;
|
|
36
36
|
/** Set the label snippet */
|
|
37
37
|
label?: Snippet;
|
|
38
|
-
/** Set the onValueChange callback */
|
|
39
|
-
onValueChange?: (value: number) => void;
|
|
40
38
|
}
|
|
@@ -4,7 +4,7 @@ export interface SegmentContext {
|
|
|
4
4
|
api: ReturnType<typeof radio.connect>;
|
|
5
5
|
indicatorText: string;
|
|
6
6
|
}
|
|
7
|
-
export interface SegmentProps extends Omit<radio.Context, 'id' | 'orientation'
|
|
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. */
|
|
@@ -4,7 +4,7 @@ export interface TabsContextState {
|
|
|
4
4
|
fluid: boolean;
|
|
5
5
|
api: ReturnType<typeof tabs.connect>;
|
|
6
6
|
}
|
|
7
|
-
export interface TabsProps extends Omit<tabs.Context, 'id' | 'orientation'
|
|
7
|
+
export interface TabsProps extends Omit<tabs.Context, 'id' | 'orientation'> {
|
|
8
8
|
/** Set the active value. */
|
|
9
9
|
value?: string;
|
|
10
10
|
/** Set tabs to stretch to fill the available width. */
|
|
@@ -9,7 +9,7 @@ describe('TagsInput', () => {
|
|
|
9
9
|
delete: 'tag-delete'
|
|
10
10
|
};
|
|
11
11
|
const commonProps = {
|
|
12
|
-
value: ['Vanilla', 'Chocolate', '
|
|
12
|
+
value: ['Vanilla', 'Chocolate', 'Strawberry']
|
|
13
13
|
};
|
|
14
14
|
it('Renders the component', () => {
|
|
15
15
|
render(TagsInput, { ...commonProps });
|
|
@@ -21,7 +21,7 @@ export interface Toast {
|
|
|
21
21
|
/** The duration of the toast. Default varies by type. */
|
|
22
22
|
duration?: number;
|
|
23
23
|
}
|
|
24
|
-
/** Provides
|
|
24
|
+
/** Provides access to the Toast Context API. */
|
|
25
25
|
export interface ToastContext {
|
|
26
26
|
/** Used to create display a new Toast instance. */
|
|
27
27
|
create: (toast: Toast) => void;
|
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.18",
|
|
4
4
|
"description": "The Svelte package for Skeleton.",
|
|
5
5
|
"author": "endigo9740 <chris@skeletonlabs.dev>",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"postcss": "^8.4.49",
|
|
57
57
|
"postcss-load-config": "^6.0.1",
|
|
58
58
|
"publint": "^0.2.12",
|
|
59
|
-
"svelte": "^5.
|
|
59
|
+
"svelte": "^5.19.0",
|
|
60
60
|
"svelte-check": "^4.1.1",
|
|
61
61
|
"tailwindcss": "^3.4.16",
|
|
62
62
|
"tslib": "^2.8.1",
|