best-react-pagination 0.0.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/.eslintignore +1 -1
- package/.husky/pre-commit +5 -2
- package/.idea/best-react-pagination.iml +9 -0
- package/.idea/codeStyles/Project.xml +58 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/discord.xml +7 -0
- package/.idea/git_toolbox_prj.xml +15 -0
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/prettier.xml +6 -0
- package/.idea/vcs.xml +6 -0
- package/.lintstagedrc.json +1 -1
- package/LICENCE +12 -12
- package/README.md +18 -13
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/husky.config.js +4 -4
- package/package.json +5 -3
- package/tsconfig.json +24 -23
- package/webpack.config.ts +53 -45
- package/demo/.babelrc +0 -14
- package/demo/public/index.html +0 -17
- package/demo/src/App.tsx +0 -15
- package/demo/src/Pagination/index.tsx +0 -331
- package/demo/src/index.html +0 -11
- package/demo/src/index.tsx +0 -7
- package/demo/tsconfig.json +0 -18
- package/demo/webpack.config.js +0 -50
- package/lib/index.tsx +0 -331
package/.eslintignore
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/dist
|
|
1
|
+
/dist
|
|
2
2
|
webpack.config.ts
|
package/.husky/pre-commit
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="JAVA_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
4
|
+
<exclude-output />
|
|
5
|
+
<content url="file://$MODULE_DIR$" />
|
|
6
|
+
<orderEntry type="inheritedJdk" />
|
|
7
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
8
|
+
</component>
|
|
9
|
+
</module>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<component name="ProjectCodeStyleConfiguration">
|
|
2
|
+
<code_scheme name="Project" version="173">
|
|
3
|
+
<HTMLCodeStyleSettings>
|
|
4
|
+
<option name="HTML_UNIFORM_INDENT" value="true" />
|
|
5
|
+
<option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
|
|
6
|
+
<option name="HTML_DO_NOT_INDENT_CHILDREN_OF" value="html" />
|
|
7
|
+
<option name="HTML_ENFORCE_QUOTES" value="true" />
|
|
8
|
+
</HTMLCodeStyleSettings>
|
|
9
|
+
<JSCodeStyleSettings version="0">
|
|
10
|
+
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
|
11
|
+
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
|
12
|
+
<option name="FORCE_QUOTE_STYlE" value="true" />
|
|
13
|
+
<option name="ENFORCE_TRAILING_COMMA" value="Remove" />
|
|
14
|
+
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
|
15
|
+
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
|
16
|
+
</JSCodeStyleSettings>
|
|
17
|
+
<TypeScriptCodeStyleSettings version="0">
|
|
18
|
+
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
|
19
|
+
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
|
20
|
+
<option name="FORCE_QUOTE_STYlE" value="true" />
|
|
21
|
+
<option name="ENFORCE_TRAILING_COMMA" value="Remove" />
|
|
22
|
+
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
|
23
|
+
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
|
24
|
+
<option name="SPACE_WITHIN_TYPE_ASSERTION" value="true" />
|
|
25
|
+
<option name="BLACKLIST_IMPORTS" value="rxjs/Rx" />
|
|
26
|
+
</TypeScriptCodeStyleSettings>
|
|
27
|
+
<codeStyleSettings language="HTML">
|
|
28
|
+
<option name="SOFT_MARGINS" value="80" />
|
|
29
|
+
<indentOptions>
|
|
30
|
+
<option name="INDENT_SIZE" value="2" />
|
|
31
|
+
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
32
|
+
<option name="TAB_SIZE" value="2" />
|
|
33
|
+
<option name="SMART_TABS" value="true" />
|
|
34
|
+
</indentOptions>
|
|
35
|
+
</codeStyleSettings>
|
|
36
|
+
<codeStyleSettings language="JavaScript">
|
|
37
|
+
<option name="SOFT_MARGINS" value="80" />
|
|
38
|
+
<indentOptions>
|
|
39
|
+
<option name="INDENT_SIZE" value="2" />
|
|
40
|
+
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
41
|
+
<option name="TAB_SIZE" value="2" />
|
|
42
|
+
</indentOptions>
|
|
43
|
+
</codeStyleSettings>
|
|
44
|
+
<codeStyleSettings language="TypeScript">
|
|
45
|
+
<option name="RIGHT_MARGIN" value="100" />
|
|
46
|
+
<option name="IF_BRACE_FORCE" value="3" />
|
|
47
|
+
<option name="DOWHILE_BRACE_FORCE" value="3" />
|
|
48
|
+
<option name="WHILE_BRACE_FORCE" value="3" />
|
|
49
|
+
<option name="FOR_BRACE_FORCE" value="3" />
|
|
50
|
+
<option name="SOFT_MARGINS" value="80" />
|
|
51
|
+
<indentOptions>
|
|
52
|
+
<option name="INDENT_SIZE" value="2" />
|
|
53
|
+
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
54
|
+
<option name="TAB_SIZE" value="2" />
|
|
55
|
+
</indentOptions>
|
|
56
|
+
</codeStyleSettings>
|
|
57
|
+
</code_scheme>
|
|
58
|
+
</component>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="GitToolBoxProjectSettings">
|
|
4
|
+
<option name="commitMessageIssueKeyValidationOverride">
|
|
5
|
+
<BoolValueOverride>
|
|
6
|
+
<option name="enabled" value="true" />
|
|
7
|
+
</BoolValueOverride>
|
|
8
|
+
</option>
|
|
9
|
+
<option name="commitMessageValidationConfigOverride">
|
|
10
|
+
<CommitMessageValidationOverride>
|
|
11
|
+
<option name="enabled" value="true" />
|
|
12
|
+
</CommitMessageValidationOverride>
|
|
13
|
+
</option>
|
|
14
|
+
</component>
|
|
15
|
+
</project>
|
package/.idea/misc.xml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/best-react-pagination.iml" filepath="$PROJECT_DIR$/.idea/best-react-pagination.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
package/.idea/vcs.xml
ADDED
package/.lintstagedrc.json
CHANGED
package/LICENCE
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
Copyright (c) 2021, Dmitriy Tsybizov <dts97@yandex.ru>
|
|
2
|
-
|
|
3
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
4
|
-
purpose with or without fee is hereby granted, provided that the above
|
|
5
|
-
copyright notice and this permission notice appear in all copies.
|
|
6
|
-
|
|
7
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
8
|
-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
9
|
-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
10
|
-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
11
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
12
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
1
|
+
Copyright (c) 2021, Dmitriy Tsybizov <dts97@yandex.ru>
|
|
2
|
+
|
|
3
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
4
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
5
|
+
copyright notice and this permission notice appear in all copies.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
8
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
9
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
10
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
11
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
12
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
13
13
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
CHANGED
|
@@ -28,18 +28,23 @@ const YourComponent: FC = () => {
|
|
|
28
28
|
};
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
+
#### Example https://codesandbox.io/s/lingering-breeze-gh2dk
|
|
32
|
+
|
|
31
33
|
## Props
|
|
32
34
|
|
|
33
|
-
| Name | Type
|
|
34
|
-
| -------------------
|
|
35
|
-
| `paginationStart` | `Number`
|
|
36
|
-
| `currentIndex` | `Number`
|
|
37
|
-
| `totalPages` | `Number`
|
|
38
|
-
| `setIndex` | `React.
|
|
39
|
-
| `isDefaultStyles` | `Boolean`
|
|
40
|
-
| `wrapperClass` | `String`
|
|
41
|
-
| `itemListClass` | `String`
|
|
42
|
-
| `itemClass` | `String`
|
|
43
|
-
| `selectedItemClass` | `String`
|
|
44
|
-
| `disableItemClass` | `String`
|
|
45
|
-
| `className` | `String`
|
|
35
|
+
| Name | Type | Description |
|
|
36
|
+
| ------------------- |----------------------------------| ---------------------------------------------------------------------- |
|
|
37
|
+
| `paginationStart` | `Number` | **Required.** The number of start pages on your logic (0 or 1). |
|
|
38
|
+
| `currentIndex` | `Number` | **Required.** The current index from hook useState of pages displayed. |
|
|
39
|
+
| `totalPages` | `Number` | **Required.** The range of pages displayed. |
|
|
40
|
+
| `setIndex` | `React.SetStateAction<number>` | **Required.** The dispatch from hook useState |
|
|
41
|
+
| `isDefaultStyles` | `Boolean` | **Default true** |
|
|
42
|
+
| `wrapperClass` | `String` | Css class |
|
|
43
|
+
| `itemListClass` | `String` | Css class |
|
|
44
|
+
| `itemClass` | `String` | Css class |
|
|
45
|
+
| `selectedItemClass` | `String` | Css class |
|
|
46
|
+
| `disableItemClass` | `String` | Css class |
|
|
47
|
+
| `className` | `String` | **Field for styled-component** |
|
|
48
|
+
|
|
49
|
+
### Remark
|
|
50
|
+
For rewrite default styles - use !important in your css
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { FC } from "react";
|
|
2
|
-
interface
|
|
2
|
+
interface PaginationProps {
|
|
3
3
|
paginationStart: 0 | 1;
|
|
4
4
|
currentIndex: number;
|
|
5
5
|
totalPages: number;
|
|
@@ -12,5 +12,5 @@ interface IPagination {
|
|
|
12
12
|
disableItemClass?: string;
|
|
13
13
|
className?: string;
|
|
14
14
|
}
|
|
15
|
-
declare const Pagination: FC<
|
|
15
|
+
declare const Pagination: FC<PaginationProps>;
|
|
16
16
|
export default Pagination;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["best-react-pagination"]=t():e["best-react-pagination"]=t()}(self,(function(){return(()=>{"use strict";var e={
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["best-react-pagination"]=t():e["best-react-pagination"]=t()}(self,(function(){return(()=>{"use strict";var e={743:function(e,t,l){var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=a(l(689)),n=l(40);t.default=function(e){var t=e.isDefaultStyles,l=e.itemListClass,a=e.children;return s.default.createElement("ul",{className:l,style:t?n.defaultStyles.itemListClass:void 0},a)}},175:function(e,t,l){var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var s=l(743);Object.defineProperty(t,"default",{enumerable:!0,get:function(){return a(s).default}})},775:function(e,t,l){var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=a(l(689)),n=l(40);t.default=function(e){var t=e.isDefaultStyles,l=e.itemClass,a=e.itemStyle,u=e.onClick,i=e.children;return s.default.createElement("li",{className:l,style:t?n.defaultStyles[a]:void 0,onClick:u},i)}},541:function(e,t,l){var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var s=l(775);Object.defineProperty(t,"default",{enumerable:!0,get:function(){return a(s).default}})},989:function(e,t,l){var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=a(l(689)),n=l(40);t.default=function(e){var t=e.isDefaultStyles,l=e.wrapperClass,a=e.children;return s.default.createElement("div",{className:l,style:t?n.defaultStyles.wrapperClass:void 0},a)}},704:function(e,t,l){var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var s=l(989);Object.defineProperty(t,"default",{enumerable:!0,get:function(){return a(s).default}})},40:(e,t)=>{var l;Object.defineProperty(t,"__esModule",{value:!0}),t.defaultStyles=t.defaultStylesEnum=void 0,(l=t.defaultStylesEnum||(t.defaultStylesEnum={})).wrapperClass="wrapperClass",l.itemListClass="itemListClass",l.itemClass="itemClass",l.selectedItemClass="selectedItemClass",l.disableItemClass="disableItemClass",t.defaultStyles={wrapperClass:{position:"sticky",display:"flex",justifyContent:"center",alignItems:"center",width:"100%",bottom:0},itemListClass:{padding:"10px 0"},itemClass:{display:"inline",cursor:"pointer",padding:"6px 12px",borderRadius:"4px",margin:"0 2px",backgroundColor:"#45c954",userSelect:"none"},selectedItemClass:{display:"inline",cursor:"pointer",padding:"6px 12px",borderRadius:"4px",margin:"0 2px",backgroundColor:"#48bbff",userSelect:"none"},disableItemClass:{display:"inline",cursor:"not-allowed",padding:"6px 12px",borderRadius:"4px",margin:"0 2px",userSelect:"none"}}},741:function(e,t,l){var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Item=t.ItemList=t.Wrapper=void 0;var s=l(704);Object.defineProperty(t,"Wrapper",{enumerable:!0,get:function(){return a(s).default}});var n=l(175);Object.defineProperty(t,"ItemList",{enumerable:!0,get:function(){return a(n).default}});var u=l(541);Object.defineProperty(t,"Item",{enumerable:!0,get:function(){return a(u).default}})},876:(e,t)=>{function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var l=0,a=new Array(t);l<t;l++)a[l]=e[l];return a}Object.defineProperty(t,"__esModule",{value:!0}),t.range=void 0,t.range=function(e){return(t=Array(e).keys(),function(e){if(Array.isArray(e))return l(e)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var a=Object.prototype.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?l(e,t):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).map((function(e){return e}));var t}},708:function(e,t,l){var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=a(l(689)),n=l(40),u=l(741),i=l(876);t.default=function(e){var t=e.paginationStart,l=e.currentIndex,a=e.totalPages,r=e.setIndex,m=e.isDefaultStyles,f=e.wrapperClass,d=void 0===f?"":f,o=e.itemListClass,c=void 0===o?"":o,y=e.itemClass,S=void 0===y?"":y,p=e.selectedItemClass,C=void 0===p?"":p,E=e.disableItemClass,I=void 0===E?"":E,v=e.className;return a<=1?s.default.createElement(u.Wrapper,{wrapperClass:v||d,isDefaultStyles:m},s.default.createElement(u.ItemList,{itemListClass:c,isDefaultStyles:m},s.default.createElement(u.Item,{itemClass:I,itemStyle:n.defaultStylesEnum.disableItemClass,isDefaultStyles:m},"<<"),s.default.createElement(u.Item,{itemClass:I,itemStyle:n.defaultStylesEnum.disableItemClass,isDefaultStyles:m},"1"),s.default.createElement(u.Item,{itemClass:I,itemStyle:n.defaultStylesEnum.disableItemClass,isDefaultStyles:m},">>"))):a>1&&a<4?s.default.createElement(u.Wrapper,{wrapperClass:v||d,isDefaultStyles:m},s.default.createElement(u.ItemList,{itemListClass:c,isDefaultStyles:m},(0,i.range)(a).map((function(e){var a=0===t?e:e+1;return l===a?s.default.createElement(u.Item,{itemClass:C,itemStyle:n.defaultStylesEnum.selectedItemClass,isDefaultStyles:m,key:e},e+1):s.default.createElement(u.Item,{itemClass:C,itemStyle:n.defaultStylesEnum.itemClass,isDefaultStyles:m,onClick:function(){return r(a)},key:e},e+1)})))):4===a?s.default.createElement(u.Wrapper,{wrapperClass:v||d,isDefaultStyles:m},s.default.createElement(u.ItemList,{itemListClass:c,isDefaultStyles:m},l>(0===t?0:1)?s.default.createElement(u.Item,{itemClass:S,itemStyle:n.defaultStylesEnum.itemClass,isDefaultStyles:m,onClick:function(){return r(l-1)}},"<<"):s.default.createElement(u.Item,{itemClass:I,itemStyle:n.defaultStylesEnum.disableItemClass,isDefaultStyles:m},"<<"),(0,i.range)(a).map((function(e){var a=0===t?e:e+1;return l===a?s.default.createElement(u.Item,{itemClass:C,itemStyle:n.defaultStylesEnum.selectedItemClass,isDefaultStyles:m,key:e},e+1):s.default.createElement(u.Item,{itemClass:C,itemStyle:n.defaultStylesEnum.itemClass,isDefaultStyles:m,key:e,onClick:function(){return r(a)}},e+1)})),l<(0===t?3:4)?s.default.createElement(u.Item,{itemClass:S,itemStyle:n.defaultStylesEnum.itemClass,isDefaultStyles:m,onClick:function(){return r(l+1)}},">>"):s.default.createElement(u.Item,{itemClass:I,itemStyle:n.defaultStylesEnum.disableItemClass,isDefaultStyles:m},">>"))):s.default.createElement(u.Wrapper,{wrapperClass:v||d,isDefaultStyles:m},s.default.createElement(u.ItemList,{itemListClass:c,isDefaultStyles:m},l>(0===t?0:1)?s.default.createElement(u.Item,{itemClass:S,itemStyle:n.defaultStylesEnum.itemClass,isDefaultStyles:m,onClick:function(){return r(l-1)}},"<<"):s.default.createElement(u.Item,{itemClass:I,itemStyle:n.defaultStylesEnum.disableItemClass,isDefaultStyles:m},"<<"),l>(0==t?2:3)?s.default.createElement(u.Item,{itemClass:S,itemStyle:n.defaultStylesEnum.itemClass,isDefaultStyles:m,onClick:function(){return r(0===t?0:1)}},"1"):null,l<(0===t?3:4)?(0,i.range)(4).map((function(e){var a=0===t?e:e+1;return l===a?s.default.createElement(u.Item,{itemClass:C,itemStyle:n.defaultStylesEnum.selectedItemClass,isDefaultStyles:m,key:e},e+1):s.default.createElement(u.Item,{itemClass:S,itemStyle:n.defaultStylesEnum.itemClass,isDefaultStyles:m,onClick:function(){return r(a)},key:e},e+1)})):null,l>(0===t?2:3)?s.default.createElement(u.Item,{itemClass:I,itemStyle:n.defaultStylesEnum.disableItemClass,isDefaultStyles:m},"..."):null,l>(0===t?2:3)&&(0===t?l:l-1)<a?s.default.createElement(s.default.Fragment,null,l===(0===t?a-2:a-1)&&s.default.createElement(u.Item,{itemClass:S,itemStyle:n.defaultStylesEnum.itemClass,isDefaultStyles:m,onClick:function(){return r(0===t?a-4:a-3)}},a-3),l===(0===t?a-1:a)&&s.default.createElement(s.default.Fragment,null,s.default.createElement(u.Item,{itemClass:S,itemStyle:n.defaultStylesEnum.itemClass,isDefaultStyles:m,onClick:function(){return r(0===t?a-4:a-3)}},a-3),s.default.createElement(u.Item,{itemClass:S,itemStyle:n.defaultStylesEnum.itemClass,isDefaultStyles:m,onClick:function(){return r(0===t?a-3:a-2)}},a-2)),s.default.createElement(u.Item,{itemClass:S,itemStyle:n.defaultStylesEnum.itemClass,isDefaultStyles:m,onClick:function(){return r(l-1)}},0===t?l:l-1),s.default.createElement(u.Item,{itemClass:C,itemStyle:n.defaultStylesEnum.selectedItemClass,isDefaultStyles:m},0===t?l+1:l),l<(0===t?a-1:a)?s.default.createElement(u.Item,{itemClass:S,itemStyle:n.defaultStylesEnum.itemClass,isDefaultStyles:m,onClick:function(){return r(l+1)}},0===t?l+2:l+1):null):null,l<(0===t?a-3:a-2)?s.default.createElement(u.Item,{itemClass:I,itemStyle:n.defaultStylesEnum.disableItemClass,isDefaultStyles:m},"..."):null,l<(0===t?a-2:a-1)?s.default.createElement(u.Item,{itemClass:S,itemStyle:n.defaultStylesEnum.itemClass,isDefaultStyles:m,onClick:function(){return r(0===t?a-1:a)}},a):null,(0===t?l+1:l)<a?s.default.createElement(u.Item,{itemClass:S,itemStyle:n.defaultStylesEnum.itemClass,isDefaultStyles:m,onClick:function(){return r(l+1)}},">>"):s.default.createElement(u.Item,{itemClass:I,itemStyle:n.defaultStylesEnum.disableItemClass,isDefaultStyles:m},">>")))}},689:e=>{e.exports=require("react")}},t={};return function l(a){var s=t[a];if(void 0!==s)return s.exports;var n=t[a]={exports:{}};return e[a].call(n.exports,n,n.exports,l),n.exports}(708)})()}));
|
package/husky.config.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
"hooks": {
|
|
3
|
-
"pre-commit": "npm run build && npm run test"
|
|
4
|
-
}
|
|
1
|
+
module.exports = {
|
|
2
|
+
"hooks": {
|
|
3
|
+
"pre-commit": "npm run build && npm run test"
|
|
4
|
+
}
|
|
5
5
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "best-react-pagination",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Pagination for work with React",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -33,6 +33,8 @@
|
|
|
33
33
|
"@babel/preset-env": "^7.15.8",
|
|
34
34
|
"@babel/preset-react": "^7.14.5",
|
|
35
35
|
"@babel/preset-typescript": "^7.15.0",
|
|
36
|
+
"@commitlint/cli": "^15.0.0",
|
|
37
|
+
"@commitlint/config-conventional": "^15.0.0",
|
|
36
38
|
"@types/jest": "^27.0.2",
|
|
37
39
|
"@types/node": "^16.11.0",
|
|
38
40
|
"@types/react": "^17.0.30",
|
|
@@ -45,13 +47,13 @@
|
|
|
45
47
|
"clean-webpack-plugin": "^4.0.0",
|
|
46
48
|
"copy-webpack-plugin": "^9.0.1",
|
|
47
49
|
"eslint": "^7.32.0",
|
|
48
|
-
"@commitlint/cli": "^15.0.0",
|
|
49
|
-
"@commitlint/config-conventional": "^15.0.0",
|
|
50
50
|
"eslint-plugin-react": "^7.26.1",
|
|
51
51
|
"eslint-plugin-react-hooks": "^4.2.0",
|
|
52
|
+
"fs-extra": "^10.0.0",
|
|
52
53
|
"husky": "^7.0.4",
|
|
53
54
|
"jest": "^27.2.5",
|
|
54
55
|
"lint-staged": "^12.1.2",
|
|
56
|
+
"ncp": "^2.0.0",
|
|
55
57
|
"prettier": "^2.5.1",
|
|
56
58
|
"react": "17.0.2",
|
|
57
59
|
"react-dom": "^17.0.2",
|
package/tsconfig.json
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"outDir": "./dist/",
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"jsx": "react",
|
|
13
|
-
"strict": true,
|
|
14
|
-
"allowJs": true,
|
|
15
|
-
"moduleResolution": "node"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"outDir": "./dist/",
|
|
4
|
+
"noImplicitAny": true,
|
|
5
|
+
"esModuleInterop": true,
|
|
6
|
+
"module": "CommonJS",
|
|
7
|
+
"sourceMap": true,
|
|
8
|
+
"target": "ESNext",
|
|
9
|
+
"lib": ["ESNext", "dom"],
|
|
10
|
+
"declaration": true,
|
|
11
|
+
"declarationDir": "dist",
|
|
12
|
+
"jsx": "react",
|
|
13
|
+
"strict": true,
|
|
14
|
+
"allowJs": true,
|
|
15
|
+
"moduleResolution": "node",
|
|
16
|
+
"downlevelIteration": true
|
|
17
|
+
},
|
|
18
|
+
"include": ["./lib/index.tsx"],
|
|
19
|
+
"exclude": [
|
|
20
|
+
"node_modules",
|
|
21
|
+
"dist",
|
|
22
|
+
"test"
|
|
23
|
+
]
|
|
24
|
+
}
|
package/webpack.config.ts
CHANGED
|
@@ -1,45 +1,53 @@
|
|
|
1
|
-
const path = require("path");
|
|
2
|
-
import { Configuration } from "webpack";
|
|
3
|
-
const nodeExternals = require("webpack-node-externals");
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
1
|
+
const path = require("path");
|
|
2
|
+
import { Configuration } from "webpack";
|
|
3
|
+
const nodeExternals = require("webpack-node-externals");
|
|
4
|
+
const ncp = require("ncp").ncp;
|
|
5
|
+
const fs = require("fs-extra");
|
|
6
|
+
|
|
7
|
+
const libPath = path.resolve(__dirname, "lib");
|
|
8
|
+
const distPath = path.resolve(__dirname, "dist");
|
|
9
|
+
const demoPath = path.resolve(__dirname, "demo");
|
|
10
|
+
|
|
11
|
+
const config: Configuration = {
|
|
12
|
+
entry: path.resolve(libPath, "index.tsx"),
|
|
13
|
+
output: {
|
|
14
|
+
path: distPath,
|
|
15
|
+
filename: "index.js",
|
|
16
|
+
library: "best-react-pagination",
|
|
17
|
+
libraryTarget: "umd",
|
|
18
|
+
clean: true,
|
|
19
|
+
},
|
|
20
|
+
resolve: {
|
|
21
|
+
extensions: [".tsx", ".ts", ".js"],
|
|
22
|
+
},
|
|
23
|
+
externals: [nodeExternals()],
|
|
24
|
+
plugins: [
|
|
25
|
+
{
|
|
26
|
+
apply: (compiler) => {
|
|
27
|
+
compiler.hooks.beforeCompile.tapPromise("Copy file", () => {
|
|
28
|
+
return new Promise<void>((resolve, reject) => {
|
|
29
|
+
fs.emptyDirSync(libPath);
|
|
30
|
+
ncp(demoPath + "/src/Pagination/", libPath, (err: any) => {
|
|
31
|
+
if (err) {
|
|
32
|
+
reject(err);
|
|
33
|
+
}
|
|
34
|
+
console.log("Pagination was copied to ", libPath);
|
|
35
|
+
resolve();
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
module: {
|
|
43
|
+
rules: [
|
|
44
|
+
{
|
|
45
|
+
test: /\.tsx?$/,
|
|
46
|
+
exclude: /(node_modules|bower_components)/,
|
|
47
|
+
use: ["babel-loader", "ts-loader"],
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default config;
|
package/demo/.babelrc
DELETED
package/demo/public/index.html
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
-
<meta name="theme-color" content="#000000" />
|
|
7
|
-
<meta
|
|
8
|
-
name="description"
|
|
9
|
-
content="Web site created using create-react-app"
|
|
10
|
-
/>
|
|
11
|
-
<title>React App</title>
|
|
12
|
-
</head>
|
|
13
|
-
<body>
|
|
14
|
-
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
15
|
-
<div id="root"></div>
|
|
16
|
-
</body>
|
|
17
|
-
</html>
|
package/demo/src/App.tsx
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React, { FC, useState } from "react";
|
|
2
|
-
import { hot } from "react-hot-loader/root";
|
|
3
|
-
import Pagination from "./Pagination";
|
|
4
|
-
|
|
5
|
-
const App: FC = () => {
|
|
6
|
-
const [index, setIndex] = useState(1);
|
|
7
|
-
|
|
8
|
-
return (
|
|
9
|
-
<>
|
|
10
|
-
<Pagination paginationStart={0} currentIndex={index} setIndex={setIndex} totalPages={10} isDefaultStyles={true} />
|
|
11
|
-
</>
|
|
12
|
-
);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default hot(App);
|