@star-insure/sdk 2.0.7 → 2.0.9

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.
@@ -4,6 +4,7 @@ interface Props {
4
4
  className?: string;
5
5
  meta: Meta;
6
6
  showPerPageSelector?: boolean;
7
+ defaultValue?: number;
7
8
  }
8
- export default function Pagination({ meta, className, showPerPageSelector }: Props): JSX.Element;
9
+ export default function Pagination({ meta, className, showPerPageSelector, defaultValue }: Props): JSX.Element;
9
10
  export {};
@@ -1,9 +1,10 @@
1
1
  /// <reference types="react" />
2
- import { Meta } from "../../types";
2
+ import { Meta } from '../../types';
3
3
  interface Props {
4
4
  className?: string;
5
5
  meta: Meta;
6
6
  showPerPageSelector?: boolean;
7
+ defaultValue?: number;
7
8
  }
8
- export default function SimplePagination({ meta, className, showPerPageSelector }: Props): JSX.Element;
9
+ export default function SimplePagination({ meta, className, showPerPageSelector, defaultValue, }: Props): JSX.Element;
9
10
  export {};
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- interface Props {
2
+ interface Props extends React.DetailedHTMLProps<React.TableHTMLAttributes<HTMLTableElement>, HTMLTableElement> {
3
3
  children: React.ReactNode;
4
4
  }
5
- export default function Table({ children }: Props): JSX.Element;
5
+ export default function Table({ children, ...props }: Props): JSX.Element;
6
6
  export {};
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- interface Props {
2
+ interface Props extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement> {
3
3
  children: React.ReactNode;
4
4
  className?: string;
5
5
  }
6
- export default function TableBody({ children, className }: Props): JSX.Element;
6
+ export default function TableBody({ children, className, ...props }: Props): JSX.Element;
7
7
  export {};
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
- interface Props {
2
+ interface Props extends React.DetailedHTMLProps<React.TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement> {
3
3
  children: React.ReactNode;
4
4
  className?: string;
5
5
  condensed?: true;
6
6
  }
7
- export default function TableCell({ children, className, condensed }: Props): JSX.Element;
7
+ export default function TableCell({ children, className, condensed, ...props }: Props): JSX.Element;
8
8
  export {};
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- interface Props {
2
+ interface Props extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement> {
3
3
  children: React.ReactNode;
4
4
  className?: string;
5
5
  }
6
- export default function TableHead({ children, className }: Props): JSX.Element;
6
+ export default function TableHead({ children, className, ...props }: Props): JSX.Element;
7
7
  export {};
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
- interface Props {
2
+ interface Props extends React.DetailedHTMLProps<React.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement> {
3
3
  children: React.ReactNode;
4
4
  className?: string;
5
5
  textAlign?: 'left' | 'right' | 'center';
6
6
  sort?: string;
7
7
  condensed?: true;
8
8
  }
9
- export default function TableHeader({ children, className, sort, textAlign, condensed, }: Props): JSX.Element;
9
+ export default function TableHeader({ children, className, sort, textAlign, condensed, ...props }: Props): JSX.Element;
10
10
  export {};
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
- interface Props {
2
+ interface Props extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement> {
3
3
  children: React.ReactNode;
4
4
  className?: string;
5
5
  onClick?: () => void;
6
6
  }
7
- export default function TableRow({ children, className, onClick }: Props): JSX.Element;
7
+ export default function TableRow({ children, className, onClick, ...props }: Props): JSX.Element;
8
8
  export {};
@@ -721,6 +721,21 @@ function _extends() {
721
721
  return _extends.apply(this, arguments);
722
722
  }
723
723
 
724
+ function _objectWithoutPropertiesLoose(source, excluded) {
725
+ if (source == null) return {};
726
+ var target = {};
727
+ var sourceKeys = Object.keys(source);
728
+ var key, i;
729
+
730
+ for (i = 0; i < sourceKeys.length; i++) {
731
+ key = sourceKeys[i];
732
+ if (excluded.indexOf(key) >= 0) continue;
733
+ target[key] = source[key];
734
+ }
735
+
736
+ return target;
737
+ }
738
+
724
739
  var initialData = {
725
740
  id: undefined,
726
741
  status: 'new',
@@ -1158,10 +1173,12 @@ function Pagination(_ref) {
1158
1173
  var meta = _ref.meta,
1159
1174
  className = _ref.className,
1160
1175
  _ref$showPerPageSelec = _ref.showPerPageSelector,
1161
- showPerPageSelector = _ref$showPerPageSelec === void 0 ? false : _ref$showPerPageSelec;
1176
+ showPerPageSelector = _ref$showPerPageSelec === void 0 ? false : _ref$showPerPageSelec,
1177
+ defaultValue = _ref.defaultValue;
1162
1178
  var current_page = meta.current_page,
1163
1179
  total = meta.total,
1164
1180
  per_page = meta.per_page;
1181
+ var perPageValue = defaultValue != null ? defaultValue : per_page;
1165
1182
  var page_count = Math.ceil(total / per_page);
1166
1183
 
1167
1184
  function getNextPageLink() {
@@ -1218,7 +1235,7 @@ function Pagination(_ref) {
1218
1235
  })), "Prev"), React__default.createElement("div", {
1219
1236
  className: "flex gap-6 items-center"
1220
1237
  }, React__default.createElement("p", null, "Page ", current_page, " of ", page_count), showPerPageSelector ? React__default.createElement("select", {
1221
- value: per_page,
1238
+ value: perPageValue,
1222
1239
  onChange: handlePerPageChange
1223
1240
  }, React__default.createElement("option", {
1224
1241
  value: "10"
@@ -1250,11 +1267,13 @@ function SimplePagination(_ref) {
1250
1267
  var meta = _ref.meta,
1251
1268
  className = _ref.className,
1252
1269
  _ref$showPerPageSelec = _ref.showPerPageSelector,
1253
- showPerPageSelector = _ref$showPerPageSelec === void 0 ? false : _ref$showPerPageSelec;
1270
+ showPerPageSelector = _ref$showPerPageSelec === void 0 ? false : _ref$showPerPageSelec,
1271
+ defaultValue = _ref.defaultValue;
1254
1272
  var current_page = meta.current_page,
1255
1273
  per_page = meta.per_page,
1256
1274
  to = meta.to,
1257
1275
  from = meta.from;
1276
+ var perPageValue = defaultValue != null ? defaultValue : per_page;
1258
1277
  var results_on_page = to - from + 1;
1259
1278
  var has_more_pages = results_on_page === per_page;
1260
1279
 
@@ -1312,7 +1331,7 @@ function SimplePagination(_ref) {
1312
1331
  })), "Prev"), React__default.createElement("div", {
1313
1332
  className: "flex gap-6 items-center"
1314
1333
  }, React__default.createElement("p", null, "Page ", current_page), showPerPageSelector ? React__default.createElement("select", {
1315
- value: per_page,
1334
+ value: perPageValue,
1316
1335
  onChange: handlePerPageChange
1317
1336
  }, React__default.createElement("option", {
1318
1337
  value: "10"
@@ -1457,17 +1476,20 @@ function Modal(_ref) {
1457
1476
  })))), React__default.createElement("div", null, children))))));
1458
1477
  }
1459
1478
 
1479
+ var _excluded = ["children"];
1460
1480
  function Table(_ref) {
1461
- var children = _ref.children;
1481
+ var children = _ref.children,
1482
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
1483
+
1462
1484
  return React__default.createElement("div", {
1463
1485
  className: "-my-2 -mx-4 overflow-x-auto sm:-mx-6 lg:-mx-8 text-sm"
1464
1486
  }, React__default.createElement("div", {
1465
1487
  className: "inline-block min-w-full py-2 align-middle md:px-6 lg:px-8"
1466
1488
  }, React__default.createElement("div", {
1467
1489
  className: "overflow-hidden shadow ring-1 ring-black ring-opacity-5 md:rounded-lg"
1468
- }, React__default.createElement("table", {
1490
+ }, React__default.createElement("table", Object.assign({}, props, {
1469
1491
  className: "min-w-full divide-y divide-gray-300"
1470
- }, children))));
1492
+ }), children))));
1471
1493
  }
1472
1494
 
1473
1495
  function TableActions(_ref) {
@@ -1479,35 +1501,43 @@ function TableActions(_ref) {
1479
1501
  }, children);
1480
1502
  }
1481
1503
 
1504
+ var _excluded$1 = ["children", "className"];
1482
1505
  function TableBody(_ref) {
1483
1506
  var children = _ref.children,
1484
- _ref$className = _ref.className,
1485
- className = _ref$className === void 0 ? '' : _ref$className;
1486
- return React__default.createElement("tbody", {
1487
- className: (className != null ? className : '') + " divide-y divide-gray-200 bg-white"
1488
- }, children);
1507
+ className = _ref.className,
1508
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
1509
+
1510
+ return React__default.createElement("tbody", Object.assign({}, props, {
1511
+ className: cn(className, 'divide-y divide-gray-200 bg-white')
1512
+ }), children);
1489
1513
  }
1490
1514
 
1515
+ var _excluded$2 = ["children", "className", "condensed"];
1491
1516
  function TableCell(_ref) {
1492
1517
  var children = _ref.children,
1493
1518
  className = _ref.className,
1494
- condensed = _ref.condensed;
1495
- return React__default.createElement("td", {
1519
+ condensed = _ref.condensed,
1520
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
1521
+
1522
+ return React__default.createElement("td", Object.assign({}, props, {
1496
1523
  className: cn(className, 'px-3 py-3 text-sm text-gray-500', {
1497
1524
  'w-0 whitespace-nowrap': condensed
1498
1525
  })
1499
- }, children);
1526
+ }), children);
1500
1527
  }
1501
1528
 
1529
+ var _excluded$3 = ["children", "className"];
1502
1530
  function TableHead(_ref) {
1503
1531
  var children = _ref.children,
1504
- _ref$className = _ref.className,
1505
- className = _ref$className === void 0 ? '' : _ref$className;
1506
- return React__default.createElement("thead", {
1507
- className: className + " px-3 py-4 text-sm text-white bg-gray-600"
1508
- }, children);
1532
+ className = _ref.className,
1533
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
1534
+
1535
+ return React__default.createElement("thead", Object.assign({}, props, {
1536
+ className: cn(className, 'px-3 py-4 text-sm text-white bg-gray-600')
1537
+ }), children);
1509
1538
  }
1510
1539
 
1540
+ var _excluded$4 = ["children", "className", "sort", "textAlign", "condensed"];
1511
1541
  function TableHeader(_ref) {
1512
1542
  var children = _ref.children,
1513
1543
  _ref$className = _ref.className,
@@ -1515,7 +1545,8 @@ function TableHeader(_ref) {
1515
1545
  sort = _ref.sort,
1516
1546
  _ref$textAlign = _ref.textAlign,
1517
1547
  textAlign = _ref$textAlign === void 0 ? 'left' : _ref$textAlign,
1518
- condensed = _ref.condensed;
1548
+ condensed = _ref.condensed,
1549
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
1519
1550
 
1520
1551
  var _React$useState = React__default.useState(''),
1521
1552
  sortLink = _React$useState[0],
@@ -1538,11 +1569,11 @@ function TableHeader(_ref) {
1538
1569
  }
1539
1570
  }, []);
1540
1571
  var textAlignClass = textAlign === 'center' && 'text-center justify-center' || textAlign === 'right' && 'text-right justify-end' || 'text-left justify-between';
1541
- return React__default.createElement("th", {
1572
+ return React__default.createElement("th", Object.assign({}, props, {
1542
1573
  className: cn(className, 'py-3.5 px-3 text-sm font-semibold text-left', {
1543
1574
  'w-0 whitespace-nowrap': condensed
1544
1575
  })
1545
- }, React__default.createElement("div", {
1576
+ }), React__default.createElement("div", {
1546
1577
  className: "flex items-center gap-3 " + textAlignClass
1547
1578
  }, children, sort && React__default.createElement(react.Link, {
1548
1579
  href: sortLink
@@ -1560,17 +1591,20 @@ function TableHeader(_ref) {
1560
1591
  })))));
1561
1592
  }
1562
1593
 
1594
+ var _excluded$5 = ["children", "className", "onClick"];
1563
1595
  function TableRow(_ref) {
1564
1596
  var children = _ref.children,
1565
1597
  _ref$className = _ref.className,
1566
1598
  className = _ref$className === void 0 ? '' : _ref$className,
1567
1599
  _ref$onClick = _ref.onClick,
1568
- onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick;
1600
+ onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
1601
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
1602
+
1569
1603
  var bgClass = className.includes('bg') ? '' : 'bg-white even:bg-gray-50';
1570
- return React__default.createElement("tr", {
1571
- className: className + " " + bgClass + " hover:bg-gray-100",
1604
+ return React__default.createElement("tr", Object.assign({}, props, {
1605
+ className: cn(className, bgClass, 'hover:bg-gray-100'),
1572
1606
  onClick: onClick
1573
- }, children);
1607
+ }), children);
1574
1608
  }
1575
1609
 
1576
1610
  function DateOfBirthField(_ref) {