@mijn-ui/react-pagination 0.2.1 → 0.4.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 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 * as _mijn_ui_react_theme from '@mijn-ui/react-theme';
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: _mijn_ui_react_theme.SlotsToClasses<"base" | "content" | "list" | "listItem" | "previousBtn" | "previousElipsis" | "nextBtn" | "nextElipsis"> | undefined;
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<tailwind_variants.ClassValue>) | undefined) => string | undefined;
84
+ } & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
25
85
  content: (slotProps?: ({
26
86
  active?: boolean | undefined;
27
- } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string | undefined;
87
+ } & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
28
88
  list: (slotProps?: ({
29
89
  active?: boolean | undefined;
30
- } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string | undefined;
90
+ } & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
31
91
  listItem: (slotProps?: ({
32
92
  active?: boolean | undefined;
33
- } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string | undefined;
93
+ } & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
34
94
  previousBtn: (slotProps?: ({
35
95
  active?: boolean | undefined;
36
- } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string | undefined;
96
+ } & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
37
97
  previousElipsis: (slotProps?: ({
38
98
  active?: boolean | undefined;
39
- } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string | undefined;
99
+ } & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
40
100
  nextBtn: (slotProps?: ({
41
101
  active?: boolean | undefined;
42
- } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string | undefined;
102
+ } & tailwind_variants.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string | undefined;
43
103
  nextElipsis: (slotProps?: ({
44
104
  active?: boolean | undefined;
45
- } & tailwind_variants.ClassProp<tailwind_variants.ClassValue>) | undefined) => string | undefined;
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"> & UnstyledProps;
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"> & UnstyledProps;
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"> & UnstyledProps;
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"> & UnstyledProps;
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"> & UnstyledProps;
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"> & UnstyledProps;
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,62 @@
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
6
  cn,
8
- paginationStyles
9
- } from "@mijn-ui/react-theme";
10
- import { createContext } from "@mijn-ui/react-utilities";
7
+ createContext,
8
+ useTVUnstyled
9
+ } from "@mijn-ui/react-core";
11
10
  import { EllipsisIcon } from "@mijn-ui/shared-icons";
11
+ import { tv } from "tailwind-variants";
12
12
  import { jsx } from "react/jsx-runtime";
13
+ var paginationStyles = tv({
14
+ slots: {
15
+ base: "",
16
+ content: "flex w-full items-center gap-4",
17
+ list: "flex flex-row items-center",
18
+ listItem: "",
19
+ previousBtn: "",
20
+ previousElipsis: "",
21
+ nextBtn: "",
22
+ nextElipsis: ""
23
+ },
24
+ variants: {
25
+ active: {
26
+ true: {
27
+ listItem: [
28
+ "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",
29
+ "text-fg-default hover:bg-bg-secondary focus-visible:ring-outline-brand active:bg-bg-secondary/70 focus-visible:ring-offset-2",
30
+ "gap-0 px-0",
31
+ "size-9",
32
+ "bg-bg-secondary"
33
+ ]
34
+ },
35
+ false: {
36
+ listItem: [
37
+ "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",
38
+ "text-fg-default hover:bg-bg-secondary focus-visible:ring-outline-brand active:bg-bg-secondary/70 focus-visible:ring-offset-2",
39
+ "gap-0 px-0",
40
+ "size-9",
41
+ "text-fg-tertiary"
42
+ ]
43
+ }
44
+ }
45
+ },
46
+ compoundSlots: [
47
+ {
48
+ slots: ["previousBtn", "nextBtn"],
49
+ class: [
50
+ "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",
51
+ "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",
52
+ "h-8 rounded-md px-3"
53
+ ]
54
+ },
55
+ {
56
+ slots: ["previousElipsis", "nextElipsis"],
57
+ class: "text-fg-tertiary flex size-8 items-center justify-center [&_svg]:size-4"
58
+ }
59
+ ]
60
+ });
13
61
  var [PaginationProvider, usePaginationContext] = createContext({
14
62
  name: "PaginationContext",
15
63
  strict: true,
@@ -232,6 +280,7 @@ export {
232
280
  PaginationNextEllipsis,
233
281
  PaginationPreviousButton,
234
282
  PaginationPreviousEllipsis,
283
+ paginationStyles,
235
284
  usePaginationContext,
236
285
  usePaginationStyles
237
286
  };
@@ -1 +1 @@
1
- {"inputs":{"src/pagination.tsx":{"bytes":10103,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@mijn-ui/react-hooks","kind":"import-statement","external":true},{"path":"@mijn-ui/react-theme","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities","kind":"import-statement","external":true},{"path":"@mijn-ui/shared-icons","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-hooks","kind":"import-statement","external":true},{"path":"@mijn-ui/react-theme","kind":"import-statement","external":true},{"path":"@mijn-ui/react-utilities","kind":"import-statement","external":true},{"path":"@mijn-ui/shared-icons","kind":"import-statement","external":true},{"path":"react/jsx-runtime","kind":"import-statement","external":true}],"exports":["Pagination","PaginationContent","PaginationList","PaginationNextButton","PaginationNextEllipsis","PaginationPreviousButton","PaginationPreviousEllipsis","usePaginationContext","usePaginationStyles"],"entryPoint":"src/index.ts","inputs":{"src/pagination.tsx":{"bytesInOutput":6085},"src/index.ts":{"bytesInOutput":0}},"bytes":6341}}}
1
+ {"inputs":{"src/pagination.tsx":{"bytes":12303,"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":8051},"src/index.ts":{"bytesInOutput":0}},"bytes":8327}}}
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.2.1",
4
+ "version": "0.4.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.2.0",
30
- "@mijn-ui/react-theme": "0.2.0",
29
+ "@mijn-ui/react-core": "0.4.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.19",
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.2.0",
42
- "@mijn-ui/react-theme": "^0.2.0",
38
+ "@mijn-ui/react-core": "^0.4.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
  },