@xqmsg/ui-core 0.15.3 → 0.15.4

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
1
  import React__default, { useMemo, useCallback, useRef, useEffect, useState, memo, forwardRef, createElement } from 'react';
2
- import { Button as Button$2, Image, Alert as Alert$1, AlertDescription, Box, Flex, Text as Text$2, Icon as Icon$1, Spinner, Checkbox, Input as Input$2, InputGroup, RadioGroup, Radio, InputRightElement, Textarea as Textarea$1, useOutsideClick, Switch as Switch$1, FormLabel as FormLabel$1, FormControl, FormErrorMessage, FormHelperText, SimpleGrid, useMediaQuery, Grid, GridItem, IconButton, Collapse, TableContainer, Table as Table$2, Thead, Tr, Th, Tbody, Td, TableCaption, Tabs as Tabs$1, TabList, Tab, extendTheme } from '@chakra-ui/react';
2
+ import { Button as Button$2, Image, Alert as Alert$1, AlertDescription, Box, Flex, Text as Text$2, Icon as Icon$1, Spinner, Checkbox, Input as Input$2, InputGroup, RadioGroup, Radio, InputRightElement, Textarea as Textarea$1, useOutsideClick, Switch as Switch$1, FormLabel as FormLabel$1, FormControl, FormErrorMessage, FormHelperText, SimpleGrid, useMediaQuery, Grid, GridItem, IconButton, Collapse, Table as Table$2, Tbody, Tr, Td, TableContainer, Thead, Th, Tabs as Tabs$1, TabList, Tab, extendTheme } from '@chakra-ui/react';
3
3
  import { FormProvider, useWatch, Controller } from 'react-hook-form';
4
4
  import { truncate } from 'lodash-es';
5
5
  import { CloseIcon, HamburgerIcon } from '@chakra-ui/icons';
@@ -1759,6 +1759,58 @@ var TableLoadingRows = function TableLoadingRows(_ref) {
1759
1759
  }));
1760
1760
  };
1761
1761
 
1762
+ /**
1763
+ * A React component utilized to render the `EmptyTable` component
1764
+ */
1765
+
1766
+ var EmptyTable = function EmptyTable() {
1767
+ var getOpacity = function getOpacity(index) {
1768
+ switch (index) {
1769
+ case 1:
1770
+ return 0.7;
1771
+
1772
+ case 3:
1773
+ return 0.6;
1774
+
1775
+ case 5:
1776
+ return 0.5;
1777
+
1778
+ case 7:
1779
+ return 0.4;
1780
+
1781
+ case 9:
1782
+ return 0.3;
1783
+
1784
+ case 11:
1785
+ return 0.2;
1786
+
1787
+ case 13:
1788
+ return 0.1;
1789
+
1790
+ default:
1791
+ return 1;
1792
+ }
1793
+ };
1794
+
1795
+ return /*#__PURE__*/React__default.createElement(Table$2, {
1796
+ variant: "unstyled",
1797
+ width: "100%",
1798
+ style: {
1799
+ borderCollapse: 'separate',
1800
+ borderSpacing: '0px'
1801
+ }
1802
+ }, /*#__PURE__*/React__default.createElement(Tbody, null, Array.from({
1803
+ length: 14
1804
+ }, function (_, i) {
1805
+ return i + 1;
1806
+ }).map(function (i) {
1807
+ return /*#__PURE__*/React__default.createElement(Tr, null, /*#__PURE__*/React__default.createElement(Td, {
1808
+ height: "23px",
1809
+ opacity: getOpacity(i)
1810
+ }));
1811
+ })));
1812
+ };
1813
+
1762
1814
  /**
1763
1815
  * A React component utilized to render the `Table` component
1764
1816
  */
@@ -1767,8 +1819,6 @@ function Table(_ref) {
1767
1819
  var columns = _ref.columns,
1768
1820
  headers = _ref.headers,
1769
1821
  body = _ref.body,
1770
- _ref$placeholder = _ref.placeholder,
1771
- placeholder = _ref$placeholder === void 0 ? 'There is currently no available data' : _ref$placeholder,
1772
1822
  loading = _ref.loading,
1773
1823
  loadMore = _ref.loadMore;
1774
1824
  var columnsAsConst = generateTableColumnsAsConst(columns);
@@ -1777,7 +1827,7 @@ function Table(_ref) {
1777
1827
  overflowX: "auto",
1778
1828
  bg: "white",
1779
1829
  width: "100%"
1780
- }, /*#__PURE__*/React__default.createElement(Table$2, {
1830
+ }, body.length ? /*#__PURE__*/React__default.createElement(Table$2, {
1781
1831
  variant: "unstyled",
1782
1832
  width: "100%",
1783
1833
  style: {
@@ -1802,12 +1852,10 @@ function Table(_ref) {
1802
1852
  React__default.createElement(Td, null, row[column])
1803
1853
  );
1804
1854
  }));
1805
- })), !body.length && /*#__PURE__*/React__default.createElement(TableCaption, {
1806
- py: 10
1807
- }, placeholder), ' '), loadMore && loading !== undefined && /*#__PURE__*/React__default.createElement(TableLoadingRows, {
1855
+ }))) : /*#__PURE__*/React__default.createElement(EmptyTable, null), loadMore && loading !== undefined && body.length ? /*#__PURE__*/React__default.createElement(TableLoadingRows, {
1808
1856
  isLoading: loading,
1809
1857
  onLoadMore: loadMore
1810
- }));
1858
+ }) : null);
1811
1859
  }
1812
1860
 
1813
1861
  /**