@pushwoosh/dumb-components 1.1.25 → 1.1.27
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/Drawer/components/Drawer/Drawer.d.ts +1 -1
- package/Drawer/components/Drawer/Drawer.js +3 -1
- package/Drawer/components/Drawer/styles.d.ts +4 -2
- package/Drawer/components/Drawer/styles.js +22 -2
- package/Drawer/components/Drawer/types.d.ts +7 -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 {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
2
|
import type { DrawerProps } from './types';
|
|
3
|
-
export declare function Drawer({ size, isOpen, zIndex, onClose, children, withoutLockScreen, closeOnClickOutside, }: DrawerProps): ReactElement;
|
|
3
|
+
export declare function Drawer({ size, isOpen, zIndex, onClose, children, padding, withoutLockScreen, closeOnClickOutside, }: DrawerProps): ReactElement;
|
|
@@ -11,6 +11,7 @@ export function Drawer({
|
|
|
11
11
|
zIndex = 10000,
|
|
12
12
|
onClose,
|
|
13
13
|
children,
|
|
14
|
+
padding,
|
|
14
15
|
withoutLockScreen = false,
|
|
15
16
|
closeOnClickOutside = true
|
|
16
17
|
}) {
|
|
@@ -53,7 +54,8 @@ export function Drawer({
|
|
|
53
54
|
ref: ref,
|
|
54
55
|
"$zIndex": zIndex
|
|
55
56
|
}, React.createElement(LockBody, null), React.createElement(DrawerInner, {
|
|
56
|
-
onMouseDown: handleClickOutside
|
|
57
|
+
onMouseDown: handleClickOutside,
|
|
58
|
+
"$padding": padding
|
|
57
59
|
}, React.createElement(DrawerContainer, {
|
|
58
60
|
"$width": drawerSizes[size],
|
|
59
61
|
onClick: handleClose
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { DrawerBoxBaseProps, IDrawerBoxTransProps } from './types';
|
|
2
|
+
import type { ContentPadding, DrawerBoxBaseProps, IDrawerBoxTransProps } from './types';
|
|
3
3
|
export declare const LockBody: import("styled-components").GlobalStyleComponent<{}, import("styled-components").DefaultTheme>;
|
|
4
4
|
export declare const DrawerBox: import("styled-components").StyledComponent<"div", any, {
|
|
5
5
|
$zIndex: number;
|
|
6
6
|
}, never>;
|
|
7
|
-
export declare const DrawerInner: import("styled-components").StyledComponent<"div", any, {
|
|
7
|
+
export declare const DrawerInner: import("styled-components").StyledComponent<"div", any, {
|
|
8
|
+
$padding?: ContentPadding;
|
|
9
|
+
}, never>;
|
|
8
10
|
export declare const DrawerBoxTrans: import("styled-components").StyledComponent<React.FC<DrawerBoxBaseProps>, any, IDrawerBoxTransProps, never>;
|
|
9
11
|
export declare const DrawerContainer: import("styled-components").StyledComponent<"div", any, {
|
|
10
12
|
$width: string;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CSSTransition } from 'react-transition-group';
|
|
3
3
|
import styled, { createGlobalStyle } from 'styled-components';
|
|
4
|
+
import { ShapeRadius } from '@pushwoosh/kit-constants';
|
|
5
|
+
import { DrawerBody, DrawerHeader } from '../DrawerContent';
|
|
4
6
|
const animationTimeout = 300;
|
|
5
7
|
export const LockBody = createGlobalStyle(["body{overflow:hidden;position:relative;height:100%;}"]);
|
|
6
8
|
export const DrawerBox = styled.div.withConfig({
|
|
@@ -12,7 +14,25 @@ export const DrawerBox = styled.div.withConfig({
|
|
|
12
14
|
export const DrawerInner = styled.div.withConfig({
|
|
13
15
|
displayName: "DrawerInner",
|
|
14
16
|
componentId: "sc-n2uxwd-1"
|
|
15
|
-
})(["display:flex;justify-content:flex-end;width:100vw;height:100vh;padding:
|
|
17
|
+
})(["display:flex;justify-content:flex-end;width:100vw;height:100vh;padding-top:", ";padding-right:", ";padding-bottom:", ";padding-left:", ";", "{", "}", "{", "}"], ({
|
|
18
|
+
$padding
|
|
19
|
+
}) => ($padding === null || $padding === void 0 ? void 0 : $padding.top) || '0px', ({
|
|
20
|
+
$padding
|
|
21
|
+
}) => ($padding === null || $padding === void 0 ? void 0 : $padding.right) || '0px', ({
|
|
22
|
+
$padding
|
|
23
|
+
}) => ($padding === null || $padding === void 0 ? void 0 : $padding.bottom) || '0px', ({
|
|
24
|
+
$padding
|
|
25
|
+
}) => ($padding === null || $padding === void 0 ? void 0 : $padding.left) || '280px', DrawerBody, ({
|
|
26
|
+
$padding
|
|
27
|
+
}) => ($padding === null || $padding === void 0 ? void 0 : $padding.bottom) && `
|
|
28
|
+
border-bottom-left-radius: ${ShapeRadius.SECTION};
|
|
29
|
+
border-bottom-right-radius: ${ShapeRadius.SECTION};
|
|
30
|
+
`, DrawerHeader, ({
|
|
31
|
+
$padding
|
|
32
|
+
}) => ($padding === null || $padding === void 0 ? void 0 : $padding.top) && `
|
|
33
|
+
border-top-left-radius: ${ShapeRadius.SECTION};
|
|
34
|
+
border-top-right-radius: ${ShapeRadius.SECTION};
|
|
35
|
+
`);
|
|
16
36
|
const DrawerBoxBase = props => {
|
|
17
37
|
const {
|
|
18
38
|
isOpen,
|
|
@@ -52,6 +72,6 @@ export const DrawerBoxTrans = styled(DrawerBoxBase).withConfig({
|
|
|
52
72
|
export const DrawerContainer = styled.div.withConfig({
|
|
53
73
|
displayName: "DrawerContainer",
|
|
54
74
|
componentId: "sc-n2uxwd-3"
|
|
55
|
-
})(["position:relative;display:inline-flex;flex-direction:column;align-items:stretch;justify-content:flex-start;width:", ";
|
|
75
|
+
})(["position:relative;display:inline-flex;flex-direction:column;align-items:stretch;justify-content:flex-start;width:", ";z-index:10;box-shadow:0 10px 16px 0 rgba(27,31,36,0.1);"], ({
|
|
56
76
|
$width
|
|
57
77
|
}) => $width);
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { MutableRefObject, PropsWithChildren } from 'react';
|
|
2
2
|
import type { drawerSizes } from './maps';
|
|
3
|
+
export type ContentPadding = {
|
|
4
|
+
top?: string;
|
|
5
|
+
right?: string;
|
|
6
|
+
bottom?: string;
|
|
7
|
+
left?: string;
|
|
8
|
+
};
|
|
3
9
|
export type DrawerProps = PropsWithChildren<{
|
|
4
10
|
readonly size: keyof typeof drawerSizes;
|
|
5
11
|
readonly isOpen: boolean;
|
|
@@ -7,6 +13,7 @@ export type DrawerProps = PropsWithChildren<{
|
|
|
7
13
|
readonly onClose?: () => any;
|
|
8
14
|
readonly withoutLockScreen?: boolean;
|
|
9
15
|
readonly closeOnClickOutside?: boolean;
|
|
16
|
+
readonly padding?: ContentPadding;
|
|
10
17
|
}>;
|
|
11
18
|
export type DrawerBoxBaseProps = PropsWithChildren<{
|
|
12
19
|
className?: string;
|
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';
|