@sendbird/uikit-react
Version:
Sendbird UIKit for React: A feature-rich and customizable chat UI kit with messaging, channel management, and user authentication.
68 lines (65 loc) • 3.24 kB
JavaScript
import React__default from 'react';
import { a as LabelTypography, b as LabelColors } from '../chunks/bundle-FZ_FdxZT.js';
import LinkLabel from './LinkLabel.js';
import { D as convertWordToStringObj, S as StringObjType } from '../chunks/bundle-C5Cl3Igw.js';
import MentionLabel from './MentionLabel.js';
import '../chunks/bundle-DlZj_j5B.js';
import '../chunks/bundle-Dhutxl0X.js';
import '../chunks/bundle-CaW4IP0_.js';
import '@sendbird/chat/groupChannel';
import '../utils/message/getOutgoingMessageState.js';
import '../chunks/bundle-OJHU7Q3U.js';
import '../chunks/bundle-DZaN4z9l.js';
import '../chunks/bundle-0bJlK18Z.js';
import '../chunks/bundle-C8kxBudB.js';
import '../chunks/bundle-BRB1saAI.js';
import 'react-dom';
import '@sendbird/chat';
import '@sendbird/chat/openChannel';
import './SortByRow.js';
import '../chunks/bundle-CSjCAZib.js';
import './IconButton.js';
import '../chunks/bundle-DxLnjDoJ.js';
import '../chunks/bundle-D89Qj0P4.js';
import '../chunks/bundle-C1jTnXNH.js';
import './UserProfile.js';
import '../chunks/bundle-tDk7wyaM.js';
import '../chunks/bundle-BnaoVUUl.js';
import '../sendbirdSelectors.js';
import '../chunks/bundle-D9lZlE3H.js';
import '../chunks/bundle-Dgt7lb2O.js';
import './ImageRenderer.js';
import '../chunks/bundle-h43SVTxb.js';
import './Icon.js';
import './Button.js';
/**
* @deprecated This component is deprecated and will be removed in the next major version.
* Use TextFragment instead.
*/
// Word and StringObj will include types: normal, mention, url
function Word(props) {
var word = props.word, message = props.message, _a = props.isByMe, isByMe = _a === void 0 ? false : _a, _b = props.mentionTemplate, mentionTemplate = _b === void 0 ? '@' : _b, _c = props.renderString, renderString = _c === void 0 ? null : _c;
if (word === '') {
return null;
}
return (React__default.createElement("span", { className: "sendbird-word", "data-testid": "sendbird-ui-word" }, (message === null || message === void 0 ? void 0 : message.mentionedUsers) && convertWordToStringObj(word, message.mentionedUsers).map(function (stringObj, index) {
var type = (stringObj === null || stringObj === void 0 ? void 0 : stringObj.type) || '';
var value = (stringObj === null || stringObj === void 0 ? void 0 : stringObj.value) || '';
var userId = (stringObj === null || stringObj === void 0 ? void 0 : stringObj.userId) || '';
var key = "".concat(value, "-").concat(index);
if (renderString && typeof renderString === 'function') {
return renderString(stringObj);
}
if (type === StringObjType.mention) {
return (React__default.createElement(MentionLabel, { key: key, mentionTemplate: mentionTemplate, mentionedUserId: userId, mentionedUserNickname: value, isByMe: isByMe }));
}
else if (type === StringObjType.url) {
return (React__default.createElement(LinkLabel, { key: key, className: "sendbird-word__url", src: word, type: LabelTypography.BODY_1, color: isByMe ? LabelColors.ONCONTENT_1 : LabelColors.ONBACKGROUND_1 }, value));
}
else {
return value;
}
})));
}
export { Word as default };
//# sourceMappingURL=Word.js.map