@mijn-ui/react-pagination 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +90 -18
- package/dist/index.js +59 -11
- package/dist/metafile-esm.json +1 -1
- package/package.json +5 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,69 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as tailwind_merge from 'tailwind-merge';
|
|
3
|
+
import * as _mijn_ui_react_core from '@mijn-ui/react-core';
|
|
4
|
+
import { UnstyledComponentWithSlots } from '@mijn-ui/react-core';
|
|
2
5
|
import * as tailwind_variants from 'tailwind-variants';
|
|
3
|
-
import
|
|
4
|
-
import { UnstyledComponentWithSlots, PaginationSlots, UnstyledProps, paginationStyles } from '@mijn-ui/react-theme';
|
|
6
|
+
import { VariantProps } from 'tailwind-variants';
|
|
5
7
|
import * as React from 'react';
|
|
6
8
|
|
|
9
|
+
declare const paginationStyles: tailwind_variants.TVReturnType<{
|
|
10
|
+
active: {
|
|
11
|
+
true: {
|
|
12
|
+
listItem: string[];
|
|
13
|
+
};
|
|
14
|
+
false: {
|
|
15
|
+
listItem: string[];
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
}, {
|
|
19
|
+
base: string;
|
|
20
|
+
content: string;
|
|
21
|
+
list: string;
|
|
22
|
+
listItem: string;
|
|
23
|
+
previousBtn: string;
|
|
24
|
+
previousElipsis: string;
|
|
25
|
+
nextBtn: string;
|
|
26
|
+
nextElipsis: string;
|
|
27
|
+
}, undefined, {
|
|
28
|
+
active: {
|
|
29
|
+
true: {
|
|
30
|
+
listItem: string[];
|
|
31
|
+
};
|
|
32
|
+
false: {
|
|
33
|
+
listItem: string[];
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
}, {
|
|
37
|
+
base: string;
|
|
38
|
+
content: string;
|
|
39
|
+
list: string;
|
|
40
|
+
listItem: string;
|
|
41
|
+
previousBtn: string;
|
|
42
|
+
previousElipsis: string;
|
|
43
|
+
nextBtn: string;
|
|
44
|
+
nextElipsis: string;
|
|
45
|
+
}, tailwind_variants.TVReturnType<{
|
|
46
|
+
active: {
|
|
47
|
+
true: {
|
|
48
|
+
listItem: string[];
|
|
49
|
+
};
|
|
50
|
+
false: {
|
|
51
|
+
listItem: string[];
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
}, {
|
|
55
|
+
base: string;
|
|
56
|
+
content: string;
|
|
57
|
+
list: string;
|
|
58
|
+
listItem: string;
|
|
59
|
+
previousBtn: string;
|
|
60
|
+
previousElipsis: string;
|
|
61
|
+
nextBtn: string;
|
|
62
|
+
nextElipsis: string;
|
|
63
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
64
|
+
type PaginationVariantProps = VariantProps<typeof paginationStyles>;
|
|
65
|
+
type PaginationSlots = keyof ReturnType<typeof paginationStyles>;
|
|
66
|
+
|
|
7
67
|
type PaginationBaseProps = UnstyledComponentWithSlots<PaginationSlots>;
|
|
8
68
|
type PaginationContextType = PaginationBaseProps & {
|
|
9
69
|
styles: ReturnType<typeof paginationStyles>;
|
|
@@ -17,32 +77,32 @@ type PaginationContextType = PaginationBaseProps & {
|
|
|
17
77
|
};
|
|
18
78
|
declare const usePaginationContext: () => PaginationContextType;
|
|
19
79
|
declare const usePaginationStyles: (unstyledOverride?: boolean) => {
|
|
20
|
-
classNames:
|
|
80
|
+
classNames: _mijn_ui_react_core.SlotsToClasses<"base" | "content" | "list" | "listItem" | "previousBtn" | "previousElipsis" | "nextBtn" | "nextElipsis"> | undefined;
|
|
21
81
|
isUnstyled: boolean | undefined;
|
|
22
82
|
base: (slotProps?: ({
|
|
23
83
|
active?: boolean | undefined;
|
|
24
|
-
} & tailwind_variants.ClassProp<
|
|
84
|
+
} & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
|
|
25
85
|
content: (slotProps?: ({
|
|
26
86
|
active?: boolean | undefined;
|
|
27
|
-
} & tailwind_variants.ClassProp<
|
|
87
|
+
} & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
|
|
28
88
|
list: (slotProps?: ({
|
|
29
89
|
active?: boolean | undefined;
|
|
30
|
-
} & tailwind_variants.ClassProp<
|
|
90
|
+
} & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
|
|
31
91
|
listItem: (slotProps?: ({
|
|
32
92
|
active?: boolean | undefined;
|
|
33
|
-
} & tailwind_variants.ClassProp<
|
|
93
|
+
} & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
|
|
34
94
|
previousBtn: (slotProps?: ({
|
|
35
95
|
active?: boolean | undefined;
|
|
36
|
-
} & tailwind_variants.ClassProp<
|
|
96
|
+
} & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
|
|
37
97
|
previousElipsis: (slotProps?: ({
|
|
38
98
|
active?: boolean | undefined;
|
|
39
|
-
} & tailwind_variants.ClassProp<
|
|
99
|
+
} & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
|
|
40
100
|
nextBtn: (slotProps?: ({
|
|
41
101
|
active?: boolean | undefined;
|
|
42
|
-
} & tailwind_variants.ClassProp<
|
|
102
|
+
} & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
|
|
43
103
|
nextElipsis: (slotProps?: ({
|
|
44
104
|
active?: boolean | undefined;
|
|
45
|
-
} & tailwind_variants.ClassProp<
|
|
105
|
+
} & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
|
|
46
106
|
};
|
|
47
107
|
type PaginationProps = {
|
|
48
108
|
totalPages: number;
|
|
@@ -52,17 +112,29 @@ type PaginationProps = {
|
|
|
52
112
|
onChangePage?: (page: number) => void;
|
|
53
113
|
} & PaginationBaseProps;
|
|
54
114
|
declare const Pagination: React.FC<PaginationProps>;
|
|
55
|
-
type PaginationContentProps = React.ComponentPropsWithRef<"nav"> &
|
|
115
|
+
type PaginationContentProps = React.ComponentPropsWithRef<"nav"> & {
|
|
116
|
+
unstyled?: boolean;
|
|
117
|
+
};
|
|
56
118
|
declare const PaginationContent: ({ className, unstyled, ...props }: PaginationContentProps) => react_jsx_runtime.JSX.Element;
|
|
57
|
-
type PaginationListProps = React.ComponentProps<"ul"> &
|
|
119
|
+
type PaginationListProps = React.ComponentProps<"ul"> & {
|
|
120
|
+
unstyled?: boolean;
|
|
121
|
+
};
|
|
58
122
|
declare const PaginationList: ({ className, unstyled, ...props }: PaginationListProps) => react_jsx_runtime.JSX.Element;
|
|
59
|
-
type PaginationPreviousButtonProps = React.ComponentProps<"button"> &
|
|
123
|
+
type PaginationPreviousButtonProps = React.ComponentProps<"button"> & {
|
|
124
|
+
unstyled?: boolean;
|
|
125
|
+
};
|
|
60
126
|
declare const PaginationPreviousButton: ({ className, unstyled, ...props }: PaginationPreviousButtonProps) => react_jsx_runtime.JSX.Element;
|
|
61
|
-
type PaginationNextButtonProps = React.ComponentProps<"button"> &
|
|
127
|
+
type PaginationNextButtonProps = React.ComponentProps<"button"> & {
|
|
128
|
+
unstyled?: boolean;
|
|
129
|
+
};
|
|
62
130
|
declare const PaginationNextButton: ({ className, unstyled, ...props }: PaginationNextButtonProps) => react_jsx_runtime.JSX.Element;
|
|
63
|
-
type PaginationPreviousEllipsisProps = React.ComponentProps<"span"> &
|
|
131
|
+
type PaginationPreviousEllipsisProps = React.ComponentProps<"span"> & {
|
|
132
|
+
unstyled?: boolean;
|
|
133
|
+
};
|
|
64
134
|
declare const PaginationPreviousEllipsis: ({ className, unstyled, ...props }: PaginationPreviousEllipsisProps) => react_jsx_runtime.JSX.Element | null;
|
|
65
|
-
type PaginationNextEllipsisProps = React.ComponentProps<"span"> &
|
|
135
|
+
type PaginationNextEllipsisProps = React.ComponentProps<"span"> & {
|
|
136
|
+
unstyled?: boolean;
|
|
137
|
+
};
|
|
66
138
|
declare const PaginationNextEllipsis: ({ className, unstyled, ...props }: PaginationNextEllipsisProps) => react_jsx_runtime.JSX.Element | null;
|
|
67
139
|
|
|
68
|
-
export { Pagination, PaginationContent, type PaginationContentProps, PaginationList, type PaginationListProps, PaginationNextButton, type PaginationNextButtonProps, PaginationNextEllipsis, type PaginationNextEllipsisProps, PaginationPreviousButton, PaginationPreviousEllipsis, type PaginationProps, usePaginationContext, usePaginationStyles };
|
|
140
|
+
export { Pagination, PaginationContent, type PaginationContentProps, PaginationList, type PaginationListProps, PaginationNextButton, type PaginationNextButtonProps, PaginationNextEllipsis, type PaginationNextEllipsisProps, PaginationPreviousButton, PaginationPreviousEllipsis, type PaginationProps, type PaginationSlots, type PaginationVariantProps, paginationStyles, usePaginationContext, usePaginationStyles };
|
package/dist/index.js
CHANGED
|
@@ -2,14 +2,61 @@
|
|
|
2
2
|
|
|
3
3
|
// src/pagination.tsx
|
|
4
4
|
import * as React from "react";
|
|
5
|
-
import { useTVUnstyled } from "@mijn-ui/react-hooks";
|
|
6
5
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} from "@mijn-ui/react-
|
|
10
|
-
import { createContext } from "@mijn-ui/react-utilities";
|
|
6
|
+
createContext,
|
|
7
|
+
useTVUnstyled
|
|
8
|
+
} from "@mijn-ui/react-core";
|
|
11
9
|
import { EllipsisIcon } from "@mijn-ui/shared-icons";
|
|
10
|
+
import { cnBase, tv } from "tailwind-variants";
|
|
12
11
|
import { jsx } from "react/jsx-runtime";
|
|
12
|
+
var paginationStyles = tv({
|
|
13
|
+
slots: {
|
|
14
|
+
base: "",
|
|
15
|
+
content: "flex w-full items-center gap-4",
|
|
16
|
+
list: "flex flex-row items-center",
|
|
17
|
+
listItem: "",
|
|
18
|
+
previousBtn: "",
|
|
19
|
+
previousElipsis: "",
|
|
20
|
+
nextBtn: "",
|
|
21
|
+
nextElipsis: ""
|
|
22
|
+
},
|
|
23
|
+
variants: {
|
|
24
|
+
active: {
|
|
25
|
+
true: {
|
|
26
|
+
listItem: [
|
|
27
|
+
"inline-flex items-center justify-center gap-0.5 text-sm font-medium outline-none duration-300 ease-in-out focus-visible:ring-2 focus-visible:ring-offset-bg-default focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
28
|
+
"text-fg-default hover:bg-bg-secondary focus-visible:ring-outline-brand active:bg-bg-secondary/70 focus-visible:ring-offset-2",
|
|
29
|
+
"gap-0 px-0",
|
|
30
|
+
"size-9",
|
|
31
|
+
"bg-bg-secondary"
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
false: {
|
|
35
|
+
listItem: [
|
|
36
|
+
"inline-flex items-center justify-center gap-0.5 text-sm font-medium outline-none duration-300 ease-in-out focus-visible:ring-2 focus-visible:ring-offset-bg-default focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
37
|
+
"text-fg-default hover:bg-bg-secondary focus-visible:ring-outline-brand active:bg-bg-secondary/70 focus-visible:ring-offset-2",
|
|
38
|
+
"gap-0 px-0",
|
|
39
|
+
"size-9",
|
|
40
|
+
"text-fg-tertiary"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
compoundSlots: [
|
|
46
|
+
{
|
|
47
|
+
slots: ["previousBtn", "nextBtn"],
|
|
48
|
+
class: [
|
|
49
|
+
"inline-flex items-center justify-center gap-0.5 text-sm font-medium outline-none duration-300 ease-in-out focus-visible:ring-2 focus-visible:ring-offset-bg-default focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
50
|
+
"bg-bg-default-alt text-fg-default hover:bg-bg-secondary focus-visible:ring-outline-brand active:bg-bg-secondary/70 shadow-xs border focus-visible:ring-offset-2",
|
|
51
|
+
"h-8 rounded-md px-3"
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
slots: ["previousElipsis", "nextElipsis"],
|
|
56
|
+
class: "text-fg-tertiary flex size-8 items-center justify-center [&_svg]:size-4"
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
});
|
|
13
60
|
var [PaginationProvider, usePaginationContext] = createContext({
|
|
14
61
|
name: "PaginationContext",
|
|
15
62
|
strict: true,
|
|
@@ -120,7 +167,7 @@ var PaginationContent = ({
|
|
|
120
167
|
return /* @__PURE__ */ jsx(
|
|
121
168
|
"nav",
|
|
122
169
|
{
|
|
123
|
-
className: content({ className:
|
|
170
|
+
className: content({ className: cnBase(classNames?.content, className) }),
|
|
124
171
|
...props
|
|
125
172
|
}
|
|
126
173
|
);
|
|
@@ -135,7 +182,7 @@ var PaginationList = ({
|
|
|
135
182
|
return /* @__PURE__ */ jsx(
|
|
136
183
|
"ul",
|
|
137
184
|
{
|
|
138
|
-
className: list({ className:
|
|
185
|
+
className: list({ className: cnBase(classNames?.list, className) }),
|
|
139
186
|
...props,
|
|
140
187
|
children: paginationRange.map((page, index) => /* @__PURE__ */ jsx("li", { onClick: () => setPage(page), children: /* @__PURE__ */ jsx(
|
|
141
188
|
"button",
|
|
@@ -162,7 +209,7 @@ var PaginationPreviousButton = ({
|
|
|
162
209
|
{
|
|
163
210
|
onClick: goToPreviousPage,
|
|
164
211
|
className: previousBtn({
|
|
165
|
-
className:
|
|
212
|
+
className: cnBase(classNames?.previousBtn, className)
|
|
166
213
|
}),
|
|
167
214
|
...props
|
|
168
215
|
}
|
|
@@ -179,7 +226,7 @@ var PaginationNextButton = ({
|
|
|
179
226
|
"button",
|
|
180
227
|
{
|
|
181
228
|
onClick: goToNextPage,
|
|
182
|
-
className: nextBtn({ className:
|
|
229
|
+
className: nextBtn({ className: cnBase(classNames?.nextBtn, className) }),
|
|
183
230
|
...props
|
|
184
231
|
}
|
|
185
232
|
);
|
|
@@ -197,7 +244,7 @@ var PaginationPreviousEllipsis = ({
|
|
|
197
244
|
{
|
|
198
245
|
"aria-hidden": true,
|
|
199
246
|
className: previousElipsis({
|
|
200
|
-
className:
|
|
247
|
+
className: cnBase(classNames?.previousElipsis, className)
|
|
201
248
|
}),
|
|
202
249
|
...props,
|
|
203
250
|
children: /* @__PURE__ */ jsx(EllipsisIcon, { className: "size-4" })
|
|
@@ -217,7 +264,7 @@ var PaginationNextEllipsis = ({
|
|
|
217
264
|
{
|
|
218
265
|
"aria-hidden": true,
|
|
219
266
|
className: nextElipsis({
|
|
220
|
-
className:
|
|
267
|
+
className: cnBase(classNames?.nextElipsis, className)
|
|
221
268
|
}),
|
|
222
269
|
...props,
|
|
223
270
|
children: /* @__PURE__ */ jsx(EllipsisIcon, { className: "size-4" })
|
|
@@ -232,6 +279,7 @@ export {
|
|
|
232
279
|
PaginationNextEllipsis,
|
|
233
280
|
PaginationPreviousButton,
|
|
234
281
|
PaginationPreviousEllipsis,
|
|
282
|
+
paginationStyles,
|
|
235
283
|
usePaginationContext,
|
|
236
284
|
usePaginationStyles
|
|
237
285
|
};
|
package/dist/metafile-esm.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/pagination.tsx":{"bytes":
|
|
1
|
+
{"inputs":{"src/pagination.tsx":{"bytes":12329,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@mijn-ui/react-core","kind":"import-statement","external":true},{"path":"@mijn-ui/shared-icons","kind":"import-statement","external":true},{"path":"tailwind-variants","kind":"import-statement","external":true},{"path":"react/jsx-runtime","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":29,"imports":[{"path":"src/pagination.tsx","kind":"import-statement","original":"./pagination"}],"format":"esm"}},"outputs":{"dist/index.js":{"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@mijn-ui/react-core","kind":"import-statement","external":true},{"path":"@mijn-ui/shared-icons","kind":"import-statement","external":true},{"path":"tailwind-variants","kind":"import-statement","external":true},{"path":"react/jsx-runtime","kind":"import-statement","external":true}],"exports":["Pagination","PaginationContent","PaginationList","PaginationNextButton","PaginationNextEllipsis","PaginationPreviousButton","PaginationPreviousEllipsis","paginationStyles","usePaginationContext","usePaginationStyles"],"entryPoint":"src/index.ts","inputs":{"src/pagination.tsx":{"bytesInOutput":8077},"src/index.ts":{"bytesInOutput":0}},"bytes":8353}}}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mijn-ui/react-pagination",
|
|
3
3
|
"author": "Htet Aung Lin<htetaunglin.coder@gmail.com>",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.0",
|
|
5
5
|
"homepage": "https://mijn-ui.vercel.app",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
@@ -26,20 +26,18 @@
|
|
|
26
26
|
"lucide-react": "^0.479.0",
|
|
27
27
|
"react": "19.0.0",
|
|
28
28
|
"react-dom": "19.0.0",
|
|
29
|
-
"@mijn-ui/react-core": "0.
|
|
30
|
-
"@mijn-ui/react-theme": "0.2.0",
|
|
29
|
+
"@mijn-ui/react-core": "0.3.0",
|
|
31
30
|
"eslint-config-custom": "0.0.1",
|
|
32
31
|
"tsconfig": "0.0.0",
|
|
33
32
|
"tsup-config": "0.0.0"
|
|
34
33
|
},
|
|
35
34
|
"dependencies": {
|
|
36
|
-
"@mijn-ui/react-hooks": "0.0.18",
|
|
37
|
-
"@mijn-ui/react-utilities": "0.0.9",
|
|
38
35
|
"@mijn-ui/shared-icons": "0.1.0"
|
|
39
36
|
},
|
|
40
37
|
"peerDependencies": {
|
|
41
|
-
"@mijn-ui/react-core": "^0.
|
|
42
|
-
"
|
|
38
|
+
"@mijn-ui/react-core": "^0.3.0",
|
|
39
|
+
"tailwind-merge": "^3.0.0",
|
|
40
|
+
"tailwind-variants": "^3.0.0",
|
|
43
41
|
"react": "^19.0",
|
|
44
42
|
"react-dom": "^19.0"
|
|
45
43
|
},
|