@mijn-ui/react-pagination 0.0.4 → 0.0.6

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 CHANGED
@@ -33,15 +33,4 @@ declare const PaginationPreviousEllipsis: ({ className, unstyled, ...props }: Pa
33
33
  type PaginationNextEllipsisProps = React.ComponentProps<"span"> & UnstyledProps;
34
34
  declare const PaginationNextEllipsis: ({ className, unstyled, ...props }: PaginationNextEllipsisProps) => react_jsx_runtime.JSX.Element | undefined;
35
35
 
36
- type usePaginationProps = {
37
- totalPages: number;
38
- itemsPerPage: number;
39
- currentPage: number;
40
- };
41
- declare const usePaginationRange: ({ totalPages, itemsPerPage, currentPage, }: usePaginationProps) => {
42
- range: number[];
43
- prevEllipsisActive: boolean;
44
- nextEllipsisActive: boolean;
45
- };
46
-
47
- export { Pagination, PaginationContent, PaginationList, PaginationNextButton, PaginationNextEllipsis, PaginationPreviousButton, PaginationPreviousEllipsis, usePagination, usePaginationRange };
36
+ export { Pagination, PaginationContent, PaginationList, PaginationNextButton, PaginationNextEllipsis, PaginationPreviousButton, PaginationPreviousEllipsis, usePagination };
package/dist/index.js CHANGED
@@ -1,13 +1,17 @@
1
- // src/pagination.tsx
2
- import * as React2 from "react";
1
+ "use client"
3
2
 
4
- // src/use-pagination.ts
3
+ // src/pagination.tsx
5
4
  import * as React from "react";
5
+ import { buttonStyles } from "@mijn-ui/react-button";
6
+ import { UnstyledProvider, useUnstyled } from "@mijn-ui/react-utilities/context";
7
+ import { applyUnstyled } from "@mijn-ui/react-utilities/shared";
8
+ import { LuMoreHorizontal } from "react-icons/lu";
9
+ import { jsx } from "react/jsx-runtime";
6
10
  var usePaginationRange = ({
7
11
  totalPages,
8
12
  itemsPerPage,
9
13
  currentPage
10
- }) => React.useMemo(() => {
14
+ }) => {
11
15
  const totalPageCount = Math.ceil(totalPages / itemsPerPage);
12
16
  const visiblePages = 3;
13
17
  if (totalPageCount <= visiblePages) {
@@ -42,15 +46,8 @@ var usePaginationRange = ({
42
46
  prevEllipsisActive: leftBound > 1,
43
47
  nextEllipsisActive: rightBound < totalPageCount
44
48
  };
45
- }, [totalPages, itemsPerPage, currentPage]);
46
-
47
- // src/pagination.tsx
48
- import { buttonStyles } from "@mijn-ui/react-button";
49
- import { UnstyledProvider, useUnstyled } from "@mijn-ui/react-utilities/context";
50
- import { applyUnstyled } from "@mijn-ui/react-utilities/shared";
51
- import { LuMoreHorizontal } from "react-icons/lu";
52
- import { jsx } from "react/jsx-runtime";
53
- var PaginationContext = React2.createContext(void 0);
49
+ };
50
+ var PaginationContext = React.createContext(void 0);
54
51
  var Pagination = ({
55
52
  unstyled = false,
56
53
  totalPages,
@@ -59,7 +56,7 @@ var Pagination = ({
59
56
  currentPage: propsCurrentPage,
60
57
  onChangePage
61
58
  }) => {
62
- const [internalCurrentPage, setInternalCurrentPage] = React2.useState(1);
59
+ const [internalCurrentPage, setInternalCurrentPage] = React.useState(1);
63
60
  const isControlled = propsCurrentPage !== void 0;
64
61
  const currentPage = isControlled ? propsCurrentPage : internalCurrentPage;
65
62
  const paginationRange = usePaginationRange({
@@ -76,7 +73,7 @@ var Pagination = ({
76
73
  };
77
74
  const goToPreviousPage = () => setPage(Math.max(currentPage - 1, 1));
78
75
  const goToNextPage = () => setPage(Math.min(currentPage + 1, Math.ceil(totalPages / itemsPerPage)));
79
- React2.useEffect(() => {
76
+ React.useEffect(() => {
80
77
  if (!isControlled && propsCurrentPage !== void 0) {
81
78
  setInternalCurrentPage(propsCurrentPage);
82
79
  }
@@ -98,7 +95,7 @@ var Pagination = ({
98
95
  );
99
96
  };
100
97
  var usePagination = () => {
101
- const context = React2.useContext(PaginationContext);
98
+ const context = React.useContext(PaginationContext);
102
99
  if (context === void 0) {
103
100
  throw new Error(
104
101
  "usePaginationContext must be used within a PaginationProvider"
@@ -265,6 +262,5 @@ export {
265
262
  PaginationNextEllipsis,
266
263
  PaginationPreviousButton,
267
264
  PaginationPreviousEllipsis,
268
- usePagination,
269
- usePaginationRange
265
+ usePagination
270
266
  };
@@ -1 +1 @@
1
- {"inputs":{"src/use-pagination.ts":{"bytes":1355,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/pagination.tsx":{"bytes":8310,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"src/use-pagination.ts","kind":"import-statement","original":"./use-pagination"},{"path":"@mijn-ui/react-button","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities/context","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities/shared","kind":"import-statement","external":true},{"path":"react-icons/lu","kind":"import-statement","external":true},{"path":"react/jsx-runtime","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":62,"imports":[{"path":"src/pagination.tsx","kind":"import-statement","original":"./pagination"},{"path":"src/use-pagination.ts","kind":"import-statement","original":"./use-pagination"}],"format":"esm"}},"outputs":{"dist/index.js":{"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@mijn-ui/react-button","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities/context","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities/shared","kind":"import-statement","external":true},{"path":"react-icons/lu","kind":"import-statement","external":true},{"path":"react/jsx-runtime","kind":"import-statement","external":true}],"exports":["Pagination","PaginationContent","PaginationList","PaginationNextButton","PaginationNextEllipsis","PaginationPreviousButton","PaginationPreviousEllipsis","usePagination","usePaginationRange"],"entryPoint":"src/index.ts","inputs":{"src/pagination.tsx":{"bytesInOutput":5593},"src/use-pagination.ts":{"bytesInOutput":1131},"src/index.ts":{"bytesInOutput":0}},"bytes":7006}}}
1
+ {"inputs":{"src/pagination.tsx":{"bytes":9915,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@mijn-ui/react-button","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities/context","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities/shared","kind":"import-statement","external":true},{"path":"react-icons/lu","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-button","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities/context","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities/shared","kind":"import-statement","external":true},{"path":"react-icons/lu","kind":"import-statement","external":true},{"path":"react/jsx-runtime","kind":"import-statement","external":true}],"exports":["Pagination","PaginationContent","PaginationList","PaginationNextButton","PaginationNextEllipsis","PaginationPreviousButton","PaginationPreviousEllipsis","usePagination"],"entryPoint":"src/index.ts","inputs":{"src/pagination.tsx":{"bytesInOutput":6625},"src/index.ts":{"bytesInOutput":0}},"bytes":6836}}}
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.0.4",
4
+ "version": "0.0.6",
5
5
  "homepage": "https://mijn-ui.vercel.app",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -12,7 +12,7 @@
12
12
  "repository": {
13
13
  "type": "git",
14
14
  "url": "git+https://github.com/mijn-ui/mijn-ui-react.git",
15
- "directory": "packages/components/src"
15
+ "directory": "packages/components/pagination"
16
16
  },
17
17
  "bugs": {
18
18
  "url": "https://github.com/mijn-ui/mijn-ui-react/issues"
@@ -30,12 +30,12 @@
30
30
  "react": "19.0.0-rc-b01722d5-20241114",
31
31
  "react-dom": "19.0.0-rc-b01722d5-20241114",
32
32
  "react-icons": "^5.3.0",
33
- "@mijn-ui/react-utilities": "0.0.4",
34
- "@mijn-ui/react-button": "0.0.4"
33
+ "@mijn-ui/react-utilities": "0.0.5",
34
+ "@mijn-ui/react-button": "0.0.6"
35
35
  },
36
36
  "peerDependencies": {
37
- "react": "19.0.0-rc-b01722d5-20241114",
38
- "react-dom": "19.0.0-rc-b01722d5-20241114"
37
+ "react": "^19.0",
38
+ "react-dom": "^19.0"
39
39
  },
40
40
  "publishConfig": {
41
41
  "access": "public"