sv5ui 1.1.2 → 1.2.0
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 +6 -0
- package/dist/Alert/Alert.svelte +33 -22
- package/dist/Alert/Alert.svelte.d.ts +1 -1
- package/dist/Alert/alert.types.d.ts +4 -0
- package/dist/Avatar/Avatar.svelte +72 -46
- package/dist/Avatar/avatar.types.d.ts +36 -3
- package/dist/Avatar/avatar.variants.d.ts +138 -0
- package/dist/Avatar/avatar.variants.js +23 -12
- package/dist/Avatar/index.d.ts +1 -1
- package/dist/AvatarGroup/AvatarGroup.svelte +11 -6
- package/dist/AvatarGroup/AvatarGroup.svelte.d.ts +1 -1
- package/dist/AvatarGroup/avatar-group.types.d.ts +18 -3
- package/dist/AvatarGroup/avatar-group.variants.d.ts +85 -0
- package/dist/AvatarGroup/avatar-group.variants.js +19 -29
- package/dist/Badge/Badge.svelte +4 -3
- package/dist/Badge/Badge.svelte.d.ts +1 -1
- package/dist/Badge/badge.types.d.ts +9 -0
- package/dist/Breadcrumb/Breadcrumb.svelte +20 -7
- package/dist/Breadcrumb/Breadcrumb.svelte.d.ts +1 -1
- package/dist/Breadcrumb/breadcrumb.types.d.ts +5 -1
- package/dist/Breadcrumb/breadcrumb.variants.d.ts +15 -5
- package/dist/Breadcrumb/breadcrumb.variants.js +7 -3
- package/dist/Button/Button.svelte +71 -16
- package/dist/Button/Button.svelte.d.ts +0 -1
- package/dist/Button/button.types.d.ts +61 -2
- package/dist/Calendar/Calendar.svelte +4 -0
- package/dist/Calendar/Calendar.svelte.d.ts +1 -1
- package/dist/Calendar/calendar.types.d.ts +4 -0
- package/dist/Card/Card.svelte +5 -4
- package/dist/Card/Card.svelte.d.ts +1 -1
- package/dist/Card/card.types.d.ts +5 -1
- package/dist/Checkbox/Checkbox.svelte +37 -11
- package/dist/Checkbox/Checkbox.svelte.d.ts +1 -1
- package/dist/Checkbox/checkbox.types.d.ts +16 -1
- package/dist/Checkbox/checkbox.variants.d.ts +90 -0
- package/dist/Checkbox/checkbox.variants.js +73 -4
- package/dist/Chip/Chip.svelte +3 -2
- package/dist/Chip/Chip.svelte.d.ts +1 -1
- package/dist/Chip/chip.types.d.ts +5 -1
- package/dist/Chip/chip.variants.d.ts +135 -45
- package/dist/Chip/chip.variants.js +9 -9
- package/dist/ContextMenu/ContextMenu.svelte +87 -77
- package/dist/ContextMenu/ContextMenu.svelte.d.ts +1 -1
- package/dist/ContextMenu/context-menu.types.d.ts +9 -3
- package/dist/ContextMenu/context-menu.types.js +1 -1
- package/dist/ContextMenu/context-menu.variants.d.ts +74 -160
- package/dist/ContextMenu/context-menu.variants.js +63 -95
- package/dist/DropdownMenu/DropdownMenu.svelte +37 -43
- package/dist/DropdownMenu/DropdownMenu.svelte.d.ts +1 -1
- package/dist/DropdownMenu/dropdown-menu.types.d.ts +9 -3
- package/dist/DropdownMenu/dropdown-menu.types.js +1 -1
- package/dist/DropdownMenu/dropdown-menu.variants.d.ts +79 -230
- package/dist/DropdownMenu/dropdown-menu.variants.js +68 -111
- package/dist/DropdownMenu/index.d.ts +1 -1
- package/dist/Empty/Empty.svelte +68 -33
- package/dist/Empty/Empty.svelte.d.ts +1 -1
- package/dist/Empty/empty.types.d.ts +26 -9
- package/dist/Empty/empty.variants.d.ts +150 -130
- package/dist/Empty/empty.variants.js +33 -324
- package/dist/FieldGroup/FieldGroup.svelte +11 -6
- package/dist/FieldGroup/FieldGroup.svelte.d.ts +1 -1
- package/dist/FieldGroup/field-group.types.d.ts +4 -0
- package/dist/FormField/FormField.svelte +17 -18
- package/dist/FormField/FormField.svelte.d.ts +1 -1
- package/dist/FormField/form-field.types.d.ts +4 -0
- package/dist/Icon/Icon.svelte +13 -7
- package/dist/Icon/icon.types.d.ts +18 -9
- package/dist/Input/Input.svelte +30 -29
- package/dist/Kbd/Kbd.svelte +13 -3
- package/dist/Kbd/Kbd.svelte.d.ts +1 -1
- package/dist/Kbd/index.d.ts +1 -1
- package/dist/Kbd/kbd.types.d.ts +15 -1
- package/dist/Kbd/kbd.variants.d.ts +92 -30
- package/dist/Kbd/kbd.variants.js +55 -35
- package/dist/Kbd/useKbd.svelte.d.ts +2 -2
- package/dist/Kbd/useKbd.svelte.js +34 -41
- package/dist/Link/Link.svelte +69 -24
- package/dist/Link/Link.svelte.d.ts +1 -1
- package/dist/Link/link.types.d.ts +26 -8
- package/dist/Link/link.variants.d.ts +35 -60
- package/dist/Link/link.variants.js +8 -110
- package/dist/Modal/Modal.svelte +9 -1
- package/dist/Modal/modal.types.d.ts +5 -0
- package/dist/Modal/modal.variants.d.ts +5 -0
- package/dist/Modal/modal.variants.js +1 -0
- package/dist/Pagination/Pagination.svelte +143 -94
- package/dist/Pagination/Pagination.svelte.d.ts +1 -1
- package/dist/Pagination/index.d.ts +1 -1
- package/dist/Pagination/pagination.types.d.ts +21 -2
- package/dist/Pagination/pagination.variants.d.ts +21 -387
- package/dist/Pagination/pagination.variants.js +63 -59
- package/dist/Popover/Popover.svelte +9 -12
- package/dist/Popover/Popover.svelte.d.ts +1 -1
- package/dist/Popover/popover.types.d.ts +4 -0
- package/dist/Popover/popover.variants.d.ts +5 -75
- package/dist/Popover/popover.variants.js +6 -16
- package/dist/Progress/Progress.svelte +58 -30
- package/dist/Progress/progress.types.d.ts +9 -1
- package/dist/Progress/progress.variants.d.ts +55 -25
- package/dist/Progress/progress.variants.js +34 -28
- package/dist/RadioGroup/RadioGroup.svelte +105 -61
- package/dist/RadioGroup/RadioGroup.svelte.d.ts +1 -1
- package/dist/RadioGroup/radio-group.types.d.ts +16 -1
- package/dist/RadioGroup/radio-group.variants.d.ts +90 -0
- package/dist/RadioGroup/radio-group.variants.js +73 -4
- package/dist/Select/Select.svelte +9 -6
- package/dist/Select/Select.svelte.d.ts +1 -1
- package/dist/Select/select.types.d.ts +4 -0
- package/dist/SelectMenu/SelectMenu.svelte +436 -0
- package/dist/SelectMenu/SelectMenu.svelte.d.ts +5 -0
- package/dist/SelectMenu/index.d.ts +2 -0
- package/dist/SelectMenu/index.js +1 -0
- package/dist/SelectMenu/select-menu.types.d.ts +262 -0
- package/dist/SelectMenu/select-menu.types.js +1 -0
- package/dist/SelectMenu/select-menu.variants.d.ts +759 -0
- package/dist/SelectMenu/select-menu.variants.js +33 -0
- package/dist/Separator/Separator.svelte +1 -2
- package/dist/Separator/separator.variants.d.ts +1 -5
- package/dist/Separator/separator.variants.js +2 -2
- package/dist/Skeleton/Skeleton.svelte +18 -2
- package/dist/Skeleton/Skeleton.svelte.d.ts +1 -1
- package/dist/Skeleton/skeleton.types.d.ts +10 -1
- package/dist/Slideover/Slideover.svelte +9 -1
- package/dist/Slideover/slideover.types.d.ts +5 -0
- package/dist/Slideover/slideover.variants.d.ts +20 -5
- package/dist/Slideover/slideover.variants.js +4 -29
- package/dist/Switch/Switch.svelte +32 -31
- package/dist/Switch/Switch.svelte.d.ts +1 -1
- package/dist/Switch/switch.types.d.ts +6 -1
- package/dist/Switch/switch.variants.js +6 -6
- package/dist/Tabs/Tabs.svelte +6 -9
- package/dist/Tabs/Tabs.svelte.d.ts +1 -1
- package/dist/Tabs/tabs.types.d.ts +4 -0
- package/dist/Tabs/tabs.variants.js +2 -0
- package/dist/Textarea/Textarea.svelte +26 -25
- package/dist/ThemeModeButton/theme-mode-button.types.d.ts +7 -2
- package/dist/Timeline/Timeline.svelte +62 -19
- package/dist/Timeline/Timeline.svelte.d.ts +1 -1
- package/dist/Timeline/index.d.ts +1 -1
- package/dist/Timeline/timeline.types.d.ts +8 -0
- package/dist/Tooltip/Tooltip.svelte +12 -10
- package/dist/Tooltip/Tooltip.svelte.d.ts +1 -1
- package/dist/Tooltip/tooltip.types.d.ts +8 -4
- package/dist/Tooltip/tooltip.variants.d.ts +10 -75
- package/dist/Tooltip/tooltip.variants.js +8 -17
- package/dist/User/User.svelte +13 -9
- package/dist/User/User.svelte.d.ts +1 -1
- package/dist/User/user.types.d.ts +4 -0
- package/dist/User/user.variants.d.ts +60 -0
- package/dist/User/user.variants.js +13 -1
- package/dist/config.d.ts +4 -0
- package/dist/config.js +4 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
|
@@ -113,6 +113,11 @@ export interface ModalProps extends RootProps, ContentProps {
|
|
|
113
113
|
* Custom description slot. Overrides the `description` prop when provided.
|
|
114
114
|
*/
|
|
115
115
|
descriptionSlot?: Snippet;
|
|
116
|
+
/**
|
|
117
|
+
* Actions slot rendered between the title/description wrapper
|
|
118
|
+
* and the close button inside the header.
|
|
119
|
+
*/
|
|
120
|
+
actions?: Snippet;
|
|
116
121
|
/**
|
|
117
122
|
* Body content rendered between the header and footer.
|
|
118
123
|
*/
|
|
@@ -38,6 +38,7 @@ export declare const modalVariants: import("tailwind-variants").TVReturnType<{
|
|
|
38
38
|
footer: string;
|
|
39
39
|
title: string;
|
|
40
40
|
description: string;
|
|
41
|
+
actions: string;
|
|
41
42
|
close: string;
|
|
42
43
|
}, undefined, {
|
|
43
44
|
transition: {
|
|
@@ -78,6 +79,7 @@ export declare const modalVariants: import("tailwind-variants").TVReturnType<{
|
|
|
78
79
|
footer: string;
|
|
79
80
|
title: string;
|
|
80
81
|
description: string;
|
|
82
|
+
actions: string;
|
|
81
83
|
close: string;
|
|
82
84
|
}, import("tailwind-variants").TVReturnType<{
|
|
83
85
|
transition: {
|
|
@@ -118,6 +120,7 @@ export declare const modalVariants: import("tailwind-variants").TVReturnType<{
|
|
|
118
120
|
footer: string;
|
|
119
121
|
title: string;
|
|
120
122
|
description: string;
|
|
123
|
+
actions: string;
|
|
121
124
|
close: string;
|
|
122
125
|
}, undefined, unknown, unknown, undefined>>;
|
|
123
126
|
export type ModalVariantProps = VariantProps<typeof modalVariants>;
|
|
@@ -162,6 +165,7 @@ export declare const modalDefaults: {
|
|
|
162
165
|
footer: string;
|
|
163
166
|
title: string;
|
|
164
167
|
description: string;
|
|
168
|
+
actions: string;
|
|
165
169
|
close: string;
|
|
166
170
|
}, {
|
|
167
171
|
transition: {
|
|
@@ -202,6 +206,7 @@ export declare const modalDefaults: {
|
|
|
202
206
|
footer: string;
|
|
203
207
|
title: string;
|
|
204
208
|
description: string;
|
|
209
|
+
actions: string;
|
|
205
210
|
close: string;
|
|
206
211
|
}>;
|
|
207
212
|
slots: Partial<Record<ModalSlots, string>>;
|
|
@@ -9,6 +9,7 @@ export const modalVariants = tv({
|
|
|
9
9
|
footer: 'flex items-center gap-1.5 p-4 sm:px-6',
|
|
10
10
|
title: 'text-on-surface font-semibold',
|
|
11
11
|
description: 'mt-1 text-on-surface-variant text-sm',
|
|
12
|
+
actions: 'flex items-center gap-1.5 shrink-0',
|
|
12
13
|
close: 'absolute top-4 end-4'
|
|
13
14
|
},
|
|
14
15
|
variants: {
|
|
@@ -7,14 +7,20 @@
|
|
|
7
7
|
<script lang="ts">
|
|
8
8
|
import { Pagination } from 'bits-ui'
|
|
9
9
|
import { untrack } from 'svelte'
|
|
10
|
-
import {
|
|
11
|
-
|
|
10
|
+
import {
|
|
11
|
+
paginationVariants,
|
|
12
|
+
paginationDefaults,
|
|
13
|
+
activeVariantColorClasses
|
|
14
|
+
} from './pagination.variants.js'
|
|
15
|
+
import { getComponentConfig, iconsDefaults } from '../config.js'
|
|
12
16
|
import Icon from '../Icon/Icon.svelte'
|
|
13
17
|
import ButtonComponent from '../Button/Button.svelte'
|
|
14
18
|
|
|
15
19
|
const config = getComponentConfig('pagination', paginationDefaults)
|
|
20
|
+
const icons = getComponentConfig('icons', iconsDefaults)
|
|
16
21
|
|
|
17
22
|
let {
|
|
23
|
+
ref = $bindable(null),
|
|
18
24
|
page = $bindable(),
|
|
19
25
|
defaultPage = 1,
|
|
20
26
|
total = 0,
|
|
@@ -25,12 +31,15 @@
|
|
|
25
31
|
disabled = false,
|
|
26
32
|
onPageChange,
|
|
27
33
|
size = config.defaultVariants.size ?? 'md',
|
|
34
|
+
variant = config.defaultVariants.variant ?? 'ghost',
|
|
35
|
+
color = config.defaultVariants.color ?? 'surface',
|
|
28
36
|
activeColor = config.defaultVariants.activeColor ?? 'primary',
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
activeVariant = config.defaultVariants.activeVariant ?? 'solid',
|
|
38
|
+
firstIcon = icons.chevronsLeft,
|
|
39
|
+
prevIcon = icons.chevronLeft,
|
|
40
|
+
nextIcon = icons.chevronRight,
|
|
41
|
+
lastIcon = icons.chevronsRight,
|
|
42
|
+
ellipsisIcon = icons.ellipsis,
|
|
34
43
|
ui,
|
|
35
44
|
class: className,
|
|
36
45
|
firstSlot,
|
|
@@ -51,45 +60,24 @@
|
|
|
51
60
|
const prevDisabled = $derived(disabled || isFirstPage)
|
|
52
61
|
const nextDisabled = $derived(disabled || isLastPage)
|
|
53
62
|
|
|
54
|
-
const variantSlots = $derived(paginationVariants({ size,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const uiSlot = ui?.[slot as keyof typeof ui]
|
|
59
|
-
return (variantSlots[slot] as (opts: { class: unknown[] }) => string)({
|
|
60
|
-
class: [configSlot, extra, uiSlot]
|
|
61
|
-
})
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const baseClasses = $derived.by(() => ({
|
|
65
|
-
root: resolveSlot('root', className),
|
|
66
|
-
list: resolveSlot('list'),
|
|
67
|
-
item: resolveSlot('item'),
|
|
68
|
-
ellipsis: resolveSlot('ellipsis'),
|
|
69
|
-
ellipsisIcon: resolveSlot('ellipsisIcon')
|
|
70
|
-
}))
|
|
71
|
-
|
|
72
|
-
const controlClasses = $derived.by(() =>
|
|
73
|
-
showControls
|
|
74
|
-
? {
|
|
75
|
-
prev: resolveSlot('prev'),
|
|
76
|
-
next: resolveSlot('next'),
|
|
77
|
-
prevIcon: resolveSlot('prevIcon'),
|
|
78
|
-
nextIcon: resolveSlot('nextIcon')
|
|
79
|
-
}
|
|
80
|
-
: null
|
|
81
|
-
)
|
|
82
|
-
|
|
83
|
-
const edgeClasses = $derived.by(() =>
|
|
84
|
-
showEdges
|
|
85
|
-
? {
|
|
86
|
-
first: resolveSlot('first'),
|
|
87
|
-
last: resolveSlot('last'),
|
|
88
|
-
firstIcon: resolveSlot('firstIcon'),
|
|
89
|
-
lastIcon: resolveSlot('lastIcon')
|
|
90
|
-
}
|
|
91
|
-
: null
|
|
63
|
+
const variantSlots = $derived(paginationVariants({ size, disabled }))
|
|
64
|
+
const activeCls = $derived(
|
|
65
|
+
activeVariantColorClasses[activeVariant]?.[activeColor] ??
|
|
66
|
+
activeVariantColorClasses.solid.primary
|
|
92
67
|
)
|
|
68
|
+
const classes = $derived({
|
|
69
|
+
root: variantSlots.root({ class: [config.slots.root, className] }),
|
|
70
|
+
list: variantSlots.list({ class: [config.slots.list, ui?.list] }),
|
|
71
|
+
item: variantSlots.item({ class: [config.slots.item, activeCls, ui?.item] }),
|
|
72
|
+
ellipsis: variantSlots.ellipsis({ class: [config.slots.ellipsis, ui?.ellipsis] }),
|
|
73
|
+
ellipsisIcon: variantSlots.ellipsisIcon({
|
|
74
|
+
class: [config.slots.ellipsisIcon, ui?.ellipsisIcon]
|
|
75
|
+
}),
|
|
76
|
+
first: variantSlots.first({ class: [config.slots.first, ui?.first] }),
|
|
77
|
+
prev: variantSlots.prev({ class: [config.slots.prev, ui?.prev] }),
|
|
78
|
+
next: variantSlots.next({ class: [config.slots.next, ui?.next] }),
|
|
79
|
+
last: variantSlots.last({ class: [config.slots.last, ui?.last] })
|
|
80
|
+
})
|
|
93
81
|
|
|
94
82
|
function handlePageChange(newPage: number) {
|
|
95
83
|
page = newPage
|
|
@@ -106,54 +94,85 @@
|
|
|
106
94
|
</script>
|
|
107
95
|
|
|
108
96
|
<Pagination.Root
|
|
97
|
+
bind:ref
|
|
109
98
|
count={total}
|
|
110
99
|
perPage={itemsPerPage}
|
|
111
100
|
{siblingCount}
|
|
112
101
|
{page}
|
|
113
102
|
onPageChange={handlePageChange}
|
|
114
|
-
class={
|
|
103
|
+
class={classes.root}
|
|
115
104
|
>
|
|
116
105
|
{#snippet children({ pages })}
|
|
117
|
-
<div class={
|
|
118
|
-
{#if
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
106
|
+
<div class={classes.list}>
|
|
107
|
+
{#if showEdges}
|
|
108
|
+
{#if firstSlot}
|
|
109
|
+
<ButtonComponent
|
|
110
|
+
{variant}
|
|
111
|
+
{color}
|
|
112
|
+
square
|
|
113
|
+
{size}
|
|
114
|
+
class={classes.first}
|
|
115
|
+
disabled={prevDisabled}
|
|
116
|
+
aria-label="First page"
|
|
117
|
+
onclick={goToFirst}
|
|
118
|
+
>
|
|
129
119
|
{@render firstSlot({ page: page!, disabled: prevDisabled })}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
120
|
+
</ButtonComponent>
|
|
121
|
+
{:else}
|
|
122
|
+
<ButtonComponent
|
|
123
|
+
{variant}
|
|
124
|
+
{color}
|
|
125
|
+
square
|
|
126
|
+
{size}
|
|
127
|
+
icon={firstIcon}
|
|
128
|
+
class={classes.first}
|
|
129
|
+
disabled={prevDisabled}
|
|
130
|
+
aria-label="First page"
|
|
131
|
+
onclick={goToFirst}
|
|
132
|
+
/>
|
|
133
|
+
{/if}
|
|
134
134
|
{/if}
|
|
135
135
|
|
|
136
|
-
{#if
|
|
137
|
-
<Pagination.PrevButton
|
|
138
|
-
{#
|
|
139
|
-
{
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
136
|
+
{#if showControls}
|
|
137
|
+
<Pagination.PrevButton disabled={prevDisabled}>
|
|
138
|
+
{#snippet child({ props })}
|
|
139
|
+
{#if prevSlot}
|
|
140
|
+
<ButtonComponent
|
|
141
|
+
{...props}
|
|
142
|
+
{variant}
|
|
143
|
+
{color}
|
|
144
|
+
square
|
|
145
|
+
{size}
|
|
146
|
+
class={classes.prev}
|
|
147
|
+
>
|
|
148
|
+
{@render prevSlot({ page: page!, disabled: prevDisabled })}
|
|
149
|
+
</ButtonComponent>
|
|
150
|
+
{:else}
|
|
151
|
+
<ButtonComponent
|
|
152
|
+
{...props}
|
|
153
|
+
{variant}
|
|
154
|
+
{color}
|
|
155
|
+
square
|
|
156
|
+
{size}
|
|
157
|
+
icon={prevIcon}
|
|
158
|
+
class={classes.prev}
|
|
159
|
+
/>
|
|
160
|
+
{/if}
|
|
161
|
+
{/snippet}
|
|
143
162
|
</Pagination.PrevButton>
|
|
144
163
|
{/if}
|
|
145
164
|
|
|
146
165
|
{#each pages as pageItem (pageItem.key)}
|
|
147
166
|
{#if pageItem.type === 'ellipsis'}
|
|
148
|
-
<span class={
|
|
167
|
+
<span class={classes.ellipsis}>
|
|
149
168
|
{#if ellipsisSlot}
|
|
150
169
|
{@render ellipsisSlot()}
|
|
151
170
|
{:else}
|
|
152
|
-
<Icon name={ellipsisIcon} class={
|
|
171
|
+
<Icon name={ellipsisIcon} class={classes.ellipsisIcon} />
|
|
153
172
|
{/if}
|
|
154
173
|
</span>
|
|
155
174
|
{:else}
|
|
156
|
-
<Pagination.Page page={pageItem} class={
|
|
175
|
+
<Pagination.Page page={pageItem} class={classes.item} {disabled}>
|
|
157
176
|
{#if itemSlot}
|
|
158
177
|
{@render itemSlot({
|
|
159
178
|
page: pageItem.value,
|
|
@@ -166,32 +185,62 @@
|
|
|
166
185
|
{/if}
|
|
167
186
|
{/each}
|
|
168
187
|
|
|
169
|
-
{#if
|
|
170
|
-
<Pagination.NextButton
|
|
171
|
-
{#
|
|
172
|
-
{
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
188
|
+
{#if showControls}
|
|
189
|
+
<Pagination.NextButton disabled={nextDisabled}>
|
|
190
|
+
{#snippet child({ props })}
|
|
191
|
+
{#if nextSlot}
|
|
192
|
+
<ButtonComponent
|
|
193
|
+
{...props}
|
|
194
|
+
{variant}
|
|
195
|
+
{color}
|
|
196
|
+
square
|
|
197
|
+
{size}
|
|
198
|
+
class={classes.next}
|
|
199
|
+
>
|
|
200
|
+
{@render nextSlot({ page: page!, disabled: nextDisabled })}
|
|
201
|
+
</ButtonComponent>
|
|
202
|
+
{:else}
|
|
203
|
+
<ButtonComponent
|
|
204
|
+
{...props}
|
|
205
|
+
{variant}
|
|
206
|
+
{color}
|
|
207
|
+
square
|
|
208
|
+
{size}
|
|
209
|
+
icon={nextIcon}
|
|
210
|
+
class={classes.next}
|
|
211
|
+
/>
|
|
212
|
+
{/if}
|
|
213
|
+
{/snippet}
|
|
176
214
|
</Pagination.NextButton>
|
|
177
215
|
{/if}
|
|
178
216
|
|
|
179
|
-
{#if
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
217
|
+
{#if showEdges}
|
|
218
|
+
{#if lastSlot}
|
|
219
|
+
<ButtonComponent
|
|
220
|
+
{variant}
|
|
221
|
+
{color}
|
|
222
|
+
square
|
|
223
|
+
{size}
|
|
224
|
+
class={classes.last}
|
|
225
|
+
disabled={nextDisabled}
|
|
226
|
+
aria-label="Last page"
|
|
227
|
+
onclick={goToLast}
|
|
228
|
+
>
|
|
190
229
|
{@render lastSlot({ page: page!, disabled: nextDisabled })}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
230
|
+
</ButtonComponent>
|
|
231
|
+
{:else}
|
|
232
|
+
<ButtonComponent
|
|
233
|
+
{variant}
|
|
234
|
+
{color}
|
|
235
|
+
square
|
|
236
|
+
{size}
|
|
237
|
+
icon={lastIcon}
|
|
238
|
+
class={classes.last}
|
|
239
|
+
disabled={nextDisabled}
|
|
240
|
+
aria-label="Last page"
|
|
241
|
+
onclick={goToLast}
|
|
242
|
+
/>
|
|
243
|
+
{/if}
|
|
195
244
|
{/if}
|
|
196
245
|
</div>
|
|
197
246
|
{/snippet}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PaginationProps } from './pagination.types.js';
|
|
2
2
|
export type Props = PaginationProps;
|
|
3
3
|
import { Pagination } from 'bits-ui';
|
|
4
|
-
declare const Pagination: import("svelte").Component<PaginationProps, {}, "page">;
|
|
4
|
+
declare const Pagination: import("svelte").Component<PaginationProps, {}, "ref" | "page">;
|
|
5
5
|
type Pagination = ReturnType<typeof Pagination>;
|
|
6
6
|
export default Pagination;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as Pagination } from './Pagination.svelte';
|
|
2
|
-
export type { PaginationProps } from './pagination.types.js';
|
|
2
|
+
export type { PaginationProps, PaginationNavSlotProps, PaginationItemSlotProps } from './pagination.types.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
3
3
|
import type { PaginationSlots, PaginationVariantProps } from './pagination.variants.js';
|
|
4
|
+
import type { ButtonProps } from '../Button/button.types.js';
|
|
4
5
|
/**
|
|
5
6
|
* Props passed to navigation button snippet slots (first, prev, next, last).
|
|
6
7
|
*/
|
|
@@ -38,6 +39,10 @@ export interface PaginationItemSlotProps {
|
|
|
38
39
|
* @see https://bits-ui.com/docs/components/pagination
|
|
39
40
|
*/
|
|
40
41
|
export interface PaginationProps {
|
|
42
|
+
/**
|
|
43
|
+
* Bindable reference to the root DOM element.
|
|
44
|
+
*/
|
|
45
|
+
ref?: HTMLElement | null;
|
|
41
46
|
/**
|
|
42
47
|
* The currently active page number.
|
|
43
48
|
* Use `bind:page` for two-way binding.
|
|
@@ -90,11 +95,26 @@ export interface PaginationProps {
|
|
|
90
95
|
* @default 'md'
|
|
91
96
|
*/
|
|
92
97
|
size?: NonNullable<PaginationVariantProps['size']>;
|
|
98
|
+
/**
|
|
99
|
+
* Button variant for navigation buttons (first, prev, next, last).
|
|
100
|
+
* @default 'ghost'
|
|
101
|
+
*/
|
|
102
|
+
variant?: NonNullable<ButtonProps['variant']>;
|
|
103
|
+
/**
|
|
104
|
+
* Button color for navigation buttons (first, prev, next, last).
|
|
105
|
+
* @default 'surface'
|
|
106
|
+
*/
|
|
107
|
+
color?: NonNullable<ButtonProps['color']>;
|
|
93
108
|
/**
|
|
94
109
|
* Color applied to the currently selected page button.
|
|
95
110
|
* @default 'primary'
|
|
96
111
|
*/
|
|
97
|
-
activeColor?: NonNullable<
|
|
112
|
+
activeColor?: NonNullable<ButtonProps['color']>;
|
|
113
|
+
/**
|
|
114
|
+
* Variant style applied to the currently selected page button.
|
|
115
|
+
* @default 'solid'
|
|
116
|
+
*/
|
|
117
|
+
activeVariant?: NonNullable<ButtonProps['variant']>;
|
|
98
118
|
/**
|
|
99
119
|
* Icon for the "first page" button.
|
|
100
120
|
* @default 'lucide:chevrons-left'
|
|
@@ -132,7 +152,6 @@ export interface PaginationProps {
|
|
|
132
152
|
* ui={{
|
|
133
153
|
* list: 'gap-2',
|
|
134
154
|
* item: 'rounded-full',
|
|
135
|
-
* prev: 'rounded-full'
|
|
136
155
|
* }}
|
|
137
156
|
* ```
|
|
138
157
|
*/
|