@antscorp/antsomi-ui 1.3.5-beta.29 → 1.3.5-beta.30
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/es/assets/images/profile.png +0 -0
- package/es/assets/images/tail.png +0 -0
- package/es/components/molecules/RichMenu/RichMenuMobileView/RichMenuMobileView.d.ts +4 -0
- package/es/components/molecules/RichMenu/RichMenuMobileView/RichMenuMobileView.js +22 -3
- package/es/components/molecules/RichMenu/RichMenuMobileView/styled.d.ts +5 -0
- package/es/components/molecules/RichMenu/RichMenuMobileView/styled.js +31 -0
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
@@ -3,6 +3,10 @@ import { RichMenu } from '@antscorp/antsomi-ui/es/types';
|
|
|
3
3
|
interface RichMenuMobileViewProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
richMenu: RichMenu;
|
|
5
5
|
isPreview?: boolean;
|
|
6
|
+
messagePreview?: {
|
|
7
|
+
show?: boolean;
|
|
8
|
+
text?: string;
|
|
9
|
+
};
|
|
6
10
|
onChangeRichMenu?: (richMenu: RichMenu, source?: 'user' | 'system') => void;
|
|
7
11
|
onClickCell?: (cellIndex: number) => void;
|
|
8
12
|
size?: 'large' | 'medium';
|
|
@@ -13,14 +13,16 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
13
13
|
import React, { useState } from 'react';
|
|
14
14
|
// Assets
|
|
15
15
|
import IphoneTopBar from '@antscorp/antsomi-ui/es/assets/images/iphone-top-bar.png';
|
|
16
|
+
import TailMessage from '@antscorp/antsomi-ui/es/assets/images/tail.png';
|
|
17
|
+
import ProfileMessage from '@antscorp/antsomi-ui/es/assets/images/profile.png';
|
|
16
18
|
// Components
|
|
17
19
|
import { MobileFrame } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
18
20
|
import { RichMenuChatBar } from '../RichMenuChatBar';
|
|
19
21
|
import { RichMenuBlock } from '../RichMenuBlock';
|
|
20
22
|
// Styles
|
|
21
|
-
import { MobileContent, RichMenuWrapper, TopBar } from './styled';
|
|
23
|
+
import { Image, Message, MessageBox, MessageWrapper, Profile, MobileContent, RichMenuWrapper, TopBar, } from './styled';
|
|
22
24
|
export const RichMenuMobileView = props => {
|
|
23
|
-
const { richMenu, className, isPreview, onChangeRichMenu, onClickCell, reCalculateFlag, size } = props, restOfProps = __rest(props, ["richMenu", "className", "isPreview", "onChangeRichMenu", "onClickCell", "reCalculateFlag", "size"]);
|
|
25
|
+
const { richMenu, className, isPreview, onChangeRichMenu, onClickCell, reCalculateFlag, messagePreview, size } = props, restOfProps = __rest(props, ["richMenu", "className", "isPreview", "onChangeRichMenu", "onClickCell", "reCalculateFlag", "messagePreview", "size"]);
|
|
24
26
|
// State
|
|
25
27
|
const [state, setState] = useState({
|
|
26
28
|
showRichMenu: true,
|
|
@@ -30,7 +32,24 @@ export const RichMenuMobileView = props => {
|
|
|
30
32
|
// Variables
|
|
31
33
|
const { showRichMenu, showTypingChat } = state;
|
|
32
34
|
return (React.createElement(MobileFrame, Object.assign({ size: size, className: `ants-mx-auto ${className}` }, restOfProps),
|
|
33
|
-
isPreview && React.createElement(
|
|
35
|
+
isPreview && (React.createElement(React.Fragment, null,
|
|
36
|
+
React.createElement(TopBar, { src: IphoneTopBar, width: "100%", height: "auto" }),
|
|
37
|
+
(messagePreview === null || messagePreview === void 0 ? void 0 : messagePreview.show) && (React.createElement(MessageBox, null,
|
|
38
|
+
React.createElement(Profile, null,
|
|
39
|
+
React.createElement(Image, { src: ProfileMessage, alt: "profile user" })),
|
|
40
|
+
React.createElement(MessageWrapper, null,
|
|
41
|
+
React.createElement("div", { style: {
|
|
42
|
+
position: 'absolute',
|
|
43
|
+
top: '-5px',
|
|
44
|
+
left: '-10px',
|
|
45
|
+
width: 20,
|
|
46
|
+
height: 20,
|
|
47
|
+
} },
|
|
48
|
+
React.createElement(Image, { src: TailMessage, alt: "tail decorator", style: { objectFit: 'contain' } })),
|
|
49
|
+
React.createElement(Message, null, (messagePreview === null || messagePreview === void 0 ? void 0 : messagePreview.text) ||
|
|
50
|
+
`Antsomi CDP 365 helps businesses decode their customer data, understand the
|
|
51
|
+
nuances of their customer lifecycles, and act on them – 24 hours a day, 365 days a
|
|
52
|
+
year.`)))))),
|
|
34
53
|
React.createElement(MobileContent, null,
|
|
35
54
|
React.createElement(RichMenuWrapper, { "$showRichMenu": showRichMenu && !showTypingChat, "$isPreview": !!isPreview }, richMenu && (React.createElement(RichMenuBlock, { richMenu: richMenu, isPreview: isPreview, onChange: onChangeRichMenu, onClickCell: onClickCell, reCalculateFlag: reCalculateFlag }))),
|
|
36
55
|
React.createElement(RichMenuChatBar, { disabled: !isPreview, label: richMenu === null || richMenu === void 0 ? void 0 : richMenu.chatBar.label, size: size, showRichMenu: showRichMenu, showTypingChat: showTypingChat, onToggleRichMenu: showRichMenu => setState(prevState => (Object.assign(Object.assign({}, prevState), { showRichMenu: !!showRichMenu }))), onToggleTypingChat: showTypingChat => setState(prevState => (Object.assign(Object.assign({}, prevState), { showTypingChat: !!showTypingChat }))) }))));
|
|
@@ -4,3 +4,8 @@ export declare const RichMenuWrapper: import("styled-components").StyledComponen
|
|
|
4
4
|
$isPreview: boolean;
|
|
5
5
|
}, never>;
|
|
6
6
|
export declare const TopBar: import("styled-components").StyledComponent<"img", any, {}, never>;
|
|
7
|
+
export declare const MessageBox: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
8
|
+
export declare const Profile: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
9
|
+
export declare const Image: import("styled-components").StyledComponent<"img", any, {}, never>;
|
|
10
|
+
export declare const Message: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
11
|
+
export declare const MessageWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
var _a;
|
|
1
2
|
// Libraries
|
|
2
3
|
import styled, { css } from 'styled-components';
|
|
4
|
+
// Constants
|
|
5
|
+
import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
3
6
|
export const MobileContent = styled.div `
|
|
4
7
|
position: absolute;
|
|
5
8
|
bottom: 0;
|
|
@@ -18,3 +21,31 @@ export const RichMenuWrapper = styled.div `
|
|
|
18
21
|
`}
|
|
19
22
|
`;
|
|
20
23
|
export const TopBar = styled.img ``;
|
|
24
|
+
export const MessageBox = styled.div `
|
|
25
|
+
display: flex;
|
|
26
|
+
gap: 10px;
|
|
27
|
+
margin: 15px 9px 0px 8px;
|
|
28
|
+
`;
|
|
29
|
+
export const Profile = styled.div `
|
|
30
|
+
width: 24px;
|
|
31
|
+
height: 24px;
|
|
32
|
+
`;
|
|
33
|
+
export const Image = styled.img `
|
|
34
|
+
width: 100%;
|
|
35
|
+
height: 100%;
|
|
36
|
+
object-fit: cover;
|
|
37
|
+
`;
|
|
38
|
+
export const Message = styled.div `
|
|
39
|
+
color: rgba(37, 37, 37, 1);
|
|
40
|
+
font-size: ${(_a = THEME.token) === null || _a === void 0 ? void 0 : _a.fontSize}px;
|
|
41
|
+
line-height: 16px;
|
|
42
|
+
`;
|
|
43
|
+
export const MessageWrapper = styled.div `
|
|
44
|
+
position: relative;
|
|
45
|
+
flex: 1;
|
|
46
|
+
padding: 10px;
|
|
47
|
+
background-color: rgba(229, 229, 234, 1);
|
|
48
|
+
border-radius: 15px;
|
|
49
|
+
color: rgba(229, 229, 234, 1);
|
|
50
|
+
box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
|
|
51
|
+
`;
|