@starasia/pagination 1.0.4 → 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 +18 -17
- package/dist/pagination.umd.js +8 -7
- package/package.json +1 -1
package/dist/pagination.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useMemo as
|
|
1
|
+
import { jsxs as h, jsx as o } from "react/jsx-runtime";
|
|
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,24 +10,25 @@ 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
33
|
--starasia-ui-pagination-color-primary-blue: var(--starasia-ui-brand-primary-default, rgba(74, 106, 148, 1));
|
|
33
34
|
--starasia-ui-pagination-color-secondary-blue: var(--starasia-ui-brand-primary-default, rgba(74, 106, 148, 1));
|
|
@@ -93,7 +94,7 @@ const x = `@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght
|
|
|
93
94
|
|
|
94
95
|
.starasia-pagination-item.starasia-pagination-selected {
|
|
95
96
|
background-color: var(--starasia-ui-pagination-color-quinary-blue);
|
|
96
|
-
color:
|
|
97
|
+
color: var(--starasia-ui-pagination-color-white) !important;
|
|
97
98
|
font-weight: var(--starasia-ui-pagination-font-weight);
|
|
98
99
|
}
|
|
99
100
|
|
|
@@ -147,33 +148,33 @@ const x = `@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght
|
|
|
147
148
|
// pageSize,
|
|
148
149
|
siblingCount: i = 1,
|
|
149
150
|
currentPage: s
|
|
150
|
-
}) =>
|
|
151
|
+
}) => f(() => {
|
|
151
152
|
const a = n;
|
|
152
153
|
if (i + 5 >= a)
|
|
153
154
|
return m(1, a);
|
|
154
155
|
const u = Math.max(s - i, 1), c = Math.min(
|
|
155
156
|
s + i,
|
|
156
157
|
a
|
|
157
|
-
), g = u > 2, r = c < a - 2, p = 1,
|
|
158
|
+
), g = u > 2, r = c < a - 2, p = 1, v = a;
|
|
158
159
|
if (!g && r) {
|
|
159
160
|
let l = 3 + 2 * i;
|
|
160
161
|
return [...m(1, l), d, a];
|
|
161
162
|
}
|
|
162
163
|
if (g && !r) {
|
|
163
|
-
let l = 3 + 2 * i,
|
|
164
|
+
let l = 3 + 2 * i, y = m(
|
|
164
165
|
a - l + 1,
|
|
165
166
|
a
|
|
166
167
|
);
|
|
167
|
-
return [p, d, ...
|
|
168
|
+
return [p, d, ...y];
|
|
168
169
|
}
|
|
169
170
|
if (g && r) {
|
|
170
171
|
let l = m(u, c);
|
|
171
|
-
return [p, d, ...l, d,
|
|
172
|
+
return [p, d, ...l, d, v];
|
|
172
173
|
}
|
|
173
|
-
}, [n, i, s]),
|
|
174
|
-
if (!document.getElementById(
|
|
174
|
+
}, [n, i, s]), b = "starasia-pagination-styles", k = (n) => {
|
|
175
|
+
if (!document.getElementById(b)) {
|
|
175
176
|
const i = document.createElement("style");
|
|
176
|
-
i.id =
|
|
177
|
+
i.id = b, i.textContent = n, document.head.appendChild(i);
|
|
177
178
|
}
|
|
178
179
|
};
|
|
179
180
|
k(x);
|
|
@@ -198,7 +199,7 @@ const N = ({
|
|
|
198
199
|
n(t - 1);
|
|
199
200
|
};
|
|
200
201
|
let g = e[e.length - 1];
|
|
201
|
-
return /* @__PURE__ */
|
|
202
|
+
return /* @__PURE__ */ h("ul", { className: "starasia-pagination-container", style: { padding: 0 }, children: [
|
|
202
203
|
/* @__PURE__ */ o(
|
|
203
204
|
"li",
|
|
204
205
|
{
|
package/dist/pagination.umd.js
CHANGED
|
@@ -8,24 +8,25 @@
|
|
|
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
31
|
--starasia-ui-pagination-color-primary-blue: var(--starasia-ui-brand-primary-default, rgba(74, 106, 148, 1));
|
|
31
32
|
--starasia-ui-pagination-color-secondary-blue: var(--starasia-ui-brand-primary-default, rgba(74, 106, 148, 1));
|
|
@@ -91,7 +92,7 @@
|
|
|
91
92
|
|
|
92
93
|
.starasia-pagination-item.starasia-pagination-selected {
|
|
93
94
|
background-color: var(--starasia-ui-pagination-color-quinary-blue);
|
|
94
|
-
color:
|
|
95
|
+
color: var(--starasia-ui-pagination-color-white) !important;
|
|
95
96
|
font-weight: var(--starasia-ui-pagination-font-weight);
|
|
96
97
|
}
|
|
97
98
|
|
|
@@ -137,4 +138,4 @@
|
|
|
137
138
|
background-color: transparent;
|
|
138
139
|
cursor: default;
|
|
139
140
|
}
|
|
140
|
-
`,
|
|
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"})});
|