norma-library 0.6.81 → 0.6.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/dist/esm/components/Modal.js +3 -2
- package/dist/esm/components/Modal.js.map +1 -1
- package/dist/esm/components/NormaChatMessageBalloon/components/Content.d.ts +3 -0
- package/dist/esm/components/NormaChatMessageBalloon/components/Content.js +18 -0
- package/dist/esm/components/NormaChatMessageBalloon/components/Content.js.map +1 -0
- package/dist/esm/components/NormaChatMessageBalloon/components/Date.d.ts +3 -0
- package/dist/esm/components/NormaChatMessageBalloon/components/Date.js +8 -0
- package/dist/esm/components/NormaChatMessageBalloon/components/Date.js.map +1 -0
- package/dist/esm/components/NormaChatMessageBalloon/components/MessageItem.d.ts +3 -0
- package/dist/esm/components/NormaChatMessageBalloon/components/MessageItem.js +30 -0
- package/dist/esm/components/NormaChatMessageBalloon/components/MessageItem.js.map +1 -0
- package/dist/esm/components/NormaChatMessageBalloon/components/Root.d.ts +3 -0
- package/dist/esm/components/NormaChatMessageBalloon/components/Root.js +8 -0
- package/dist/esm/components/NormaChatMessageBalloon/components/Root.js.map +1 -0
- package/dist/esm/components/NormaChatMessageBalloon/components/Row.d.ts +3 -0
- package/dist/esm/components/NormaChatMessageBalloon/components/Row.js +7 -0
- package/dist/esm/components/NormaChatMessageBalloon/components/Row.js.map +1 -0
- package/dist/esm/components/NormaChatMessageBalloon/hook.d.ts +4 -0
- package/dist/esm/components/NormaChatMessageBalloon/hook.js +13 -0
- package/dist/esm/components/NormaChatMessageBalloon/hook.js.map +1 -0
- package/dist/esm/components/NormaChatMessageBalloon/index.d.ts +12 -0
- package/dist/esm/components/NormaChatMessageBalloon/index.js +13 -0
- package/dist/esm/components/NormaChatMessageBalloon/index.js.map +1 -0
- package/dist/esm/components/NormaChatMessageBalloon/styles.d.ts +5 -0
- package/dist/esm/components/NormaChatMessageBalloon/styles.js +13 -0
- package/dist/esm/components/NormaChatMessageBalloon/styles.js.map +1 -0
- package/dist/esm/components/ProductCard/ProductCard.js +3 -3
- package/dist/esm/components/ProductCard/ProductCard.js.map +1 -1
- package/dist/esm/components/RadioGroup.js +1 -1
- package/dist/esm/components/RadioGroup.js.map +1 -1
- package/dist/esm/components/ServiceCard/ServiceCard.js +2 -2
- package/dist/esm/components/ServiceCard/ServiceCard.js.map +1 -1
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/interfaces/Modal.d.ts +1 -0
- package/dist/esm/interfaces/NormaChatMessageBalloon.d.ts +20 -0
- package/dist/esm/interfaces/NormaChatMessageBalloon.js +2 -0
- package/dist/esm/interfaces/NormaChatMessageBalloon.js.map +1 -0
- package/dist/esm/interfaces/ProductCard.d.ts +2 -0
- package/dist/esm/interfaces/ServiceCard.d.ts +1 -0
- package/dist/esm/interfaces/index.d.ts +1 -0
- package/dist/esm/interfaces/index.js +1 -0
- package/dist/esm/interfaces/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Modal.tsx +4 -2
- package/src/components/NormaChatMessageBalloon/components/Content.tsx +31 -0
- package/src/components/NormaChatMessageBalloon/components/Date.tsx +11 -0
- package/src/components/NormaChatMessageBalloon/components/MessageItem.tsx +55 -0
- package/src/components/NormaChatMessageBalloon/components/Root.tsx +11 -0
- package/src/components/NormaChatMessageBalloon/components/Row.tsx +11 -0
- package/src/components/NormaChatMessageBalloon/hook.tsx +12 -0
- package/src/components/NormaChatMessageBalloon/index.tsx +13 -0
- package/src/components/NormaChatMessageBalloon/styles.ts +59 -0
- package/src/components/ProductCard/ProductCard.tsx +5 -2
- package/src/components/RadioGroup.tsx +1 -1
- package/src/components/ServiceCard/ServiceCard.tsx +2 -2
- package/src/components/index.ts +1 -0
- package/src/index.ts +2 -1
- package/src/interfaces/Modal.ts +1 -0
- package/src/interfaces/NormaChatMessageBalloon.ts +21 -0
- package/src/interfaces/ProductCard.ts +2 -0
- package/src/interfaces/ServiceCard.ts +1 -0
- package/src/interfaces/index.ts +1 -0
- package/src/stories/Modal.stories.tsx +1 -0
- package/src/stories/NormaChatMessageBalloon.stories.tsx +229 -0
- package/src/stories/Icons.stories.mdx +0 -27
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NormaChatMessageBalloonProps } from "../../../interfaces";
|
|
3
|
+
import Content from "./Content";
|
|
4
|
+
import Row from "./Row";
|
|
5
|
+
import Date from "./Date";
|
|
6
|
+
import { useChatMessageBalloon } from "../hook";
|
|
7
|
+
import { Avatar, Typography } from "@mui/material";
|
|
8
|
+
import Root from "./Root";
|
|
9
|
+
|
|
10
|
+
export default function MessageItem({ avatar, label, description, date, direction, onMouseEnter, highlight, children }: NormaChatMessageBalloonProps) {
|
|
11
|
+
const { balloonClassNames } = useChatMessageBalloon(onMouseEnter, highlight);
|
|
12
|
+
return (
|
|
13
|
+
<Root onMouseEnter={() => console.log('hover')} onMouseLeave={() => console.log('leave')}>
|
|
14
|
+
<Row direction={direction} onMouseEnter={() => console.log('row hover')} onMouseLeave={() => console.log('row leave')}>
|
|
15
|
+
<Content
|
|
16
|
+
label={label}
|
|
17
|
+
description={description}
|
|
18
|
+
direction={direction}
|
|
19
|
+
className={balloonClassNames}
|
|
20
|
+
/>
|
|
21
|
+
</Row>
|
|
22
|
+
<Row direction={direction}>
|
|
23
|
+
{avatar && (
|
|
24
|
+
<Avatar
|
|
25
|
+
sx={{
|
|
26
|
+
width: '30px',
|
|
27
|
+
height: '30px',
|
|
28
|
+
marginX: '10px',
|
|
29
|
+
position: 'relative',
|
|
30
|
+
}}
|
|
31
|
+
src={avatar?.src}
|
|
32
|
+
alt={avatar?.alt}
|
|
33
|
+
>
|
|
34
|
+
<Typography
|
|
35
|
+
sx={{
|
|
36
|
+
position: 'absolute',
|
|
37
|
+
top: '50%',
|
|
38
|
+
left: '50%',
|
|
39
|
+
transform: 'translate(-50%, -50%)',
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
42
|
+
{avatar?.alt}
|
|
43
|
+
</Typography>
|
|
44
|
+
</Avatar>
|
|
45
|
+
)}
|
|
46
|
+
<Date date={date} />
|
|
47
|
+
</Row>
|
|
48
|
+
{/* Children located here */}
|
|
49
|
+
<Row direction={direction}>
|
|
50
|
+
{children}
|
|
51
|
+
</Row>
|
|
52
|
+
|
|
53
|
+
</Root>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ChatMessageBalloonContainerStyle } from "../styles";
|
|
3
|
+
import { NormaChatMessageBalloonProps } from "../../../interfaces";
|
|
4
|
+
|
|
5
|
+
export default function Root({children, className, ...rest}: NormaChatMessageBalloonProps) {
|
|
6
|
+
return (
|
|
7
|
+
<ChatMessageBalloonContainerStyle className={className} {...rest}>
|
|
8
|
+
{children}
|
|
9
|
+
</ChatMessageBalloonContainerStyle>
|
|
10
|
+
)
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ChatMessageBalloonRowStyle } from "../styles";
|
|
3
|
+
import { NormaChatMessageBalloonProps } from "../../../interfaces";
|
|
4
|
+
|
|
5
|
+
export default function Row({children, direction, onRowMouseEnter, onRowMouseLeave }: NormaChatMessageBalloonProps) {
|
|
6
|
+
return (
|
|
7
|
+
<ChatMessageBalloonRowStyle direction={direction} onMouseLeave={onRowMouseLeave} onMouseEnter={onRowMouseEnter}>
|
|
8
|
+
{children}
|
|
9
|
+
</ChatMessageBalloonRowStyle>
|
|
10
|
+
);
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React, { useMemo } from "react"
|
|
2
|
+
|
|
3
|
+
export const useChatMessageBalloon = (onMouseEnter: React.MouseEventHandler<HTMLDivElement> | undefined, highlight: boolean | undefined) => {
|
|
4
|
+
const balloonClassNames = useMemo(() => {
|
|
5
|
+
const classNames = []
|
|
6
|
+
if(!!onMouseEnter) classNames.push('is-interactive')
|
|
7
|
+
if(!!highlight) classNames.push('is-highlight')
|
|
8
|
+
return classNames.join(" ")
|
|
9
|
+
}, [highlight, onMouseEnter])
|
|
10
|
+
|
|
11
|
+
return {balloonClassNames}
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Content from "./components/Content";
|
|
2
|
+
import Date from "./components/Date";
|
|
3
|
+
import MessageItem from "./components/MessageItem";
|
|
4
|
+
import Root from "./components/Root";
|
|
5
|
+
import Row from "./components/Row";
|
|
6
|
+
|
|
7
|
+
export const NormaChatMessageBalloon = {
|
|
8
|
+
Root: Root,
|
|
9
|
+
Row: Row,
|
|
10
|
+
Content: Content,
|
|
11
|
+
MessageItem: MessageItem,
|
|
12
|
+
Date: Date,
|
|
13
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Box, Typography } from '@mui/material';
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
|
+
|
|
4
|
+
export const ChatMessageBalloonContainerStyle: any = styled(Box)({
|
|
5
|
+
display: 'flex',
|
|
6
|
+
flexDirection: 'column',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const ChatMessageBalloonRowStyle: any = styled('div')<{ direction: string }>`
|
|
10
|
+
display: flex;
|
|
11
|
+
margin-bottom: 8px;
|
|
12
|
+
flex-direction: ${props => (props.direction === 'I' ? 'row-reverse' : 'row')};
|
|
13
|
+
justify-content: flex-start;
|
|
14
|
+
align-items: flex-start;
|
|
15
|
+
vertical-align: middle;
|
|
16
|
+
&:last-child {
|
|
17
|
+
margin-bottom: 0px;
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
export const ChatMessageBalloonStyle: any = styled('div')<{ direction: string }>`
|
|
22
|
+
background-color: ${props => (props.direction === 'I' ? '#FFF' : '#E18B50')};
|
|
23
|
+
border: 2px solid transparent;
|
|
24
|
+
border-radius: ${props => (props.direction === 'I' ? '20px 20px 0px 20px' : '20px 20px 20px 0px')};
|
|
25
|
+
box-sizing: border-box;
|
|
26
|
+
color: ${props => (props.direction === 'I' ? '#4D4F5B' : '#FFF')};
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
padding: 12px 24px;
|
|
30
|
+
width: 60%;
|
|
31
|
+
transition: border 0.6s cubic-bezier(0.16, 1, 0.3, 1);
|
|
32
|
+
|
|
33
|
+
&.is-highlight {
|
|
34
|
+
border: 2px solid #8a8888;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&.is-interactive {
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
|
|
40
|
+
&:hover {
|
|
41
|
+
border: 2px solid #8a8888;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
45
|
+
|
|
46
|
+
export const ChatMessageDateStyle: any = styled(Typography)`
|
|
47
|
+
color: #43425d;
|
|
48
|
+
opacity: 0.5;
|
|
49
|
+
margin-top: 7px;
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
export const ChatMessageChildrenStyle: any = styled('div')<{ direction: string }>`
|
|
53
|
+
align-items: center;
|
|
54
|
+
box-sizing: border-box;
|
|
55
|
+
display: flex;
|
|
56
|
+
flex: 1;
|
|
57
|
+
justify-content: ${props => (props.direction === 'I' ? 'end' : 'start')};
|
|
58
|
+
padding: 8px;
|
|
59
|
+
`;
|
|
@@ -12,13 +12,15 @@ export const ProductCard: React.FC<ProductCardProps> = ({
|
|
|
12
12
|
// product = 'analytics'
|
|
13
13
|
color,
|
|
14
14
|
iconColor,
|
|
15
|
+
iconSize,
|
|
15
16
|
onClick,
|
|
16
17
|
hasBorder = true,
|
|
17
18
|
disabled = false,
|
|
18
19
|
title,
|
|
19
20
|
description,
|
|
20
21
|
iconName,
|
|
21
|
-
flaggable = false
|
|
22
|
+
flaggable = false,
|
|
23
|
+
flagged = false
|
|
22
24
|
}) => {
|
|
23
25
|
|
|
24
26
|
/* const colors: { [key: string]: string } = {
|
|
@@ -44,6 +46,7 @@ export const ProductCard: React.FC<ProductCardProps> = ({
|
|
|
44
46
|
event.preventDefault()
|
|
45
47
|
event.stopPropagation()
|
|
46
48
|
}}
|
|
49
|
+
color={flagged ? 'primary' : 'inherit'}
|
|
47
50
|
cursor="pointer"
|
|
48
51
|
>
|
|
49
52
|
<GradeIcon />
|
|
@@ -57,7 +60,7 @@ export const ProductCard: React.FC<ProductCardProps> = ({
|
|
|
57
60
|
$iColor={iconColor}
|
|
58
61
|
$bColor={color}
|
|
59
62
|
>
|
|
60
|
-
<IconifyIcon iconName={iconName} color={iconColor} size=
|
|
63
|
+
<IconifyIcon iconName={iconName} color={iconColor} size={iconSize || '2em'} />
|
|
61
64
|
</IconCardStyle>
|
|
62
65
|
<p>{title}</p>
|
|
63
66
|
</TitleContainer>
|
|
@@ -34,7 +34,7 @@ export const RadioGroup = ({ ...props }: RadioBaseProps) => {
|
|
|
34
34
|
control={<RadioStyled color={props.color} size={item.size ? item.size : sizes[1]} />}
|
|
35
35
|
label={item.label}
|
|
36
36
|
key={key}
|
|
37
|
-
sx={{alignItems: "
|
|
37
|
+
sx={{alignItems: "center"}}
|
|
38
38
|
/>
|
|
39
39
|
))}
|
|
40
40
|
</MuiRadioGroup>
|
|
@@ -4,7 +4,7 @@ import { IconCardStyle, ServiceCardStyle, TitleContainer } from "./ServiceCard.s
|
|
|
4
4
|
import { Card } from "../Card";
|
|
5
5
|
import { IconifyIcon } from "../IconifyIcon";
|
|
6
6
|
|
|
7
|
-
export const ServiceCard: React.FC<ServiceCardProps> = ({iconName, onClick, disabled = false, color, iconColor, description, title }) => {
|
|
7
|
+
export const ServiceCard: React.FC<ServiceCardProps> = ({iconName, onClick, disabled = false, color, iconColor, iconSize, description, title }) => {
|
|
8
8
|
return (
|
|
9
9
|
<ServiceCardStyle disabled={disabled} $bColor={iconColor}>
|
|
10
10
|
<Card
|
|
@@ -17,7 +17,7 @@ export const ServiceCard: React.FC<ServiceCardProps> = ({iconName, onClick, disa
|
|
|
17
17
|
>
|
|
18
18
|
<TitleContainer>
|
|
19
19
|
<IconCardStyle $iColor={iconColor || ""} $bColor={color || ""}>
|
|
20
|
-
<IconifyIcon iconName={iconName || ""} color={iconColor} size="100%"/>
|
|
20
|
+
<IconifyIcon iconName={iconName || ""} color={iconColor} size={iconSize || "100%"}/>
|
|
21
21
|
</IconCardStyle>
|
|
22
22
|
<div className="text">
|
|
23
23
|
<p className="title">{title}</p>
|
package/src/components/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from './DropDown';
|
|
|
11
11
|
export * from './IconButton';
|
|
12
12
|
export * from './Icons';
|
|
13
13
|
export * from './Modal';
|
|
14
|
+
export * from './NormaChatMessageBalloon';
|
|
14
15
|
export * from './Paper';
|
|
15
16
|
export * from './ProductCard/ProductCard';
|
|
16
17
|
export * from './ProgressBar';
|
package/src/index.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { Tabs } from './components/Tabs';
|
|
|
14
14
|
import { Tag } from './components/Tag';
|
|
15
15
|
import { TextField } from './components/TextField';
|
|
16
16
|
import { DatePicker } from './components/DatePicker';
|
|
17
|
-
import { ChatMessage, ChatMessageBalloon, ProductCard, ServiceCard } from './components';
|
|
17
|
+
import { ChatMessage, ChatMessageBalloon, NormaChatMessageBalloon, ProductCard, ServiceCard } from './components';
|
|
18
18
|
import { NormaProvider } from './providers/NormaProvider';
|
|
19
19
|
import { themes, getPalette } from './helpers';
|
|
20
20
|
import DateInput from './components/DateInput';
|
|
@@ -62,6 +62,7 @@ export {
|
|
|
62
62
|
SelectInput,
|
|
63
63
|
ServiceCard,
|
|
64
64
|
MultiSelectInput,
|
|
65
|
+
NormaChatMessageBalloon,
|
|
65
66
|
Text,
|
|
66
67
|
Title,
|
|
67
68
|
TextInput,
|
package/src/interfaces/Modal.ts
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReactNode, MouseEventHandler } from "react";
|
|
2
|
+
|
|
3
|
+
export interface NormaChatMessageBalloonProps {
|
|
4
|
+
avatar?: {
|
|
5
|
+
src: string;
|
|
6
|
+
alt: string;
|
|
7
|
+
}
|
|
8
|
+
label?: string;
|
|
9
|
+
description?: ReactNode;
|
|
10
|
+
date?: string;
|
|
11
|
+
direction?: "I" | "O";
|
|
12
|
+
onMouseEnter?: MouseEventHandler<HTMLDivElement>;
|
|
13
|
+
onMouseLeave?: MouseEventHandler<HTMLDivElement>;
|
|
14
|
+
onRowMouseEnter?: MouseEventHandler<HTMLDivElement>;
|
|
15
|
+
onRowMouseLeave?: MouseEventHandler<HTMLDivElement>;
|
|
16
|
+
highlight?: boolean;
|
|
17
|
+
attachments?: string[];
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
bottomChildren?: ReactNode;
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
@@ -6,11 +6,13 @@ export interface ProductCardProps {
|
|
|
6
6
|
disabled?: boolean
|
|
7
7
|
color: string
|
|
8
8
|
iconColor: string
|
|
9
|
+
iconSize: string
|
|
9
10
|
iconName: string
|
|
10
11
|
title: string
|
|
11
12
|
description: string
|
|
12
13
|
hasBorder?: boolean
|
|
13
14
|
flaggable?: boolean
|
|
15
|
+
flagged?: boolean
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
|
package/src/interfaces/index.ts
CHANGED
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta } from '@storybook/react';
|
|
3
|
+
import { IconButton, NormaChatMessageBalloon } from '../components';
|
|
4
|
+
import { useChatMessageBalloon } from '../components/NormaChatMessageBalloon/hook';
|
|
5
|
+
import { Avatar, Box, Typography } from '@mui/material';
|
|
6
|
+
import { IconifyIcon } from '../components/IconifyIcon';
|
|
7
|
+
|
|
8
|
+
const messageArr = [
|
|
9
|
+
{
|
|
10
|
+
direction: 'O' as 'O',
|
|
11
|
+
label: "Teste de Título",
|
|
12
|
+
description: "lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec purus feugiat, molestie ipsum et, varius velit. Nulla nec purus feugiat, molestie ipsum et, varius velit.",
|
|
13
|
+
date: "06/02/2025",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
direction: 'I' as 'I',
|
|
17
|
+
label: "Teste de Título",
|
|
18
|
+
description: "lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec purus feugiat, molestie ipsum et, varius velit. Nulla nec purus feugiat, molestie ipsum et, varius velit.",
|
|
19
|
+
date: "06/02/2025",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
direction: 'O' as 'O',
|
|
23
|
+
label: "Teste de Título",
|
|
24
|
+
description: "lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla nec purus feugiat, molestie ipsum et, varius velit. Nulla nec purus feugiat, molestie ipsum et, varius velit.",
|
|
25
|
+
date: "07/02/2025",
|
|
26
|
+
}
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
const avatars = {
|
|
30
|
+
O: {
|
|
31
|
+
src: '',
|
|
32
|
+
alt: 'HC'
|
|
33
|
+
},
|
|
34
|
+
I: {
|
|
35
|
+
src: 'https://letsenhance.io/static/73136da51c245e80edc6ccfe44888a99/1015f/MainBefore.jpg',
|
|
36
|
+
alt: 'MB'
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const Template = () => {
|
|
41
|
+
return (
|
|
42
|
+
<>
|
|
43
|
+
{messageArr.map((message, index) => {
|
|
44
|
+
const { balloonClassNames } = useChatMessageBalloon(() => console.log('hover'), false);
|
|
45
|
+
return (
|
|
46
|
+
<Box key={index} sx={{
|
|
47
|
+
display: 'flex',
|
|
48
|
+
justifyContent: 'center',
|
|
49
|
+
alignItems: 'center',
|
|
50
|
+
backgroundColor: '#F5F5F5',
|
|
51
|
+
padding: '20px',
|
|
52
|
+
}}>
|
|
53
|
+
<NormaChatMessageBalloon.Root onMouseEnter={() => console.log('hover')} onMouseLeave={() => console.log('leave')}>
|
|
54
|
+
<NormaChatMessageBalloon.Row direction={message.direction} onMouseEnter={() => console.log('row hover')} onMouseLeave={() => console.log('row leave')}>
|
|
55
|
+
<NormaChatMessageBalloon.Content
|
|
56
|
+
label={message.label}
|
|
57
|
+
description={message.description}
|
|
58
|
+
direction={message.direction}
|
|
59
|
+
className={balloonClassNames}
|
|
60
|
+
/>
|
|
61
|
+
</NormaChatMessageBalloon.Row>
|
|
62
|
+
<NormaChatMessageBalloon.Row direction={message.direction}>
|
|
63
|
+
<NormaChatMessageBalloon.Date date={message.date} />
|
|
64
|
+
</NormaChatMessageBalloon.Row>
|
|
65
|
+
</NormaChatMessageBalloon.Root>
|
|
66
|
+
</Box>
|
|
67
|
+
);
|
|
68
|
+
})}
|
|
69
|
+
</>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const TemplateWithAvatar = () => {
|
|
74
|
+
return (
|
|
75
|
+
<>
|
|
76
|
+
{messageArr.map((message, index) => {
|
|
77
|
+
const { balloonClassNames } = useChatMessageBalloon(() => console.log('hover'), false);
|
|
78
|
+
return (
|
|
79
|
+
<Box key={index} sx={{
|
|
80
|
+
display: 'flex',
|
|
81
|
+
justifyContent: 'center',
|
|
82
|
+
alignItems: 'center',
|
|
83
|
+
backgroundColor: '#F5F5F5',
|
|
84
|
+
padding: '20px',
|
|
85
|
+
}}>
|
|
86
|
+
<NormaChatMessageBalloon.Root onMouseEnter={() => console.log('hover')} onMouseLeave={() => console.log('leave')}>
|
|
87
|
+
<NormaChatMessageBalloon.Row direction={message.direction} onMouseEnter={() => console.log('row hover')} onMouseLeave={() => console.log('row leave')}>
|
|
88
|
+
<NormaChatMessageBalloon.Content
|
|
89
|
+
label={message.label}
|
|
90
|
+
description={message.description}
|
|
91
|
+
direction={message.direction}
|
|
92
|
+
className={balloonClassNames}
|
|
93
|
+
|
|
94
|
+
/>
|
|
95
|
+
</NormaChatMessageBalloon.Row>
|
|
96
|
+
<NormaChatMessageBalloon.Row direction={message.direction}>
|
|
97
|
+
<Avatar
|
|
98
|
+
sx={{
|
|
99
|
+
width: '30px',
|
|
100
|
+
height: '30px',
|
|
101
|
+
marginX: '10px',
|
|
102
|
+
position: 'relative',
|
|
103
|
+
}}
|
|
104
|
+
src={avatars[message.direction].src}
|
|
105
|
+
alt={avatars[message.direction].alt}
|
|
106
|
+
>
|
|
107
|
+
<Typography
|
|
108
|
+
sx={{
|
|
109
|
+
position: 'absolute',
|
|
110
|
+
top: '50%',
|
|
111
|
+
left: '50%',
|
|
112
|
+
transform: 'translate(-50%, -50%)',
|
|
113
|
+
}}
|
|
114
|
+
>
|
|
115
|
+
{avatars[message.direction].alt}
|
|
116
|
+
</Typography>
|
|
117
|
+
</Avatar>
|
|
118
|
+
<NormaChatMessageBalloon.Date date={message.date} />
|
|
119
|
+
</NormaChatMessageBalloon.Row>
|
|
120
|
+
</NormaChatMessageBalloon.Root>
|
|
121
|
+
</Box>
|
|
122
|
+
);
|
|
123
|
+
})}
|
|
124
|
+
</>
|
|
125
|
+
);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const TemplateWithChildren = () => {
|
|
129
|
+
return (
|
|
130
|
+
<>
|
|
131
|
+
{messageArr.map((message, index) => {
|
|
132
|
+
const { balloonClassNames } = useChatMessageBalloon(() => console.log('hover'), false);
|
|
133
|
+
return (
|
|
134
|
+
<Box key={index} sx={{
|
|
135
|
+
display: 'flex',
|
|
136
|
+
justifyContent: 'center',
|
|
137
|
+
alignItems: 'center',
|
|
138
|
+
backgroundColor: '#F5F5F5',
|
|
139
|
+
padding: '20px',
|
|
140
|
+
}}>
|
|
141
|
+
<NormaChatMessageBalloon.Root onMouseEnter={() => console.log('hover')} onMouseLeave={() => console.log('leave')}>
|
|
142
|
+
<NormaChatMessageBalloon.Row direction={message.direction} onMouseEnter={() => console.log('row hover')} onMouseLeave={() => console.log('row leave')}>
|
|
143
|
+
<NormaChatMessageBalloon.Content
|
|
144
|
+
label={message.label}
|
|
145
|
+
description={message.description}
|
|
146
|
+
direction={message.direction}
|
|
147
|
+
className={balloonClassNames}
|
|
148
|
+
/>
|
|
149
|
+
</NormaChatMessageBalloon.Row>
|
|
150
|
+
<NormaChatMessageBalloon.Row direction={message.direction}>
|
|
151
|
+
<NormaChatMessageBalloon.Date date={message.date} />
|
|
152
|
+
</NormaChatMessageBalloon.Row>
|
|
153
|
+
{/* Children located here */}
|
|
154
|
+
<NormaChatMessageBalloon.Row direction={message.direction}>
|
|
155
|
+
<IconButton>
|
|
156
|
+
<IconifyIcon iconName="bx:bx-smile" size='2rem' color='#E18B50' />
|
|
157
|
+
</IconButton>
|
|
158
|
+
<IconButton>
|
|
159
|
+
<IconifyIcon iconName="uil:atom" size='2rem' color='#E18B50' />
|
|
160
|
+
</IconButton>
|
|
161
|
+
<p>...children</p>
|
|
162
|
+
</NormaChatMessageBalloon.Row>
|
|
163
|
+
|
|
164
|
+
</NormaChatMessageBalloon.Root>
|
|
165
|
+
</Box>
|
|
166
|
+
);
|
|
167
|
+
})}
|
|
168
|
+
</>
|
|
169
|
+
);
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const SimplifiedTemplate = () => {
|
|
173
|
+
return (
|
|
174
|
+
<>
|
|
175
|
+
{messageArr.map((message, index) => {
|
|
176
|
+
const { balloonClassNames } = useChatMessageBalloon(() => console.log('hover'), false);
|
|
177
|
+
return (
|
|
178
|
+
<Box key={index} sx={{
|
|
179
|
+
display: 'flex',
|
|
180
|
+
justifyContent: 'center',
|
|
181
|
+
alignItems: 'center',
|
|
182
|
+
backgroundColor: '#F5F5F5',
|
|
183
|
+
padding: '20px',
|
|
184
|
+
}}>
|
|
185
|
+
<NormaChatMessageBalloon.Root onMouseEnter={() => console.log('hover')} onMouseLeave={() => console.log('leave')}>
|
|
186
|
+
<NormaChatMessageBalloon.MessageItem
|
|
187
|
+
direction={message.direction}
|
|
188
|
+
label={message.label}
|
|
189
|
+
description={message.description}
|
|
190
|
+
onMouseEnter={() => console.log('row hover')}
|
|
191
|
+
onMouseLeave={() => console.log('row leave')}
|
|
192
|
+
className={balloonClassNames}
|
|
193
|
+
avatar={avatars[message.direction]}
|
|
194
|
+
children={
|
|
195
|
+
<>
|
|
196
|
+
<IconButton>
|
|
197
|
+
<IconifyIcon iconName="bx:bx-smile" size='2rem' color='#E18B50' />
|
|
198
|
+
</IconButton>
|
|
199
|
+
<IconButton>
|
|
200
|
+
<IconifyIcon iconName="uil:atom" size='2rem' color='#E18B50' />
|
|
201
|
+
</IconButton>
|
|
202
|
+
<p>...children</p>
|
|
203
|
+
</>
|
|
204
|
+
}
|
|
205
|
+
/>
|
|
206
|
+
</NormaChatMessageBalloon.Root>
|
|
207
|
+
</Box>
|
|
208
|
+
);
|
|
209
|
+
})}
|
|
210
|
+
</>
|
|
211
|
+
);
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const meta = {
|
|
215
|
+
title: 'Norma/ChatMessageBalloon',
|
|
216
|
+
component: Template,
|
|
217
|
+
parameters: {
|
|
218
|
+
layout: 'centered',
|
|
219
|
+
},
|
|
220
|
+
tags: ['autodocs'],
|
|
221
|
+
argTypes: {},
|
|
222
|
+
} satisfies Meta<typeof Template>;
|
|
223
|
+
|
|
224
|
+
export default meta;
|
|
225
|
+
|
|
226
|
+
export const Default = Template.bind({});
|
|
227
|
+
export const WithAvatar = TemplateWithAvatar.bind({});
|
|
228
|
+
export const WithChildren = TemplateWithChildren.bind({});
|
|
229
|
+
export const Simplified = SimplifiedTemplate.bind({});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Meta, ColorPalette, ColorItem } from "@storybook/blocks";
|
|
2
|
-
import { Box, Card, Grid, Typography, Paper } from "@mui/material";
|
|
3
|
-
import { palette } from "../helpers";
|
|
4
|
-
import { iconsSVG } from "../components/Svgs";
|
|
5
|
-
import { Icons } from "../components/Icons";
|
|
6
|
-
|
|
7
|
-
<Meta title="Display/Icons" />
|
|
8
|
-
|
|
9
|
-
<Grid container spacing={2}>
|
|
10
|
-
<Grid item xs={12}>
|
|
11
|
-
<Typography variant="h5">Norma DS Icons</Typography>
|
|
12
|
-
</Grid>
|
|
13
|
-
{Object.keys(iconsSVG).map((key) => (
|
|
14
|
-
<Grid item xs={3} key={key}>
|
|
15
|
-
<Paper sx={{ padding: 2 }}>
|
|
16
|
-
<Typography variant={"body1"}> {key} </Typography>
|
|
17
|
-
<Icons icon={key} scale="xsmall" />
|
|
18
|
-
<Icons icon={key} scale="small" color="secondary" />
|
|
19
|
-
<Icons icon={key} scale="medium" color="error" />
|
|
20
|
-
<Icons icon={key} scale="large" color="warning" />
|
|
21
|
-
<Icons icon={key} scale="xlarge" color="success" />
|
|
22
|
-
<Icons icon={key} scale="2xlarge" color="black" />
|
|
23
|
-
<Icons icon={key} scale="3xlarge" color="primary" />
|
|
24
|
-
</Paper>
|
|
25
|
-
</Grid>
|
|
26
|
-
))}
|
|
27
|
-
</Grid>
|