@ttoss/components 1.30.5 → 1.31.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/README.md +232 -40
- package/dist/components/Table.d.ts +14 -0
- package/dist/esm/components/Table.js +55 -0
- package/dist/esm/index.js +2271 -3
- package/dist/index.d.ts +36 -1
- package/package.json +14 -8
- package/src/components/Drawer.tsx +27 -0
- package/src/components/Menu.tsx +107 -0
- package/src/components/Search.tsx +2 -2
- package/src/components/Table.tsx +36 -0
- package/src/index.ts +2 -0
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ import ReactModal from 'react-modal';
|
|
|
8
8
|
import { ToastContainerProps } from 'react-toastify';
|
|
9
9
|
export { ToastContainerProps, toast } from 'react-toastify';
|
|
10
10
|
import { Options } from 'react-markdown';
|
|
11
|
+
import { IconifyIcon } from '@ttoss/react-icons';
|
|
12
|
+
import DrawerUi from 'react-modern-drawer';
|
|
11
13
|
|
|
12
14
|
type AccordionProps = BoxProps & {
|
|
13
15
|
allowMultipleExpanded?: boolean;
|
|
@@ -325,4 +327,37 @@ type SearchProps = Omit<InputProps, 'onChange'> & {
|
|
|
325
327
|
};
|
|
326
328
|
declare const Search: ({ value, defaultValue, loading, onChange, ...props }: SearchProps) => react_jsx_runtime.JSX.Element;
|
|
327
329
|
|
|
328
|
-
|
|
330
|
+
type MenuProps = {
|
|
331
|
+
onClose: () => void;
|
|
332
|
+
onOpen: () => void;
|
|
333
|
+
isOpen: boolean;
|
|
334
|
+
children: React.ReactNode;
|
|
335
|
+
srcLogo?: string;
|
|
336
|
+
sx?: BoxProps['sx'];
|
|
337
|
+
/**
|
|
338
|
+
* Default direction: `left`
|
|
339
|
+
*/
|
|
340
|
+
direction?: 'left' | 'right';
|
|
341
|
+
/**
|
|
342
|
+
* Default size: `100%`
|
|
343
|
+
*/
|
|
344
|
+
sizeOnMobile?: string | number;
|
|
345
|
+
/**
|
|
346
|
+
* Default size: `300px`
|
|
347
|
+
*/
|
|
348
|
+
sizeOnDesktop?: string | number;
|
|
349
|
+
/**
|
|
350
|
+
* Default icon: `menu-open`
|
|
351
|
+
*/
|
|
352
|
+
menuIcon?: IconifyIcon | string;
|
|
353
|
+
};
|
|
354
|
+
declare const Menu: ({ children, srcLogo, onClose, onOpen, isOpen, sx, direction, sizeOnDesktop, sizeOnMobile, menuIcon, }: MenuProps) => react_jsx_runtime.JSX.Element;
|
|
355
|
+
|
|
356
|
+
type DrawerUiProps = React.ComponentProps<typeof DrawerUi>;
|
|
357
|
+
|
|
358
|
+
type DrawerProps = DrawerUiProps & {
|
|
359
|
+
sx?: BoxProps['sx'];
|
|
360
|
+
};
|
|
361
|
+
declare const Drawer: ({ children, sx, ...props }: DrawerProps) => react_jsx_runtime.JSX.Element;
|
|
362
|
+
|
|
363
|
+
export { Accordion, type AccordionProps, Drawer, type DrawerProps, InstallPwa, InstallPwaUi, type InstallPwaUiProps, Markdown, type MarkdownProps, Menu, type MenuProps, Modal, type ModalProps, Search, type SearchProps, ToastContainer };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.31.0",
|
|
4
4
|
"description": "React components for ttoss ecosystem.",
|
|
5
5
|
"author": "ttoss",
|
|
6
6
|
"contributors": [
|
|
@@ -16,6 +16,10 @@
|
|
|
16
16
|
".": {
|
|
17
17
|
"types": "./dist/index.d.ts",
|
|
18
18
|
"import": "./dist/esm/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./table": {
|
|
21
|
+
"types": "./dist/components/Table.d.ts",
|
|
22
|
+
"import": "./dist/esm/components/Table.js"
|
|
19
23
|
}
|
|
20
24
|
},
|
|
21
25
|
"files": [
|
|
@@ -25,30 +29,32 @@
|
|
|
25
29
|
"sideEffects": false,
|
|
26
30
|
"dependencies": {
|
|
27
31
|
"@emotion/css": "^11.11.2",
|
|
28
|
-
"@
|
|
32
|
+
"@tanstack/react-table": "^8.15.3",
|
|
33
|
+
"@theme-ui/css": "^0.16.2",
|
|
29
34
|
"@types/react-modal": "^3.16.3",
|
|
30
35
|
"react-accessible-accordion": "^5.0.0",
|
|
31
36
|
"react-markdown": "^9.0.1",
|
|
32
37
|
"react-modal": "^3.16.1",
|
|
33
|
-
"react-
|
|
38
|
+
"react-modern-drawer": "^1.2.2",
|
|
39
|
+
"react-toastify": "^10.0.4",
|
|
34
40
|
"rehype-raw": "^7.0.0",
|
|
35
41
|
"remark-gfm": "^4.0.0"
|
|
36
42
|
},
|
|
37
43
|
"peerDependencies": {
|
|
38
44
|
"react": ">=16.8.0",
|
|
39
|
-
"@ttoss/
|
|
40
|
-
"@ttoss/
|
|
45
|
+
"@ttoss/react-hooks": "^1.25.3",
|
|
46
|
+
"@ttoss/ui": "^4.1.4"
|
|
41
47
|
},
|
|
42
48
|
"devDependencies": {
|
|
43
49
|
"@types/jest": "^29.5.12",
|
|
44
50
|
"@types/react": "^18.2.58",
|
|
45
51
|
"jest": "^29.7.0",
|
|
46
52
|
"tsup": "^8.0.2",
|
|
47
|
-
"@ttoss/config": "^1.31.5",
|
|
48
53
|
"@ttoss/react-hooks": "^1.25.3",
|
|
49
|
-
"@ttoss/
|
|
54
|
+
"@ttoss/config": "^1.31.5",
|
|
55
|
+
"@ttoss/react-icons": "^0.3.1",
|
|
50
56
|
"@ttoss/test-utils": "^2.1.1",
|
|
51
|
-
"@ttoss/
|
|
57
|
+
"@ttoss/ui": "^4.1.4"
|
|
52
58
|
},
|
|
53
59
|
"keywords": [
|
|
54
60
|
"React",
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Box, type BoxProps } from '@ttoss/ui';
|
|
3
|
+
import DrawerUi from 'react-modern-drawer';
|
|
4
|
+
|
|
5
|
+
type DrawerUiProps = React.ComponentProps<typeof DrawerUi>;
|
|
6
|
+
|
|
7
|
+
import 'react-modern-drawer/dist/index.css';
|
|
8
|
+
|
|
9
|
+
export type DrawerProps = DrawerUiProps & {
|
|
10
|
+
sx?: BoxProps['sx'];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const Drawer = ({ children, sx, ...props }: DrawerProps) => {
|
|
14
|
+
return (
|
|
15
|
+
<DrawerUi {...props}>
|
|
16
|
+
<Box
|
|
17
|
+
sx={{
|
|
18
|
+
width: '100%',
|
|
19
|
+
height: '100%',
|
|
20
|
+
...sx,
|
|
21
|
+
}}
|
|
22
|
+
>
|
|
23
|
+
{children}
|
|
24
|
+
</Box>
|
|
25
|
+
</DrawerUi>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Box,
|
|
4
|
+
BoxProps,
|
|
5
|
+
Flex,
|
|
6
|
+
Image,
|
|
7
|
+
Text,
|
|
8
|
+
useResponsiveValue,
|
|
9
|
+
} from '@ttoss/ui';
|
|
10
|
+
import { Drawer } from '..';
|
|
11
|
+
import { Icon, IconifyIcon } from '@ttoss/react-icons';
|
|
12
|
+
|
|
13
|
+
export type MenuProps = {
|
|
14
|
+
onClose: () => void;
|
|
15
|
+
onOpen: () => void;
|
|
16
|
+
isOpen: boolean;
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
srcLogo?: string;
|
|
19
|
+
sx?: BoxProps['sx'];
|
|
20
|
+
/**
|
|
21
|
+
* Default direction: `left`
|
|
22
|
+
*/
|
|
23
|
+
direction?: 'left' | 'right';
|
|
24
|
+
/**
|
|
25
|
+
* Default size: `100%`
|
|
26
|
+
*/
|
|
27
|
+
sizeOnMobile?: string | number;
|
|
28
|
+
/**
|
|
29
|
+
* Default size: `300px`
|
|
30
|
+
*/
|
|
31
|
+
sizeOnDesktop?: string | number;
|
|
32
|
+
/**
|
|
33
|
+
* Default icon: `menu-open`
|
|
34
|
+
*/
|
|
35
|
+
menuIcon?: IconifyIcon | string;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const Menu = ({
|
|
39
|
+
children,
|
|
40
|
+
srcLogo,
|
|
41
|
+
onClose,
|
|
42
|
+
onOpen,
|
|
43
|
+
isOpen,
|
|
44
|
+
sx,
|
|
45
|
+
direction = 'left',
|
|
46
|
+
sizeOnDesktop = '300px',
|
|
47
|
+
sizeOnMobile = '100%',
|
|
48
|
+
menuIcon = 'menu-open',
|
|
49
|
+
}: MenuProps) => {
|
|
50
|
+
const responsiveSize = useResponsiveValue([sizeOnMobile, sizeOnDesktop]);
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<>
|
|
54
|
+
<Text sx={{ cursor: 'pointer' }} onClick={onOpen}>
|
|
55
|
+
<Icon icon={menuIcon} />
|
|
56
|
+
</Text>
|
|
57
|
+
|
|
58
|
+
<Drawer size={responsiveSize} direction={direction} open={isOpen}>
|
|
59
|
+
<Box
|
|
60
|
+
sx={{
|
|
61
|
+
position: 'fixed',
|
|
62
|
+
height: '100%',
|
|
63
|
+
backgroundColor: 'background',
|
|
64
|
+
width: '100%',
|
|
65
|
+
maxWidth: 'md',
|
|
66
|
+
right: 0,
|
|
67
|
+
boxShadow: 'lg',
|
|
68
|
+
paddingX: 'xl',
|
|
69
|
+
paddingTop: 'lg',
|
|
70
|
+
paddingBottom: '2xl',
|
|
71
|
+
...sx,
|
|
72
|
+
}}
|
|
73
|
+
>
|
|
74
|
+
<Flex sx={{ justifyContent: 'space-between' }}>
|
|
75
|
+
<Image
|
|
76
|
+
src={srcLogo}
|
|
77
|
+
sx={{
|
|
78
|
+
maxWidth: '200px',
|
|
79
|
+
height: '44px',
|
|
80
|
+
objectFit: 'cover',
|
|
81
|
+
}}
|
|
82
|
+
/>
|
|
83
|
+
|
|
84
|
+
<Text
|
|
85
|
+
sx={{
|
|
86
|
+
marginLeft: 'auto',
|
|
87
|
+
fontSize: '2xl',
|
|
88
|
+
alignSelf: 'center',
|
|
89
|
+
flexShrink: 0,
|
|
90
|
+
cursor: 'pointer',
|
|
91
|
+
lineHeight: 0,
|
|
92
|
+
}}
|
|
93
|
+
role="button"
|
|
94
|
+
onClick={onClose}
|
|
95
|
+
>
|
|
96
|
+
<Icon icon="close" />
|
|
97
|
+
</Text>
|
|
98
|
+
</Flex>
|
|
99
|
+
|
|
100
|
+
<Box sx={{ paddingTop: '3xl' }} as="nav">
|
|
101
|
+
{children}
|
|
102
|
+
</Box>
|
|
103
|
+
</Box>
|
|
104
|
+
</Drawer>
|
|
105
|
+
</>
|
|
106
|
+
);
|
|
107
|
+
};
|
|
@@ -21,12 +21,12 @@ export const Search = ({
|
|
|
21
21
|
|
|
22
22
|
React.useEffect(() => {
|
|
23
23
|
onChange(debouncedValue);
|
|
24
|
-
}, [debouncedValue]);
|
|
24
|
+
}, [debouncedValue, onChange]);
|
|
25
25
|
|
|
26
26
|
return (
|
|
27
27
|
<Input
|
|
28
28
|
leadingIcon={loading ? 'loading' : 'search'}
|
|
29
|
-
|
|
29
|
+
defaultValue={text}
|
|
30
30
|
onChange={(e) => {
|
|
31
31
|
return setText(e.target.value);
|
|
32
32
|
}}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Box, BoxProps } from '@ttoss/ui';
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line react-refresh/only-export-components
|
|
4
|
+
export * from '@tanstack/react-table';
|
|
5
|
+
|
|
6
|
+
export const Table = (props: BoxProps) => {
|
|
7
|
+
return <Box as="table" {...props} />;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const TableHead = (props: BoxProps) => {
|
|
11
|
+
return <Box as="thead" {...props} />;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const TableBody = (props: BoxProps) => {
|
|
15
|
+
return <Box as="tbody" {...props} />;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const TableRow = (props: BoxProps) => {
|
|
19
|
+
return <Box as="tr" {...props} />;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const TableCell = (props: BoxProps) => {
|
|
23
|
+
return <Box as="td" {...props} />;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const TableHeader = (props: BoxProps) => {
|
|
27
|
+
return <Box as="th" {...props} />;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const TableCaption = (props: BoxProps) => {
|
|
31
|
+
return <Box as="caption" {...props} />;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const TableFooter = (props: BoxProps) => {
|
|
35
|
+
return <Box as="tfoot" {...props} />;
|
|
36
|
+
};
|