@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 CHANGED
@@ -8,7 +8,7 @@ This project has been created using a [SvelteKit](https://kit.svelte.dev/) proje
8
8
 
9
9
  ## Exports
10
10
 
11
- Library exports are contained within `/src/lib/index.ts`
11
+ Library exports are contained within `/src/lib/migrate.ts`
12
12
 
13
13
  ## Dev
14
14
 
@@ -28,6 +28,7 @@
28
28
  accordion.machine({
29
29
  id: useId(),
30
30
  onValueChange(details) {
31
+ zagProps.onValueChange?.(details);
31
32
  value = details.value;
32
33
  }
33
34
  }),
@@ -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({ inputValue }) {
67
- const filtered = data.filter((item) => item.label.toLowerCase().includes(inputValue.toLowerCase()));
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
  }),
@@ -5,7 +5,7 @@
5
5
  let {
6
6
  value = $bindable(''),
7
7
  // Root
8
- base = 'h-full flex flex-col',
8
+ base = 'flex flex-col',
9
9
  background = 'preset-filled-surface-100-900',
10
10
  width = 'min-w-[320px] w-full',
11
11
  height = 'h-20',
@@ -1,4 +1,4 @@
1
- <!-- Navigation Bar Test Copmonent -->
1
+ <!-- Navigation Bar Test Component -->
2
2
 
3
3
  <script lang="ts">
4
4
  import { Navigation } from '../../index.js';
@@ -1,4 +1,4 @@
1
- <!-- Navigation Rail Test Copmonent -->
1
+ <!-- Navigation Rail Test Component -->
2
2
 
3
3
  <script lang="ts">
4
4
  import { Navigation } from '../../index.js';
@@ -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 Navgiation component tile. -->
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 Navgiation component tile. */
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
- count: data.length,
50
- onPageChange(details) {
51
- page = details.page;
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
- get page() {
61
- return page;
62
- },
63
- get pageSize() {
64
- return pageSize;
57
+ onPageChange(details) {
58
+ zagProps.onPageChange?.(details);
59
+ page = details.page;
65
60
  },
66
- get count() {
67
- // Use 'count' if specified; required for server-side pagination.
68
- return zagProps.count ?? data.length;
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}`;
@@ -43,6 +43,7 @@
43
43
  id: useId(),
44
44
  open,
45
45
  onOpenChange(details) {
46
+ zagProps.onOpenChange?.(details);
46
47
  open = details.open;
47
48
  }
48
49
  }),
@@ -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' | 'onValueChange'> {
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
  }
@@ -43,6 +43,7 @@
43
43
  radio.machine({
44
44
  id: useId(),
45
45
  onValueChange(details) {
46
+ zagProps.onValueChange?.(details);
46
47
  value = details.value;
47
48
  },
48
49
  orientation
@@ -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' | 'onValueChange'> {
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. */
@@ -57,6 +57,7 @@
57
57
  slider.machine({
58
58
  id: useId(),
59
59
  onValueChange(details) {
60
+ zagProps.onValueChange?.(details);
60
61
  value = details.value;
61
62
  }
62
63
  }),
@@ -33,6 +33,7 @@
33
33
  tabs.machine({
34
34
  id: useId(),
35
35
  onValueChange(details) {
36
+ zagProps.onValueChange?.(details);
36
37
  value = details.value;
37
38
  }
38
39
  }),
@@ -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' | 'onValueChange'> {
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. */
@@ -43,6 +43,7 @@
43
43
  tagsInput.machine({
44
44
  id: useId(),
45
45
  onValueChange: (details) => {
46
+ zagProps.onValueChange?.(details);
46
47
  value = details.value;
47
48
  }
48
49
  }),
@@ -9,7 +9,7 @@ describe('TagsInput', () => {
9
9
  delete: 'tag-delete'
10
10
  };
11
11
  const commonProps = {
12
- value: ['Vanilla', 'Chocolate', 'Stawberry']
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 accesss to the Toast Context API. */
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;
@@ -39,6 +39,7 @@
39
39
  id: useId(),
40
40
  open,
41
41
  onOpenChange(details) {
42
+ zagProps.onOpenChange?.(details);
42
43
  open = details.open;
43
44
  }
44
45
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skeletonlabs/skeleton-svelte",
3
- "version": "1.0.0-next.16",
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.6.2",
59
+ "svelte": "^5.19.0",
60
60
  "svelte-check": "^4.1.1",
61
61
  "tailwindcss": "^3.4.16",
62
62
  "tslib": "^2.8.1",