@pushwoosh/dumb-components 1.1.26 → 1.1.28
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/DateTimePicker/components/DatePickerField/DatePickerField.d.ts +1 -1
- package/DateTimePicker/components/DatePickerField/DatePickerField.js +7 -1
- package/DateTimePicker/components/DatePickerField/types.d.ts +1 -0
- package/DateTimePicker/components/DateTimePickerField/DateTimePickerField.d.ts +1 -1
- package/DateTimePicker/components/DateTimePickerField/DateTimePickerField.js +7 -1
- package/DateTimePicker/components/DateTimePickerField/types.d.ts +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/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
2
|
import type { DatePickerFieldProps } from './types';
|
|
3
|
-
export declare function DatePickerField({ value, error, allowedPlacements, zIndex, onChange, }: DatePickerFieldProps): ReactElement;
|
|
3
|
+
export declare function DatePickerField({ value, error, allowedPlacements, zIndex, closeOnSelect, onChange, }: DatePickerFieldProps): ReactElement;
|
|
@@ -9,6 +9,7 @@ export function DatePickerField({
|
|
|
9
9
|
error,
|
|
10
10
|
allowedPlacements = ['bottom-start', 'bottom-end', 'top-start', 'top-end'],
|
|
11
11
|
zIndex = 1000,
|
|
12
|
+
closeOnSelect = false,
|
|
12
13
|
onChange
|
|
13
14
|
}) {
|
|
14
15
|
const [showPicker, setShowPicker] = useState(false);
|
|
@@ -35,7 +36,12 @@ export function DatePickerField({
|
|
|
35
36
|
document.removeEventListener('click', handleClickListener);
|
|
36
37
|
};
|
|
37
38
|
}, [showPicker, refs]);
|
|
38
|
-
const onSelect = date =>
|
|
39
|
+
const onSelect = date => {
|
|
40
|
+
onChange(date);
|
|
41
|
+
if (closeOnSelect) {
|
|
42
|
+
setShowPicker(false);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
39
45
|
return React.createElement(React.Fragment, null, React.createElement(InputFrame, {
|
|
40
46
|
ref: refs.setReference,
|
|
41
47
|
"$gap": 8,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
2
|
import type { DateTimePickerFieldProps } from './types';
|
|
3
|
-
export declare function DateTimePickerField({ value, error, allowedPlacements, zIndex, onChange, }: DateTimePickerFieldProps): ReactElement;
|
|
3
|
+
export declare function DateTimePickerField({ value, error, allowedPlacements, zIndex, closeOnSelect, onChange, }: DateTimePickerFieldProps): ReactElement;
|
|
@@ -10,6 +10,7 @@ export function DateTimePickerField({
|
|
|
10
10
|
error,
|
|
11
11
|
allowedPlacements = ['bottom-start', 'bottom-end', 'top-start', 'top-end'],
|
|
12
12
|
zIndex = 1000,
|
|
13
|
+
closeOnSelect = false,
|
|
13
14
|
onChange
|
|
14
15
|
}) {
|
|
15
16
|
const [showPicker, setShowPicker] = useState(false);
|
|
@@ -36,7 +37,12 @@ export function DateTimePickerField({
|
|
|
36
37
|
document.removeEventListener('click', handleClickListener);
|
|
37
38
|
};
|
|
38
39
|
}, [showPicker, refs]);
|
|
39
|
-
const onSelect = date =>
|
|
40
|
+
const onSelect = date => {
|
|
41
|
+
onChange(date);
|
|
42
|
+
if (closeOnSelect) {
|
|
43
|
+
setShowPicker(false);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
40
46
|
const {
|
|
41
47
|
year,
|
|
42
48
|
month,
|
|
@@ -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;
|