@hh.ru/magritte-ui-chat-bubble 3.0.5 → 3.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/Call.d.ts +2 -2
  2. package/Call.js +41 -9
  3. package/Call.js.map +1 -1
  4. package/ChatBubble.d.ts +10 -10
  5. package/ChatBubble.js +92 -16
  6. package/ChatBubble.js.map +1 -1
  7. package/ErrorAction.js +8 -9
  8. package/ErrorAction.js.map +1 -1
  9. package/File.d.ts +2 -2
  10. package/File.js +59 -15
  11. package/File.js.map +1 -1
  12. package/Label.js +4 -7
  13. package/Label.js.map +1 -1
  14. package/Media.d.ts +2 -2
  15. package/Media.js +15 -8
  16. package/Media.js.map +1 -1
  17. package/Message.d.ts +2 -2
  18. package/Message.js +11 -9
  19. package/Message.js.map +1 -1
  20. package/Meta.d.ts +1 -1
  21. package/Meta.js +12 -10
  22. package/Meta.js.map +1 -1
  23. package/Reply.js +31 -8
  24. package/Reply.js.map +1 -1
  25. package/Snippet.js +21 -8
  26. package/Snippet.js.map +1 -1
  27. package/Status.js +28 -19
  28. package/Status.js.map +1 -1
  29. package/Tail.js +20 -5
  30. package/Tail.js.map +1 -1
  31. package/chat-bubble-BOBGge0h.js +5 -0
  32. package/chat-bubble-BOBGge0h.js.map +1 -0
  33. package/index.css +114 -114
  34. package/index.d.ts +11 -11
  35. package/index.js +1 -1
  36. package/index.mock.d.ts +10 -10
  37. package/index.mock.js +19 -19
  38. package/index.mock.js.map +1 -1
  39. package/internal/colors.d.ts +1 -1
  40. package/internal/colors.js +36 -37
  41. package/internal/colors.js.map +1 -1
  42. package/internal/errorMenu.js +1 -1
  43. package/internal/errorMenu.js.map +1 -1
  44. package/internal/mode.d.ts +1 -1
  45. package/internal/mode.js +1 -2
  46. package/internal/mode.js.map +1 -1
  47. package/internal/utils.js +10 -10
  48. package/internal/utils.js.map +1 -1
  49. package/package.json +11 -11
  50. package/chat-bubble-DgO7_sM3.js +0 -5
  51. package/chat-bubble-DgO7_sM3.js.map +0 -1
package/Call.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type HTMLAttributes, type ReactNode } from 'react';
2
- import { type ChatBubbleMetaHostProps } from '@hh.ru/magritte-ui-chat-bubble/internal/utils';
2
+ import { type ChatBubbleMetaHostProps } from './internal/utils';
3
3
  export type ChatBubbleCallState = 'connected' | 'not-connected';
4
4
  type ChatBubbleCallHelper = HTMLAttributes<HTMLDivElement> & ChatBubbleMetaHostProps;
5
5
  export interface ChatBubbleCallProps extends Omit<ChatBubbleCallHelper, 'children' | 'title'> {
@@ -20,5 +20,5 @@ export interface ChatBubbleCallProps extends Omit<ChatBubbleCallHelper, 'childre
20
20
  */
21
21
  'data-qa'?: string;
22
22
  }
23
- export declare const ChatBubbleCall: import("react").ForwardRefExoticComponent<ChatBubbleCallProps & import("react").RefAttributes<HTMLDivElement>> & import("@hh.ru/magritte-ui-chat-bubble/internal/utils").MetaHostComponent;
23
+ export declare const ChatBubbleCall: import("react").ForwardRefExoticComponent<ChatBubbleCallProps & import("react").RefAttributes<HTMLDivElement>> & import("./internal/utils").MetaHostComponent;
24
24
  export {};
package/Call.js CHANGED
@@ -6,18 +6,50 @@ 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-DgO7_sM3.js';
9
+ import { s as styles } from './chat-bubble-BOBGge0h.js';
10
10
 
11
- /** Входящий/исходящий звонок */
12
- const ChatBubbleCallComponent = forwardRef(({ 'data-qa': dataQa = 'chat-bubble-call', title, description, meta, state = 'connected', ...props }, ref) => {
11
+ const ChatBubbleCallComponent = forwardRef(
12
+ ({ "data-qa": dataQa = "chat-bubble-call", title, description, meta, state = "connected", ...props }, ref) => {
13
13
  const mode = useChatBubbleMode();
14
14
  const colors = useChatBubbleColors();
15
- // у несостоявшегося звонка - крестик в любом режиме, иначе - стрелка по направлению
16
- const connectedIcon = mode === 'outgoing' ? PhoneArrowOutFilledSize24 : PhoneArrowInFilledSize24;
17
- const Icon = state === 'connected' ? connectedIcon : PhoneCrossFilledSize24;
18
- return (jsxs("div", { ...props, className: styles.file, "data-qa": dataQa, ref: ref, children: [jsxs(Cell, { align: "center", horPadding: false, vertPadding: false, left: 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-call-name", children: title }), description && (jsx(CellText, { type: "subtitle", style: state === 'not-connected' && mode === 'incoming' ? 'negative' : colors.secondaryText, maxLines: 1, "data-qa": "chat-bubble-call-description", children: description }))] }), meta] }));
19
- });
20
- ChatBubbleCallComponent.displayName = 'ChatBubbleCall';
15
+ const connectedIcon = mode === "outgoing" ? PhoneArrowOutFilledSize24 : PhoneArrowInFilledSize24;
16
+ const Icon = state === "connected" ? connectedIcon : PhoneCrossFilledSize24;
17
+ return /* @__PURE__ */ jsxs("div", { ...props, className: styles.file, "data-qa": dataQa, ref, children: [
18
+ /* @__PURE__ */ jsxs(
19
+ Cell,
20
+ {
21
+ align: "center",
22
+ horPadding: false,
23
+ vertPadding: false,
24
+ left: /* @__PURE__ */ jsx(
25
+ Icon,
26
+ {
27
+ initialColor: colors.fileIcon,
28
+ backgroundStyle: colors.fileIconBackground,
29
+ padding: 12,
30
+ borderRadius: 8
31
+ }
32
+ ),
33
+ children: [
34
+ /* @__PURE__ */ jsx(CellText, { type: "title", style: colors.text, maxLines: 1, "data-qa": "chat-bubble-call-name", children: title }),
35
+ description && /* @__PURE__ */ jsx(
36
+ CellText,
37
+ {
38
+ type: "subtitle",
39
+ style: state === "not-connected" && mode === "incoming" ? "negative" : colors.secondaryText,
40
+ maxLines: 1,
41
+ "data-qa": "chat-bubble-call-description",
42
+ children: description
43
+ }
44
+ )
45
+ ]
46
+ }
47
+ ),
48
+ meta
49
+ ] });
50
+ }
51
+ );
52
+ ChatBubbleCallComponent.displayName = "ChatBubbleCall";
21
53
  const ChatBubbleCall = markMetaHost(ChatBubbleCallComponent);
22
54
 
23
55
  export { ChatBubbleCall };
package/Call.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Call.js","sources":["src/Call.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\n\nimport { Cell, CellText } from '@hh.ru/magritte-ui-cell';\nimport { useChatBubbleColors } 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 {\n PhoneArrowInFilledSize24,\n PhoneArrowOutFilledSize24,\n PhoneCrossFilledSize24,\n} from '@hh.ru/magritte-ui-icon/icon';\n\nimport styles from './chat-bubble.less';\n\nexport type ChatBubbleCallState = 'connected' | 'not-connected';\n\ntype ChatBubbleCallHelper = HTMLAttributes<HTMLDivElement> & ChatBubbleMetaHostProps;\n\nexport interface ChatBubbleCallProps extends Omit<ChatBubbleCallHelper, 'children' | 'title'> {\n /** Заголовок */\n title?: ReactNode;\n /**\n * Строка под заголовком (например, для длительности звонка)\n */\n description?: ReactNode;\n /**\n * Состояние звонка\n * @default connected\n */\n state?: ChatBubbleCallState;\n /**\n * Значение data-qa\n * @default chat-bubble-call\n */\n 'data-qa'?: string;\n}\n\n/** Входящий/исходящий звонок */\nconst ChatBubbleCallComponent = forwardRef<HTMLDivElement, ChatBubbleCallProps>(\n ({ 'data-qa': dataQa = 'chat-bubble-call', title, description, meta, state = 'connected', ...props }, ref) => {\n const mode = useChatBubbleMode();\n const colors = useChatBubbleColors();\n // у несостоявшегося звонка - крестик в любом режиме, иначе - стрелка по направлению\n const connectedIcon = mode === 'outgoing' ? PhoneArrowOutFilledSize24 : PhoneArrowInFilledSize24;\n const Icon = state === 'connected' ? connectedIcon : PhoneCrossFilledSize24;\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 <Icon\n initialColor={colors.fileIcon}\n backgroundStyle={colors.fileIconBackground}\n padding={12}\n borderRadius={8}\n />\n }\n >\n <CellText type=\"title\" style={colors.text} maxLines={1} data-qa=\"chat-bubble-call-name\">\n {title}\n </CellText>\n {description && (\n <CellText\n type=\"subtitle\"\n style={state === 'not-connected' && mode === 'incoming' ? 'negative' : colors.secondaryText}\n maxLines={1}\n data-qa=\"chat-bubble-call-description\"\n >\n {description}\n </CellText>\n )}\n </Cell>\n {meta}\n </div>\n );\n }\n);\n\nChatBubbleCallComponent.displayName = 'ChatBubbleCall';\n\nexport const ChatBubbleCall = markMetaHost(ChatBubbleCallComponent);\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;AAqCA;AACA,MAAM,uBAAuB,GAAG,UAAU,CACtC,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,kBAAkB,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,GAAG,WAAW,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAI;AACzG,IAAA,MAAM,IAAI,GAAG,iBAAiB,EAAE,CAAC;AACjC,IAAA,MAAM,MAAM,GAAG,mBAAmB,EAAE,CAAC;;AAErC,IAAA,MAAM,aAAa,GAAG,IAAI,KAAK,UAAU,GAAG,yBAAyB,GAAG,wBAAwB,CAAC;AACjG,IAAA,MAAM,IAAI,GAAG,KAAK,KAAK,WAAW,GAAG,aAAa,GAAG,sBAAsB,CAAC;IAE5E,QACIA,IAAS,CAAA,KAAA,EAAA,EAAA,GAAA,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,IAAI,EAAW,SAAA,EAAA,MAAM,EAAE,GAAG,EAAE,GAAG,EAC7D,QAAA,EAAA,CAAAA,IAAA,CAAC,IAAI,EAAA,EACD,KAAK,EAAC,QAAQ,EACd,UAAU,EAAE,KAAK,EACjB,WAAW,EAAE,KAAK,EAClB,IAAI,EACAC,GAAC,CAAA,IAAI,EACD,EAAA,YAAY,EAAE,MAAM,CAAC,QAAQ,EAC7B,eAAe,EAAE,MAAM,CAAC,kBAAkB,EAC1C,OAAO,EAAE,EAAE,EACX,YAAY,EAAE,CAAC,EACjB,CAAA,EAAA,QAAA,EAAA,CAGNA,GAAC,CAAA,QAAQ,EAAC,EAAA,IAAI,EAAC,OAAO,EAAC,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAU,SAAA,EAAA,uBAAuB,EAClF,QAAA,EAAA,KAAK,EACC,CAAA,EACV,WAAW,KACRA,GAAA,CAAC,QAAQ,EAAA,EACL,IAAI,EAAC,UAAU,EACf,KAAK,EAAE,KAAK,KAAK,eAAe,IAAI,IAAI,KAAK,UAAU,GAAG,UAAU,GAAG,MAAM,CAAC,aAAa,EAC3F,QAAQ,EAAE,CAAC,EAAA,SAAA,EACH,8BAA8B,EAAA,QAAA,EAErC,WAAW,EAAA,CACL,CACd,CAAA,EAAA,CACE,EACN,IAAI,CACH,EAAA,CAAA,EACR;AACN,CAAC,CACJ,CAAC;AAEF,uBAAuB,CAAC,WAAW,GAAG,gBAAgB,CAAC;MAE1C,cAAc,GAAG,YAAY,CAAC,uBAAuB;;;;"}
1
+ {"version":3,"file":"Call.js","sources":["src/Call.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';\n\nimport { Cell, CellText } from '@hh.ru/magritte-ui-cell';\nimport { useChatBubbleColors } 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 {\n PhoneArrowInFilledSize24,\n PhoneArrowOutFilledSize24,\n PhoneCrossFilledSize24,\n} from '@hh.ru/magritte-ui-icon/icon';\n\nimport styles from './chat-bubble.less';\n\nexport type ChatBubbleCallState = 'connected' | 'not-connected';\n\ntype ChatBubbleCallHelper = HTMLAttributes<HTMLDivElement> & ChatBubbleMetaHostProps;\n\nexport interface ChatBubbleCallProps extends Omit<ChatBubbleCallHelper, 'children' | 'title'> {\n /** Заголовок */\n title?: ReactNode;\n /**\n * Строка под заголовком (например, для длительности звонка)\n */\n description?: ReactNode;\n /**\n * Состояние звонка\n * @default connected\n */\n state?: ChatBubbleCallState;\n /**\n * Значение data-qa\n * @default chat-bubble-call\n */\n 'data-qa'?: string;\n}\n\n/** Входящий/исходящий звонок */\nconst ChatBubbleCallComponent = forwardRef<HTMLDivElement, ChatBubbleCallProps>(\n ({ 'data-qa': dataQa = 'chat-bubble-call', title, description, meta, state = 'connected', ...props }, ref) => {\n const mode = useChatBubbleMode();\n const colors = useChatBubbleColors();\n // у несостоявшегося звонка - крестик в любом режиме, иначе - стрелка по направлению\n const connectedIcon = mode === 'outgoing' ? PhoneArrowOutFilledSize24 : PhoneArrowInFilledSize24;\n const Icon = state === 'connected' ? connectedIcon : PhoneCrossFilledSize24;\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 <Icon\n initialColor={colors.fileIcon}\n backgroundStyle={colors.fileIconBackground}\n padding={12}\n borderRadius={8}\n />\n }\n >\n <CellText type=\"title\" style={colors.text} maxLines={1} data-qa=\"chat-bubble-call-name\">\n {title}\n </CellText>\n {description && (\n <CellText\n type=\"subtitle\"\n style={state === 'not-connected' && mode === 'incoming' ? 'negative' : colors.secondaryText}\n maxLines={1}\n data-qa=\"chat-bubble-call-description\"\n >\n {description}\n </CellText>\n )}\n </Cell>\n {meta}\n </div>\n );\n }\n);\n\nChatBubbleCallComponent.displayName = 'ChatBubbleCall';\n\nex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;AAAA,cAAC,QAAA;AAAA,cAAA;AAAA,gBACG,IAAK,EAAA,UAAA;AAAA,gBACL,OAAO,KAAU,KAAA,eAAA,IAAmB,IAAS,KAAA,UAAA,GAAa,aAAa,MAAO,CAAA,aAAA;AAAA,gBAC9E,QAAU,EAAA,CAAA;AAAA,gBACV,SAAQ,EAAA,8BAAA;AAAA,gBAEP,QAAA,EAAA,WAAA;AAAA,eAAA;AAAA,aACL;AAAA,WAAA;AAAA,SAAA;AAAA,OAER;AAAA,MACC,IAAA;AAAA,KACL,EAAA,CAAA,CAAA;AAAA,GAER;AACJ,CAAA,CAAA;AAEA,uBAAA,CAAwB,WAAc,GAAA,gBAAA,CAAA;AAEzB,MAAA,cAAA,GAAiB,aAAa,uBAAuB;;;;"}
package/ChatBubble.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { ChatBubbleCall } from '@hh.ru/magritte-ui-chat-bubble/Call';
2
- import { ChatBubbleErrorAction } from '@hh.ru/magritte-ui-chat-bubble/ErrorAction';
3
- import { ChatBubbleFile } from '@hh.ru/magritte-ui-chat-bubble/File';
4
- import { ChatBubbleLabel } from '@hh.ru/magritte-ui-chat-bubble/Label';
5
- import { ChatBubbleMedia } from '@hh.ru/magritte-ui-chat-bubble/Media';
6
- import { ChatBubbleMessage } from '@hh.ru/magritte-ui-chat-bubble/Message';
7
- import { ChatBubbleReply } from '@hh.ru/magritte-ui-chat-bubble/Reply';
8
- import { ChatBubbleSnippet } from '@hh.ru/magritte-ui-chat-bubble/Snippet';
9
- import { ChatBubbleStatus } from '@hh.ru/magritte-ui-chat-bubble/Status';
10
- import type { ChatBubbleProps } from '@hh.ru/magritte-ui-chat-bubble/types';
1
+ import { ChatBubbleCall } from './Call';
2
+ import { ChatBubbleErrorAction } from './ErrorAction';
3
+ import { ChatBubbleFile } from './File';
4
+ import { ChatBubbleLabel } from './Label';
5
+ import { ChatBubbleMedia } from './Media';
6
+ import { ChatBubbleMessage } from './Message';
7
+ import { ChatBubbleReply } from './Reply';
8
+ import { ChatBubbleSnippet } from './Snippet';
9
+ import { ChatBubbleStatus } from './Status';
10
+ import type { ChatBubbleProps } from './types';
11
11
  interface ChatBubbleComponents {
12
12
  Call: typeof ChatBubbleCall;
13
13
  ErrorAction: typeof ChatBubbleErrorAction;
package/ChatBubble.js CHANGED
@@ -22,7 +22,7 @@ import { flattenFragments, isMetaHost } from './internal/utils.js';
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-DgO7_sM3.js';
25
+ import { s as styles } from './chat-bubble-BOBGge0h.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,7 +30,23 @@ 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(({ aside, buttons, children, header, edited, errorActions, mode = 'incoming', showTail = false, status, time, error = false, errorText, 'data-qa': dataQa = 'chat-bubble', className, }, ref) => {
33
+ const ChatBubble = forwardRef(
34
+ ({
35
+ aside,
36
+ buttons,
37
+ children,
38
+ header,
39
+ edited,
40
+ errorActions,
41
+ mode = "incoming",
42
+ showTail = false,
43
+ status,
44
+ time,
45
+ error = false,
46
+ errorText,
47
+ "data-qa": dataQa = "chat-bubble",
48
+ className
49
+ }, ref) => {
34
50
  const rowRef = useRef(null);
35
51
  const activatorMenuRef = useRef(null);
36
52
  const [menuVisible, setMenuVisible] = useState(false);
@@ -38,25 +54,85 @@ const ChatBubble = forwardRef(({ aside, buttons, children, header, edited, error
38
54
  const [asideShow, setAsideShow] = useState(false);
39
55
  const showAside = useCallback(() => setAsideShow(true), []);
40
56
  const hideAside = useCallback(() => setAsideShow(false), []);
41
- // скрываем aside при кликах вне
42
57
  useCloseByClickOutside(rowRef, hideAside, asideShow);
43
58
  const colors = getColors(mode);
44
- const buttonsProps = useMemo(() => ({ size: 'small', stretched: true, ...colors.button }), [colors]);
45
- /**
46
- * Время отдаём последнему элементу контента
47
- * Позиция времени меняется, в зависимости от компонента
48
- * Если последний ребенок не может отрисовать, вставим meta в самый конец
49
- */
50
- const meta = jsx(Meta, { mode: mode, status: status, time: time, edited: edited });
59
+ const buttonsProps = useMemo(
60
+ () => ({ size: "small", stretched: true, ...colors.button }),
61
+ [colors]
62
+ );
63
+ const meta = /* @__PURE__ */ jsx(Meta, { mode, status, time, edited });
51
64
  const items = flattenFragments(children);
52
65
  const lastIndex = items.length - 1;
53
66
  const metaHosted = isMetaHost(items[lastIndex]);
54
- const content = items.map((child, index) => index === lastIndex && isMetaHost(child) ? cloneElement(child, { meta }) : child);
55
- return (jsx(ChatBubbleModeProvider, { value: mode, children: jsxs("div", { className: classnames(className, styles.chatBubble, styles[mode], {
56
- [styles.withTail]: showTail,
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 }) }))] }) }));
58
- });
59
- ChatBubble.displayName = 'ChatBubble';
67
+ const content = items.map(
68
+ (child, index) => index === lastIndex && isMetaHost(child) ? cloneElement(child, { meta }) : child
69
+ );
70
+ return /* @__PURE__ */ jsx(ChatBubbleModeProvider, { value: mode, children: /* @__PURE__ */ jsxs(
71
+ "div",
72
+ {
73
+ className: classnames(className, styles.chatBubble, styles[mode], {
74
+ [styles.withTail]: showTail
75
+ }),
76
+ "data-qa": dataQa,
77
+ ref,
78
+ children: [
79
+ /* @__PURE__ */ jsxs(
80
+ "div",
81
+ {
82
+ className: styles.row,
83
+ onMouseEnter: aside ? showAside : void 0,
84
+ onMouseLeave: aside ? hideAside : void 0,
85
+ onClick: aside ? showAside : void 0,
86
+ ref: rowRef,
87
+ children: [
88
+ /* @__PURE__ */ jsxs("div", { className: styles.bubble, children: [
89
+ header,
90
+ content,
91
+ !metaHosted && meta,
92
+ showTail && /* @__PURE__ */ jsx(Tail, {})
93
+ ] }),
94
+ mode === "outgoing" && error && /* @__PURE__ */ jsxs("div", { children: [
95
+ /* @__PURE__ */ jsx(
96
+ ExclamationCircleFilledSize24,
97
+ {
98
+ ref: activatorMenuRef,
99
+ initialColor: "negative",
100
+ onClick: errorActions ? () => setMenuVisible((visible) => !visible) : void 0,
101
+ "data-qa": "chat-bubble-error-button",
102
+ "aria-haspopup": errorActions ? "menu" : void 0,
103
+ "aria-expanded": errorActions ? menuVisible : void 0
104
+ }
105
+ ),
106
+ errorActions && /* @__PURE__ */ jsx(
107
+ Menu,
108
+ {
109
+ activatorRef: activatorMenuRef,
110
+ onClose: closeErrorMenu,
111
+ placement: "bottom-right",
112
+ visible: menuVisible,
113
+ children: /* @__PURE__ */ jsx(ChatBubbleErrorMenuProvider, { value: closeErrorMenu, children: errorActions })
114
+ }
115
+ )
116
+ ] }),
117
+ aside && /* @__PURE__ */ jsx(
118
+ "div",
119
+ {
120
+ className: classnames(styles.aside, { [styles.asideRevealed]: asideShow }),
121
+ "data-qa": "chat-bubble-aside",
122
+ children: aside
123
+ }
124
+ )
125
+ ]
126
+ }
127
+ ),
128
+ mode === "outgoing" && error && errorText && /* @__PURE__ */ jsx("div", { className: styles.errorText, "data-qa": "chat-bubble-error-text", children: /* @__PURE__ */ jsx(Text, { typography: "label-4-regular", style: "negative", maxLines: 2, children: errorText }) }),
129
+ buttons && /* @__PURE__ */ jsx(ButtonDefaultPropsContext, { props: buttonsProps, children: /* @__PURE__ */ jsx("div", { className: styles.buttons, "data-qa": "chat-bubble-buttons", children: buttons }) })
130
+ ]
131
+ }
132
+ ) });
133
+ }
134
+ );
135
+ ChatBubble.displayName = "ChatBubble";
60
136
  ChatBubble.Call = ChatBubbleCall;
61
137
  ChatBubble.ErrorAction = ChatBubbleErrorAction;
62
138
  ChatBubble.File = ChatBubbleFile;
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 { 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 = ChatBubbleStatus;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAuCa,UAAU,GAAG,UAAU,CAChC,CACI,EACI,KAAK,EACL,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;AACA,IAAA,MAAM,MAAM,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;AAC5C,IAAA,MAAM,gBAAgB,GAAG,MAAM,CAAa,IAAI,CAAC,CAAC;IAElD,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,C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BAAqB,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;;;;"}
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 = ChatBubbleStatus;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCO,MAAM,UAAa,GAAA,UAAA;AAAA,EACtB,CACI;AAAA,IACI,KAAA;AAAA,IACA,OAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA;AAAA,IACA,MAAA;AAAA,IACA,YAAA;AAAA,IACA,IAAO,GAAA,UAAA;AAAA,IACP,QAAW,GAAA,KAAA;AAAA,IACX,MAAA;AAAA,IACA,IAAA;AAAA,IACA,KAAQ,GAAA,KAAA;AAAA,IACR,SAAA;AAAA,IACA,WAAW,MAAS,GAAA,aAAA;AAAA,IACpB,SAAA;AAAA,KAEJ,GACC,KAAA;AACD,IAAM,MAAA,MAAA,GAAS,OAAuB,IAAI,CAAA,CAAA;AAC1C,IAAM,MAAA,gBAAA,GAAmB,OAAmB,IAAI,CAAA,CAAA;AAEhD,IAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,SAAS,KAAK,CAAA,CAAA;AACpD,IAAA,MAAM,iBAAiB,WAAY,CAAA,MAAM,eAAe,KAAK,CAAA,EAAG,EAAE,CAAA,CAAA;AAElE,IAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,SAAS,KAAK,CAAA,CAAA;AAChD,IAAA,MAAM,YAAY,WAAY,CAAA,MAAM,aAAa,IAAI,CAAA,EAAG,EAAE,CAAA,CAAA;AAC1D,IAAA,MAAM,YAAY,WAAY,CAAA,MAAM,aAAa,KAAK,CAAA,EAAG,EAAE,CAAA,CAAA;AAG3D,I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rB,UAAA,CAAW,KAAQ,GAAA,eAAA,CAAA;AACnB,UAAA,CAAW,OAAU,GAAA,iBAAA,CAAA;AACrB,UAAA,CAAW,MAAS,GAAA,gBAAA;;;;"}
package/ErrorAction.js CHANGED
@@ -4,18 +4,17 @@ import { forwardRef } from 'react';
4
4
  import { useChatBubbleErrorMenuClose } from './internal/errorMenu.js';
5
5
  import { Menu } from '@hh.ru/magritte-ui-menu';
6
6
 
7
- /**
8
- * Пункт меню, которое открывается по нажатию на иконку ошибки отправки.
9
- */
10
- const ChatBubbleErrorAction = forwardRef(({ 'data-qa': dataQa = 'chat-bubble-error-action', onClick, ...props }, ref) => {
7
+ const ChatBubbleErrorAction = forwardRef(
8
+ ({ "data-qa": dataQa = "chat-bubble-error-action", onClick, ...props }, ref) => {
11
9
  const close = useChatBubbleErrorMenuClose();
12
10
  const handleClick = (event) => {
13
- onClick?.(event);
14
- close();
11
+ onClick?.(event);
12
+ close();
15
13
  };
16
- return jsx(Menu.Item, { ...props, "data-qa": dataQa, onClick: handleClick, ref: ref });
17
- });
18
- ChatBubbleErrorAction.displayName = 'ChatBubbleErrorAction';
14
+ return /* @__PURE__ */ jsx(Menu.Item, { ...props, "data-qa": dataQa, onClick: handleClick, ref });
15
+ }
16
+ );
17
+ ChatBubbleErrorAction.displayName = "ChatBubbleErrorAction";
19
18
 
20
19
  export { ChatBubbleErrorAction };
21
20
  //# sourceMappingURL=ErrorAction.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorAction.js","sources":["src/ErrorAction.tsx"],"sourcesContent":["import { forwardRef, type MouseEvent } from 'react';\n\nimport { useChatBubbleErrorMenuClose } from '@hh.ru/magritte-ui-chat-bubble/internal/errorMenu';\nimport { Menu, type MenuItemProps } from '@hh.ru/magritte-ui-menu';\n\nexport interface ChatBubbleErrorActionProps extends Pick<\n MenuItemProps,\n 'children' | 'disabled' | 'icon' | 'style' | 'subtitle' | 'onClick'\n> {\n /** Значение data-qa\n * @default chat-bubble-error-action\n */\n 'data-qa'?: string;\n}\n\n/**\n * Пункт меню, которое открывается по нажатию на иконку ошибки отправки.\n */\nexport const ChatBubbleErrorAction = forwardRef<HTMLDivElement, ChatBubbleErrorActionProps>(\n ({ 'data-qa': dataQa = 'chat-bubble-error-action', onClick, ...props }, ref) => {\n const close = useChatBubbleErrorMenuClose();\n\n const handleClick = (event: MouseEvent<HTMLDivElement>) => {\n onClick?.(event);\n close();\n };\n\n return <Menu.Item {...props} data-qa={dataQa} onClick={handleClick} ref={ref} />;\n }\n);\n\nChatBubbleErrorAction.displayName = 'ChatBubbleErrorAction';\n"],"names":["_jsx"],"mappings":";;;;;AAeA;;AAEG;MACU,qBAAqB,GAAG,UAAU,CAC3C,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,0BAA0B,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAI;AAC3E,IAAA,MAAM,KAAK,GAAG,2BAA2B,EAAE,CAAC;AAE5C,IAAA,MAAM,WAAW,GAAG,CAAC,KAAiC,KAAI;AACtD,QAAA,OAAO,GAAG,KAAK,CAAC,CAAC;AACjB,QAAA,KAAK,EAAE,CAAC;AACZ,KAAC,CAAC;AAEF,IAAA,OAAOA,IAAC,IAAI,CAAC,IAAI,EAAA,EAAA,GAAK,KAAK,EAAW,SAAA,EAAA,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,GAAI,CAAC;AACrF,CAAC,EACH;AAEF,qBAAqB,CAAC,WAAW,GAAG,uBAAuB;;;;"}
1
+ {"version":3,"file":"ErrorAction.js","sources":["src/ErrorAction.tsx"],"sourcesContent":["import { forwardRef, type MouseEvent } from 'react';\n\nimport { useChatBubbleErrorMenuClose } from '@hh.ru/magritte-ui-chat-bubble/internal/errorMenu';\nimport { Menu, type MenuItemProps } from '@hh.ru/magritte-ui-menu';\n\nexport interface ChatBubbleErrorActionProps extends Pick<\n MenuItemProps,\n 'children' | 'disabled' | 'icon' | 'style' | 'subtitle' | 'onClick'\n> {\n /** Значение data-qa\n * @default chat-bubble-error-action\n */\n 'data-qa'?: string;\n}\n\n/**\n * Пункт меню, которое открывается по нажатию на иконку ошибки отправки.\n */\nexport const ChatBubbleErrorAction = forwardRef<HTMLDivElement, ChatBubbleErrorActionProps>(\n ({ 'data-qa': dataQa = 'chat-bubble-error-action', onClick, ...props }, ref) => {\n const close = useChatBubbleErrorMenuClose();\n\n const handleClick = (event: MouseEvent<HTMLDivElement>) => {\n onClick?.(event);\n close();\n };\n\n return <Menu.Item {...props} data-qa={dataQa} onClick={handleClick} ref={ref} />;\n }\n);\n\nChatBubbleErrorAction.displayName = 'ChatBubbleErrorAction';\n"],"names":[],"mappings":";;;;;AAkBO,MAAM,qBAAwB,GAAA,UAAA;AAAA,EACjC,CAAC,EAAE,SAAW,EAAA,MAAA,GAAS,4BAA4B,OAAS,EAAA,GAAG,KAAM,EAAA,EAAG,GAAQ,KAAA;AAC5E,IAAA,MAAM,QAAQ,2BAA4B,EAAA,CAAA;AAE1C,IAAM,MAAA,WAAA,GAAc,CAAC,KAAsC,KAAA;AACvD,MAAA,OAAA,GAAU,KAAK,CAAA,CAAA;AACf,MAAM,KAAA,EAAA,CAAA;AAAA,KACV,CAAA;AAEA,IAAO,uBAAA,GAAA,CAAC,IAAK,CAAA,IAAA,EAAL,EAAW,GAAG,OAAO,SAAS,EAAA,MAAA,EAAQ,OAAS,EAAA,WAAA,EAAa,GAAU,EAAA,CAAA,CAAA;AAAA,GAClF;AACJ,EAAA;AAEA,qBAAA,CAAsB,WAAc,GAAA,uBAAA;;;;"}
package/File.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type HTMLAttributes, type ReactNode } from 'react';
2
- import { type ChatBubbleMetaHostProps } from '@hh.ru/magritte-ui-chat-bubble/internal/utils';
2
+ import { type ChatBubbleMetaHostProps } from './internal/utils';
3
3
  export type ChatBubbleFileState = 'unloaded' | 'loading' | 'preview' | 'loaded' | 'invalid';
4
4
  type ChatBubbleFileHelper = HTMLAttributes<HTMLDivElement> & ChatBubbleMetaHostProps;
5
5
  export interface ChatBubbleFileProps extends Omit<ChatBubbleFileHelper, 'children'> {
@@ -24,5 +24,5 @@ export interface ChatBubbleFileProps extends Omit<ChatBubbleFileHelper, 'childre
24
24
  */
25
25
  'data-qa'?: string;
26
26
  }
27
- export declare const ChatBubbleFile: import("react").ForwardRefExoticComponent<ChatBubbleFileProps & import("react").RefAttributes<HTMLDivElement>> & import("@hh.ru/magritte-ui-chat-bubble/internal/utils").MetaHostComponent;
27
+ export declare const ChatBubbleFile: import("react").ForwardRefExoticComponent<ChatBubbleFileProps & import("react").RefAttributes<HTMLDivElement>> & import("./internal/utils").MetaHostComponent;
28
28
  export {};
package/File.js CHANGED
@@ -4,29 +4,73 @@ import { forwardRef, useMemo } from 'react';
4
4
  import { Cell, CellText } from '@hh.ru/magritte-ui-cell';
5
5
  import { useChatBubbleColors } from './internal/colors.js';
6
6
  import { markMetaHost } from './internal/utils.js';
7
- import { ExclamationTriangleOutlinedSize16, ArrowDownLineOutlinedSize24, DocumentOutlinedSize24 } from '@hh.ru/magritte-ui-icon/icon';
7
+ import { ArrowDownLineOutlinedSize24, DocumentOutlinedSize24, ExclamationTriangleOutlinedSize16 } 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-DgO7_sM3.js';
10
+ import { s as styles } from './chat-bubble-BOBGge0h.js';
11
11
  import './internal/mode.js';
12
12
 
13
- /** Прикреплённый файл */
14
- const ChatBubbleFileComponent = forwardRef(({ 'data-qa': dataQa = 'chat-bubble-file', description, meta, name, preview, state = 'loaded', previewAlt, ...props }, ref) => {
13
+ const ChatBubbleFileComponent = forwardRef(
14
+ ({
15
+ "data-qa": dataQa = "chat-bubble-file",
16
+ description,
17
+ meta,
18
+ name,
19
+ preview,
20
+ state = "loaded",
21
+ previewAlt,
22
+ ...props
23
+ }, ref) => {
15
24
  const colors = useChatBubbleColors();
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]);
25
+ const isLoading = state === "loading";
26
+ const Icon = state === "unloaded" || isLoading ? ArrowDownLineOutlinedSize24 : DocumentOutlinedSize24;
27
+ const defaultLinkProps = useMemo(
28
+ () => ({ ...colors.link, typography: "label-3-regular", inline: true }),
29
+ [colors]
30
+ );
20
31
  let leftSlot;
21
32
  if (isLoading) {
22
- leftSlot = jsx(Loader, { size: 16, color: colors.secondaryIcon });
33
+ leftSlot = /* @__PURE__ */ jsx(Loader, { size: 16, color: colors.secondaryIcon });
34
+ } else if (state === "invalid") {
35
+ leftSlot = /* @__PURE__ */ jsx(ExclamationTriangleOutlinedSize16, { initialColor: "negative" });
23
36
  }
24
- else if (state === 'invalid') {
25
- leftSlot = jsx(ExclamationTriangleOutlinedSize16, { initialColor: "negative" });
26
- }
27
- 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: leftSlot, "data-qa": "chat-bubble-file-description", children: jsx(LinkDefaultPropsContext, { props: defaultLinkProps, children: description }) }))] }), meta] }));
28
- });
29
- ChatBubbleFileComponent.displayName = 'ChatBubbleFile';
37
+ return /* @__PURE__ */ jsxs("div", { ...props, className: styles.file, "data-qa": dataQa, ref, children: [
38
+ /* @__PURE__ */ jsxs(
39
+ Cell,
40
+ {
41
+ align: "center",
42
+ horPadding: false,
43
+ vertPadding: false,
44
+ left: state === "preview" && preview ? /* @__PURE__ */ jsx("img", { className: styles.filePreview, src: preview, alt: previewAlt ?? "" }) : /* @__PURE__ */ jsx(
45
+ Icon,
46
+ {
47
+ initialColor: colors.fileIcon,
48
+ backgroundStyle: colors.fileIconBackground,
49
+ padding: 12,
50
+ borderRadius: 8
51
+ }
52
+ ),
53
+ children: [
54
+ /* @__PURE__ */ jsx(CellText, { type: "title", style: colors.text, maxLines: 1, "data-qa": "chat-bubble-file-name", children: name }),
55
+ description && /* @__PURE__ */ jsx(
56
+ CellText,
57
+ {
58
+ type: "subtitle",
59
+ style: colors.secondaryText,
60
+ maxLines: 1,
61
+ left: leftSlot,
62
+ "data-qa": "chat-bubble-file-description",
63
+ children: /* @__PURE__ */ jsx(LinkDefaultPropsContext, { props: defaultLinkProps, children: description })
64
+ }
65
+ )
66
+ ]
67
+ }
68
+ ),
69
+ meta
70
+ ] });
71
+ }
72
+ );
73
+ ChatBubbleFileComponent.displayName = "ChatBubbleFile";
30
74
  const ChatBubbleFile = markMetaHost(ChatBubbleFileComponent);
31
75
 
32
76
  export { ChatBubbleFile };
package/File.js.map CHANGED
@@ -1 +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 { useChatBubbleColors } from '@hh.ru/magritte-ui-chat-bubble/internal/colors';\nimport { markMetaHost, type ChatBubbleMetaHostProps } from '@hh.ru/magritte-ui-chat-bubble/internal/utils';\nimport {\n ArrowDownLineOutlinedSize24,\n DocumentOutlinedSize24,\n ExclamationTriangleOutlinedSize16,\n} 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' | 'invalid';\n\ntype ChatBubbleFileHelper = HTMLAttributes<HTMLDivElement> & ChatBubbleMetaHostProps;\n\nexport interface ChatBubbleFileProps extends Omit<ChatBubbleFileHelper, 'children'> {\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 = useChatBubbleColors();\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 let leftSlot: ReactNode;\n if (isLoading) {\n leftSlot = <Loader size={16} color={colors.secondaryIcon} />;\n } else if (state === 'invalid') {\n leftSlot = <ExclamationTriangleOutlinedSize16 initialColor=\"negative\" />;\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={leftSlot}\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 = 'ChatBubbleFile';\n\nexport const ChatBubbleFile = markMetaHost(ChatBubbleFileComponent);\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;AA0CA;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,mBAAmB,EAAE,CAAC;AACrC,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,MAAM,CAAC,CACX,CAAC;AAEF,IAAA,IAAI,QAAmB,CAAC;IACxB,IAAI,SAAS,EAAE;AACX,QAAA,QAAQ,GAAGA,GAAA,CAAC,MAAM,EAAA,EAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,aAAa,GAAI,CAAC;KAChE;AAAM,SAAA,IAAI,KAAK,KAAK,SAAS,EAAE;QAC5B,QAAQ,GAAGA,IAAC,iCAAiC,EAAA,EA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AG,gBAAgB,CAAC;MAE1C,cAAc,GAAG,YAAY,CAAC,uBAAuB;;;;"}
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 { useChatBubbleColors } from '@hh.ru/magritte-ui-chat-bubble/internal/colors';\nimport { markMetaHost, type ChatBubbleMetaHostProps } from '@hh.ru/magritte-ui-chat-bubble/internal/utils';\nimport {\n ArrowDownLineOutlinedSize24,\n DocumentOutlinedSize24,\n ExclamationTriangleOutlinedSize16,\n} 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' | 'invalid';\n\ntype ChatBubbleFileHelper = HTMLAttributes<HTMLDivElement> & ChatBubbleMetaHostProps;\n\nexport interface ChatBubbleFileProps extends Omit<ChatBubbleFileHelper, 'children'> {\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 = useChatBubbleColors();\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 let leftSlot: ReactNode;\n if (isLoading) {\n leftSlot = <Loader size={16} color={colors.secondaryIcon} />;\n } else if (state === 'invalid') {\n leftSlot = <ExclamationTriangleOutlinedSize16 initialColor=\"negative\" />;\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={leftSlot}\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 = 'ChatBubbleFile';\n\nexport const ChatBubbleFile = markMetaHost(ChatBubbleFileComponent);\n"],"names":[],"mappings":";;;;;;;;;;;AA2CA,MAAM,uBAA0B,GAAA,UAAA;AAAA,EAC5B,CACI;AAAA,IACI,WAAW,MAAS,GAAA,kBAAA;AAAA,IACpB,WAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,OAAA;AAAA,IACA,KAAQ,GAAA,QAAA;AAAA,IACR,UAAA;AAAA,IACA,GAAG,KAAA;AAAA,KAEP,GACC,KAAA;AACD,IAAA,MAAM,SAAS,mBAAoB,EAAA,CAAA;AACnC,IAAA,MAAM,YAAY,KAAU,KAAA,SAAA,CAAA;AAE5B,IAAA,MAAM,IAAO,GAAA,KAAA,KAAU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AAA,4BAAC,GAAA,CAAA,QAAA,EAAA,EAAS,IAAK,EAAA,OAAA,EAAQ,KAAO,EAAA,MAAA,CAAO,MAAM,QAAU,EAAA,CAAA,EAAG,SAAQ,EAAA,uBAAA,EAC3D,QACL,EAAA,IAAA,EAAA,CAAA;AAAA,YACC,WACG,oBAAA,GAAA;AAAA,cAAC,QAAA;AAAA,cAAA;AAAA,gBACG,IAAK,EAAA,UAAA;AAAA,gBACL,OAAO,MAAO,CAAA,aAAA;AAAA,gBACd,QAAU,EAAA,CAAA;AAAA,gBACV,IAAM,EAAA,QAAA;AAAA,gBACN,SAAQ,EAAA,8BAAA;AAAA,gBAER,QAAC,kBAAA,GAAA,CAAA,uBAAA,EAAA,EAAwB,KAAO,EAAA,gBAAA,EAAmB,QAAY,EAAA,WAAA,EAAA,CAAA;AAAA,eAAA;AAAA,aACnE;AAAA,WAAA;AAAA,SAAA;AAAA,OAER;AAAA,MACC,IAAA;AAAA,KACL,EAAA,CAAA,CAAA;AAAA,GAER;AACJ,CAAA,CAAA;AAEA,uBAAA,CAAwB,WAAc,GAAA,gBAAA,CAAA;AAEzB,MAAA,cAAA,GAAiB,aAAa,uBAAuB;;;;"}
package/Label.js CHANGED
@@ -3,17 +3,14 @@ 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-DgO7_sM3.js';
6
+ import { s as styles } from './chat-bubble-BOBGge0h.js';
7
7
  import './internal/mode.js';
8
8
 
9
- /**
10
- * Заголовок сообщения.
11
- */
12
9
  const ChatBubbleLabel = forwardRef(({ children, ...props }, ref) => {
13
- const colors = useChatBubbleColors();
14
- return (jsx("div", { ...props, className: styles.label, "data-qa": "chat-bubble-label", ref: ref, children: jsx(Text, { typography: "subtitle-2-semibold", style: colors.accentText, maxLines: 1, children: children }) }));
10
+ const colors = useChatBubbleColors();
11
+ return /* @__PURE__ */ jsx("div", { ...props, className: styles.label, "data-qa": "chat-bubble-label", ref, children: /* @__PURE__ */ jsx(Text, { typography: "subtitle-2-semibold", style: colors.accentText, maxLines: 1, children }) });
15
12
  });
16
- ChatBubbleLabel.displayName = 'ChatBubbleLabel';
13
+ ChatBubbleLabel.displayName = "ChatBubbleLabel";
17
14
 
18
15
  export { ChatBubbleLabel };
19
16
  //# sourceMappingURL=Label.js.map
package/Label.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Label.js","sources":["src/Label.tsx"],"sourcesContent":["import { type HTMLAttributes, type ReactNode, forwardRef } from 'react';\n\nimport { useChatBubbleColors } from '@hh.ru/magritte-ui-chat-bubble/internal/colors';\nimport { Text } from '@hh.ru/magritte-ui-typography';\n\nimport styles from './chat-bubble.less';\n\nexport interface ChatBubbleLabelProps extends HTMLAttributes<HTMLDivElement> {\n /** Имя отправителя */\n children?: ReactNode;\n}\n\n/**\n * Заголовок сообщения.\n */\nexport const ChatBubbleLabel = forwardRef<HTMLDivElement, ChatBubbleLabelProps>(({ children, ...props }, ref) => {\n const colors = useChatBubbleColors();\n\n return (\n <div {...props} className={styles.label} data-qa=\"chat-bubble-label\" ref={ref}>\n <Text typography=\"subtitle-2-semibold\" style={colors.accentText} maxLines={1}>\n {children}\n </Text>\n </div>\n );\n});\n\nChatBubbleLabel.displayName = 'ChatBubbleLabel';\n"],"names":["_jsx"],"mappings":";;;;;;;AAYA;;AAEG;AACU,MAAA,eAAe,GAAG,UAAU,CAAuC,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAI;AAC5G,IAAA,MAAM,MAAM,GAAG,mBAAmB,EAAE,CAAC;AAErC,IAAA,QACIA,GAAS,CAAA,KAAA,EAAA,EAAA,GAAA,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,KAAK,EAAA,SAAA,EAAU,mBAAmB,EAAC,GAAG,EAAE,GAAG,YACzEA,GAAC,CAAA,IAAI,EAAC,EAAA,UAAU,EAAC,qBAAqB,EAAC,KAAK,EAAE,MAAM,CAAC,UAAU,EAAE,QAAQ,EAAE,CAAC,EAAA,QAAA,EACvE,QAAQ,EACN,CAAA,EAAA,CACL,EACR;AACN,CAAC,EAAE;AAEH,eAAe,CAAC,WAAW,GAAG,iBAAiB;;;;"}
1
+ {"version":3,"file":"Label.js","sources":["src/Label.tsx"],"sourcesContent":["import { type HTMLAttributes, type ReactNode, forwardRef } from 'react';\n\nimport { useChatBubbleColors } from '@hh.ru/magritte-ui-chat-bubble/internal/colors';\nimport { Text } from '@hh.ru/magritte-ui-typography';\n\nimport styles from './chat-bubble.less';\n\nexport interface ChatBubbleLabelProps extends HTMLAttributes<HTMLDivElement> {\n /** Имя отправителя */\n children?: ReactNode;\n}\n\n/**\n * Заголовок сообщения.\n */\nexport const ChatBubbleLabel = forwardRef<HTMLDivElement, ChatBubbleLabelProps>(({ children, ...props }, ref) => {\n const colors = useChatBubbleColors();\n\n return (\n <div {...props} className={styles.label} data-qa=\"chat-bubble-label\" ref={ref}>\n <Text typography=\"subtitle-2-semibold\" style={colors.accentText} maxLines={1}>\n {children}\n </Text>\n </div>\n );\n});\n\nChatBubbleLabel.displayName = 'ChatBubbleLabel';\n"],"names":[],"mappings":";;;;;;;AAea,MAAA,eAAA,GAAkB,WAAiD,CAAC,EAAE,UAAU,GAAG,KAAA,IAAS,GAAQ,KAAA;AAC7G,EAAA,MAAM,SAAS,mBAAoB,EAAA,CAAA;AAEnC,EACI,uBAAA,GAAA,CAAC,SAAK,GAAG,KAAA,EAAO,WAAW,MAAO,CAAA,KAAA,EAAO,WAAQ,mBAAoB,EAAA,GAAA,EACjE,8BAAC,IAAK,EAAA,EAAA,UAAA,EAAW,uBAAsB,KAAO,EAAA,MAAA,CAAO,YAAY,QAAU,EAAA,CAAA,EACtE,UACL,CACJ,EAAA,CAAA,CAAA;AAER,CAAC,EAAA;AAED,eAAA,CAAgB,WAAc,GAAA,iBAAA;;;;"}
package/Media.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type HTMLAttributes, type ReactNode } from 'react';
2
- import { type ChatBubbleMetaHostProps } from '@hh.ru/magritte-ui-chat-bubble/internal/utils';
2
+ import { type ChatBubbleMetaHostProps } from './internal/utils';
3
3
  export interface ChatBubbleMediaProps extends HTMLAttributes<HTMLDivElement>, ChatBubbleMetaHostProps {
4
4
  /** Url изображения или превью видео */
5
5
  src?: string;
@@ -27,4 +27,4 @@ export interface ChatBubbleMediaProps extends HTMLAttributes<HTMLDivElement>, Ch
27
27
  */
28
28
  height?: number;
29
29
  }
30
- export declare const ChatBubbleMedia: import("react").ForwardRefExoticComponent<ChatBubbleMediaProps & import("react").RefAttributes<HTMLDivElement>> & import("@hh.ru/magritte-ui-chat-bubble/internal/utils").MetaHostComponent;
30
+ export declare const ChatBubbleMedia: import("react").ForwardRefExoticComponent<ChatBubbleMediaProps & import("react").RefAttributes<HTMLDivElement>> & import("./internal/utils").MetaHostComponent;