@pushwoosh/dumb-components 1.1.81 → 1.1.83
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 +13 -8
- package/DateTimePicker/components/DatePickerField/types.d.ts +2 -0
- package/DateTimePicker/components/DateTimePicker/DateTimePicker.js +4 -0
- package/DateTimePicker/components/DateTimePicker/types.d.ts +2 -0
- package/DateTimePicker/components/DateTimePickerField/DateTimePickerField.d.ts +1 -1
- package/DateTimePicker/components/DateTimePickerField/DateTimePickerField.js +13 -8
- package/DateTimePicker/components/DateTimePickerField/types.d.ts +2 -0
- package/ExternalImagePreview/ExternalImagePreview.d.ts +3 -0
- package/ExternalImagePreview/ExternalImagePreview.js +50 -0
- package/ExternalImagePreview/index.d.ts +1 -0
- package/ExternalImagePreview/index.js +1 -0
- package/ExternalImagePreview/styles.d.ts +13 -0
- package/ExternalImagePreview/styles.js +29 -0
- package/ExternalImagePreview/types.d.ts +9 -0
- package/ExternalImagePreview/types.js +1 -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(
|
|
3
|
+
export declare function DatePickerField(props: DatePickerFieldProps): ReactElement;
|
|
@@ -4,14 +4,17 @@ import { CalendarIcon } from '@pushwoosh/kit-icons';
|
|
|
4
4
|
import { format, monthName, get } from '../../helpers';
|
|
5
5
|
import { InputFrame } from '../../styles';
|
|
6
6
|
import { DatePicker } from '../DatePicker';
|
|
7
|
-
export function DatePickerField({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
export function DatePickerField(props) {
|
|
8
|
+
const {
|
|
9
|
+
value,
|
|
10
|
+
minDate,
|
|
11
|
+
maxDate,
|
|
12
|
+
error,
|
|
13
|
+
allowedPlacements = ['bottom-start', 'bottom-end', 'top-start', 'top-end'],
|
|
14
|
+
zIndex = 1000,
|
|
15
|
+
closeOnSelect = false,
|
|
16
|
+
onChange
|
|
17
|
+
} = props;
|
|
15
18
|
const [showPicker, setShowPicker] = useState(false);
|
|
16
19
|
const {
|
|
17
20
|
refs,
|
|
@@ -61,6 +64,8 @@ export function DatePickerField({
|
|
|
61
64
|
}
|
|
62
65
|
}, React.createElement(DatePicker, {
|
|
63
66
|
value: value,
|
|
67
|
+
minDate: minDate,
|
|
68
|
+
maxDate: maxDate,
|
|
64
69
|
onChange: onSelect
|
|
65
70
|
})));
|
|
66
71
|
}
|
|
@@ -6,6 +6,8 @@ import { NumberPicker } from '../NumberPicker';
|
|
|
6
6
|
export function DateTimePicker(props) {
|
|
7
7
|
const {
|
|
8
8
|
value,
|
|
9
|
+
minDate,
|
|
10
|
+
maxDate,
|
|
9
11
|
userInputDay,
|
|
10
12
|
onChange
|
|
11
13
|
} = props;
|
|
@@ -30,6 +32,8 @@ export function DateTimePicker(props) {
|
|
|
30
32
|
return React.createElement(DatePicker, {
|
|
31
33
|
value: format(date, 'year-month-dayThour:minute:second'),
|
|
32
34
|
userInputDay: userInputDay,
|
|
35
|
+
minDate: minDate,
|
|
36
|
+
maxDate: maxDate,
|
|
33
37
|
onChange: handleChange,
|
|
34
38
|
slotAfterMonth: () => React.createElement(Collapse, {
|
|
35
39
|
expanded: !!value
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
2
|
import type { DateTimePickerFieldProps } from './types';
|
|
3
|
-
export declare function DateTimePickerField(
|
|
3
|
+
export declare function DateTimePickerField(props: DateTimePickerFieldProps): ReactElement;
|
|
@@ -4,14 +4,17 @@ import { CalendarIcon } from '@pushwoosh/kit-icons';
|
|
|
4
4
|
import { useUTCDate } from './helpers';
|
|
5
5
|
import { InputFrame } from '../../styles';
|
|
6
6
|
import { DateTimePicker } from '../DateTimePicker';
|
|
7
|
-
export function DateTimePickerField({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
export function DateTimePickerField(props) {
|
|
8
|
+
const {
|
|
9
|
+
value,
|
|
10
|
+
minDate,
|
|
11
|
+
maxDate,
|
|
12
|
+
error,
|
|
13
|
+
allowedPlacements = ['bottom-start', 'bottom-end', 'top-start', 'top-end'],
|
|
14
|
+
zIndex = 1000,
|
|
15
|
+
closeOnSelect = false,
|
|
16
|
+
onChange
|
|
17
|
+
} = props;
|
|
15
18
|
const [showPicker, setShowPicker] = useState(false);
|
|
16
19
|
const {
|
|
17
20
|
refs,
|
|
@@ -68,6 +71,8 @@ export function DateTimePickerField({
|
|
|
68
71
|
}
|
|
69
72
|
}, React.createElement(DateTimePicker, {
|
|
70
73
|
value: value,
|
|
74
|
+
minDate: minDate,
|
|
75
|
+
maxDate: maxDate,
|
|
71
76
|
onChange: onSelect
|
|
72
77
|
})));
|
|
73
78
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { Color } from '@pushwoosh/kit-constants';
|
|
3
|
+
import { Spinner } from '../Spinner';
|
|
4
|
+
import { RootBox, ImgPreview, PlaceholderWrapper } from './styles';
|
|
5
|
+
export function ExternalImagePreview(props) {
|
|
6
|
+
const {
|
|
7
|
+
src,
|
|
8
|
+
alt = 'External image preview',
|
|
9
|
+
width,
|
|
10
|
+
height,
|
|
11
|
+
placeholder,
|
|
12
|
+
onError
|
|
13
|
+
} = props;
|
|
14
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
15
|
+
const [isError, setIsError] = useState(false);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (src) {
|
|
18
|
+
setIsLoading(true);
|
|
19
|
+
setIsError(false);
|
|
20
|
+
}
|
|
21
|
+
}, [src]);
|
|
22
|
+
const handleOnError = error => {
|
|
23
|
+
setIsLoading(false);
|
|
24
|
+
setIsError(true);
|
|
25
|
+
if (onError) {
|
|
26
|
+
onError(error);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
return React.createElement(RootBox, {
|
|
30
|
+
width: width,
|
|
31
|
+
height: height
|
|
32
|
+
}, (!src || isError) && React.createElement(PlaceholderWrapper, {
|
|
33
|
+
width: width,
|
|
34
|
+
height: height
|
|
35
|
+
}, placeholder), isLoading && React.createElement(PlaceholderWrapper, {
|
|
36
|
+
width: width,
|
|
37
|
+
height: height
|
|
38
|
+
}, React.createElement(Spinner, {
|
|
39
|
+
size: "small",
|
|
40
|
+
color: Color.CLEAR
|
|
41
|
+
})), React.createElement(ImgPreview, {
|
|
42
|
+
width: width,
|
|
43
|
+
height: height,
|
|
44
|
+
isHide: !src || isLoading || isError,
|
|
45
|
+
alt: alt,
|
|
46
|
+
src: src,
|
|
47
|
+
onError: handleOnError,
|
|
48
|
+
onLoad: () => setIsLoading(false)
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ExternalImagePreview } from './ExternalImagePreview';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ExternalImagePreview } from './ExternalImagePreview';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const RootBox: import("styled-components").StyledComponent<"div", any, {
|
|
2
|
+
width: string | number;
|
|
3
|
+
height: string | number;
|
|
4
|
+
}, never>;
|
|
5
|
+
export declare const ImgPreview: import("styled-components").StyledComponent<"img", any, {
|
|
6
|
+
width: string | number;
|
|
7
|
+
height: string | number;
|
|
8
|
+
isHide: boolean;
|
|
9
|
+
}, never>;
|
|
10
|
+
export declare const PlaceholderWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
11
|
+
width: string | number;
|
|
12
|
+
height: string | number;
|
|
13
|
+
}, never>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { Color, ShapeRadius } from '@pushwoosh/kit-constants';
|
|
3
|
+
import { toCssValue } from '@pushwoosh/kit-helpers';
|
|
4
|
+
export const RootBox = styled.div.withConfig({
|
|
5
|
+
displayName: "RootBox",
|
|
6
|
+
componentId: "sc-irvho3-0"
|
|
7
|
+
})(["position:relative;width:", ";height:", ";"], ({
|
|
8
|
+
width
|
|
9
|
+
}) => toCssValue(width), ({
|
|
10
|
+
height
|
|
11
|
+
}) => toCssValue(height));
|
|
12
|
+
export const ImgPreview = styled.img.withConfig({
|
|
13
|
+
displayName: "ImgPreview",
|
|
14
|
+
componentId: "sc-irvho3-1"
|
|
15
|
+
})(["width:", ";height:", ";border-radius:", ";opacity:", ";z-index:1;"], ({
|
|
16
|
+
width
|
|
17
|
+
}) => toCssValue(width), ({
|
|
18
|
+
height
|
|
19
|
+
}) => toCssValue(height), ShapeRadius.CONTROL, ({
|
|
20
|
+
isHide
|
|
21
|
+
}) => isHide ? 0 : 1);
|
|
22
|
+
export const PlaceholderWrapper = styled.div.withConfig({
|
|
23
|
+
displayName: "PlaceholderWrapper",
|
|
24
|
+
componentId: "sc-irvho3-2"
|
|
25
|
+
})(["width:", ";height:", ";display:flex;align-items:center;justify-content:center;border-radius:", ";position:absolute;top:0;left:0;z-index:2;background:", ";"], ({
|
|
26
|
+
width
|
|
27
|
+
}) => toCssValue(width), ({
|
|
28
|
+
height
|
|
29
|
+
}) => toCssValue(height), ShapeRadius.CONTROL, Color.MAIN);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactElement, ReactEventHandler } from 'react';
|
|
2
|
+
export interface ExternalImagePreviewProps {
|
|
3
|
+
src: string;
|
|
4
|
+
alt?: string;
|
|
5
|
+
width: string | number;
|
|
6
|
+
height: string | number;
|
|
7
|
+
placeholder: ReactElement;
|
|
8
|
+
onError?: (error: ReactEventHandler<HTMLImageElement>) => void;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|