Skip to content

Commit

Permalink
Bugfix: reinstate Pagination count property (#3026)
Browse files Browse the repository at this point in the history
  • Loading branch information
endigo9740 authored Dec 5, 2024
1 parent e572bd6 commit 2a14a66
Show file tree
Hide file tree
Showing 9 changed files with 1,502 additions and 2,017 deletions.
6 changes: 6 additions & 0 deletions .changeset/blue-moles-swim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@skeletonlabs/skeleton-svelte': patch
'@skeletonlabs/skeleton-react': patch
---

bugfix: Reinstate Pagination `count` prop.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ export const Pagination: FC<PaginationProps> = ({
const [state, send] = useMachine(
pagination.machine({
id: useId(),
count: data.length
// Use 'count' if specified; required for server-side pagination.
count: zagProps.count ?? data.length
}),
{ context: zagProps }
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { ReactNode } from 'react';
import * as pagination from '@zag-js/pagination';

export interface PaginationProps extends Omit<pagination.Context, 'id'> {
export interface PaginationProps extends Omit<pagination.Context, 'id' | 'count'> {
// Provide source data as an array.
data: unknown[];
/** Total number of data items. Required for server-side pagination. */
count?: number;

// Enables alternative display with stats and first/last buttons.
alternative?: boolean;
/** Set the separator text or character, such as "of" in "X of Y". */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
return pageSize;
},
get count() {
return data.length;
// Use 'count' if specified; required for server-side pagination.
return zagProps.count ?? data.length;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import type { Snippet } from 'svelte';
import * as pagination from '@zag-js/pagination';

export interface PaginationProps extends Omit<pagination.Context, 'id' | 'page' | 'pageSize' | 'count'> {
// Provide source data as an array.
data: unknown[];
/** Total number of data items. Required for server-side pagination. */
count?: number;
/** Bind the current page. */
page: number;
/** Bind the number of data items to display. */
pageSize: number;

// Provide source data as an array.
data: unknown[];
// Enables alternative display with stats and first/last buttons.
alternative?: boolean;
/** Set the separator text or character, such as "of" in "X of Y". */
Expand Down
4 changes: 3 additions & 1 deletion packages/skeleton-svelte/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import { skeleton } from '@skeletonlabs/skeleton/plugin';
import * as themes from '@skeletonlabs/skeleton/themes';

import forms from '@tailwindcss/forms';

/** @type {import('tailwindcss').Config}*/
export default {
darkMode: 'class',
Expand All @@ -12,7 +14,7 @@ export default {
extend: {}
},
plugins: [
require('@tailwindcss/forms'),
forms,
skeleton({
themes: [themes.cerberus, themes.catppuccin, themes.pine, themes.rose]
})
Expand Down
Loading

0 comments on commit 2a14a66

Please sign in to comment.