@true-engineering/true-react-common-ui-kit 3.30.0 → 3.32.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 +13 -0
- package/dist/components/FlexibleTable/types.d.ts +17 -16
- package/dist/components/Notification/Notification.d.ts +2 -0
- package/dist/components/Notification/Notification.styles.d.ts +1 -1
- package/dist/components/Notification/types.d.ts +1 -1
- package/dist/true-react-common-ui-kit.js +7 -4
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +7 -4
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/package.json +98 -98
- package/src/components/FlexibleTable/types.ts +70 -64
- package/src/components/Icon/icons-list.ts +856 -856
- package/src/components/Notification/Notification.stories.tsx +10 -1
- package/src/components/Notification/Notification.styles.ts +57 -55
- package/src/components/Notification/Notification.tsx +12 -4
- package/src/components/Notification/types.ts +1 -1
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { Meta, Story } from '@storybook/react';
|
|
2
|
+
import { iconsList, IIconType } from '../Icon';
|
|
3
|
+
import { complexIcons } from '../Icon/complexIcons';
|
|
2
4
|
import { INotificationProps, Notification } from './Notification';
|
|
3
5
|
|
|
6
|
+
const iconTypes = [
|
|
7
|
+
undefined,
|
|
8
|
+
...Object.keys(iconsList),
|
|
9
|
+
...Object.keys(complexIcons),
|
|
10
|
+
] as IIconType[];
|
|
11
|
+
|
|
4
12
|
const lorem = 'Lorem ipsum dolor, sit amet consectetur adipisicing';
|
|
5
13
|
|
|
6
14
|
interface IStory extends INotificationProps {
|
|
@@ -20,9 +28,10 @@ export default {
|
|
|
20
28
|
},
|
|
21
29
|
argTypes: {
|
|
22
30
|
size: { control: 'inline-radio', options: ['s', 'm', 'l'] },
|
|
31
|
+
icon: { options: iconTypes, control: 'select' },
|
|
23
32
|
type: {
|
|
24
33
|
control: 'inline-radio',
|
|
25
|
-
options: ['error', 'info', 'warning', 'ok', 'not-ok'],
|
|
34
|
+
options: ['error', 'info', 'warning', 'ok', 'not-ok', 'custom'],
|
|
26
35
|
},
|
|
27
36
|
},
|
|
28
37
|
} as Meta<IStory>;
|
|
@@ -1,55 +1,57 @@
|
|
|
1
|
-
import { ITweakStyles, createThemedStyles } from '../../theme';
|
|
2
|
-
|
|
3
|
-
export const useStyles = createThemedStyles('Notification', {
|
|
4
|
-
root: {
|
|
5
|
-
display: 'flex',
|
|
6
|
-
},
|
|
7
|
-
|
|
8
|
-
inline: {
|
|
9
|
-
width: 'fit-content',
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
icon: {
|
|
13
|
-
width: 20,
|
|
14
|
-
height: 20,
|
|
15
|
-
marginRight: 16,
|
|
16
|
-
flexShrink: 0,
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
body: {
|
|
20
|
-
flexGrow: 1,
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
title: {
|
|
24
|
-
display: 'block',
|
|
25
|
-
fontWeight: 'bold',
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
text: {
|
|
29
|
-
display: 'block',
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
content: {},
|
|
33
|
-
|
|
34
|
-
s: {},
|
|
35
|
-
|
|
36
|
-
m: {},
|
|
37
|
-
|
|
38
|
-
l: {},
|
|
39
|
-
|
|
40
|
-
withText: {},
|
|
41
|
-
|
|
42
|
-
withTitle: {},
|
|
43
|
-
|
|
44
|
-
error: {},
|
|
45
|
-
|
|
46
|
-
info: {},
|
|
47
|
-
|
|
48
|
-
warning: {},
|
|
49
|
-
|
|
50
|
-
ok: {},
|
|
51
|
-
|
|
52
|
-
'not-ok': {},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
1
|
+
import { ITweakStyles, createThemedStyles } from '../../theme';
|
|
2
|
+
|
|
3
|
+
export const useStyles = createThemedStyles('Notification', {
|
|
4
|
+
root: {
|
|
5
|
+
display: 'flex',
|
|
6
|
+
},
|
|
7
|
+
|
|
8
|
+
inline: {
|
|
9
|
+
width: 'fit-content',
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
icon: {
|
|
13
|
+
width: 20,
|
|
14
|
+
height: 20,
|
|
15
|
+
marginRight: 16,
|
|
16
|
+
flexShrink: 0,
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
body: {
|
|
20
|
+
flexGrow: 1,
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
title: {
|
|
24
|
+
display: 'block',
|
|
25
|
+
fontWeight: 'bold',
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
text: {
|
|
29
|
+
display: 'block',
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
content: {},
|
|
33
|
+
|
|
34
|
+
s: {},
|
|
35
|
+
|
|
36
|
+
m: {},
|
|
37
|
+
|
|
38
|
+
l: {},
|
|
39
|
+
|
|
40
|
+
withText: {},
|
|
41
|
+
|
|
42
|
+
withTitle: {},
|
|
43
|
+
|
|
44
|
+
error: {},
|
|
45
|
+
|
|
46
|
+
info: {},
|
|
47
|
+
|
|
48
|
+
warning: {},
|
|
49
|
+
|
|
50
|
+
ok: {},
|
|
51
|
+
|
|
52
|
+
'not-ok': {},
|
|
53
|
+
|
|
54
|
+
custom: {},
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export type INotificationStyles = ITweakStyles<typeof useStyles>;
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from '@true-engineering/true-react-platform-helpers';
|
|
8
8
|
import { addDataAttributes } from '../../helpers';
|
|
9
9
|
import { ICommonProps } from '../../types';
|
|
10
|
-
import { Icon } from '../Icon';
|
|
10
|
+
import { Icon, IIcon, renderIcon } from '../Icon';
|
|
11
11
|
import { INotificationType } from './types';
|
|
12
12
|
import { useStyles, INotificationStyles } from './Notification.styles';
|
|
13
13
|
|
|
@@ -19,6 +19,7 @@ export interface INotificationProps extends ICommonProps<INotificationStyles> {
|
|
|
19
19
|
title?: string;
|
|
20
20
|
/** @default 's' */
|
|
21
21
|
size?: 's' | 'm' | 'l';
|
|
22
|
+
icon?: IIcon;
|
|
22
23
|
children?: ReactNode;
|
|
23
24
|
}
|
|
24
25
|
|
|
@@ -31,12 +32,15 @@ export const Notification: FC<INotificationProps> = ({
|
|
|
31
32
|
testId,
|
|
32
33
|
size = 's',
|
|
33
34
|
data,
|
|
35
|
+
icon,
|
|
34
36
|
tweakStyles,
|
|
35
37
|
}) => {
|
|
36
38
|
const classes = useStyles({ theme: tweakStyles });
|
|
37
39
|
|
|
38
40
|
const hasText = isStringNotEmpty(text);
|
|
39
41
|
const hasTitle = isStringNotEmpty(title);
|
|
42
|
+
const isDefaultType = type !== 'custom';
|
|
43
|
+
const hasIcon = isReactNodeNotEmpty(icon) || isDefaultType;
|
|
40
44
|
|
|
41
45
|
return (
|
|
42
46
|
<div
|
|
@@ -48,9 +52,13 @@ export const Notification: FC<INotificationProps> = ({
|
|
|
48
52
|
{...addDataTestId(testId)}
|
|
49
53
|
{...addDataAttributes(data)}
|
|
50
54
|
>
|
|
51
|
-
|
|
52
|
-
<
|
|
53
|
-
|
|
55
|
+
{hasIcon && (
|
|
56
|
+
<div className={classes.icon}>
|
|
57
|
+
{isReactNodeNotEmpty(icon)
|
|
58
|
+
? renderIcon(icon)
|
|
59
|
+
: isDefaultType && <Icon type={`status-${type}`} />}
|
|
60
|
+
</div>
|
|
61
|
+
)}
|
|
54
62
|
<div className={classes.body}>
|
|
55
63
|
{hasTitle && (
|
|
56
64
|
<span className={classes.title} {...addDataTestId(testId, 'title')}>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type INotificationType = 'error' | 'info' | 'warning' | 'ok' | 'not-ok';
|
|
1
|
+
export type INotificationType = 'error' | 'info' | 'warning' | 'ok' | 'not-ok' | 'custom';
|