Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: reinstate Pagination count property #3026

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading