@star-insure/sdk 2.0.0 → 2.0.1
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/components/common/SimplePagination.d.ts +9 -0
- package/dist/components/common/index.d.ts +2 -1
- package/dist/sdk.cjs.development.js +95 -0
- package/dist/sdk.cjs.development.js.map +1 -1
- package/dist/sdk.cjs.production.min.js +1 -1
- package/dist/sdk.cjs.production.min.js.map +1 -1
- package/dist/sdk.esm.js +95 -1
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/common/SimplePagination.tsx +78 -0
- package/src/components/common/index.ts +2 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Meta } from "../../types";
|
|
3
|
+
interface Props {
|
|
4
|
+
className?: string;
|
|
5
|
+
meta: Meta;
|
|
6
|
+
showPerPageSelector?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export default function SimplePagination({ meta, className, showPerPageSelector }: Props): JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import Button from './Button';
|
|
2
2
|
import Card from './Card';
|
|
3
3
|
import Pagination from './Pagination';
|
|
4
|
+
import SimplePagination from './SimplePagination';
|
|
4
5
|
import ToastItem from './ToastItem';
|
|
5
6
|
import Toasts from './Toasts';
|
|
6
7
|
import Modal from './Modal';
|
|
7
|
-
export { Button, Card, Pagination, ToastItem, Toasts, Modal, };
|
|
8
|
+
export { Button, Card, Pagination, SimplePagination, ToastItem, Toasts, Modal, };
|
|
@@ -1245,6 +1245,100 @@ function Pagination(_ref) {
|
|
|
1245
1245
|
})))));
|
|
1246
1246
|
}
|
|
1247
1247
|
|
|
1248
|
+
function SimplePagination(_ref) {
|
|
1249
|
+
var meta = _ref.meta,
|
|
1250
|
+
className = _ref.className,
|
|
1251
|
+
_ref$showPerPageSelec = _ref.showPerPageSelector,
|
|
1252
|
+
showPerPageSelector = _ref$showPerPageSelec === void 0 ? false : _ref$showPerPageSelec;
|
|
1253
|
+
var current_page = meta.current_page,
|
|
1254
|
+
per_page = meta.per_page,
|
|
1255
|
+
to = meta.to,
|
|
1256
|
+
from = meta.from;
|
|
1257
|
+
var results_on_page = to - from + 1;
|
|
1258
|
+
var has_more_pages = results_on_page === per_page;
|
|
1259
|
+
|
|
1260
|
+
function getNextPageLink() {
|
|
1261
|
+
if (typeof window !== 'undefined') {
|
|
1262
|
+
var search = new URLSearchParams(window.location.search);
|
|
1263
|
+
search.set('page', String(current_page + 1));
|
|
1264
|
+
return "?" + search.toString();
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
return '';
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
function getPrevPageLink() {
|
|
1271
|
+
if (typeof window !== 'undefined') {
|
|
1272
|
+
var search = new URLSearchParams(window.location.search);
|
|
1273
|
+
search.set('page', String(current_page - 1));
|
|
1274
|
+
return "?" + search.toString();
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
return '';
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
var nextPageLink = getNextPageLink();
|
|
1281
|
+
var prevPageLink = getPrevPageLink();
|
|
1282
|
+
|
|
1283
|
+
function handlePerPageChange(e) {
|
|
1284
|
+
var _window;
|
|
1285
|
+
|
|
1286
|
+
var search = new URLSearchParams((_window = window) == null ? void 0 : _window.location.search);
|
|
1287
|
+
search.set('limit', e.currentTarget.value);
|
|
1288
|
+
search.set('page', '1');
|
|
1289
|
+
window.location.href = "?" + search.toString();
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
return React__default.createElement("div", {
|
|
1293
|
+
className: "" + (className != null ? className : '')
|
|
1294
|
+
}, React__default.createElement("nav", {
|
|
1295
|
+
className: "font-bold flex justify-between items-center gap-6"
|
|
1296
|
+
}, React__default.createElement(react.Link, {
|
|
1297
|
+
href: prevPageLink,
|
|
1298
|
+
className: "flex items-center gap-2",
|
|
1299
|
+
disabled: current_page === 1
|
|
1300
|
+
}, React__default.createElement("svg", {
|
|
1301
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1302
|
+
className: "h-4 w-4",
|
|
1303
|
+
fill: "none",
|
|
1304
|
+
viewBox: "0 0 24 24",
|
|
1305
|
+
stroke: "currentColor",
|
|
1306
|
+
strokeWidth: "2"
|
|
1307
|
+
}, React__default.createElement("path", {
|
|
1308
|
+
strokeLinecap: "round",
|
|
1309
|
+
strokeLinejoin: "round",
|
|
1310
|
+
d: "M10 19l-7-7m0 0l7-7m-7 7h18"
|
|
1311
|
+
})), "Prev"), React__default.createElement("div", {
|
|
1312
|
+
className: "flex gap-6 items-center"
|
|
1313
|
+
}, React__default.createElement("p", null, "Page ", current_page), showPerPageSelector ? React__default.createElement("select", {
|
|
1314
|
+
value: per_page,
|
|
1315
|
+
onChange: handlePerPageChange
|
|
1316
|
+
}, React__default.createElement("option", {
|
|
1317
|
+
value: "10"
|
|
1318
|
+
}, "10 per page"), React__default.createElement("option", {
|
|
1319
|
+
value: "25"
|
|
1320
|
+
}, "25 per page"), React__default.createElement("option", {
|
|
1321
|
+
value: "50"
|
|
1322
|
+
}, "50 per page"), React__default.createElement("option", {
|
|
1323
|
+
value: "100"
|
|
1324
|
+
}, "100 per page")) : ''), React__default.createElement(react.Link, {
|
|
1325
|
+
href: nextPageLink,
|
|
1326
|
+
className: "flex items-center gap-2",
|
|
1327
|
+
disabled: !has_more_pages
|
|
1328
|
+
}, "Next", React__default.createElement("svg", {
|
|
1329
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1330
|
+
className: "h-4 w-4",
|
|
1331
|
+
fill: "none",
|
|
1332
|
+
viewBox: "0 0 24 24",
|
|
1333
|
+
stroke: "currentColor",
|
|
1334
|
+
strokeWidth: "2"
|
|
1335
|
+
}, React__default.createElement("path", {
|
|
1336
|
+
strokeLinecap: "round",
|
|
1337
|
+
strokeLinejoin: "round",
|
|
1338
|
+
d: "M14 5l7 7m0 0l-7 7m7-7H3"
|
|
1339
|
+
})))));
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1248
1342
|
function ToastItem(_ref) {
|
|
1249
1343
|
var _ref$_id = _ref._id,
|
|
1250
1344
|
_id = _ref$_id === void 0 ? '' : _ref$_id,
|
|
@@ -2076,6 +2170,7 @@ exports.QuoteRequestFormContext = QuoteRequestFormContext;
|
|
|
2076
2170
|
exports.QuoteRequestFormProvider = QuoteRequestFormProvider;
|
|
2077
2171
|
exports.QuoteRequestOptionsProvider = QuoteRequestOptionsProvider;
|
|
2078
2172
|
exports.RegistrationSearchField = RegistrationSearchField;
|
|
2173
|
+
exports.SimplePagination = SimplePagination;
|
|
2079
2174
|
exports.Table = Table;
|
|
2080
2175
|
exports.TableActions = TableActions;
|
|
2081
2176
|
exports.TableBody = TableBody;
|