@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.
- package/dist/components/banner/index.d.ts +1 -0
- package/dist/components/input/StackedSelect/{StackedSelect.d.ts → index.d.ts} +0 -0
- package/dist/components/table/empty/index.d.ts +5 -0
- package/dist/components/table/index.d.ts +1 -1
- package/dist/theme/components/button.d.ts +3 -0
- package/dist/theme/components/table.d.ts +6 -0
- package/dist/theme/styles.d.ts +1 -0
- package/dist/ui-core.cjs.development.js +88 -22
- package/dist/ui-core.cjs.development.js.map +1 -1
- package/dist/ui-core.cjs.production.min.js +1 -1
- package/dist/ui-core.cjs.production.min.js.map +1 -1
- package/dist/ui-core.esm.js +89 -23
- package/dist/ui-core.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/banner/Banner.stories.tsx +32 -0
- package/src/components/banner/index.tsx +24 -13
- package/src/components/button/Button.stories.tsx +1 -1
- package/src/components/button/spinner/index.tsx +2 -3
- package/src/components/input/StackedSelect/{StackedSelect.tsx → index.tsx} +14 -4
- package/src/components/input/index.tsx +1 -1
- package/src/components/table/empty/index.tsx +47 -0
- package/src/components/table/index.tsx +30 -29
- package/src/theme/components/button.ts +1 -0
- package/src/theme/components/table.ts +6 -0
- package/src/theme/components/text.ts +1 -1
- package/src/theme/styles.ts +1 -0
|
File without changes
|
|
@@ -11,4 +11,4 @@ export interface TableProps<T extends ReadonlyTableColumns> {
|
|
|
11
11
|
/**
|
|
12
12
|
* A React component utilized to render the `Table` component
|
|
13
13
|
*/
|
|
14
|
-
export declare function Table<T extends ReadonlyTableColumns>({ columns, headers, body,
|
|
14
|
+
export declare function Table<T extends ReadonlyTableColumns>({ columns, headers, body, loading, loadMore, }: TableProps<T>): JSX.Element;
|
|
@@ -4,6 +4,7 @@ declare const _default: {
|
|
|
4
4
|
fontSize: string;
|
|
5
5
|
bg: string;
|
|
6
6
|
color: string;
|
|
7
|
+
h: string;
|
|
7
8
|
border: string;
|
|
8
9
|
px: string;
|
|
9
10
|
py: string;
|
|
@@ -34,6 +35,7 @@ declare const _default: {
|
|
|
34
35
|
fontSize: string;
|
|
35
36
|
bg: string;
|
|
36
37
|
color: string;
|
|
38
|
+
h: string;
|
|
37
39
|
border: string;
|
|
38
40
|
px: string;
|
|
39
41
|
py: string;
|
|
@@ -74,6 +76,7 @@ declare const _default: {
|
|
|
74
76
|
};
|
|
75
77
|
borderRadius: string;
|
|
76
78
|
fontSize: string;
|
|
79
|
+
h: string;
|
|
77
80
|
border: string;
|
|
78
81
|
px: string;
|
|
79
82
|
py: string;
|
|
@@ -11,8 +11,12 @@ declare const _default: {
|
|
|
11
11
|
};
|
|
12
12
|
tr: {
|
|
13
13
|
fontSize: string;
|
|
14
|
+
h: string;
|
|
15
|
+
lineHeight: string;
|
|
14
16
|
_odd: {
|
|
15
17
|
td: {
|
|
18
|
+
h: string;
|
|
19
|
+
lineHeight: string;
|
|
16
20
|
bg: string;
|
|
17
21
|
_first: {
|
|
18
22
|
borderTopLeftRadius: string;
|
|
@@ -27,6 +31,8 @@ declare const _default: {
|
|
|
27
31
|
};
|
|
28
32
|
td: {
|
|
29
33
|
padding: string;
|
|
34
|
+
lineHeight: string;
|
|
35
|
+
h: string;
|
|
30
36
|
};
|
|
31
37
|
};
|
|
32
38
|
};
|
package/dist/theme/styles.d.ts
CHANGED
|
@@ -57,7 +57,9 @@ var Banner = function Banner(_ref) {
|
|
|
57
57
|
var variant = _ref.variant,
|
|
58
58
|
message = _ref.message,
|
|
59
59
|
buttonText = _ref.buttonText,
|
|
60
|
-
onClick = _ref.onClick
|
|
60
|
+
onClick = _ref.onClick,
|
|
61
|
+
_ref$type = _ref.type,
|
|
62
|
+
type = _ref$type === void 0 ? 'expanded' : _ref$type;
|
|
61
63
|
var Icon = React.useMemo(function () {
|
|
62
64
|
switch (variant) {
|
|
63
65
|
case 'error':
|
|
@@ -94,18 +96,24 @@ var Banner = function Banner(_ref) {
|
|
|
94
96
|
}, [variant]);
|
|
95
97
|
return /*#__PURE__*/React__default.createElement(react.Alert, {
|
|
96
98
|
variant: variant
|
|
97
|
-
}, /*#__PURE__*/React__default.createElement(react.AlertDescription, null, /*#__PURE__*/React__default.createElement(react.
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
}, /*#__PURE__*/React__default.createElement(react.AlertDescription, null, /*#__PURE__*/React__default.createElement(react.Flex, {
|
|
100
|
+
flexDirection: type === 'condensed' ? 'row' : 'column',
|
|
101
|
+
alignItems: type === 'condensed' ? 'center' : ''
|
|
102
|
+
}, /*#__PURE__*/React__default.createElement(react.Box, {
|
|
103
|
+
pr: "8px"
|
|
104
|
+
}, Icon), /*#__PURE__*/React__default.createElement(react.Box, {
|
|
105
|
+
pt: type === 'condensed' ? 0 : '8px'
|
|
106
|
+
}, " ", message), onClick && buttonText && /*#__PURE__*/React__default.createElement(react.Flex, {
|
|
107
|
+
ml: type === 'condensed' ? 'auto' : '',
|
|
108
|
+
pt: type === 'condensed' ? 0 : '8px',
|
|
109
|
+
justifyContent: type === 'condensed' ? 'flex-end' : 'flex-end'
|
|
102
110
|
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
103
111
|
variant: "secondary",
|
|
104
112
|
onClick: onClick,
|
|
105
113
|
text: buttonText,
|
|
106
114
|
width: "variable",
|
|
107
115
|
ariaLabel: "banner button"
|
|
108
|
-
}))));
|
|
116
|
+
})))));
|
|
109
117
|
};
|
|
110
118
|
|
|
111
119
|
var blue = {
|
|
@@ -373,12 +381,12 @@ var SpinnerButton = function SpinnerButton(_ref) {
|
|
|
373
381
|
type = _ref.type,
|
|
374
382
|
ariaLabel = _ref.ariaLabel,
|
|
375
383
|
_ref$variant = _ref.variant,
|
|
376
|
-
variant = _ref$variant === void 0 ? '
|
|
384
|
+
variant = _ref$variant === void 0 ? 'primary' : _ref$variant,
|
|
377
385
|
disabled = _ref.disabled,
|
|
378
386
|
className = _ref.className;
|
|
379
387
|
return /*#__PURE__*/React__default.createElement(react.Button, {
|
|
380
388
|
spinner: /*#__PURE__*/React__default.createElement(react.Spinner, {
|
|
381
|
-
size: '
|
|
389
|
+
size: 'sm'
|
|
382
390
|
}),
|
|
383
391
|
isLoading: isLoading,
|
|
384
392
|
onClick: onClick,
|
|
@@ -602,7 +610,7 @@ function useOnClickOutside(ref, handler) {
|
|
|
602
610
|
[ref, handler]);
|
|
603
611
|
}
|
|
604
612
|
|
|
605
|
-
var _excluded$1 = ["isRequired", "options", "name", "setValue", "handleOnChange", "value"];
|
|
613
|
+
var _excluded$1 = ["isRequired", "options", "name", "setValue", "handleOnChange", "disabled", "value"];
|
|
606
614
|
/**
|
|
607
615
|
* A functional React component utilized to render the `StackedSelect` component.
|
|
608
616
|
*/
|
|
@@ -615,6 +623,7 @@ var StackedSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref
|
|
|
615
623
|
name = _ref2.name,
|
|
616
624
|
setValue = _ref2.setValue,
|
|
617
625
|
handleOnChange = _ref2.handleOnChange,
|
|
626
|
+
disabled = _ref2.disabled,
|
|
618
627
|
value = _ref2.value,
|
|
619
628
|
props = _objectWithoutPropertiesLoose(_ref2, _excluded$1);
|
|
620
629
|
|
|
@@ -683,6 +692,7 @@ var StackedSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref
|
|
|
683
692
|
fontSize: "13px",
|
|
684
693
|
textShadow: "0 0 0 " + colors.label.primary.light,
|
|
685
694
|
value: selectedOption,
|
|
695
|
+
disabled: disabled,
|
|
686
696
|
autoComplete: "off",
|
|
687
697
|
onKeyDown: function onKeyDown(e) {
|
|
688
698
|
if (isFocussed) {
|
|
@@ -703,9 +713,9 @@ var StackedSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref
|
|
|
703
713
|
}
|
|
704
714
|
}
|
|
705
715
|
})), /*#__PURE__*/React__default.createElement(react.InputRightElement, {
|
|
706
|
-
cursor:
|
|
716
|
+
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
707
717
|
onClick: function onClick() {
|
|
708
|
-
return setIsFocussed(!isFocussed);
|
|
718
|
+
return !disabled && setIsFocussed(!isFocussed);
|
|
709
719
|
}
|
|
710
720
|
}, /*#__PURE__*/React__default.createElement(react.Image, {
|
|
711
721
|
src: SubtractIcon,
|
|
@@ -1766,6 +1776,58 @@ var TableLoadingRows = function TableLoadingRows(_ref) {
|
|
|
1766
1776
|
}));
|
|
1767
1777
|
};
|
|
1768
1778
|
|
|
1779
|
+
/**
|
|
1780
|
+
* A React component utilized to render the `EmptyTable` component
|
|
1781
|
+
*/
|
|
1782
|
+
|
|
1783
|
+
var EmptyTable = function EmptyTable() {
|
|
1784
|
+
var getOpacity = function getOpacity(index) {
|
|
1785
|
+
switch (index) {
|
|
1786
|
+
case 1:
|
|
1787
|
+
return 0.7;
|
|
1788
|
+
|
|
1789
|
+
case 3:
|
|
1790
|
+
return 0.6;
|
|
1791
|
+
|
|
1792
|
+
case 5:
|
|
1793
|
+
return 0.5;
|
|
1794
|
+
|
|
1795
|
+
case 7:
|
|
1796
|
+
return 0.4;
|
|
1797
|
+
|
|
1798
|
+
case 9:
|
|
1799
|
+
return 0.3;
|
|
1800
|
+
|
|
1801
|
+
case 11:
|
|
1802
|
+
return 0.2;
|
|
1803
|
+
|
|
1804
|
+
case 13:
|
|
1805
|
+
return 0.1;
|
|
1806
|
+
|
|
1807
|
+
default:
|
|
1808
|
+
return 1;
|
|
1809
|
+
}
|
|
1810
|
+
};
|
|
1811
|
+
|
|
1812
|
+
return /*#__PURE__*/React__default.createElement(react.Table, {
|
|
1813
|
+
variant: "unstyled",
|
|
1814
|
+
width: "100%",
|
|
1815
|
+
style: {
|
|
1816
|
+
borderCollapse: 'separate',
|
|
1817
|
+
borderSpacing: '0px'
|
|
1818
|
+
}
|
|
1819
|
+
}, /*#__PURE__*/React__default.createElement(react.Tbody, null, Array.from({
|
|
1820
|
+
length: 14
|
|
1821
|
+
}, function (_, i) {
|
|
1822
|
+
return i + 1;
|
|
1823
|
+
}).map(function (i) {
|
|
1824
|
+
return /*#__PURE__*/React__default.createElement(react.Tr, null, /*#__PURE__*/React__default.createElement(react.Td, {
|
|
1825
|
+
height: "26px",
|
|
1826
|
+
opacity: getOpacity(i)
|
|
1827
|
+
}));
|
|
1828
|
+
})));
|
|
1829
|
+
};
|
|
1830
|
+
|
|
1769
1831
|
/**
|
|
1770
1832
|
* A React component utilized to render the `Table` component
|
|
1771
1833
|
*/
|
|
@@ -1774,8 +1836,6 @@ function Table(_ref) {
|
|
|
1774
1836
|
var columns = _ref.columns,
|
|
1775
1837
|
headers = _ref.headers,
|
|
1776
1838
|
body = _ref.body,
|
|
1777
|
-
_ref$placeholder = _ref.placeholder,
|
|
1778
|
-
placeholder = _ref$placeholder === void 0 ? 'There is currently no available data' : _ref$placeholder,
|
|
1779
1839
|
loading = _ref.loading,
|
|
1780
1840
|
loadMore = _ref.loadMore;
|
|
1781
1841
|
var columnsAsConst = generateTableColumnsAsConst(columns);
|
|
@@ -1784,7 +1844,7 @@ function Table(_ref) {
|
|
|
1784
1844
|
overflowX: "auto",
|
|
1785
1845
|
bg: "white",
|
|
1786
1846
|
width: "100%"
|
|
1787
|
-
}, /*#__PURE__*/React__default.createElement(react.Table, {
|
|
1847
|
+
}, body.length ? /*#__PURE__*/React__default.createElement(react.Table, {
|
|
1788
1848
|
variant: "unstyled",
|
|
1789
1849
|
width: "100%",
|
|
1790
1850
|
style: {
|
|
@@ -1809,12 +1869,10 @@ function Table(_ref) {
|
|
|
1809
1869
|
React__default.createElement(react.Td, null, row[column])
|
|
1810
1870
|
);
|
|
1811
1871
|
}));
|
|
1812
|
-
})),
|
|
1813
|
-
py: 10
|
|
1814
|
-
}, placeholder), ' '), loadMore && loading !== undefined && /*#__PURE__*/React__default.createElement(TableLoadingRows, {
|
|
1872
|
+
}))) : /*#__PURE__*/React__default.createElement(EmptyTable, null), loadMore && loading !== undefined && body.length ? /*#__PURE__*/React__default.createElement(TableLoadingRows, {
|
|
1815
1873
|
isLoading: loading,
|
|
1816
1874
|
onLoadMore: loadMore
|
|
1817
|
-
}));
|
|
1875
|
+
}) : null);
|
|
1818
1876
|
}
|
|
1819
1877
|
|
|
1820
1878
|
/**
|
|
@@ -2026,6 +2084,7 @@ var baseStyle$2 = /*#__PURE__*/system.defineStyle({
|
|
|
2026
2084
|
fontSize: '13px',
|
|
2027
2085
|
bg: colors.fill.action,
|
|
2028
2086
|
color: colors.label.primary.dark,
|
|
2087
|
+
h: '26px',
|
|
2029
2088
|
border: 'none',
|
|
2030
2089
|
px: '8px',
|
|
2031
2090
|
py: '4px',
|
|
@@ -2669,8 +2728,12 @@ var baseStyle$c = {
|
|
|
2669
2728
|
},
|
|
2670
2729
|
tr: {
|
|
2671
2730
|
fontSize: '13px',
|
|
2731
|
+
h: '26px',
|
|
2732
|
+
lineHeight: 'normal',
|
|
2672
2733
|
_odd: {
|
|
2673
2734
|
td: {
|
|
2735
|
+
h: '26px ',
|
|
2736
|
+
lineHeight: 'normal',
|
|
2674
2737
|
bg: colors.fill.light.tertiary,
|
|
2675
2738
|
_first: {
|
|
2676
2739
|
borderTopLeftRadius: 'md',
|
|
@@ -2684,7 +2747,9 @@ var baseStyle$c = {
|
|
|
2684
2747
|
}
|
|
2685
2748
|
},
|
|
2686
2749
|
td: {
|
|
2687
|
-
padding: '5px 8px !important'
|
|
2750
|
+
padding: '5px 8px !important',
|
|
2751
|
+
lineHeight: 'normal',
|
|
2752
|
+
h: '26px'
|
|
2688
2753
|
}
|
|
2689
2754
|
};
|
|
2690
2755
|
var Table$1 = {
|
|
@@ -2955,7 +3020,7 @@ var baseStyle$f = {
|
|
|
2955
3020
|
fontWeight: typography.fontWeights.normal,
|
|
2956
3021
|
fontFamily: typography.fonts.base,
|
|
2957
3022
|
fontSize: typography.fontSizes.sm,
|
|
2958
|
-
lineHeight: typography.lineHeights.
|
|
3023
|
+
lineHeight: typography.lineHeights.normal,
|
|
2959
3024
|
letterSpacing: typography.letterSpacings.wide
|
|
2960
3025
|
};
|
|
2961
3026
|
|
|
@@ -3003,7 +3068,8 @@ var styles = {
|
|
|
3003
3068
|
overflow: {
|
|
3004
3069
|
base: 'visible',
|
|
3005
3070
|
lg: 'hidden'
|
|
3006
|
-
}
|
|
3071
|
+
},
|
|
3072
|
+
lineHeight: 'normal'
|
|
3007
3073
|
},
|
|
3008
3074
|
'*, *::before, *::after': {
|
|
3009
3075
|
borderColor: 'gray.200'
|