@hh.ru/magritte-ui-chat-bubble 1.7.0 → 2.0.0
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.js +1 -1
- package/ChatBubble.js +12 -7
- package/ChatBubble.js.map +1 -1
- package/File.js +1 -1
- package/Label.js +1 -1
- package/Media.js +1 -1
- package/Message.js +1 -1
- package/Meta.js +1 -1
- package/Reply.js +1 -1
- package/Snippet.js +1 -1
- package/Status.js +1 -1
- package/Tail.js +1 -1
- package/chat-bubble-C7c7YGmG.js +5 -0
- package/chat-bubble-C7c7YGmG.js.map +1 -0
- package/index.css +86 -67
- package/index.js +2 -2
- package/internal/colors.d.ts +0 -2
- package/internal/colors.js +0 -3
- package/internal/colors.js.map +1 -1
- package/package.json +3 -2
- package/types.d.ts +2 -2
- package/chat-bubble-LoILH1vk.js +0 -5
- package/chat-bubble-LoILH1vk.js.map +0 -1
package/Call.js
CHANGED
|
@@ -6,7 +6,7 @@ import { useChatBubbleColors } from './internal/colors.js';
|
|
|
6
6
|
import { useChatBubbleMode } from './internal/mode.js';
|
|
7
7
|
import { markMetaHost } from './internal/utils.js';
|
|
8
8
|
import { PhoneCrossFilledSize24, PhoneArrowOutFilledSize24, PhoneArrowInFilledSize24 } from '@hh.ru/magritte-ui-icon/icon';
|
|
9
|
-
import { s as styles } from './chat-bubble-
|
|
9
|
+
import { s as styles } from './chat-bubble-C7c7YGmG.js';
|
|
10
10
|
|
|
11
11
|
/** Входящий/исходящий звонок */
|
|
12
12
|
const ChatBubbleCallComponent = forwardRef(({ 'data-qa': dataQa = 'chat-bubble-call', title, description, meta, state = 'connected', ...props }, ref) => {
|
package/ChatBubble.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import { forwardRef, useState, useCallback,
|
|
3
|
+
import { forwardRef, useRef, useState, useCallback, useMemo, cloneElement } from 'react';
|
|
4
4
|
import classnames from 'classnames';
|
|
5
|
+
import { useCloseByClickOutside } from '@hh.ru/magritte-common-mouse';
|
|
5
6
|
import { ButtonDefaultPropsContext } from '@hh.ru/magritte-ui-button';
|
|
6
7
|
import { ChatBubbleCall } from './Call.js';
|
|
7
8
|
import { ChatBubbleErrorAction } from './ErrorAction.js';
|
|
@@ -18,11 +19,10 @@ import { getColors } from './internal/colors.js';
|
|
|
18
19
|
import { ChatBubbleErrorMenuProvider } from './internal/errorMenu.js';
|
|
19
20
|
import { ChatBubbleModeProvider } from './internal/mode.js';
|
|
20
21
|
import { flattenFragments, isMetaHost } from './internal/utils.js';
|
|
21
|
-
import { IconDefaultPropsContext } from '@hh.ru/magritte-ui-icon';
|
|
22
22
|
import { ExclamationCircleFilledSize24 } from '@hh.ru/magritte-ui-icon/icon';
|
|
23
23
|
import { Menu } from '@hh.ru/magritte-ui-menu';
|
|
24
24
|
import { Text } from '@hh.ru/magritte-ui-typography';
|
|
25
|
-
import { s as styles } from './chat-bubble-
|
|
25
|
+
import { s as styles } from './chat-bubble-C7c7YGmG.js';
|
|
26
26
|
import '@hh.ru/magritte-ui-cell';
|
|
27
27
|
import '@hh.ru/magritte-ui-link';
|
|
28
28
|
import '@hh.ru/magritte-ui-loader';
|
|
@@ -30,12 +30,17 @@ import '@hh.ru/magritte-common-use-translation';
|
|
|
30
30
|
import '@hh.ru/magritte-common-use-multiple-refs';
|
|
31
31
|
import '@hh.ru/magritte-ui-tooltip';
|
|
32
32
|
|
|
33
|
-
const ChatBubble = forwardRef(({
|
|
33
|
+
const ChatBubble = forwardRef(({ aside, buttons, children, header, edited, errorActions, mode = 'incoming', showTail = false, status, time, error = false, errorText, 'data-qa': dataQa = 'chat-bubble', className, }, ref) => {
|
|
34
|
+
const rowRef = useRef(null);
|
|
35
|
+
const activatorMenuRef = useRef(null);
|
|
34
36
|
const [menuVisible, setMenuVisible] = useState(false);
|
|
35
37
|
const closeErrorMenu = useCallback(() => setMenuVisible(false), []);
|
|
36
|
-
const
|
|
38
|
+
const [asideShow, setAsideShow] = useState(false);
|
|
39
|
+
const showAside = useCallback(() => setAsideShow(true), []);
|
|
40
|
+
const hideAside = useCallback(() => setAsideShow(false), []);
|
|
41
|
+
// скрываем aside при кликах вне
|
|
42
|
+
useCloseByClickOutside(rowRef, hideAside, asideShow);
|
|
37
43
|
const colors = getColors(mode);
|
|
38
|
-
const actionsIconProps = useMemo(() => ({ padding: 8, initialColor: colors.actionsIcon }), [colors]);
|
|
39
44
|
const buttonsProps = useMemo(() => ({ size: 'small', stretched: true, ...colors.button }), [colors]);
|
|
40
45
|
/**
|
|
41
46
|
* Время отдаём последнему элементу контента
|
|
@@ -49,7 +54,7 @@ const ChatBubble = forwardRef(({ actions, buttons, children, header, edited, err
|
|
|
49
54
|
const content = items.map((child, index) => index === lastIndex && isMetaHost(child) ? cloneElement(child, { meta }) : child);
|
|
50
55
|
return (jsx(ChatBubbleModeProvider, { value: mode, children: jsxs("div", { className: classnames(className, styles.chatBubble, styles[mode], {
|
|
51
56
|
[styles.withTail]: showTail,
|
|
52
|
-
}), "data-qa": dataQa, ref: ref, children: [jsxs("div", { className: styles.row, children: [jsxs("div", { className: styles.bubble, children: [header, content, !metaHosted && meta, showTail && jsx(Tail, {})] }), mode === 'outgoing' && error && (jsxs("div", { children: [jsx(ExclamationCircleFilledSize24, { ref: activatorMenuRef, initialColor: "negative", onClick: errorActions ? () => setMenuVisible((visible) => !visible) : undefined, "data-qa": "chat-bubble-error-button", "aria-haspopup": errorActions ? 'menu' : undefined, "aria-expanded": errorActions ? menuVisible : undefined }), errorActions && (jsx(Menu, { activatorRef: activatorMenuRef, onClose: closeErrorMenu, placement: "bottom-right", visible: menuVisible, children: jsx(ChatBubbleErrorMenuProvider, { value: closeErrorMenu, children: errorActions }) }))] }))] }), mode === 'outgoing' && error && errorText && (jsx("div", { className: styles.errorText, "data-qa": "chat-bubble-error-text", children: jsx(Text, { typography: "label-4-regular", style: "negative", maxLines: 2, children: errorText }) })), buttons && (jsx(ButtonDefaultPropsContext, { props: buttonsProps, children: jsx("div", { className: styles.buttons, "data-qa": "chat-bubble-buttons", children: buttons }) }))
|
|
57
|
+
}), "data-qa": dataQa, ref: ref, children: [jsxs("div", { className: styles.row, onMouseEnter: aside ? showAside : undefined, onMouseLeave: aside ? hideAside : undefined, onClick: aside ? showAside : undefined, ref: rowRef, children: [jsxs("div", { className: styles.bubble, children: [header, content, !metaHosted && meta, showTail && jsx(Tail, {})] }), mode === 'outgoing' && error && (jsxs("div", { children: [jsx(ExclamationCircleFilledSize24, { ref: activatorMenuRef, initialColor: "negative", onClick: errorActions ? () => setMenuVisible((visible) => !visible) : undefined, "data-qa": "chat-bubble-error-button", "aria-haspopup": errorActions ? 'menu' : undefined, "aria-expanded": errorActions ? menuVisible : undefined }), errorActions && (jsx(Menu, { activatorRef: activatorMenuRef, onClose: closeErrorMenu, placement: "bottom-right", visible: menuVisible, children: jsx(ChatBubbleErrorMenuProvider, { value: closeErrorMenu, children: errorActions }) }))] })), aside && (jsx("div", { className: classnames(styles.aside, { [styles.asideRevealed]: asideShow }), "data-qa": "chat-bubble-aside", children: aside }))] }), mode === 'outgoing' && error && errorText && (jsx("div", { className: styles.errorText, "data-qa": "chat-bubble-error-text", children: jsx(Text, { typography: "label-4-regular", style: "negative", maxLines: 2, children: errorText }) })), buttons && (jsx(ButtonDefaultPropsContext, { props: buttonsProps, children: jsx("div", { className: styles.buttons, "data-qa": "chat-bubble-buttons", children: buttons }) }))] }) }));
|
|
53
58
|
});
|
|
54
59
|
ChatBubble.displayName = 'ChatBubble';
|
|
55
60
|
ChatBubble.Call = ChatBubbleCall;
|
package/ChatBubble.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatBubble.js","sources":["src/ChatBubble.tsx"],"sourcesContent":["import { cloneElement, forwardRef, useCallback, useState, useMemo, useRef } from 'react';\nimport classnames from 'classnames';\n\nimport { ButtonDefaultPropsContext, type ButtonProps } from '@hh.ru/magritte-ui-button';\nimport { ChatBubbleCall } from '@hh.ru/magritte-ui-chat-bubble/Call';\nimport { ChatBubbleErrorAction } from '@hh.ru/magritte-ui-chat-bubble/ErrorAction';\nimport { ChatBubbleFile } from '@hh.ru/magritte-ui-chat-bubble/File';\nimport { ChatBubbleLabel } from '@hh.ru/magritte-ui-chat-bubble/Label';\nimport { ChatBubbleMedia } from '@hh.ru/magritte-ui-chat-bubble/Media';\nimport { ChatBubbleMessage } from '@hh.ru/magritte-ui-chat-bubble/Message';\nimport { Meta } from '@hh.ru/magritte-ui-chat-bubble/Meta';\nimport { ChatBubbleReply } from '@hh.ru/magritte-ui-chat-bubble/Reply';\nimport { ChatBubbleSnippet } from '@hh.ru/magritte-ui-chat-bubble/Snippet';\nimport { ChatBubbleStatus } from '@hh.ru/magritte-ui-chat-bubble/Status';\nimport { Tail } from '@hh.ru/magritte-ui-chat-bubble/Tail';\nimport { getColors } from '@hh.ru/magritte-ui-chat-bubble/internal/colors';\nimport { ChatBubbleErrorMenuProvider } from '@hh.ru/magritte-ui-chat-bubble/internal/errorMenu';\nimport { ChatBubbleModeProvider } from '@hh.ru/magritte-ui-chat-bubble/internal/mode';\nimport { isMetaHost, flattenFragments } from '@hh.ru/magritte-ui-chat-bubble/internal/utils';\nimport type { ChatBubbleProps } from '@hh.ru/magritte-ui-chat-bubble/types';\nimport { IconDefaultPropsContext, type IconProps } from '@hh.ru/magritte-ui-icon';\nimport { ExclamationCircleFilledSize24 } from '@hh.ru/magritte-ui-icon/icon';\nimport { Menu } from '@hh.ru/magritte-ui-menu';\nimport { Text } from '@hh.ru/magritte-ui-typography';\n\nimport styles from './chat-bubble.less';\n\ninterface ChatBubbleComponents {\n Call: typeof ChatBubbleCall;\n ErrorAction: typeof ChatBubbleErrorAction;\n File: typeof ChatBubbleFile;\n Label: typeof ChatBubbleLabel;\n Media: typeof ChatBubbleMedia;\n Message: typeof ChatBubbleMessage;\n Reply: typeof ChatBubbleReply;\n Snippet: typeof ChatBubbleSnippet;\n Status: typeof ChatBubbleStatus;\n}\n\nexport const ChatBubble = forwardRef<HTMLDivElement, ChatBubbleProps>(\n (\n {\n actions,\n buttons,\n children,\n header,\n edited,\n errorActions,\n mode = 'incoming',\n showTail = false,\n status,\n time,\n error = false,\n errorText,\n 'data-qa': dataQa = 'chat-bubble',\n className,\n },\n ref\n ) => {\n const [menuVisible, setMenuVisible] = useState(false);\n const closeErrorMenu = useCallback(() => setMenuVisible(false), []);\n const activatorMenuRef = useRef<SVGElement>(null);\n const colors = getColors(mode);\n const actionsIconProps: Partial<IconProps> = useMemo(\n () => ({ padding: 8, initialColor: colors.actionsIcon }),\n [colors]\n );\n const buttonsProps: Partial<ButtonProps> = useMemo(\n () => ({ size: 'small', stretched: true, ...colors.button }),\n [colors]\n );\n /**\n * Время отдаём последнему элементу контента\n * Позиция времени меняется, в зависимости от компонента\n * Если последний ребенок не может отрисовать, вставим meta в самый конец\n */\n const meta = <Meta mode={mode} status={status} time={time} edited={edited} />;\n const items = flattenFragments(children);\n const lastIndex = items.length - 1;\n const metaHosted = isMetaHost(items[lastIndex]);\n const content = items.map((child, index) =>\n index === lastIndex && isMetaHost(child) ? cloneElement(child, { meta }) : child\n );\n return (\n <ChatBubbleModeProvider value={mode}>\n <div\n className={classnames(className, styles.chatBubble, styles[mode], {\n [styles.withTail]: showTail,\n })}\n data-qa={dataQa}\n ref={ref}\n >\n <div className={styles.row}>\n <div className={styles.bubble}>\n {header}\n {content}\n {!metaHosted && meta}\n {showTail && <Tail />}\n </div>\n {mode === 'outgoing' && error && (\n <div>\n <ExclamationCircleFilledSize24\n ref={activatorMenuRef}\n initialColor=\"negative\"\n onClick={errorActions ? () => setMenuVisible((visible) => !visible) : undefined}\n data-qa=\"chat-bubble-error-button\"\n aria-haspopup={errorActions ? 'menu' : undefined}\n aria-expanded={errorActions ? menuVisible : undefined}\n />\n {errorActions && (\n <Menu\n activatorRef={activatorMenuRef}\n onClose={closeErrorMenu}\n placement=\"bottom-right\"\n visible={menuVisible}\n >\n <ChatBubbleErrorMenuProvider value={closeErrorMenu}>\n {errorActions}\n </ChatBubbleErrorMenuProvider>\n </Menu>\n )}\n </div>\n )}\n </div>\n {mode === 'outgoing' && error && errorText && (\n <div className={styles.errorText} data-qa=\"chat-bubble-error-text\">\n <Text typography=\"label-4-regular\" style=\"negative\" maxLines={2}>\n {errorText}\n </Text>\n </div>\n )}\n {buttons && (\n <ButtonDefaultPropsContext props={buttonsProps}>\n <div className={styles.buttons} data-qa=\"chat-bubble-buttons\">\n {buttons}\n </div>\n </ButtonDefaultPropsContext>\n )}\n {actions && (\n <IconDefaultPropsContext props={actionsIconProps}>\n <div className={styles.actions} data-qa=\"chat-bubble-actions\">\n {actions}\n </div>\n </IconDefaultPropsContext>\n )}\n </div>\n </ChatBubbleModeProvider>\n );\n }\n) as React.ForwardRefExoticComponent<ChatBubbleProps & React.RefAttributes<HTMLDivElement>> & ChatBubbleComponents;\n\nChatBubble.displayName = 'ChatBubble';\n\nChatBubble.Call = ChatBubbleCall;\nChatBubble.ErrorAction = ChatBubbleErrorAction;\nChatBubble.File = ChatBubbleFile;\nChatBubble.Label = ChatBubbleLabel;\nChatBubble.Media = ChatBubbleMedia;\nChatBubble.Message = ChatBubbleMessage;\nChatBubble.Reply = ChatBubbleReply;\nChatBubble.Snippet = ChatBubbleSnippet;\nChatBubble.Status = ChatBubbleStatus;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAuCa,UAAU,GAAG,UAAU,CAChC,CACI,EACI,OAAO,EACP,OAAO,EACP,QAAQ,EACR,MAAM,EACN,MAAM,EACN,YAAY,EACZ,IAAI,GAAG,UAAU,EACjB,QAAQ,GAAG,KAAK,EAChB,MAAM,EACN,IAAI,EACJ,KAAK,GAAG,KAAK,EACb,SAAS,EACT,SAAS,EAAE,MAAM,GAAG,aAAa,EACjC,SAAS,GACZ,EACD,GAAG,KACH;IACA,MAAM,CAAC,WAA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C,UAAU,CAAC,MAAM,GAAG,gBAAgB;;;;"}
|
|
1
|
+
{"version":3,"file":"ChatBubble.js","sources":["src/ChatBubble.tsx"],"sourcesContent":["import { cloneElement, forwardRef, useCallback, useState, useMemo, useRef } from 'react';\nimport classnames from 'classnames';\n\nimport { useCloseByClickOutside } from '@hh.ru/magritte-common-mouse';\nimport { ButtonDefaultPropsContext, type ButtonProps } from '@hh.ru/magritte-ui-button';\nimport { ChatBubbleCall } from '@hh.ru/magritte-ui-chat-bubble/Call';\nimport { ChatBubbleErrorAction } from '@hh.ru/magritte-ui-chat-bubble/ErrorAction';\nimport { ChatBubbleFile } from '@hh.ru/magritte-ui-chat-bubble/File';\nimport { ChatBubbleLabel } from '@hh.ru/magritte-ui-chat-bubble/Label';\nimport { ChatBubbleMedia } from '@hh.ru/magritte-ui-chat-bubble/Media';\nimport { ChatBubbleMessage } from '@hh.ru/magritte-ui-chat-bubble/Message';\nimport { Meta } from '@hh.ru/magritte-ui-chat-bubble/Meta';\nimport { ChatBubbleReply } from '@hh.ru/magritte-ui-chat-bubble/Reply';\nimport { ChatBubbleSnippet } from '@hh.ru/magritte-ui-chat-bubble/Snippet';\nimport { ChatBubbleStatus } from '@hh.ru/magritte-ui-chat-bubble/Status';\nimport { Tail } from '@hh.ru/magritte-ui-chat-bubble/Tail';\nimport { getColors } from '@hh.ru/magritte-ui-chat-bubble/internal/colors';\nimport { ChatBubbleErrorMenuProvider } from '@hh.ru/magritte-ui-chat-bubble/internal/errorMenu';\nimport { ChatBubbleModeProvider } from '@hh.ru/magritte-ui-chat-bubble/internal/mode';\nimport { isMetaHost, flattenFragments } from '@hh.ru/magritte-ui-chat-bubble/internal/utils';\nimport type { ChatBubbleProps } from '@hh.ru/magritte-ui-chat-bubble/types';\nimport { ExclamationCircleFilledSize24 } from '@hh.ru/magritte-ui-icon/icon';\nimport { Menu } from '@hh.ru/magritte-ui-menu';\nimport { Text } from '@hh.ru/magritte-ui-typography';\n\nimport styles from './chat-bubble.less';\n\ninterface ChatBubbleComponents {\n Call: typeof ChatBubbleCall;\n ErrorAction: typeof ChatBubbleErrorAction;\n File: typeof ChatBubbleFile;\n Label: typeof ChatBubbleLabel;\n Media: typeof ChatBubbleMedia;\n Message: typeof ChatBubbleMessage;\n Reply: typeof ChatBubbleReply;\n Snippet: typeof ChatBubbleSnippet;\n Status: typeof ChatBubbleStatus;\n}\n\nexport const ChatBubble = forwardRef<HTMLDivElement, ChatBubbleProps>(\n (\n {\n aside,\n buttons,\n children,\n header,\n edited,\n errorActions,\n mode = 'incoming',\n showTail = false,\n status,\n time,\n error = false,\n errorText,\n 'data-qa': dataQa = 'chat-bubble',\n className,\n },\n ref\n ) => {\n const rowRef = useRef<HTMLDivElement>(null);\n const activatorMenuRef = useRef<SVGElement>(null);\n\n const [menuVisible, setMenuVisible] = useState(false);\n const closeErrorMenu = useCallback(() => setMenuVisible(false), []);\n\n const [asideShow, setAsideShow] = useState(false);\n const showAside = useCallback(() => setAsideShow(true), []);\n const hideAside = useCallback(() => setAsideShow(false), []);\n\n // скрываем aside при кликах вне\n useCloseByClickOutside(rowRef, hideAside, asideShow);\n\n const colors = getColors(mode);\n const buttonsProps: Partial<ButtonProps> = useMemo(\n () => ({ size: 'small', stretched: true, ...colors.button }),\n [colors]\n );\n /**\n * Время отдаём последнему элементу контента\n * Позиция времени меняется, в зависимости от компонента\n * Если последний ребенок не может отрисовать, вставим meta в самый конец\n */\n const meta = <Meta mode={mode} status={status} time={time} edited={edited} />;\n const items = flattenFragments(children);\n const lastIndex = items.length - 1;\n const metaHosted = isMetaHost(items[lastIndex]);\n const content = items.map((child, index) =>\n index === lastIndex && isMetaHost(child) ? cloneElement(child, { meta }) : child\n );\n return (\n <ChatBubbleModeProvider value={mode}>\n <div\n className={classnames(className, styles.chatBubble, styles[mode], {\n [styles.withTail]: showTail,\n })}\n data-qa={dataQa}\n ref={ref}\n >\n <div\n className={styles.row}\n onMouseEnter={aside ? showAside : undefined}\n onMouseLeave={aside ? hideAside : undefined}\n onClick={aside ? showAside : undefined}\n ref={rowRef}\n >\n <div className={styles.bubble}>\n {header}\n {content}\n {!metaHosted && meta}\n {showTail && <Tail />}\n </div>\n {mode === 'outgoing' && error && (\n <div>\n <ExclamationCircleFilledSize24\n ref={activatorMenuRef}\n initialColor=\"negative\"\n onClick={errorActions ? () => setMenuVisible((visible) => !visible) : undefined}\n data-qa=\"chat-bubble-error-button\"\n aria-haspopup={errorActions ? 'menu' : undefined}\n aria-expanded={errorActions ? menuVisible : undefined}\n />\n {errorActions && (\n <Menu\n activatorRef={activatorMenuRef}\n onClose={closeErrorMenu}\n placement=\"bottom-right\"\n visible={menuVisible}\n >\n <ChatBubbleErrorMenuProvider value={closeErrorMenu}>\n {errorActions}\n </ChatBubbleErrorMenuProvider>\n </Menu>\n )}\n </div>\n )}\n {aside && (\n <div\n className={classnames(styles.aside, { [styles.asideRevealed]: asideShow })}\n data-qa=\"chat-bubble-aside\"\n >\n {aside}\n </div>\n )}\n </div>\n {mode === 'outgoing' && error && errorText && (\n <div className={styles.errorText} data-qa=\"chat-bubble-error-text\">\n <Text typography=\"label-4-regular\" style=\"negative\" maxLines={2}>\n {errorText}\n </Text>\n </div>\n )}\n {buttons && (\n <ButtonDefaultPropsContext props={buttonsProps}>\n <div className={styles.buttons} data-qa=\"chat-bubble-buttons\">\n {buttons}\n </div>\n </ButtonDefaultPropsContext>\n )}\n </div>\n </ChatBubbleModeProvider>\n );\n }\n) as React.ForwardRefExoticComponent<ChatBubbleProps & React.RefAttributes<HTMLDivElement>> & ChatBubbleComponents;\n\nChatBubble.displayName = 'ChatBubble';\n\nChatBubble.Call = ChatBubbleCall;\nChatBubble.ErrorAction = ChatBubbleErrorAction;\nChatBubble.File = ChatBubbleFile;\nChatBubble.Label = ChatBubbleLabel;\nChatBubble.Media = ChatBubbleMedia;\nChatBubble.Message = ChatBubbleMessage;\nChatBubble.Reply = ChatBubbleReply;\nChatBubble.Snippet = ChatBubbleSnippet;\nChatBubble.Status = Chat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A,CAAC,IAAI,EAAC,EAAA,UAAU,EAAC,iBAAiB,EAAC,KAAK,EAAC,UAAU,EAAC,QAAQ,EAAE,CAAC,EAAA,QAAA,EAC1D,SAAS,EAAA,CACP,EACL,CAAA,CACT,EACA,OAAO,KACJA,GAAC,CAAA,yBAAyB,EAAC,EAAA,KAAK,EAAE,YAAY,EAAA,QAAA,EAC1CA,GAAK,CAAA,KAAA,EAAA,EAAA,SAAS,EAAE,MAAM,CAAC,OAAO,aAAU,qBAAqB,EAAA,QAAA,EACxD,OAAO,EAAA,CACN,EACkB,CAAA,CAC/B,CACC,EAAA,CAAA,EAAA,CACe,EAC3B;AACN,CAAC,EAC8G;AAEnH,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC;AAEtC,UAAU,CAAC,IAAI,GAAG,cAAc,CAAC;AACjC,UAAU,CAAC,WAAW,GAAG,qBAAqB,CAAC;AAC/C,UAAU,CAAC,IAAI,GAAG,cAAc,CAAC;AACjC,UAAU,CAAC,KAAK,GAAG,eAAe,CAAC;AACnC,UAAU,CAAC,KAAK,GAAG,eAAe,CAAC;AACnC,UAAU,CAAC,OAAO,GAAG,iBAAiB,CAAC;AACvC,UAAU,CAAC,KAAK,GAAG,eAAe,CAAC;AACnC,UAAU,CAAC,OAAO,GAAG,iBAAiB,CAAC;AACvC,UAAU,CAAC,MAAM,GAAG,gBAAgB;;;;"}
|
package/File.js
CHANGED
|
@@ -7,7 +7,7 @@ import { markMetaHost } from './internal/utils.js';
|
|
|
7
7
|
import { ExclamationTriangleOutlinedSize16, ArrowDownLineOutlinedSize24, DocumentOutlinedSize24 } from '@hh.ru/magritte-ui-icon/icon';
|
|
8
8
|
import { LinkDefaultPropsContext } from '@hh.ru/magritte-ui-link';
|
|
9
9
|
import { Loader } from '@hh.ru/magritte-ui-loader';
|
|
10
|
-
import { s as styles } from './chat-bubble-
|
|
10
|
+
import { s as styles } from './chat-bubble-C7c7YGmG.js';
|
|
11
11
|
import './internal/mode.js';
|
|
12
12
|
|
|
13
13
|
/** Прикреплённый файл */
|
package/Label.js
CHANGED
|
@@ -3,7 +3,7 @@ import { 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-C7c7YGmG.js';
|
|
7
7
|
import './internal/mode.js';
|
|
8
8
|
|
|
9
9
|
/**
|
package/Media.js
CHANGED
|
@@ -3,7 +3,7 @@ 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-C7c7YGmG.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Медиа в сообщении
|
package/Message.js
CHANGED
|
@@ -4,7 +4,7 @@ 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-C7c7YGmG.js';
|
|
8
8
|
import './internal/mode.js';
|
|
9
9
|
|
|
10
10
|
/**
|
package/Meta.js
CHANGED
|
@@ -3,7 +3,7 @@ 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-C7c7YGmG.js';
|
|
7
7
|
import './internal/mode.js';
|
|
8
8
|
import 'react';
|
|
9
9
|
|
package/Reply.js
CHANGED
|
@@ -3,7 +3,7 @@ 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-C7c7YGmG.js';
|
|
7
7
|
import './internal/mode.js';
|
|
8
8
|
|
|
9
9
|
/**
|
package/Snippet.js
CHANGED
|
@@ -3,7 +3,7 @@ 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-C7c7YGmG.js';
|
|
7
7
|
import './internal/mode.js';
|
|
8
8
|
|
|
9
9
|
/**
|
package/Status.js
CHANGED
|
@@ -7,7 +7,7 @@ import { getColors } from './internal/colors.js';
|
|
|
7
7
|
import { useChatBubbleMode } from './internal/mode.js';
|
|
8
8
|
import { EyeOutlinedSize16, ClockOutlinedSize16, CheckOutlinedSize16, CheckDoubleOutlinedSize16 } 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-C7c7YGmG.js';
|
|
11
11
|
|
|
12
12
|
const ICON = {
|
|
13
13
|
sending: ClockOutlinedSize16,
|
package/Tail.js
CHANGED
|
@@ -2,7 +2,7 @@ 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-C7c7YGmG.js';
|
|
6
6
|
import 'react';
|
|
7
7
|
|
|
8
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';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import './index.css';
|
|
2
|
+
var styles = {"chat-bubble":"magritte-chat-bubble___ds9CP_2-0-0","chatBubble":"magritte-chat-bubble___ds9CP_2-0-0","outgoing":"magritte-outgoing___3n00o_2-0-0","bot":"magritte-bot___Z6vZA_2-0-0","row":"magritte-row___mQNnt_2-0-0","bubble":"magritte-bubble___NVuDI_2-0-0","with-tail":"magritte-with-tail___IdixJ_2-0-0","withTail":"magritte-with-tail___IdixJ_2-0-0","tail":"magritte-tail___E2hdk_2-0-0","tail-outgoing":"magritte-tail-outgoing___Pn3MI_2-0-0","tailOutgoing":"magritte-tail-outgoing___Pn3MI_2-0-0","buttons":"magritte-buttons___yQqBi_2-0-0","aside":"magritte-aside___bTex-_2-0-0","aside-revealed":"magritte-aside-revealed___CRBl7_2-0-0","asideRevealed":"magritte-aside-revealed___CRBl7_2-0-0","error-text":"magritte-error-text___1ZxWY_2-0-0","errorText":"magritte-error-text___1ZxWY_2-0-0","file":"magritte-file___k2IKy_2-0-0","file-preview":"magritte-file-preview___eJKu8_2-0-0","filePreview":"magritte-file-preview___eJKu8_2-0-0","media":"magritte-media___9jH2k_2-0-0","media-blur":"magritte-media-blur___TbiMa_2-0-0","mediaBlur":"magritte-media-blur___TbiMa_2-0-0","media-image":"magritte-media-image___G-FkF_2-0-0","mediaImage":"magritte-media-image___G-FkF_2-0-0","media-content":"magritte-media-content___n3XbD_2-0-0","mediaContent":"magritte-media-content___n3XbD_2-0-0","media-format":"magritte-media-format___AdfCK_2-0-0","mediaFormat":"magritte-media-format___AdfCK_2-0-0","media-meta":"magritte-media-meta___oSxxr_2-0-0","mediaMeta":"magritte-media-meta___oSxxr_2-0-0","reply":"magritte-reply___-QCK7_2-0-0","reply-preview":"magritte-reply-preview___qvlNT_2-0-0","replyPreview":"magritte-reply-preview___qvlNT_2-0-0","reply-body":"magritte-reply-body___f2xx7_2-0-0","replyBody":"magritte-reply-body___f2xx7_2-0-0","snippet":"magritte-snippet___8k9xb_2-0-0","meta":"magritte-meta___1qhjm_2-0-0","edited":"magritte-edited___m-zmB_2-0-0","status":"magritte-status___dHzCt_2-0-0","message-title":"magritte-message-title___dgBFk_2-0-0","messageTitle":"magritte-message-title___dgBFk_2-0-0","label":"magritte-label___i0Wyt_2-0-0","message":"magritte-message___7TEpw_2-0-0"};
|
|
3
|
+
|
|
4
|
+
export { styles as s };
|
|
5
|
+
//# sourceMappingURL=chat-bubble-C7c7YGmG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-bubble-C7c7YGmG.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
package/index.css
CHANGED
|
@@ -16,6 +16,10 @@
|
|
|
16
16
|
--magritte-color-component-chat-bubble-snippet-line-bot-v25-0-1:#9054ea;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
:root{
|
|
20
|
+
--magritte-semantic-animation-time-s-duration-v25-0-1:200ms;
|
|
21
|
+
}
|
|
22
|
+
|
|
19
23
|
.magritte-night-theme{
|
|
20
24
|
--magritte-color-component-chat-bubble-background-incoming-v25-0-1:#262626;
|
|
21
25
|
--magritte-color-component-chat-bubble-background-outgoing-v25-0-1:#2b7fff;
|
|
@@ -34,7 +38,7 @@
|
|
|
34
38
|
--magritte-color-component-chat-bubble-snippet-background-outgoing-v25-0-1:#90ACC1;
|
|
35
39
|
--magritte-color-component-chat-bubble-snippet-line-incoming-v25-0-1:#557B96;
|
|
36
40
|
}
|
|
37
|
-
.magritte-chat-
|
|
41
|
+
.magritte-chat-bubble___ds9CP_2-0-0{
|
|
38
42
|
--magritte-chat-bubble-background:var(--magritte-color-component-chat-bubble-background-incoming-v25-0-1);
|
|
39
43
|
--magritte-chat-bubble-border:var(--magritte-color-component-chat-bubble-border-incoming-v25-0-1);
|
|
40
44
|
--magritte-chat-bubble-snippet-background:var(--magritte-color-component-chat-bubble-snippet-background-incoming-v25-0-1);
|
|
@@ -45,16 +49,16 @@
|
|
|
45
49
|
max-width:calc(100% - 40px);
|
|
46
50
|
}
|
|
47
51
|
@media (min-width: 1020px){
|
|
48
|
-
body.magritte-old-layout .magritte-chat-
|
|
52
|
+
body.magritte-old-layout .magritte-chat-bubble___ds9CP_2-0-0{
|
|
49
53
|
max-width:min(460px, 100%);
|
|
50
54
|
}
|
|
51
55
|
}
|
|
52
56
|
@media (min-width: 1024px){
|
|
53
|
-
body:not(.magritte-old-layout) .magritte-chat-
|
|
57
|
+
body:not(.magritte-old-layout) .magritte-chat-bubble___ds9CP_2-0-0{
|
|
54
58
|
max-width:min(460px, 100%);
|
|
55
59
|
}
|
|
56
60
|
}
|
|
57
|
-
.magritte-
|
|
61
|
+
.magritte-outgoing___3n00o_2-0-0{
|
|
58
62
|
--magritte-chat-bubble-background:var(--magritte-color-component-chat-bubble-background-outgoing-v25-0-1);
|
|
59
63
|
--magritte-chat-bubble-border:var(--magritte-color-component-chat-bubble-border-outgoing-v25-0-1);
|
|
60
64
|
--magritte-chat-bubble-snippet-background:var(--magritte-color-component-chat-bubble-snippet-background-outgoing-v25-0-1);
|
|
@@ -62,19 +66,20 @@
|
|
|
62
66
|
align-items:flex-end;
|
|
63
67
|
margin-left:auto;
|
|
64
68
|
}
|
|
65
|
-
.magritte-
|
|
69
|
+
.magritte-bot___Z6vZA_2-0-0{
|
|
66
70
|
--magritte-chat-bubble-background:var(--magritte-color-component-chat-bubble-background-bot-v25-0-1);
|
|
67
71
|
--magritte-chat-bubble-border:var(--magritte-color-component-chat-bubble-border-bot-v25-0-1);
|
|
68
72
|
--magritte-chat-bubble-snippet-background:var(--magritte-color-component-chat-bubble-snippet-background-bot-v25-0-1);
|
|
69
73
|
--magritte-chat-bubble-snippet-line:var(--magritte-color-component-chat-bubble-snippet-line-bot-v25-0-1);
|
|
70
74
|
}
|
|
71
|
-
.magritte-
|
|
75
|
+
.magritte-row___mQNnt_2-0-0{
|
|
72
76
|
display:flex;
|
|
77
|
+
position:relative;
|
|
73
78
|
align-items:flex-end;
|
|
74
79
|
gap:8px;
|
|
75
80
|
max-width:100%;
|
|
76
81
|
}
|
|
77
|
-
.magritte-
|
|
82
|
+
.magritte-bubble___NVuDI_2-0-0{
|
|
78
83
|
position:relative;
|
|
79
84
|
box-sizing:border-box;
|
|
80
85
|
min-width:0;
|
|
@@ -85,54 +90,68 @@
|
|
|
85
90
|
border-radius:20px;
|
|
86
91
|
overflow-wrap:break-word;
|
|
87
92
|
}
|
|
88
|
-
.magritte-with-
|
|
93
|
+
.magritte-with-tail___IdixJ_2-0-0 .magritte-bubble___NVuDI_2-0-0{
|
|
89
94
|
border-bottom-left-radius:0;
|
|
90
95
|
}
|
|
91
|
-
.magritte-with-
|
|
96
|
+
.magritte-with-tail___IdixJ_2-0-0.magritte-outgoing___3n00o_2-0-0 .magritte-bubble___NVuDI_2-0-0{
|
|
92
97
|
border-bottom-left-radius:20px;
|
|
93
98
|
border-bottom-right-radius:0;
|
|
94
99
|
}
|
|
95
|
-
.magritte-
|
|
100
|
+
.magritte-tail___E2hdk_2-0-0{
|
|
96
101
|
position:absolute;
|
|
97
102
|
bottom:-1px;
|
|
98
103
|
left:-7px;
|
|
99
104
|
}
|
|
100
|
-
.magritte-tail-
|
|
105
|
+
.magritte-tail-outgoing___Pn3MI_2-0-0{
|
|
101
106
|
left:auto;
|
|
102
107
|
right:-7px;
|
|
103
108
|
transform:scaleX(-1);
|
|
104
109
|
}
|
|
105
|
-
.magritte-
|
|
110
|
+
.magritte-buttons___yQqBi_2-0-0{
|
|
106
111
|
display:grid;
|
|
107
112
|
grid-template-columns:repeat(2, 1fr);
|
|
108
113
|
gap:8px;
|
|
109
114
|
width:100%;
|
|
110
115
|
margin-top:4px;
|
|
111
116
|
}
|
|
112
|
-
.magritte-
|
|
113
|
-
grid-column:span 2;
|
|
114
|
-
}
|
|
115
|
-
.magritte-actions___I5GSz_1-7-0{
|
|
117
|
+
.magritte-aside___bTex-_2-0-0{
|
|
116
118
|
display:flex;
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
position:absolute;
|
|
120
|
+
top:0;
|
|
121
|
+
bottom:0;
|
|
122
|
+
left:100%;
|
|
123
|
+
align-items:flex-start;
|
|
124
|
+
padding-left:8px;
|
|
125
|
+
opacity:0;
|
|
126
|
+
transition:opacity var(--magritte-semantic-animation-time-s-duration-v25-0-1) ease-in-out;
|
|
127
|
+
}
|
|
128
|
+
.magritte-aside-revealed___CRBl7_2-0-0{
|
|
129
|
+
opacity:1;
|
|
130
|
+
}
|
|
131
|
+
.magritte-outgoing___3n00o_2-0-0 .magritte-aside___bTex-_2-0-0{
|
|
132
|
+
left:auto;
|
|
133
|
+
right:100%;
|
|
134
|
+
padding-right:8px;
|
|
135
|
+
padding-left:0;
|
|
136
|
+
}
|
|
137
|
+
.magritte-buttons___yQqBi_2-0-0 > *:last-child:nth-child(odd){
|
|
138
|
+
grid-column:span 2;
|
|
120
139
|
}
|
|
121
|
-
.magritte-error-
|
|
140
|
+
.magritte-error-text___1ZxWY_2-0-0{
|
|
122
141
|
margin-top:2px;
|
|
123
142
|
}
|
|
124
|
-
.magritte-
|
|
143
|
+
.magritte-file___k2IKy_2-0-0{
|
|
125
144
|
display:flex;
|
|
126
145
|
align-items:flex-end;
|
|
127
146
|
}
|
|
128
|
-
.magritte-file-
|
|
147
|
+
.magritte-file-preview___eJKu8_2-0-0{
|
|
129
148
|
display:block;
|
|
130
149
|
width:48px;
|
|
131
150
|
height:48px;
|
|
132
151
|
border-radius:8px;
|
|
133
152
|
object-fit:cover;
|
|
134
153
|
}
|
|
135
|
-
.magritte-
|
|
154
|
+
.magritte-media___9jH2k_2-0-0{
|
|
136
155
|
display:flex;
|
|
137
156
|
position:relative;
|
|
138
157
|
box-sizing:border-box;
|
|
@@ -145,18 +164,18 @@
|
|
|
145
164
|
box-shadow:inset 0 0 0 1px var(--magritte-color-component-chat-bubble-border-image-v25-0-1);
|
|
146
165
|
}
|
|
147
166
|
@media (min-width: 1020px){
|
|
148
|
-
body.magritte-old-layout .magritte-
|
|
167
|
+
body.magritte-old-layout .magritte-media___9jH2k_2-0-0{
|
|
149
168
|
max-width:452px;
|
|
150
169
|
max-height:452px;
|
|
151
170
|
}
|
|
152
171
|
}
|
|
153
172
|
@media (min-width: 1024px){
|
|
154
|
-
body:not(.magritte-old-layout) .magritte-
|
|
173
|
+
body:not(.magritte-old-layout) .magritte-media___9jH2k_2-0-0{
|
|
155
174
|
max-width:452px;
|
|
156
175
|
max-height:452px;
|
|
157
176
|
}
|
|
158
177
|
}
|
|
159
|
-
.magritte-media-
|
|
178
|
+
.magritte-media-blur___TbiMa_2-0-0{
|
|
160
179
|
position:absolute;
|
|
161
180
|
top:-96px;
|
|
162
181
|
left:-96px;
|
|
@@ -166,7 +185,7 @@
|
|
|
166
185
|
filter:blur(48px);
|
|
167
186
|
object-fit:cover;
|
|
168
187
|
}
|
|
169
|
-
.magritte-media-image___G-
|
|
188
|
+
.magritte-media-image___G-FkF_2-0-0{
|
|
170
189
|
display:block;
|
|
171
190
|
position:relative;
|
|
172
191
|
max-width:100%;
|
|
@@ -174,23 +193,23 @@
|
|
|
174
193
|
margin:auto;
|
|
175
194
|
}
|
|
176
195
|
@media (min-width: 1020px){
|
|
177
|
-
body.magritte-old-layout .magritte-media-image___G-
|
|
196
|
+
body.magritte-old-layout .magritte-media-image___G-FkF_2-0-0{
|
|
178
197
|
max-height:452px;
|
|
179
198
|
}
|
|
180
199
|
}
|
|
181
200
|
@media (min-width: 1024px){
|
|
182
|
-
body:not(.magritte-old-layout) .magritte-media-image___G-
|
|
201
|
+
body:not(.magritte-old-layout) .magritte-media-image___G-FkF_2-0-0{
|
|
183
202
|
max-height:452px;
|
|
184
203
|
}
|
|
185
204
|
}
|
|
186
|
-
.magritte-media-
|
|
205
|
+
.magritte-media-content___n3XbD_2-0-0{
|
|
187
206
|
display:flex;
|
|
188
207
|
position:absolute;
|
|
189
208
|
inset:0;
|
|
190
209
|
align-items:center;
|
|
191
210
|
justify-content:center;
|
|
192
211
|
}
|
|
193
|
-
.magritte-media-
|
|
212
|
+
.magritte-media-format___AdfCK_2-0-0{
|
|
194
213
|
display:flex;
|
|
195
214
|
position:absolute;
|
|
196
215
|
padding:2px 8px;
|
|
@@ -200,7 +219,7 @@
|
|
|
200
219
|
top:4px;
|
|
201
220
|
left:4px;
|
|
202
221
|
}
|
|
203
|
-
.magritte-media-
|
|
222
|
+
.magritte-media-meta___oSxxr_2-0-0{
|
|
204
223
|
--magritte-ui-text-color-override:var(--magritte-color-text-constant-v25-0-1);
|
|
205
224
|
display:flex;
|
|
206
225
|
position:absolute;
|
|
@@ -212,13 +231,13 @@
|
|
|
212
231
|
bottom:4px;
|
|
213
232
|
align-items:center;
|
|
214
233
|
}
|
|
215
|
-
.magritte-media-
|
|
234
|
+
.magritte-media-meta___oSxxr_2-0-0:empty{
|
|
216
235
|
display:none;
|
|
217
236
|
}
|
|
218
|
-
.magritte-media-
|
|
237
|
+
.magritte-media-meta___oSxxr_2-0-0 > span{
|
|
219
238
|
margin-left:0;
|
|
220
239
|
}
|
|
221
|
-
.magritte-reply___-
|
|
240
|
+
.magritte-reply___-QCK7_2-0-0{
|
|
222
241
|
display:flex;
|
|
223
242
|
position:relative;
|
|
224
243
|
padding:8px;
|
|
@@ -229,7 +248,7 @@
|
|
|
229
248
|
align-items:center;
|
|
230
249
|
gap:8px;
|
|
231
250
|
}
|
|
232
|
-
.magritte-reply___-
|
|
251
|
+
.magritte-reply___-QCK7_2-0-0::before{
|
|
233
252
|
content:'';
|
|
234
253
|
position:absolute;
|
|
235
254
|
top:0;
|
|
@@ -238,7 +257,7 @@
|
|
|
238
257
|
width:4px;
|
|
239
258
|
background-color:var(--magritte-chat-bubble-snippet-line);
|
|
240
259
|
}
|
|
241
|
-
.magritte-reply-
|
|
260
|
+
.magritte-reply-preview___qvlNT_2-0-0{
|
|
242
261
|
display:block;
|
|
243
262
|
flex-shrink:0;
|
|
244
263
|
width:40px;
|
|
@@ -248,12 +267,12 @@
|
|
|
248
267
|
outline-offset:-1px;
|
|
249
268
|
object-fit:cover;
|
|
250
269
|
}
|
|
251
|
-
.magritte-reply-
|
|
270
|
+
.magritte-reply-body___f2xx7_2-0-0{
|
|
252
271
|
display:flex;
|
|
253
272
|
flex-direction:column;
|
|
254
273
|
min-width:0;
|
|
255
274
|
}
|
|
256
|
-
.magritte-
|
|
275
|
+
.magritte-snippet___8k9xb_2-0-0{
|
|
257
276
|
display:flex;
|
|
258
277
|
position:relative;
|
|
259
278
|
padding:8px;
|
|
@@ -264,7 +283,7 @@
|
|
|
264
283
|
flex-direction:column;
|
|
265
284
|
gap:2px;
|
|
266
285
|
}
|
|
267
|
-
.magritte-
|
|
286
|
+
.magritte-snippet___8k9xb_2-0-0::before{
|
|
268
287
|
content:'';
|
|
269
288
|
position:absolute;
|
|
270
289
|
top:0;
|
|
@@ -273,7 +292,7 @@
|
|
|
273
292
|
width:4px;
|
|
274
293
|
background-color:var(--magritte-chat-bubble-snippet-line);
|
|
275
294
|
}
|
|
276
|
-
.magritte-
|
|
295
|
+
.magritte-snippet___8k9xb_2-0-0 img{
|
|
277
296
|
display:block;
|
|
278
297
|
max-width:100%;
|
|
279
298
|
border-radius:4px;
|
|
@@ -281,7 +300,7 @@
|
|
|
281
300
|
outline-offset:-1px;
|
|
282
301
|
margin-top:6px;
|
|
283
302
|
}
|
|
284
|
-
.magritte-
|
|
303
|
+
.magritte-meta___1qhjm_2-0-0{
|
|
285
304
|
float:right;
|
|
286
305
|
margin-left:12px;
|
|
287
306
|
white-space:nowrap;
|
|
@@ -294,53 +313,53 @@
|
|
|
294
313
|
text-transform:none;
|
|
295
314
|
text-decoration:none;
|
|
296
315
|
}
|
|
297
|
-
.magritte-edited___m-
|
|
316
|
+
.magritte-edited___m-zmB_2-0-0{
|
|
298
317
|
margin-right:4px;
|
|
299
318
|
}
|
|
300
|
-
.magritte-
|
|
319
|
+
.magritte-status___dHzCt_2-0-0{
|
|
301
320
|
display:inline-flex;
|
|
302
321
|
vertical-align:middle;
|
|
303
322
|
}
|
|
304
|
-
.magritte-
|
|
323
|
+
.magritte-status___dHzCt_2-0-0:not(:first-child){
|
|
305
324
|
margin-left:4px;
|
|
306
325
|
}
|
|
307
|
-
.magritte-message-
|
|
326
|
+
.magritte-message-title___dgBFk_2-0-0{
|
|
308
327
|
margin-bottom:4px;
|
|
309
328
|
}
|
|
310
|
-
.magritte-
|
|
311
|
-
.magritte-
|
|
312
|
-
.magritte-
|
|
313
|
-
.magritte-
|
|
314
|
-
.magritte-
|
|
329
|
+
.magritte-label___i0Wyt_2-0-0 + .magritte-media___9jH2k_2-0-0,
|
|
330
|
+
.magritte-label___i0Wyt_2-0-0 + .magritte-message___7TEpw_2-0-0,
|
|
331
|
+
.magritte-label___i0Wyt_2-0-0 + .magritte-snippet___8k9xb_2-0-0,
|
|
332
|
+
.magritte-message___7TEpw_2-0-0 + .magritte-message___7TEpw_2-0-0,
|
|
333
|
+
.magritte-bubble___NVuDI_2-0-0 > .magritte-meta___1qhjm_2-0-0{
|
|
315
334
|
margin-top:4px;
|
|
316
335
|
}
|
|
317
|
-
.magritte-
|
|
318
|
-
.magritte-reply___-
|
|
319
|
-
.magritte-reply___-
|
|
320
|
-
.magritte-reply___-
|
|
321
|
-
.magritte-
|
|
336
|
+
.magritte-label___i0Wyt_2-0-0 + .magritte-reply___-QCK7_2-0-0,
|
|
337
|
+
.magritte-reply___-QCK7_2-0-0 + .magritte-media___9jH2k_2-0-0,
|
|
338
|
+
.magritte-reply___-QCK7_2-0-0 + .magritte-message___7TEpw_2-0-0,
|
|
339
|
+
.magritte-reply___-QCK7_2-0-0 + .magritte-snippet___8k9xb_2-0-0,
|
|
340
|
+
.magritte-media___9jH2k_2-0-0 + .magritte-snippet___8k9xb_2-0-0{
|
|
322
341
|
margin-top:8px;
|
|
323
342
|
}
|
|
324
|
-
.magritte-
|
|
325
|
-
.magritte-reply___-
|
|
326
|
-
.magritte-
|
|
327
|
-
.magritte-
|
|
328
|
-
.magritte-
|
|
329
|
-
.magritte-
|
|
343
|
+
.magritte-label___i0Wyt_2-0-0 + .magritte-file___k2IKy_2-0-0,
|
|
344
|
+
.magritte-reply___-QCK7_2-0-0 + .magritte-file___k2IKy_2-0-0,
|
|
345
|
+
.magritte-media___9jH2k_2-0-0 + .magritte-file___k2IKy_2-0-0,
|
|
346
|
+
.magritte-media___9jH2k_2-0-0 + .magritte-message___7TEpw_2-0-0,
|
|
347
|
+
.magritte-file___k2IKy_2-0-0 + .magritte-message___7TEpw_2-0-0,
|
|
348
|
+
.magritte-file___k2IKy_2-0-0 + .magritte-snippet___8k9xb_2-0-0{
|
|
330
349
|
margin-top:12px;
|
|
331
350
|
}
|
|
332
|
-
.magritte-
|
|
351
|
+
.magritte-message___7TEpw_2-0-0 + .magritte-snippet___8k9xb_2-0-0{
|
|
333
352
|
margin-top:16px;
|
|
334
353
|
}
|
|
335
|
-
.magritte-
|
|
354
|
+
.magritte-file___k2IKy_2-0-0 + .magritte-file___k2IKy_2-0-0{
|
|
336
355
|
margin-top:24px;
|
|
337
356
|
}
|
|
338
|
-
.magritte-
|
|
357
|
+
.magritte-label___i0Wyt_2-0-0{
|
|
339
358
|
margin-top:-4px;
|
|
340
359
|
}
|
|
341
|
-
.magritte-
|
|
360
|
+
.magritte-bubble___NVuDI_2-0-0 > .magritte-media___9jH2k_2-0-0:first-child{
|
|
342
361
|
margin-top:-8px;
|
|
343
362
|
}
|
|
344
|
-
.magritte-
|
|
363
|
+
.magritte-bubble___NVuDI_2-0-0 > .magritte-media___9jH2k_2-0-0:not(:has( ~ :not(.magritte-tail___E2hdk_2-0-0))){
|
|
345
364
|
margin-bottom:-8px;
|
|
346
365
|
}
|
package/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export { ChatBubble } from './ChatBubble.js';
|
|
|
3
3
|
import 'react/jsx-runtime';
|
|
4
4
|
import 'react';
|
|
5
5
|
import 'classnames';
|
|
6
|
+
import '@hh.ru/magritte-common-mouse';
|
|
6
7
|
import '@hh.ru/magritte-ui-button';
|
|
7
8
|
import './Call.js';
|
|
8
9
|
import '@hh.ru/magritte-ui-cell';
|
|
@@ -10,7 +11,7 @@ import './internal/colors.js';
|
|
|
10
11
|
import './internal/mode.js';
|
|
11
12
|
import './internal/utils.js';
|
|
12
13
|
import '@hh.ru/magritte-ui-icon/icon';
|
|
13
|
-
import './chat-bubble-
|
|
14
|
+
import './chat-bubble-C7c7YGmG.js';
|
|
14
15
|
import './ErrorAction.js';
|
|
15
16
|
import './internal/errorMenu.js';
|
|
16
17
|
import '@hh.ru/magritte-ui-menu';
|
|
@@ -29,5 +30,4 @@ import './Status.js';
|
|
|
29
30
|
import '@hh.ru/magritte-common-use-multiple-refs';
|
|
30
31
|
import '@hh.ru/magritte-ui-tooltip';
|
|
31
32
|
import './Tail.js';
|
|
32
|
-
import '@hh.ru/magritte-ui-icon';
|
|
33
33
|
//# sourceMappingURL=index.js.map
|
package/internal/colors.d.ts
CHANGED
|
@@ -15,8 +15,6 @@ export interface ChatBubbleColors {
|
|
|
15
15
|
replyTitle: TextStyle;
|
|
16
16
|
/** Иконка статуса, лежит на фоне баббла */
|
|
17
17
|
statusIcon: IconColor;
|
|
18
|
-
/** Иконки действий, лежат под бабблом на фоне страницы */
|
|
19
|
-
actionsIcon: IconColor;
|
|
20
18
|
/** Кнопки под бабблом */
|
|
21
19
|
button: Pick<ButtonProps, 'mode' | 'style'>;
|
|
22
20
|
/** Ссылка-действие: «Открыть», «Загрузить» */
|
package/internal/colors.js
CHANGED
|
@@ -9,7 +9,6 @@ const COLORS = {
|
|
|
9
9
|
accentText: 'accent',
|
|
10
10
|
replyTitle: 'accent',
|
|
11
11
|
statusIcon: 'constant',
|
|
12
|
-
actionsIcon: 'secondary',
|
|
13
12
|
button: { mode: 'secondary', style: 'neutral' },
|
|
14
13
|
link: { style: 'accent' },
|
|
15
14
|
secondaryIcon: 'secondary',
|
|
@@ -22,7 +21,6 @@ const COLORS = {
|
|
|
22
21
|
accentText: 'constant',
|
|
23
22
|
replyTitle: 'constant',
|
|
24
23
|
statusIcon: 'constant',
|
|
25
|
-
actionsIcon: 'accent',
|
|
26
24
|
button: { mode: 'primary', style: 'accent' },
|
|
27
25
|
link: { style: 'constant', mode: 'secondary' },
|
|
28
26
|
secondaryIcon: 'constant',
|
|
@@ -35,7 +33,6 @@ const COLORS = {
|
|
|
35
33
|
accentText: 'special',
|
|
36
34
|
replyTitle: 'accent',
|
|
37
35
|
statusIcon: 'special',
|
|
38
|
-
actionsIcon: 'special',
|
|
39
36
|
button: { mode: 'secondary', style: 'special' },
|
|
40
37
|
link: { style: 'accent' },
|
|
41
38
|
secondaryIcon: 'secondary',
|
package/internal/colors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.js","sources":["src/internal/colors.ts"],"sourcesContent":["import type { TokenColorBackground } from '@hh.ru/magritte-design-tokens/types';\nimport type { ButtonProps } from '@hh.ru/magritte-ui-button';\nimport { useChatBubbleMode } from '@hh.ru/magritte-ui-chat-bubble/internal/mode';\nimport type { ChatBubbleMode } from '@hh.ru/magritte-ui-chat-bubble/types';\nimport type { IconColor } from '@hh.ru/magritte-ui-icon';\nimport type { LinkProps } from '@hh.ru/magritte-ui-link';\nimport type { TextStyle } from '@hh.ru/magritte-ui-typography';\n\nexport interface ChatBubbleColors {\n /** Основной текст сообщения, названия файла, текст сниппета */\n text: TextStyle;\n /** Второстепенный текст: время, размер файла */\n secondaryText: TextStyle;\n /** Акцентный текст: имя отправителя */\n accentText: TextStyle;\n /** Автор цитируемого сообщения (у бота акцентный, потому отдельно от accentText) */\n replyTitle: TextStyle;\n /** Иконка статуса, лежит на фоне баббла */\n statusIcon: IconColor;\n /**
|
|
1
|
+
{"version":3,"file":"colors.js","sources":["src/internal/colors.ts"],"sourcesContent":["import type { TokenColorBackground } from '@hh.ru/magritte-design-tokens/types';\nimport type { ButtonProps } from '@hh.ru/magritte-ui-button';\nimport { useChatBubbleMode } from '@hh.ru/magritte-ui-chat-bubble/internal/mode';\nimport type { ChatBubbleMode } from '@hh.ru/magritte-ui-chat-bubble/types';\nimport type { IconColor } from '@hh.ru/magritte-ui-icon';\nimport type { LinkProps } from '@hh.ru/magritte-ui-link';\nimport type { TextStyle } from '@hh.ru/magritte-ui-typography';\n\nexport interface ChatBubbleColors {\n /** Основной текст сообщения, названия файла, текст сниппета */\n text: TextStyle;\n /** Второстепенный текст: время, размер файла */\n secondaryText: TextStyle;\n /** Акцентный текст: имя отправителя */\n accentText: TextStyle;\n /** Автор цитируемого сообщения (у бота акцентный, потому отдельно от accentText) */\n replyTitle: TextStyle;\n /** Иконка статуса, лежит на фоне баббла */\n statusIcon: IconColor;\n /** Кнопки под бабблом */\n button: Pick<ButtonProps, 'mode' | 'style'>;\n /** Ссылка-действие: «Открыть», «Загрузить» */\n link: Pick<LinkProps, 'style' | 'mode'>;\n /** Иконка рядом со второстепенным текстом: лоадер загрузки файла */\n secondaryIcon: IconColor;\n /** Иконка файла */\n fileIcon: IconColor;\n /** Подложка под иконкой файла */\n fileIconBackground: TokenColorBackground;\n}\n\nconst COLORS: Record<ChatBubbleMode, ChatBubbleColors> = {\n incoming: {\n text: 'primary',\n secondaryText: 'secondary',\n accentText: 'accent',\n replyTitle: 'accent',\n statusIcon: 'constant',\n button: { mode: 'secondary', style: 'neutral' },\n link: { style: 'accent' },\n secondaryIcon: 'secondary',\n fileIcon: 'constant',\n fileIconBackground: 'accent',\n },\n outgoing: {\n text: 'constant',\n secondaryText: 'constant',\n accentText: 'constant',\n replyTitle: 'constant',\n statusIcon: 'constant',\n button: { mode: 'primary', style: 'accent' },\n link: { style: 'constant', mode: 'secondary' },\n secondaryIcon: 'constant',\n fileIcon: 'accent',\n fileIconBackground: 'accent-secondary',\n },\n bot: {\n text: 'primary',\n secondaryText: 'secondary',\n accentText: 'special',\n replyTitle: 'accent',\n statusIcon: 'special',\n button: { mode: 'secondary', style: 'special' },\n link: { style: 'accent' },\n secondaryIcon: 'secondary',\n fileIcon: 'constant',\n fileIconBackground: 'special',\n },\n};\n\nexport const getColors = (mode: ChatBubbleMode): ChatBubbleColors => COLORS[mode];\n\n// Для подкомпонентов, которые сидят под mode провайдером\nexport const useChatBubbleColors = (): ChatBubbleColors => COLORS[useChatBubbleMode()];\n"],"names":[],"mappings":";;;AA+BA,MAAM,MAAM,GAA6C;AACrD,IAAA,QAAQ,EAAE;AACN,QAAA,IAAI,EAAE,SAAS;AACf,QAAA,aAAa,EAAE,WAAW;AAC1B,QAAA,UAAU,EAAE,QAAQ;AACpB,QAAA,UAAU,EAAE,QAAQ;AACpB,QAAA,UAAU,EAAE,UAAU;QACtB,MAAM,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE;AAC/C,QAAA,IAAI,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE;AACzB,QAAA,aAAa,EAAE,WAAW;AAC1B,QAAA,QAAQ,EAAE,UAAU;AACpB,QAAA,kBAAkB,EAAE,QAAQ;AAC/B,KAAA;AACD,IAAA,QAAQ,EAAE;AACN,QAAA,IAAI,EAAE,UAAU;AAChB,QAAA,aAAa,EAAE,UAAU;AACzB,QAAA,UAAU,EAAE,UAAU;AACtB,QAAA,UAAU,EAAE,UAAU;AACtB,QAAA,UAAU,EAAE,UAAU;QACtB,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE;QAC5C,IAAI,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE;AAC9C,QAAA,aAAa,EAAE,UAAU;AACzB,QAAA,QAAQ,EAAE,QAAQ;AAClB,QAAA,kBAAkB,EAAE,kBAAkB;AACzC,KAAA;AACD,IAAA,GAAG,EAAE;AACD,QAAA,IAAI,EAAE,SAAS;AACf,QAAA,aAAa,EAAE,WAAW;AAC1B,QAAA,UAAU,EAAE,SAAS;AACrB,QAAA,UAAU,EAAE,QAAQ;AACpB,QAAA,UAAU,EAAE,SAAS;QACrB,MAAM,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE;AAC/C,QAAA,IAAI,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE;AACzB,QAAA,aAAa,EAAE,WAAW;AAC1B,QAAA,QAAQ,EAAE,UAAU;AACpB,QAAA,kBAAkB,EAAE,SAAS;AAChC,KAAA;CACJ,CAAC;AAEK,MAAM,SAAS,GAAG,CAAC,IAAoB,KAAuB,MAAM,CAAC,IAAI,EAAE;AAElF;AACO,MAAM,mBAAmB,GAAG,MAAwB,MAAM,CAAC,iBAAiB,EAAE;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hh.ru/magritte-ui-chat-bubble",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"sideEffects": [
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"watch": "yarn root:watch $(pwd)"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
+
"@hh.ru/magritte-common-mouse": "1.2.0",
|
|
22
23
|
"@hh.ru/magritte-common-use-multiple-refs": "1.1.11",
|
|
23
24
|
"@hh.ru/magritte-common-use-translation": "3.4.0",
|
|
24
25
|
"@hh.ru/magritte-design-tokens": "25.0.1",
|
|
@@ -40,5 +41,5 @@
|
|
|
40
41
|
"publishConfig": {
|
|
41
42
|
"access": "public"
|
|
42
43
|
},
|
|
43
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "7851a979c2a202a7fecc4c673dd6b72d959b58b4"
|
|
44
45
|
}
|
package/types.d.ts
CHANGED
|
@@ -20,8 +20,6 @@ export interface ChatBubbleProps extends Omit<HTMLAttributes<HTMLDivElement>, 'c
|
|
|
20
20
|
time?: ReactNode;
|
|
21
21
|
/** Статус сообщения: `ChatBubble.Status`. У входящих сообщений статусов нет */
|
|
22
22
|
status?: ReactNode;
|
|
23
|
-
/** Дополнительные действия с сообщением: список иконок размера 16px под бабблом */
|
|
24
|
-
actions?: ReactNode;
|
|
25
23
|
/** Кнопки под бабблом */
|
|
26
24
|
buttons?: ReactNode;
|
|
27
25
|
/** Сообщение было отредактировано */
|
|
@@ -34,6 +32,8 @@ export interface ChatBubbleProps extends Omit<HTMLAttributes<HTMLDivElement>, 'c
|
|
|
34
32
|
* Действия для исправления ошибки: список `ChatBubble.ErrorAction`.
|
|
35
33
|
*/
|
|
36
34
|
errorActions?: ReactNode;
|
|
35
|
+
/** Слот сбоку от баббла, напротив хвоста сообщения */
|
|
36
|
+
aside?: ReactNode;
|
|
37
37
|
/**
|
|
38
38
|
* Содержимое сообщения
|
|
39
39
|
* - `ChatBubble.Message`
|
package/chat-bubble-LoILH1vk.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import './index.css';
|
|
2
|
-
var styles = {"chat-bubble":"magritte-chat-bubble___ds9CP_1-7-0","chatBubble":"magritte-chat-bubble___ds9CP_1-7-0","outgoing":"magritte-outgoing___3n00o_1-7-0","bot":"magritte-bot___Z6vZA_1-7-0","row":"magritte-row___mQNnt_1-7-0","bubble":"magritte-bubble___NVuDI_1-7-0","with-tail":"magritte-with-tail___IdixJ_1-7-0","withTail":"magritte-with-tail___IdixJ_1-7-0","tail":"magritte-tail___E2hdk_1-7-0","tail-outgoing":"magritte-tail-outgoing___Pn3MI_1-7-0","tailOutgoing":"magritte-tail-outgoing___Pn3MI_1-7-0","buttons":"magritte-buttons___yQqBi_1-7-0","actions":"magritte-actions___I5GSz_1-7-0","error-text":"magritte-error-text___1ZxWY_1-7-0","errorText":"magritte-error-text___1ZxWY_1-7-0","file":"magritte-file___k2IKy_1-7-0","file-preview":"magritte-file-preview___eJKu8_1-7-0","filePreview":"magritte-file-preview___eJKu8_1-7-0","media":"magritte-media___9jH2k_1-7-0","media-blur":"magritte-media-blur___TbiMa_1-7-0","mediaBlur":"magritte-media-blur___TbiMa_1-7-0","media-image":"magritte-media-image___G-FkF_1-7-0","mediaImage":"magritte-media-image___G-FkF_1-7-0","media-content":"magritte-media-content___n3XbD_1-7-0","mediaContent":"magritte-media-content___n3XbD_1-7-0","media-format":"magritte-media-format___AdfCK_1-7-0","mediaFormat":"magritte-media-format___AdfCK_1-7-0","media-meta":"magritte-media-meta___oSxxr_1-7-0","mediaMeta":"magritte-media-meta___oSxxr_1-7-0","reply":"magritte-reply___-QCK7_1-7-0","reply-preview":"magritte-reply-preview___qvlNT_1-7-0","replyPreview":"magritte-reply-preview___qvlNT_1-7-0","reply-body":"magritte-reply-body___f2xx7_1-7-0","replyBody":"magritte-reply-body___f2xx7_1-7-0","snippet":"magritte-snippet___8k9xb_1-7-0","meta":"magritte-meta___1qhjm_1-7-0","edited":"magritte-edited___m-zmB_1-7-0","status":"magritte-status___dHzCt_1-7-0","message-title":"magritte-message-title___dgBFk_1-7-0","messageTitle":"magritte-message-title___dgBFk_1-7-0","label":"magritte-label___i0Wyt_1-7-0","message":"magritte-message___7TEpw_1-7-0"};
|
|
3
|
-
|
|
4
|
-
export { styles as s };
|
|
5
|
-
//# sourceMappingURL=chat-bubble-LoILH1vk.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chat-bubble-LoILH1vk.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|