@foundrykit/components 0.1.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.
@@ -0,0 +1,184 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { Command as CommandPrimitive } from "cmdk"
5
+ import { SearchIcon } from "lucide-react"
6
+
7
+ import { cn } from "@foundrykit/utils"
8
+ import {
9
+ Dialog,
10
+ DialogContent,
11
+ DialogDescription,
12
+ DialogHeader,
13
+ DialogTitle,
14
+ } from "@foundrykit/primitives"
15
+
16
+ function Command({
17
+ className,
18
+ ...props
19
+ }: React.ComponentProps<typeof CommandPrimitive>) {
20
+ return (
21
+ <CommandPrimitive
22
+ data-slot="command"
23
+ className={cn(
24
+ "bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",
25
+ className
26
+ )}
27
+ {...props}
28
+ />
29
+ )
30
+ }
31
+
32
+ function CommandDialog({
33
+ title = "Command Palette",
34
+ description = "Search for a command to run...",
35
+ children,
36
+ className,
37
+ showCloseButton = true,
38
+ ...props
39
+ }: React.ComponentProps<typeof Dialog> & {
40
+ title?: string
41
+ description?: string
42
+ className?: string
43
+ showCloseButton?: boolean
44
+ }) {
45
+ return (
46
+ <Dialog {...props}>
47
+ <DialogHeader className="sr-only">
48
+ <DialogTitle>{title}</DialogTitle>
49
+ <DialogDescription>{description}</DialogDescription>
50
+ </DialogHeader>
51
+ <DialogContent
52
+ className={cn("overflow-hidden p-0", className)}
53
+ showCloseButton={showCloseButton}
54
+ >
55
+ <Command className="[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
56
+ {children}
57
+ </Command>
58
+ </DialogContent>
59
+ </Dialog>
60
+ )
61
+ }
62
+
63
+ function CommandInput({
64
+ className,
65
+ ...props
66
+ }: React.ComponentProps<typeof CommandPrimitive.Input>) {
67
+ return (
68
+ <div
69
+ data-slot="command-input-wrapper"
70
+ className="flex h-9 items-center gap-2 border-b px-3"
71
+ >
72
+ <SearchIcon className="size-4 shrink-0 opacity-50" />
73
+ <CommandPrimitive.Input
74
+ data-slot="command-input"
75
+ className={cn(
76
+ "placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
77
+ className
78
+ )}
79
+ {...props}
80
+ />
81
+ </div>
82
+ )
83
+ }
84
+
85
+ function CommandList({
86
+ className,
87
+ ...props
88
+ }: React.ComponentProps<typeof CommandPrimitive.List>) {
89
+ return (
90
+ <CommandPrimitive.List
91
+ data-slot="command-list"
92
+ className={cn(
93
+ "max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",
94
+ className
95
+ )}
96
+ {...props}
97
+ />
98
+ )
99
+ }
100
+
101
+ function CommandEmpty({
102
+ ...props
103
+ }: React.ComponentProps<typeof CommandPrimitive.Empty>) {
104
+ return (
105
+ <CommandPrimitive.Empty
106
+ data-slot="command-empty"
107
+ className="py-6 text-center text-sm"
108
+ {...props}
109
+ />
110
+ )
111
+ }
112
+
113
+ function CommandGroup({
114
+ className,
115
+ ...props
116
+ }: React.ComponentProps<typeof CommandPrimitive.Group>) {
117
+ return (
118
+ <CommandPrimitive.Group
119
+ data-slot="command-group"
120
+ className={cn(
121
+ "text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",
122
+ className
123
+ )}
124
+ {...props}
125
+ />
126
+ )
127
+ }
128
+
129
+ function CommandSeparator({
130
+ className,
131
+ ...props
132
+ }: React.ComponentProps<typeof CommandPrimitive.Separator>) {
133
+ return (
134
+ <CommandPrimitive.Separator
135
+ data-slot="command-separator"
136
+ className={cn("bg-border -mx-1 h-px", className)}
137
+ {...props}
138
+ />
139
+ )
140
+ }
141
+
142
+ function CommandItem({
143
+ className,
144
+ ...props
145
+ }: React.ComponentProps<typeof CommandPrimitive.Item>) {
146
+ return (
147
+ <CommandPrimitive.Item
148
+ data-slot="command-item"
149
+ className={cn(
150
+ "data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
151
+ className
152
+ )}
153
+ {...props}
154
+ />
155
+ )
156
+ }
157
+
158
+ function CommandShortcut({
159
+ className,
160
+ ...props
161
+ }: React.ComponentProps<"span">) {
162
+ return (
163
+ <span
164
+ data-slot="command-shortcut"
165
+ className={cn(
166
+ "text-muted-foreground ml-auto text-xs tracking-widest",
167
+ className
168
+ )}
169
+ {...props}
170
+ />
171
+ )
172
+ }
173
+
174
+ export {
175
+ Command,
176
+ CommandDialog,
177
+ CommandInput,
178
+ CommandList,
179
+ CommandEmpty,
180
+ CommandGroup,
181
+ CommandItem,
182
+ CommandShortcut,
183
+ CommandSeparator,
184
+ }
@@ -0,0 +1,54 @@
1
+ import { ComponentConfig } from '@foundrykit/types';
2
+
3
+ export const datePickerConfig: ComponentConfig = {
4
+ name: 'Date Picker',
5
+ description: 'Date picker component with calendar popup',
6
+ category: 'components',
7
+ tags: ['date', 'picker', 'calendar', 'form'],
8
+ preview: {
9
+ type: 'static',
10
+ html: '<div class="flex h-12 w-full items-center justify-between rounded-md border border-gray-300 bg-white px-3"><div class="h-2 w-16 rounded bg-gray-400"></div><div class="h-2 w-2 rotate-45 border border-gray-400"></div></div>',
11
+ },
12
+ variants: [
13
+ {
14
+ name: 'Default',
15
+ description: 'Default date picker',
16
+ code: '<DatePicker selected={date} onSelect={setDate} />',
17
+ preview: {
18
+ type: 'component',
19
+ component: 'DatePicker',
20
+ props: { selected: new Date(), onSelect: () => {} },
21
+ },
22
+ },
23
+ {
24
+ name: 'With Placeholder',
25
+ description: 'Date picker with custom placeholder',
26
+ code: '<DatePicker placeholder="Select date..." selected={date} onSelect={setDate} />',
27
+ preview: {
28
+ type: 'component',
29
+ component: 'DatePicker',
30
+ props: {
31
+ placeholder: 'Select date...',
32
+ selected: new Date(),
33
+ onSelect: () => {},
34
+ },
35
+ },
36
+ },
37
+ {
38
+ name: 'Range',
39
+ description: 'Date range picker',
40
+ code: '<DatePicker mode="range" selected={dateRange} onSelect={setDateRange} />',
41
+ preview: {
42
+ type: 'component',
43
+ component: 'DatePicker',
44
+ props: {
45
+ mode: 'range',
46
+ selected: { from: new Date(), to: new Date() },
47
+ onSelect: () => {},
48
+ },
49
+ },
50
+ },
51
+ ],
52
+ dependencies: ['primitives', 'utils'],
53
+ files: ['components/date-picker/index.tsx'],
54
+ };
@@ -0,0 +1,139 @@
1
+ import * as React from 'react';
2
+ import { Calendar as CalendarIcon } from 'lucide-react';
3
+ import { format } from 'date-fns';
4
+
5
+ import { Button } from '@foundrykit/primitives';
6
+ import { Input } from '@foundrykit/primitives';
7
+ import { cn } from '@foundrykit/utils';
8
+
9
+ export interface DatePickerProps {
10
+ value?: Date;
11
+ onValueChange?: (date: Date | undefined) => void;
12
+ placeholder?: string;
13
+ className?: string;
14
+ disabled?: boolean;
15
+ }
16
+
17
+ const DatePicker = React.forwardRef<HTMLDivElement, DatePickerProps>(
18
+ (
19
+ { value, onValueChange, placeholder = 'Pick a date', className, disabled },
20
+ ref
21
+ ) => {
22
+ const [open, setOpen] = React.useState(false);
23
+ const [selectedDate, setSelectedDate] = React.useState<Date | undefined>(
24
+ value
25
+ );
26
+
27
+ const handleDateSelect = (date: Date) => {
28
+ setSelectedDate(date);
29
+ onValueChange?.(date);
30
+ setOpen(false);
31
+ };
32
+
33
+ const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
34
+ const inputValue = e.target.value;
35
+ if (inputValue) {
36
+ const date = new Date(inputValue);
37
+ if (!isNaN(date.getTime())) {
38
+ setSelectedDate(date);
39
+ onValueChange?.(date);
40
+ }
41
+ } else {
42
+ setSelectedDate(undefined);
43
+ onValueChange?.(undefined);
44
+ }
45
+ };
46
+
47
+ const generateCalendarDays = () => {
48
+ const today = new Date();
49
+ const currentMonth = selectedDate
50
+ ? selectedDate.getMonth()
51
+ : today.getMonth();
52
+ const currentYear = selectedDate
53
+ ? selectedDate.getFullYear()
54
+ : today.getFullYear();
55
+
56
+ const firstDay = new Date(currentYear, currentMonth, 1);
57
+ const lastDay = new Date(currentYear, currentMonth + 1, 0);
58
+ const daysInMonth = lastDay.getDate();
59
+ const startingDayOfWeek = firstDay.getDay();
60
+
61
+ const days = [];
62
+
63
+ // Add empty cells for days before the first day of the month
64
+ for (let i = 0; i < startingDayOfWeek; i++) {
65
+ days.push(null);
66
+ }
67
+
68
+ // Add days of the month
69
+ for (let day = 1; day <= daysInMonth; day++) {
70
+ days.push(new Date(currentYear, currentMonth, day));
71
+ }
72
+
73
+ return days;
74
+ };
75
+
76
+ const calendarDays = generateCalendarDays();
77
+ const weekDays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
78
+
79
+ return (
80
+ <div className={cn('relative', className)} ref={ref}>
81
+ <div className='flex gap-2'>
82
+ <Input
83
+ type='date'
84
+ value={selectedDate ? format(selectedDate, 'yyyy-MM-dd') : ''}
85
+ onChange={handleInputChange}
86
+ placeholder={placeholder}
87
+ disabled={disabled}
88
+ className='flex-1'
89
+ />
90
+ <Button
91
+ variant='outline'
92
+ onClick={() => setOpen(!open)}
93
+ disabled={disabled}
94
+ className='px-3'
95
+ >
96
+ <CalendarIcon className='h-4 w-4' />
97
+ </Button>
98
+ </div>
99
+
100
+ {open && (
101
+ <div className='bg-popover absolute top-full z-50 mt-1 w-80 rounded-md border p-3 shadow-md'>
102
+ <div className='mb-2 grid grid-cols-7 gap-1 text-center text-sm font-medium'>
103
+ {weekDays.map(day => (
104
+ <div key={day} className='p-1'>
105
+ {day}
106
+ </div>
107
+ ))}
108
+ </div>
109
+ <div className='grid grid-cols-7 gap-1'>
110
+ {calendarDays.map((day, index) => (
111
+ <button
112
+ key={index}
113
+ className={cn(
114
+ 'hover:bg-accent hover:text-accent-foreground rounded p-2 text-sm',
115
+ day &&
116
+ selectedDate &&
117
+ day.toDateString() === selectedDate.toDateString()
118
+ ? 'bg-primary text-primary-foreground'
119
+ : day && day.toDateString() === new Date().toDateString()
120
+ ? 'bg-muted'
121
+ : 'text-muted-foreground'
122
+ )}
123
+ onClick={() => day && handleDateSelect(day)}
124
+ disabled={!day}
125
+ >
126
+ {day ? day.getDate() : ''}
127
+ </button>
128
+ ))}
129
+ </div>
130
+ </div>
131
+ )}
132
+ </div>
133
+ );
134
+ }
135
+ );
136
+
137
+ DatePicker.displayName = 'DatePicker';
138
+
139
+ export { DatePicker };
@@ -0,0 +1,192 @@
1
+ import { ComponentConfig } from '@foundrykit/types';
2
+
3
+ export const paginationConfig: ComponentConfig = {
4
+ name: 'Pagination',
5
+ description: 'Pagination component for navigating through pages of content',
6
+ category: 'components',
7
+ tags: ['navigation', 'interactive', 'ui'],
8
+ preview: {
9
+ type: 'static',
10
+ html: '<div class="flex h-12 w-full items-center justify-center rounded-md bg-gray-200"><div class="flex items-center space-x-2"><button class="inline-flex items-center justify-center rounded-md text-sm font-medium h-9 px-3 py-2 border border-gray-300 bg-white hover:bg-gray-50">Previous</button><button class="inline-flex items-center justify-center rounded-md text-sm font-medium h-9 w-9 border border-gray-300 bg-white hover:bg-gray-50">1</button><button class="inline-flex items-center justify-center rounded-md text-sm font-medium h-9 w-9 border border-blue-500 bg-blue-500 text-white">2</button><button class="inline-flex items-center justify-center rounded-md text-sm font-medium h-9 w-9 border border-gray-300 bg-white hover:bg-gray-50">3</button><button class="inline-flex items-center justify-center rounded-md text-sm font-medium h-9 px-3 py-2 border border-gray-300 bg-white hover:bg-gray-50">Next</button></div></div>'
11
+ },
12
+ variants: [
13
+ {
14
+ name: 'Default',
15
+ description: 'Basic pagination with page numbers',
16
+ code: `<Pagination>
17
+ <PaginationContent>
18
+ <PaginationItem>
19
+ <PaginationPrevious href="#" />
20
+ </PaginationItem>
21
+ <PaginationItem>
22
+ <PaginationLink href="#" isActive>1</PaginationLink>
23
+ </PaginationItem>
24
+ <PaginationItem>
25
+ <PaginationLink href="#">2</PaginationLink>
26
+ </PaginationItem>
27
+ <PaginationItem>
28
+ <PaginationLink href="#">3</PaginationLink>
29
+ </PaginationItem>
30
+ <PaginationItem>
31
+ <PaginationNext href="#" />
32
+ </PaginationItem>
33
+ </PaginationContent>
34
+ </Pagination>`,
35
+ preview: {
36
+ type: 'component',
37
+ component: 'Pagination',
38
+ props: {
39
+ children: {
40
+ type: 'PaginationContent',
41
+ props: {
42
+ children: [
43
+ { type: 'PaginationItem', props: { children: { type: 'PaginationPrevious', props: { href: '#' } } } },
44
+ { type: 'PaginationItem', props: { children: { type: 'PaginationLink', props: { href: '#', isActive: true, children: '1' } } } },
45
+ { type: 'PaginationItem', props: { children: { type: 'PaginationLink', props: { href: '#', children: '2' } } } },
46
+ { type: 'PaginationItem', props: { children: { type: 'PaginationLink', props: { href: '#', children: '3' } } } },
47
+ { type: 'PaginationItem', props: { children: { type: 'PaginationNext', props: { href: '#' } } } }
48
+ ]
49
+ }
50
+ }
51
+ }
52
+ }
53
+ },
54
+ {
55
+ name: 'With Ellipsis',
56
+ description: 'Pagination with ellipsis for many pages',
57
+ code: `<Pagination>
58
+ <PaginationContent>
59
+ <PaginationItem>
60
+ <PaginationPrevious href="#" />
61
+ </PaginationItem>
62
+ <PaginationItem>
63
+ <PaginationLink href="#">1</PaginationLink>
64
+ </PaginationItem>
65
+ <PaginationItem>
66
+ <PaginationEllipsis />
67
+ </PaginationItem>
68
+ <PaginationItem>
69
+ <PaginationLink href="#" isActive>4</PaginationLink>
70
+ </PaginationItem>
71
+ <PaginationItem>
72
+ <PaginationLink href="#">5</PaginationLink>
73
+ </PaginationItem>
74
+ <PaginationItem>
75
+ <PaginationEllipsis />
76
+ </PaginationItem>
77
+ <PaginationItem>
78
+ <PaginationLink href="#">10</PaginationLink>
79
+ </PaginationItem>
80
+ <PaginationItem>
81
+ <PaginationNext href="#" />
82
+ </PaginationItem>
83
+ </PaginationContent>
84
+ </Pagination>`,
85
+ preview: {
86
+ type: 'component',
87
+ component: 'Pagination',
88
+ props: {
89
+ children: {
90
+ type: 'PaginationContent',
91
+ props: {
92
+ children: [
93
+ { type: 'PaginationItem', props: { children: { type: 'PaginationPrevious', props: { href: '#' } } } },
94
+ { type: 'PaginationItem', props: { children: { type: 'PaginationLink', props: { href: '#', children: '1' } } } },
95
+ { type: 'PaginationItem', props: { children: { type: 'PaginationEllipsis', props: {} } } },
96
+ { type: 'PaginationItem', props: { children: { type: 'PaginationLink', props: { href: '#', isActive: true, children: '4' } } } },
97
+ { type: 'PaginationItem', props: { children: { type: 'PaginationLink', props: { href: '#', children: '5' } } } },
98
+ { type: 'PaginationItem', props: { children: { type: 'PaginationEllipsis', props: {} } } },
99
+ { type: 'PaginationItem', props: { children: { type: 'PaginationLink', props: { href: '#', children: '10' } } } },
100
+ { type: 'PaginationItem', props: { children: { type: 'PaginationNext', props: { href: '#' } } } }
101
+ ]
102
+ }
103
+ }
104
+ }
105
+ }
106
+ },
107
+ {
108
+ name: 'Compact',
109
+ description: 'Compact pagination with smaller buttons',
110
+ code: `<Pagination>
111
+ <PaginationContent>
112
+ <PaginationItem>
113
+ <PaginationPrevious href="#" />
114
+ </PaginationItem>
115
+ <PaginationItem>
116
+ <PaginationLink href="#" size="sm" isActive>1</PaginationLink>
117
+ </PaginationItem>
118
+ <PaginationItem>
119
+ <PaginationLink href="#" size="sm">2</PaginationLink>
120
+ </PaginationItem>
121
+ <PaginationItem>
122
+ <PaginationLink href="#" size="sm">3</PaginationLink>
123
+ </PaginationItem>
124
+ <PaginationItem>
125
+ <PaginationNext href="#" />
126
+ </PaginationItem>
127
+ </PaginationContent>
128
+ </Pagination>`,
129
+ preview: {
130
+ type: 'component',
131
+ component: 'Pagination',
132
+ props: {
133
+ children: {
134
+ type: 'PaginationContent',
135
+ props: {
136
+ children: [
137
+ { type: 'PaginationItem', props: { children: { type: 'PaginationPrevious', props: { href: '#' } } } },
138
+ { type: 'PaginationItem', props: { children: { type: 'PaginationLink', props: { href: '#', size: 'sm', isActive: true, children: '1' } } } },
139
+ { type: 'PaginationItem', props: { children: { type: 'PaginationLink', props: { href: '#', size: 'sm', children: '2' } } } },
140
+ { type: 'PaginationItem', props: { children: { type: 'PaginationLink', props: { href: '#', size: 'sm', children: '3' } } } },
141
+ { type: 'PaginationItem', props: { children: { type: 'PaginationNext', props: { href: '#' } } } }
142
+ ]
143
+ }
144
+ }
145
+ }
146
+ }
147
+ },
148
+ {
149
+ name: 'Disabled States',
150
+ description: 'Pagination with disabled previous/next buttons',
151
+ code: `<Pagination>
152
+ <PaginationContent>
153
+ <PaginationItem>
154
+ <PaginationPrevious href="#" className="pointer-events-none opacity-50" />
155
+ </PaginationItem>
156
+ <PaginationItem>
157
+ <PaginationLink href="#" isActive>1</PaginationLink>
158
+ </PaginationItem>
159
+ <PaginationItem>
160
+ <PaginationLink href="#">2</PaginationLink>
161
+ </PaginationItem>
162
+ <PaginationItem>
163
+ <PaginationLink href="#">3</PaginationLink>
164
+ </PaginationItem>
165
+ <PaginationItem>
166
+ <PaginationNext href="#" />
167
+ </PaginationItem>
168
+ </PaginationContent>
169
+ </Pagination>`,
170
+ preview: {
171
+ type: 'component',
172
+ component: 'Pagination',
173
+ props: {
174
+ children: {
175
+ type: 'PaginationContent',
176
+ props: {
177
+ children: [
178
+ { type: 'PaginationItem', props: { children: { type: 'PaginationPrevious', props: { href: '#', className: 'pointer-events-none opacity-50' } } } },
179
+ { type: 'PaginationItem', props: { children: { type: 'PaginationLink', props: { href: '#', isActive: true, children: '1' } } } },
180
+ { type: 'PaginationItem', props: { children: { type: 'PaginationLink', props: { href: '#', children: '2' } } } },
181
+ { type: 'PaginationItem', props: { children: { type: 'PaginationLink', props: { href: '#', children: '3' } } } },
182
+ { type: 'PaginationItem', props: { children: { type: 'PaginationNext', props: { href: '#' } } } }
183
+ ]
184
+ }
185
+ }
186
+ }
187
+ }
188
+ }
189
+ ],
190
+ dependencies: ['utils', 'primitives'],
191
+ files: ['components/pagination/index.tsx']
192
+ };
@@ -0,0 +1,127 @@
1
+ import * as React from 'react';
2
+ import {
3
+ ChevronLeftIcon,
4
+ ChevronRightIcon,
5
+ MoreHorizontalIcon,
6
+ } from 'lucide-react';
7
+
8
+ import { cn } from '@foundrykit/utils';
9
+ import { Button, buttonVariants } from '@foundrykit/primitives';
10
+
11
+ function Pagination({ className, ...props }: React.ComponentProps<'nav'>) {
12
+ return (
13
+ <nav
14
+ role='navigation'
15
+ aria-label='pagination'
16
+ data-slot='pagination'
17
+ className={cn('mx-auto flex w-full justify-center', className)}
18
+ {...props}
19
+ />
20
+ );
21
+ }
22
+
23
+ function PaginationContent({
24
+ className,
25
+ ...props
26
+ }: React.ComponentProps<'ul'>) {
27
+ return (
28
+ <ul
29
+ data-slot='pagination-content'
30
+ className={cn('flex flex-row items-center gap-1', className)}
31
+ {...props}
32
+ />
33
+ );
34
+ }
35
+
36
+ function PaginationItem({ ...props }: React.ComponentProps<'li'>) {
37
+ return <li data-slot='pagination-item' {...props} />;
38
+ }
39
+
40
+ type PaginationLinkProps = {
41
+ isActive?: boolean;
42
+ } & Pick<React.ComponentProps<typeof Button>, 'size'> &
43
+ React.ComponentProps<'a'>;
44
+
45
+ function PaginationLink({
46
+ className,
47
+ isActive,
48
+ size = 'icon',
49
+ ...props
50
+ }: PaginationLinkProps) {
51
+ return (
52
+ <a
53
+ aria-current={isActive ? 'page' : undefined}
54
+ data-slot='pagination-link'
55
+ data-active={isActive}
56
+ className={cn(
57
+ buttonVariants({
58
+ variant: isActive ? 'outline' : 'ghost',
59
+ size,
60
+ }),
61
+ className
62
+ )}
63
+ {...props}
64
+ />
65
+ );
66
+ }
67
+
68
+ function PaginationPrevious({
69
+ className,
70
+ ...props
71
+ }: React.ComponentProps<typeof PaginationLink>) {
72
+ return (
73
+ <PaginationLink
74
+ aria-label='Go to previous page'
75
+ size='default'
76
+ className={cn('gap-1 px-2.5 sm:pl-2.5', className)}
77
+ {...props}
78
+ >
79
+ <ChevronLeftIcon />
80
+ <span className='hidden sm:block'>Previous</span>
81
+ </PaginationLink>
82
+ );
83
+ }
84
+
85
+ function PaginationNext({
86
+ className,
87
+ ...props
88
+ }: React.ComponentProps<typeof PaginationLink>) {
89
+ return (
90
+ <PaginationLink
91
+ aria-label='Go to next page'
92
+ size='default'
93
+ className={cn('gap-1 px-2.5 sm:pr-2.5', className)}
94
+ {...props}
95
+ >
96
+ <span className='hidden sm:block'>Next</span>
97
+ <ChevronRightIcon />
98
+ </PaginationLink>
99
+ );
100
+ }
101
+
102
+ function PaginationEllipsis({
103
+ className,
104
+ ...props
105
+ }: React.ComponentProps<'span'>) {
106
+ return (
107
+ <span
108
+ aria-hidden
109
+ data-slot='pagination-ellipsis'
110
+ className={cn('flex size-9 items-center justify-center', className)}
111
+ {...props}
112
+ >
113
+ <MoreHorizontalIcon className='size-4' />
114
+ <span className='sr-only'>More pages</span>
115
+ </span>
116
+ );
117
+ }
118
+
119
+ export {
120
+ Pagination,
121
+ PaginationContent,
122
+ PaginationLink,
123
+ PaginationItem,
124
+ PaginationPrevious,
125
+ PaginationNext,
126
+ PaginationEllipsis,
127
+ };