@docubook/ui-react 0.1.0 → 0.1.1
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/breadcrumbs.cjs +3 -3
- package/dist/breadcrumbs.js +2 -3
- package/dist/{chunk-7HHY2WDF.cjs → chunk-2DFF5NEL.cjs} +3 -1
- package/dist/chunk-4QUABBES.js +43 -0
- package/dist/{chunk-BCJ3FW3Y.cjs → chunk-5SA5UPFQ.cjs} +3 -3
- package/dist/{chunk-IBKH77YN.js → chunk-5UVG5YY5.js} +1 -2
- package/dist/{chunk-LUO4YXRQ.js → chunk-7BWAXCW2.js} +1 -2
- package/dist/{chunk-FGJ6EYLA.js → chunk-AQP3U2YN.js} +1 -2
- package/dist/{chunk-PB4SHWMJ.cjs → chunk-BHHZBMD4.cjs} +9 -9
- package/dist/{chunk-LJV3UIMK.cjs → chunk-BXRTL6BJ.cjs} +6 -6
- package/dist/{chunk-QZH7EIFW.js → chunk-FQQILPIP.js} +1 -2
- package/dist/{chunk-NJKWNMJF.js → chunk-GRADTONK.js} +3 -2
- package/dist/{chunk-54N6HTQV.cjs → chunk-HTH2UTCL.cjs} +5 -5
- package/dist/{chunk-OB6B2KN5.js → chunk-JHI4G22P.js} +1 -2
- package/dist/chunk-K22HSWMW.cjs +43 -0
- package/dist/{chunk-VRODU4ZV.cjs → chunk-K6B7XOJ5.cjs} +3 -3
- package/dist/{chunk-EJCGJCVK.cjs → chunk-LUVR2YGT.cjs} +10 -10
- package/dist/{chunk-42YUT467.cjs → chunk-MWJV72OM.cjs} +6 -6
- package/dist/{chunk-I4CZWV3M.js → chunk-ND7BTYGG.js} +1 -2
- package/dist/{chunk-Q55KNNKE.js → chunk-OGI5BHGM.js} +1 -2
- package/dist/{chunk-ACEM5N2Y.cjs → chunk-OO3HHTPV.cjs} +10 -10
- package/dist/{chunk-W5G2ZBYA.js → chunk-OTJGG73E.js} +1 -2
- package/dist/{chunk-HTNZRBKW.js → chunk-PFRBA5BH.js} +1 -2
- package/dist/{chunk-KHU72DOY.cjs → chunk-RDRDPR67.cjs} +4 -4
- package/dist/{chunk-OKMEBWPL.cjs → chunk-SV4L2FGT.cjs} +6 -6
- package/dist/{chunk-4DCBYM74.js → chunk-SX6DOGUE.js} +1 -2
- package/dist/cn.cjs +2 -2
- package/dist/cn.d.cts +2 -1
- package/dist/cn.d.ts +2 -1
- package/dist/cn.js +1 -2
- package/dist/collapse.cjs +3 -3
- package/dist/collapse.js +2 -3
- package/dist/drawer.cjs +3 -3
- package/dist/drawer.js +2 -3
- package/dist/dropdown.cjs +3 -3
- package/dist/dropdown.js +2 -3
- package/dist/index.cjs +13 -25
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +13 -26
- package/dist/input.cjs +5 -4
- package/dist/input.js +2 -2
- package/dist/kbd.cjs +5 -4
- package/dist/kbd.js +2 -2
- package/dist/modal.cjs +3 -3
- package/dist/modal.js +2 -3
- package/dist/navbar.cjs +3 -3
- package/dist/navbar.js +2 -3
- package/dist/pagination.cjs +4 -17
- package/dist/pagination.d.cts +1 -69
- package/dist/pagination.d.ts +1 -69
- package/dist/pagination.js +4 -18
- package/dist/theme-controller.cjs +3 -3
- package/dist/theme-controller.js +2 -3
- package/dist/toggle.cjs +3 -3
- package/dist/toggle.js +2 -3
- package/package.json +6 -2
- package/dist/chunk-EN2X23AN.cjs +0 -330
- package/dist/chunk-ZMIZV66S.js +0 -331
package/dist/pagination.d.ts
CHANGED
|
@@ -1,30 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
-
type PaginationSize = "lg" | "md" | "sm" | "xs";
|
|
5
|
-
type PaginationVariant = "default" | "square" | "rounded";
|
|
6
|
-
interface PaginationItemProps {
|
|
7
|
-
children: ReactNode;
|
|
8
|
-
active?: boolean;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
onClick?: () => void;
|
|
11
|
-
className?: string;
|
|
12
|
-
size?: PaginationSize;
|
|
13
|
-
"aria-label"?: string;
|
|
14
|
-
}
|
|
15
|
-
interface PaginationFullProps {
|
|
16
|
-
current: number;
|
|
17
|
-
total: number;
|
|
18
|
-
pageSize?: number;
|
|
19
|
-
onPageChange: (page: number) => void;
|
|
20
|
-
siblingCount?: number;
|
|
21
|
-
className?: string;
|
|
22
|
-
size?: PaginationSize;
|
|
23
|
-
variant?: PaginationVariant;
|
|
24
|
-
showFirstLast?: boolean;
|
|
25
|
-
showPrevNext?: boolean;
|
|
26
|
-
infoClassName?: string;
|
|
27
|
-
}
|
|
28
4
|
interface PaginationDocsProps {
|
|
29
5
|
prev?: {
|
|
30
6
|
href: string;
|
|
@@ -39,50 +15,6 @@ interface PaginationDocsProps {
|
|
|
39
15
|
nextIcon?: ReactNode;
|
|
40
16
|
linkClassName?: string;
|
|
41
17
|
}
|
|
42
|
-
interface PaginationButtonsProps {
|
|
43
|
-
page: number;
|
|
44
|
-
totalPages: number;
|
|
45
|
-
onPageChange: (page: number) => void;
|
|
46
|
-
className?: string;
|
|
47
|
-
size?: PaginationSize;
|
|
48
|
-
showFirstLast?: boolean;
|
|
49
|
-
showPrevNext?: boolean;
|
|
50
|
-
prevLabel?: string;
|
|
51
|
-
nextLabel?: string;
|
|
52
|
-
firstLabel?: string;
|
|
53
|
-
lastLabel?: string;
|
|
54
|
-
disabled?: boolean;
|
|
55
|
-
}
|
|
56
|
-
interface PaginationRangeProps {
|
|
57
|
-
start: number;
|
|
58
|
-
end: number;
|
|
59
|
-
total: number;
|
|
60
|
-
current: number;
|
|
61
|
-
onPageChange: (page: number) => void;
|
|
62
|
-
siblingCount?: number;
|
|
63
|
-
className?: string;
|
|
64
|
-
size?: PaginationSize;
|
|
65
|
-
variant?: PaginationVariant;
|
|
66
|
-
}
|
|
67
|
-
interface PaginationInfoProps {
|
|
68
|
-
current: number;
|
|
69
|
-
total: number;
|
|
70
|
-
pageSize?: number;
|
|
71
|
-
className?: string;
|
|
72
|
-
label?: string;
|
|
73
|
-
showTotal?: boolean;
|
|
74
|
-
}
|
|
75
|
-
declare function getPaginationRange({ totalCount, pageSize, siblingCount, currentPage, }: {
|
|
76
|
-
totalCount: number;
|
|
77
|
-
pageSize: number;
|
|
78
|
-
siblingCount?: number;
|
|
79
|
-
currentPage: number;
|
|
80
|
-
}): (number | "ellipsis")[];
|
|
81
|
-
declare function PaginationItem({ children, active, disabled, onClick, className, size, "aria-label": ariaLabel, }: PaginationItemProps): react_jsx_runtime.JSX.Element;
|
|
82
|
-
declare function PaginationButtons({ page, totalPages, onPageChange, className, size, showFirstLast, showPrevNext, prevLabel, nextLabel, firstLabel, lastLabel, disabled, }: PaginationButtonsProps): react_jsx_runtime.JSX.Element;
|
|
83
|
-
declare function PaginationRange({ start, end, total, current, onPageChange, siblingCount, className, size, variant, }: PaginationRangeProps): react_jsx_runtime.JSX.Element;
|
|
84
|
-
declare function PaginationInfo({ current, total, pageSize, className, label, showTotal, }: PaginationInfoProps): react_jsx_runtime.JSX.Element;
|
|
85
|
-
declare function PaginationFull({ current, total, pageSize, onPageChange, siblingCount, className, size, variant, showFirstLast, showPrevNext, infoClassName, }: PaginationFullProps): react_jsx_runtime.JSX.Element;
|
|
86
18
|
declare function PaginationDocs({ prev, next, className, prevIcon, nextIcon, linkClassName, }: PaginationDocsProps): react_jsx_runtime.JSX.Element;
|
|
87
19
|
|
|
88
|
-
export {
|
|
20
|
+
export { PaginationDocs, type PaginationDocsProps };
|
package/dist/pagination.js
CHANGED
|
@@ -1,21 +1,7 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use client";
|
|
3
1
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
PaginationInfo,
|
|
8
|
-
PaginationItem,
|
|
9
|
-
PaginationRange,
|
|
10
|
-
getPaginationRange
|
|
11
|
-
} from "./chunk-ZMIZV66S.js";
|
|
12
|
-
import "./chunk-NJKWNMJF.js";
|
|
2
|
+
PaginationDocs
|
|
3
|
+
} from "./chunk-4QUABBES.js";
|
|
4
|
+
import "./chunk-GRADTONK.js";
|
|
13
5
|
export {
|
|
14
|
-
|
|
15
|
-
PaginationDocs,
|
|
16
|
-
PaginationFull,
|
|
17
|
-
PaginationInfo,
|
|
18
|
-
PaginationItem,
|
|
19
|
-
PaginationRange,
|
|
20
|
-
getPaginationRange
|
|
6
|
+
PaginationDocs
|
|
21
7
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('./chunk-
|
|
4
|
+
var _chunk5SA5UPFQcjs = require('./chunk-5SA5UPFQ.cjs');
|
|
5
|
+
require('./chunk-2DFF5NEL.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
exports.ThemeControllerToggle =
|
|
8
|
+
exports.ThemeControllerToggle = _chunk5SA5UPFQcjs.ThemeControllerToggle;
|
package/dist/theme-controller.js
CHANGED
package/dist/toggle.cjs
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('./chunk-
|
|
5
|
+
var _chunkOO3HHTPVcjs = require('./chunk-OO3HHTPV.cjs');
|
|
6
|
+
require('./chunk-2DFF5NEL.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
exports.Toggle =
|
|
10
|
+
exports.Toggle = _chunkOO3HHTPVcjs.Toggle; exports.ToggleGroup = _chunkOO3HHTPVcjs.ToggleGroup;
|
package/dist/toggle.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docubook/ui-react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "React + DaisyUI component library for documentation sites",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -196,5 +196,9 @@
|
|
|
196
196
|
"docs framework",
|
|
197
197
|
"ui",
|
|
198
198
|
"tailwindcss"
|
|
199
|
-
]
|
|
199
|
+
],
|
|
200
|
+
"dependencies": {
|
|
201
|
+
"clsx": "^2.1.1",
|
|
202
|
+
"tailwind-merge": "^2.6.1"
|
|
203
|
+
}
|
|
200
204
|
}
|
package/dist/chunk-EN2X23AN.cjs
DELETED
|
@@ -1,330 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _chunk7HHY2WDFcjs = require('./chunk-7HHY2WDF.cjs');
|
|
4
|
-
|
|
5
|
-
// src/base/pagination.tsx
|
|
6
|
-
var _react = require('react');
|
|
7
|
-
var _jsxruntime = require('react/jsx-runtime');
|
|
8
|
-
function getPaginationRange({
|
|
9
|
-
totalCount,
|
|
10
|
-
pageSize,
|
|
11
|
-
siblingCount = 1,
|
|
12
|
-
currentPage
|
|
13
|
-
}) {
|
|
14
|
-
const totalPages = Math.ceil(totalCount / pageSize);
|
|
15
|
-
if (totalPages <= 1) return [1];
|
|
16
|
-
const totalPageNumbers = siblingCount + 5;
|
|
17
|
-
if (totalPages < totalPageNumbers) return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
18
|
-
const leftSiblingIndex = Math.max(currentPage - siblingCount, 1);
|
|
19
|
-
const rightSiblingIndex = Math.min(currentPage + siblingCount, totalPages);
|
|
20
|
-
const showLeftDots = leftSiblingIndex > 2;
|
|
21
|
-
const showRightDots = rightSiblingIndex < totalPages - 1;
|
|
22
|
-
if (!showLeftDots && showRightDots)
|
|
23
|
-
return [...Array.from({ length: 3 }, (_, i) => i + 1), "ellipsis", totalPages - 1, totalPages];
|
|
24
|
-
if (showLeftDots && !showRightDots)
|
|
25
|
-
return [1, 2, "ellipsis", ...Array.from({ length: 3 }, (_, i) => totalPages - 2 + i)];
|
|
26
|
-
if (showLeftDots && showRightDots) {
|
|
27
|
-
const middle = Array.from(
|
|
28
|
-
{ length: rightSiblingIndex - leftSiblingIndex + 1 },
|
|
29
|
-
(_, i) => leftSiblingIndex + i
|
|
30
|
-
);
|
|
31
|
-
return [1, 2, "ellipsis", ...middle, "ellipsis", totalPages - 1, totalPages];
|
|
32
|
-
}
|
|
33
|
-
return [1];
|
|
34
|
-
}
|
|
35
|
-
function variantClass(variant) {
|
|
36
|
-
if (variant === "square") return "[&_.join-item]:btn-square";
|
|
37
|
-
if (variant === "rounded") return "[&_.join-item]:btn-circle";
|
|
38
|
-
return "";
|
|
39
|
-
}
|
|
40
|
-
function PaginationItem({
|
|
41
|
-
children,
|
|
42
|
-
active,
|
|
43
|
-
disabled,
|
|
44
|
-
onClick,
|
|
45
|
-
className,
|
|
46
|
-
size = "md",
|
|
47
|
-
"aria-label": ariaLabel
|
|
48
|
-
}) {
|
|
49
|
-
const sizeClass = size === "lg" ? "btn-lg" : size === "sm" ? "btn-sm" : size === "xs" ? "btn-xs" : "";
|
|
50
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
51
|
-
"button",
|
|
52
|
-
{
|
|
53
|
-
type: "button",
|
|
54
|
-
className: _chunk7HHY2WDFcjs.cn.call(void 0,
|
|
55
|
-
"join-item btn",
|
|
56
|
-
sizeClass,
|
|
57
|
-
active && "btn-active",
|
|
58
|
-
disabled && "btn-disabled",
|
|
59
|
-
className
|
|
60
|
-
),
|
|
61
|
-
onClick,
|
|
62
|
-
disabled,
|
|
63
|
-
"aria-label": ariaLabel,
|
|
64
|
-
"aria-current": active ? "page" : void 0,
|
|
65
|
-
children
|
|
66
|
-
}
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
function PaginationButtons({
|
|
70
|
-
page,
|
|
71
|
-
totalPages,
|
|
72
|
-
onPageChange,
|
|
73
|
-
className,
|
|
74
|
-
size = "md",
|
|
75
|
-
showFirstLast = false,
|
|
76
|
-
showPrevNext = true,
|
|
77
|
-
prevLabel,
|
|
78
|
-
nextLabel,
|
|
79
|
-
firstLabel,
|
|
80
|
-
lastLabel,
|
|
81
|
-
disabled = false
|
|
82
|
-
}) {
|
|
83
|
-
const sizeClass = size !== "md" ? `btn-${size}` : "";
|
|
84
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
85
|
-
showFirstLast && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
86
|
-
"button",
|
|
87
|
-
{
|
|
88
|
-
type: "button",
|
|
89
|
-
className: _chunk7HHY2WDFcjs.cn.call(void 0, "join-item btn", sizeClass, className),
|
|
90
|
-
onClick: () => onPageChange(1),
|
|
91
|
-
disabled: disabled || page <= 1,
|
|
92
|
-
"aria-label": firstLabel != null ? firstLabel : "First page",
|
|
93
|
-
children: firstLabel != null ? firstLabel : "\xAB"
|
|
94
|
-
}
|
|
95
|
-
),
|
|
96
|
-
showPrevNext && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
97
|
-
"button",
|
|
98
|
-
{
|
|
99
|
-
type: "button",
|
|
100
|
-
className: _chunk7HHY2WDFcjs.cn.call(void 0, "join-item btn", sizeClass, className),
|
|
101
|
-
onClick: () => onPageChange(page - 1),
|
|
102
|
-
disabled: disabled || page <= 1,
|
|
103
|
-
"aria-label": prevLabel != null ? prevLabel : "Previous page",
|
|
104
|
-
children: prevLabel != null ? prevLabel : "\u2039"
|
|
105
|
-
}
|
|
106
|
-
),
|
|
107
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "join-item btn btn-disabled no-animation cursor-default", children: [
|
|
108
|
-
page,
|
|
109
|
-
" / ",
|
|
110
|
-
totalPages
|
|
111
|
-
] }),
|
|
112
|
-
showPrevNext && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
113
|
-
"button",
|
|
114
|
-
{
|
|
115
|
-
type: "button",
|
|
116
|
-
className: _chunk7HHY2WDFcjs.cn.call(void 0, "join-item btn", sizeClass, className),
|
|
117
|
-
onClick: () => onPageChange(page + 1),
|
|
118
|
-
disabled: disabled || page >= totalPages,
|
|
119
|
-
"aria-label": nextLabel != null ? nextLabel : "Next page",
|
|
120
|
-
children: nextLabel != null ? nextLabel : "\u203A"
|
|
121
|
-
}
|
|
122
|
-
),
|
|
123
|
-
showFirstLast && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
124
|
-
"button",
|
|
125
|
-
{
|
|
126
|
-
type: "button",
|
|
127
|
-
className: _chunk7HHY2WDFcjs.cn.call(void 0, "join-item btn", sizeClass, className),
|
|
128
|
-
onClick: () => onPageChange(totalPages),
|
|
129
|
-
disabled: disabled || page >= totalPages,
|
|
130
|
-
"aria-label": lastLabel != null ? lastLabel : "Last page",
|
|
131
|
-
children: lastLabel != null ? lastLabel : "\xBB"
|
|
132
|
-
}
|
|
133
|
-
)
|
|
134
|
-
] });
|
|
135
|
-
}
|
|
136
|
-
function PaginationRange({
|
|
137
|
-
start,
|
|
138
|
-
end,
|
|
139
|
-
total,
|
|
140
|
-
current,
|
|
141
|
-
onPageChange,
|
|
142
|
-
siblingCount = 1,
|
|
143
|
-
className,
|
|
144
|
-
size = "md",
|
|
145
|
-
variant
|
|
146
|
-
}) {
|
|
147
|
-
const range = _react.useMemo.call(void 0,
|
|
148
|
-
() => getPaginationRange({
|
|
149
|
-
totalCount: total,
|
|
150
|
-
pageSize: end - start + 1,
|
|
151
|
-
siblingCount,
|
|
152
|
-
currentPage: current
|
|
153
|
-
}),
|
|
154
|
-
[total, start, end, siblingCount, current]
|
|
155
|
-
);
|
|
156
|
-
const sizeClass = size === "lg" ? "join-lg" : size === "sm" ? "join-sm" : size === "xs" ? "join-xs" : "";
|
|
157
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _chunk7HHY2WDFcjs.cn.call(void 0, "join", sizeClass, variantClass(variant), className), children: range.map(
|
|
158
|
-
(item, i) => item === "ellipsis" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "join-item btn btn-disabled no-animation", children: "..." }, `e-${i}`) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
159
|
-
"button",
|
|
160
|
-
{
|
|
161
|
-
type: "button",
|
|
162
|
-
className: _chunk7HHY2WDFcjs.cn.call(void 0,
|
|
163
|
-
"join-item btn",
|
|
164
|
-
item === current && "btn-active",
|
|
165
|
-
size !== "md" && `btn-${size}`
|
|
166
|
-
),
|
|
167
|
-
onClick: () => onPageChange(item),
|
|
168
|
-
"aria-current": item === current ? "page" : void 0,
|
|
169
|
-
children: item
|
|
170
|
-
},
|
|
171
|
-
item
|
|
172
|
-
)
|
|
173
|
-
) });
|
|
174
|
-
}
|
|
175
|
-
function PaginationInfo({
|
|
176
|
-
current,
|
|
177
|
-
total,
|
|
178
|
-
pageSize = 10,
|
|
179
|
-
className,
|
|
180
|
-
label = "Showing",
|
|
181
|
-
showTotal = true
|
|
182
|
-
}) {
|
|
183
|
-
const start = (current - 1) * pageSize + 1;
|
|
184
|
-
const end = Math.min(current * pageSize, total);
|
|
185
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunk7HHY2WDFcjs.cn.call(void 0, "text-base-content/70 text-sm", className), children: [
|
|
186
|
-
label,
|
|
187
|
-
" ",
|
|
188
|
-
start,
|
|
189
|
-
"-",
|
|
190
|
-
end,
|
|
191
|
-
showTotal && ` of ${total}`
|
|
192
|
-
] });
|
|
193
|
-
}
|
|
194
|
-
function PaginationFull({
|
|
195
|
-
current,
|
|
196
|
-
total,
|
|
197
|
-
pageSize = 10,
|
|
198
|
-
onPageChange,
|
|
199
|
-
siblingCount = 1,
|
|
200
|
-
className,
|
|
201
|
-
size = "md",
|
|
202
|
-
variant,
|
|
203
|
-
showFirstLast = true,
|
|
204
|
-
showPrevNext = true,
|
|
205
|
-
infoClassName
|
|
206
|
-
}) {
|
|
207
|
-
const totalPages = Math.ceil(total / pageSize);
|
|
208
|
-
const range = _react.useMemo.call(void 0,
|
|
209
|
-
() => getPaginationRange({ totalCount: total, pageSize, siblingCount, currentPage: current }),
|
|
210
|
-
[total, pageSize, siblingCount, current]
|
|
211
|
-
);
|
|
212
|
-
const sizeClass = size === "lg" ? "join-lg" : size === "sm" ? "join-sm" : size === "xs" ? "join-xs" : "";
|
|
213
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunk7HHY2WDFcjs.cn.call(void 0, "flex flex-col items-center justify-between gap-4 sm:flex-row", className), children: [
|
|
214
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
215
|
-
PaginationInfo,
|
|
216
|
-
{
|
|
217
|
-
current,
|
|
218
|
-
total,
|
|
219
|
-
pageSize,
|
|
220
|
-
className: infoClassName
|
|
221
|
-
}
|
|
222
|
-
),
|
|
223
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunk7HHY2WDFcjs.cn.call(void 0, "join", sizeClass, variantClass(variant)), children: [
|
|
224
|
-
showFirstLast && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
225
|
-
"button",
|
|
226
|
-
{
|
|
227
|
-
type: "button",
|
|
228
|
-
className: _chunk7HHY2WDFcjs.cn.call(void 0, "join-item btn", size !== "md" && `btn-${size}`),
|
|
229
|
-
onClick: () => onPageChange(1),
|
|
230
|
-
disabled: current <= 1,
|
|
231
|
-
"aria-label": "First page",
|
|
232
|
-
children: "\xAB"
|
|
233
|
-
}
|
|
234
|
-
),
|
|
235
|
-
showPrevNext && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
236
|
-
"button",
|
|
237
|
-
{
|
|
238
|
-
type: "button",
|
|
239
|
-
className: _chunk7HHY2WDFcjs.cn.call(void 0, "join-item btn", size !== "md" && `btn-${size}`),
|
|
240
|
-
onClick: () => onPageChange(current - 1),
|
|
241
|
-
disabled: current <= 1,
|
|
242
|
-
"aria-label": "Previous page",
|
|
243
|
-
children: "\u2039"
|
|
244
|
-
}
|
|
245
|
-
),
|
|
246
|
-
range.map(
|
|
247
|
-
(item, i) => item === "ellipsis" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "join-item btn btn-disabled no-animation", children: "..." }, `e-${i}`) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
248
|
-
"button",
|
|
249
|
-
{
|
|
250
|
-
type: "button",
|
|
251
|
-
className: _chunk7HHY2WDFcjs.cn.call(void 0,
|
|
252
|
-
"join-item btn",
|
|
253
|
-
item === current && "btn-active",
|
|
254
|
-
size !== "md" && `btn-${size}`
|
|
255
|
-
),
|
|
256
|
-
onClick: () => onPageChange(item),
|
|
257
|
-
"aria-current": item === current ? "page" : void 0,
|
|
258
|
-
children: item
|
|
259
|
-
},
|
|
260
|
-
item
|
|
261
|
-
)
|
|
262
|
-
),
|
|
263
|
-
showPrevNext && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
264
|
-
"button",
|
|
265
|
-
{
|
|
266
|
-
type: "button",
|
|
267
|
-
className: _chunk7HHY2WDFcjs.cn.call(void 0, "join-item btn", size !== "md" && `btn-${size}`),
|
|
268
|
-
onClick: () => onPageChange(current + 1),
|
|
269
|
-
disabled: current >= totalPages,
|
|
270
|
-
"aria-label": "Next page",
|
|
271
|
-
children: "\u203A"
|
|
272
|
-
}
|
|
273
|
-
),
|
|
274
|
-
showFirstLast && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
275
|
-
"button",
|
|
276
|
-
{
|
|
277
|
-
type: "button",
|
|
278
|
-
className: _chunk7HHY2WDFcjs.cn.call(void 0, "join-item btn", size !== "md" && `btn-${size}`),
|
|
279
|
-
onClick: () => onPageChange(totalPages),
|
|
280
|
-
disabled: current >= totalPages,
|
|
281
|
-
"aria-label": "Last page",
|
|
282
|
-
children: "\xBB"
|
|
283
|
-
}
|
|
284
|
-
)
|
|
285
|
-
] })
|
|
286
|
-
] });
|
|
287
|
-
}
|
|
288
|
-
function PaginationDocs({
|
|
289
|
-
prev,
|
|
290
|
-
next,
|
|
291
|
-
className,
|
|
292
|
-
prevIcon,
|
|
293
|
-
nextIcon,
|
|
294
|
-
linkClassName
|
|
295
|
-
}) {
|
|
296
|
-
const linkBase = "flex flex-col no-underline rounded-lg border border-base-300 bg-base-100 transition-colors hover:bg-base-200 hover:border-base-300";
|
|
297
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunk7HHY2WDFcjs.cn.call(void 0, "grid grow grid-cols-1 gap-4 py-8 sm:grid-cols-2", className), children: [
|
|
298
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: prev && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "a", { href: prev.href, className: _chunk7HHY2WDFcjs.cn.call(void 0, linkBase, "items-start px-4 py-4", linkClassName), children: [
|
|
299
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-muted-foreground flex items-center justify-start text-xs", children: [
|
|
300
|
-
prevIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "mr-1", children: prevIcon }),
|
|
301
|
-
"Previous"
|
|
302
|
-
] }),
|
|
303
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-base-content mt-1 text-sm font-medium", children: prev.title })
|
|
304
|
-
] }) }),
|
|
305
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: next && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
306
|
-
"a",
|
|
307
|
-
{
|
|
308
|
-
href: next.href,
|
|
309
|
-
className: _chunk7HHY2WDFcjs.cn.call(void 0, linkBase, "items-end px-4 py-4 text-right", linkClassName),
|
|
310
|
-
children: [
|
|
311
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-muted-foreground flex items-center justify-end text-xs", children: [
|
|
312
|
-
"Next",
|
|
313
|
-
nextIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "ml-1", children: nextIcon })
|
|
314
|
-
] }),
|
|
315
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-base-content mt-1 text-sm font-medium", children: next.title })
|
|
316
|
-
]
|
|
317
|
-
}
|
|
318
|
-
) })
|
|
319
|
-
] });
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
exports.getPaginationRange = getPaginationRange; exports.PaginationItem = PaginationItem; exports.PaginationButtons = PaginationButtons; exports.PaginationRange = PaginationRange; exports.PaginationInfo = PaginationInfo; exports.PaginationFull = PaginationFull; exports.PaginationDocs = PaginationDocs;
|