@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.
@@ -1,5 +1,5 @@
1
- import { jsxs as v, jsx as o } from "react/jsx-runtime";
2
- import { useMemo as h } from "react";
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
- #374151
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
- #6b7280
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
- #d1d5db
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
- #f3f4f6
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
- #f9fafb
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: #ffffff !important;
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
- }) => h(() => {
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, b = a;
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, f = m(
164
+ let l = 3 + 2 * i, y = m(
164
165
  a - l + 1,
165
166
  a
166
167
  );
167
- return [p, d, ...f];
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, b];
172
+ return [p, d, ...l, d, v];
172
173
  }
173
- }, [n, i, s]), y = "starasia-pagination-styles", k = (n) => {
174
- if (!document.getElementById(y)) {
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 = y, i.textContent = n, document.head.appendChild(i);
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__ */ v("ul", { className: "starasia-pagination-container", style: { padding: 0 }, children: [
202
+ return /* @__PURE__ */ h("ul", { className: "starasia-pagination-container", style: { padding: 0 }, children: [
202
203
  /* @__PURE__ */ o(
203
204
  "li",
204
205
  {
@@ -8,24 +8,25 @@
8
8
  /* color */
9
9
  --starasia-ui-pagination-color-primary-gray: var(
10
10
  --starasia-ui-color-gray-700,
11
- #374151
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
- #6b7280
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
- #d1d5db
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
- #f3f4f6
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
- #f9fafb
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: #ffffff !important;
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
- `,p="...",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),f=Math.min(e+i,a),l=m>2,o=f<a-2,d=1,S=a;if(!l&&o){let c=3+2*i;return[...u(1,c),p,a]}if(l&&!o){let c=3+2*i,b=u(a-c+1,a);return[d,p,...b]}if(l&&o){let c=u(m,f);return[d,p,...c,p,S]}},[t,i,e]),y="starasia-pagination-styles";(t=>{if(!document.getElementById(y)){const i=document.createElement("style");i.id=y,i.textContent=t,document.head.appendChild(i)}})(v);const w=({onPageChange:t,totalCount:i,siblingCount:e=1,currentPage:r,size:a="md"})=>{const g=x({currentPage:r,totalCount:i,siblingCount:e});if(r===0||g.length<2)return null;const m=()=>{t(r+1)},f=()=>{t(r-1)};let l=g[g.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:f,children:n.jsx("div",{className:"starasia-pagination-arrow starasia-pagination-left"})}),g.map((o,d)=>o===p?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"})});
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"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@starasia/pagination",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "pagination component for starasia UI",
5
5
  "author": "Prawito Hudoro",
6
6
  "main": "dist/pagination.umd.js",