@hh.ru/magritte-ui-chat-bubble 1.1.0 → 1.2.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/ChatBubble.d.ts +2 -0
- package/ChatBubble.js +8 -3
- package/ChatBubble.js.map +1 -1
- package/File.d.ts +26 -0
- package/File.js +26 -0
- package/File.js.map +1 -0
- package/Message.js +1 -1
- package/Status.d.ts +2 -1
- package/Status.js +1 -1
- package/Status.js.map +1 -1
- package/chat-bubble-BjmT1S_i.js +5 -0
- package/chat-bubble-BjmT1S_i.js.map +1 -0
- package/chat-bubble-CaB7cEff.js +5 -0
- package/chat-bubble-CaB7cEff.js.map +1 -0
- package/index.css +37 -20
- package/index.d.ts +3 -2
- package/index.js +9 -5
- package/index.js.map +1 -1
- package/index.mock.d.ts +4 -2
- package/index.mock.js +2 -0
- package/index.mock.js.map +1 -1
- package/internal/Meta.js +1 -1
- package/internal/Tail.js +1 -1
- package/internal/colors.d.ts +11 -1
- package/internal/colors.js +12 -0
- package/internal/colors.js.map +1 -1
- package/package.json +6 -3
- package/types.d.ts +0 -2
- package/chat-bubble-B2HOuNTb.js +0 -5
- package/chat-bubble-B2HOuNTb.js.map +0 -1
- package/chat-bubble-Djyvds6I.js +0 -5
- package/chat-bubble-Djyvds6I.js.map +0 -1
package/ChatBubble.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { ChatBubbleErrorAction } from '@hh.ru/magritte-ui-chat-bubble/ErrorAction';
|
|
2
|
+
import { ChatBubbleFile } from '@hh.ru/magritte-ui-chat-bubble/File';
|
|
2
3
|
import { ChatBubbleLabel } from '@hh.ru/magritte-ui-chat-bubble/Label';
|
|
3
4
|
import { ChatBubbleMessage } from '@hh.ru/magritte-ui-chat-bubble/Message';
|
|
4
5
|
import { ChatBubbleStatus } from '@hh.ru/magritte-ui-chat-bubble/Status';
|
|
5
6
|
import type { ChatBubbleProps } from '@hh.ru/magritte-ui-chat-bubble/types';
|
|
6
7
|
interface ChatBubbleComponents {
|
|
7
8
|
ErrorAction: typeof ChatBubbleErrorAction;
|
|
9
|
+
File: typeof ChatBubbleFile;
|
|
8
10
|
Label: typeof ChatBubbleLabel;
|
|
9
11
|
Message: typeof ChatBubbleMessage;
|
|
10
12
|
Status: typeof ChatBubbleStatus;
|
package/ChatBubble.js
CHANGED
|
@@ -4,6 +4,7 @@ import { forwardRef, useState, useCallback, useRef, useMemo, cloneElement } from
|
|
|
4
4
|
import classnames from 'classnames';
|
|
5
5
|
import { ButtonDefaultPropsContext } from '@hh.ru/magritte-ui-button';
|
|
6
6
|
import { ChatBubbleErrorAction } from './ErrorAction.js';
|
|
7
|
+
import { ChatBubbleFile } from './File.js';
|
|
7
8
|
import { ChatBubbleLabel } from './Label.js';
|
|
8
9
|
import { ChatBubbleMessage } from './Message.js';
|
|
9
10
|
import { ChatBubbleStatus } from './Status.js';
|
|
@@ -17,11 +18,14 @@ import { IconDefaultPropsContext } from '@hh.ru/magritte-ui-icon';
|
|
|
17
18
|
import { ExclamationCircleFilledSize24 } from '@hh.ru/magritte-ui-icon/icon';
|
|
18
19
|
import { Menu } from '@hh.ru/magritte-ui-menu';
|
|
19
20
|
import { Text } from '@hh.ru/magritte-ui-typography';
|
|
20
|
-
import { s as styles } from './chat-bubble-
|
|
21
|
+
import { s as styles } from './chat-bubble-CaB7cEff.js';
|
|
22
|
+
import '@hh.ru/magritte-ui-cell';
|
|
23
|
+
import '@hh.ru/magritte-ui-link';
|
|
24
|
+
import '@hh.ru/magritte-ui-loader';
|
|
21
25
|
import '@hh.ru/magritte-common-use-multiple-refs';
|
|
22
26
|
import '@hh.ru/magritte-common-use-translation';
|
|
23
27
|
import '@hh.ru/magritte-ui-tooltip';
|
|
24
|
-
import './chat-bubble-
|
|
28
|
+
import './chat-bubble-BjmT1S_i.js';
|
|
25
29
|
|
|
26
30
|
const ChatBubble = forwardRef(({ actions, buttons, children, header, errorActions, mode = 'incoming', showTail = false, status, time, error = false, errorText, 'data-qa': dataQa = 'chat-bubble', className, }, ref) => {
|
|
27
31
|
const [menuVisible, setMenuVisible] = useState(false);
|
|
@@ -42,10 +46,11 @@ const ChatBubble = forwardRef(({ actions, buttons, children, header, errorAction
|
|
|
42
46
|
const content = items.map((child, index) => index === lastIndex && isMetaHost(child) ? cloneElement(child, { meta }) : child);
|
|
43
47
|
return (jsx(ChatBubbleModeProvider, { value: mode, children: jsxs("div", { className: classnames(className, styles.chatBubble, styles[mode], {
|
|
44
48
|
[styles.withTail]: showTail,
|
|
45
|
-
}), "data-qa": dataQa, ref: ref, children: [jsxs("div", { className: styles.row, children: [jsxs("div", { className: styles.bubble, children: [header && (jsx("div", { className: styles.header, "data-qa": "chat-bubble-header", children: header })), jsxs("div", { "data-qa": "chat-bubble-content", children: [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 && (mode === 'bot' || mode === 'incoming') && (jsx(ButtonDefaultPropsContext, { props: buttonsProps, children: jsx("div", { className: styles.buttons, "data-qa": "chat-bubble-buttons", children: buttons }) })), actions && (jsx(IconDefaultPropsContext, { props: actionsIconProps, children: jsx("div", { className: styles.actions, "data-qa": "chat-bubble-actions", children: actions }) }))] }) }));
|
|
49
|
+
}), "data-qa": dataQa, ref: ref, children: [jsxs("div", { className: styles.row, children: [jsxs("div", { className: styles.bubble, children: [header && (jsx("div", { className: styles.header, "data-qa": "chat-bubble-header", children: header })), jsxs("div", { className: header ? styles.contentWithHeader : undefined, "data-qa": "chat-bubble-content", children: [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 && (mode === 'bot' || mode === 'incoming') && (jsx(ButtonDefaultPropsContext, { props: buttonsProps, children: jsx("div", { className: styles.buttons, "data-qa": "chat-bubble-buttons", children: buttons }) })), actions && (jsx(IconDefaultPropsContext, { props: actionsIconProps, children: jsx("div", { className: styles.actions, "data-qa": "chat-bubble-actions", children: actions }) }))] }) }));
|
|
46
50
|
});
|
|
47
51
|
ChatBubble.displayName = 'ChatBubble';
|
|
48
52
|
ChatBubble.ErrorAction = ChatBubbleErrorAction;
|
|
53
|
+
ChatBubble.File = ChatBubbleFile;
|
|
49
54
|
ChatBubble.Label = ChatBubbleLabel;
|
|
50
55
|
ChatBubble.Message = ChatBubbleMessage;
|
|
51
56
|
ChatBubble.Status = ChatBubbleStatus;
|
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 { ChatBubbleErrorAction } from '@hh.ru/magritte-ui-chat-bubble/ErrorAction';\nimport { ChatBubbleLabel } from '@hh.ru/magritte-ui-chat-bubble/Label';\nimport { ChatBubbleMessage } from '@hh.ru/magritte-ui-chat-bubble/Message';\nimport { ChatBubbleStatus } from '@hh.ru/magritte-ui-chat-bubble/Status';\nimport { Meta } from '@hh.ru/magritte-ui-chat-bubble/internal/Meta';\nimport { Tail } from '@hh.ru/magritte-ui-chat-bubble/internal/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 ErrorAction: typeof ChatBubbleErrorAction;\n Label: typeof ChatBubbleLabel;\n Message: typeof ChatBubbleMessage;\n Status: typeof ChatBubbleStatus;\n}\n\nexport const ChatBubble = forwardRef<HTMLDivElement, ChatBubbleProps>(\n (\n {\n actions,\n buttons,\n children,\n header,\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', mode: 'secondary', style: colors.button, stretched: true }),\n [colors]\n );\n /**\n * Время отдаём последнему элементу контента\n * Позиция времени меняется, в зависимости от компонента\n * Если последний ребенок не может отрисовать, вставим meta в самый конец\n */\n const meta = <Meta mode={mode} status={status} time={time} />;\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 <div className={styles.header} data-qa=\"chat-bubble-header\">\n {header}\n </div>\n )}\n <div data-qa=\"chat-bubble-content\">\n {content}\n {!metaHosted && meta}\n </div>\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 && (mode === 'bot' || mode === 'incoming') && (\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.ErrorAction = ChatBubbleErrorAction;\nChatBubble.Label = ChatBubbleLabel;\nChatBubble.Message = ChatBubbleMessage;\nChatBubble.Status = ChatBubbleStatus;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;MA6Ba,UAAU,GAAG,UAAU,CAChC,CACI,EACI,OAAO,EACP,OAAO,EACP,QAAQ,EACR,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,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;AACtD,IAAA,MAAM,cAAc,GAAG,WAAW,CAAC,MAAM,cAAc,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;AACpE,IAAA,MAAM,gBAAgB,GAAG,MAAM,CAAa,IAAI,CAAC,CAAC;AAClD,IAAA,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,gBAAgB,GAAuB,OAAO,CAChD,OAAO,EAAE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AI,SAAS,KACtCA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,MAAM,CAAC,SAAS,EAAA,SAAA,EAAU,wBAAwB,EAAA,QAAA,EAC9DA,GAAC,CAAA,IAAI,EAAC,EAAA,UAAU,EAAC,iBAAiB,EAAC,KAAK,EAAC,UAAU,EAAC,QAAQ,EAAE,CAAC,YAC1D,SAAS,EAAA,CACP,EACL,CAAA,CACT,EACA,OAAO,KAAK,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,UAAU,CAAC,KAC/CA,GAAC,CAAA,yBAAyB,EAAC,EAAA,KAAK,EAAE,YAAY,EAC1C,QAAA,EAAAA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,MAAM,CAAC,OAAO,EAAA,SAAA,EAAU,qBAAqB,EAAA,QAAA,EACxD,OAAO,EAAA,CACN,EACkB,CAAA,CAC/B,EACA,OAAO,KACJA,GAAC,CAAA,uBAAuB,EAAC,EAAA,KAAK,EAAE,gBAAgB,EAC5C,QAAA,EAAAA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,MAAM,CAAC,OAAO,EAAA,SAAA,EAAU,qBAAqB,EAAA,QAAA,EACxD,OAAO,EAAA,CACN,EACgB,CAAA,CAC7B,CACC,EAAA,CAAA,EAAA,CACe,EAC3B;AACN,CAAC,EAC8G;AAEnH,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC;AAEtC,UAAU,CAAC,WAAW,GAAG,qBAAqB,CAAC;AAC/C,UAAU,CAAC,KAAK,GAAG,eAAe,CAAC;AACnC,UAAU,CAAC,OAAO,GAAG,iBAAiB,CAAC;AACvC,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 { ButtonDefaultPropsContext, type ButtonProps } from '@hh.ru/magritte-ui-button';\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 { ChatBubbleMessage } from '@hh.ru/magritte-ui-chat-bubble/Message';\nimport { ChatBubbleStatus } from '@hh.ru/magritte-ui-chat-bubble/Status';\nimport { Meta } from '@hh.ru/magritte-ui-chat-bubble/internal/Meta';\nimport { Tail } from '@hh.ru/magritte-ui-chat-bubble/internal/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 ErrorAction: typeof ChatBubbleErrorAction;\n File: typeof ChatBubbleFile;\n Label: typeof ChatBubbleLabel;\n Message: typeof ChatBubbleMessage;\n Status: typeof ChatBubbleStatus;\n}\n\nexport const ChatBubble = forwardRef<HTMLDivElement, ChatBubbleProps>(\n (\n {\n actions,\n buttons,\n children,\n header,\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', mode: 'secondary', style: colors.button, stretched: true }),\n [colors]\n );\n /**\n * Время отдаём последнему элементу контента\n * Позиция времени меняется, в зависимости от компонента\n * Если последний ребенок не может отрисовать, вставим meta в самый конец\n */\n const meta = <Meta mode={mode} status={status} time={time} />;\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 <div className={styles.header} data-qa=\"chat-bubble-header\">\n {header}\n </div>\n )}\n <div\n className={header ? styles.contentWithHeader : undefined}\n data-qa=\"chat-bubble-content\"\n >\n {content}\n {!metaHosted && meta}\n </div>\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 && (mode === 'bot' || mode === 'incoming') && (\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.ErrorAction = ChatBubbleErrorAction;\nChatBubble.File = ChatBubbleFile;\nChatBubble.Label = ChatBubbleLabel;\nChatBubble.Message = ChatBubbleMessage;\nChatBubble.Status = ChatBubbleStatus;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;MA+Ba,UAAU,GAAG,UAAU,CAChC,CACI,EACI,OAAO,EACP,OAAO,EACP,QAAQ,EACR,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,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;AACtD,IAAA,MAAM,cAAc,GAAG,WAAW,CAAC,MAAM,cAAc,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;AACpE,IAAA,MAAM,gBAAgB,GAAG,MAAM,CAAa,IAAI,CAAC,CAAC;AAClD,IAAA,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,gB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+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
import { type ChatBubbleMetaHostProps } from '@hh.ru/magritte-ui-chat-bubble/internal/utils';
|
|
3
|
+
export type ChatBubbleFileState = 'unloaded' | 'loading' | 'preview' | 'loaded';
|
|
4
|
+
export interface ChatBubbleFileProps extends HTMLAttributes<HTMLDivElement>, ChatBubbleMetaHostProps {
|
|
5
|
+
/** Имя файла */
|
|
6
|
+
name?: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Строка под именем (например, для размера файла и действия с ним)
|
|
9
|
+
*/
|
|
10
|
+
description?: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Состояние файла
|
|
13
|
+
* @default loaded
|
|
14
|
+
*/
|
|
15
|
+
state?: ChatBubbleFileState;
|
|
16
|
+
/** Url превью файла, показывается в состоянии `preview` */
|
|
17
|
+
preview?: string;
|
|
18
|
+
/** alt превью файла */
|
|
19
|
+
previewAlt?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Значение data-qa
|
|
22
|
+
* @default chat-bubble-file
|
|
23
|
+
*/
|
|
24
|
+
'data-qa'?: string;
|
|
25
|
+
}
|
|
26
|
+
export declare const ChatBubbleFile: import("react").ForwardRefExoticComponent<ChatBubbleFileProps & import("react").RefAttributes<HTMLDivElement>> & import("@hh.ru/magritte-ui-chat-bubble/internal/utils").MetaHostComponent;
|
package/File.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import './index.css';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { forwardRef, useMemo } from 'react';
|
|
4
|
+
import { Cell, CellText } from '@hh.ru/magritte-ui-cell';
|
|
5
|
+
import { getColors } from './internal/colors.js';
|
|
6
|
+
import { useChatBubbleMode } from './internal/mode.js';
|
|
7
|
+
import { markMetaHost } from './internal/utils.js';
|
|
8
|
+
import { ArrowDownLineOutlinedSize24, DocumentOutlinedSize24 } from '@hh.ru/magritte-ui-icon/icon';
|
|
9
|
+
import { LinkDefaultPropsContext } from '@hh.ru/magritte-ui-link';
|
|
10
|
+
import { Loader } from '@hh.ru/magritte-ui-loader';
|
|
11
|
+
import { s as styles } from './chat-bubble-CaB7cEff.js';
|
|
12
|
+
|
|
13
|
+
/** Прикреплённый файл */
|
|
14
|
+
const ChatBubbleFileComponent = forwardRef(({ 'data-qa': dataQa = 'chat-bubble-file', description, meta, name, preview, state = 'loaded', previewAlt, ...props }, ref) => {
|
|
15
|
+
const colors = getColors(useChatBubbleMode());
|
|
16
|
+
const isLoading = state === 'loading';
|
|
17
|
+
// пока файл не скачан, на иконке стрелка
|
|
18
|
+
const Icon = state === 'unloaded' || isLoading ? ArrowDownLineOutlinedSize24 : DocumentOutlinedSize24;
|
|
19
|
+
const defaultLinkProps = useMemo(() => ({ ...colors.link, typography: 'label-3-regular', inline: true }), [colors]);
|
|
20
|
+
return (jsxs("div", { ...props, className: styles.file, "data-qa": dataQa, ref: ref, children: [jsxs(Cell, { align: "center", horPadding: false, vertPadding: false, left: state === 'preview' && preview ? (jsx("img", { className: styles.filePreview, src: preview, alt: previewAlt ?? '' })) : (jsx(Icon, { initialColor: colors.fileIcon, backgroundStyle: colors.fileIconBackground, padding: 12, borderRadius: 8 })), children: [jsx(CellText, { type: "title", style: colors.text, maxLines: 1, "data-qa": "chat-bubble-file-name", children: name }), description && (jsx(CellText, { type: "subtitle", style: colors.secondaryText, maxLines: 1, left: isLoading ? jsx(Loader, { size: 16, color: colors.secondaryIcon }) : undefined, "data-qa": "chat-bubble-file-description", children: jsx(LinkDefaultPropsContext, { props: defaultLinkProps, children: description }) }))] }), meta] }));
|
|
21
|
+
});
|
|
22
|
+
ChatBubbleFileComponent.displayName = 'ChatBubble.File';
|
|
23
|
+
const ChatBubbleFile = markMetaHost(ChatBubbleFileComponent);
|
|
24
|
+
|
|
25
|
+
export { ChatBubbleFile };
|
|
26
|
+
//# sourceMappingURL=File.js.map
|
package/File.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"File.js","sources":["src/File.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode, useMemo } from 'react';\n\nimport { Cell, CellText } from '@hh.ru/magritte-ui-cell';\nimport { getColors } from '@hh.ru/magritte-ui-chat-bubble/internal/colors';\nimport { useChatBubbleMode } from '@hh.ru/magritte-ui-chat-bubble/internal/mode';\nimport { markMetaHost, type ChatBubbleMetaHostProps } from '@hh.ru/magritte-ui-chat-bubble/internal/utils';\nimport { ArrowDownLineOutlinedSize24, DocumentOutlinedSize24 } from '@hh.ru/magritte-ui-icon/icon';\nimport { LinkDefaultPropsContext } from '@hh.ru/magritte-ui-link';\nimport { Loader } from '@hh.ru/magritte-ui-loader';\n\nimport styles from './chat-bubble.less';\n\nexport type ChatBubbleFileState = 'unloaded' | 'loading' | 'preview' | 'loaded';\n\nexport interface ChatBubbleFileProps extends HTMLAttributes<HTMLDivElement>, ChatBubbleMetaHostProps {\n /** Имя файла */\n name?: ReactNode;\n /**\n * Строка под именем (например, для размера файла и действия с ним)\n */\n description?: ReactNode;\n /**\n * Состояние файла\n * @default loaded\n */\n state?: ChatBubbleFileState;\n /** Url превью файла, показывается в состоянии `preview` */\n preview?: string;\n /** alt превью файла */\n previewAlt?: string;\n /**\n * Значение data-qa\n * @default chat-bubble-file\n */\n 'data-qa'?: string;\n}\n\n/** Прикреплённый файл */\nconst ChatBubbleFileComponent = forwardRef<HTMLDivElement, ChatBubbleFileProps>(\n (\n {\n 'data-qa': dataQa = 'chat-bubble-file',\n description,\n meta,\n name,\n preview,\n state = 'loaded',\n previewAlt,\n ...props\n },\n ref\n ) => {\n const colors = getColors(useChatBubbleMode());\n const isLoading = state === 'loading';\n // пока файл не скачан, на иконке стрелка\n const Icon = state === 'unloaded' || isLoading ? ArrowDownLineOutlinedSize24 : DocumentOutlinedSize24;\n\n const defaultLinkProps = useMemo(\n () => ({ ...colors.link, typography: 'label-3-regular' as const, inline: true }),\n [colors]\n );\n\n return (\n <div {...props} className={styles.file} data-qa={dataQa} ref={ref}>\n <Cell\n align=\"center\"\n horPadding={false}\n vertPadding={false}\n left={\n state === 'preview' && preview ? (\n <img className={styles.filePreview} src={preview} alt={previewAlt ?? ''} />\n ) : (\n <Icon\n initialColor={colors.fileIcon}\n backgroundStyle={colors.fileIconBackground}\n padding={12}\n borderRadius={8}\n />\n )\n }\n >\n <CellText type=\"title\" style={colors.text} maxLines={1} data-qa=\"chat-bubble-file-name\">\n {name}\n </CellText>\n {description && (\n <CellText\n type=\"subtitle\"\n style={colors.secondaryText}\n maxLines={1}\n left={isLoading ? <Loader size={16} color={colors.secondaryIcon} /> : undefined}\n data-qa=\"chat-bubble-file-description\"\n >\n <LinkDefaultPropsContext props={defaultLinkProps}>{description}</LinkDefaultPropsContext>\n </CellText>\n )}\n </Cell>\n {meta}\n </div>\n );\n }\n);\n\nChatBubbleFileComponent.displayName = 'ChatBubble.File';\n\nexport const ChatBubbleFile = markMetaHost(ChatBubbleFileComponent);\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;AAqCA;AACA,MAAM,uBAAuB,GAAG,UAAU,CACtC,CACI,EACI,SAAS,EAAE,MAAM,GAAG,kBAAkB,EACtC,WAAW,EACX,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,KAAK,GAAG,QAAQ,EAChB,UAAU,EACV,GAAG,KAAK,EACX,EACD,GAAG,KACH;AACA,IAAA,MAAM,MAAM,GAAG,SAAS,CAAC,iBAAiB,EAAE,CAAC,CAAC;AAC9C,IAAA,MAAM,SAAS,GAAG,KAAK,KAAK,SAAS,CAAC;;AAEtC,IAAA,MAAM,IAAI,GAAG,KAAK,KAAK,UAAU,IAAI,SAAS,GAAG,2BAA2B,GAAG,sBAAsB,CAAC;AAEtG,IAAA,MAAM,gBAAgB,GAAG,OAAO,CAC5B,OAAO,EAAE,GAAG,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,iBAA0B,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAChF,CAAC,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J,CAAC;AAEF,uBAAuB,CAAC,WAAW,GAAG,iBAAiB,CAAC;MAE3C,cAAc,GAAG,YAAY,CAAC,uBAAuB;;;;"}
|
package/Message.js
CHANGED
|
@@ -5,7 +5,7 @@ import { getColors } from './internal/colors.js';
|
|
|
5
5
|
import { useChatBubbleMode } from './internal/mode.js';
|
|
6
6
|
import { markMetaHost } from './internal/utils.js';
|
|
7
7
|
import { Text } from '@hh.ru/magritte-ui-typography';
|
|
8
|
-
import { s as styles } from './chat-bubble-
|
|
8
|
+
import { s as styles } from './chat-bubble-CaB7cEff.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Текстовая часть сообщения.
|
package/Status.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
import type { ChatBubbleStatusValue } from '@hh.ru/magritte-ui-chat-bubble/types';
|
|
3
2
|
import { type TooltipHoverProps } from '@hh.ru/magritte-ui-tooltip';
|
|
3
|
+
/** Статус исходящего сообщения */
|
|
4
|
+
export type ChatBubbleStatusValue = 'sending' | 'sent' | 'delivered';
|
|
4
5
|
export interface ChatBubbleStatusProps extends Omit<TooltipHoverProps, 'activatorRef' | 'placement' | 'size' | 'children'> {
|
|
5
6
|
/** Статус отправки. У сообщений от бота не используется — там всегда «видно только вам»
|
|
6
7
|
* @default sending
|
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-CaB7cEff.js';
|
|
11
11
|
|
|
12
12
|
const ICON = {
|
|
13
13
|
sending: ClockOutlinedSize16,
|
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
|
|
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} 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' | 'delivered';\n\nconst ICON = {\n sending: ClockOutlinedSize16,\n sent: CheckOutlinedSize16,\n delivered: CheckDoubleOutlinedSize16,\n} as const;\n\nexport interface ChatBubbleStatusProps\n extends Omit<TooltipHoverProps, 'activatorRef' | 'placement' | 'size' | 'children'> {\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 label = useTranslation('ChatBubble', isBot ? 'private' : value);\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 = 'ChatBubble.Status';\n"],"names":["_jsxs","_Fragment","_jsx"],"mappings":";;;;;;;;;;AAmBA,MAAM,IAAI,GAAG;AACT,IAAA,OAAO,EAAE,mBAAmB;AAC5B,IAAA,IAAI,EAAE,mBAAmB;AACzB,IAAA,SAAS,EAAE,yBAAyB;CAC9B,CAAC;AAgBX;;AAEG;AACU,MAAA,gBAAgB,GAAG,UAAU,CACtC,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,oBAAoB,EAAE,KAAK,GAAG,SAAS,EAAE,GAAG,YAAY,EAAE,EAAE,GAAG,KAAI;AAChG,IAAA,MAAM,IAAI,GAAG,iBAAiB,EAAE,CAAC;AACjC,IAAA,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAC/B,IAAA,MAAM,YAAY,GAAG,MAAM,CAAkB,IAAI,CAAC,CAAC;IACnD,MAAM,SAAS,GAAG,eAAe,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;AACrD,IAAA,MAAM,KAAK,GAAG,IAAI,KAAK,KAAK,CAAC;AAC7B,IAAA,MAAM,KAAK,GAAG,cAAc,CAAC,YAAY,EAAE,KAAK,GAAG,SAAS,GAAG,KAAK,CAAC,CAAC;;AAGtE,IAAA,MAAM,IAAI,GAAG,KAAK,GAAG,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;AAErD,IAAA,QACIA,IAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAA,CACIC,GACI,CAAA,MAAA,EAAA,EAAA,GAAG,EAAE,SAAS,EACd,SAAS,EAAE,MAAM,CAAC,MAAM,EACf,SAAA,EAAA,MAAM,EACF,aAAA,EAAA,KAAK,GAAG,SAAS,GAAG,KAAK,EAEtC,QAAA,EAAAA,GAAA,CAAC,IAAI,EAAA,EAAC,YAAY,EAAE,MAAM,CAAC,UAAU,EAAA,YAAA,EAAc,KAAK,EAAA,CAAI,EACzD,CAAA,EACPA,GAAC,CAAA,YAAY,EAAK,EAAA,GAAA,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAC,YAAY,EAAC,IAAI,EAAC,OAAO,EAC1F,QAAA,EAAA,QAAQ,IAAI,KAAK,EACP,CAAA,CAAA,EAAA,CAChB,EACL;AACN,CAAC,EACH;AAEF,gBAAgB,CAAC,WAAW,GAAG,mBAAmB;;;;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import './index.css';
|
|
2
|
+
var styles = {"tail":"magritte-tail___-1lJ0_1-2-0","tail_outgoing":"magritte-tail_outgoing___cnyh3_1-2-0","tailOutgoing":"magritte-tail_outgoing___cnyh3_1-2-0","meta":"magritte-meta___HT7lp_1-2-0"};
|
|
3
|
+
|
|
4
|
+
export { styles as s };
|
|
5
|
+
//# sourceMappingURL=chat-bubble-BjmT1S_i.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-bubble-BjmT1S_i.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import './index.css';
|
|
2
|
+
var styles = {"chat-bubble":"magritte-chat-bubble___ds9CP_1-2-0","chatBubble":"magritte-chat-bubble___ds9CP_1-2-0","outgoing":"magritte-outgoing___3n00o_1-2-0","bot":"magritte-bot___Z6vZA_1-2-0","row":"magritte-row___mQNnt_1-2-0","bubble":"magritte-bubble___NVuDI_1-2-0","with-tail":"magritte-with-tail___IdixJ_1-2-0","withTail":"magritte-with-tail___IdixJ_1-2-0","header":"magritte-header___Px2to_1-2-0","message-title":"magritte-message-title___dgBFk_1-2-0","messageTitle":"magritte-message-title___dgBFk_1-2-0","message":"magritte-message___7TEpw_1-2-0","buttons":"magritte-buttons___yQqBi_1-2-0","actions":"magritte-actions___I5GSz_1-2-0","error-text":"magritte-error-text___1ZxWY_1-2-0","errorText":"magritte-error-text___1ZxWY_1-2-0","file":"magritte-file___k2IKy_1-2-0","content-with-header":"magritte-content-with-header___wiNKB_1-2-0","contentWithHeader":"magritte-content-with-header___wiNKB_1-2-0","file-preview":"magritte-file-preview___eJKu8_1-2-0","filePreview":"magritte-file-preview___eJKu8_1-2-0","status":"magritte-status___dHzCt_1-2-0"};
|
|
3
|
+
|
|
4
|
+
export { styles as s };
|
|
5
|
+
//# sourceMappingURL=chat-bubble-CaB7cEff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-bubble-CaB7cEff.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
package/index.css
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
--magritte-color-component-chat-bubble-background-outgoing-v25-0-1:#7195AF;
|
|
21
21
|
--magritte-color-component-chat-bubble-border-outgoing-v25-0-1:#557B96;
|
|
22
22
|
}
|
|
23
|
-
.magritte-chat-bubble___ds9CP_1-
|
|
23
|
+
.magritte-chat-bubble___ds9CP_1-2-0{
|
|
24
24
|
--magritte-chat-bubble-background:var(--magritte-color-component-chat-bubble-background-incoming-v25-0-1);
|
|
25
25
|
--magritte-chat-bubble-border:var(--magritte-color-component-chat-bubble-border-incoming-v25-0-1);
|
|
26
26
|
display:flex;
|
|
@@ -29,32 +29,32 @@
|
|
|
29
29
|
max-width:calc(100% - 40px);
|
|
30
30
|
}
|
|
31
31
|
@media (min-width: 1020px){
|
|
32
|
-
body.magritte-old-layout .magritte-chat-bubble___ds9CP_1-
|
|
32
|
+
body.magritte-old-layout .magritte-chat-bubble___ds9CP_1-2-0{
|
|
33
33
|
max-width:min(460px, 100%);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
@media (min-width: 1024px){
|
|
37
|
-
body:not(.magritte-old-layout) .magritte-chat-bubble___ds9CP_1-
|
|
37
|
+
body:not(.magritte-old-layout) .magritte-chat-bubble___ds9CP_1-2-0{
|
|
38
38
|
max-width:min(460px, 100%);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
.magritte-outgoing___3n00o_1-
|
|
41
|
+
.magritte-outgoing___3n00o_1-2-0{
|
|
42
42
|
--magritte-chat-bubble-background:var(--magritte-color-component-chat-bubble-background-outgoing-v25-0-1);
|
|
43
43
|
--magritte-chat-bubble-border:var(--magritte-color-component-chat-bubble-border-outgoing-v25-0-1);
|
|
44
44
|
align-items:flex-end;
|
|
45
45
|
margin-left:auto;
|
|
46
46
|
}
|
|
47
|
-
.magritte-bot___Z6vZA_1-
|
|
47
|
+
.magritte-bot___Z6vZA_1-2-0{
|
|
48
48
|
--magritte-chat-bubble-background:var(--magritte-color-component-chat-bubble-background-bot-v25-0-1);
|
|
49
49
|
--magritte-chat-bubble-border:var(--magritte-color-component-chat-bubble-border-bot-v25-0-1);
|
|
50
50
|
}
|
|
51
|
-
.magritte-row___mQNnt_1-
|
|
51
|
+
.magritte-row___mQNnt_1-2-0{
|
|
52
52
|
display:flex;
|
|
53
53
|
align-items:flex-end;
|
|
54
54
|
gap:8px;
|
|
55
55
|
max-width:100%;
|
|
56
56
|
}
|
|
57
|
-
.magritte-bubble___NVuDI_1-
|
|
57
|
+
.magritte-bubble___NVuDI_1-2-0{
|
|
58
58
|
position:relative;
|
|
59
59
|
box-sizing:border-box;
|
|
60
60
|
min-width:0;
|
|
@@ -65,61 +65,78 @@
|
|
|
65
65
|
border-radius:20px;
|
|
66
66
|
overflow-wrap:break-word;
|
|
67
67
|
}
|
|
68
|
-
.magritte-with-tail___IdixJ_1-
|
|
68
|
+
.magritte-with-tail___IdixJ_1-2-0 .magritte-bubble___NVuDI_1-2-0{
|
|
69
69
|
border-bottom-left-radius:0;
|
|
70
70
|
}
|
|
71
|
-
.magritte-with-tail___IdixJ_1-
|
|
71
|
+
.magritte-with-tail___IdixJ_1-2-0.magritte-outgoing___3n00o_1-2-0 .magritte-bubble___NVuDI_1-2-0{
|
|
72
72
|
border-bottom-left-radius:20px;
|
|
73
73
|
border-bottom-right-radius:0;
|
|
74
74
|
}
|
|
75
|
-
.magritte-header___Px2to_1-
|
|
75
|
+
.magritte-header___Px2to_1-2-0{
|
|
76
76
|
display:flex;
|
|
77
77
|
flex-direction:column;
|
|
78
78
|
gap:4px;
|
|
79
79
|
margin-bottom:4px;
|
|
80
80
|
}
|
|
81
|
-
.magritte-message-title___dgBFk_1-
|
|
81
|
+
.magritte-message-title___dgBFk_1-2-0{
|
|
82
82
|
margin-bottom:4px;
|
|
83
83
|
}
|
|
84
|
-
.magritte-message___7TEpw_1-
|
|
84
|
+
.magritte-message___7TEpw_1-2-0:not(:first-child){
|
|
85
85
|
margin-top:8px;
|
|
86
86
|
}
|
|
87
|
-
.magritte-buttons___yQqBi_1-
|
|
87
|
+
.magritte-buttons___yQqBi_1-2-0{
|
|
88
88
|
display:grid;
|
|
89
89
|
grid-template-columns:repeat(2, 1fr);
|
|
90
90
|
gap:8px;
|
|
91
91
|
width:100%;
|
|
92
92
|
margin-top:4px;
|
|
93
93
|
}
|
|
94
|
-
.magritte-buttons___yQqBi_1-
|
|
94
|
+
.magritte-buttons___yQqBi_1-2-0 > *:last-child:nth-child(odd){
|
|
95
95
|
grid-column:span 2;
|
|
96
96
|
}
|
|
97
|
-
.magritte-actions___I5GSz_1-
|
|
97
|
+
.magritte-actions___I5GSz_1-2-0{
|
|
98
98
|
display:flex;
|
|
99
99
|
flex-wrap:wrap;
|
|
100
100
|
gap:2px;
|
|
101
101
|
margin-top:4px;
|
|
102
102
|
}
|
|
103
|
-
.magritte-error-text___1ZxWY_1-
|
|
103
|
+
.magritte-error-text___1ZxWY_1-2-0{
|
|
104
104
|
margin-top:2px;
|
|
105
105
|
}
|
|
106
|
-
.magritte-
|
|
106
|
+
.magritte-file___k2IKy_1-2-0{
|
|
107
|
+
display:flex;
|
|
108
|
+
align-items:flex-end;
|
|
109
|
+
}
|
|
110
|
+
.magritte-file___k2IKy_1-2-0 + .magritte-file___k2IKy_1-2-0{
|
|
111
|
+
margin-top:12px;
|
|
112
|
+
}
|
|
113
|
+
.magritte-content-with-header___wiNKB_1-2-0 > .magritte-file___k2IKy_1-2-0:first-child{
|
|
114
|
+
margin-top:8px;
|
|
115
|
+
}
|
|
116
|
+
.magritte-file-preview___eJKu8_1-2-0{
|
|
117
|
+
display:block;
|
|
118
|
+
width:48px;
|
|
119
|
+
height:48px;
|
|
120
|
+
border-radius:8px;
|
|
121
|
+
object-fit:cover;
|
|
122
|
+
}
|
|
123
|
+
.magritte-status___dHzCt_1-2-0{
|
|
107
124
|
display:inline-flex;
|
|
108
125
|
vertical-align:middle;
|
|
109
126
|
margin-left:4px;
|
|
110
127
|
}
|
|
111
128
|
|
|
112
|
-
.magritte-tail___-1lJ0_1-
|
|
129
|
+
.magritte-tail___-1lJ0_1-2-0{
|
|
113
130
|
position:absolute;
|
|
114
131
|
bottom:-1px;
|
|
115
132
|
left:-7px;
|
|
116
133
|
}
|
|
117
|
-
.magritte-tail_outgoing___cnyh3_1-
|
|
134
|
+
.magritte-tail_outgoing___cnyh3_1-2-0{
|
|
118
135
|
left:auto;
|
|
119
136
|
right:-7px;
|
|
120
137
|
transform:scaleX(-1);
|
|
121
138
|
}
|
|
122
|
-
.magritte-meta___HT7lp_1-
|
|
139
|
+
.magritte-meta___HT7lp_1-2-0{
|
|
123
140
|
float:right;
|
|
124
141
|
margin-left:12px;
|
|
125
142
|
white-space:nowrap;
|
package/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { ChatBubble } from '@hh.ru/magritte-ui-chat-bubble/ChatBubble';
|
|
2
|
-
export type { ChatBubbleMode,
|
|
2
|
+
export type { ChatBubbleMode, ChatBubbleProps } from '@hh.ru/magritte-ui-chat-bubble/types';
|
|
3
3
|
export type { ChatBubbleErrorActionProps } from '@hh.ru/magritte-ui-chat-bubble/ErrorAction';
|
|
4
|
+
export type { ChatBubbleFileProps, ChatBubbleFileState } from '@hh.ru/magritte-ui-chat-bubble/File';
|
|
4
5
|
export type { ChatBubbleLabelProps } from '@hh.ru/magritte-ui-chat-bubble/Label';
|
|
5
6
|
export type { ChatBubbleMessageProps } from '@hh.ru/magritte-ui-chat-bubble/Message';
|
|
6
|
-
export type { ChatBubbleStatusProps } from '@hh.ru/magritte-ui-chat-bubble/Status';
|
|
7
|
+
export type { ChatBubbleStatusProps, ChatBubbleStatusValue } from '@hh.ru/magritte-ui-chat-bubble/Status';
|
package/index.js
CHANGED
|
@@ -7,20 +7,24 @@ import '@hh.ru/magritte-ui-button';
|
|
|
7
7
|
import './ErrorAction.js';
|
|
8
8
|
import './internal/errorMenu.js';
|
|
9
9
|
import '@hh.ru/magritte-ui-menu';
|
|
10
|
-
import './
|
|
10
|
+
import './File.js';
|
|
11
|
+
import '@hh.ru/magritte-ui-cell';
|
|
11
12
|
import './internal/colors.js';
|
|
12
13
|
import './internal/mode.js';
|
|
14
|
+
import './internal/utils.js';
|
|
15
|
+
import '@hh.ru/magritte-ui-icon/icon';
|
|
16
|
+
import '@hh.ru/magritte-ui-link';
|
|
17
|
+
import '@hh.ru/magritte-ui-loader';
|
|
18
|
+
import './chat-bubble-CaB7cEff.js';
|
|
19
|
+
import './Label.js';
|
|
13
20
|
import '@hh.ru/magritte-ui-typography';
|
|
14
21
|
import './Message.js';
|
|
15
|
-
import './internal/utils.js';
|
|
16
|
-
import './chat-bubble-Djyvds6I.js';
|
|
17
22
|
import './Status.js';
|
|
18
23
|
import '@hh.ru/magritte-common-use-multiple-refs';
|
|
19
24
|
import '@hh.ru/magritte-common-use-translation';
|
|
20
|
-
import '@hh.ru/magritte-ui-icon/icon';
|
|
21
25
|
import '@hh.ru/magritte-ui-tooltip';
|
|
22
26
|
import './internal/Meta.js';
|
|
23
|
-
import './chat-bubble-
|
|
27
|
+
import './chat-bubble-BjmT1S_i.js';
|
|
24
28
|
import './internal/Tail.js';
|
|
25
29
|
import '@hh.ru/magritte-ui-icon';
|
|
26
30
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/index.mock.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
export type { ChatBubbleMode,
|
|
1
|
+
export type { ChatBubbleMode, ChatBubbleProps } from '@hh.ru/magritte-ui-chat-bubble/types';
|
|
2
2
|
export type { ChatBubbleErrorActionProps } from '@hh.ru/magritte-ui-chat-bubble/ErrorAction';
|
|
3
|
+
export type { ChatBubbleFileProps, ChatBubbleFileState } from '@hh.ru/magritte-ui-chat-bubble/File';
|
|
3
4
|
export type { ChatBubbleLabelProps } from '@hh.ru/magritte-ui-chat-bubble/Label';
|
|
4
5
|
export type { ChatBubbleMessageProps } from '@hh.ru/magritte-ui-chat-bubble/Message';
|
|
5
|
-
export type { ChatBubbleStatusProps } from '@hh.ru/magritte-ui-chat-bubble/Status';
|
|
6
|
+
export type { ChatBubbleStatusProps, ChatBubbleStatusValue } from '@hh.ru/magritte-ui-chat-bubble/Status';
|
|
6
7
|
export declare const ChatBubble: import("react").ForwardRefExoticComponent<Record<string, unknown>> & {
|
|
7
8
|
ErrorAction: import("react").ForwardRefExoticComponent<Record<string, unknown>>;
|
|
9
|
+
File: import("react").ForwardRefExoticComponent<Record<string, unknown>>;
|
|
8
10
|
Label: import("react").ForwardRefExoticComponent<Record<string, unknown>>;
|
|
9
11
|
Message: import("react").ForwardRefExoticComponent<Record<string, unknown>>;
|
|
10
12
|
Status: import("react").ForwardRefExoticComponent<Record<string, unknown>>;
|
package/index.mock.js
CHANGED
|
@@ -2,11 +2,13 @@ import './index.css';
|
|
|
2
2
|
import { mockComponent } from '@hh.ru/magritte-ui-mock-component';
|
|
3
3
|
|
|
4
4
|
const ErrorAction = mockComponent('ChatBubble.ErrorAction', undefined, { withChildren: true });
|
|
5
|
+
const File = mockComponent('ChatBubble.File');
|
|
5
6
|
const Label = mockComponent('ChatBubble.Label', undefined, { withChildren: true });
|
|
6
7
|
const Message = mockComponent('ChatBubble.Message', undefined, { withChildren: true });
|
|
7
8
|
const Status = mockComponent('ChatBubble.Status', undefined, { withChildren: true });
|
|
8
9
|
const ChatBubble = Object.assign(mockComponent('ChatBubble', undefined, { withChildren: true }), {
|
|
9
10
|
ErrorAction,
|
|
11
|
+
File,
|
|
10
12
|
Label,
|
|
11
13
|
Message,
|
|
12
14
|
Status,
|
package/index.mock.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mock.js","sources":["src/index.mock.ts"],"sourcesContent":["import { mockComponent } from '@hh.ru/magritte-ui-mock-component';\n\nexport type { ChatBubbleMode,
|
|
1
|
+
{"version":3,"file":"index.mock.js","sources":["src/index.mock.ts"],"sourcesContent":["import { mockComponent } from '@hh.ru/magritte-ui-mock-component';\n\nexport type { ChatBubbleMode, ChatBubbleProps } from '@hh.ru/magritte-ui-chat-bubble/types';\nexport type { ChatBubbleErrorActionProps } from '@hh.ru/magritte-ui-chat-bubble/ErrorAction';\nexport type { ChatBubbleFileProps, ChatBubbleFileState } from '@hh.ru/magritte-ui-chat-bubble/File';\nexport type { ChatBubbleLabelProps } from '@hh.ru/magritte-ui-chat-bubble/Label';\nexport type { ChatBubbleMessageProps } from '@hh.ru/magritte-ui-chat-bubble/Message';\nexport type { ChatBubbleStatusProps, ChatBubbleStatusValue } from '@hh.ru/magritte-ui-chat-bubble/Status';\n\nconst ErrorAction = mockComponent('ChatBubble.ErrorAction', undefined, { withChildren: true });\nconst File = mockComponent('ChatBubble.File');\nconst Label = mockComponent('ChatBubble.Label', undefined, { withChildren: true });\nconst Message = mockComponent('ChatBubble.Message', undefined, { withChildren: true });\nconst Status = mockComponent('ChatBubble.Status', undefined, { withChildren: true });\n\nexport const ChatBubble = Object.assign(mockComponent('ChatBubble', undefined, { withChildren: true }), {\n ErrorAction,\n File,\n Label,\n Message,\n Status,\n});\n"],"names":[],"mappings":";;AASA,MAAM,WAAW,GAAG,aAAa,CAAC,wBAAwB,EAAE,SAAS,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;AAC/F,MAAM,IAAI,GAAG,aAAa,CAAC,iBAAiB,CAAC,CAAC;AAC9C,MAAM,KAAK,GAAG,aAAa,CAAC,kBAAkB,EAAE,SAAS,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;AACnF,MAAM,OAAO,GAAG,aAAa,CAAC,oBAAoB,EAAE,SAAS,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;AACvF,MAAM,MAAM,GAAG,aAAa,CAAC,mBAAmB,EAAE,SAAS,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;MAExE,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,YAAY,EAAE,SAAS,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,EAAE;IACpG,WAAW;IACX,IAAI;IACJ,KAAK;IACL,OAAO;IACP,MAAM;AACT,CAAA;;;;"}
|
package/internal/Meta.js
CHANGED
|
@@ -2,7 +2,7 @@ import './../index.css';
|
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { getColors } from './colors.js';
|
|
4
4
|
import { Text } from '@hh.ru/magritte-ui-typography';
|
|
5
|
-
import { s as styles } from '../chat-bubble-
|
|
5
|
+
import { s as styles } from '../chat-bubble-BjmT1S_i.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Время и статус сообщения
|
package/internal/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 './mode.js';
|
|
5
|
-
import { s as styles } from '../chat-bubble-
|
|
5
|
+
import { s as styles } from '../chat-bubble-BjmT1S_i.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';
|
package/internal/colors.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import type { TokenColorBackground } from '@hh.ru/magritte-design-tokens/types';
|
|
1
2
|
import type { ButtonStyle } from '@hh.ru/magritte-ui-button';
|
|
2
3
|
import type { ChatBubbleMode } from '@hh.ru/magritte-ui-chat-bubble/types';
|
|
3
4
|
import type { IconColor } from '@hh.ru/magritte-ui-icon';
|
|
5
|
+
import type { LinkProps } from '@hh.ru/magritte-ui-link';
|
|
4
6
|
import type { TextStyle } from '@hh.ru/magritte-ui-typography';
|
|
5
7
|
export interface ChatBubbleColors {
|
|
6
|
-
/** Основной текст
|
|
8
|
+
/** Основной текст сообщения, названия файла */
|
|
7
9
|
text: TextStyle;
|
|
8
10
|
/** Второстепенный текст: время, размер файла, описание сниппета */
|
|
9
11
|
secondaryText: TextStyle;
|
|
@@ -15,5 +17,13 @@ export interface ChatBubbleColors {
|
|
|
15
17
|
actionsIcon: IconColor;
|
|
16
18
|
/** Кнопки под бабблом */
|
|
17
19
|
button: ButtonStyle;
|
|
20
|
+
/** Ссылка-действие: «Открыть», «Загрузить» */
|
|
21
|
+
link: Pick<LinkProps, 'style' | 'mode'>;
|
|
22
|
+
/** Иконка рядом со второстепенным текстом: лоадер загрузки файла */
|
|
23
|
+
secondaryIcon: IconColor;
|
|
24
|
+
/** Иконка файла */
|
|
25
|
+
fileIcon: IconColor;
|
|
26
|
+
/** Подложка под иконкой файла */
|
|
27
|
+
fileIconBackground: TokenColorBackground;
|
|
18
28
|
}
|
|
19
29
|
export declare const getColors: (mode: ChatBubbleMode) => ChatBubbleColors;
|
package/internal/colors.js
CHANGED
|
@@ -7,6 +7,10 @@ const COLORS = {
|
|
|
7
7
|
statusIcon: 'constant',
|
|
8
8
|
actionsIcon: 'secondary',
|
|
9
9
|
button: 'neutral',
|
|
10
|
+
link: { style: 'accent' },
|
|
11
|
+
secondaryIcon: 'secondary',
|
|
12
|
+
fileIcon: 'constant',
|
|
13
|
+
fileIconBackground: 'accent',
|
|
10
14
|
},
|
|
11
15
|
outgoing: {
|
|
12
16
|
text: 'constant',
|
|
@@ -15,6 +19,10 @@ const COLORS = {
|
|
|
15
19
|
statusIcon: 'constant',
|
|
16
20
|
actionsIcon: 'accent',
|
|
17
21
|
button: 'accent',
|
|
22
|
+
link: { style: 'constant', mode: 'secondary' },
|
|
23
|
+
secondaryIcon: 'constant',
|
|
24
|
+
fileIcon: 'accent',
|
|
25
|
+
fileIconBackground: 'accent-secondary',
|
|
18
26
|
},
|
|
19
27
|
bot: {
|
|
20
28
|
text: 'primary',
|
|
@@ -23,6 +31,10 @@ const COLORS = {
|
|
|
23
31
|
statusIcon: 'special',
|
|
24
32
|
actionsIcon: 'special',
|
|
25
33
|
button: 'special',
|
|
34
|
+
link: { style: 'accent' },
|
|
35
|
+
secondaryIcon: 'secondary',
|
|
36
|
+
fileIcon: 'constant',
|
|
37
|
+
fileIconBackground: 'special',
|
|
26
38
|
},
|
|
27
39
|
};
|
|
28
40
|
const getColors = (mode) => COLORS[mode];
|
package/internal/colors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.js","sources":["src/internal/colors.ts"],"sourcesContent":["import type { ButtonStyle } from '@hh.ru/magritte-ui-button';\nimport type { ChatBubbleMode } from '@hh.ru/magritte-ui-chat-bubble/types';\nimport type { IconColor } from '@hh.ru/magritte-ui-icon';\nimport type { TextStyle } from '@hh.ru/magritte-ui-typography';\n\nexport interface ChatBubbleColors {\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 { ButtonStyle } from '@hh.ru/magritte-ui-button';\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 /** Иконка статуса, лежит на фоне баббла */\n statusIcon: IconColor;\n /** Иконки действий, лежат под бабблом на фоне страницы */\n actionsIcon: IconColor;\n /** Кнопки под бабблом */\n button: ButtonStyle;\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 statusIcon: 'constant',\n actionsIcon: 'secondary',\n button: '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 statusIcon: 'constant',\n actionsIcon: 'accent',\n button: '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 statusIcon: 'special',\n actionsIcon: 'special',\n button: '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"],"names":[],"mappings":"AA8BA,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,UAAU;AACtB,QAAA,WAAW,EAAE,WAAW;AACxB,QAAA,MAAM,EAAE,SAAS;AACjB,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,WAAW,EAAE,QAAQ;AACrB,QAAA,MAAM,EAAE,QAAQ;QAChB,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,SAAS;AACrB,QAAA,WAAW,EAAE,SAAS;AACtB,QAAA,MAAM,EAAE,SAAS;AACjB,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;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hh.ru/magritte-ui-chat-bubble",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"sideEffects": [
|
|
@@ -24,8 +24,11 @@
|
|
|
24
24
|
"@hh.ru/magritte-design-tokens": "25.0.1",
|
|
25
25
|
"@hh.ru/magritte-ui-breakpoint": "6.1.1",
|
|
26
26
|
"@hh.ru/magritte-ui-button": "7.3.0",
|
|
27
|
+
"@hh.ru/magritte-ui-cell": "7.2.38",
|
|
27
28
|
"@hh.ru/magritte-ui-icon": "15.0.3",
|
|
28
|
-
"@hh.ru/magritte-ui-
|
|
29
|
+
"@hh.ru/magritte-ui-link": "7.2.0",
|
|
30
|
+
"@hh.ru/magritte-ui-loader": "4.1.0",
|
|
31
|
+
"@hh.ru/magritte-ui-menu": "1.0.34",
|
|
29
32
|
"@hh.ru/magritte-ui-mock-component": "1.1.7",
|
|
30
33
|
"@hh.ru/magritte-ui-tooltip": "11.0.44",
|
|
31
34
|
"@hh.ru/magritte-ui-typography": "5.3.12"
|
|
@@ -37,5 +40,5 @@
|
|
|
37
40
|
"publishConfig": {
|
|
38
41
|
"access": "public"
|
|
39
42
|
},
|
|
40
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "908702cc0743dad7b2875c13c8f7abd8b3ceb011"
|
|
41
44
|
}
|
package/types.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
/** Тип сообщения */
|
|
3
3
|
export type ChatBubbleMode = 'incoming' | 'outgoing' | 'bot';
|
|
4
|
-
/** Статус исходящего сообщения */
|
|
5
|
-
export type ChatBubbleStatusValue = 'sending' | 'sent' | 'delivered';
|
|
6
4
|
export interface ChatBubbleProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
7
5
|
/**
|
|
8
6
|
* Тип сообщения по отправителю
|
package/chat-bubble-B2HOuNTb.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import './index.css';
|
|
2
|
-
var styles = {"tail":"magritte-tail___-1lJ0_1-1-0","tail_outgoing":"magritte-tail_outgoing___cnyh3_1-1-0","tailOutgoing":"magritte-tail_outgoing___cnyh3_1-1-0","meta":"magritte-meta___HT7lp_1-1-0"};
|
|
3
|
-
|
|
4
|
-
export { styles as s };
|
|
5
|
-
//# sourceMappingURL=chat-bubble-B2HOuNTb.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chat-bubble-B2HOuNTb.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
package/chat-bubble-Djyvds6I.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import './index.css';
|
|
2
|
-
var styles = {"chat-bubble":"magritte-chat-bubble___ds9CP_1-1-0","chatBubble":"magritte-chat-bubble___ds9CP_1-1-0","outgoing":"magritte-outgoing___3n00o_1-1-0","bot":"magritte-bot___Z6vZA_1-1-0","row":"magritte-row___mQNnt_1-1-0","bubble":"magritte-bubble___NVuDI_1-1-0","with-tail":"magritte-with-tail___IdixJ_1-1-0","withTail":"magritte-with-tail___IdixJ_1-1-0","header":"magritte-header___Px2to_1-1-0","message-title":"magritte-message-title___dgBFk_1-1-0","messageTitle":"magritte-message-title___dgBFk_1-1-0","message":"magritte-message___7TEpw_1-1-0","buttons":"magritte-buttons___yQqBi_1-1-0","actions":"magritte-actions___I5GSz_1-1-0","error-text":"magritte-error-text___1ZxWY_1-1-0","errorText":"magritte-error-text___1ZxWY_1-1-0","status":"magritte-status___dHzCt_1-1-0"};
|
|
3
|
-
|
|
4
|
-
export { styles as s };
|
|
5
|
-
//# sourceMappingURL=chat-bubble-Djyvds6I.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chat-bubble-Djyvds6I.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|