-
-
Notifications
You must be signed in to change notification settings - Fork 367
feature: First Page and Last Page buttons for svelte #3987
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
Merged
Hugos68
merged 18 commits into
skeletonlabs:main
from
Uncle798:PaginationFirstLastTrigger
Oct 28, 2025
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
dcad04d
feat: First Page and Last Page buttons
Uncle798 50099cd
Docs: Added example of first and last buttons
Uncle798 fdca475
docs: corrected wrong icon
Uncle798 f89cbd3
feat: Pagination first and last buttons
Uncle798 2ca734c
init
Uncle798 2bc93b4
init
Uncle798 cfac868
first prev next last
Uncle798 e138213
formatted
Uncle798 b0b8e4e
formatted
Uncle798 62e2500
fixed prop misplacement
Uncle798 d642b1d
added tests
Uncle798 29f26d8
fixed copy past mistake for PaginationLastTriggerProps
Uncle798 faecc64
is this what you mean by it's own closure?
Uncle798 00ce7ec
export types
Uncle798 053766d
formatted
Uncle798 742f113
Merge branch 'main' into PaginationFirstLastTrigger
Uncle798 60fb1ca
Merge branch 'main' of https://github.com/skeletonlabs/skeleton into …
Uncle798 3387e56
fix up last small odds
Hugos68 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| "@skeletonlabs/skeleton-common": minor | ||
| "@skeletonlabs/skeleton-svelte": minor | ||
| "@skeletonlabs/skeleton-react": minor | ||
| --- | ||
|
|
||
| feat: `Pagination.FirstTrigger` and `Pagination.LastTrigger` | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/skeleton-react/src/components/pagination/anatomy/first-trigger.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import { RootContext } from '../modules/root-context.js'; | ||
| import type { HTMLAttributes } from '@/internal/html-attributes.js'; | ||
| import type { PropsWithElement } from '@/internal/props-with-element.js'; | ||
| import { classesPagination } from '@skeletonlabs/skeleton-common'; | ||
| import { mergeProps } from '@zag-js/react'; | ||
| import { use } from 'react'; | ||
|
|
||
| export interface PaginationFirstTriggerProps extends PropsWithElement<'button'>, HTMLAttributes<'button'> {} | ||
|
|
||
| export default function FirstTrigger(props: PaginationFirstTriggerProps) { | ||
| const pagination = use(RootContext); | ||
|
|
||
| const { element, children, ...rest } = props; | ||
|
|
||
| const attributes = mergeProps( | ||
| { | ||
| className: classesPagination.nextTrigger, | ||
| onClick: pagination.goToFirstPage, | ||
| }, | ||
| rest, | ||
| ); | ||
|
|
||
| return element ? element(attributes) : <button {...attributes}>{children}</button>; | ||
| } |
24 changes: 24 additions & 0 deletions
24
packages/skeleton-react/src/components/pagination/anatomy/last-trigger.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import { RootContext } from '../modules/root-context.js'; | ||
| import type { HTMLAttributes } from '@/internal/html-attributes.js'; | ||
| import type { PropsWithElement } from '@/internal/props-with-element.js'; | ||
| import { classesPagination } from '@skeletonlabs/skeleton-common'; | ||
| import { mergeProps } from '@zag-js/react'; | ||
| import { use } from 'react'; | ||
|
|
||
| export interface PaginationLastTriggerProps extends PropsWithElement<'button'>, HTMLAttributes<'button'> {} | ||
|
|
||
| export default function LastTrigger(props: PaginationLastTriggerProps) { | ||
| const pagination = use(RootContext); | ||
|
|
||
| const { element, children, ...rest } = props; | ||
|
|
||
| const attributes = mergeProps( | ||
| { | ||
| className: classesPagination.nextTrigger, | ||
| onClick: pagination.goToLastPage, | ||
| }, | ||
| rest, | ||
| ); | ||
|
|
||
| return element ? element(attributes) : <button {...attributes}>{children}</button>; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
packages/skeleton-svelte/src/components/pagination/anatomy/first-trigger.svelte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| <script lang="ts" module> | ||
| import type { HTMLAttributes } from '@/internal/html-attributes.js'; | ||
| import type { PropsWithElement } from '@/internal/props-with-element.js'; | ||
|
|
||
| export interface PaginationFirstTriggerProps extends PropsWithElement<'button'>, HTMLAttributes<'button'> {} | ||
| </script> | ||
|
|
||
| <script lang="ts"> | ||
| import { RootContext } from '../modules/root-context.js'; | ||
| import { classesPagination } from '@skeletonlabs/skeleton-common'; | ||
| import { mergeProps } from '@zag-js/svelte'; | ||
|
|
||
| const props: PaginationFirstTriggerProps = $props(); | ||
|
|
||
| const pagination = RootContext.consume(); | ||
|
|
||
| const { element, children, ...rest } = $derived(props); | ||
|
|
||
| const attributes = $derived( | ||
| mergeProps( | ||
| { | ||
| class: classesPagination.firstTrigger, | ||
| onclick: () => pagination().goToFirstPage(), | ||
| }, | ||
| rest, | ||
| ), | ||
| ); | ||
| </script> | ||
|
|
||
| {#if element} | ||
| {@render element(attributes)} | ||
| {:else} | ||
| <button {...attributes}> | ||
| {@render children?.()} | ||
| </button> | ||
| {/if} |
36 changes: 36 additions & 0 deletions
36
packages/skeleton-svelte/src/components/pagination/anatomy/last-trigger.svelte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| <script lang="ts" module> | ||
| import type { HTMLAttributes } from '@/internal/html-attributes.js'; | ||
| import type { PropsWithElement } from '@/internal/props-with-element.js'; | ||
|
|
||
| export interface PaginationLastTriggerProps extends PropsWithElement<'button'>, HTMLAttributes<'button'> {} | ||
| </script> | ||
|
|
||
| <script lang="ts"> | ||
| import { RootContext } from '../modules/root-context.js'; | ||
| import { classesPagination } from '@skeletonlabs/skeleton-common'; | ||
| import { mergeProps } from '@zag-js/svelte'; | ||
|
|
||
| const props: PaginationLastTriggerProps = $props(); | ||
|
|
||
| const pagination = RootContext.consume(); | ||
|
|
||
| const { element, children, ...rest } = $derived(props); | ||
|
|
||
| const attributes = $derived( | ||
| mergeProps( | ||
| { | ||
| class: classesPagination.lastTrigger, | ||
| onclick: () => pagination().goToLastPage(), | ||
| }, | ||
| rest, | ||
| ), | ||
| ); | ||
| </script> | ||
|
|
||
| {#if element} | ||
| {@render element(attributes)} | ||
| {:else} | ||
| <button {...attributes}> | ||
| {@render children?.()} | ||
| </button> | ||
| {/if} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put it in front of Prev as it's First, Prev, Next, Last