@xqmsg/ui-core 0.15.3 → 0.16.0

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, Flex, Box, 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';
@@ -50,7 +50,9 @@ var Banner = function Banner(_ref) {
50
50
  var variant = _ref.variant,
51
51
  message = _ref.message,
52
52
  buttonText = _ref.buttonText,
53
- onClick = _ref.onClick;
53
+ onClick = _ref.onClick,
54
+ _ref$type = _ref.type,
55
+ type = _ref$type === void 0 ? 'expanded' : _ref$type;
54
56
  var Icon = useMemo(function () {
55
57
  switch (variant) {
56
58
  case 'error':
@@ -87,18 +89,24 @@ var Banner = function Banner(_ref) {
87
89
  }, [variant]);
88
90
  return /*#__PURE__*/React__default.createElement(Alert$1, {
89
91
  variant: variant
90
- }, /*#__PURE__*/React__default.createElement(AlertDescription, null, /*#__PURE__*/React__default.createElement(Box, {
91
- pb: "8px"
92
- }, Icon), message, onClick && buttonText && /*#__PURE__*/React__default.createElement(Flex, {
93
- pt: "8px",
94
- justifyContent: "flex-end"
92
+ }, /*#__PURE__*/React__default.createElement(AlertDescription, null, /*#__PURE__*/React__default.createElement(Flex, {
93
+ flexDirection: type === 'condensed' ? 'row' : 'column',
94
+ alignItems: type === 'condensed' ? 'center' : ''
95
+ }, /*#__PURE__*/React__default.createElement(Box, {
96
+ pr: "8px"
97
+ }, Icon), /*#__PURE__*/React__default.createElement(Box, {
98
+ pt: type === 'condensed' ? 0 : '8px'
99
+ }, " ", message), onClick && buttonText && /*#__PURE__*/React__default.createElement(Flex, {
100
+ ml: type === 'condensed' ? 'auto' : '',
101
+ pt: type === 'condensed' ? 0 : '8px',
102
+ justifyContent: type === 'condensed' ? 'flex-end' : 'flex-end'
95
103
  }, /*#__PURE__*/React__default.createElement(Button, {
96
104
  variant: "secondary",
97
105
  onClick: onClick,
98
106
  text: buttonText,
99
107
  width: "variable",
100
108
  ariaLabel: "banner button"
101
- }))));
109
+ })))));
102
110
  };
103
111
 
104
112
  var blue = {
@@ -366,12 +374,12 @@ var SpinnerButton = function SpinnerButton(_ref) {
366
374
  type = _ref.type,
367
375
  ariaLabel = _ref.ariaLabel,
368
376
  _ref$variant = _ref.variant,
369
- variant = _ref$variant === void 0 ? 'solid' : _ref$variant,
377
+ variant = _ref$variant === void 0 ? 'primary' : _ref$variant,
370
378
  disabled = _ref.disabled,
371
379
  className = _ref.className;
372
380
  return /*#__PURE__*/React__default.createElement(Button$2, {
373
381
  spinner: /*#__PURE__*/React__default.createElement(Spinner, {
374
- size: 'md'
382
+ size: 'sm'
375
383
  }),
376
384
  isLoading: isLoading,
377
385
  onClick: onClick,
@@ -595,7 +603,7 @@ function useOnClickOutside(ref, handler) {
595
603
  [ref, handler]);
596
604
  }
597
605
 
598
- var _excluded$1 = ["isRequired", "options", "name", "setValue", "handleOnChange", "value"];
606
+ var _excluded$1 = ["isRequired", "options", "name", "setValue", "handleOnChange", "disabled", "value"];
599
607
  /**
600
608
  * A functional React component utilized to render the `StackedSelect` component.
601
609
  */
@@ -608,6 +616,7 @@ var StackedSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref
608
616
  name = _ref2.name,
609
617
  setValue = _ref2.setValue,
610
618
  handleOnChange = _ref2.handleOnChange,
619
+ disabled = _ref2.disabled,
611
620
  value = _ref2.value,
612
621
  props = _objectWithoutPropertiesLoose(_ref2, _excluded$1);
613
622
 
@@ -676,6 +685,7 @@ var StackedSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref
676
685
  fontSize: "13px",
677
686
  textShadow: "0 0 0 " + colors.label.primary.light,
678
687
  value: selectedOption,
688
+ disabled: disabled,
679
689
  autoComplete: "off",
680
690
  onKeyDown: function onKeyDown(e) {
681
691
  if (isFocussed) {
@@ -696,9 +706,9 @@ var StackedSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref
696
706
  }
697
707
  }
698
708
  })), /*#__PURE__*/React__default.createElement(InputRightElement, {
699
- cursor: "pointer",
709
+ cursor: disabled ? 'not-allowed' : 'pointer',
700
710
  onClick: function onClick() {
701
- return setIsFocussed(!isFocussed);
711
+ return !disabled && setIsFocussed(!isFocussed);
702
712
  }
703
713
  }, /*#__PURE__*/React__default.createElement(Image, {
704
714
  src: SubtractIcon,
@@ -1759,6 +1769,58 @@ var TableLoadingRows = function TableLoadingRows(_ref) {
1759
1769
  }));
1760
1770
  };
1761
1771
 
1772
+ /**
1773
+ * A React component utilized to render the `EmptyTable` component
1774
+ */
1775
+
1776
+ var EmptyTable = function EmptyTable() {
1777
+ var getOpacity = function getOpacity(index) {
1778
+ switch (index) {
1779
+ case 1:
1780
+ return 0.7;
1781
+
1782
+ case 3:
1783
+ return 0.6;
1784
+
1785
+ case 5:
1786
+ return 0.5;
1787
+
1788
+ case 7:
1789
+ return 0.4;
1790
+
1791
+ case 9:
1792
+ return 0.3;
1793
+
1794
+ case 11:
1795
+ return 0.2;
1796
+
1797
+ case 13:
1798
+ return 0.1;
1799
+
1800
+ default:
1801
+ return 1;
1802
+ }
1803
+ };
1804
+
1805
+ return /*#__PURE__*/React__default.createElement(Table$2, {
1806
+ variant: "unstyled",
1807
+ width: "100%",
1808
+ style: {
1809
+ borderCollapse: 'separate',
1810
+ borderSpacing: '0px'
1811
+ }
1812
+ }, /*#__PURE__*/React__default.createElement(Tbody, null, Array.from({
1813
+ length: 14
1814
+ }, function (_, i) {
1815
+ return i + 1;
1816
+ }).map(function (i) {
1817
+ return /*#__PURE__*/React__default.createElement(Tr, null, /*#__PURE__*/React__default.createElement(Td, {
1818
+ height: "26px",
1819
+ opacity: getOpacity(i)
1820
+ }));
1821
+ })));
1822
+ };
1823
+
1762
1824
  /**
1763
1825
  * A React component utilized to render the `Table` component
1764
1826
  */
@@ -1767,8 +1829,6 @@ function Table(_ref) {
1767
1829
  var columns = _ref.columns,
1768
1830
  headers = _ref.headers,
1769
1831
  body = _ref.body,
1770
- _ref$placeholder = _ref.placeholder,
1771
- placeholder = _ref$placeholder === void 0 ? 'There is currently no available data' : _ref$placeholder,
1772
1832
  loading = _ref.loading,
1773
1833
  loadMore = _ref.loadMore;
1774
1834
  var columnsAsConst = generateTableColumnsAsConst(columns);
@@ -1777,7 +1837,7 @@ function Table(_ref) {
1777
1837
  overflowX: "auto",
1778
1838
  bg: "white",
1779
1839
  width: "100%"
1780
- }, /*#__PURE__*/React__default.createElement(Table$2, {
1840
+ }, body.length ? /*#__PURE__*/React__default.createElement(Table$2, {
1781
1841
  variant: "unstyled",
1782
1842
  width: "100%",
1783
1843
  style: {
@@ -1802,12 +1862,10 @@ function Table(_ref) {
1802
1862
  React__default.createElement(Td, null, row[column])
1803
1863
  );
1804
1864
  }));
1805
- })), !body.length && /*#__PURE__*/React__default.createElement(TableCaption, {
1806
- py: 10
1807
- }, placeholder), ' '), loadMore && loading !== undefined && /*#__PURE__*/React__default.createElement(TableLoadingRows, {
1865
+ }))) : /*#__PURE__*/React__default.createElement(EmptyTable, null), loadMore && loading !== undefined && body.length ? /*#__PURE__*/React__default.createElement(TableLoadingRows, {
1808
1866
  isLoading: loading,
1809
1867
  onLoadMore: loadMore
1810
- }));
1868
+ }) : null);
1811
1869
  }
1812
1870
 
1813
1871
  /**
@@ -2019,6 +2077,7 @@ var baseStyle$2 = /*#__PURE__*/defineStyle({
2019
2077
  fontSize: '13px',
2020
2078
  bg: colors.fill.action,
2021
2079
  color: colors.label.primary.dark,
2080
+ h: '26px',
2022
2081
  border: 'none',
2023
2082
  px: '8px',
2024
2083
  py: '4px',
@@ -2662,8 +2721,12 @@ var baseStyle$c = {
2662
2721
  },
2663
2722
  tr: {
2664
2723
  fontSize: '13px',
2724
+ h: '26px',
2725
+ lineHeight: 'normal',
2665
2726
  _odd: {
2666
2727
  td: {
2728
+ h: '26px ',
2729
+ lineHeight: 'normal',
2667
2730
  bg: colors.fill.light.tertiary,
2668
2731
  _first: {
2669
2732
  borderTopLeftRadius: 'md',
@@ -2677,7 +2740,9 @@ var baseStyle$c = {
2677
2740
  }
2678
2741
  },
2679
2742
  td: {
2680
- padding: '5px 8px !important'
2743
+ padding: '5px 8px !important',
2744
+ lineHeight: 'normal',
2745
+ h: '26px'
2681
2746
  }
2682
2747
  };
2683
2748
  var Table$1 = {
@@ -2948,7 +3013,7 @@ var baseStyle$f = {
2948
3013
  fontWeight: typography.fontWeights.normal,
2949
3014
  fontFamily: typography.fonts.base,
2950
3015
  fontSize: typography.fontSizes.sm,
2951
- lineHeight: typography.lineHeights.base,
3016
+ lineHeight: typography.lineHeights.normal,
2952
3017
  letterSpacing: typography.letterSpacings.wide
2953
3018
  };
2954
3019
 
@@ -2996,7 +3061,8 @@ var styles = {
2996
3061
  overflow: {
2997
3062
  base: 'visible',
2998
3063
  lg: 'hidden'
2999
- }
3064
+ },
3065
+ lineHeight: 'normal'
3000
3066
  },
3001
3067
  '*, *::before, *::after': {
3002
3068
  borderColor: 'gray.200'