@starasia/pagination 1.0.3 → 1.0.5
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/pagination.es.js +26 -18
- package/dist/pagination.umd.js +23 -15
- package/package.json +1 -1
package/dist/pagination.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as h, jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo as
|
|
2
|
+
import { useMemo as f } from "react";
|
|
3
3
|
const x = `@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@500&display=swap");
|
|
4
4
|
|
|
5
5
|
:root {
|
|
@@ -10,30 +10,31 @@ const x = `@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght
|
|
|
10
10
|
/* color */
|
|
11
11
|
--starasia-ui-pagination-color-primary-gray: var(
|
|
12
12
|
--starasia-ui-color-gray-700,
|
|
13
|
-
|
|
13
|
+
rgba(55, 65, 81, 1)
|
|
14
14
|
);
|
|
15
15
|
--starasia-ui-pagination-color-secondary-gray: var(
|
|
16
16
|
--starasia-ui-color-gray-500,
|
|
17
|
-
|
|
17
|
+
rgba(107, 114, 128, 1)
|
|
18
18
|
);
|
|
19
19
|
--starasia-ui-pagination-color-tertiary-gray: var(
|
|
20
20
|
--starasia-ui-color-gray-300,
|
|
21
|
-
|
|
21
|
+
rgba(209, 213, 219, 1)
|
|
22
22
|
);
|
|
23
23
|
--starasia-ui-pagination-color-quaternary-gray: var(
|
|
24
24
|
--starasia-ui-color-gray-100,
|
|
25
|
-
|
|
25
|
+
rgba(243, 244, 246, 1)
|
|
26
26
|
);
|
|
27
27
|
--starasia-ui-pagination-color-quinary-gray: var(
|
|
28
28
|
--starasia-ui-color-gray-50,
|
|
29
|
-
|
|
29
|
+
rgba(249, 250, 251, 1)
|
|
30
30
|
);
|
|
31
|
+
--starasia-ui-pagination-color-white: var(--starasia-ui-color-gray-50, rgba(255, 254, 255, 1));
|
|
31
32
|
/* brand color */
|
|
32
|
-
--starasia-ui-pagination-color-primary-blue: var(--starasia-ui-brand-primary-default);
|
|
33
|
-
--starasia-ui-pagination-color-secondary-blue: var(--starasia-ui-brand-primary-default);
|
|
34
|
-
--starasia-ui-pagination-color-tertiary-blue: var(--starasia-ui-brand-primary-secondary);
|
|
35
|
-
--starasia-ui-pagination-color-quaternary-blue: var(--starasia-ui-brand-primary-tertiary);
|
|
36
|
-
--starasia-ui-pagination-color-quinary-blue: var(--starasia-ui-brand-primary-tertiary);
|
|
33
|
+
--starasia-ui-pagination-color-primary-blue: var(--starasia-ui-brand-primary-default, rgba(74, 106, 148, 1));
|
|
34
|
+
--starasia-ui-pagination-color-secondary-blue: var(--starasia-ui-brand-primary-default, rgba(74, 106, 148, 1));
|
|
35
|
+
--starasia-ui-pagination-color-tertiary-blue: var(--starasia-ui-brand-primary-secondary, rgba(144, 176, 218, 1));
|
|
36
|
+
--starasia-ui-pagination-color-quaternary-blue: var(--starasia-ui-brand-primary-tertiary, rgba(227, 237, 248, 1));
|
|
37
|
+
--starasia-ui-pagination-color-quinary-blue: var(--starasia-ui-brand-primary-tertiary, rgba(227, 237, 248, 1));
|
|
37
38
|
|
|
38
39
|
/* border radius */
|
|
39
40
|
--starasia-ui-pagination-border-radius: var(--starasia-ui-radii-base, 4px);
|
|
@@ -66,10 +67,12 @@ const x = `@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght
|
|
|
66
67
|
display: flex;
|
|
67
68
|
box-sizing: border-box;
|
|
68
69
|
align-items: center;
|
|
69
|
-
|
|
70
|
+
justify-content: center;
|
|
71
|
+
border-radius: 8px !important;
|
|
72
|
+
height: 32px !important;
|
|
73
|
+
width: 32px !important;
|
|
70
74
|
font-size: var(--starasia-ui-pagination-font-size-sm);
|
|
71
75
|
font-family: "Montserrat";
|
|
72
|
-
text-align: center;
|
|
73
76
|
}
|
|
74
77
|
|
|
75
78
|
.starasia-pagination-item.starasia-pagination-item-responsive {
|
|
@@ -91,10 +94,15 @@ const x = `@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght
|
|
|
91
94
|
|
|
92
95
|
.starasia-pagination-item.starasia-pagination-selected {
|
|
93
96
|
background-color: var(--starasia-ui-pagination-color-quinary-blue);
|
|
94
|
-
color: var(--starasia-ui-pagination-color-
|
|
97
|
+
color: var(--starasia-ui-pagination-color-white) !important;
|
|
95
98
|
font-weight: var(--starasia-ui-pagination-font-weight);
|
|
96
99
|
}
|
|
97
100
|
|
|
101
|
+
.starasia-pagination-selected {
|
|
102
|
+
background-color: var(--starasia-ui-brand-primary-default, rgba(74, 106, 148, 1)) !important;
|
|
103
|
+
border-radius: 8px !important;
|
|
104
|
+
}
|
|
105
|
+
|
|
98
106
|
.starasia-pagination-arrow::before {
|
|
99
107
|
position: relative;
|
|
100
108
|
/* top: 3pt; Uncomment this to lower the icons as requested in comments*/
|
|
@@ -140,7 +148,7 @@ const x = `@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght
|
|
|
140
148
|
// pageSize,
|
|
141
149
|
siblingCount: i = 1,
|
|
142
150
|
currentPage: s
|
|
143
|
-
}) =>
|
|
151
|
+
}) => f(() => {
|
|
144
152
|
const a = n;
|
|
145
153
|
if (i + 5 >= a)
|
|
146
154
|
return m(1, a);
|
|
@@ -163,10 +171,10 @@ const x = `@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght
|
|
|
163
171
|
let l = m(u, c);
|
|
164
172
|
return [p, d, ...l, d, v];
|
|
165
173
|
}
|
|
166
|
-
}, [n, i, s]),
|
|
167
|
-
if (!document.getElementById(
|
|
174
|
+
}, [n, i, s]), b = "starasia-pagination-styles", k = (n) => {
|
|
175
|
+
if (!document.getElementById(b)) {
|
|
168
176
|
const i = document.createElement("style");
|
|
169
|
-
i.id =
|
|
177
|
+
i.id = b, i.textContent = n, document.head.appendChild(i);
|
|
170
178
|
}
|
|
171
179
|
};
|
|
172
180
|
k(x);
|
package/dist/pagination.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(s,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],n):(s=typeof globalThis<"u"?globalThis:s||self,n(s.Pagination={},s.jsxRuntime,s.React))})(this,function(s,n,h){"use strict";const
|
|
1
|
+
(function(s,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],n):(s=typeof globalThis<"u"?globalThis:s||self,n(s.Pagination={},s.jsxRuntime,s.React))})(this,function(s,n,h){"use strict";const v=`@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@500&display=swap");
|
|
2
2
|
|
|
3
3
|
:root {
|
|
4
4
|
/* spacing */
|
|
@@ -8,30 +8,31 @@
|
|
|
8
8
|
/* color */
|
|
9
9
|
--starasia-ui-pagination-color-primary-gray: var(
|
|
10
10
|
--starasia-ui-color-gray-700,
|
|
11
|
-
|
|
11
|
+
rgba(55, 65, 81, 1)
|
|
12
12
|
);
|
|
13
13
|
--starasia-ui-pagination-color-secondary-gray: var(
|
|
14
14
|
--starasia-ui-color-gray-500,
|
|
15
|
-
|
|
15
|
+
rgba(107, 114, 128, 1)
|
|
16
16
|
);
|
|
17
17
|
--starasia-ui-pagination-color-tertiary-gray: var(
|
|
18
18
|
--starasia-ui-color-gray-300,
|
|
19
|
-
|
|
19
|
+
rgba(209, 213, 219, 1)
|
|
20
20
|
);
|
|
21
21
|
--starasia-ui-pagination-color-quaternary-gray: var(
|
|
22
22
|
--starasia-ui-color-gray-100,
|
|
23
|
-
|
|
23
|
+
rgba(243, 244, 246, 1)
|
|
24
24
|
);
|
|
25
25
|
--starasia-ui-pagination-color-quinary-gray: var(
|
|
26
26
|
--starasia-ui-color-gray-50,
|
|
27
|
-
|
|
27
|
+
rgba(249, 250, 251, 1)
|
|
28
28
|
);
|
|
29
|
+
--starasia-ui-pagination-color-white: var(--starasia-ui-color-gray-50, rgba(255, 254, 255, 1));
|
|
29
30
|
/* brand color */
|
|
30
|
-
--starasia-ui-pagination-color-primary-blue: var(--starasia-ui-brand-primary-default);
|
|
31
|
-
--starasia-ui-pagination-color-secondary-blue: var(--starasia-ui-brand-primary-default);
|
|
32
|
-
--starasia-ui-pagination-color-tertiary-blue: var(--starasia-ui-brand-primary-secondary);
|
|
33
|
-
--starasia-ui-pagination-color-quaternary-blue: var(--starasia-ui-brand-primary-tertiary);
|
|
34
|
-
--starasia-ui-pagination-color-quinary-blue: var(--starasia-ui-brand-primary-tertiary);
|
|
31
|
+
--starasia-ui-pagination-color-primary-blue: var(--starasia-ui-brand-primary-default, rgba(74, 106, 148, 1));
|
|
32
|
+
--starasia-ui-pagination-color-secondary-blue: var(--starasia-ui-brand-primary-default, rgba(74, 106, 148, 1));
|
|
33
|
+
--starasia-ui-pagination-color-tertiary-blue: var(--starasia-ui-brand-primary-secondary, rgba(144, 176, 218, 1));
|
|
34
|
+
--starasia-ui-pagination-color-quaternary-blue: var(--starasia-ui-brand-primary-tertiary, rgba(227, 237, 248, 1));
|
|
35
|
+
--starasia-ui-pagination-color-quinary-blue: var(--starasia-ui-brand-primary-tertiary, rgba(227, 237, 248, 1));
|
|
35
36
|
|
|
36
37
|
/* border radius */
|
|
37
38
|
--starasia-ui-pagination-border-radius: var(--starasia-ui-radii-base, 4px);
|
|
@@ -64,10 +65,12 @@
|
|
|
64
65
|
display: flex;
|
|
65
66
|
box-sizing: border-box;
|
|
66
67
|
align-items: center;
|
|
67
|
-
|
|
68
|
+
justify-content: center;
|
|
69
|
+
border-radius: 8px !important;
|
|
70
|
+
height: 32px !important;
|
|
71
|
+
width: 32px !important;
|
|
68
72
|
font-size: var(--starasia-ui-pagination-font-size-sm);
|
|
69
73
|
font-family: "Montserrat";
|
|
70
|
-
text-align: center;
|
|
71
74
|
}
|
|
72
75
|
|
|
73
76
|
.starasia-pagination-item.starasia-pagination-item-responsive {
|
|
@@ -89,10 +92,15 @@
|
|
|
89
92
|
|
|
90
93
|
.starasia-pagination-item.starasia-pagination-selected {
|
|
91
94
|
background-color: var(--starasia-ui-pagination-color-quinary-blue);
|
|
92
|
-
color: var(--starasia-ui-pagination-color-
|
|
95
|
+
color: var(--starasia-ui-pagination-color-white) !important;
|
|
93
96
|
font-weight: var(--starasia-ui-pagination-font-weight);
|
|
94
97
|
}
|
|
95
98
|
|
|
99
|
+
.starasia-pagination-selected {
|
|
100
|
+
background-color: var(--starasia-ui-brand-primary-default, rgba(74, 106, 148, 1)) !important;
|
|
101
|
+
border-radius: 8px !important;
|
|
102
|
+
}
|
|
103
|
+
|
|
96
104
|
.starasia-pagination-arrow::before {
|
|
97
105
|
position: relative;
|
|
98
106
|
/* top: 3pt; Uncomment this to lower the icons as requested in comments*/
|
|
@@ -130,4 +138,4 @@
|
|
|
130
138
|
background-color: transparent;
|
|
131
139
|
cursor: default;
|
|
132
140
|
}
|
|
133
|
-
`,g="...",u=(t,i)=>{let e=i-t+1;return Array.from({length:e},(r,a)=>a+t)},x=({totalCount:t,siblingCount:i=1,currentPage:e})=>h.useMemo(()=>{const a=t;if(i+5>=a)return u(1,a);const m=Math.max(e-i,1),y=Math.min(e+i,a),l=m>2,o=y<a-2,d=1,S=a;if(!l&&o){let c=3+2*i;return[...u(1,c),g,a]}if(l&&!o){let c=3+2*i,
|
|
141
|
+
`,g="...",u=(t,i)=>{let e=i-t+1;return Array.from({length:e},(r,a)=>a+t)},x=({totalCount:t,siblingCount:i=1,currentPage:e})=>h.useMemo(()=>{const a=t;if(i+5>=a)return u(1,a);const m=Math.max(e-i,1),y=Math.min(e+i,a),l=m>2,o=y<a-2,d=1,S=a;if(!l&&o){let c=3+2*i;return[...u(1,c),g,a]}if(l&&!o){let c=3+2*i,b=u(a-c+1,a);return[d,g,...b]}if(l&&o){let c=u(m,y);return[d,g,...c,g,S]}},[t,i,e]),f="starasia-pagination-styles";(t=>{if(!document.getElementById(f)){const i=document.createElement("style");i.id=f,i.textContent=t,document.head.appendChild(i)}})(v);const w=({onPageChange:t,totalCount:i,siblingCount:e=1,currentPage:r,size:a="md"})=>{const p=x({currentPage:r,totalCount:i,siblingCount:e});if(r===0||p.length<2)return null;const m=()=>{t(r+1)},y=()=>{t(r-1)};let l=p[p.length-1];return n.jsxs("ul",{className:"starasia-pagination-container",style:{padding:0},children:[n.jsx("li",{className:`starasia-pagination-item ${r===1?"starasia-pagination-disabled":null} ${a==="sm"?"starasia-pagination-item-responsive":""}`,onClick:y,children:n.jsx("div",{className:"starasia-pagination-arrow starasia-pagination-left"})}),p.map((o,d)=>o===g?n.jsx("li",{className:`starasia-pagination-item starasia-pagination-dots ${a==="sm"?"starasia-pagination-item-responsive":""}`,children:"…"},d):n.jsx("li",{className:`starasia-pagination-item ${o===r?"starasia-pagination-selected":null} ${a==="sm"?"starasia-pagination-item-responsive":""}`,onClick:()=>t(Number(o)),children:o},d)),n.jsx("li",{className:`starasia-pagination-item ${r===l?"starasia-pagination-disabled":null} ${a==="sm"?"starasia-pagination-item-responsive":""}`,onClick:m,children:n.jsx("div",{className:"starasia-pagination-arrow starasia-pagination-right"})})]})};s.Pagination=w,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
|