@catalystsoftware/ui 1.0.2 → 1.0.5
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/data/tailwind.config.js +261 -3821
- package/dist/components/catalyst-ui/buttons/burger.tsx +207 -0
- package/dist/components/catalyst-ui/core/data-display/timeline.tsx +210 -0
- package/dist/components/catalyst-ui/core/feedback/alert.tsx +491 -0
- package/dist/components/catalyst-ui/core/feedback/spinner-1.tsx +65 -0
- package/dist/components/catalyst-ui/core/feedback/toast.tsx +1857 -0
- package/dist/components/catalyst-ui/core/navigation/menu.tsx +164 -0
- package/dist/components/catalyst-ui/forms/toggle-class.tsx +176 -0
- package/dist/components/catalyst-ui/hooks/use-copy-to-clipboard.tsx +419 -0
- package/dist/components/catalyst-ui/hooks/use-counter.tsx +13 -0
- package/dist/components/catalyst-ui/hooks/use-event-listener.tsx +23 -0
- package/dist/components/catalyst-ui/hooks/use-export-markdown.tsx +47 -0
- package/dist/components/catalyst-ui/hooks/use-focus.tsx +17 -0
- package/dist/components/catalyst-ui/hooks/use-interval.tsx +23 -0
- package/dist/components/catalyst-ui/hooks/use-is-client.tsx +16 -0
- package/dist/components/catalyst-ui/hooks/use-media-query.tsx +19 -0
- package/dist/components/catalyst-ui/hooks/use-mobile.tsx +19 -0
- package/dist/components/catalyst-ui/hooks/use-resize-observer.tsx +81 -0
- package/dist/components/catalyst-ui/hooks/use-timeout.tsx +21 -0
- package/dist/components/catalyst-ui/hooks/use-timer.tsx +209 -0
- package/dist/components/catalyst-ui/hooks/use-toggle.tsx +12 -0
- package/dist/components/catalyst-ui/media/image.tsx +13 -0
- package/dist/components/catalyst-ui/overlays/dual-sidebar.tsx +4142 -0
- package/dist/components/catalyst-ui/overlays/sidebar-original.tsx +726 -0
- package/dist/components/catalyst-ui/primitives/accordion.tsx +250 -0
- package/dist/components/catalyst-ui/primitives/alert-dialog.tsx +126 -0
- package/dist/components/catalyst-ui/primitives/aspect-ratio.tsx +9 -0
- package/dist/components/catalyst-ui/primitives/avatar.tsx +296 -0
- package/dist/components/catalyst-ui/primitives/badge.tsx +57 -0
- package/dist/components/catalyst-ui/primitives/breadcrumb.tsx +101 -0
- package/dist/components/catalyst-ui/primitives/button.tsx +265 -0
- package/dist/components/catalyst-ui/primitives/calendar-v4.tsx +208 -0
- package/dist/components/catalyst-ui/primitives/calendar.tsx +295 -0
- package/dist/components/catalyst-ui/primitives/card.tsx +618 -0
- package/dist/components/catalyst-ui/primitives/carousel.tsx +238 -0
- package/dist/components/catalyst-ui/primitives/chart.tsx +347 -0
- package/dist/components/catalyst-ui/primitives/checkbox.tsx +225 -0
- package/dist/components/catalyst-ui/primitives/collapsible.tsx +212 -0
- package/dist/components/catalyst-ui/primitives/command.tsx +393 -0
- package/dist/components/catalyst-ui/primitives/context-menu.tsx +236 -0
- package/dist/components/catalyst-ui/primitives/dialog.tsx +471 -0
- package/dist/components/catalyst-ui/primitives/drawer.tsx +761 -0
- package/dist/components/catalyst-ui/primitives/dropdown-menu.tsx +290 -0
- package/dist/components/catalyst-ui/primitives/empty.tsx +104 -0
- package/dist/components/catalyst-ui/primitives/field.tsx +244 -0
- package/dist/components/catalyst-ui/primitives/hover-card.tsx +124 -0
- package/dist/components/catalyst-ui/primitives/input-otp.tsx +76 -0
- package/dist/components/catalyst-ui/primitives/input.tsx +64 -0
- package/dist/components/catalyst-ui/primitives/item.tsx +196 -0
- package/dist/components/catalyst-ui/primitives/kbd.tsx +75 -0
- package/dist/components/catalyst-ui/primitives/label.tsx +24 -0
- package/dist/components/catalyst-ui/primitives/navigation-menu.tsx +150 -0
- package/dist/components/catalyst-ui/primitives/pagination.tsx +198 -0
- package/dist/components/catalyst-ui/primitives/popover.tsx +232 -0
- package/dist/components/catalyst-ui/primitives/progress.tsx +34 -0
- package/dist/components/catalyst-ui/primitives/radio-group.tsx +43 -0
- package/dist/components/catalyst-ui/primitives/resizable.tsx +56 -0
- package/dist/components/catalyst-ui/primitives/select.tsx +155 -0
- package/dist/components/catalyst-ui/primitives/separator.tsx +74 -0
- package/dist/components/catalyst-ui/primitives/sheet.tsx +126 -0
- package/dist/components/catalyst-ui/primitives/skeleton.tsx +15 -0
- package/dist/components/catalyst-ui/primitives/slider.tsx +27 -0
- package/dist/components/catalyst-ui/primitives/switch.tsx +187 -0
- package/dist/components/catalyst-ui/primitives/tabs.tsx +335 -0
- package/dist/components/catalyst-ui/primitives/textarea.tsx +24 -0
- package/dist/components/catalyst-ui/primitives/toggle-group.tsx +55 -0
- package/dist/components/catalyst-ui/primitives/toggle.tsx +42 -0
- package/dist/components/catalyst-ui/primitives/tooltip.tsx +116 -0
- package/dist/components/catalyst-ui/utils/basic-auth.tsx +40 -0
- package/dist/components/catalyst-ui/utils/context-storage.tsx +19 -0
- package/dist/components/catalyst-ui/utils/cors-middleware.tsx +71 -0
- package/dist/components/catalyst-ui/utils/deferred-content.tsx +595 -0
- package/dist/components/catalyst-ui/utils/honeypot-middleware.tsx +38 -0
- package/dist/components/catalyst-ui/utils/incId.tsx +75 -0
- package/dist/components/catalyst-ui/utils/jwk-auth.tsx +36 -0
- package/dist/components/catalyst-ui/utils/request-id.tsx +14 -0
- package/dist/components/catalyst-ui/utils/secure-headers.tsx +37 -0
- package/dist/components/catalyst-ui/utils/server-timing.tsx +23 -0
- package/dist/components/catalyst-ui/utils/utils.ts +43 -0
- package/dist/components/catalyst-ui/utils/with-cookie.tsx +43 -0
- package/dist/components/catalyst-ui/x/accordian-x.tsx +428 -0
- package/dist/components/catalyst-ui/x/alert-x.tsx +413 -0
- package/dist/components/catalyst-ui/x/animated-text-x.tsx +2242 -0
- package/dist/components/catalyst-ui/x/avatar-x.tsx +515 -0
- package/dist/components/catalyst-ui/x/badge-x.tsx +670 -0
- package/dist/components/catalyst-ui/x/button-X.tsx +2857 -0
- package/dist/components/catalyst-ui/x/button-group-x.tsx +847 -0
- package/dist/components/catalyst-ui/x/calendar-x.tsx +1910 -0
- package/dist/components/catalyst-ui/x/card-x.tsx +2597 -0
- package/dist/components/catalyst-ui/x/checkbox-x.tsx +656 -0
- package/dist/components/catalyst-ui/x/collapsible-x.tsx +1360 -0
- package/dist/components/catalyst-ui/x/combobox-x.tsx +911 -0
- package/dist/components/catalyst-ui/x/data-table-x.tsx +1753 -0
- package/dist/components/catalyst-ui/x/date-picker-x.tsx +648 -0
- package/dist/components/catalyst-ui/x/dialog-x.tsx +659 -0
- package/dist/components/catalyst-ui/x/dropdown-menu-x.tsx +612 -0
- package/dist/components/catalyst-ui/x/hover-card-x.tsx +375 -0
- package/dist/components/catalyst-ui/x/icon-x.tsx +840 -0
- package/dist/components/catalyst-ui/x/input-mask-x.tsx +981 -0
- package/dist/components/catalyst-ui/x/input-otp-x.tsx +659 -0
- package/dist/components/catalyst-ui/x/loader-x.tsx +1757 -0
- package/dist/components/catalyst-ui/x/pagination-x.tsx +622 -0
- package/dist/components/catalyst-ui/x/popover-x.tsx +744 -0
- package/dist/components/catalyst-ui/x/radio-group-x.tsx +499 -0
- package/dist/components/catalyst-ui/x/select-x.tsx +1127 -0
- package/dist/components/catalyst-ui/x/sheet-x.tsx +668 -0
- package/dist/components/catalyst-ui/x/switch-x.tsx +681 -0
- package/dist/components/catalyst-ui/x/table-x.tsx +574 -0
- package/dist/components/catalyst-ui/x/tabs-x.tsx +839 -0
- package/dist/components/catalyst-ui/x/textarea-x.tsx +1263 -0
- package/dist/components/catalyst-ui/x/tooltip-x.tsx +396 -0
- package/dist/components/catalyst-ui/x/tracker-x.tsx +560 -0
- package/dist/data/bg-data.tsx +901 -0
- package/dist/data/buttons-data.tsx +2327 -0
- package/dist/data/charts-data.tsx +102 -0
- package/dist/data/chat-data.tsx +83 -0
- package/dist/data/code-data.tsx +1040 -0
- package/dist/data/comboboxes-data.tsx +1843 -0
- package/dist/data/command-data.tsx +1381 -0
- package/dist/data/core-data.tsx +15953 -0
- package/dist/data/crm-data.tsx +47 -0
- package/dist/data/data.tsx +159 -0
- package/dist/data/date-and-time-data.tsx +554 -0
- package/dist/data/dependencies.tsx +7 -0
- package/dist/data/ecommerce-data.tsx +1387 -0
- package/dist/data/forms-data.tsx +7890 -0
- package/dist/data/hooks-data.tsx +5487 -0
- package/dist/data/index.ts +34 -0
- package/dist/data/inputs-data.tsx +557 -0
- package/dist/data/interactive-data.tsx +5394 -0
- package/dist/data/lofi-data.tsx +18295 -0
- package/dist/data/marketing-data.tsx +2546 -0
- package/dist/data/media-data.tsx +1510 -0
- package/dist/data/motion-data.tsx +5801 -0
- package/dist/data/overlay-data.tsx +4136 -0
- package/dist/data/pdf-data.tsx +124 -0
- package/dist/data/pos-data.tsx +213 -0
- package/dist/data/postcss.config.js +6 -0
- package/dist/data/primitive-data.tsx +5170 -0
- package/dist/data/prompt-data.tsx +1226 -0
- package/dist/data/requiredLibs.ts +4 -0
- package/dist/data/sandbox-data.tsx +1 -0
- package/dist/data/sidebars-data.tsx +5421 -0
- package/dist/data/stacks-data.tsx +32 -0
- package/dist/data/table-data.tsx +706 -0
- package/dist/data/tailwind.config.js +270 -0
- package/dist/data/tailwind.config.ngin.js +3830 -0
- package/dist/data/tailwind.css +431 -0
- package/dist/data/tools-data.tsx +6910 -0
- package/dist/data/typography-data.tsx +2050 -0
- package/dist/data/utils-data.tsx +6500 -0
- package/dist/data/x-data.tsx +1171 -0
- package/dist/data.tsx +159 -0
- package/package.json +1 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -362
|
@@ -0,0 +1,622 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import React, { useId } from 'react'
|
|
4
|
+
import { ChevronLeft, ChevronRight, ChevronFirst, ChevronLast } from 'lucide-react'
|
|
5
|
+
import { cn } from "~/components/catalyst-ui"
|
|
6
|
+
import {
|
|
7
|
+
Pagination,
|
|
8
|
+
PaginationContent,
|
|
9
|
+
PaginationItem,
|
|
10
|
+
PaginationLink,
|
|
11
|
+
PaginationPrevious,
|
|
12
|
+
PaginationNext,
|
|
13
|
+
PaginationEllipsis
|
|
14
|
+
} from "~/components/catalyst-ui"
|
|
15
|
+
import { Button, buttonVariants } from "~/components/catalyst-ui"
|
|
16
|
+
import { Label } from "~/components/catalyst-ui"
|
|
17
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "~/components/catalyst-ui"
|
|
18
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "~/components/catalyst-ui"
|
|
19
|
+
|
|
20
|
+
// #region PARENT FUNCTION
|
|
21
|
+
export function PaginationX({ pagination = 'default', ...props }: any) {
|
|
22
|
+
switch (pagination) {
|
|
23
|
+
case 'WithIcon':
|
|
24
|
+
return <WithIcon {...props} />
|
|
25
|
+
case 'PrimaryButton':
|
|
26
|
+
return <PrimaryButton {...props} />
|
|
27
|
+
case 'SecondaryButton':
|
|
28
|
+
return <SecondaryButton {...props} />
|
|
29
|
+
case 'Bordered':
|
|
30
|
+
return <Bordered {...props} />
|
|
31
|
+
case 'Rounded':
|
|
32
|
+
return <Rounded {...props} />
|
|
33
|
+
case 'FirstLast':
|
|
34
|
+
return <FirstLast {...props} />
|
|
35
|
+
case 'WithEllipsis':
|
|
36
|
+
return <WithEllipsis {...props} />
|
|
37
|
+
case 'Underline':
|
|
38
|
+
return <Underline {...props} />
|
|
39
|
+
case 'Card':
|
|
40
|
+
return <Card {...props} />
|
|
41
|
+
case 'Numberless':
|
|
42
|
+
return <Numberless {...props} />
|
|
43
|
+
case 'NumberlessWithText':
|
|
44
|
+
return <NumberlessWithText {...props} />
|
|
45
|
+
case 'Mini':
|
|
46
|
+
return <Mini {...props} />
|
|
47
|
+
case 'WithSelect':
|
|
48
|
+
return <WithSelect {...props} />
|
|
49
|
+
case 'Table':
|
|
50
|
+
return <Table {...props} />
|
|
51
|
+
default:
|
|
52
|
+
return <DefaultPagination {...props} />
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// #endregion
|
|
56
|
+
|
|
57
|
+
// #region SUPPORTING FUNCTIONS
|
|
58
|
+
const DefaultPagination = ({ currentPage = 2, totalPages = 3, className, ...props }: any) => {
|
|
59
|
+
const pages = Array.from({ length: totalPages }, (_, i) => i + 1)
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<Pagination className={className} {...props}>
|
|
63
|
+
<PaginationContent>
|
|
64
|
+
<PaginationItem>
|
|
65
|
+
<PaginationPrevious href='#' />
|
|
66
|
+
</PaginationItem>
|
|
67
|
+
{pages.map(page => (
|
|
68
|
+
<PaginationItem key={page}>
|
|
69
|
+
<PaginationLink href={`#${page}`} isActive={page === currentPage}>
|
|
70
|
+
{page}
|
|
71
|
+
</PaginationLink>
|
|
72
|
+
</PaginationItem>
|
|
73
|
+
))}
|
|
74
|
+
<PaginationItem>
|
|
75
|
+
<PaginationNext href='#' />
|
|
76
|
+
</PaginationItem>
|
|
77
|
+
</PaginationContent>
|
|
78
|
+
</Pagination>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const WithIcon = ({ currentPage = 2, totalPages = 3, className, ...props }: any) => {
|
|
83
|
+
const pages = Array.from({ length: totalPages }, (_, i) => i + 1)
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<Pagination className={className} {...props}>
|
|
87
|
+
<PaginationContent>
|
|
88
|
+
<PaginationItem>
|
|
89
|
+
<PaginationLink href='#' aria-label='Go to previous page' size='icon'>
|
|
90
|
+
<ChevronLeft className='size-4' />
|
|
91
|
+
</PaginationLink>
|
|
92
|
+
</PaginationItem>
|
|
93
|
+
{pages.map(page => (
|
|
94
|
+
<PaginationItem key={page}>
|
|
95
|
+
<PaginationLink href={`#${page}`} isActive={page === currentPage}>
|
|
96
|
+
{page}
|
|
97
|
+
</PaginationLink>
|
|
98
|
+
</PaginationItem>
|
|
99
|
+
))}
|
|
100
|
+
<PaginationItem>
|
|
101
|
+
<PaginationLink href='#' aria-label='Go to next page' size='icon'>
|
|
102
|
+
<ChevronRight className='size-4' />
|
|
103
|
+
</PaginationLink>
|
|
104
|
+
</PaginationItem>
|
|
105
|
+
</PaginationContent>
|
|
106
|
+
</Pagination>
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const PrimaryButton = ({ currentPage = 2, totalPages = 3, className, ...props }: any) => {
|
|
111
|
+
const pages = Array.from({ length: totalPages }, (_, i) => i + 1)
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<Pagination className={className} {...props}>
|
|
115
|
+
<PaginationContent>
|
|
116
|
+
<PaginationItem>
|
|
117
|
+
<PaginationPrevious href='#' />
|
|
118
|
+
</PaginationItem>
|
|
119
|
+
{pages.map(page => (
|
|
120
|
+
<PaginationItem key={page}>
|
|
121
|
+
<PaginationLink
|
|
122
|
+
href={`#${page}`}
|
|
123
|
+
isActive={page === currentPage}
|
|
124
|
+
className={cn(
|
|
125
|
+
page === currentPage && buttonVariants({
|
|
126
|
+
variant: 'default',
|
|
127
|
+
size: 'icon'
|
|
128
|
+
}),
|
|
129
|
+
page === currentPage && 'hover:!text-primary-foreground dark:bg-primary dark:text-primary-foreground dark:hover:text-primary-foreground dark:hover:bg-primary/90 !shadow-none dark:border-transparent'
|
|
130
|
+
)}
|
|
131
|
+
>
|
|
132
|
+
{page}
|
|
133
|
+
</PaginationLink>
|
|
134
|
+
</PaginationItem>
|
|
135
|
+
))}
|
|
136
|
+
<PaginationItem>
|
|
137
|
+
<PaginationNext href='#' />
|
|
138
|
+
</PaginationItem>
|
|
139
|
+
</PaginationContent>
|
|
140
|
+
</Pagination>
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const SecondaryButton = ({ currentPage = 2, totalPages = 3, className, ...props }: any) => {
|
|
145
|
+
const pages = Array.from({ length: totalPages }, (_, i) => i + 1)
|
|
146
|
+
|
|
147
|
+
return (
|
|
148
|
+
<Pagination className={className} {...props}>
|
|
149
|
+
<PaginationContent>
|
|
150
|
+
<PaginationItem>
|
|
151
|
+
<PaginationPrevious href='#' />
|
|
152
|
+
</PaginationItem>
|
|
153
|
+
{pages.map(page => (
|
|
154
|
+
<PaginationItem key={page}>
|
|
155
|
+
<PaginationLink
|
|
156
|
+
href={`#${page}`}
|
|
157
|
+
isActive={page === currentPage}
|
|
158
|
+
className={cn(
|
|
159
|
+
page === currentPage && 'hover:!text-secondary-foreground !border-none !shadow-none',
|
|
160
|
+
page === currentPage && buttonVariants({
|
|
161
|
+
variant: 'secondary',
|
|
162
|
+
size: 'icon'
|
|
163
|
+
})
|
|
164
|
+
)}
|
|
165
|
+
>
|
|
166
|
+
{page}
|
|
167
|
+
</PaginationLink>
|
|
168
|
+
</PaginationItem>
|
|
169
|
+
))}
|
|
170
|
+
<PaginationItem>
|
|
171
|
+
<PaginationNext href='#' />
|
|
172
|
+
</PaginationItem>
|
|
173
|
+
</PaginationContent>
|
|
174
|
+
</Pagination>
|
|
175
|
+
)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const Bordered = ({ currentPage = 2, totalPages = 3, className, ...props }: any) => {
|
|
179
|
+
const pages = Array.from({ length: totalPages }, (_, i) => i + 1)
|
|
180
|
+
|
|
181
|
+
return (
|
|
182
|
+
<Pagination className={className} {...props}>
|
|
183
|
+
<PaginationContent className='gap-0 divide-x overflow-hidden rounded-lg border'>
|
|
184
|
+
<PaginationItem>
|
|
185
|
+
<PaginationPrevious href='#' className='rounded-none' />
|
|
186
|
+
</PaginationItem>
|
|
187
|
+
{pages.map(page => {
|
|
188
|
+
const isActive = page === currentPage
|
|
189
|
+
return (
|
|
190
|
+
<PaginationItem key={page}>
|
|
191
|
+
<PaginationLink
|
|
192
|
+
href={`#${page}`}
|
|
193
|
+
className={cn(
|
|
194
|
+
{
|
|
195
|
+
[buttonVariants({
|
|
196
|
+
variant: 'default',
|
|
197
|
+
className: 'hover:!text-primary-foreground dark:bg-primary dark:text-primary-foreground dark:hover:text-primary-foreground dark:hover:bg-primary/90 dark:border-transparent'
|
|
198
|
+
})]: isActive
|
|
199
|
+
},
|
|
200
|
+
'rounded-none border-none'
|
|
201
|
+
)}
|
|
202
|
+
isActive={isActive}
|
|
203
|
+
>
|
|
204
|
+
{page}
|
|
205
|
+
</PaginationLink>
|
|
206
|
+
</PaginationItem>
|
|
207
|
+
)
|
|
208
|
+
})}
|
|
209
|
+
<PaginationItem>
|
|
210
|
+
<PaginationNext href='#' className='rounded-none' />
|
|
211
|
+
</PaginationItem>
|
|
212
|
+
</PaginationContent>
|
|
213
|
+
</Pagination>
|
|
214
|
+
)
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const Rounded = ({ currentPage = 2, totalPages = 3, className, ...props }: any) => {
|
|
218
|
+
const pages = Array.from({ length: totalPages }, (_, i) => i + 1)
|
|
219
|
+
|
|
220
|
+
return (
|
|
221
|
+
<Pagination className={className} {...props}>
|
|
222
|
+
<PaginationContent>
|
|
223
|
+
<PaginationItem>
|
|
224
|
+
<PaginationPrevious href='#' className='rounded-full' />
|
|
225
|
+
</PaginationItem>
|
|
226
|
+
{pages.map(page => (
|
|
227
|
+
<PaginationItem key={page}>
|
|
228
|
+
<PaginationLink href={`#${page}`} isActive={page === currentPage} className='rounded-full'>
|
|
229
|
+
{page}
|
|
230
|
+
</PaginationLink>
|
|
231
|
+
</PaginationItem>
|
|
232
|
+
))}
|
|
233
|
+
<PaginationItem>
|
|
234
|
+
<PaginationNext href='#' className='rounded-full' />
|
|
235
|
+
</PaginationItem>
|
|
236
|
+
</PaginationContent>
|
|
237
|
+
</Pagination>
|
|
238
|
+
)
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
const FirstLast = ({ currentPage = 2, totalPages = 3, className, ...props }: any) => {
|
|
242
|
+
const pages = Array.from({ length: totalPages }, (_, i) => i + 1)
|
|
243
|
+
|
|
244
|
+
return (
|
|
245
|
+
<Pagination className={className} {...props}>
|
|
246
|
+
<PaginationContent>
|
|
247
|
+
<PaginationItem>
|
|
248
|
+
<PaginationLink href='#' aria-label='Go to first page' size='icon' className='rounded-full'>
|
|
249
|
+
<ChevronFirst className='size-4' />
|
|
250
|
+
</PaginationLink>
|
|
251
|
+
</PaginationItem>
|
|
252
|
+
<PaginationItem>
|
|
253
|
+
<PaginationLink href='#' aria-label='Go to previous page' size='icon' className='rounded-full'>
|
|
254
|
+
<ChevronLeft className='size-4' />
|
|
255
|
+
</PaginationLink>
|
|
256
|
+
</PaginationItem>
|
|
257
|
+
{pages.map(page => (
|
|
258
|
+
<PaginationItem key={page}>
|
|
259
|
+
<PaginationLink href={`#${page}`} isActive={page === currentPage} className='rounded-full'>
|
|
260
|
+
{page}
|
|
261
|
+
</PaginationLink>
|
|
262
|
+
</PaginationItem>
|
|
263
|
+
))}
|
|
264
|
+
<PaginationItem>
|
|
265
|
+
<PaginationLink href='#' aria-label='Go to next page' size='icon' className='rounded-full'>
|
|
266
|
+
<ChevronRight className='size-4' />
|
|
267
|
+
</PaginationLink>
|
|
268
|
+
</PaginationItem>
|
|
269
|
+
<PaginationItem>
|
|
270
|
+
<PaginationLink href='#' aria-label='Go to last page' size='icon' className='rounded-full'>
|
|
271
|
+
<ChevronLast className='size-4' />
|
|
272
|
+
</PaginationLink>
|
|
273
|
+
</PaginationItem>
|
|
274
|
+
</PaginationContent>
|
|
275
|
+
</Pagination>
|
|
276
|
+
)
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
const WithEllipsis = ({ currentPage = 2, className, ...props }: any) => {
|
|
280
|
+
return (
|
|
281
|
+
<Pagination className={className} {...props}>
|
|
282
|
+
<PaginationContent>
|
|
283
|
+
<PaginationItem>
|
|
284
|
+
<PaginationPrevious href='#' />
|
|
285
|
+
</PaginationItem>
|
|
286
|
+
<PaginationItem>
|
|
287
|
+
<PaginationLink href='#'>1</PaginationLink>
|
|
288
|
+
</PaginationItem>
|
|
289
|
+
<PaginationItem>
|
|
290
|
+
<PaginationLink href='#' isActive={currentPage === 2}>
|
|
291
|
+
2
|
|
292
|
+
</PaginationLink>
|
|
293
|
+
</PaginationItem>
|
|
294
|
+
<PaginationItem>
|
|
295
|
+
<Tooltip>
|
|
296
|
+
<TooltipTrigger asChild>
|
|
297
|
+
<PaginationEllipsis />
|
|
298
|
+
</TooltipTrigger>
|
|
299
|
+
<TooltipContent>
|
|
300
|
+
<p>8 other pages</p>
|
|
301
|
+
</TooltipContent>
|
|
302
|
+
</Tooltip>
|
|
303
|
+
</PaginationItem>
|
|
304
|
+
<PaginationItem>
|
|
305
|
+
<PaginationNext href='#' />
|
|
306
|
+
</PaginationItem>
|
|
307
|
+
</PaginationContent>
|
|
308
|
+
</Pagination>
|
|
309
|
+
)
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
const Underline = ({ currentPage = 1, totalPages = 3, className, ...props }: any) => {
|
|
313
|
+
const pages = Array.from({ length: totalPages }, (_, i) => i + 1)
|
|
314
|
+
|
|
315
|
+
return (
|
|
316
|
+
<Pagination className={className} {...props}>
|
|
317
|
+
<PaginationContent>
|
|
318
|
+
<PaginationItem>
|
|
319
|
+
<PaginationPrevious href='#' className='rounded-none' />
|
|
320
|
+
</PaginationItem>
|
|
321
|
+
{pages.map(page => (
|
|
322
|
+
<PaginationItem key={page}>
|
|
323
|
+
<PaginationLink
|
|
324
|
+
href={`#${page}`}
|
|
325
|
+
isActive={page === currentPage}
|
|
326
|
+
className={cn(
|
|
327
|
+
'rounded-none',
|
|
328
|
+
page === currentPage && 'border-primary! border-0 border-b-2 bg-transparent! !shadow-none'
|
|
329
|
+
)}
|
|
330
|
+
>
|
|
331
|
+
{page}
|
|
332
|
+
</PaginationLink>
|
|
333
|
+
</PaginationItem>
|
|
334
|
+
))}
|
|
335
|
+
<PaginationItem>
|
|
336
|
+
<PaginationNext href='#' className='rounded-none' />
|
|
337
|
+
</PaginationItem>
|
|
338
|
+
</PaginationContent>
|
|
339
|
+
</Pagination>
|
|
340
|
+
)
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
const Card = ({ currentPage = 2, totalPages = 3, className, ...props }: any) => {
|
|
344
|
+
const pages = Array.from({ length: totalPages }, (_, i) => i + 1)
|
|
345
|
+
|
|
346
|
+
return (
|
|
347
|
+
<Pagination className={className} {...props}>
|
|
348
|
+
<PaginationContent className='rounded-md border p-1 shadow-xs'>
|
|
349
|
+
<PaginationItem>
|
|
350
|
+
<PaginationPrevious href='#' />
|
|
351
|
+
</PaginationItem>
|
|
352
|
+
{pages.map(page => (
|
|
353
|
+
<PaginationItem key={page}>
|
|
354
|
+
<PaginationLink href={`#${page}`} isActive={page === currentPage}>
|
|
355
|
+
{page}
|
|
356
|
+
</PaginationLink>
|
|
357
|
+
</PaginationItem>
|
|
358
|
+
))}
|
|
359
|
+
<PaginationItem>
|
|
360
|
+
<PaginationNext href='#' />
|
|
361
|
+
</PaginationItem>
|
|
362
|
+
</PaginationContent>
|
|
363
|
+
</Pagination>
|
|
364
|
+
)
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
const Numberless = ({ className, ...props }: any) => {
|
|
368
|
+
return (
|
|
369
|
+
<Pagination className={className} {...props}>
|
|
370
|
+
<PaginationContent className='w-full justify-between'>
|
|
371
|
+
<PaginationItem>
|
|
372
|
+
<PaginationPrevious href='#' className='border' />
|
|
373
|
+
</PaginationItem>
|
|
374
|
+
<PaginationItem>
|
|
375
|
+
<PaginationNext href='#' className='border' />
|
|
376
|
+
</PaginationItem>
|
|
377
|
+
</PaginationContent>
|
|
378
|
+
</Pagination>
|
|
379
|
+
)
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
const NumberlessWithText = ({ currentPage = 2, totalPages = 5, className, ...props }: any) => {
|
|
383
|
+
return (
|
|
384
|
+
<Pagination className={className} {...props}>
|
|
385
|
+
<PaginationContent className='w-full justify-between'>
|
|
386
|
+
<PaginationItem>
|
|
387
|
+
<PaginationPrevious href='#' className='border' />
|
|
388
|
+
</PaginationItem>
|
|
389
|
+
<PaginationItem>
|
|
390
|
+
<p className='text-muted-foreground text-sm' aria-live='polite'>
|
|
391
|
+
Page <span className='text-foreground'>{currentPage}</span> of <span className='text-foreground'>{totalPages}</span>
|
|
392
|
+
</p>
|
|
393
|
+
</PaginationItem>
|
|
394
|
+
<PaginationItem>
|
|
395
|
+
<PaginationNext href='#' className='border' />
|
|
396
|
+
</PaginationItem>
|
|
397
|
+
</PaginationContent>
|
|
398
|
+
</Pagination>
|
|
399
|
+
)
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
const Mini = ({ currentPage = 2, totalPages = 5, className, ...props }: any) => {
|
|
403
|
+
return (
|
|
404
|
+
<Pagination className={className} {...props}>
|
|
405
|
+
<PaginationContent>
|
|
406
|
+
<PaginationItem>
|
|
407
|
+
<PaginationLink href='#' aria-label='Go to previous page' size='icon'>
|
|
408
|
+
<ChevronLeft className='size-4' />
|
|
409
|
+
</PaginationLink>
|
|
410
|
+
</PaginationItem>
|
|
411
|
+
<PaginationItem>
|
|
412
|
+
<p className='text-muted-foreground text-sm' aria-live='polite'>
|
|
413
|
+
Page <span className='text-foreground'>{currentPage}</span> of <span className='text-foreground'>{totalPages}</span>
|
|
414
|
+
</p>
|
|
415
|
+
</PaginationItem>
|
|
416
|
+
<PaginationItem>
|
|
417
|
+
<PaginationLink href='#' aria-label='Go to next page' size='icon'>
|
|
418
|
+
<ChevronRight className='size-4' />
|
|
419
|
+
</PaginationLink>
|
|
420
|
+
</PaginationItem>
|
|
421
|
+
</PaginationContent>
|
|
422
|
+
</Pagination>
|
|
423
|
+
)
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
const WithSelect = ({ className, ...props }: any) => {
|
|
427
|
+
return (
|
|
428
|
+
<Pagination className={className} {...props}>
|
|
429
|
+
<PaginationContent>
|
|
430
|
+
<PaginationItem>
|
|
431
|
+
<PaginationLink href='#' aria-label='Go to first page' size='icon' className='rounded-full'>
|
|
432
|
+
<ChevronFirst className='size-4' />
|
|
433
|
+
</PaginationLink>
|
|
434
|
+
</PaginationItem>
|
|
435
|
+
<PaginationItem>
|
|
436
|
+
<PaginationLink href='#' aria-label='Go to previous page' size='icon' className='rounded-full'>
|
|
437
|
+
<ChevronLeft className='size-4' />
|
|
438
|
+
</PaginationLink>
|
|
439
|
+
</PaginationItem>
|
|
440
|
+
<PaginationItem>
|
|
441
|
+
<Select defaultValue={String(1)} aria-label='Select page'>
|
|
442
|
+
<SelectTrigger id='select-page' className='w-fit whitespace-nowrap' aria-label='Select page'>
|
|
443
|
+
<SelectValue placeholder='Select page' />
|
|
444
|
+
</SelectTrigger>
|
|
445
|
+
<SelectContent>
|
|
446
|
+
{Array.from({ length: 10 }, (_, i) => i + 1).map(page => (
|
|
447
|
+
<SelectItem key={page} value={String(page)}>
|
|
448
|
+
Page {page}
|
|
449
|
+
</SelectItem>
|
|
450
|
+
))}
|
|
451
|
+
</SelectContent>
|
|
452
|
+
</Select>
|
|
453
|
+
</PaginationItem>
|
|
454
|
+
<PaginationItem>
|
|
455
|
+
<PaginationLink href='#' aria-label='Go to next page' size='icon' className='rounded-full'>
|
|
456
|
+
<ChevronRight className='size-4' />
|
|
457
|
+
</PaginationLink>
|
|
458
|
+
</PaginationItem>
|
|
459
|
+
<PaginationItem>
|
|
460
|
+
<PaginationLink href='#' aria-label='Go to last page' size='icon' className='rounded-full'>
|
|
461
|
+
<ChevronLast className='size-4' />
|
|
462
|
+
</PaginationLink>
|
|
463
|
+
</PaginationItem>
|
|
464
|
+
</PaginationContent>
|
|
465
|
+
</Pagination>
|
|
466
|
+
)
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
const Table = ({ currentPage = 2, totalPages = 3, className, ...props }: any) => {
|
|
470
|
+
const id = useId()
|
|
471
|
+
const pages = Array.from({ length: totalPages }, (_, i) => i + 1)
|
|
472
|
+
|
|
473
|
+
return (
|
|
474
|
+
<div className='flex w-full flex-wrap items-center justify-between gap-6 max-sm:justify-center'>
|
|
475
|
+
<div className='flex shrink-0 items-center gap-3'>
|
|
476
|
+
<Label htmlFor={id}>Rows per page</Label>
|
|
477
|
+
<Select defaultValue='10'>
|
|
478
|
+
<SelectTrigger id={id} className='w-fit whitespace-nowrap'>
|
|
479
|
+
<SelectValue placeholder='Select number of results' />
|
|
480
|
+
</SelectTrigger>
|
|
481
|
+
<SelectContent className='[&_*[role=option]]:pr-8 [&_*[role=option]]:pl-2 [&_*[role=option]>span]:right-2 [&_*[role=option]>span]:left-auto'>
|
|
482
|
+
<SelectItem value='10'>10</SelectItem>
|
|
483
|
+
<SelectItem value='25'>25</SelectItem>
|
|
484
|
+
<SelectItem value='50'>50</SelectItem>
|
|
485
|
+
</SelectContent>
|
|
486
|
+
</Select>
|
|
487
|
+
</div>
|
|
488
|
+
<div className='text-muted-foreground flex grow items-center justify-end whitespace-nowrap max-sm:justify-center'>
|
|
489
|
+
<p className='text-muted-foreground text-sm whitespace-nowrap' aria-live='polite'>
|
|
490
|
+
Showing <span className='text-foreground'>1</span> to <span className='text-foreground'>10</span> of{' '}
|
|
491
|
+
<span className='text-foreground'>100</span> products
|
|
492
|
+
</p>
|
|
493
|
+
</div>
|
|
494
|
+
<Pagination className='w-fit max-sm:mx-0'>
|
|
495
|
+
<PaginationContent>
|
|
496
|
+
<PaginationItem>
|
|
497
|
+
<PaginationLink href='#' aria-label='Go to first page' size='icon' className='rounded-full'>
|
|
498
|
+
<ChevronFirst className='size-4' />
|
|
499
|
+
</PaginationLink>
|
|
500
|
+
</PaginationItem>
|
|
501
|
+
<PaginationItem>
|
|
502
|
+
<PaginationLink href='#' aria-label='Go to previous page' size='icon' className='rounded-full'>
|
|
503
|
+
<ChevronLeft className='size-4' />
|
|
504
|
+
</PaginationLink>
|
|
505
|
+
</PaginationItem>
|
|
506
|
+
{pages.map(page => (
|
|
507
|
+
<PaginationItem key={page}>
|
|
508
|
+
<PaginationLink href={`#${page}`} isActive={page === currentPage} className='rounded-full'>
|
|
509
|
+
{page}
|
|
510
|
+
</PaginationLink>
|
|
511
|
+
</PaginationItem>
|
|
512
|
+
))}
|
|
513
|
+
<PaginationItem>
|
|
514
|
+
<Tooltip>
|
|
515
|
+
<TooltipTrigger asChild>
|
|
516
|
+
<PaginationEllipsis />
|
|
517
|
+
</TooltipTrigger>
|
|
518
|
+
<TooltipContent>
|
|
519
|
+
<p>2 other pages</p>
|
|
520
|
+
</TooltipContent>
|
|
521
|
+
</Tooltip>
|
|
522
|
+
</PaginationItem>
|
|
523
|
+
<PaginationItem>
|
|
524
|
+
<PaginationLink href='#' aria-label='Go to next page' size='icon' className='rounded-full'>
|
|
525
|
+
<ChevronRight className='size-4' />
|
|
526
|
+
</PaginationLink>
|
|
527
|
+
</PaginationItem>
|
|
528
|
+
<PaginationItem>
|
|
529
|
+
<PaginationLink href='#' aria-label='Go to last page' size='icon' className='rounded-full'>
|
|
530
|
+
<ChevronLast className='size-4' />
|
|
531
|
+
</PaginationLink>
|
|
532
|
+
</PaginationItem>
|
|
533
|
+
</PaginationContent>
|
|
534
|
+
</Pagination>
|
|
535
|
+
</div>
|
|
536
|
+
)
|
|
537
|
+
}
|
|
538
|
+
// #endregion
|
|
539
|
+
|
|
540
|
+
// #region DEMO
|
|
541
|
+
export function PaginationXDemo() {
|
|
542
|
+
return (
|
|
543
|
+
<div className='space-y-12 p-6 max-w-4xl mx-auto'>
|
|
544
|
+
<div>
|
|
545
|
+
<h3 className='text-lg font-semibold mb-4'>Default</h3>
|
|
546
|
+
<PaginationX />
|
|
547
|
+
</div>
|
|
548
|
+
|
|
549
|
+
<div>
|
|
550
|
+
<h3 className='text-lg font-semibold mb-4'>With Icon</h3>
|
|
551
|
+
<PaginationX pagination='WithIcon' />
|
|
552
|
+
</div>
|
|
553
|
+
|
|
554
|
+
<div>
|
|
555
|
+
<h3 className='text-lg font-semibold mb-4'>Primary Button</h3>
|
|
556
|
+
<PaginationX pagination='PrimaryButton' />
|
|
557
|
+
</div>
|
|
558
|
+
|
|
559
|
+
<div>
|
|
560
|
+
<h3 className='text-lg font-semibold mb-4'>Secondary Button</h3>
|
|
561
|
+
<PaginationX pagination='SecondaryButton' />
|
|
562
|
+
</div>
|
|
563
|
+
|
|
564
|
+
<div>
|
|
565
|
+
<h3 className='text-lg font-semibold mb-4'>Bordered</h3>
|
|
566
|
+
<PaginationX pagination='Bordered' />
|
|
567
|
+
</div>
|
|
568
|
+
|
|
569
|
+
<div>
|
|
570
|
+
<h3 className='text-lg font-semibold mb-4'>Rounded</h3>
|
|
571
|
+
<PaginationX pagination='Rounded' />
|
|
572
|
+
</div>
|
|
573
|
+
|
|
574
|
+
<div>
|
|
575
|
+
<h3 className='text-lg font-semibold mb-4'>First & Last Navigation</h3>
|
|
576
|
+
<PaginationX pagination='FirstLast' />
|
|
577
|
+
</div>
|
|
578
|
+
|
|
579
|
+
<div>
|
|
580
|
+
<h3 className='text-lg font-semibold mb-4'>With Ellipsis</h3>
|
|
581
|
+
<PaginationX pagination='WithEllipsis' />
|
|
582
|
+
</div>
|
|
583
|
+
|
|
584
|
+
<div>
|
|
585
|
+
<h3 className='text-lg font-semibold mb-4'>Underline</h3>
|
|
586
|
+
<PaginationX pagination='Underline' />
|
|
587
|
+
</div>
|
|
588
|
+
|
|
589
|
+
<div>
|
|
590
|
+
<h3 className='text-lg font-semibold mb-4'>Card</h3>
|
|
591
|
+
<PaginationX pagination='Card' />
|
|
592
|
+
</div>
|
|
593
|
+
|
|
594
|
+
<div>
|
|
595
|
+
<h3 className='text-lg font-semibold mb-4'>Numberless</h3>
|
|
596
|
+
<PaginationX pagination='Numberless' />
|
|
597
|
+
</div>
|
|
598
|
+
|
|
599
|
+
<div>
|
|
600
|
+
<h3 className='text-lg font-semibold mb-4'>Numberless with Text</h3>
|
|
601
|
+
<PaginationX pagination='NumberlessWithText' />
|
|
602
|
+
</div>
|
|
603
|
+
|
|
604
|
+
<div>
|
|
605
|
+
<h3 className='text-lg font-semibold mb-4'>Mini</h3>
|
|
606
|
+
<PaginationX pagination='Mini' />
|
|
607
|
+
</div>
|
|
608
|
+
|
|
609
|
+
<div>
|
|
610
|
+
<h3 className='text-lg font-semibold mb-4'>With Select</h3>
|
|
611
|
+
<PaginationX pagination='WithSelect' />
|
|
612
|
+
</div>
|
|
613
|
+
|
|
614
|
+
<div>
|
|
615
|
+
<h3 className='text-lg font-semibold mb-4'>Table Pagination</h3>
|
|
616
|
+
<PaginationX pagination='Table' />
|
|
617
|
+
</div>
|
|
618
|
+
</div>
|
|
619
|
+
)
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
// #endregion
|