@xqmsg/ui-core 0.11.0 → 0.12.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/table/TableTypes.d.ts +0 -1
- package/dist/components/table/{loading → components/loading}/index.d.ts +0 -0
- package/dist/components/table/components/text/index.d.ts +9 -0
- package/dist/components/table/index.d.ts +2 -4
- package/dist/theme/components/table.d.ts +28 -0
- package/dist/ui-core.cjs.development.js +48 -19
- 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 +50 -21
- package/dist/ui-core.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/button/Button.stories.tsx +1 -1
- package/src/components/table/Table.stories.tsx +2 -8
- package/src/components/table/TableTypes.ts +0 -20
- package/src/components/table/{loading → components/loading}/index.tsx +6 -3
- package/src/components/table/components/text/index.tsx +23 -0
- package/src/components/table/index.tsx +4 -10
- package/src/theme/components/table.ts +34 -0
- package/src/theme/customXQChakraTheme.ts +2 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Meta, Story } from '@storybook/react';
|
|
3
3
|
import { Button, ButtonProps } from '.';
|
|
4
|
-
import {
|
|
4
|
+
import { Flex } from '@chakra-ui/react';
|
|
5
5
|
|
|
6
6
|
const meta: Meta<ButtonProps> = {
|
|
7
7
|
title: 'Button example',
|
|
@@ -4,7 +4,7 @@ import { Text } from '../text';
|
|
|
4
4
|
import { Table, TableProps } from '.';
|
|
5
5
|
import { TableBody, TableHeaders } from './TableTypes';
|
|
6
6
|
import { useArgs } from '@storybook/addons';
|
|
7
|
-
import {
|
|
7
|
+
import { TableText } from './components/text';
|
|
8
8
|
|
|
9
9
|
const tableColumns = ['foo', 'bar'];
|
|
10
10
|
|
|
@@ -15,11 +15,7 @@ const tableHeaders: TableHeaders<typeof tableColumns> = {
|
|
|
15
15
|
|
|
16
16
|
const tableBody: TableBody<typeof tableColumns> = [
|
|
17
17
|
{
|
|
18
|
-
foo:
|
|
19
|
-
<Box>
|
|
20
|
-
hi <Box>hi</Box>
|
|
21
|
-
</Box>
|
|
22
|
-
),
|
|
18
|
+
foo: <TableText primaryText="hee" secondaryText="hi" />,
|
|
23
19
|
bar: 'hey',
|
|
24
20
|
},
|
|
25
21
|
{ foo: 'hi', bar: 'hey' },
|
|
@@ -76,6 +72,4 @@ Default.args = {
|
|
|
76
72
|
headers: tableHeaders,
|
|
77
73
|
columns: tableColumns,
|
|
78
74
|
loading: false,
|
|
79
|
-
variant: 'simple',
|
|
80
|
-
colorScheme: 'messenger',
|
|
81
75
|
};
|
|
@@ -13,23 +13,3 @@ export type TableRow<K extends ReadonlyTableColumns> = {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
export type TableBody<R extends ReadonlyTableColumns> = TableRow<R>[];
|
|
16
|
-
|
|
17
|
-
export type TableColorScheme =
|
|
18
|
-
| 'blue'
|
|
19
|
-
| 'cyan'
|
|
20
|
-
| 'gray'
|
|
21
|
-
| 'green'
|
|
22
|
-
| 'orange'
|
|
23
|
-
| 'pink'
|
|
24
|
-
| 'purple'
|
|
25
|
-
| 'red'
|
|
26
|
-
| 'teal'
|
|
27
|
-
| 'yellow'
|
|
28
|
-
| 'whiteAlpha'
|
|
29
|
-
| 'blackAlpha'
|
|
30
|
-
| 'linkedin'
|
|
31
|
-
| 'facebook'
|
|
32
|
-
| 'messenger'
|
|
33
|
-
| 'whatsapp'
|
|
34
|
-
| 'twitter'
|
|
35
|
-
| 'telegram';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Flex, IconButton, Spinner } from '@chakra-ui/react';
|
|
3
3
|
import { HiOutlineRefresh } from 'react-icons/hi';
|
|
4
|
-
import colors from '
|
|
5
|
-
import typography from '
|
|
4
|
+
import colors from '../../../../theme/foundations/colors';
|
|
5
|
+
import typography from '../../../../theme/foundations/typography';
|
|
6
6
|
|
|
7
7
|
interface TableLoadingRowsProps {
|
|
8
8
|
isLoading: boolean;
|
|
@@ -32,8 +32,11 @@ export const TableLoadingRows: React.FC<TableLoadingRowsProps> = ({
|
|
|
32
32
|
aria-label="Fetch more rows"
|
|
33
33
|
icon={<HiOutlineRefresh />}
|
|
34
34
|
fontSize={typography.fontSizes['3xl']}
|
|
35
|
+
bg="transparent"
|
|
36
|
+
shadow="none"
|
|
37
|
+
color={colors.fill.action}
|
|
35
38
|
type="button"
|
|
36
|
-
variant="
|
|
39
|
+
variant="outline"
|
|
37
40
|
onClick={onLoadMore}
|
|
38
41
|
/>
|
|
39
42
|
)}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box, Text } from '@chakra-ui/react';
|
|
3
|
+
import colors from 'src/theme/foundations/colors';
|
|
4
|
+
|
|
5
|
+
export interface TableTextProps {
|
|
6
|
+
primaryText: string;
|
|
7
|
+
secondaryText?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A functional React component utilized to render the `TableText` component
|
|
12
|
+
*/
|
|
13
|
+
export const TableText: React.FC<TableTextProps> = ({
|
|
14
|
+
primaryText,
|
|
15
|
+
secondaryText,
|
|
16
|
+
}) => {
|
|
17
|
+
return (
|
|
18
|
+
<Box>
|
|
19
|
+
<Text color={colors.label.primary.light}>{primaryText}</Text>
|
|
20
|
+
<Text color={colors.label.secondary.light}>{secondaryText}</Text>
|
|
21
|
+
</Box>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import {
|
|
3
3
|
ReadonlyTableColumns,
|
|
4
4
|
TableBody,
|
|
5
|
-
TableColorScheme,
|
|
6
5
|
TableColumns,
|
|
7
6
|
TableHeaders,
|
|
8
7
|
} from './TableTypes';
|
|
@@ -18,16 +17,13 @@ import {
|
|
|
18
17
|
Thead,
|
|
19
18
|
Tr,
|
|
20
19
|
} from '@chakra-ui/react';
|
|
21
|
-
import { TableLoadingRows } from './loading';
|
|
22
|
-
import colors from '../../theme/foundations/colors';
|
|
20
|
+
import { TableLoadingRows } from './components/loading';
|
|
23
21
|
|
|
24
22
|
export interface TableProps<T extends ReadonlyTableColumns> {
|
|
25
23
|
columns: TableColumns;
|
|
26
24
|
headers: TableHeaders<T>;
|
|
27
25
|
body: TableBody<T>;
|
|
28
26
|
loading?: boolean;
|
|
29
|
-
variant: 'simple' | 'striped' | 'unstyled';
|
|
30
|
-
colorScheme?: TableColorScheme;
|
|
31
27
|
borderTopRadius?: boolean;
|
|
32
28
|
loadMore?: () => void;
|
|
33
29
|
placeholder?: string;
|
|
@@ -42,8 +38,7 @@ export function Table<T extends ReadonlyTableColumns>({
|
|
|
42
38
|
body,
|
|
43
39
|
placeholder = 'There is currently no available data',
|
|
44
40
|
loading,
|
|
45
|
-
|
|
46
|
-
colorScheme,
|
|
41
|
+
|
|
47
42
|
borderTopRadius = true,
|
|
48
43
|
loadMore,
|
|
49
44
|
}: TableProps<T>) {
|
|
@@ -51,15 +46,14 @@ export function Table<T extends ReadonlyTableColumns>({
|
|
|
51
46
|
|
|
52
47
|
return (
|
|
53
48
|
<TableContainer
|
|
54
|
-
border="
|
|
55
|
-
borderColor={colors.fill.light.quaternary}
|
|
49
|
+
border="none"
|
|
56
50
|
overflowX="auto"
|
|
57
51
|
bg="white"
|
|
58
52
|
borderRadius="md"
|
|
59
53
|
borderTopLeftRadius={borderTopRadius ? 'md' : 0}
|
|
60
54
|
borderTopRightRadius={borderTopRadius ? 'md' : 0}
|
|
61
55
|
>
|
|
62
|
-
<ChakraTable variant=
|
|
56
|
+
<ChakraTable variant="unstyled">
|
|
63
57
|
<Thead>
|
|
64
58
|
<Tr>
|
|
65
59
|
{columnsAsConst.map(column => (
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import colors from '../foundations/colors';
|
|
2
|
+
|
|
3
|
+
const parts = ['th', 'td', 'tr', 'body'];
|
|
4
|
+
|
|
5
|
+
const baseStyle = {
|
|
6
|
+
th: {
|
|
7
|
+
height: 'fit-content',
|
|
8
|
+
width: '100%',
|
|
9
|
+
bg: colors.label.primary.dark,
|
|
10
|
+
padding: '5px 8px !important',
|
|
11
|
+
},
|
|
12
|
+
tr: {
|
|
13
|
+
fontSize: '13px',
|
|
14
|
+
display: 'flex',
|
|
15
|
+
alignItems: 'center',
|
|
16
|
+
width: '100%',
|
|
17
|
+
|
|
18
|
+
height: 'fit-content',
|
|
19
|
+
borderRadius: 'md',
|
|
20
|
+
_odd: {
|
|
21
|
+
background: colors.fill.light.tertiary,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
td: {
|
|
25
|
+
padding: '5px 8px !important',
|
|
26
|
+
borderRadius: 'md',
|
|
27
|
+
width: '100%',
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default {
|
|
32
|
+
parts,
|
|
33
|
+
baseStyle,
|
|
34
|
+
};
|
|
@@ -15,6 +15,7 @@ import Link from './components/link';
|
|
|
15
15
|
import Modal from './components/modal';
|
|
16
16
|
import Select from './components/select';
|
|
17
17
|
import Switch from './components/switch';
|
|
18
|
+
import Table from './components/table';
|
|
18
19
|
import Tabs from './components/tabs';
|
|
19
20
|
import Textarea from './components/textarea';
|
|
20
21
|
import Text from './components/text';
|
|
@@ -38,6 +39,7 @@ const customXQChakraTheme = extendTheme({
|
|
|
38
39
|
Modal,
|
|
39
40
|
Select,
|
|
40
41
|
Switch,
|
|
42
|
+
Table,
|
|
41
43
|
Tabs,
|
|
42
44
|
Textarea,
|
|
43
45
|
Text,
|