@pushwoosh/dumb-components 1.1.228 → 1.1.229

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.
@@ -6,7 +6,7 @@ import { WhatsAppMessageContent } from './components/WhatsAppMessageContent';
6
6
  import { WHATSAPP_CARD_PADDING } from './constants';
7
7
  import { isMessageDrawable } from './helpers';
8
8
  import { Lang } from './polyglot';
9
- import { AppBar, AppName, Card, MissedGlyph, MissedHint, MissedRow, MissedTitle, PreviewText } from './styles';
9
+ import { AppBar, AppName, Backdrop, Card, MissedGlyph, MissedHint, MissedRow, MissedTitle, PreviewText } from './styles';
10
10
  import { Spinner } from '../Spinner';
11
11
  /** Renders a WhatsApp message the way the recipient sees it, WhatsApp markup and attachments included. */
12
12
  export function WhatsAppPreview(props) {
@@ -18,46 +18,48 @@ export function WhatsAppPreview(props) {
18
18
  isContentMissing = false
19
19
  } = props;
20
20
  const isDrawable = !isContentMissing && message !== undefined && isMessageDrawable(message);
21
- return _jsxs(Card, {
22
- children: [applicationName && _jsxs(AppBar, {
23
- children: [_jsx(WhatsappIcon, {
24
- size: "small",
25
- view: "filled"
26
- }), _jsx(AppName, {
27
- children: applicationName
28
- })]
29
- }), isLoading && _jsx(Horizontal, {
30
- "$alignItems": "center",
31
- "$justifyContent": "center",
32
- "$padding": WHATSAPP_CARD_PADDING,
33
- children: _jsx(Spinner, {
34
- color: Color.LOCKED,
35
- size: "medium"
36
- })
37
- }), !isLoading && isContentMissing && _jsxs(MissedRow, {
38
- children: [_jsx(MissedGlyph, {
39
- children: _jsx(CloseIcon, {
21
+ return _jsx(Backdrop, {
22
+ children: _jsxs(Card, {
23
+ children: [applicationName && _jsxs(AppBar, {
24
+ children: [_jsx(WhatsappIcon, {
25
+ size: "small",
26
+ view: "filled"
27
+ }), _jsx(AppName, {
28
+ children: applicationName
29
+ })]
30
+ }), isLoading && _jsx(Horizontal, {
31
+ "$alignItems": "center",
32
+ "$justifyContent": "center",
33
+ "$padding": WHATSAPP_CARD_PADDING,
34
+ children: _jsx(Spinner, {
35
+ color: Color.LOCKED,
40
36
  size: "medium"
41
37
  })
42
- }), _jsxs(Vertical, {
43
- children: [_jsx(MissedTitle, {
44
- children: _jsx(Lang, {
45
- message: "DUMB.WHATSAPP_PREVIEW.CONTENT_MISSED_TITLE"
46
- })
47
- }), _jsx(MissedHint, {
48
- children: _jsx(Lang, {
49
- message: "DUMB.WHATSAPP_PREVIEW.CONTENT_MISSED_HINT"
38
+ }), !isLoading && isContentMissing && _jsxs(MissedRow, {
39
+ children: [_jsx(MissedGlyph, {
40
+ children: _jsx(CloseIcon, {
41
+ size: "medium"
50
42
  })
43
+ }), _jsxs(Vertical, {
44
+ children: [_jsx(MissedTitle, {
45
+ children: _jsx(Lang, {
46
+ message: "DUMB.WHATSAPP_PREVIEW.CONTENT_MISSED_TITLE"
47
+ })
48
+ }), _jsx(MissedHint, {
49
+ children: _jsx(Lang, {
50
+ message: "DUMB.WHATSAPP_PREVIEW.CONTENT_MISSED_HINT"
51
+ })
52
+ })]
51
53
  })]
54
+ }), !isLoading && !isContentMissing && !isDrawable && _jsx(PreviewText, {
55
+ "$color": Color.LOCKED,
56
+ "$ellipsis": true,
57
+ children: emptyText ?? _jsx(Lang, {
58
+ message: "DUMB.WHATSAPP_PREVIEW.EMPTY"
59
+ })
60
+ }), !isLoading && isDrawable && _jsx(WhatsAppMessageContent, {
61
+ message: message
52
62
  })]
53
- }), !isLoading && !isContentMissing && !isDrawable && _jsx(PreviewText, {
54
- "$color": Color.LOCKED,
55
- "$ellipsis": true,
56
- children: emptyText ?? _jsx(Lang, {
57
- message: "DUMB.WHATSAPP_PREVIEW.EMPTY"
58
- })
59
- }), !isLoading && isDrawable && _jsx(WhatsAppMessageContent, {
60
- message: message
61
- })]
63
+ })
62
64
  });
63
65
  }
@@ -13,6 +13,8 @@ export declare const WHATSAPP_COLOR: {
13
13
  /** Card geometry from the design: 280px of content inside a 12px padding and a 1px border, border-box. */
14
14
  export declare const WHATSAPP_CARD_WIDTH = 306;
15
15
  export declare const WHATSAPP_CARD_PADDING = 12;
16
+ export declare const WHATSAPP_BACKDROP_PADDING = 24;
17
+ export declare const WHATSAPP_BACKDROP_WIDTH: number;
16
18
  export declare const WHATSAPP_APP_BAR_GAP = 6;
17
19
  export declare const WHATSAPP_APP_BAR_PADDING: {
18
20
  vertical: number;
@@ -13,6 +13,8 @@ export const WHATSAPP_COLOR = {
13
13
  /** Card geometry from the design: 280px of content inside a 12px padding and a 1px border, border-box. */
14
14
  export const WHATSAPP_CARD_WIDTH = 306;
15
15
  export const WHATSAPP_CARD_PADDING = 12;
16
+ export const WHATSAPP_BACKDROP_PADDING = 24;
17
+ export const WHATSAPP_BACKDROP_WIDTH = WHATSAPP_CARD_WIDTH + WHATSAPP_BACKDROP_PADDING * 2;
16
18
  export const WHATSAPP_APP_BAR_GAP = 6;
17
19
  export const WHATSAPP_APP_BAR_PADDING = {
18
20
  vertical: 8,
@@ -1,4 +1,23 @@
1
1
  import { Color, ShapeRadius } from '@pushwoosh/kit-constants';
2
+ export declare const Backdrop: import("styled-components").StyledComponent<"div", any, import("@pushwoosh/kit-helpers/styled-helpers").CommonBoxProps & {
3
+ $alignContent?: import("@pushwoosh/kit-helpers/styled-helpers").AlignContentValue | undefined;
4
+ $alignItems?: import("@pushwoosh/kit-helpers/styled-helpers").ItemAlignmentValue | undefined;
5
+ $gap?: import("@pushwoosh/kit-helpers/styled-helpers").StrNum | undefined;
6
+ $justifyContent?: import("@pushwoosh/kit-helpers/styled-helpers").JustifyContentValue | undefined;
7
+ } & {
8
+ $gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense" | undefined;
9
+ $justifyItems?: import("@pushwoosh/kit-helpers/styled-helpers").ItemAlignmentValue | undefined;
10
+ $placeItems?: import("@pushwoosh/kit-helpers/styled-helpers").ItemAlignmentValue | undefined;
11
+ } & {
12
+ $gridAutoFlow: string;
13
+ } & {
14
+ $alignContent: string;
15
+ $justifyItems: string;
16
+ $bgColor: Color;
17
+ $borderRadius: ShapeRadius;
18
+ $padding: number;
19
+ $width: number;
20
+ }, "$gridAutoFlow" | "$bgColor" | "$borderRadius" | "$padding" | "$width" | "$alignContent" | "$justifyItems">;
2
21
  export declare const Card: import("styled-components").StyledComponent<"div", any, import("@pushwoosh/kit-helpers/styled-helpers").CommonBoxProps & {
3
22
  $alignContent?: import("@pushwoosh/kit-helpers/styled-helpers").AlignContentValue | undefined;
4
23
  $alignItems?: import("@pushwoosh/kit-helpers/styled-helpers").ItemAlignmentValue | undefined;
@@ -2,7 +2,18 @@ import styled from 'styled-components';
2
2
  import { Color, FontFamily, FontSize, FontWeight, Shadow, ShapeRadius } from '@pushwoosh/kit-constants';
3
3
  import { Columns, Horizontal, Vertical } from '@pushwoosh/kit-helpers';
4
4
  import { Text } from '@pushwoosh/kit-typography';
5
- import { WHATSAPP_APP_BAR_GAP, WHATSAPP_APP_BAR_PADDING, WHATSAPP_CARD_PADDING, WHATSAPP_CARD_WIDTH, WHATSAPP_MISSED_GAP, WHATSAPP_MISSED_GLYPH_SIZE } from './constants';
5
+ import { WHATSAPP_APP_BAR_GAP, WHATSAPP_BACKDROP_PADDING, WHATSAPP_BACKDROP_WIDTH, WHATSAPP_APP_BAR_PADDING, WHATSAPP_CARD_PADDING, WHATSAPP_CARD_WIDTH, WHATSAPP_MISSED_GAP, WHATSAPP_MISSED_GLYPH_SIZE } from './constants';
6
+ export const Backdrop = styled(Vertical).attrs({
7
+ $alignContent: 'start',
8
+ $justifyItems: 'center',
9
+ $bgColor: Color.SOFT_LIGHT,
10
+ $borderRadius: ShapeRadius.SECTION,
11
+ $padding: WHATSAPP_BACKDROP_PADDING,
12
+ $width: WHATSAPP_BACKDROP_WIDTH
13
+ }).withConfig({
14
+ displayName: "Backdrop",
15
+ componentId: "sc-15y0kbp-0"
16
+ })(["-webkit-font-smoothing:antialiased;&,*{box-sizing:border-box;}"]);
6
17
  export const Card = styled(Vertical).attrs({
7
18
  $alignContent: 'start',
8
19
  $bgColor: Color.CLEAR,
@@ -13,8 +24,8 @@ export const Card = styled(Vertical).attrs({
13
24
  $width: WHATSAPP_CARD_WIDTH
14
25
  }).withConfig({
15
26
  displayName: "Card",
16
- componentId: "sc-15y0kbp-0"
17
- })(["-webkit-font-smoothing:antialiased;box-shadow:", ";overflow-wrap:anywhere;&,*{box-sizing:border-box;}"], Shadow.LARGE);
27
+ componentId: "sc-15y0kbp-1"
28
+ })(["box-shadow:", ";overflow-wrap:anywhere;"], Shadow.LARGE);
18
29
  // styled-components merges attrs OVER incoming props, so a plain object here would
19
30
  // silently clobber every call-site `$color`; the callback keeps MAIN as a default only.
20
31
  export const PreviewText = styled(Text).attrs(props => ({
@@ -22,7 +33,7 @@ export const PreviewText = styled(Text).attrs(props => ({
22
33
  $color: props.$color ?? Color.MAIN
23
34
  })).withConfig({
24
35
  displayName: "PreviewText",
25
- componentId: "sc-15y0kbp-1"
36
+ componentId: "sc-15y0kbp-2"
26
37
  })(["overflow:hidden;line-height:18px;text-overflow:ellipsis;"]);
27
38
  export const AppBar = styled(Horizontal).attrs({
28
39
  $alignItems: 'center',
@@ -31,14 +42,14 @@ export const AppBar = styled(Horizontal).attrs({
31
42
  $padding: WHATSAPP_APP_BAR_PADDING
32
43
  }).withConfig({
33
44
  displayName: "AppBar",
34
- componentId: "sc-15y0kbp-2"
45
+ componentId: "sc-15y0kbp-3"
35
46
  })(["margin:-", "px -", "px 0;border-bottom:1px solid ", ";color:", ";svg{display:block;}"], WHATSAPP_CARD_PADDING, WHATSAPP_CARD_PADDING, Color.DIVIDER, Color.SUCCESS);
36
47
  export const AppName = styled(Text).attrs({
37
48
  $color: Color.MAIN,
38
49
  $ellipsis: true
39
50
  }).withConfig({
40
51
  displayName: "AppName",
41
- componentId: "sc-15y0kbp-3"
52
+ componentId: "sc-15y0kbp-4"
42
53
  })(["overflow:hidden;font-family:", ";font-size:", ";font-style:normal;font-weight:", ";line-height:18px;text-overflow:ellipsis;"], FontFamily.MAIN, FontSize.SMALL, FontWeight.MEDIUM);
43
54
  export const MissedRow = styled(Columns).attrs({
44
55
  $alignItems: 'center',
@@ -46,7 +57,7 @@ export const MissedRow = styled(Columns).attrs({
46
57
  $sizes: `${WHATSAPP_MISSED_GLYPH_SIZE}px minmax(0, 1fr)`
47
58
  }).withConfig({
48
59
  displayName: "MissedRow",
49
- componentId: "sc-15y0kbp-4"
60
+ componentId: "sc-15y0kbp-5"
50
61
  })([""]);
51
62
  export const MissedGlyph = styled(Horizontal).attrs({
52
63
  $alignItems: 'center',
@@ -57,18 +68,18 @@ export const MissedGlyph = styled(Horizontal).attrs({
57
68
  $height: WHATSAPP_MISSED_GLYPH_SIZE
58
69
  }).withConfig({
59
70
  displayName: "MissedGlyph",
60
- componentId: "sc-15y0kbp-5"
71
+ componentId: "sc-15y0kbp-6"
61
72
  })(["color:", ";svg{display:block;}"], Color.LOCKED);
62
73
  export const MissedTitle = styled(Text).attrs({
63
74
  $color: Color.MAIN,
64
75
  $ellipsis: true
65
76
  }).withConfig({
66
77
  displayName: "MissedTitle",
67
- componentId: "sc-15y0kbp-6"
78
+ componentId: "sc-15y0kbp-7"
68
79
  })(["overflow:hidden;font-family:", ";font-size:", ";font-weight:", ";line-height:18px;text-overflow:ellipsis;"], FontFamily.MAIN, FontSize.SMALL, FontWeight.MEDIUM);
69
80
  export const MissedHint = styled(Text).attrs({
70
81
  $color: Color.LOCKED
71
82
  }).withConfig({
72
83
  displayName: "MissedHint",
73
- componentId: "sc-15y0kbp-7"
84
+ componentId: "sc-15y0kbp-8"
74
85
  })(["font-family:", ";font-size:", ";font-weight:", ";line-height:18px;"], FontFamily.MAIN, FontSize.SMALL, FontWeight.REGULAR);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/dumb-components",
3
- "version": "1.1.228",
3
+ "version": "1.1.229",
4
4
  "description": "React components to build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",