@tecsinapse/react-web-kit 1.7.5 → 1.8.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/CHANGELOG.md +41 -0
- package/dist/components/atoms/Accordion/Accordion.d.ts +1 -1
- package/dist/components/atoms/Accordion/Accordion.js +3 -2
- package/dist/components/atoms/Accordion/Accordion.js.map +1 -1
- package/dist/components/atoms/Modal/Modal.d.ts +2 -3
- package/dist/components/atoms/Modal/Modal.js +6 -3
- package/dist/components/atoms/Modal/Modal.js.map +1 -1
- package/dist/components/atoms/Skeleton/Skeleton.d.ts +1 -1
- package/dist/components/atoms/Skeleton/Skeleton.js +6 -3
- package/dist/components/atoms/Skeleton/Skeleton.js.map +1 -1
- package/dist/components/molecules/Breadcrumbs/Breadcrumbs.d.ts +2 -2
- package/dist/components/molecules/Breadcrumbs/Breadcrumbs.js +3 -2
- package/dist/components/molecules/Breadcrumbs/Breadcrumbs.js.map +1 -1
- package/dist/components/molecules/Drawer/Drawer.d.ts +4 -3
- package/dist/components/molecules/Drawer/Drawer.js +10 -4
- package/dist/components/molecules/Drawer/Drawer.js.map +1 -1
- package/dist/components/molecules/Drawer/animations.d.ts +3 -12
- package/dist/components/molecules/Drawer/animations.js +1 -1
- package/dist/components/molecules/Drawer/animations.js.map +1 -1
- package/dist/components/molecules/Menubar/Menubar.d.ts +1 -1
- package/dist/components/molecules/Menubar/Menubar.js +7 -3
- package/dist/components/molecules/Menubar/Menubar.js.map +1 -1
- package/dist/components/molecules/Select/Dropdown/Dropdown.d.ts +1 -3
- package/dist/components/molecules/Select/Dropdown/Dropdown.js +6 -4
- package/dist/components/molecules/Select/Dropdown/Dropdown.js.map +1 -1
- package/dist/components/molecules/Select/Dropdown/styled.d.ts +1 -1
- package/dist/components/molecules/Select/Dropdown/styled.js +26 -10
- package/dist/components/molecules/Select/Dropdown/styled.js.map +1 -1
- package/dist/components/molecules/Select/Select.d.ts +7 -2
- package/dist/components/molecules/Select/Select.js +15 -8
- package/dist/components/molecules/Select/Select.js.map +1 -1
- package/dist/components/molecules/Select/SelectItem/SelectItem.js +1 -1
- package/dist/components/molecules/Select/SelectItem/SelectItem.js.map +1 -1
- package/dist/components/molecules/Select/animations.d.ts +42 -18
- package/dist/components/molecules/Select/animations.js +42 -18
- package/dist/components/molecules/Select/animations.js.map +1 -1
- package/dist/components/organisms/DataGrid/DataGrid.d.ts +3 -4
- package/dist/components/organisms/DataGrid/DataGrid.js +3 -5
- package/dist/components/organisms/DataGrid/DataGrid.js.map +1 -1
- package/package.json +4 -3
- package/src/components/atoms/Accordion/Accordion.tsx +3 -2
- package/src/components/atoms/Modal/Modal.tsx +10 -4
- package/src/components/atoms/Skeleton/Skeleton.tsx +3 -1
- package/src/components/molecules/Breadcrumbs/Breadcrumbs.tsx +3 -3
- package/src/components/molecules/Drawer/Drawer.tsx +13 -5
- package/src/components/molecules/Drawer/animations.ts +9 -3
- package/src/components/molecules/Menubar/Menubar.tsx +5 -7
- package/src/components/molecules/Select/Dropdown/Dropdown.tsx +10 -6
- package/src/components/molecules/Select/Dropdown/styled.ts +32 -13
- package/src/components/molecules/Select/Select.tsx +22 -6
- package/src/components/molecules/Select/SelectItem/SelectItem.tsx +1 -1
- package/src/components/molecules/Select/animations.ts +31 -7
- package/src/components/organisms/DataGrid/DataGrid.tsx +5 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
2
|
import { StyledContainerDrawer } from './styled';
|
|
3
|
-
import { Transition } from 'react-transition-group';
|
|
3
|
+
import { Transition, TransitionStatus } from 'react-transition-group';
|
|
4
4
|
import { Overlay } from '../../atoms/Overlay';
|
|
5
5
|
import {
|
|
6
6
|
transitionStylesTopBottom,
|
|
@@ -9,10 +9,12 @@ import {
|
|
|
9
9
|
transitionStylesLeftRight,
|
|
10
10
|
} from './animations';
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
type AnchorPosition = 'left' | 'right' | 'top' | 'bottom';
|
|
13
|
+
|
|
14
|
+
export interface DrawerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
13
15
|
open: boolean;
|
|
14
16
|
onClose: () => void;
|
|
15
|
-
anchorPosition:
|
|
17
|
+
anchorPosition: AnchorPosition;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
const Drawer: FC<DrawerProps> = ({
|
|
@@ -20,8 +22,13 @@ const Drawer: FC<DrawerProps> = ({
|
|
|
20
22
|
anchorPosition = 'right',
|
|
21
23
|
onClose,
|
|
22
24
|
children,
|
|
25
|
+
style,
|
|
26
|
+
...rest
|
|
23
27
|
}) => {
|
|
24
|
-
const getStyles = (
|
|
28
|
+
const getStyles = (
|
|
29
|
+
anchorPosition: AnchorPosition,
|
|
30
|
+
state: TransitionStatus
|
|
31
|
+
) => {
|
|
25
32
|
const stylesLeftRight = defaultStylesLeftRight(anchorPosition);
|
|
26
33
|
const transitionLeftRight = transitionStylesLeftRight(anchorPosition);
|
|
27
34
|
const stylesTopBottom = defaultStylesTopBottom(anchorPosition);
|
|
@@ -46,10 +53,11 @@ const Drawer: FC<DrawerProps> = ({
|
|
|
46
53
|
<Transition in={open} timeout={300}>
|
|
47
54
|
{state => (
|
|
48
55
|
<StyledContainerDrawer
|
|
49
|
-
style={getStyles(anchorPosition, state)}
|
|
56
|
+
style={{ ...style, ...getStyles(anchorPosition, state) }}
|
|
50
57
|
anchorPosition={anchorPosition}
|
|
51
58
|
onClose={onClose}
|
|
52
59
|
open={open}
|
|
60
|
+
{...rest}
|
|
53
61
|
>
|
|
54
62
|
{children}
|
|
55
63
|
</StyledContainerDrawer>
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
|
|
1
3
|
export const transformLeftRigthClose = (anchorPosition: string) =>
|
|
2
4
|
anchorPosition === 'right' ? 'translateX(100%)' : 'translateX(-100%)';
|
|
3
5
|
|
|
@@ -8,10 +10,12 @@ export const transformTopBottomClose = (anchorPosition: string) =>
|
|
|
8
10
|
|
|
9
11
|
export const transformTopBottomOpen = 'translateY(0%)';
|
|
10
12
|
|
|
11
|
-
export const defaultStylesLeftRight = (
|
|
13
|
+
export const defaultStylesLeftRight = (
|
|
14
|
+
anchorPosition: string
|
|
15
|
+
): CSSProperties => {
|
|
12
16
|
return {
|
|
13
17
|
transition: 'transform 300ms ease-in-out',
|
|
14
|
-
transform:
|
|
18
|
+
transform: transformLeftRigthClose(anchorPosition),
|
|
15
19
|
overflowX: 'hidden',
|
|
16
20
|
overflowY: 'auto',
|
|
17
21
|
};
|
|
@@ -30,7 +34,9 @@ export const transitionStylesLeftRight = (anchorPosition: string) => {
|
|
|
30
34
|
};
|
|
31
35
|
};
|
|
32
36
|
|
|
33
|
-
export const defaultStylesTopBottom = (
|
|
37
|
+
export const defaultStylesTopBottom = (
|
|
38
|
+
anchorPosition: string
|
|
39
|
+
): CSSProperties => {
|
|
34
40
|
return {
|
|
35
41
|
transition: 'transform 300ms ease-in-out',
|
|
36
42
|
transform: transformTopBottomClose(anchorPosition),
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
} from './animations';
|
|
23
23
|
import { useClickAwayListener } from '../../../hooks';
|
|
24
24
|
|
|
25
|
-
export interface MenubarProps {
|
|
25
|
+
export interface MenubarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
26
26
|
options: OptionsType[];
|
|
27
27
|
leftComponents?: React.ReactNode;
|
|
28
28
|
rightComponents?: React.ReactNode;
|
|
@@ -43,6 +43,7 @@ const Menubar: React.FC<MenubarProps> = ({
|
|
|
43
43
|
mostUsedLabel = 'Mais acessados',
|
|
44
44
|
searchResultsLabel = 'Resultados da busca',
|
|
45
45
|
searchable = true,
|
|
46
|
+
...rest
|
|
46
47
|
}) => {
|
|
47
48
|
const [search, setSearch] = React.useState<string>('');
|
|
48
49
|
const [results, setResults] = React.useState<MostUsedType[]>([]);
|
|
@@ -61,7 +62,7 @@ const Menubar: React.FC<MenubarProps> = ({
|
|
|
61
62
|
}, [search]);
|
|
62
63
|
|
|
63
64
|
return (
|
|
64
|
-
|
|
65
|
+
<div ref={ref => (menuRef.current = ref)} {...rest}>
|
|
65
66
|
<StyledMenuBar>
|
|
66
67
|
<StyledMenuButton variant="filled" color="primary" onPress={toggleOpen}>
|
|
67
68
|
{!open ? (
|
|
@@ -103,10 +104,7 @@ const Menubar: React.FC<MenubarProps> = ({
|
|
|
103
104
|
</StyledMenuBar>
|
|
104
105
|
<Transition in={open} timeout={250}>
|
|
105
106
|
{state => (
|
|
106
|
-
<StyledContainerOpenMenu
|
|
107
|
-
ref={ref => (menuRef.current = ref)}
|
|
108
|
-
style={getContainerOpenMenuStyles(state)}
|
|
109
|
-
>
|
|
107
|
+
<StyledContainerOpenMenu style={getContainerOpenMenuStyles(state)}>
|
|
110
108
|
{!search ? (
|
|
111
109
|
<>
|
|
112
110
|
{mostUsed && (
|
|
@@ -136,7 +134,7 @@ const Menubar: React.FC<MenubarProps> = ({
|
|
|
136
134
|
</StyledContainerOpenMenu>
|
|
137
135
|
)}
|
|
138
136
|
</Transition>
|
|
139
|
-
|
|
137
|
+
</div>
|
|
140
138
|
);
|
|
141
139
|
};
|
|
142
140
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Checkbox,
|
|
4
4
|
Text,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
StyledContainerDropdown,
|
|
15
15
|
StyledContainerTextLabel,
|
|
16
16
|
StyledSpan,
|
|
17
|
-
|
|
17
|
+
OptionsContainer,
|
|
18
18
|
} from './styled';
|
|
19
19
|
|
|
20
20
|
const Dropdown = <Data, Type extends 'single' | 'multi'>({
|
|
@@ -28,9 +28,9 @@ const Dropdown = <Data, Type extends 'single' | 'multi'>({
|
|
|
28
28
|
labelExtractor,
|
|
29
29
|
setDropDownVisible,
|
|
30
30
|
style,
|
|
31
|
+
anchor,
|
|
31
32
|
}: SelectProps<Data, Type> & {
|
|
32
33
|
setDropDownVisible: (t: boolean) => void;
|
|
33
|
-
style: CSSProperties;
|
|
34
34
|
}): JSX.Element => {
|
|
35
35
|
const [searchArg, setSearchArg] = useDebouncedState<string>('', onSearch);
|
|
36
36
|
const lengthOptions = options.length;
|
|
@@ -49,7 +49,11 @@ const Dropdown = <Data, Type extends 'single' | 'multi'>({
|
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
return (
|
|
52
|
-
<StyledContainerDropdown
|
|
52
|
+
<StyledContainerDropdown
|
|
53
|
+
lengthOptions={lengthOptions}
|
|
54
|
+
style={style}
|
|
55
|
+
anchor={anchor}
|
|
56
|
+
>
|
|
53
57
|
{type === 'multi' && (
|
|
54
58
|
<StyledContainerCheckAll
|
|
55
59
|
onClick={hideSearchBar ? onClickCheckAll : undefined}
|
|
@@ -81,7 +85,7 @@ const Dropdown = <Data, Type extends 'single' | 'multi'>({
|
|
|
81
85
|
)}
|
|
82
86
|
</StyledContainerCheckAll>
|
|
83
87
|
)}
|
|
84
|
-
<
|
|
88
|
+
<OptionsContainer lengthOptions={options.length}>
|
|
85
89
|
{options.map((item, index) => (
|
|
86
90
|
<ItemSelect
|
|
87
91
|
type={type}
|
|
@@ -98,7 +102,7 @@ const Dropdown = <Data, Type extends 'single' | 'multi'>({
|
|
|
98
102
|
lenghtOptions={options.length}
|
|
99
103
|
/>
|
|
100
104
|
))}
|
|
101
|
-
</
|
|
105
|
+
</OptionsContainer>
|
|
102
106
|
</StyledContainerDropdown>
|
|
103
107
|
);
|
|
104
108
|
};
|
|
@@ -1,18 +1,39 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
2
|
import { hex2rgba, StyleProps } from '@tecsinapse/react-core';
|
|
3
3
|
import { SelectProps } from '../Select';
|
|
4
|
+
import { css } from '@emotion/react';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
type InjectedProps = Partial<
|
|
7
|
+
StyleProps & SelectProps<any, any> & { lengthOptions: number }
|
|
8
|
+
>;
|
|
9
|
+
|
|
10
|
+
const anchorBottom = ({
|
|
11
|
+
theme,
|
|
12
|
+
anchor,
|
|
13
|
+
}: StyleProps & Omit<InjectedProps, 'theme'>) =>
|
|
14
|
+
anchor === 'bottom' &&
|
|
15
|
+
css`
|
|
16
|
+
margin-top: ${theme.spacing.centi};
|
|
17
|
+
top: 100%;
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
const anchorTop = ({
|
|
21
|
+
theme,
|
|
22
|
+
anchor,
|
|
23
|
+
}: StyleProps & Omit<InjectedProps, 'theme'>) =>
|
|
24
|
+
anchor === 'top' &&
|
|
25
|
+
css`
|
|
26
|
+
margin-bottom: ${theme.spacing.centi};
|
|
27
|
+
bottom: 100%;
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
export const StyledContainerDropdown = styled('div')<InjectedProps>`
|
|
8
31
|
width: 100%;
|
|
9
32
|
background-color: ${({ theme }: StyleProps) =>
|
|
10
33
|
theme.miscellaneous.surfaceColor};
|
|
11
34
|
border-radius: ${({ theme }: StyleProps) => theme.borderRadius.mili};
|
|
12
|
-
box-shadow:
|
|
35
|
+
box-shadow: 0 2px 8px
|
|
13
36
|
${({ theme }: StyleProps) => hex2rgba(theme.miscellaneous.shadow, 0.08)};
|
|
14
|
-
margin-top: ${({ theme }: StyleProps) => theme.spacing.centi};
|
|
15
|
-
top: 100%;
|
|
16
37
|
position: absolute;
|
|
17
38
|
padding-top: ${({
|
|
18
39
|
theme,
|
|
@@ -21,17 +42,15 @@ export const StyledContainerDropdown = styled('div')<
|
|
|
21
42
|
!hideSearchBar ? `${theme.spacing.deca}` : '0px'};
|
|
22
43
|
padding-bottom: ${({ theme }: StyleProps) => theme.spacing.mili};
|
|
23
44
|
z-index: ${({ theme }: StyleProps) => theme.zIndex.select};
|
|
45
|
+
${anchorTop}
|
|
46
|
+
${anchorBottom}
|
|
24
47
|
`;
|
|
25
48
|
|
|
26
|
-
export const
|
|
27
|
-
Partial<StyleProps & SelectProps<any, any> & { lenghtOptions: number }>
|
|
28
|
-
>`
|
|
49
|
+
export const OptionsContainer = styled('div')<InjectedProps>`
|
|
29
50
|
max-height: 250px;
|
|
30
51
|
top: 100%;
|
|
31
|
-
overflow-y: ${({
|
|
32
|
-
|
|
33
|
-
}: Partial<{ lenghtOptions: number } & StyleProps>) =>
|
|
34
|
-
lenghtOptions > 5 ? 'scroll' : 'hidden'};
|
|
52
|
+
overflow-y: ${({ lengthOptions = 0 }: InjectedProps) =>
|
|
53
|
+
lengthOptions > 5 ? 'scroll' : 'hidden'};
|
|
35
54
|
::-webkit-scrollbar {
|
|
36
55
|
width: 8px;
|
|
37
56
|
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Icon,
|
|
4
|
+
PressableInputContainer,
|
|
5
|
+
Text,
|
|
6
|
+
TextProps,
|
|
7
|
+
} from '@tecsinapse/react-core';
|
|
3
8
|
import { useClickAwayListener } from '../../../hooks';
|
|
4
9
|
import { StyledContainer, StyledInputContainer } from './styled';
|
|
5
10
|
import { Dropdown } from './Dropdown';
|
|
@@ -7,7 +12,8 @@ import { getDisplayValue } from './functions';
|
|
|
7
12
|
import { Transition } from 'react-transition-group';
|
|
8
13
|
import { defaultStyles, transition } from './animations';
|
|
9
14
|
|
|
10
|
-
export interface SelectProps<Data, Type extends 'single' | 'multi'>
|
|
15
|
+
export interface SelectProps<Data, Type extends 'single' | 'multi'>
|
|
16
|
+
extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> {
|
|
11
17
|
options: Data[];
|
|
12
18
|
onSelect: (
|
|
13
19
|
option: Type extends 'single' ? Data | undefined : Data[]
|
|
@@ -20,7 +26,10 @@ export interface SelectProps<Data, Type extends 'single' | 'multi'> {
|
|
|
20
26
|
onSearch?: (searchArg: string) => void | never;
|
|
21
27
|
searchBarPlaceholder?: string;
|
|
22
28
|
hideSearchBar?: boolean;
|
|
29
|
+
disabled?: boolean;
|
|
23
30
|
label?: string;
|
|
31
|
+
anchor?: 'top' | 'bottom';
|
|
32
|
+
displayTextProps?: TextProps;
|
|
24
33
|
}
|
|
25
34
|
|
|
26
35
|
export const Select = <Data, Type extends 'single' | 'multi'>({
|
|
@@ -32,8 +41,12 @@ export const Select = <Data, Type extends 'single' | 'multi'>({
|
|
|
32
41
|
labelExtractor,
|
|
33
42
|
placeholder,
|
|
34
43
|
onSearch,
|
|
44
|
+
searchBarPlaceholder,
|
|
35
45
|
hideSearchBar = true,
|
|
36
46
|
label,
|
|
47
|
+
disabled = false,
|
|
48
|
+
anchor = 'bottom',
|
|
49
|
+
displayTextProps,
|
|
37
50
|
...rest
|
|
38
51
|
}: SelectProps<Data, Type>): JSX.Element => {
|
|
39
52
|
const [dropDownVisible, setDropDownVisible] = React.useState<boolean>(false);
|
|
@@ -50,12 +63,12 @@ export const Select = <Data, Type extends 'single' | 'multi'>({
|
|
|
50
63
|
);
|
|
51
64
|
|
|
52
65
|
return (
|
|
53
|
-
<StyledContainer ref={refDropDown}>
|
|
66
|
+
<StyledContainer ref={refDropDown} {...rest}>
|
|
54
67
|
<StyledInputContainer>
|
|
55
68
|
<PressableInputContainer
|
|
56
69
|
label={label}
|
|
57
|
-
{...rest}
|
|
58
70
|
onPress={() => setDropDownVisible(!dropDownVisible)}
|
|
71
|
+
disabled={disabled}
|
|
59
72
|
rightComponent={
|
|
60
73
|
<Icon
|
|
61
74
|
name="chevron-down"
|
|
@@ -65,7 +78,7 @@ export const Select = <Data, Type extends 'single' | 'multi'>({
|
|
|
65
78
|
/>
|
|
66
79
|
}
|
|
67
80
|
>
|
|
68
|
-
<Text ellipsizeMode="tail" numberOfLines={1}>
|
|
81
|
+
<Text {...displayTextProps} ellipsizeMode="tail" numberOfLines={1}>
|
|
69
82
|
{displayValue}
|
|
70
83
|
</Text>
|
|
71
84
|
</PressableInputContainer>
|
|
@@ -80,8 +93,11 @@ export const Select = <Data, Type extends 'single' | 'multi'>({
|
|
|
80
93
|
keyExtractor={keyExtractor}
|
|
81
94
|
labelExtractor={labelExtractor}
|
|
82
95
|
hideSearchBar={hideSearchBar}
|
|
83
|
-
|
|
96
|
+
searchBarPlaceholder={searchBarPlaceholder}
|
|
97
|
+
onSearch={onSearch}
|
|
98
|
+
style={{ ...defaultStyles, ...transition[anchor][state] }}
|
|
84
99
|
setDropDownVisible={setDropDownVisible}
|
|
100
|
+
anchor={anchor}
|
|
85
101
|
/>
|
|
86
102
|
)}
|
|
87
103
|
</Transition>
|
|
@@ -57,7 +57,7 @@ const SelectItem = <Data, Type extends 'single' | 'multi'>({
|
|
|
57
57
|
onSelect([...value, key] as OnSelectArg);
|
|
58
58
|
[...value, key].length === lenghtOptions && setCheckedAll(true);
|
|
59
59
|
} else {
|
|
60
|
-
const auxArray: Data[] = value;
|
|
60
|
+
const auxArray: Data[] = [...value];
|
|
61
61
|
const indexToExclude = auxArray.indexOf(key);
|
|
62
62
|
auxArray.splice(indexToExclude, 1);
|
|
63
63
|
onSelect([...auxArray] as OnSelectArg);
|
|
@@ -7,12 +7,36 @@ export const defaultStyles = {
|
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
export const transition = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
bottom: {
|
|
11
|
+
entering: {
|
|
12
|
+
transform: 'translateY(-10%)',
|
|
13
|
+
opacity: 0,
|
|
14
|
+
visibility: 'hidden',
|
|
15
|
+
},
|
|
16
|
+
entered: {
|
|
17
|
+
transform: 'translateY(0%)',
|
|
18
|
+
opacity: 1,
|
|
19
|
+
visibility: 'visible',
|
|
20
|
+
},
|
|
21
|
+
exiting: {
|
|
22
|
+
transform: 'translateY(0%)',
|
|
23
|
+
opacity: 1,
|
|
24
|
+
visibility: 'visible',
|
|
25
|
+
},
|
|
26
|
+
exited: {
|
|
27
|
+
transform: 'translateY(-10%)',
|
|
28
|
+
opacity: 0,
|
|
29
|
+
visibility: 'hidden',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
top: {
|
|
33
|
+
entering: {
|
|
34
|
+
transform: 'translateY(10%)',
|
|
35
|
+
opacity: 0,
|
|
36
|
+
visibility: 'hidden',
|
|
37
|
+
},
|
|
38
|
+
entered: { transform: 'translateY(0%)', opacity: 1, visibility: 'visible' },
|
|
39
|
+
exiting: { transform: 'translateY(0%)', opacity: 1, visibility: 'visible' },
|
|
40
|
+
exited: { transform: 'translateY(10%)', opacity: 0, visibility: 'hidden' },
|
|
14
41
|
},
|
|
15
|
-
entered: { transform: 'translateY(0%)', opacity: 1, visibility: 'visible' },
|
|
16
|
-
exiting: { transform: 'translateY(0%)', opacity: 1, visibility: 'visible' },
|
|
17
|
-
exited: { transform: 'translateY(-10%)', opacity: 0, visibility: 'hidden' },
|
|
18
42
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Table,
|
|
4
4
|
TableToolbar,
|
|
@@ -14,7 +14,8 @@ import { Footer } from './Footer';
|
|
|
14
14
|
import { Skeleton } from '../../atoms/Skeleton';
|
|
15
15
|
import { getData, removeElement } from './utils';
|
|
16
16
|
|
|
17
|
-
export interface DataGridProps<Data>
|
|
17
|
+
export interface DataGridProps<Data>
|
|
18
|
+
extends React.HTMLAttributes<HTMLDivElement> {
|
|
18
19
|
headers: HeadersType<Data>[];
|
|
19
20
|
data: Data[];
|
|
20
21
|
/** Unique identifier for row data */
|
|
@@ -49,8 +50,6 @@ export interface DataGridProps<Data> {
|
|
|
49
50
|
loading?: boolean;
|
|
50
51
|
/** Custom skeleton component for better visual */
|
|
51
52
|
skeletonComponent?: React.ReactNode;
|
|
52
|
-
/** CSS style spread to TableContainer */
|
|
53
|
-
style?: CSSProperties;
|
|
54
53
|
/** Empty state placeholder */
|
|
55
54
|
emptyPlaceholder?: React.ReactNode;
|
|
56
55
|
}
|
|
@@ -78,8 +77,8 @@ const DataGrid = <Data extends unknown>({
|
|
|
78
77
|
onPageChange,
|
|
79
78
|
loading = false,
|
|
80
79
|
skeletonComponent,
|
|
81
|
-
style,
|
|
82
80
|
emptyPlaceholder,
|
|
81
|
+
...rest
|
|
83
82
|
}: DataGridProps<Data>): JSX.Element => {
|
|
84
83
|
if (selectable && (!selectedRows || !onSelectedRows)) {
|
|
85
84
|
throw new Error(
|
|
@@ -117,7 +116,7 @@ const DataGrid = <Data extends unknown>({
|
|
|
117
116
|
);
|
|
118
117
|
|
|
119
118
|
return (
|
|
120
|
-
<TableContainer
|
|
119
|
+
<TableContainer {...rest}>
|
|
121
120
|
<TableToolbar
|
|
122
121
|
title={toolbarTitle}
|
|
123
122
|
rightIcons={toolbarRightIcons}
|