@pushwoosh/dumb-components 1.1.82 → 1.1.84

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/Banner/Banner.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import React, { useState, useCallback } from 'react';
2
- import { Spacing } from '@pushwoosh/kit-constants';
3
2
  import { Vertical } from '@pushwoosh/kit-helpers';
4
3
  import { CloseIcon } from '@pushwoosh/kit-icons';
5
4
  import { H4 } from '@pushwoosh/kit-typography';
@@ -64,7 +63,7 @@ export function Banner(props) {
64
63
  })), React.createElement(BannerContent, {
65
64
  "$hasChildren": !!children
66
65
  }, React.createElement(H4, null, title), children && React.createElement("div", null, children)), action && React.createElement(Vertical, {
67
- "$padding": `0 ${Spacing.S3} 0 0`,
66
+ "$padding": "0 8px 0 0",
68
67
  "$alignContent": "center"
69
68
  }, React.createElement(ActionButton, {
70
69
  onClick: handleAction,
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import { Spacing } from '@pushwoosh/kit-constants';
3
2
  import { Horizontal } from '@pushwoosh/kit-helpers';
4
3
  import { CloseIcon, CsvIcon } from '@pushwoosh/kit-icons';
5
4
  import { Button } from '../Button';
@@ -16,19 +15,19 @@ export function ExportResult(props) {
16
15
  return React.createElement(Horizontal, {
17
16
  "$justifyContent": "space-between",
18
17
  "$alignItems": "center",
19
- "$gap": Spacing.S4
18
+ "$gap": 12
20
19
  }, React.createElement(Horizontal, {
21
- "$gap": Spacing.S4
20
+ "$gap": 12
22
21
  }, React.createElement(LeftSlot, {
23
22
  "$type": type,
24
23
  "$alignItems": "center",
25
- "$padding": Spacing.S1
24
+ "$padding": 4
26
25
  }, leftSlotIcon || React.createElement(CsvIcon, {
27
26
  size: "medium",
28
27
  view: "filled"
29
28
  })), React.createElement(MainInfoContainer, null, React.createElement(Title, null, title), React.createElement(Subtitle, null, subtitle))), React.createElement(RightSlotContainer, {
30
- "$gap": Spacing.S3,
31
- "$alignItems": "center"
29
+ "$alignItems": "center",
30
+ "$gap": 8
32
31
  }, rightSlot, React.createElement(Button, {
33
32
  color: "secondary",
34
33
  onClick: handleClose,
@@ -0,0 +1,3 @@
1
+ import { type ReactElement } from 'react';
2
+ import type { ExternalImagePreviewProps } from './types';
3
+ export declare function ExternalImagePreview(props: ExternalImagePreviewProps): ReactElement;
@@ -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 {};
@@ -1,5 +1,4 @@
1
1
  import styled from 'styled-components';
2
- import { Spacing } from '@pushwoosh/kit-constants';
3
2
  import { Paragraph } from '@pushwoosh/kit-typography';
4
3
  export const RootBox = styled.div.withConfig({
5
4
  displayName: "RootBox",
@@ -12,18 +11,18 @@ export const BackButton = styled.div.withConfig({
12
11
  export const TitleBox = styled.div.withConfig({
13
12
  displayName: "TitleBox",
14
13
  componentId: "sc-1qwo99q-2"
15
- })(["display:flex;align-items:center;justify-content:start;flex-shrink:0;gap:", ";"], Spacing.S3);
14
+ })(["display:flex;align-items:center;justify-content:start;flex-shrink:0;gap:8px;"]);
16
15
  export const ActionsBox = styled.div.withConfig({
17
16
  displayName: "ActionsBox",
18
17
  componentId: "sc-1qwo99q-3"
19
- })(["display:flex;justify-content:flex-end;gap:", ";"], Spacing.S3);
18
+ })(["display:flex;justify-content:flex-end;gap:8px;"]);
20
19
  export const MoreActionsBox = styled.div.withConfig({
21
20
  displayName: "MoreActionsBox",
22
21
  componentId: "sc-1qwo99q-4"
23
22
  })(["display:flex;margin-right:", ";"], ({
24
23
  hasActions
25
- }) => hasActions ? Spacing.S5 : '0');
24
+ }) => hasActions ? '16px' : '0');
26
25
  export const DescriptionBox = styled(Paragraph).withConfig({
27
26
  displayName: "DescriptionBox",
28
27
  componentId: "sc-1qwo99q-5"
29
- })(["margin-top:", ";"], Spacing.S5);
28
+ })(["margin-top:16px;"]);
@@ -1,5 +1,4 @@
1
1
  import styled from 'styled-components';
2
- import { Spacing } from '@pushwoosh/kit-constants';
3
2
  import { H2, Paragraph } from '@pushwoosh/kit-typography';
4
3
  export const RootBox = styled.div.withConfig({
5
4
  displayName: "RootBox",
@@ -12,22 +11,22 @@ export const BackButton = styled.div.withConfig({
12
11
  export const TitleBox = styled.div.withConfig({
13
12
  displayName: "TitleBox",
14
13
  componentId: "sc-19rm2yr-2"
15
- })(["display:flex;align-items:center;justify-content:start;flex-shrink:0;gap:", ";"], Spacing.S3);
14
+ })(["display:flex;align-items:center;justify-content:start;flex-shrink:0;gap:8px;"]);
16
15
  export const AutosizeInputBox = styled(H2).withConfig({
17
16
  displayName: "AutosizeInputBox",
18
17
  componentId: "sc-19rm2yr-3"
19
- })(["display:flex;align-items:center;justify-content:start;overflow:hidden;gap:", ";"], Spacing.S3);
18
+ })(["display:flex;align-items:center;justify-content:start;overflow:hidden;gap:8px;"]);
20
19
  export const ActionsBox = styled.div.withConfig({
21
20
  displayName: "ActionsBox",
22
21
  componentId: "sc-19rm2yr-4"
23
- })(["display:flex;justify-content:flex-end;gap:", ";"], Spacing.S3);
22
+ })(["display:flex;justify-content:flex-end;gap:8px;"]);
24
23
  export const MoreActionsBox = styled.div.withConfig({
25
24
  displayName: "MoreActionsBox",
26
25
  componentId: "sc-19rm2yr-5"
27
26
  })(["display:flex;margin-right:", ";"], ({
28
27
  hasActions
29
- }) => hasActions ? Spacing.S5 : '0');
28
+ }) => hasActions ? '16px' : '0');
30
29
  export const DescriptionBox = styled(Paragraph).withConfig({
31
30
  displayName: "DescriptionBox",
32
31
  componentId: "sc-19rm2yr-6"
33
- })(["margin-top:", ";"], Spacing.S5);
32
+ })(["margin-top:16px;"]);
@@ -1,6 +1,5 @@
1
1
  import styled from 'styled-components';
2
- import { Spacing } from '@pushwoosh/kit-constants';
3
2
  export const TabsContainer = styled.div.withConfig({
4
3
  displayName: "TabsContainer",
5
4
  componentId: "sc-1pr0dun-0"
6
- })(["display:flex;flex-direction:column;gap:", ";width:100%;height:100%;"], Spacing.S5);
5
+ })(["display:flex;flex-direction:column;width:100%;height:100%;gap:16px;"]);
package/index.d.ts CHANGED
@@ -5,7 +5,7 @@ export { Button, GhostButton } from './Button';
5
5
  export { CardMetric } from './CardMetric';
6
6
  export { Checkbox } from './Checkbox';
7
7
  export { Drawer, DrawerHeader, DrawerTitle, DrawerBody, DrawerDocs, useDocs, } from './Drawer';
8
- export { CalendarSuperForm, type CalendarSuperFormProps, CalendarDropdown, type CalendarDropdownProps, dateToStruct, structToDate, dateToStructTz, structToDateTz, getTimezoneOffset, } from './Calendar';
8
+ export { CalendarSuperForm, CalendarDropdown, dateToStruct, structToDate, dateToStructTz, structToDateTz, getTimezoneOffset, type CalendarSuperFormProps, type CalendarDropdownProps, } from './Calendar';
9
9
  export { DatePicker, DatePickerField, DateTimePicker, DateTimePickerField, } from './DateTimePicker';
10
10
  export { DropdownMenu, DropdownMenuButton, DropdownMenuSection, DropdownMenuItem, } from './DropdownMenu';
11
11
  export { GetStartedPage } from './GetStartedPage';
@@ -31,15 +31,16 @@ export { PushPreview } from './PushPreview';
31
31
  export { Toast, ToastProvider, useToast } from './Toast';
32
32
  export { AutosizeInput, PageHeader, PageHeaderEditable } from './PageHeader';
33
33
  export { ExportResult } from './ExportResult';
34
+ export { ExternalImagePreview } from './ExternalImagePreview';
34
35
  export { NativeInput, NativeTextarea, NativeSelect, NativeTimeInput, } from './native';
35
36
  export { FieldBox } from './FieldBox';
36
37
  export { NumberPicker } from './NumberPicker';
37
38
  export { CodeEditor } from './CodeEditor';
38
39
  export { EnhancedInput, SearchInput } from './EnhancedInput';
39
40
  export { Chip } from './Chip';
40
- export { RichMessageEditor, RichMessageViewer, type DynamicContent } from './RichMessageEditor';
41
- export { FrequencyCappingEdit, FrequencyCappingReadonly, type LocalCapping } from './FrequencyCapping';
42
- export { SendRateEdit, SendRateReadonly, type SendRateBase, type SendRateEditProps, type SendRateReadonlyProps } from './SendRate';
41
+ export { RichMessageEditor, RichMessageViewer, type DynamicContent, } from './RichMessageEditor';
42
+ export { FrequencyCappingEdit, FrequencyCappingReadonly, type LocalCapping, } from './FrequencyCapping';
43
+ export { SendRateEdit, SendRateReadonly, type SendRateBase, type SendRateEditProps, type SendRateReadonlyProps, } from './SendRate';
43
44
  export { Alert } from './Alert';
44
- export { ApplicationPreloader, type ApplicationPreloaderProps } from './ApplicationPreloader';
45
+ export { ApplicationPreloader, type ApplicationPreloaderProps, } from './ApplicationPreloader';
45
46
  export { NotificationInbox, NotificationBar, NotificationBell, type Notification, type NotificationInboxProps, type NotificationSeverity, type NotificationBarType, type NotificationBarProps, type NotificationBellProps, } from './NotificationInbox';
package/index.js CHANGED
@@ -31,6 +31,7 @@ export { PushPreview } from './PushPreview';
31
31
  export { Toast, ToastProvider, useToast } from './Toast';
32
32
  export { AutosizeInput, PageHeader, PageHeaderEditable } from './PageHeader';
33
33
  export { ExportResult } from './ExportResult';
34
+ export { ExternalImagePreview } from './ExternalImagePreview';
34
35
  export { NativeInput, NativeTextarea, NativeSelect, NativeTimeInput } from './native';
35
36
  export { FieldBox } from './FieldBox';
36
37
  export { NumberPicker } from './NumberPicker';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/dumb-components",
3
- "version": "1.1.82",
3
+ "version": "1.1.84",
4
4
  "description": "React components to build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",