@neynar/ui 0.1.1 → 0.1.2
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/dist/components/ui/accordion.d.ts +1 -25
- package/dist/components/ui/accordion.d.ts.map +1 -1
- package/dist/components/ui/alert-dialog.d.ts +240 -46
- package/dist/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/components/ui/alert.d.ts +73 -11
- package/dist/components/ui/alert.d.ts.map +1 -1
- package/dist/components/ui/aspect-ratio.d.ts +44 -10
- package/dist/components/ui/aspect-ratio.d.ts.map +1 -1
- package/dist/components/ui/avatar.d.ts +117 -33
- package/dist/components/ui/avatar.d.ts.map +1 -1
- package/dist/components/ui/badge.d.ts +50 -71
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/breadcrumb.d.ts +231 -49
- package/dist/components/ui/breadcrumb.d.ts.map +1 -1
- package/dist/components/ui/button.d.ts +189 -71
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/calendar.d.ts +197 -40
- package/dist/components/ui/calendar.d.ts.map +1 -1
- package/dist/components/ui/card.d.ts +7 -22
- package/dist/components/ui/card.d.ts.map +1 -1
- package/dist/components/ui/carousel.d.ts +369 -99
- package/dist/components/ui/carousel.d.ts.map +1 -1
- package/dist/components/ui/chart.d.ts.map +1 -1
- package/dist/components/ui/checkbox.d.ts +110 -38
- package/dist/components/ui/checkbox.d.ts.map +1 -1
- package/dist/components/ui/collapsible.d.ts +246 -61
- package/dist/components/ui/collapsible.d.ts.map +1 -1
- package/dist/components/ui/combobox.d.ts +207 -159
- package/dist/components/ui/combobox.d.ts.map +1 -1
- package/dist/components/ui/command.d.ts +336 -67
- package/dist/components/ui/command.d.ts.map +1 -1
- package/dist/components/ui/container.d.ts +159 -64
- package/dist/components/ui/container.d.ts.map +1 -1
- package/dist/components/ui/context-menu.d.ts +321 -39
- package/dist/components/ui/context-menu.d.ts.map +1 -1
- package/dist/components/ui/date-picker.d.ts +113 -86
- package/dist/components/ui/date-picker.d.ts.map +1 -1
- package/dist/components/ui/dialog.d.ts +106 -25
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/drawer.d.ts +388 -59
- package/dist/components/ui/drawer.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu.d.ts +521 -74
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/empty-state.d.ts +148 -76
- package/dist/components/ui/empty-state.d.ts.map +1 -1
- package/dist/components/ui/hover-card.d.ts +253 -34
- package/dist/components/ui/hover-card.d.ts.map +1 -1
- package/dist/components/ui/input.d.ts +143 -44
- package/dist/components/ui/input.d.ts.map +1 -1
- package/dist/components/ui/label.d.ts +0 -8
- package/dist/components/ui/label.d.ts.map +1 -1
- package/dist/components/ui/menubar.d.ts +288 -46
- package/dist/components/ui/menubar.d.ts.map +1 -1
- package/dist/components/ui/navigation-menu.d.ts +444 -127
- package/dist/components/ui/navigation-menu.d.ts.map +1 -1
- package/dist/components/ui/pagination.d.ts +342 -66
- package/dist/components/ui/pagination.d.ts.map +1 -1
- package/dist/components/ui/popover.d.ts +0 -8
- package/dist/components/ui/popover.d.ts.map +1 -1
- package/dist/components/ui/progress.d.ts +88 -30
- package/dist/components/ui/progress.d.ts.map +1 -1
- package/dist/components/ui/radio-group.d.ts +189 -45
- package/dist/components/ui/radio-group.d.ts.map +1 -1
- package/dist/components/ui/resizable.d.ts +178 -62
- package/dist/components/ui/resizable.d.ts.map +1 -1
- package/dist/components/ui/scroll-area.d.ts +180 -21
- package/dist/components/ui/scroll-area.d.ts.map +1 -1
- package/dist/components/ui/select.d.ts +382 -60
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/components/ui/separator.d.ts +52 -39
- package/dist/components/ui/separator.d.ts.map +1 -1
- package/dist/components/ui/sheet.d.ts +144 -27
- package/dist/components/ui/sheet.d.ts.map +1 -1
- package/dist/components/ui/sidebar.d.ts +81 -31
- package/dist/components/ui/sidebar.d.ts.map +1 -1
- package/dist/components/ui/skeleton.d.ts +94 -32
- package/dist/components/ui/skeleton.d.ts.map +1 -1
- package/dist/components/ui/slider.d.ts +37 -31
- package/dist/components/ui/slider.d.ts.map +1 -1
- package/dist/components/ui/sonner.d.ts +280 -46
- package/dist/components/ui/sonner.d.ts.map +1 -1
- package/dist/components/ui/stack.d.ts +289 -148
- package/dist/components/ui/stack.d.ts.map +1 -1
- package/dist/components/ui/stories/aspect-ratio.stories.d.ts +1 -2
- package/dist/components/ui/stories/aspect-ratio.stories.d.ts.map +1 -1
- package/dist/components/ui/stories/container.stories.d.ts +2 -3
- package/dist/components/ui/stories/container.stories.d.ts.map +1 -1
- package/dist/components/ui/stories/empty-state.stories.d.ts +2 -2
- package/dist/components/ui/stories/scroll-area.stories.d.ts +1 -2
- package/dist/components/ui/stories/scroll-area.stories.d.ts.map +1 -1
- package/dist/components/ui/stories/stack.stories.d.ts +1 -1
- package/dist/components/ui/stories/text-field.stories.d.ts +7 -1
- package/dist/components/ui/stories/text-field.stories.d.ts.map +1 -1
- package/dist/components/ui/switch.d.ts +44 -38
- package/dist/components/ui/switch.d.ts.map +1 -1
- package/dist/components/ui/table.d.ts +33 -0
- package/dist/components/ui/table.d.ts.map +1 -1
- package/dist/components/ui/tabs.d.ts +4 -22
- package/dist/components/ui/tabs.d.ts.map +1 -1
- package/dist/components/ui/text-field.d.ts +170 -84
- package/dist/components/ui/text-field.d.ts.map +1 -1
- package/dist/components/ui/textarea.d.ts +106 -29
- package/dist/components/ui/textarea.d.ts.map +1 -1
- package/dist/components/ui/theme-toggle.d.ts +190 -65
- package/dist/components/ui/theme-toggle.d.ts.map +1 -1
- package/dist/components/ui/theme.d.ts +107 -23
- package/dist/components/ui/theme.d.ts.map +1 -1
- package/dist/components/ui/toggle-group.d.ts +143 -67
- package/dist/components/ui/toggle-group.d.ts.map +1 -1
- package/dist/components/ui/toggle.d.ts +118 -30
- package/dist/components/ui/toggle.d.ts.map +1 -1
- package/dist/components/ui/tooltip.d.ts +152 -28
- package/dist/components/ui/tooltip.d.ts.map +1 -1
- package/dist/components/ui/typography.d.ts +452 -134
- package/dist/components/ui/typography.d.ts.map +1 -1
- package/dist/index.js +9388 -8281
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/llms.txt +173 -3
- package/package.json +5 -2
- package/src/components/ui/accordion.tsx +112 -27
- package/src/components/ui/alert-dialog.tsx +401 -46
- package/src/components/ui/alert.tsx +114 -11
- package/src/components/ui/aspect-ratio.tsx +69 -14
- package/src/components/ui/avatar.tsx +179 -33
- package/src/components/ui/badge.tsx +74 -75
- package/src/components/ui/breadcrumb.tsx +335 -50
- package/src/components/ui/button.tsx +198 -90
- package/src/components/ui/calendar.tsx +867 -43
- package/src/components/ui/card.tsx +140 -33
- package/src/components/ui/carousel.tsx +529 -98
- package/src/components/ui/chart.tsx +222 -1
- package/src/components/ui/checkbox.tsx +176 -38
- package/src/components/ui/collapsible.tsx +321 -67
- package/src/components/ui/combobox.tsx +284 -83
- package/src/components/ui/command.tsx +527 -67
- package/src/components/ui/container.tsx +217 -65
- package/src/components/ui/context-menu.tsx +716 -51
- package/src/components/ui/date-picker.tsx +228 -38
- package/src/components/ui/dialog.tsx +270 -33
- package/src/components/ui/drawer.tsx +546 -67
- package/src/components/ui/dropdown-menu.tsx +657 -74
- package/src/components/ui/empty-state.tsx +241 -82
- package/src/components/ui/hover-card.tsx +328 -39
- package/src/components/ui/input.tsx +207 -44
- package/src/components/ui/label.tsx +98 -8
- package/src/components/ui/menubar.tsx +587 -54
- package/src/components/ui/navigation-menu.tsx +557 -128
- package/src/components/ui/pagination.tsx +561 -79
- package/src/components/ui/popover.tsx +119 -8
- package/src/components/ui/progress.tsx +131 -29
- package/src/components/ui/radio-group.tsx +260 -51
- package/src/components/ui/resizable.tsx +289 -63
- package/src/components/ui/scroll-area.tsx +377 -66
- package/src/components/ui/select.tsx +545 -60
- package/src/components/ui/separator.tsx +146 -40
- package/src/components/ui/sheet.tsx +348 -31
- package/src/components/ui/sidebar.tsx +471 -29
- package/src/components/ui/skeleton.tsx +114 -32
- package/src/components/ui/slider.tsx +77 -31
- package/src/components/ui/sonner.tsx +574 -46
- package/src/components/ui/stack.tsx +423 -101
- package/src/components/ui/switch.tsx +78 -39
- package/src/components/ui/table.tsx +170 -4
- package/src/components/ui/tabs.tsx +108 -22
- package/src/components/ui/text-field.tsx +226 -81
- package/src/components/ui/textarea.tsx +180 -29
- package/src/components/ui/theme-toggle.tsx +313 -65
- package/src/components/ui/theme.tsx +117 -23
- package/src/components/ui/toggle-group.tsx +280 -69
- package/src/components/ui/toggle.tsx +124 -35
- package/src/components/ui/tooltip.tsx +239 -29
- package/src/components/ui/typography.tsx +1115 -165
|
@@ -6,17 +6,51 @@ import {
|
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
|
|
8
8
|
import { cn } from "@/lib/utils";
|
|
9
|
-
import {
|
|
9
|
+
import { buttonVariants } from "@/components/ui/button";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Props for Pagination component (Documentation only - NOT used in component implementation)
|
|
13
|
+
* These types are for documentation generation and should not replace inferred HTML element types
|
|
14
|
+
*/
|
|
15
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
16
|
+
type PaginationDocsProps = {
|
|
17
|
+
/** Additional CSS classes for custom styling */
|
|
18
|
+
className?: string;
|
|
19
|
+
/** Child elements - typically PaginationContent */
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
/** ARIA role for the navigation element @default "navigation" */
|
|
22
|
+
role?: string;
|
|
23
|
+
/** ARIA label describing the navigation's purpose @default "pagination" */
|
|
24
|
+
"aria-label"?: string;
|
|
25
|
+
/** Custom id attribute for the pagination navigation */
|
|
26
|
+
id?: string;
|
|
27
|
+
/** Tab index for focus management @default 0 */
|
|
28
|
+
tabIndex?: number;
|
|
29
|
+
} & React.HTMLAttributes<HTMLElement>;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Component prop type using inferred HTML nav element props
|
|
33
|
+
*/
|
|
34
|
+
type PaginationProps = {
|
|
35
|
+
/** Additional CSS classes for custom styling */
|
|
36
|
+
className?: string;
|
|
37
|
+
/** Child elements - typically PaginationContent */
|
|
38
|
+
children?: React.ReactNode;
|
|
39
|
+
} & Omit<React.ComponentProps<"nav">, "className" | "children">;
|
|
10
40
|
|
|
11
41
|
/**
|
|
12
42
|
* Pagination navigation component for large datasets
|
|
13
43
|
*
|
|
14
44
|
* A comprehensive pagination component built on shadcn/ui standards that provides
|
|
15
|
-
* intuitive navigation through pages of content.
|
|
16
|
-
*
|
|
45
|
+
* intuitive navigation through pages of content. All interactive elements use
|
|
46
|
+
* buttonVariants from the Button component for consistent styling and behavior:
|
|
47
|
+
* - PaginationLink uses "outline" variant when active, "ghost" when inactive
|
|
48
|
+
* - PaginationPrevious/PaginationNext use "ghost" variant by default
|
|
49
|
+
* - All components inherit Button's focus management, hover states, and accessibility
|
|
17
50
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
51
|
+
* Features responsive design, full accessibility compliance, and flexible composition
|
|
52
|
+
* patterns for different use cases. Ideal for data tables, search results, product
|
|
53
|
+
* listings, and any paginated content that needs professional navigation controls.
|
|
20
54
|
*
|
|
21
55
|
* @example
|
|
22
56
|
* ```tsx
|
|
@@ -24,19 +58,19 @@ import { Button, buttonVariants } from "@/components/ui/button";
|
|
|
24
58
|
* <Pagination>
|
|
25
59
|
* <PaginationContent>
|
|
26
60
|
* <PaginationItem>
|
|
27
|
-
* <PaginationPrevious href="/page
|
|
61
|
+
* <PaginationPrevious href="/products?page=1" />
|
|
28
62
|
* </PaginationItem>
|
|
29
63
|
* <PaginationItem>
|
|
30
|
-
* <PaginationLink href="/page
|
|
64
|
+
* <PaginationLink href="/products?page=1">1</PaginationLink>
|
|
31
65
|
* </PaginationItem>
|
|
32
66
|
* <PaginationItem>
|
|
33
|
-
* <PaginationLink href="/page
|
|
67
|
+
* <PaginationLink href="/products?page=2" isActive>2</PaginationLink>
|
|
34
68
|
* </PaginationItem>
|
|
35
69
|
* <PaginationItem>
|
|
36
|
-
* <PaginationLink href="/page
|
|
70
|
+
* <PaginationLink href="/products?page=3">3</PaginationLink>
|
|
37
71
|
* </PaginationItem>
|
|
38
72
|
* <PaginationItem>
|
|
39
|
-
* <PaginationNext href="/page
|
|
73
|
+
* <PaginationNext href="/products?page=3" />
|
|
40
74
|
* </PaginationItem>
|
|
41
75
|
* </PaginationContent>
|
|
42
76
|
* </Pagination>
|
|
@@ -44,29 +78,35 @@ import { Button, buttonVariants } from "@/components/ui/button";
|
|
|
44
78
|
*
|
|
45
79
|
* @example
|
|
46
80
|
* ```tsx
|
|
47
|
-
* //
|
|
81
|
+
* // Complete pagination with ellipsis for large datasets
|
|
48
82
|
* <Pagination>
|
|
49
83
|
* <PaginationContent>
|
|
50
84
|
* <PaginationItem>
|
|
51
|
-
* <PaginationPrevious href="/page
|
|
85
|
+
* <PaginationPrevious href="/search?q=react&page=4" />
|
|
52
86
|
* </PaginationItem>
|
|
53
87
|
* <PaginationItem>
|
|
54
|
-
* <PaginationLink href="/page
|
|
88
|
+
* <PaginationLink href="/search?q=react&page=1">1</PaginationLink>
|
|
55
89
|
* </PaginationItem>
|
|
56
90
|
* <PaginationItem>
|
|
57
91
|
* <PaginationEllipsis />
|
|
58
92
|
* </PaginationItem>
|
|
59
93
|
* <PaginationItem>
|
|
60
|
-
* <PaginationLink href="/page
|
|
94
|
+
* <PaginationLink href="/search?q=react&page=4">4</PaginationLink>
|
|
95
|
+
* </PaginationItem>
|
|
96
|
+
* <PaginationItem>
|
|
97
|
+
* <PaginationLink href="/search?q=react&page=5" isActive>5</PaginationLink>
|
|
98
|
+
* </PaginationItem>
|
|
99
|
+
* <PaginationItem>
|
|
100
|
+
* <PaginationLink href="/search?q=react&page=6">6</PaginationLink>
|
|
61
101
|
* </PaginationItem>
|
|
62
102
|
* <PaginationItem>
|
|
63
103
|
* <PaginationEllipsis />
|
|
64
104
|
* </PaginationItem>
|
|
65
105
|
* <PaginationItem>
|
|
66
|
-
* <PaginationLink href="/page
|
|
106
|
+
* <PaginationLink href="/search?q=react&page=50">50</PaginationLink>
|
|
67
107
|
* </PaginationItem>
|
|
68
108
|
* <PaginationItem>
|
|
69
|
-
* <PaginationNext href="/page
|
|
109
|
+
* <PaginationNext href="/search?q=react&page=6" />
|
|
70
110
|
* </PaginationItem>
|
|
71
111
|
* </PaginationContent>
|
|
72
112
|
* </Pagination>
|
|
@@ -74,13 +114,81 @@ import { Button, buttonVariants } from "@/components/ui/button";
|
|
|
74
114
|
*
|
|
75
115
|
* @example
|
|
76
116
|
* ```tsx
|
|
77
|
-
* //
|
|
117
|
+
* // Client-side pagination with state management
|
|
118
|
+
* function PaginatedResults() {
|
|
119
|
+
* const [currentPage, setCurrentPage] = useState(1);
|
|
120
|
+
* const totalPages = 25;
|
|
121
|
+
*
|
|
122
|
+
* return (
|
|
123
|
+
* <Pagination>
|
|
124
|
+
* <PaginationContent>
|
|
125
|
+
* <PaginationItem>
|
|
126
|
+
* <PaginationPrevious
|
|
127
|
+
* href="#"
|
|
128
|
+
* onClick={(e) => {
|
|
129
|
+
* e.preventDefault();
|
|
130
|
+
* if (currentPage > 1) setCurrentPage(currentPage - 1);
|
|
131
|
+
* }}
|
|
132
|
+
* className={currentPage === 1 ? "pointer-events-none opacity-50" : ""}
|
|
133
|
+
* aria-disabled={currentPage === 1}
|
|
134
|
+
* />
|
|
135
|
+
* </PaginationItem>
|
|
136
|
+
*
|
|
137
|
+
* {[1, 2, 3].map((page) => (
|
|
138
|
+
* <PaginationItem key={page}>
|
|
139
|
+
* <PaginationLink
|
|
140
|
+
* href="#"
|
|
141
|
+
* isActive={currentPage === page}
|
|
142
|
+
* onClick={(e) => {
|
|
143
|
+
* e.preventDefault();
|
|
144
|
+
* setCurrentPage(page);
|
|
145
|
+
* }}
|
|
146
|
+
* >
|
|
147
|
+
* {page}
|
|
148
|
+
* </PaginationLink>
|
|
149
|
+
* </PaginationItem>
|
|
150
|
+
* ))}
|
|
151
|
+
*
|
|
152
|
+
* <PaginationItem>
|
|
153
|
+
* <PaginationNext
|
|
154
|
+
* href="#"
|
|
155
|
+
* onClick={(e) => {
|
|
156
|
+
* e.preventDefault();
|
|
157
|
+
* if (currentPage < totalPages) setCurrentPage(currentPage + 1);
|
|
158
|
+
* }}
|
|
159
|
+
* className={currentPage === totalPages ? "pointer-events-none opacity-50" : ""}
|
|
160
|
+
* aria-disabled={currentPage === totalPages}
|
|
161
|
+
* />
|
|
162
|
+
* </PaginationItem>
|
|
163
|
+
* </PaginationContent>
|
|
164
|
+
* </Pagination>
|
|
165
|
+
* );
|
|
166
|
+
* }
|
|
167
|
+
* ```
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```tsx
|
|
171
|
+
* // Different sizes for various use cases
|
|
172
|
+
* // Compact pagination for data tables
|
|
78
173
|
* <Pagination>
|
|
79
174
|
* <PaginationContent>
|
|
80
175
|
* <PaginationItem>
|
|
81
|
-
* <PaginationLink
|
|
82
|
-
*
|
|
83
|
-
*
|
|
176
|
+
* <PaginationLink href="/data?page=1" size="sm">1</PaginationLink>
|
|
177
|
+
* </PaginationItem>
|
|
178
|
+
* <PaginationItem>
|
|
179
|
+
* <PaginationLink href="/data?page=2" size="sm" isActive>2</PaginationLink>
|
|
180
|
+
* </PaginationItem>
|
|
181
|
+
* </PaginationContent>
|
|
182
|
+
* </Pagination>
|
|
183
|
+
*
|
|
184
|
+
* // Large pagination for primary content
|
|
185
|
+
* <Pagination>
|
|
186
|
+
* <PaginationContent>
|
|
187
|
+
* <PaginationItem>
|
|
188
|
+
* <PaginationLink href="/articles?page=1" size="lg">1</PaginationLink>
|
|
189
|
+
* </PaginationItem>
|
|
190
|
+
* <PaginationItem>
|
|
191
|
+
* <PaginationLink href="/articles?page=2" size="lg" isActive>2</PaginationLink>
|
|
84
192
|
* </PaginationItem>
|
|
85
193
|
* </PaginationContent>
|
|
86
194
|
* </Pagination>
|
|
@@ -90,11 +198,23 @@ import { Button, buttonVariants } from "@/components/ui/button";
|
|
|
90
198
|
* - Semantic nav element with role="navigation" and aria-label="pagination"
|
|
91
199
|
* - aria-current="page" automatically applied to active page links
|
|
92
200
|
* - Descriptive aria-labels on Previous/Next buttons for screen readers
|
|
93
|
-
* - Full keyboard navigation support
|
|
94
|
-
* - High contrast focus indicators
|
|
95
|
-
* - Screen reader friendly ellipsis with "More pages"
|
|
201
|
+
* - Full keyboard navigation support (Tab, Enter, Space keys)
|
|
202
|
+
* - High contrast focus indicators (3px ring) meeting WCAG 2.1 AA standards
|
|
203
|
+
* - Screen reader friendly ellipsis with hidden "More pages" text
|
|
204
|
+
* - Proper disabled states communicated via aria-disabled
|
|
205
|
+
* - Touch-friendly minimum 44px target sizes on all interactive elements
|
|
206
|
+
* - Respects user's reduced motion preferences in transitions
|
|
207
|
+
*
|
|
208
|
+
* @variant outline - Used for active page links (PaginationLink with isActive=true)
|
|
209
|
+
* @variant ghost - Used for inactive page links and navigation buttons (default state)
|
|
210
|
+
*
|
|
211
|
+
* @size icon - Default for PaginationLink (36px × 36px) optimized for page numbers
|
|
212
|
+
* @size default - Used for PaginationPrevious/Next (36px height with more padding)
|
|
213
|
+
* @size sm - Available for compact layouts (32px height)
|
|
214
|
+
* @size lg - Available for prominent pagination (40px height)
|
|
96
215
|
*
|
|
97
216
|
* @see {@link https://ui.shadcn.com/docs/components/pagination} shadcn/ui Pagination
|
|
217
|
+
* @see {@link buttonVariants} CVA configuration for all button styling
|
|
98
218
|
* @see {@link PaginationContent} Container for pagination items
|
|
99
219
|
* @see {@link PaginationLink} Individual page number links
|
|
100
220
|
* @see {@link PaginationPrevious} Previous page navigation button
|
|
@@ -102,7 +222,7 @@ import { Button, buttonVariants } from "@/components/ui/button";
|
|
|
102
222
|
* @see {@link PaginationEllipsis} Ellipsis indicator for omitted pages
|
|
103
223
|
* @since 1.0.0
|
|
104
224
|
*/
|
|
105
|
-
function Pagination({ className, ...props }:
|
|
225
|
+
function Pagination({ className, ...props }: PaginationProps) {
|
|
106
226
|
return (
|
|
107
227
|
<nav
|
|
108
228
|
role="navigation"
|
|
@@ -114,6 +234,34 @@ function Pagination({ className, ...props }: React.ComponentProps<"nav">) {
|
|
|
114
234
|
);
|
|
115
235
|
}
|
|
116
236
|
|
|
237
|
+
/**
|
|
238
|
+
* Props for PaginationContent component (Documentation only - NOT used in component implementation)
|
|
239
|
+
* These types are for documentation generation and should not replace inferred HTML element types
|
|
240
|
+
*/
|
|
241
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
242
|
+
type PaginationContentDocsProps = {
|
|
243
|
+
/** Additional CSS classes for custom styling */
|
|
244
|
+
className?: string;
|
|
245
|
+
/** Child elements - typically PaginationItem components */
|
|
246
|
+
children?: React.ReactNode;
|
|
247
|
+
/** Custom id attribute for the pagination list */
|
|
248
|
+
id?: string;
|
|
249
|
+
/** Tab index for focus management @default 0 */
|
|
250
|
+
tabIndex?: number;
|
|
251
|
+
/** ARIA label for the pagination list */
|
|
252
|
+
"aria-label"?: string;
|
|
253
|
+
} & React.HTMLAttributes<HTMLUListElement>;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Component prop type using inferred HTML ul element props
|
|
257
|
+
*/
|
|
258
|
+
type PaginationContentProps = {
|
|
259
|
+
/** Additional CSS classes for custom styling */
|
|
260
|
+
className?: string;
|
|
261
|
+
/** Child elements - typically PaginationItem components */
|
|
262
|
+
children?: React.ReactNode;
|
|
263
|
+
} & Omit<React.ComponentProps<"ul">, "className" | "children">;
|
|
264
|
+
|
|
117
265
|
/**
|
|
118
266
|
* Container for pagination navigation items
|
|
119
267
|
*
|
|
@@ -138,10 +286,7 @@ function Pagination({ className, ...props }: React.ComponentProps<"nav">) {
|
|
|
138
286
|
* - Flexible gap spacing for touch-friendly interaction
|
|
139
287
|
* - Horizontal scrolling support on narrow viewports
|
|
140
288
|
*/
|
|
141
|
-
function PaginationContent({
|
|
142
|
-
className,
|
|
143
|
-
...props
|
|
144
|
-
}: React.ComponentProps<"ul">) {
|
|
289
|
+
function PaginationContent({ className, ...props }: PaginationContentProps) {
|
|
145
290
|
return (
|
|
146
291
|
<ul
|
|
147
292
|
data-slot="pagination-content"
|
|
@@ -151,6 +296,34 @@ function PaginationContent({
|
|
|
151
296
|
);
|
|
152
297
|
}
|
|
153
298
|
|
|
299
|
+
/**
|
|
300
|
+
* Props for PaginationItem component (Documentation only - NOT used in component implementation)
|
|
301
|
+
* These types are for documentation generation and should not replace inferred HTML element types
|
|
302
|
+
*/
|
|
303
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
304
|
+
type PaginationItemDocsProps = {
|
|
305
|
+
/** Child elements - typically PaginationLink, PaginationPrevious, PaginationNext, or PaginationEllipsis */
|
|
306
|
+
children?: React.ReactNode;
|
|
307
|
+
/** Additional CSS classes for custom styling */
|
|
308
|
+
className?: string;
|
|
309
|
+
/** Custom id attribute for the pagination item */
|
|
310
|
+
id?: string;
|
|
311
|
+
/** Tab index for focus management @default 0 */
|
|
312
|
+
tabIndex?: number;
|
|
313
|
+
/** ARIA label for the pagination item */
|
|
314
|
+
"aria-label"?: string;
|
|
315
|
+
} & React.HTMLAttributes<HTMLLIElement>;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Component prop type using inferred HTML li element props
|
|
319
|
+
*/
|
|
320
|
+
type PaginationItemProps = {
|
|
321
|
+
/** Child elements - typically PaginationLink, PaginationPrevious, PaginationNext, or PaginationEllipsis */
|
|
322
|
+
children?: React.ReactNode;
|
|
323
|
+
/** Additional CSS classes for custom styling */
|
|
324
|
+
className?: string;
|
|
325
|
+
} & Omit<React.ComponentProps<"li">, "children" | "className">;
|
|
326
|
+
|
|
154
327
|
/**
|
|
155
328
|
* Individual list item wrapper for pagination controls
|
|
156
329
|
*
|
|
@@ -169,37 +342,131 @@ function PaginationContent({
|
|
|
169
342
|
* </PaginationItem>
|
|
170
343
|
* ```
|
|
171
344
|
*/
|
|
172
|
-
function PaginationItem({ ...props }:
|
|
345
|
+
function PaginationItem({ ...props }: PaginationItemProps) {
|
|
173
346
|
return <li data-slot="pagination-item" {...props} />;
|
|
174
347
|
}
|
|
175
348
|
|
|
176
349
|
/**
|
|
177
|
-
* Props for
|
|
350
|
+
* Props for PaginationLink component (Documentation only - NOT used in component implementation)
|
|
351
|
+
* These types are for documentation generation and should not replace inferred HTML element types
|
|
352
|
+
*/
|
|
353
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
354
|
+
type PaginationLinkDocsProps = {
|
|
355
|
+
/**
|
|
356
|
+
* Whether this link represents the currently active page
|
|
357
|
+
*
|
|
358
|
+
* When true, applies active styling (outline variant) and adds aria-current="page"
|
|
359
|
+
* for screen reader accessibility. Active links use the "outline" button variant
|
|
360
|
+
* while inactive links use the "ghost" variant from buttonVariants.
|
|
361
|
+
*
|
|
362
|
+
* @default false
|
|
363
|
+
*/
|
|
364
|
+
isActive?: boolean;
|
|
365
|
+
/**
|
|
366
|
+
* Size variant inherited from Button component
|
|
367
|
+
*
|
|
368
|
+
* Controls the dimensions and padding of the pagination link:
|
|
369
|
+
* - "default": Standard height (36px) with balanced padding
|
|
370
|
+
* - "sm": Small height (32px) for compact interfaces
|
|
371
|
+
* - "lg": Large height (40px) for prominent actions
|
|
372
|
+
* - "icon": Square (36px × 36px) optimized for icon-only usage
|
|
373
|
+
*
|
|
374
|
+
* @default "icon"
|
|
375
|
+
*/
|
|
376
|
+
size?: "default" | "sm" | "lg" | "icon";
|
|
377
|
+
/** URL or path to navigate to when the link is clicked */
|
|
378
|
+
href?: string;
|
|
379
|
+
/** Child content - typically page numbers or navigation text */
|
|
380
|
+
children?: React.ReactNode;
|
|
381
|
+
/** Additional CSS classes for custom styling */
|
|
382
|
+
className?: string;
|
|
383
|
+
/** Click handler for custom navigation logic or analytics tracking */
|
|
384
|
+
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
385
|
+
/** ARIA label for screen readers - especially important for icon-only links */
|
|
386
|
+
"aria-label"?: string;
|
|
387
|
+
/** Indicates current page state for screen readers when isActive is true */
|
|
388
|
+
"aria-current"?: "page" | "step" | "location" | "date" | "time" | boolean;
|
|
389
|
+
/** References elements that describe this link */
|
|
390
|
+
"aria-describedby"?: string;
|
|
391
|
+
/** Indicates if the link is disabled (use with appropriate styling) */
|
|
392
|
+
"aria-disabled"?: boolean;
|
|
393
|
+
/** Tab index for focus management @default 0 */
|
|
394
|
+
tabIndex?: number;
|
|
395
|
+
/** Custom id attribute for the pagination link */
|
|
396
|
+
id?: string;
|
|
397
|
+
/** Title attribute for additional context on hover */
|
|
398
|
+
title?: string;
|
|
399
|
+
/** Target window for link navigation @default "_self" */
|
|
400
|
+
target?: "_self" | "_blank" | "_parent" | "_top";
|
|
401
|
+
/** Relationship between current document and linked document */
|
|
402
|
+
rel?: string;
|
|
403
|
+
} & React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Component prop type using inferred HTML anchor element props
|
|
178
407
|
*/
|
|
179
408
|
type PaginationLinkProps = {
|
|
180
409
|
/**
|
|
181
410
|
* Whether this link represents the currently active page
|
|
182
411
|
*
|
|
183
|
-
* When true, applies active styling and adds aria-current="page"
|
|
184
|
-
* for screen reader accessibility.
|
|
412
|
+
* When true, applies active styling (outline variant) and adds aria-current="page"
|
|
413
|
+
* for screen reader accessibility. Active links use the "outline" button variant
|
|
414
|
+
* while inactive links use the "ghost" variant from buttonVariants.
|
|
185
415
|
*
|
|
186
416
|
* @default false
|
|
187
417
|
*/
|
|
188
418
|
isActive?: boolean;
|
|
189
|
-
|
|
190
|
-
|
|
419
|
+
/**
|
|
420
|
+
* Size variant inherited from Button component
|
|
421
|
+
*
|
|
422
|
+
* Controls the dimensions and padding of the pagination link:
|
|
423
|
+
* - "default": Standard height (36px) with balanced padding
|
|
424
|
+
* - "sm": Small height (32px) for compact interfaces
|
|
425
|
+
* - "lg": Large height (40px) for prominent actions
|
|
426
|
+
* - "icon": Square (36px × 36px) optimized for icon-only usage
|
|
427
|
+
*
|
|
428
|
+
* @default "icon"
|
|
429
|
+
*/
|
|
430
|
+
size?: "default" | "sm" | "lg" | "icon";
|
|
431
|
+
/** URL or path to navigate to when the link is clicked */
|
|
432
|
+
href?: string;
|
|
433
|
+
/** Child content - typically page numbers or navigation text */
|
|
434
|
+
children?: React.ReactNode;
|
|
435
|
+
/** Additional CSS classes for custom styling */
|
|
436
|
+
className?: string;
|
|
437
|
+
/** Click handler for custom navigation logic or analytics tracking */
|
|
438
|
+
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
439
|
+
/** ARIA label for screen readers - especially important for icon-only links */
|
|
440
|
+
"aria-label"?: string;
|
|
441
|
+
/** Indicates current page state for screen readers when isActive is true */
|
|
442
|
+
"aria-current"?: "page" | "step" | "location" | "date" | "time" | boolean;
|
|
443
|
+
/** References elements that describe this link */
|
|
444
|
+
"aria-describedby"?: string;
|
|
445
|
+
/** Indicates if the link is disabled (use with appropriate styling) */
|
|
446
|
+
"aria-disabled"?: boolean;
|
|
447
|
+
/** Tab index for focus management @default 0 */
|
|
448
|
+
tabIndex?: number;
|
|
449
|
+
} & Omit<
|
|
450
|
+
React.ComponentProps<"a">,
|
|
451
|
+
"size" | "href" | "children" | "className" | "onClick" | "tabIndex"
|
|
452
|
+
>;
|
|
191
453
|
|
|
192
454
|
/**
|
|
193
455
|
* Clickable link for individual page numbers
|
|
194
456
|
*
|
|
195
457
|
* Interactive link component that navigates to specific pages within
|
|
196
|
-
* paginated content.
|
|
197
|
-
*
|
|
198
|
-
*
|
|
458
|
+
* paginated content. Uses buttonVariants from the Button component to provide
|
|
459
|
+
* consistent styling - applies "outline" variant when active and "ghost" variant
|
|
460
|
+
* when inactive. Features automatic active state styling and comprehensive
|
|
461
|
+
* accessibility attributes.
|
|
462
|
+
*
|
|
463
|
+
* The component automatically inherits focus management, hover states, and
|
|
464
|
+
* proper spacing from the Button component's CVA configuration while maintaining
|
|
465
|
+
* semantic link behavior for proper navigation and SEO.
|
|
199
466
|
*
|
|
200
467
|
* @example
|
|
201
468
|
* ```tsx
|
|
202
|
-
* // Basic page links
|
|
469
|
+
* // Basic page links with different states
|
|
203
470
|
* <PaginationLink href="/products?page=1">1</PaginationLink>
|
|
204
471
|
* <PaginationLink href="/products?page=2" isActive>2</PaginationLink>
|
|
205
472
|
* <PaginationLink href="/products?page=3">3</PaginationLink>
|
|
@@ -207,10 +474,10 @@ type PaginationLinkProps = {
|
|
|
207
474
|
*
|
|
208
475
|
* @example
|
|
209
476
|
* ```tsx
|
|
210
|
-
* //
|
|
211
|
-
* <PaginationLink
|
|
212
|
-
*
|
|
213
|
-
* </PaginationLink>
|
|
477
|
+
* // Different sizes using Button size variants
|
|
478
|
+
* <PaginationLink href="/page/1" size="sm">1</PaginationLink>
|
|
479
|
+
* <PaginationLink href="/page/2" size="default">2</PaginationLink>
|
|
480
|
+
* <PaginationLink href="/page/3" size="lg">3</PaginationLink>
|
|
214
481
|
* ```
|
|
215
482
|
*
|
|
216
483
|
* @example
|
|
@@ -222,16 +489,41 @@ type PaginationLinkProps = {
|
|
|
222
489
|
* e.preventDefault();
|
|
223
490
|
* onPageChange(1);
|
|
224
491
|
* }}
|
|
492
|
+
* aria-label="Go to page 1"
|
|
225
493
|
* >
|
|
226
494
|
* 1
|
|
227
495
|
* </PaginationLink>
|
|
228
496
|
* ```
|
|
229
497
|
*
|
|
498
|
+
* @example
|
|
499
|
+
* ```tsx
|
|
500
|
+
* // Disabled state for out-of-bounds pages
|
|
501
|
+
* <PaginationLink
|
|
502
|
+
* href="#"
|
|
503
|
+
* className="pointer-events-none opacity-50"
|
|
504
|
+
* aria-disabled="true"
|
|
505
|
+
* tabIndex={-1}
|
|
506
|
+
* >
|
|
507
|
+
* 5
|
|
508
|
+
* </PaginationLink>
|
|
509
|
+
* ```
|
|
510
|
+
*
|
|
230
511
|
* @accessibility
|
|
231
512
|
* - Automatically applies aria-current="page" when isActive is true
|
|
232
|
-
* -
|
|
233
|
-
* -
|
|
234
|
-
* - Touch-friendly minimum
|
|
513
|
+
* - Inherits button-style focus indicators from buttonVariants (3px ring)
|
|
514
|
+
* - High color contrast for active/inactive states meeting WCAG 2.1 AA
|
|
515
|
+
* - Touch-friendly minimum target size from Button component
|
|
516
|
+
* - Full keyboard navigation support (Tab, Enter, Space)
|
|
517
|
+
* - Screen reader friendly with proper link semantics
|
|
518
|
+
* - Supports aria-disabled for unavailable pages
|
|
519
|
+
*
|
|
520
|
+
* @variant outline - Applied when isActive=true, provides clear active state indication
|
|
521
|
+
* @variant ghost - Applied when isActive=false, subtle hover states for navigation
|
|
522
|
+
*
|
|
523
|
+
* @size icon - Default size (36px × 36px) optimized for single digit page numbers
|
|
524
|
+
* @size default - Standard height (36px) with more horizontal padding for longer content
|
|
525
|
+
* @size sm - Compact height (32px) for dense pagination layouts
|
|
526
|
+
* @size lg - Large height (40px) for prominent pagination controls
|
|
235
527
|
*/
|
|
236
528
|
function PaginationLink({
|
|
237
529
|
className,
|
|
@@ -256,12 +548,71 @@ function PaginationLink({
|
|
|
256
548
|
);
|
|
257
549
|
}
|
|
258
550
|
|
|
551
|
+
/**
|
|
552
|
+
* Props for PaginationPrevious component (Documentation only - NOT used in component implementation)
|
|
553
|
+
* These types are for documentation generation and should not replace PaginationLink inferred types
|
|
554
|
+
*/
|
|
555
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
556
|
+
type PaginationPreviousDocsProps = {
|
|
557
|
+
/** URL to navigate to for the previous page */
|
|
558
|
+
href?: string;
|
|
559
|
+
/** Additional CSS classes for custom styling */
|
|
560
|
+
className?: string;
|
|
561
|
+
/** Click handler for custom navigation logic */
|
|
562
|
+
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
563
|
+
/** Override default aria-label for screen readers @default "Go to previous page" */
|
|
564
|
+
"aria-label"?: string;
|
|
565
|
+
/** Indicates if the button is disabled (use with appropriate styling) */
|
|
566
|
+
"aria-disabled"?: boolean;
|
|
567
|
+
/** Tab index for focus management @default 0 */
|
|
568
|
+
tabIndex?: number;
|
|
569
|
+
/** Custom id attribute for the previous button */
|
|
570
|
+
id?: string;
|
|
571
|
+
/** Title attribute for additional context on hover */
|
|
572
|
+
title?: string;
|
|
573
|
+
/** Target window for link navigation @default "_self" */
|
|
574
|
+
target?: "_self" | "_blank" | "_parent" | "_top";
|
|
575
|
+
/** Relationship between current document and linked document */
|
|
576
|
+
rel?: string;
|
|
577
|
+
} & React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* Component prop type using PaginationLink props with size and isActive omitted
|
|
581
|
+
*/
|
|
582
|
+
type PaginationPreviousProps = {
|
|
583
|
+
/** URL to navigate to for the previous page */
|
|
584
|
+
href?: string;
|
|
585
|
+
/** Additional CSS classes for custom styling */
|
|
586
|
+
className?: string;
|
|
587
|
+
/** Click handler for custom navigation logic */
|
|
588
|
+
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
589
|
+
/** Override default aria-label for screen readers @default "Go to previous page" */
|
|
590
|
+
"aria-label"?: string;
|
|
591
|
+
/** Indicates if the button is disabled (use with appropriate styling) */
|
|
592
|
+
"aria-disabled"?: boolean;
|
|
593
|
+
/** Tab index for focus management @default 0 */
|
|
594
|
+
tabIndex?: number;
|
|
595
|
+
} & Omit<
|
|
596
|
+
React.ComponentProps<typeof PaginationLink>,
|
|
597
|
+
| "href"
|
|
598
|
+
| "className"
|
|
599
|
+
| "onClick"
|
|
600
|
+
| "aria-label"
|
|
601
|
+
| "tabIndex"
|
|
602
|
+
| "size"
|
|
603
|
+
| "isActive"
|
|
604
|
+
>;
|
|
605
|
+
|
|
259
606
|
/**
|
|
260
607
|
* Previous page navigation button
|
|
261
608
|
*
|
|
262
|
-
* Navigates to the previous page in the pagination sequence.
|
|
263
|
-
*
|
|
264
|
-
*
|
|
609
|
+
* Navigates to the previous page in the pagination sequence. Built on PaginationLink
|
|
610
|
+
* with fixed "default" size and includes a chevron-left icon for visual direction.
|
|
611
|
+
* Features responsive design that shows only an icon on mobile devices and
|
|
612
|
+
* icon with "Previous" text on larger screens for optimal user experience.
|
|
613
|
+
*
|
|
614
|
+
* Uses buttonVariants with "ghost" variant by default, inheriting all focus management,
|
|
615
|
+
* hover states, and accessibility features from the Button component.
|
|
265
616
|
*
|
|
266
617
|
* @example
|
|
267
618
|
* ```tsx
|
|
@@ -276,6 +627,7 @@ function PaginationLink({
|
|
|
276
627
|
* href="#"
|
|
277
628
|
* className="pointer-events-none opacity-50"
|
|
278
629
|
* aria-disabled="true"
|
|
630
|
+
* tabIndex={-1}
|
|
279
631
|
* />
|
|
280
632
|
* ```
|
|
281
633
|
*
|
|
@@ -293,17 +645,25 @@ function PaginationLink({
|
|
|
293
645
|
* />
|
|
294
646
|
* ```
|
|
295
647
|
*
|
|
648
|
+
* @example
|
|
649
|
+
* ```tsx
|
|
650
|
+
* // With custom aria-label for internationalization
|
|
651
|
+
* <PaginationPrevious
|
|
652
|
+
* href="/page/4"
|
|
653
|
+
* aria-label="Ir a la página anterior"
|
|
654
|
+
* />
|
|
655
|
+
* ```
|
|
656
|
+
*
|
|
296
657
|
* @accessibility
|
|
297
658
|
* - Built-in aria-label="Go to previous page" for screen readers
|
|
298
|
-
* -
|
|
299
|
-
* - Responsive text
|
|
300
|
-
* -
|
|
301
|
-
* -
|
|
659
|
+
* - ChevronLeftIcon provides visual direction context
|
|
660
|
+
* - Responsive "Previous" text appears on sm screens and larger
|
|
661
|
+
* - Full keyboard navigation support (Tab, Enter, Space)
|
|
662
|
+
* - Inherits button focus indicators (3px ring) from buttonVariants
|
|
663
|
+
* - Should be disabled (aria-disabled="true") on first page to prevent confusion
|
|
664
|
+
* - Maintains semantic link behavior for proper navigation
|
|
302
665
|
*/
|
|
303
|
-
function PaginationPrevious({
|
|
304
|
-
className,
|
|
305
|
-
...props
|
|
306
|
-
}: React.ComponentProps<typeof PaginationLink>) {
|
|
666
|
+
function PaginationPrevious({ className, ...props }: PaginationPreviousProps) {
|
|
307
667
|
return (
|
|
308
668
|
<PaginationLink
|
|
309
669
|
aria-label="Go to previous page"
|
|
@@ -317,12 +677,71 @@ function PaginationPrevious({
|
|
|
317
677
|
);
|
|
318
678
|
}
|
|
319
679
|
|
|
680
|
+
/**
|
|
681
|
+
* Props for PaginationNext component (Documentation only - NOT used in component implementation)
|
|
682
|
+
* These types are for documentation generation and should not replace PaginationLink inferred types
|
|
683
|
+
*/
|
|
684
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
685
|
+
type PaginationNextDocsProps = {
|
|
686
|
+
/** URL to navigate to for the next page */
|
|
687
|
+
href?: string;
|
|
688
|
+
/** Additional CSS classes for custom styling */
|
|
689
|
+
className?: string;
|
|
690
|
+
/** Click handler for custom navigation logic */
|
|
691
|
+
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
692
|
+
/** Override default aria-label for screen readers @default "Go to next page" */
|
|
693
|
+
"aria-label"?: string;
|
|
694
|
+
/** Indicates if the button is disabled (use with appropriate styling) */
|
|
695
|
+
"aria-disabled"?: boolean;
|
|
696
|
+
/** Tab index for focus management @default 0 */
|
|
697
|
+
tabIndex?: number;
|
|
698
|
+
/** Custom id attribute for the next button */
|
|
699
|
+
id?: string;
|
|
700
|
+
/** Title attribute for additional context on hover */
|
|
701
|
+
title?: string;
|
|
702
|
+
/** Target window for link navigation @default "_self" */
|
|
703
|
+
target?: "_self" | "_blank" | "_parent" | "_top";
|
|
704
|
+
/** Relationship between current document and linked document */
|
|
705
|
+
rel?: string;
|
|
706
|
+
} & React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
707
|
+
|
|
708
|
+
/**
|
|
709
|
+
* Component prop type using PaginationLink props with size and isActive omitted
|
|
710
|
+
*/
|
|
711
|
+
type PaginationNextProps = {
|
|
712
|
+
/** URL to navigate to for the next page */
|
|
713
|
+
href?: string;
|
|
714
|
+
/** Additional CSS classes for custom styling */
|
|
715
|
+
className?: string;
|
|
716
|
+
/** Click handler for custom navigation logic */
|
|
717
|
+
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
718
|
+
/** Override default aria-label for screen readers @default "Go to next page" */
|
|
719
|
+
"aria-label"?: string;
|
|
720
|
+
/** Indicates if the button is disabled (use with appropriate styling) */
|
|
721
|
+
"aria-disabled"?: boolean;
|
|
722
|
+
/** Tab index for focus management @default 0 */
|
|
723
|
+
tabIndex?: number;
|
|
724
|
+
} & Omit<
|
|
725
|
+
React.ComponentProps<typeof PaginationLink>,
|
|
726
|
+
| "href"
|
|
727
|
+
| "className"
|
|
728
|
+
| "onClick"
|
|
729
|
+
| "aria-label"
|
|
730
|
+
| "tabIndex"
|
|
731
|
+
| "size"
|
|
732
|
+
| "isActive"
|
|
733
|
+
>;
|
|
734
|
+
|
|
320
735
|
/**
|
|
321
736
|
* Next page navigation button
|
|
322
737
|
*
|
|
323
|
-
* Navigates to the next page in the pagination sequence.
|
|
324
|
-
*
|
|
325
|
-
*
|
|
738
|
+
* Navigates to the next page in the pagination sequence. Built on PaginationLink
|
|
739
|
+
* with fixed "default" size and includes a chevron-right icon for visual direction.
|
|
740
|
+
* Features responsive design that shows only an icon on mobile devices and
|
|
741
|
+
* "Next" text with icon on larger screens for optimal user experience.
|
|
742
|
+
*
|
|
743
|
+
* Uses buttonVariants with "ghost" variant by default, inheriting all focus management,
|
|
744
|
+
* hover states, and accessibility features from the Button component.
|
|
326
745
|
*
|
|
327
746
|
* @example
|
|
328
747
|
* ```tsx
|
|
@@ -337,6 +756,7 @@ function PaginationPrevious({
|
|
|
337
756
|
* href="#"
|
|
338
757
|
* className="pointer-events-none opacity-50"
|
|
339
758
|
* aria-disabled="true"
|
|
759
|
+
* tabIndex={-1}
|
|
340
760
|
* />
|
|
341
761
|
* ```
|
|
342
762
|
*
|
|
@@ -354,17 +774,25 @@ function PaginationPrevious({
|
|
|
354
774
|
* />
|
|
355
775
|
* ```
|
|
356
776
|
*
|
|
777
|
+
* @example
|
|
778
|
+
* ```tsx
|
|
779
|
+
* // With custom aria-label for internationalization
|
|
780
|
+
* <PaginationNext
|
|
781
|
+
* href="/page/6"
|
|
782
|
+
* aria-label="Ir a la página siguiente"
|
|
783
|
+
* />
|
|
784
|
+
* ```
|
|
785
|
+
*
|
|
357
786
|
* @accessibility
|
|
358
787
|
* - Built-in aria-label="Go to next page" for screen readers
|
|
359
|
-
* -
|
|
360
|
-
* - Responsive text
|
|
361
|
-
* -
|
|
362
|
-
* -
|
|
788
|
+
* - ChevronRightIcon provides visual direction context
|
|
789
|
+
* - Responsive "Next" text appears on sm screens and larger
|
|
790
|
+
* - Full keyboard navigation support (Tab, Enter, Space)
|
|
791
|
+
* - Inherits button focus indicators (3px ring) from buttonVariants
|
|
792
|
+
* - Should be disabled (aria-disabled="true") on last page to prevent confusion
|
|
793
|
+
* - Maintains semantic link behavior for proper navigation
|
|
363
794
|
*/
|
|
364
|
-
function PaginationNext({
|
|
365
|
-
className,
|
|
366
|
-
...props
|
|
367
|
-
}: React.ComponentProps<typeof PaginationLink>) {
|
|
795
|
+
function PaginationNext({ className, ...props }: PaginationNextProps) {
|
|
368
796
|
return (
|
|
369
797
|
<PaginationLink
|
|
370
798
|
aria-label="Go to next page"
|
|
@@ -378,12 +806,47 @@ function PaginationNext({
|
|
|
378
806
|
);
|
|
379
807
|
}
|
|
380
808
|
|
|
809
|
+
/**
|
|
810
|
+
* Props for PaginationEllipsis component (Documentation only - NOT used in component implementation)
|
|
811
|
+
* These types are for documentation generation and should not replace inferred HTML element types
|
|
812
|
+
*/
|
|
813
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
814
|
+
type PaginationEllipsisDocsProps = {
|
|
815
|
+
/** Additional CSS classes for custom styling */
|
|
816
|
+
className?: string;
|
|
817
|
+
/** Override default aria-hidden behavior for custom accessibility @default true */
|
|
818
|
+
"aria-hidden"?: boolean;
|
|
819
|
+
/** Custom id attribute for the ellipsis element */
|
|
820
|
+
id?: string;
|
|
821
|
+
/** Tab index for focus management @default -1 */
|
|
822
|
+
tabIndex?: number;
|
|
823
|
+
/** Title attribute for additional context on hover */
|
|
824
|
+
title?: string;
|
|
825
|
+
/** ARIA label for screen readers (usually omitted as element is aria-hidden) */
|
|
826
|
+
"aria-label"?: string;
|
|
827
|
+
} & React.HTMLAttributes<HTMLSpanElement>;
|
|
828
|
+
|
|
829
|
+
/**
|
|
830
|
+
* Component prop type using inferred HTML span element props
|
|
831
|
+
*/
|
|
832
|
+
type PaginationEllipsisProps = {
|
|
833
|
+
/** Additional CSS classes for custom styling */
|
|
834
|
+
className?: string;
|
|
835
|
+
/** Override default aria-hidden behavior for custom accessibility @default true */
|
|
836
|
+
"aria-hidden"?: boolean;
|
|
837
|
+
} & Omit<React.ComponentProps<"span">, "className" | "aria-hidden">;
|
|
838
|
+
|
|
381
839
|
/**
|
|
382
840
|
* Visual indicator for omitted page numbers
|
|
383
841
|
*
|
|
384
|
-
* Displays a horizontal ellipsis (
|
|
385
|
-
* page numbers have been omitted from the pagination display.
|
|
386
|
-
*
|
|
842
|
+
* Displays a horizontal ellipsis (MoreHorizontalIcon from Lucide React) to indicate
|
|
843
|
+
* that page numbers have been omitted from the pagination display. Used to maintain
|
|
844
|
+
* clean UI when dealing with large page ranges without overwhelming users.
|
|
845
|
+
*
|
|
846
|
+
* The component is sized consistently with PaginationLink components (36px × 36px)
|
|
847
|
+
* to maintain visual harmony in the pagination layout. Includes accessible hidden
|
|
848
|
+
* text for screen readers while keeping the visual element hidden from assistive
|
|
849
|
+
* technology to avoid confusion.
|
|
387
850
|
*
|
|
388
851
|
* @example
|
|
389
852
|
* ```tsx
|
|
@@ -402,7 +865,7 @@ function PaginationNext({
|
|
|
402
865
|
* @example
|
|
403
866
|
* ```tsx
|
|
404
867
|
* // Common pagination pattern with ellipsis
|
|
405
|
-
* // 1 ... 23 24 [25] 26 27 ... 100
|
|
868
|
+
* // Layout: 1 ... 23 24 [25] 26 27 ... 100
|
|
406
869
|
* <PaginationContent>
|
|
407
870
|
* <PaginationItem>
|
|
408
871
|
* <PaginationLink href="/page/1">1</PaginationLink>
|
|
@@ -411,9 +874,21 @@ function PaginationNext({
|
|
|
411
874
|
* <PaginationEllipsis />
|
|
412
875
|
* </PaginationItem>
|
|
413
876
|
* <PaginationItem>
|
|
877
|
+
* <PaginationLink href="/page/23">23</PaginationLink>
|
|
878
|
+
* </PaginationItem>
|
|
879
|
+
* <PaginationItem>
|
|
880
|
+
* <PaginationLink href="/page/24">24</PaginationLink>
|
|
881
|
+
* </PaginationItem>
|
|
882
|
+
* <PaginationItem>
|
|
414
883
|
* <PaginationLink href="/page/25" isActive>25</PaginationLink>
|
|
415
884
|
* </PaginationItem>
|
|
416
885
|
* <PaginationItem>
|
|
886
|
+
* <PaginationLink href="/page/26">26</PaginationLink>
|
|
887
|
+
* </PaginationItem>
|
|
888
|
+
* <PaginationItem>
|
|
889
|
+
* <PaginationLink href="/page/27">27</PaginationLink>
|
|
890
|
+
* </PaginationItem>
|
|
891
|
+
* <PaginationItem>
|
|
417
892
|
* <PaginationEllipsis />
|
|
418
893
|
* </PaginationItem>
|
|
419
894
|
* <PaginationItem>
|
|
@@ -422,16 +897,20 @@ function PaginationNext({
|
|
|
422
897
|
* </PaginationContent>
|
|
423
898
|
* ```
|
|
424
899
|
*
|
|
900
|
+
* @example
|
|
901
|
+
* ```tsx
|
|
902
|
+
* // With custom styling for different themes
|
|
903
|
+
* <PaginationEllipsis className="text-muted-foreground/60" />
|
|
904
|
+
* ```
|
|
905
|
+
*
|
|
425
906
|
* @accessibility
|
|
426
|
-
* - Visual
|
|
427
|
-
* - Hidden "More pages" text provides context for assistive technology
|
|
428
|
-
* - Non-interactive, purely decorative indicator
|
|
429
|
-
* - Consistent sizing
|
|
907
|
+
* - Visual MoreHorizontalIcon is aria-hidden from screen readers to avoid clutter
|
|
908
|
+
* - Hidden "More pages" text (sr-only) provides context for assistive technology
|
|
909
|
+
* - Non-interactive, purely decorative indicator that doesn't receive focus
|
|
910
|
+
* - Consistent 36px × 36px sizing matches PaginationLink for visual alignment
|
|
911
|
+
* - Screen readers understand this indicates omitted content without confusion
|
|
430
912
|
*/
|
|
431
|
-
function PaginationEllipsis({
|
|
432
|
-
className,
|
|
433
|
-
...props
|
|
434
|
-
}: React.ComponentProps<"span">) {
|
|
913
|
+
function PaginationEllipsis({ className, ...props }: PaginationEllipsisProps) {
|
|
435
914
|
return (
|
|
436
915
|
<span
|
|
437
916
|
aria-hidden
|
|
@@ -454,3 +933,6 @@ export {
|
|
|
454
933
|
PaginationNext,
|
|
455
934
|
PaginationPrevious,
|
|
456
935
|
};
|
|
936
|
+
|
|
937
|
+
// Note: Component prop types are internal to this module and not exported
|
|
938
|
+
// DocsProps types are for documentation generation only
|