@pushwoosh/dumb-components 1.1.25 → 1.1.26
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/Alert/Alert.d.ts +3 -0
- package/Alert/Alert.js +45 -0
- package/Alert/index.d.ts +2 -0
- package/Alert/index.js +1 -0
- package/Alert/maps.d.ts +10 -0
- package/Alert/maps.js +19 -0
- package/Alert/styles.d.ts +114 -0
- package/Alert/styles.js +12 -0
- package/Alert/types.d.ts +8 -0
- package/Alert/types.js +1 -0
- package/index.d.ts +1 -0
- package/index.js +2 -1
- package/package.json +1 -1
package/Alert/Alert.d.ts
ADDED
package/Alert/Alert.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { ShapeRadius } from '@pushwoosh/kit-constants';
|
|
3
|
+
import { Horizontal, Vertical } from '@pushwoosh/kit-helpers';
|
|
4
|
+
import { ChevronIcon } from '@pushwoosh/kit-icons';
|
|
5
|
+
import { AlertTypeMap } from './maps';
|
|
6
|
+
import { AccordionHeader, Container } from './styles';
|
|
7
|
+
export const Alert = ({
|
|
8
|
+
isExpandedDefault,
|
|
9
|
+
title,
|
|
10
|
+
type,
|
|
11
|
+
children
|
|
12
|
+
}) => {
|
|
13
|
+
const [isExpanded, setIsExpanded] = useState(isExpandedDefault);
|
|
14
|
+
const canCollapse = !!children;
|
|
15
|
+
const {
|
|
16
|
+
icon: Icon,
|
|
17
|
+
iconColor,
|
|
18
|
+
bgColor
|
|
19
|
+
} = AlertTypeMap[type];
|
|
20
|
+
return React.createElement(Container, {
|
|
21
|
+
"$borderRadius": ShapeRadius.SECTION,
|
|
22
|
+
"$bgColor": bgColor
|
|
23
|
+
}, React.createElement(AccordionHeader, {
|
|
24
|
+
onClick: () => canCollapse && setIsExpanded(!isExpanded),
|
|
25
|
+
"$canCollapse": canCollapse,
|
|
26
|
+
"$justifyContent": "space-between",
|
|
27
|
+
"$alignItems": "center",
|
|
28
|
+
"$gap": 8,
|
|
29
|
+
"$padding": "8px 12px 8px 16px"
|
|
30
|
+
}, React.createElement(Horizontal, {
|
|
31
|
+
"$gap": 8
|
|
32
|
+
}, React.createElement(Icon, {
|
|
33
|
+
size: "small",
|
|
34
|
+
view: "lined",
|
|
35
|
+
color: iconColor
|
|
36
|
+
}), title), canCollapse && React.createElement(Horizontal, {
|
|
37
|
+
"$justifyContent": "center"
|
|
38
|
+
}, React.createElement(ChevronIcon, {
|
|
39
|
+
size: "small",
|
|
40
|
+
direction: isExpanded ? 'up' : 'down',
|
|
41
|
+
color: iconColor
|
|
42
|
+
}))), isExpanded && React.createElement(Vertical, {
|
|
43
|
+
"$padding": "0 16px 16px"
|
|
44
|
+
}, children));
|
|
45
|
+
};
|
package/Alert/index.d.ts
ADDED
package/Alert/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Alert } from './Alert';
|
package/Alert/maps.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Color } from '@pushwoosh/kit-constants';
|
|
2
|
+
import { type DangerTriangleIconProps, type InfoRoundIconProps, type WarningRoundIconProps } from '@pushwoosh/kit-icons';
|
|
3
|
+
import { type AlertType } from './types';
|
|
4
|
+
type AlertData = {
|
|
5
|
+
icon: React.FC<InfoRoundIconProps | WarningRoundIconProps | DangerTriangleIconProps>;
|
|
6
|
+
iconColor: Color;
|
|
7
|
+
bgColor: Color;
|
|
8
|
+
};
|
|
9
|
+
export declare const AlertTypeMap: Record<AlertType, AlertData>;
|
|
10
|
+
export {};
|
package/Alert/maps.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Color } from '@pushwoosh/kit-constants';
|
|
2
|
+
import { DangerTriangleIcon, InfoRoundIcon, WarningRoundIcon } from '@pushwoosh/kit-icons';
|
|
3
|
+
export const AlertTypeMap = {
|
|
4
|
+
info: {
|
|
5
|
+
icon: InfoRoundIcon,
|
|
6
|
+
iconColor: Color.BRIGHT,
|
|
7
|
+
bgColor: Color.BRIGHT_LIGHT
|
|
8
|
+
},
|
|
9
|
+
warning: {
|
|
10
|
+
icon: WarningRoundIcon,
|
|
11
|
+
iconColor: Color.WARNING,
|
|
12
|
+
bgColor: Color.WARNING_LIGHT
|
|
13
|
+
},
|
|
14
|
+
error: {
|
|
15
|
+
icon: DangerTriangleIcon,
|
|
16
|
+
iconColor: Color.DANGER,
|
|
17
|
+
bgColor: Color.DANGER_LIGHT
|
|
18
|
+
}
|
|
19
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
export declare const AccordionHeader: import("styled-components").StyledComponent<"div", any, {
|
|
2
|
+
$alignContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
|
|
3
|
+
$alignItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
|
|
4
|
+
$bgColor?: string | undefined;
|
|
5
|
+
$border?: string | ({
|
|
6
|
+
top?: string | undefined;
|
|
7
|
+
right?: string | undefined;
|
|
8
|
+
bottom?: string | undefined;
|
|
9
|
+
left?: string | undefined;
|
|
10
|
+
} | {
|
|
11
|
+
horizontal: string;
|
|
12
|
+
top?: string | undefined;
|
|
13
|
+
bottom?: string | undefined;
|
|
14
|
+
} | {
|
|
15
|
+
vertical: string;
|
|
16
|
+
right?: string | undefined;
|
|
17
|
+
left?: string | undefined;
|
|
18
|
+
}) | undefined;
|
|
19
|
+
$borderRadius?: (string | number) | undefined;
|
|
20
|
+
$boxShadow?: string | undefined;
|
|
21
|
+
$gap?: (string | number) | undefined;
|
|
22
|
+
$gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense" | undefined;
|
|
23
|
+
$justifyContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
|
|
24
|
+
$justifyItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
|
|
25
|
+
$margin?: (string | number) | ({
|
|
26
|
+
top?: (string | number) | undefined;
|
|
27
|
+
right?: (string | number) | undefined;
|
|
28
|
+
bottom?: (string | number) | undefined;
|
|
29
|
+
left?: (string | number) | undefined;
|
|
30
|
+
} | {
|
|
31
|
+
horizontal: string | number;
|
|
32
|
+
top?: (string | number) | undefined;
|
|
33
|
+
bottom?: (string | number) | undefined;
|
|
34
|
+
} | {
|
|
35
|
+
vertical: string | number;
|
|
36
|
+
right?: (string | number) | undefined;
|
|
37
|
+
left?: (string | number) | undefined;
|
|
38
|
+
}) | undefined;
|
|
39
|
+
$padding?: (string | number) | ({
|
|
40
|
+
top?: (string | number) | undefined;
|
|
41
|
+
right?: (string | number) | undefined;
|
|
42
|
+
bottom?: (string | number) | undefined;
|
|
43
|
+
left?: (string | number) | undefined;
|
|
44
|
+
} | {
|
|
45
|
+
horizontal: string | number;
|
|
46
|
+
top?: (string | number) | undefined;
|
|
47
|
+
bottom?: (string | number) | undefined;
|
|
48
|
+
} | {
|
|
49
|
+
vertical: string | number;
|
|
50
|
+
right?: (string | number) | undefined;
|
|
51
|
+
left?: (string | number) | undefined;
|
|
52
|
+
}) | undefined;
|
|
53
|
+
$placeItems?: "end" | "start" | "center" | "stretch" | undefined;
|
|
54
|
+
} & {
|
|
55
|
+
$gridAutoFlow: string;
|
|
56
|
+
} & {
|
|
57
|
+
$canCollapse?: boolean;
|
|
58
|
+
}, "$gridAutoFlow">;
|
|
59
|
+
export declare const Container: import("styled-components").StyledComponent<"div", any, {
|
|
60
|
+
$alignContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
|
|
61
|
+
$alignItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
|
|
62
|
+
$bgColor?: string | undefined;
|
|
63
|
+
$border?: string | ({
|
|
64
|
+
top?: string | undefined;
|
|
65
|
+
right?: string | undefined;
|
|
66
|
+
bottom?: string | undefined;
|
|
67
|
+
left?: string | undefined;
|
|
68
|
+
} | {
|
|
69
|
+
horizontal: string;
|
|
70
|
+
top?: string | undefined;
|
|
71
|
+
bottom?: string | undefined;
|
|
72
|
+
} | {
|
|
73
|
+
vertical: string;
|
|
74
|
+
right?: string | undefined;
|
|
75
|
+
left?: string | undefined;
|
|
76
|
+
}) | undefined;
|
|
77
|
+
$borderRadius?: (string | number) | undefined;
|
|
78
|
+
$boxShadow?: string | undefined;
|
|
79
|
+
$gap?: (string | number) | undefined;
|
|
80
|
+
$gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense" | undefined;
|
|
81
|
+
$justifyContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
|
|
82
|
+
$justifyItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
|
|
83
|
+
$margin?: (string | number) | ({
|
|
84
|
+
top?: (string | number) | undefined;
|
|
85
|
+
right?: (string | number) | undefined;
|
|
86
|
+
bottom?: (string | number) | undefined;
|
|
87
|
+
left?: (string | number) | undefined;
|
|
88
|
+
} | {
|
|
89
|
+
horizontal: string | number;
|
|
90
|
+
top?: (string | number) | undefined;
|
|
91
|
+
bottom?: (string | number) | undefined;
|
|
92
|
+
} | {
|
|
93
|
+
vertical: string | number;
|
|
94
|
+
right?: (string | number) | undefined;
|
|
95
|
+
left?: (string | number) | undefined;
|
|
96
|
+
}) | undefined;
|
|
97
|
+
$padding?: (string | number) | ({
|
|
98
|
+
top?: (string | number) | undefined;
|
|
99
|
+
right?: (string | number) | undefined;
|
|
100
|
+
bottom?: (string | number) | undefined;
|
|
101
|
+
left?: (string | number) | undefined;
|
|
102
|
+
} | {
|
|
103
|
+
horizontal: string | number;
|
|
104
|
+
top?: (string | number) | undefined;
|
|
105
|
+
bottom?: (string | number) | undefined;
|
|
106
|
+
} | {
|
|
107
|
+
vertical: string | number;
|
|
108
|
+
right?: (string | number) | undefined;
|
|
109
|
+
left?: (string | number) | undefined;
|
|
110
|
+
}) | undefined;
|
|
111
|
+
$placeItems?: "end" | "start" | "center" | "stretch" | undefined;
|
|
112
|
+
} & {
|
|
113
|
+
$gridAutoFlow: string;
|
|
114
|
+
}, "$gridAutoFlow">;
|
package/Alert/styles.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { Horizontal, Vertical } from '@pushwoosh/kit-helpers';
|
|
3
|
+
export const AccordionHeader = styled(Horizontal).withConfig({
|
|
4
|
+
displayName: "AccordionHeader",
|
|
5
|
+
componentId: "sc-fpiqkp-0"
|
|
6
|
+
})(["cursor:", ";"], ({
|
|
7
|
+
$canCollapse
|
|
8
|
+
}) => $canCollapse ? 'pointer' : 'initial');
|
|
9
|
+
export const Container = styled(Vertical).withConfig({
|
|
10
|
+
displayName: "Container",
|
|
11
|
+
componentId: "sc-fpiqkp-1"
|
|
12
|
+
})(["width:100%;min-width:200px;"]);
|
package/Alert/types.d.ts
ADDED
package/Alert/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/index.d.ts
CHANGED
|
@@ -37,3 +37,4 @@ export { CodeEditor } from './CodeEditor';
|
|
|
37
37
|
export { EnhancedInput, SearchInput } from './EnhancedInput';
|
|
38
38
|
export { Chip } from './Chip';
|
|
39
39
|
export { RichMessageEditor, RichMessageViewer, type DynamicContent } from './RichMessageEditor';
|
|
40
|
+
export { Alert } from './Alert';
|
package/index.js
CHANGED
|
@@ -36,4 +36,5 @@ export { NumberPicker } from './NumberPicker';
|
|
|
36
36
|
export { CodeEditor } from './CodeEditor';
|
|
37
37
|
export { EnhancedInput, SearchInput } from './EnhancedInput';
|
|
38
38
|
export { Chip } from './Chip';
|
|
39
|
-
export { RichMessageEditor, RichMessageViewer } from './RichMessageEditor';
|
|
39
|
+
export { RichMessageEditor, RichMessageViewer } from './RichMessageEditor';
|
|
40
|
+
export { Alert } from './Alert';
|