@hh.ru/magritte-ui-chat-bubble 3.0.5 → 3.0.7
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/Call.d.ts +2 -2
- package/Call.js +41 -9
- package/Call.js.map +1 -1
- package/ChatBubble.d.ts +10 -10
- package/ChatBubble.js +92 -16
- package/ChatBubble.js.map +1 -1
- package/ErrorAction.js +8 -9
- package/ErrorAction.js.map +1 -1
- package/File.d.ts +2 -2
- package/File.js +59 -15
- package/File.js.map +1 -1
- package/Label.js +4 -7
- package/Label.js.map +1 -1
- package/Media.d.ts +2 -2
- package/Media.js +15 -8
- package/Media.js.map +1 -1
- package/Message.d.ts +2 -2
- package/Message.js +11 -9
- package/Message.js.map +1 -1
- package/Meta.d.ts +1 -1
- package/Meta.js +12 -10
- package/Meta.js.map +1 -1
- package/Reply.js +31 -8
- package/Reply.js.map +1 -1
- package/Snippet.js +21 -8
- package/Snippet.js.map +1 -1
- package/Status.js +28 -19
- package/Status.js.map +1 -1
- package/Tail.js +20 -5
- package/Tail.js.map +1 -1
- package/chat-bubble-BOBGge0h.js +5 -0
- package/chat-bubble-BOBGge0h.js.map +1 -0
- package/index.css +114 -114
- package/index.d.ts +11 -11
- package/index.js +1 -1
- package/index.mock.d.ts +10 -10
- package/index.mock.js +19 -19
- package/index.mock.js.map +1 -1
- package/internal/colors.d.ts +1 -1
- package/internal/colors.js +36 -37
- package/internal/colors.js.map +1 -1
- package/internal/errorMenu.js +1 -1
- package/internal/errorMenu.js.map +1 -1
- package/internal/mode.d.ts +1 -1
- package/internal/mode.js +1 -2
- package/internal/mode.js.map +1 -1
- package/internal/utils.js +10 -10
- package/internal/utils.js.map +1 -1
- package/package.json +11 -11
- package/chat-bubble-DgO7_sM3.js +0 -5
- package/chat-bubble-DgO7_sM3.js.map +0 -1
package/Media.js
CHANGED
|
@@ -3,15 +3,22 @@ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { markMetaHost } from './internal/utils.js';
|
|
5
5
|
import { Text } from '@hh.ru/magritte-ui-typography';
|
|
6
|
-
import { s as styles } from './chat-bubble-
|
|
6
|
+
import { s as styles } from './chat-bubble-BOBGge0h.js';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
})
|
|
14
|
-
|
|
8
|
+
const ChatBubbleMediaComponent = forwardRef(
|
|
9
|
+
({ alt, children, "data-qa": dataQa = "chat-bubble-media", meta, src, format, width, height, ...props }, ref) => {
|
|
10
|
+
return /* @__PURE__ */ jsxs("div", { ...props, className: styles.media, "data-qa": dataQa, ref, children: [
|
|
11
|
+
src && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12
|
+
/* @__PURE__ */ jsx("img", { className: styles.mediaBlur, src, alt: "", "aria-hidden": true }),
|
|
13
|
+
/* @__PURE__ */ jsx("img", { className: styles.mediaImage, src, alt: alt ?? "", width, height })
|
|
14
|
+
] }),
|
|
15
|
+
children && /* @__PURE__ */ jsx("span", { className: styles.mediaContent, children }),
|
|
16
|
+
format && /* @__PURE__ */ jsx("span", { className: styles.mediaFormat, "data-qa": "chat-bubble-media-format", children: /* @__PURE__ */ jsx(Text, { Element: "span", typography: "label-4-regular", style: "constant", children: format }) }),
|
|
17
|
+
meta && /* @__PURE__ */ jsx("span", { className: styles.mediaMeta, "data-qa": "chat-bubble-media-meta", children: meta })
|
|
18
|
+
] });
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
ChatBubbleMediaComponent.displayName = "ChatBubbleMedia";
|
|
15
22
|
const ChatBubbleMedia = markMetaHost(ChatBubbleMediaComponent);
|
|
16
23
|
|
|
17
24
|
export { ChatBubbleMedia };
|
package/Media.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Media.js","sources":["src/Media.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\n\nimport { markMetaHost, type ChatBubbleMetaHostProps } from '@hh.ru/magritte-ui-chat-bubble/internal/utils';\nimport { Text } from '@hh.ru/magritte-ui-typography';\n\nimport styles from './chat-bubble.less';\n\nexport interface ChatBubbleMediaProps extends HTMLAttributes<HTMLDivElement>, ChatBubbleMetaHostProps {\n /** Url изображения или превью видео */\n src?: string;\n /** Alt изображения */\n alt?: string;\n /** Содержимое поверх превью */\n children?: ReactNode;\n /** Тип медиа (отображается в верхнем левом углу) */\n format?: ReactNode;\n /**\n * Значение data-qa\n * @default chat-bubble-media\n */\n 'data-qa'?: string;\n /**\n * Ширина превью в пикселях.\n * Задаётся атрибутом, ограничивается стилями компонента, но не переопределяется ими.\n * Передавать вместе с `height`.\n */\n width?: number;\n /**\n * Высота превью в пикселях.\n * Нужна, чтобы вычислить пропорции и зарезервировать место под картинку.\n * Передавать вместе с `width`.\n */\n height?: number;\n}\n\n/**\n * Медиа в сообщении\n */\nconst ChatBubbleMediaComponent = forwardRef<HTMLDivElement, ChatBubbleMediaProps>(\n ({ alt, children, 'data-qa': dataQa = 'chat-bubble-media', meta, src, format, width, height, ...props }, ref) => {\n return (\n <div {...props} className={styles.media} data-qa={dataQa} ref={ref}>\n {src && (\n <>\n <img className={styles.mediaBlur} src={src} alt=\"\" aria-hidden />\n <img className={styles.mediaImage} src={src} alt={alt ?? ''} width={width} height={height} />\n </>\n )}\n {children && <span className={styles.mediaContent}>{children}</span>}\n {format && (\n <span className={styles.mediaFormat} data-qa=\"chat-bubble-media-format\">\n <Text Element=\"span\" typography=\"label-4-regular\" style=\"constant\">\n {format}\n </Text>\n </span>\n )}\n {meta && (\n <span className={styles.mediaMeta} data-qa=\"chat-bubble-media-meta\">\n {meta}\n </span>\n )}\n </div>\n );\n }\n);\n\nChatBubbleMediaComponent.displayName = 'ChatBubbleMedia';\n\nexport const ChatBubbleMedia = markMetaHost(ChatBubbleMediaComponent);\n"],"names":[
|
|
1
|
+
{"version":3,"file":"Media.js","sources":["src/Media.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\n\nimport { markMetaHost, type ChatBubbleMetaHostProps } from '@hh.ru/magritte-ui-chat-bubble/internal/utils';\nimport { Text } from '@hh.ru/magritte-ui-typography';\n\nimport styles from './chat-bubble.less';\n\nexport interface ChatBubbleMediaProps extends HTMLAttributes<HTMLDivElement>, ChatBubbleMetaHostProps {\n /** Url изображения или превью видео */\n src?: string;\n /** Alt изображения */\n alt?: string;\n /** Содержимое поверх превью */\n children?: ReactNode;\n /** Тип медиа (отображается в верхнем левом углу) */\n format?: ReactNode;\n /**\n * Значение data-qa\n * @default chat-bubble-media\n */\n 'data-qa'?: string;\n /**\n * Ширина превью в пикселях.\n * Задаётся атрибутом, ограничивается стилями компонента, но не переопределяется ими.\n * Передавать вместе с `height`.\n */\n width?: number;\n /**\n * Высота превью в пикселях.\n * Нужна, чтобы вычислить пропорции и зарезервировать место под картинку.\n * Передавать вместе с `width`.\n */\n height?: number;\n}\n\n/**\n * Медиа в сообщении\n */\nconst ChatBubbleMediaComponent = forwardRef<HTMLDivElement, ChatBubbleMediaProps>(\n ({ alt, children, 'data-qa': dataQa = 'chat-bubble-media', meta, src, format, width, height, ...props }, ref) => {\n return (\n <div {...props} className={styles.media} data-qa={dataQa} ref={ref}>\n {src && (\n <>\n <img className={styles.mediaBlur} src={src} alt=\"\" aria-hidden />\n <img className={styles.mediaImage} src={src} alt={alt ?? ''} width={width} height={height} />\n </>\n )}\n {children && <span className={styles.mediaContent}>{children}</span>}\n {format && (\n <span className={styles.mediaFormat} data-qa=\"chat-bubble-media-format\">\n <Text Element=\"span\" typography=\"label-4-regular\" style=\"constant\">\n {format}\n </Text>\n </span>\n )}\n {meta && (\n <span className={styles.mediaMeta} data-qa=\"chat-bubble-media-meta\">\n {meta}\n </span>\n )}\n </div>\n );\n }\n);\n\nChatBubbleMediaComponent.displayName = 'ChatBubbleMedia';\n\nexport const ChatBubbleMedia = markMetaHost(ChatBubbleMediaComponent);\n"],"names":[],"mappings":";;;;;;AAsCA,MAAM,wBAA2B,GAAA,UAAA;AAAA,EAC7B,CAAC,EAAE,GAAK,EAAA,QAAA,EAAU,WAAW,MAAS,GAAA,mBAAA,EAAqB,IAAM,EAAA,GAAA,EAAK,QAAQ,KAAO,EAAA,MAAA,EAAQ,GAAG,KAAA,IAAS,GAAQ,KAAA;AAC7G,IACI,uBAAA,IAAA,CAAC,SAAK,GAAG,KAAA,EAAO,WAAW,MAAO,CAAA,KAAA,EAAO,SAAS,EAAA,MAAA,EAAQ,GACrD,EAAA,QAAA,EAAA;AAAA,MAAA,GAAA,oBAEO,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,wBAAC,GAAA,CAAA,KAAA,EAAA,EAAI,WAAW,MAAO,CAAA,SAAA,EAAW,KAAU,GAAI,EAAA,EAAA,EAAG,eAAW,IAAC,EAAA,CAAA;AAAA,wBAC/D,GAAA,CAAC,KAAI,EAAA,EAAA,SAAA,EAAW,MAAO,CAAA,UAAA,EAAY,KAAU,GAAK,EAAA,GAAA,IAAO,EAAI,EAAA,KAAA,EAAc,MAAgB,EAAA,CAAA;AAAA,OAC/F,EAAA,CAAA;AAAA,MAEH,4BAAa,GAAA,CAAA,MAAA,EAAA,EAAK,SAAW,EAAA,MAAA,CAAO,cAAe,QAAS,EAAA,CAAA;AAAA,MAC5D,0BACI,GAAA,CAAA,MAAA,EAAA,EAAK,SAAW,EAAA,MAAA,CAAO,aAAa,SAAQ,EAAA,0BAAA,EACzC,QAAC,kBAAA,GAAA,CAAA,IAAA,EAAA,EAAK,SAAQ,MAAO,EAAA,UAAA,EAAW,mBAAkB,KAAM,EAAA,UAAA,EACnD,kBACL,CACJ,EAAA,CAAA;AAAA,MAEH,IAAA,wBACI,MAAK,EAAA,EAAA,SAAA,EAAW,OAAO,SAAW,EAAA,SAAA,EAAQ,0BACtC,QACL,EAAA,IAAA,EAAA,CAAA;AAAA,KAER,EAAA,CAAA,CAAA;AAAA,GAER;AACJ,CAAA,CAAA;AAEA,wBAAA,CAAyB,WAAc,GAAA,iBAAA,CAAA;AAE1B,MAAA,eAAA,GAAkB,aAAa,wBAAwB;;;;"}
|
package/Message.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
-
import { ChatBubbleMetaHostProps } from '
|
|
2
|
+
import { ChatBubbleMetaHostProps } from './internal/utils';
|
|
3
3
|
export interface ChatBubbleMessageProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'>, ChatBubbleMetaHostProps {
|
|
4
4
|
/** Опциональный заголовок над текстом */
|
|
5
5
|
title?: ReactNode;
|
|
6
6
|
/** Текст сообщения */
|
|
7
7
|
children?: ReactNode;
|
|
8
8
|
}
|
|
9
|
-
export declare const ChatBubbleMessage: import("react").ForwardRefExoticComponent<ChatBubbleMessageProps & import("react").RefAttributes<HTMLDivElement>> & import("
|
|
9
|
+
export declare const ChatBubbleMessage: import("react").ForwardRefExoticComponent<ChatBubbleMessageProps & import("react").RefAttributes<HTMLDivElement>> & import("./internal/utils").MetaHostComponent;
|
package/Message.js
CHANGED
|
@@ -4,18 +4,20 @@ import { forwardRef } from 'react';
|
|
|
4
4
|
import { useChatBubbleColors } from './internal/colors.js';
|
|
5
5
|
import { markMetaHost } from './internal/utils.js';
|
|
6
6
|
import { Text } from '@hh.ru/magritte-ui-typography';
|
|
7
|
-
import { s as styles } from './chat-bubble-
|
|
7
|
+
import { s as styles } from './chat-bubble-BOBGge0h.js';
|
|
8
8
|
import './internal/mode.js';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* Время встаёт в одну строку с последней строкой текста (иначе переносится под текст)
|
|
13
|
-
*/
|
|
14
|
-
const ChatBubbleMessageComponent = forwardRef(({ children, meta, title, ...props }, ref) => {
|
|
10
|
+
const ChatBubbleMessageComponent = forwardRef(
|
|
11
|
+
({ children, meta, title, ...props }, ref) => {
|
|
15
12
|
const colors = useChatBubbleColors();
|
|
16
|
-
return
|
|
17
|
-
})
|
|
18
|
-
|
|
13
|
+
return /* @__PURE__ */ jsxs("div", { ...props, className: styles.message, "data-qa": "chat-bubble-message", ref, children: [
|
|
14
|
+
title && /* @__PURE__ */ jsx("div", { className: styles.messageTitle, "data-qa": "chat-bubble-message-title", children: /* @__PURE__ */ jsx(Text, { Element: "span", typography: "subtitle-2-semibold", style: colors.text, children: title }) }),
|
|
15
|
+
/* @__PURE__ */ jsx(Text, { Element: "span", typography: "label-3-regular", style: colors.text, children }),
|
|
16
|
+
meta
|
|
17
|
+
] });
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
ChatBubbleMessageComponent.displayName = "ChatBubbleMessage";
|
|
19
21
|
const ChatBubbleMessage = markMetaHost(ChatBubbleMessageComponent);
|
|
20
22
|
|
|
21
23
|
export { ChatBubbleMessage };
|
package/Message.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Message.js","sources":["src/Message.tsx"],"sourcesContent":["import { forwardRef, HTMLAttributes, ReactNode } from 'react';\n\nimport { useChatBubbleColors } from '@hh.ru/magritte-ui-chat-bubble/internal/colors';\nimport { markMetaHost, ChatBubbleMetaHostProps } from '@hh.ru/magritte-ui-chat-bubble/internal/utils';\nimport { Text } from '@hh.ru/magritte-ui-typography';\n\nimport styles from './chat-bubble.less';\n\nexport interface ChatBubbleMessageProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'>, ChatBubbleMetaHostProps {\n /** Опциональный заголовок над текстом */\n title?: ReactNode;\n /** Текст сообщения */\n children?: ReactNode;\n}\n\n/**\n * Текстовая часть сообщения.\n * Время встаёт в одну строку с последней строкой текста (иначе переносится под текст)\n */\nconst ChatBubbleMessageComponent = forwardRef<HTMLDivElement, ChatBubbleMessageProps>(\n ({ children, meta, title, ...props }, ref) => {\n const colors = useChatBubbleColors();\n\n return (\n <div {...props} className={styles.message} data-qa=\"chat-bubble-message\" ref={ref}>\n {title && (\n <div className={styles.messageTitle} data-qa=\"chat-bubble-message-title\">\n <Text Element=\"span\" typography=\"subtitle-2-semibold\" style={colors.text}>\n {title}\n </Text>\n </div>\n )}\n <Text Element=\"span\" typography=\"label-3-regular\" style={colors.text}>\n {children}\n </Text>\n {meta}\n </div>\n );\n }\n);\n\nChatBubbleMessageComponent.displayName = 'ChatBubbleMessage';\n\nexport const ChatBubbleMessage = markMetaHost(ChatBubbleMessageComponent);\n"],"names":[
|
|
1
|
+
{"version":3,"file":"Message.js","sources":["src/Message.tsx"],"sourcesContent":["import { forwardRef, HTMLAttributes, ReactNode } from 'react';\n\nimport { useChatBubbleColors } from '@hh.ru/magritte-ui-chat-bubble/internal/colors';\nimport { markMetaHost, ChatBubbleMetaHostProps } from '@hh.ru/magritte-ui-chat-bubble/internal/utils';\nimport { Text } from '@hh.ru/magritte-ui-typography';\n\nimport styles from './chat-bubble.less';\n\nexport interface ChatBubbleMessageProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'>, ChatBubbleMetaHostProps {\n /** Опциональный заголовок над текстом */\n title?: ReactNode;\n /** Текст сообщения */\n children?: ReactNode;\n}\n\n/**\n * Текстовая часть сообщения.\n * Время встаёт в одну строку с последней строкой текста (иначе переносится под текст)\n */\nconst ChatBubbleMessageComponent = forwardRef<HTMLDivElement, ChatBubbleMessageProps>(\n ({ children, meta, title, ...props }, ref) => {\n const colors = useChatBubbleColors();\n\n return (\n <div {...props} className={styles.message} data-qa=\"chat-bubble-message\" ref={ref}>\n {title && (\n <div className={styles.messageTitle} data-qa=\"chat-bubble-message-title\">\n <Text Element=\"span\" typography=\"subtitle-2-semibold\" style={colors.text}>\n {title}\n </Text>\n </div>\n )}\n <Text Element=\"span\" typography=\"label-3-regular\" style={colors.text}>\n {children}\n </Text>\n {meta}\n </div>\n );\n }\n);\n\nChatBubbleMessageComponent.displayName = 'ChatBubbleMessage';\n\nexport const ChatBubbleMessage = markMetaHost(ChatBubbleMessageComponent);\n"],"names":[],"mappings":";;;;;;;;AAmBA,MAAM,0BAA6B,GAAA,UAAA;AAAA,EAC/B,CAAC,EAAE,QAAU,EAAA,IAAA,EAAM,OAAO,GAAG,KAAA,IAAS,GAAQ,KAAA;AAC1C,IAAA,MAAM,SAAS,mBAAoB,EAAA,CAAA;AAEnC,IACI,uBAAA,IAAA,CAAC,SAAK,GAAG,KAAA,EAAO,WAAW,MAAO,CAAA,OAAA,EAAS,SAAQ,EAAA,qBAAA,EAAsB,GACpE,EAAA,QAAA,EAAA;AAAA,MAAA,KAAA,wBACI,KAAI,EAAA,EAAA,SAAA,EAAW,MAAO,CAAA,YAAA,EAAc,WAAQ,2BACzC,EAAA,QAAA,kBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,OAAA,EAAQ,QAAO,UAAW,EAAA,qBAAA,EAAsB,OAAO,MAAO,CAAA,IAAA,EAC/D,iBACL,CACJ,EAAA,CAAA;AAAA,sBAEJ,GAAA,CAAC,QAAK,OAAQ,EAAA,MAAA,EAAO,YAAW,iBAAkB,EAAA,KAAA,EAAO,MAAO,CAAA,IAAA,EAC3D,QACL,EAAA,CAAA;AAAA,MACC,IAAA;AAAA,KACL,EAAA,CAAA,CAAA;AAAA,GAER;AACJ,CAAA,CAAA;AAEA,0BAAA,CAA2B,WAAc,GAAA,mBAAA,CAAA;AAE5B,MAAA,iBAAA,GAAoB,aAAa,0BAA0B;;;;"}
|
package/Meta.d.ts
CHANGED
package/Meta.js
CHANGED
|
@@ -3,20 +3,22 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { useTranslation } from '@hh.ru/magritte-common-use-translation';
|
|
4
4
|
import { getColors } from './internal/colors.js';
|
|
5
5
|
import { Text } from '@hh.ru/magritte-ui-typography';
|
|
6
|
-
import { s as styles } from './chat-bubble-
|
|
6
|
+
import { s as styles } from './chat-bubble-BOBGge0h.js';
|
|
7
7
|
import './internal/mode.js';
|
|
8
8
|
import 'react';
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
* Время и статус сообщения
|
|
12
|
-
* Рендерится внутри последнего элемента контента.
|
|
13
|
-
* */
|
|
14
10
|
const Meta = ({ edited, mode, status, time }) => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
const editedLabel = useTranslation("ChatBubble", "edited");
|
|
12
|
+
if (!time && !status && !edited) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return /* @__PURE__ */ jsxs("span", { className: styles.meta, "data-qa": "chat-bubble-meta", children: [
|
|
16
|
+
(time || edited) && /* @__PURE__ */ jsxs(Text, { Element: "span", typography: "label-4-regular", style: getColors(mode).secondaryText, children: [
|
|
17
|
+
edited && /* @__PURE__ */ jsx("span", { className: styles.edited, children: editedLabel }),
|
|
18
|
+
time && /* @__PURE__ */ jsx("span", { children: time })
|
|
19
|
+
] }),
|
|
20
|
+
status
|
|
21
|
+
] });
|
|
20
22
|
};
|
|
21
23
|
|
|
22
24
|
export { Meta };
|
package/Meta.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Meta.js","sources":["src/Meta.tsx"],"sourcesContent":["import { type FC, type ReactNode } from 'react';\n\nimport { useTranslation } from '@hh.ru/magritte-common-use-translation';\nimport { getColors } from '@hh.ru/magritte-ui-chat-bubble/internal/colors';\nimport type { ChatBubbleMode } from '@hh.ru/magritte-ui-chat-bubble/types';\nimport { Text } from '@hh.ru/magritte-ui-typography';\n\nimport styles from './chat-bubble.less';\n\ninterface MetaProps {\n mode: ChatBubbleMode;\n status?: ReactNode;\n time?: ReactNode;\n edited?: boolean;\n}\n\n/**\n * Время и статус сообщения\n * Рендерится внутри последнего элемента контента.\n * */\nexport const Meta: FC<MetaProps> = ({ edited, mode, status, time }) => {\n const editedLabel = useTranslation('ChatBubble', 'edited');\n\n if (!time && !status && !edited) {\n return null;\n }\n\n return (\n <span className={styles.meta} data-qa=\"chat-bubble-meta\">\n {(time || edited) && (\n <Text Element=\"span\" typography=\"label-4-regular\" style={getColors(mode).secondaryText}>\n {edited && <span className={styles.edited}>{editedLabel}</span>}\n {time && <span>{time}</span>}\n </Text>\n )}\n {status}\n </span>\n );\n};\n"],"names":[
|
|
1
|
+
{"version":3,"file":"Meta.js","sources":["src/Meta.tsx"],"sourcesContent":["import { type FC, type ReactNode } from 'react';\n\nimport { useTranslation } from '@hh.ru/magritte-common-use-translation';\nimport { getColors } from '@hh.ru/magritte-ui-chat-bubble/internal/colors';\nimport type { ChatBubbleMode } from '@hh.ru/magritte-ui-chat-bubble/types';\nimport { Text } from '@hh.ru/magritte-ui-typography';\n\nimport styles from './chat-bubble.less';\n\ninterface MetaProps {\n mode: ChatBubbleMode;\n status?: ReactNode;\n time?: ReactNode;\n edited?: boolean;\n}\n\n/**\n * Время и статус сообщения\n * Рендерится внутри последнего элемента контента.\n * */\nexport const Meta: FC<MetaProps> = ({ edited, mode, status, time }) => {\n const editedLabel = useTranslation('ChatBubble', 'edited');\n\n if (!time && !status && !edited) {\n return null;\n }\n\n return (\n <span className={styles.meta} data-qa=\"chat-bubble-meta\">\n {(time || edited) && (\n <Text Element=\"span\" typography=\"label-4-regular\" style={getColors(mode).secondaryText}>\n {edited && <span className={styles.edited}>{editedLabel}</span>}\n {time && <span>{time}</span>}\n </Text>\n )}\n {status}\n </span>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAoBO,MAAM,OAAsB,CAAC,EAAE,QAAQ,IAAM,EAAA,MAAA,EAAQ,MAAW,KAAA;AACnE,EAAM,MAAA,WAAA,GAAc,cAAe,CAAA,YAAA,EAAc,QAAQ,CAAA,CAAA;AAEzD,EAAA,IAAI,CAAC,IAAA,IAAQ,CAAC,MAAA,IAAU,CAAC,MAAQ,EAAA;AAC7B,IAAO,OAAA,IAAA,CAAA;AAAA,GACX;AAEA,EAAA,4BACK,MAAK,EAAA,EAAA,SAAA,EAAW,MAAO,CAAA,IAAA,EAAM,WAAQ,kBAChC,EAAA,QAAA,EAAA;AAAA,IAAQ,CAAA,IAAA,IAAA,MAAA,qBACL,IAAA,CAAA,IAAA,EAAA,EAAK,OAAQ,EAAA,MAAA,EAAO,UAAW,EAAA,iBAAA,EAAkB,KAAO,EAAA,SAAA,CAAU,IAAI,CAAA,CAAE,aACpE,EAAA,QAAA,EAAA;AAAA,MAAA,MAAA,oBAAW,GAAA,CAAA,MAAA,EAAA,EAAK,SAAW,EAAA,MAAA,CAAO,QAAS,QAAY,EAAA,WAAA,EAAA,CAAA;AAAA,MACvD,IAAA,oBAAS,GAAA,CAAA,MAAA,EAAA,EAAM,QAAK,EAAA,IAAA,EAAA,CAAA;AAAA,KACzB,EAAA,CAAA;AAAA,IAEH,MAAA;AAAA,GACL,EAAA,CAAA,CAAA;AAER;;;;"}
|
package/Reply.js
CHANGED
|
@@ -3,17 +3,40 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { useChatBubbleColors } from './internal/colors.js';
|
|
5
5
|
import { Text } from '@hh.ru/magritte-ui-typography';
|
|
6
|
-
import { s as styles } from './chat-bubble-
|
|
6
|
+
import { s as styles } from './chat-bubble-BOBGge0h.js';
|
|
7
7
|
import './internal/mode.js';
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*/
|
|
12
|
-
const ChatBubbleReply = forwardRef(({ children, 'data-qa': dataQa = 'chat-bubble-reply', preview, previewAlt, title, ...props }, ref) => {
|
|
9
|
+
const ChatBubbleReply = forwardRef(
|
|
10
|
+
({ children, "data-qa": dataQa = "chat-bubble-reply", preview, previewAlt, title, ...props }, ref) => {
|
|
13
11
|
const colors = useChatBubbleColors();
|
|
14
|
-
return
|
|
15
|
-
})
|
|
16
|
-
|
|
12
|
+
return /* @__PURE__ */ jsxs("div", { ...props, className: styles.reply, "data-qa": dataQa, ref, children: [
|
|
13
|
+
preview && /* @__PURE__ */ jsx("img", { className: styles.replyPreview, src: preview, alt: previewAlt ?? "" }),
|
|
14
|
+
/* @__PURE__ */ jsxs("span", { className: styles.replyBody, children: [
|
|
15
|
+
title && /* @__PURE__ */ jsx(
|
|
16
|
+
Text,
|
|
17
|
+
{
|
|
18
|
+
typography: "subtitle-2-semibold",
|
|
19
|
+
style: colors.replyTitle,
|
|
20
|
+
maxLines: 1,
|
|
21
|
+
"data-qa": "chat-bubble-reply-title",
|
|
22
|
+
children: title
|
|
23
|
+
}
|
|
24
|
+
),
|
|
25
|
+
children && /* @__PURE__ */ jsx(
|
|
26
|
+
Text,
|
|
27
|
+
{
|
|
28
|
+
typography: "label-3-regular",
|
|
29
|
+
style: colors.text,
|
|
30
|
+
maxLines: 1,
|
|
31
|
+
"data-qa": "chat-bubble-reply-text",
|
|
32
|
+
children
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
] })
|
|
36
|
+
] });
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
ChatBubbleReply.displayName = "ChatBubbleReply";
|
|
17
40
|
|
|
18
41
|
export { ChatBubbleReply };
|
|
19
42
|
//# sourceMappingURL=Reply.js.map
|
package/Reply.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Reply.js","sources":["src/Reply.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\n\nimport { useChatBubbleColors } from '@hh.ru/magritte-ui-chat-bubble/internal/colors';\nimport { Text } from '@hh.ru/magritte-ui-typography';\n\nimport styles from './chat-bubble.less';\n\nexport interface ChatBubbleReplyProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** Автор цитируемого сообщения */\n title?: ReactNode;\n /** Url миниатюры вложения */\n preview?: string;\n /** Alt миниатюры */\n previewAlt?: string;\n /** Текст цитируемого сообщения */\n children?: ReactNode;\n /**\n * Значение data-qa\n * @default chat-bubble-reply\n */\n 'data-qa'?: string;\n}\n\n/**\n * Цитата сообщения, на которое отвечают (ставится в слот `header`)\n */\nexport const ChatBubbleReply = forwardRef<HTMLDivElement, ChatBubbleReplyProps>(\n ({ children, 'data-qa': dataQa = 'chat-bubble-reply', preview, previewAlt, title, ...props }, ref) => {\n const colors = useChatBubbleColors();\n\n return (\n <div {...props} className={styles.reply} data-qa={dataQa} ref={ref}>\n {preview && <img className={styles.replyPreview} src={preview} alt={previewAlt ?? ''} />}\n <span className={styles.replyBody}>\n {title && (\n <Text\n typography=\"subtitle-2-semibold\"\n style={colors.replyTitle}\n maxLines={1}\n data-qa=\"chat-bubble-reply-title\"\n >\n {title}\n </Text>\n )}\n {children && (\n <Text\n typography=\"label-3-regular\"\n style={colors.text}\n maxLines={1}\n data-qa=\"chat-bubble-reply-text\"\n >\n {children}\n </Text>\n )}\n </span>\n </div>\n );\n }\n);\n\nChatBubbleReply.displayName = 'ChatBubbleReply';\n"],"names":[
|
|
1
|
+
{"version":3,"file":"Reply.js","sources":["src/Reply.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\n\nimport { useChatBubbleColors } from '@hh.ru/magritte-ui-chat-bubble/internal/colors';\nimport { Text } from '@hh.ru/magritte-ui-typography';\n\nimport styles from './chat-bubble.less';\n\nexport interface ChatBubbleReplyProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** Автор цитируемого сообщения */\n title?: ReactNode;\n /** Url миниатюры вложения */\n preview?: string;\n /** Alt миниатюры */\n previewAlt?: string;\n /** Текст цитируемого сообщения */\n children?: ReactNode;\n /**\n * Значение data-qa\n * @default chat-bubble-reply\n */\n 'data-qa'?: string;\n}\n\n/**\n * Цитата сообщения, на которое отвечают (ставится в слот `header`)\n */\nexport const ChatBubbleReply = forwardRef<HTMLDivElement, ChatBubbleReplyProps>(\n ({ children, 'data-qa': dataQa = 'chat-bubble-reply', preview, previewAlt, title, ...props }, ref) => {\n const colors = useChatBubbleColors();\n\n return (\n <div {...props} className={styles.reply} data-qa={dataQa} ref={ref}>\n {preview && <img className={styles.replyPreview} src={preview} alt={previewAlt ?? ''} />}\n <span className={styles.replyBody}>\n {title && (\n <Text\n typography=\"subtitle-2-semibold\"\n style={colors.replyTitle}\n maxLines={1}\n data-qa=\"chat-bubble-reply-title\"\n >\n {title}\n </Text>\n )}\n {children && (\n <Text\n typography=\"label-3-regular\"\n style={colors.text}\n maxLines={1}\n data-qa=\"chat-bubble-reply-text\"\n >\n {children}\n </Text>\n )}\n </span>\n </div>\n );\n }\n);\n\nChatBubbleReply.displayName = 'ChatBubbleReply';\n"],"names":[],"mappings":";;;;;;;AA0BO,MAAM,eAAkB,GAAA,UAAA;AAAA,EAC3B,CAAC,EAAE,QAAU,EAAA,SAAA,EAAW,MAAS,GAAA,mBAAA,EAAqB,OAAS,EAAA,UAAA,EAAY,KAAO,EAAA,GAAG,KAAM,EAAA,EAAG,GAAQ,KAAA;AAClG,IAAA,MAAM,SAAS,mBAAoB,EAAA,CAAA;AAEnC,IACI,uBAAA,IAAA,CAAC,SAAK,GAAG,KAAA,EAAO,WAAW,MAAO,CAAA,KAAA,EAAO,SAAS,EAAA,MAAA,EAAQ,GACrD,EAAA,QAAA,EAAA;AAAA,MAAW,OAAA,oBAAA,GAAA,CAAC,SAAI,SAAW,EAAA,MAAA,CAAO,cAAc,GAAK,EAAA,OAAA,EAAS,GAAK,EAAA,UAAA,IAAc,EAAI,EAAA,CAAA;AAAA,sBACrF,IAAA,CAAA,MAAA,EAAA,EAAK,SAAW,EAAA,MAAA,CAAO,SACnB,EAAA,QAAA,EAAA;AAAA,QACG,KAAA,oBAAA,GAAA;AAAA,UAAC,IAAA;AAAA,UAAA;AAAA,YACG,UAAW,EAAA,qBAAA;AAAA,YACX,OAAO,MAAO,CAAA,UAAA;AAAA,YACd,QAAU,EAAA,CAAA;AAAA,YACV,SAAQ,EAAA,yBAAA;AAAA,YAEP,QAAA,EAAA,KAAA;AAAA,WAAA;AAAA,SACL;AAAA,QAEH,QACG,oBAAA,GAAA;AAAA,UAAC,IAAA;AAAA,UAAA;AAAA,YACG,UAAW,EAAA,iBAAA;AAAA,YACX,OAAO,MAAO,CAAA,IAAA;AAAA,YACd,QAAU,EAAA,CAAA;AAAA,YACV,SAAQ,EAAA,wBAAA;AAAA,YAEP,QAAA;AAAA,WAAA;AAAA,SACL;AAAA,OAER,EAAA,CAAA;AAAA,KACJ,EAAA,CAAA,CAAA;AAAA,GAER;AACJ,EAAA;AAEA,eAAA,CAAgB,WAAc,GAAA,iBAAA;;;;"}
|
package/Snippet.js
CHANGED
|
@@ -3,17 +3,30 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { useChatBubbleColors } from './internal/colors.js';
|
|
5
5
|
import { Text } from '@hh.ru/magritte-ui-typography';
|
|
6
|
-
import { s as styles } from './chat-bubble-
|
|
6
|
+
import { s as styles } from './chat-bubble-BOBGge0h.js';
|
|
7
7
|
import './internal/mode.js';
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*/
|
|
12
|
-
const ChatBubbleSnippetComponent = forwardRef(({ children, 'data-qa': dataQa = 'chat-bubble-snippet', message, subtitle, title, ...props }, ref) => {
|
|
9
|
+
const ChatBubbleSnippetComponent = forwardRef(
|
|
10
|
+
({ children, "data-qa": dataQa = "chat-bubble-snippet", message, subtitle, title, ...props }, ref) => {
|
|
13
11
|
const colors = useChatBubbleColors();
|
|
14
|
-
return
|
|
15
|
-
})
|
|
16
|
-
|
|
12
|
+
return /* @__PURE__ */ jsxs("div", { ...props, className: styles.snippet, "data-qa": dataQa, ref, children: [
|
|
13
|
+
title && /* @__PURE__ */ jsx(Text, { typography: "subtitle-3-semibold", style: colors.text, "data-qa": "chat-bubble-snippet-title", children: title }),
|
|
14
|
+
subtitle && /* @__PURE__ */ jsx(
|
|
15
|
+
Text,
|
|
16
|
+
{
|
|
17
|
+
typography: "subtitle-3-semibold",
|
|
18
|
+
style: colors.text,
|
|
19
|
+
maxLines: 2,
|
|
20
|
+
"data-qa": "chat-bubble-snippet-subtitle",
|
|
21
|
+
children: subtitle
|
|
22
|
+
}
|
|
23
|
+
),
|
|
24
|
+
message && /* @__PURE__ */ jsx(Text, { typography: "label-4-regular", style: colors.text, "data-qa": "chat-bubble-snippet-message", children: message }),
|
|
25
|
+
children
|
|
26
|
+
] });
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
ChatBubbleSnippetComponent.displayName = "ChatBubbleSnippet";
|
|
17
30
|
const ChatBubbleSnippet = ChatBubbleSnippetComponent;
|
|
18
31
|
|
|
19
32
|
export { ChatBubbleSnippet };
|
package/Snippet.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Snippet.js","sources":["src/Snippet.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\n\nimport { useChatBubbleColors } from '@hh.ru/magritte-ui-chat-bubble/internal/colors';\nimport { Text } from '@hh.ru/magritte-ui-typography';\n\nimport styles from './chat-bubble.less';\n\nexport interface ChatBubbleSnippetProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** Заголовок сниппета */\n title?: ReactNode;\n /** Подзаголовок сниппета */\n subtitle?: ReactNode;\n /** Описание под заголовками */\n message?: ReactNode;\n /** Содержимое под текстом (превью, карта, кастомный контент) */\n children?: ReactNode;\n /**\n * Значение data-qa\n * @default chat-bubble-snippet\n */\n 'data-qa'?: string;\n}\n\n/**\n * Сниппет: дополнительная информация к сообщению\n */\nconst ChatBubbleSnippetComponent = forwardRef<HTMLDivElement, ChatBubbleSnippetProps>(\n ({ children, 'data-qa': dataQa = 'chat-bubble-snippet', message, subtitle, title, ...props }, ref) => {\n const colors = useChatBubbleColors();\n\n return (\n <div {...props} className={styles.snippet} data-qa={dataQa} ref={ref}>\n {title && (\n <Text typography=\"subtitle-3-semibold\" style={colors.text} data-qa=\"chat-bubble-snippet-title\">\n {title}\n </Text>\n )}\n {subtitle && (\n <Text\n typography=\"subtitle-3-semibold\"\n style={colors.text}\n maxLines={2}\n data-qa=\"chat-bubble-snippet-subtitle\"\n >\n {subtitle}\n </Text>\n )}\n {message && (\n <Text typography=\"label-4-regular\" style={colors.text} data-qa=\"chat-bubble-snippet-message\">\n {message}\n </Text>\n )}\n {children}\n </div>\n );\n }\n);\n\nChatBubbleSnippetComponent.displayName = 'ChatBubbleSnippet';\n\nexport const ChatBubbleSnippet = ChatBubbleSnippetComponent;\n"],"names":[
|
|
1
|
+
{"version":3,"file":"Snippet.js","sources":["src/Snippet.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\n\nimport { useChatBubbleColors } from '@hh.ru/magritte-ui-chat-bubble/internal/colors';\nimport { Text } from '@hh.ru/magritte-ui-typography';\n\nimport styles from './chat-bubble.less';\n\nexport interface ChatBubbleSnippetProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** Заголовок сниппета */\n title?: ReactNode;\n /** Подзаголовок сниппета */\n subtitle?: ReactNode;\n /** Описание под заголовками */\n message?: ReactNode;\n /** Содержимое под текстом (превью, карта, кастомный контент) */\n children?: ReactNode;\n /**\n * Значение data-qa\n * @default chat-bubble-snippet\n */\n 'data-qa'?: string;\n}\n\n/**\n * Сниппет: дополнительная информация к сообщению\n */\nconst ChatBubbleSnippetComponent = forwardRef<HTMLDivElement, ChatBubbleSnippetProps>(\n ({ children, 'data-qa': dataQa = 'chat-bubble-snippet', message, subtitle, title, ...props }, ref) => {\n const colors = useChatBubbleColors();\n\n return (\n <div {...props} className={styles.snippet} data-qa={dataQa} ref={ref}>\n {title && (\n <Text typography=\"subtitle-3-semibold\" style={colors.text} data-qa=\"chat-bubble-snippet-title\">\n {title}\n </Text>\n )}\n {subtitle && (\n <Text\n typography=\"subtitle-3-semibold\"\n style={colors.text}\n maxLines={2}\n data-qa=\"chat-bubble-snippet-subtitle\"\n >\n {subtitle}\n </Text>\n )}\n {message && (\n <Text typography=\"label-4-regular\" style={colors.text} data-qa=\"chat-bubble-snippet-message\">\n {message}\n </Text>\n )}\n {children}\n </div>\n );\n }\n);\n\nChatBubbleSnippetComponent.displayName = 'ChatBubbleSnippet';\n\nexport const ChatBubbleSnippet = ChatBubbleSnippetComponent;\n"],"names":[],"mappings":";;;;;;;AA0BA,MAAM,0BAA6B,GAAA,UAAA;AAAA,EAC/B,CAAC,EAAE,QAAU,EAAA,SAAA,EAAW,MAAS,GAAA,qBAAA,EAAuB,OAAS,EAAA,QAAA,EAAU,KAAO,EAAA,GAAG,KAAM,EAAA,EAAG,GAAQ,KAAA;AAClG,IAAA,MAAM,SAAS,mBAAoB,EAAA,CAAA;AAEnC,IACI,uBAAA,IAAA,CAAC,SAAK,GAAG,KAAA,EAAO,WAAW,MAAO,CAAA,OAAA,EAAS,SAAS,EAAA,MAAA,EAAQ,GACvD,EAAA,QAAA,EAAA;AAAA,MACG,KAAA,oBAAA,GAAA,CAAC,QAAK,UAAW,EAAA,qBAAA,EAAsB,OAAO,MAAO,CAAA,IAAA,EAAM,SAAQ,EAAA,2BAAA,EAC9D,QACL,EAAA,KAAA,EAAA,CAAA;AAAA,MAEH,QACG,oBAAA,GAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACG,UAAW,EAAA,qBAAA;AAAA,UACX,OAAO,MAAO,CAAA,IAAA;AAAA,UACd,QAAU,EAAA,CAAA;AAAA,UACV,SAAQ,EAAA,8BAAA;AAAA,UAEP,QAAA,EAAA,QAAA;AAAA,SAAA;AAAA,OACL;AAAA,MAEH,OAAA,oBACI,GAAA,CAAA,IAAA,EAAA,EAAK,UAAW,EAAA,iBAAA,EAAkB,OAAO,MAAO,CAAA,IAAA,EAAM,SAAQ,EAAA,6BAAA,EAC1D,QACL,EAAA,OAAA,EAAA,CAAA;AAAA,MAEH,QAAA;AAAA,KACL,EAAA,CAAA,CAAA;AAAA,GAER;AACJ,CAAA,CAAA;AAEA,0BAAA,CAA2B,WAAc,GAAA,mBAAA,CAAA;AAElC,MAAM,iBAAoB,GAAA;;;;"}
|
package/Status.js
CHANGED
|
@@ -7,34 +7,43 @@ import { getColors } from './internal/colors.js';
|
|
|
7
7
|
import { useChatBubbleMode } from './internal/mode.js';
|
|
8
8
|
import { EyeOutlinedSize16, ClockOutlinedSize16, CheckOutlinedSize16, CheckDoubleOutlinedSize16, TrashOutlinedSize16 } from '@hh.ru/magritte-ui-icon/icon';
|
|
9
9
|
import { TooltipHover } from '@hh.ru/magritte-ui-tooltip';
|
|
10
|
-
import { s as styles } from './chat-bubble-
|
|
10
|
+
import { s as styles } from './chat-bubble-BOBGge0h.js';
|
|
11
11
|
|
|
12
12
|
const ICON = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
sending: ClockOutlinedSize16,
|
|
14
|
+
sent: CheckOutlinedSize16,
|
|
15
|
+
read: CheckDoubleOutlinedSize16,
|
|
16
|
+
deleted: TrashOutlinedSize16
|
|
17
17
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*/
|
|
21
|
-
const ChatBubbleStatus = forwardRef(({ children, 'data-qa': dataQa = 'chat-bubble-status', value = 'sending', ...tooltipProps }, ref) => {
|
|
18
|
+
const ChatBubbleStatus = forwardRef(
|
|
19
|
+
({ children, "data-qa": dataQa = "chat-bubble-status", value = "sending", ...tooltipProps }, ref) => {
|
|
22
20
|
const mode = useChatBubbleMode();
|
|
23
21
|
const colors = getColors(mode);
|
|
24
22
|
const activatorRef = useRef(null);
|
|
25
23
|
const activator = useMultipleRefs(ref, activatorRef);
|
|
26
|
-
const isBot = mode ===
|
|
27
|
-
const isDeleted = value ===
|
|
28
|
-
const label = useTranslation(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return null;
|
|
24
|
+
const isBot = mode === "bot";
|
|
25
|
+
const isDeleted = value === "deleted";
|
|
26
|
+
const label = useTranslation("ChatBubble", isBot ? "private" : value);
|
|
27
|
+
if (mode === "incoming" && !isDeleted) {
|
|
28
|
+
return null;
|
|
32
29
|
}
|
|
33
|
-
// у бота по макету всегда глаз, статус отправки к нему не применяется
|
|
34
30
|
const Icon = isBot ? EyeOutlinedSize16 : ICON[value];
|
|
35
|
-
return
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
32
|
+
/* @__PURE__ */ jsx(
|
|
33
|
+
"span",
|
|
34
|
+
{
|
|
35
|
+
ref: activator,
|
|
36
|
+
className: styles.status,
|
|
37
|
+
"data-qa": dataQa,
|
|
38
|
+
"data-status": isBot ? "private" : value,
|
|
39
|
+
children: /* @__PURE__ */ jsx(Icon, { initialColor: colors.statusIcon, "aria-label": label })
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
/* @__PURE__ */ jsx(TooltipHover, { ...tooltipProps, activatorRef, placement: "top-center", size: "small", children: children ?? label })
|
|
43
|
+
] });
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
ChatBubbleStatus.displayName = "ChatBubbleStatus";
|
|
38
47
|
|
|
39
48
|
export { ChatBubbleStatus };
|
|
40
49
|
//# sourceMappingURL=Status.js.map
|
package/Status.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Status.js","sources":["src/Status.tsx"],"sourcesContent":["import { forwardRef, useRef, type ReactNode } from 'react';\n\nimport { useMultipleRefs } from '@hh.ru/magritte-common-use-multiple-refs';\nimport { useTranslation } from '@hh.ru/magritte-common-use-translation';\nimport { getColors } from '@hh.ru/magritte-ui-chat-bubble/internal/colors';\nimport { useChatBubbleMode } from '@hh.ru/magritte-ui-chat-bubble/internal/mode';\nimport {\n CheckDoubleOutlinedSize16,\n CheckOutlinedSize16,\n ClockOutlinedSize16,\n EyeOutlinedSize16,\n TrashOutlinedSize16,\n} from '@hh.ru/magritte-ui-icon/icon';\nimport { TooltipHover, type TooltipHoverProps } from '@hh.ru/magritte-ui-tooltip';\n\nimport styles from './chat-bubble.less';\n\n/** Статус исходящего сообщения */\nexport type ChatBubbleStatusValue = 'sending' | 'sent' | 'read' | 'deleted';\n\nconst ICON = {\n sending: ClockOutlinedSize16,\n sent: CheckOutlinedSize16,\n read: CheckDoubleOutlinedSize16,\n deleted: TrashOutlinedSize16,\n} as const;\n\nexport interface ChatBubbleStatusProps extends Omit<\n TooltipHoverProps,\n 'activatorRef' | 'placement' | 'size' | 'children'\n> {\n /** Статус отправки. У сообщений от бота не используется — там всегда «видно только вам»\n * @default sending\n */\n value?: ChatBubbleStatusValue;\n /** Текст подсказки. По умолчанию берётся из словаря по статусу */\n children?: ReactNode;\n /** Значение data-qa\n * @default chat-bubble-status\n */\n 'data-qa'?: string;\n}\n\n/**\n * Статус сообщения: иконка и подсказка к ней.\n */\nexport const ChatBubbleStatus = forwardRef<HTMLSpanElement, ChatBubbleStatusProps>(\n ({ children, 'data-qa': dataQa = 'chat-bubble-status', value = 'sending', ...tooltipProps }, ref) => {\n const mode = useChatBubbleMode();\n const colors = getColors(mode);\n const activatorRef = useRef<HTMLSpanElement>(null);\n const activator = useMultipleRefs(ref, activatorRef);\n const isBot = mode === 'bot';\n const isDeleted = value === 'deleted';\n const label = useTranslation('ChatBubble', isBot ? 'private' : value);\n\n // пометка об удалении ставится у любого отправителя, остальные статусы — только у своих сообщений\n if (mode === 'incoming' && !isDeleted) {\n return null;\n }\n\n // у бота по макету всегда глаз, статус отправки к нему не применяется\n const Icon = isBot ? EyeOutlinedSize16 : ICON[value];\n\n return (\n <>\n <span\n ref={activator}\n className={styles.status}\n data-qa={dataQa}\n data-status={isBot ? 'private' : value}\n >\n <Icon initialColor={colors.statusIcon} aria-label={label} />\n </span>\n <TooltipHover {...tooltipProps} activatorRef={activatorRef} placement=\"top-center\" size=\"small\">\n {children ?? label}\n </TooltipHover>\n </>\n );\n }\n);\n\nChatBubbleStatus.displayName = 'ChatBubbleStatus';\n"],"names":[
|
|
1
|
+
{"version":3,"file":"Status.js","sources":["src/Status.tsx"],"sourcesContent":["import { forwardRef, useRef, type ReactNode } from 'react';\n\nimport { useMultipleRefs } from '@hh.ru/magritte-common-use-multiple-refs';\nimport { useTranslation } from '@hh.ru/magritte-common-use-translation';\nimport { getColors } from '@hh.ru/magritte-ui-chat-bubble/internal/colors';\nimport { useChatBubbleMode } from '@hh.ru/magritte-ui-chat-bubble/internal/mode';\nimport {\n CheckDoubleOutlinedSize16,\n CheckOutlinedSize16,\n ClockOutlinedSize16,\n EyeOutlinedSize16,\n TrashOutlinedSize16,\n} from '@hh.ru/magritte-ui-icon/icon';\nimport { TooltipHover, type TooltipHoverProps } from '@hh.ru/magritte-ui-tooltip';\n\nimport styles from './chat-bubble.less';\n\n/** Статус исходящего сообщения */\nexport type ChatBubbleStatusValue = 'sending' | 'sent' | 'read' | 'deleted';\n\nconst ICON = {\n sending: ClockOutlinedSize16,\n sent: CheckOutlinedSize16,\n read: CheckDoubleOutlinedSize16,\n deleted: TrashOutlinedSize16,\n} as const;\n\nexport interface ChatBubbleStatusProps extends Omit<\n TooltipHoverProps,\n 'activatorRef' | 'placement' | 'size' | 'children'\n> {\n /** Статус отправки. У сообщений от бота не используется — там всегда «видно только вам»\n * @default sending\n */\n value?: ChatBubbleStatusValue;\n /** Текст подсказки. По умолчанию берётся из словаря по статусу */\n children?: ReactNode;\n /** Значение data-qa\n * @default chat-bubble-status\n */\n 'data-qa'?: string;\n}\n\n/**\n * Статус сообщения: иконка и подсказка к ней.\n */\nexport const ChatBubbleStatus = forwardRef<HTMLSpanElement, ChatBubbleStatusProps>(\n ({ children, 'data-qa': dataQa = 'chat-bubble-status', value = 'sending', ...tooltipProps }, ref) => {\n const mode = useChatBubbleMode();\n const colors = getColors(mode);\n const activatorRef = useRef<HTMLSpanElement>(null);\n const activator = useMultipleRefs(ref, activatorRef);\n const isBot = mode === 'bot';\n const isDeleted = value === 'deleted';\n const label = useTranslation('ChatBubble', isBot ? 'private' : value);\n\n // пометка об удалении ставится у любого отправителя, остальные статусы — только у своих сообщений\n if (mode === 'incoming' && !isDeleted) {\n return null;\n }\n\n // у бота по макету всегда глаз, статус отправки к нему не применяется\n const Icon = isBot ? EyeOutlinedSize16 : ICON[value];\n\n return (\n <>\n <span\n ref={activator}\n className={styles.status}\n data-qa={dataQa}\n data-status={isBot ? 'private' : value}\n >\n <Icon initialColor={colors.statusIcon} aria-label={label} />\n </span>\n <TooltipHover {...tooltipProps} activatorRef={activatorRef} placement=\"top-center\" size=\"small\">\n {children ?? label}\n </TooltipHover>\n </>\n );\n }\n);\n\nChatBubbleStatus.displayName = 'ChatBubbleStatus';\n"],"names":[],"mappings":";;;;;;;;;;AAoBA,MAAM,IAAO,GAAA;AAAA,EACT,OAAS,EAAA,mBAAA;AAAA,EACT,IAAM,EAAA,mBAAA;AAAA,EACN,IAAM,EAAA,yBAAA;AAAA,EACN,OAAS,EAAA,mBAAA;AACb,CAAA,CAAA;AAqBO,MAAM,gBAAmB,GAAA,UAAA;AAAA,EAC5B,CAAC,EAAE,QAAA,EAAU,SAAW,EAAA,MAAA,GAAS,oBAAsB,EAAA,KAAA,GAAQ,SAAW,EAAA,GAAG,YAAa,EAAA,EAAG,GAAQ,KAAA;AACjG,IAAA,MAAM,OAAO,iBAAkB,EAAA,CAAA;AAC/B,IAAM,MAAA,MAAA,GAAS,UAAU,IAAI,CAAA,CAAA;AAC7B,IAAM,MAAA,YAAA,GAAe,OAAwB,IAAI,CAAA,CAAA;AACjD,IAAM,MAAA,SAAA,GAAY,eAAgB,CAAA,GAAA,EAAK,YAAY,CAAA,CAAA;AACnD,IAAA,MAAM,QAAQ,IAAS,KAAA,KAAA,CAAA;AACvB,IAAA,MAAM,YAAY,KAAU,KAAA,SAAA,CAAA;AAC5B,IAAA,MAAM,KAAQ,GAAA,cAAA,CAAe,YAAc,EAAA,KAAA,GAAQ,YAAY,KAAK,CAAA,CAAA;AAGpE,IAAI,IAAA,IAAA,KAAS,UAAc,IAAA,CAAC,SAAW,EAAA;AACnC,MAAO,OAAA,IAAA,CAAA;AAAA,KACX;AAGA,IAAA,MAAM,IAAO,GAAA,KAAA,GAAQ,iBAAoB,GAAA,IAAA,CAAK,KAAK,CAAA,CAAA;AAEnD,IAAA,uBAEQ,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,sBAAA,GAAA;AAAA,QAAC,MAAA;AAAA,QAAA;AAAA,UACG,GAAK,EAAA,SAAA;AAAA,UACL,WAAW,MAAO,CAAA,MAAA;AAAA,UAClB,SAAS,EAAA,MAAA;AAAA,UACT,aAAA,EAAa,QAAQ,SAAY,GAAA,KAAA;AAAA,UAEjC,8BAAC,IAAK,EAAA,EAAA,YAAA,EAAc,MAAO,CAAA,UAAA,EAAY,cAAY,KAAO,EAAA,CAAA;AAAA,SAAA;AAAA,OAC9D;AAAA,sBACA,GAAA,CAAC,YAAc,EAAA,EAAA,GAAG,YAAc,EAAA,YAAA,EAA4B,WAAU,YAAa,EAAA,IAAA,EAAK,OACnF,EAAA,QAAA,EAAA,QAAA,IAAY,KACjB,EAAA,CAAA;AAAA,KACJ,EAAA,CAAA,CAAA;AAAA,GAER;AACJ,EAAA;AAEA,gBAAA,CAAiB,WAAc,GAAA,kBAAA;;;;"}
|
package/Tail.js
CHANGED
|
@@ -2,14 +2,29 @@ import './index.css';
|
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { useChatBubbleMode } from './internal/mode.js';
|
|
5
|
-
import { s as styles } from './chat-bubble-
|
|
5
|
+
import { s as styles } from './chat-bubble-BOBGge0h.js';
|
|
6
6
|
import 'react';
|
|
7
7
|
|
|
8
|
-
const OUTLINE =
|
|
9
|
-
/** Хвост сообщения */
|
|
8
|
+
const OUTLINE = "M6.5 0C6.5 7.5 5.2 11.8 1.6 13.4C0.9 13.9 0.6 14.5 1.1 14.5H7";
|
|
10
9
|
const Tail = () => {
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const mode = useChatBubbleMode();
|
|
11
|
+
return /* @__PURE__ */ jsxs(
|
|
12
|
+
"svg",
|
|
13
|
+
{
|
|
14
|
+
className: classnames(styles.tail, { [styles.tailOutgoing]: mode === "outgoing" }),
|
|
15
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
16
|
+
width: "7",
|
|
17
|
+
height: "15",
|
|
18
|
+
viewBox: "0 0 7 15",
|
|
19
|
+
fill: "none",
|
|
20
|
+
"aria-hidden": true,
|
|
21
|
+
focusable: "false",
|
|
22
|
+
children: [
|
|
23
|
+
/* @__PURE__ */ jsx("path", { d: `${OUTLINE}V0Z`, fill: "var(--magritte-chat-bubble-background)" }),
|
|
24
|
+
/* @__PURE__ */ jsx("path", { d: OUTLINE, stroke: "var(--magritte-chat-bubble-border)", strokeWidth: "1" })
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
);
|
|
13
28
|
};
|
|
14
29
|
|
|
15
30
|
export { Tail };
|
package/Tail.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tail.js","sources":["src/Tail.tsx"],"sourcesContent":["import { type FC } from 'react';\nimport classnames from 'classnames';\n\nimport { useChatBubbleMode } from '@hh.ru/magritte-ui-chat-bubble/internal/mode';\n\nimport styles from './chat-bubble.less';\n\nconst OUTLINE = 'M6.5 0C6.5 7.5 5.2 11.8 1.6 13.4C0.9 13.9 0.6 14.5 1.1 14.5H7';\n\n/** Хвост сообщения */\nexport const Tail: FC = () => {\n const mode = useChatBubbleMode();\n\n return (\n <svg\n className={classnames(styles.tail, { [styles.tailOutgoing]: mode === 'outgoing' })}\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"7\"\n height=\"15\"\n viewBox=\"0 0 7 15\"\n fill=\"none\"\n aria-hidden\n focusable=\"false\"\n >\n {/* Заливка заходит под границу баббла и перекрывает её в месте стыка */}\n <path d={`${OUTLINE}V0Z`} fill=\"var(--magritte-chat-bubble-background)\" />\n <path d={OUTLINE} stroke=\"var(--magritte-chat-bubble-border)\" strokeWidth=\"1\" />\n </svg>\n );\n};\n"],"names":[
|
|
1
|
+
{"version":3,"file":"Tail.js","sources":["src/Tail.tsx"],"sourcesContent":["import { type FC } from 'react';\nimport classnames from 'classnames';\n\nimport { useChatBubbleMode } from '@hh.ru/magritte-ui-chat-bubble/internal/mode';\n\nimport styles from './chat-bubble.less';\n\nconst OUTLINE = 'M6.5 0C6.5 7.5 5.2 11.8 1.6 13.4C0.9 13.9 0.6 14.5 1.1 14.5H7';\n\n/** Хвост сообщения */\nexport const Tail: FC = () => {\n const mode = useChatBubbleMode();\n\n return (\n <svg\n className={classnames(styles.tail, { [styles.tailOutgoing]: mode === 'outgoing' })}\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"7\"\n height=\"15\"\n viewBox=\"0 0 7 15\"\n fill=\"none\"\n aria-hidden\n focusable=\"false\"\n >\n {/* Заливка заходит под границу баббла и перекрывает её в месте стыка */}\n <path d={`${OUTLINE}V0Z`} fill=\"var(--magritte-chat-bubble-background)\" />\n <path d={OUTLINE} stroke=\"var(--magritte-chat-bubble-border)\" strokeWidth=\"1\" />\n </svg>\n );\n};\n"],"names":[],"mappings":";;;;;;AAOA,MAAM,OAAU,GAAA,+DAAA,CAAA;AAGT,MAAM,OAAW,MAAM;AAC1B,EAAA,MAAM,OAAO,iBAAkB,EAAA,CAAA;AAE/B,EACI,uBAAA,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACG,SAAA,EAAW,UAAW,CAAA,MAAA,CAAO,IAAM,EAAA,EAAE,CAAC,MAAA,CAAO,YAAY,GAAG,IAAS,KAAA,UAAA,EAAY,CAAA;AAAA,MACjF,KAAM,EAAA,4BAAA;AAAA,MACN,KAAM,EAAA,GAAA;AAAA,MACN,MAAO,EAAA,IAAA;AAAA,MACP,OAAQ,EAAA,UAAA;AAAA,MACR,IAAK,EAAA,MAAA;AAAA,MACL,aAAW,EAAA,IAAA;AAAA,MACX,SAAU,EAAA,OAAA;AAAA,MAGV,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,UAAK,CAAG,EAAA,CAAA,EAAG,OAAO,CAAA,GAAA,CAAA,EAAO,MAAK,wCAAyC,EAAA,CAAA;AAAA,4BACvE,MAAK,EAAA,EAAA,CAAA,EAAG,SAAS,MAAO,EAAA,oCAAA,EAAqC,aAAY,GAAI,EAAA,CAAA;AAAA,OAAA;AAAA,KAAA;AAAA,GAClF,CAAA;AAER;;;;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import './index.css';
|
|
2
|
+
var styles = {"chat-bubble":"magritte-chat-bubble___ds9CP_3-0-7","chatBubble":"magritte-chat-bubble___ds9CP_3-0-7","outgoing":"magritte-outgoing___3n00o_3-0-7","bot":"magritte-bot___Z6vZA_3-0-7","row":"magritte-row___mQNnt_3-0-7","bubble":"magritte-bubble___NVuDI_3-0-7","with-tail":"magritte-with-tail___IdixJ_3-0-7","withTail":"magritte-with-tail___IdixJ_3-0-7","tail":"magritte-tail___E2hdk_3-0-7","tail-outgoing":"magritte-tail-outgoing___Pn3MI_3-0-7","tailOutgoing":"magritte-tail-outgoing___Pn3MI_3-0-7","buttons":"magritte-buttons___yQqBi_3-0-7","aside":"magritte-aside___bTex-_3-0-7","aside-revealed":"magritte-aside-revealed___CRBl7_3-0-7","asideRevealed":"magritte-aside-revealed___CRBl7_3-0-7","error-text":"magritte-error-text___1ZxWY_3-0-7","errorText":"magritte-error-text___1ZxWY_3-0-7","file":"magritte-file___k2IKy_3-0-7","file-preview":"magritte-file-preview___eJKu8_3-0-7","filePreview":"magritte-file-preview___eJKu8_3-0-7","media":"magritte-media___9jH2k_3-0-7","media-blur":"magritte-media-blur___TbiMa_3-0-7","mediaBlur":"magritte-media-blur___TbiMa_3-0-7","media-image":"magritte-media-image___G-FkF_3-0-7","mediaImage":"magritte-media-image___G-FkF_3-0-7","media-content":"magritte-media-content___n3XbD_3-0-7","mediaContent":"magritte-media-content___n3XbD_3-0-7","media-format":"magritte-media-format___AdfCK_3-0-7","mediaFormat":"magritte-media-format___AdfCK_3-0-7","media-meta":"magritte-media-meta___oSxxr_3-0-7","mediaMeta":"magritte-media-meta___oSxxr_3-0-7","reply":"magritte-reply___-QCK7_3-0-7","reply-preview":"magritte-reply-preview___qvlNT_3-0-7","replyPreview":"magritte-reply-preview___qvlNT_3-0-7","reply-body":"magritte-reply-body___f2xx7_3-0-7","replyBody":"magritte-reply-body___f2xx7_3-0-7","snippet":"magritte-snippet___8k9xb_3-0-7","meta":"magritte-meta___1qhjm_3-0-7","edited":"magritte-edited___m-zmB_3-0-7","status":"magritte-status___dHzCt_3-0-7","message-title":"magritte-message-title___dgBFk_3-0-7","messageTitle":"magritte-message-title___dgBFk_3-0-7","label":"magritte-label___i0Wyt_3-0-7","message":"magritte-message___7TEpw_3-0-7"};
|
|
3
|
+
|
|
4
|
+
export { styles as s };
|
|
5
|
+
//# sourceMappingURL=chat-bubble-BOBGge0h.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-bubble-BOBGge0h.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|