stream-chat-react 10.7.0 → 10.7.1
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/dist/browser.full-bundle.js +213 -294
- package/dist/browser.full-bundle.js.map +1 -1
- package/dist/browser.full-bundle.min.js +5 -5
- package/dist/browser.full-bundle.min.js.map +1 -1
- package/dist/index.cjs.js +125 -253
- package/dist/index.cjs.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -5
|
@@ -5770,51 +5770,53 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
5770
5770
|
return (React__default["default"].createElement("span", { className: 'str-chat__message-attachment-file--item-size' }, prettyBytes(fileSize)));
|
|
5771
5771
|
};
|
|
5772
5772
|
|
|
5773
|
-
var dist$
|
|
5774
|
-
|
|
5775
|
-
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};Object.defineProperty(dist$
|
|
5776
|
-
var sanitizeUrl_1 = dist$
|
|
5777
|
-
var invalidProtocolRegex = /^([^\w]*)(javascript|data|vbscript)/im;
|
|
5778
|
-
var htmlEntitiesRegex = /&#(\w+)(^\w|;)?/g;
|
|
5779
|
-
var
|
|
5780
|
-
var
|
|
5781
|
-
var
|
|
5782
|
-
|
|
5783
|
-
|
|
5773
|
+
var dist$2 = {};
|
|
5774
|
+
|
|
5775
|
+
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};Object.defineProperty(dist$2, "__esModule", { value: true });
|
|
5776
|
+
var sanitizeUrl_1$1 = dist$2.sanitizeUrl = void 0;
|
|
5777
|
+
var invalidProtocolRegex$1 = /^([^\w]*)(javascript|data|vbscript)/im;
|
|
5778
|
+
var htmlEntitiesRegex$1 = /&#(\w+)(^\w|;)?/g;
|
|
5779
|
+
var htmlCtrlEntityRegex = /&(newline|tab);/gi;
|
|
5780
|
+
var ctrlCharactersRegex$1 = /[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim;
|
|
5781
|
+
var urlSchemeRegex$1 = /^.+(:|:)/gim;
|
|
5782
|
+
var relativeFirstCharacters$1 = [".", "/"];
|
|
5783
|
+
function isRelativeUrlWithoutProtocol$1(url) {
|
|
5784
|
+
return relativeFirstCharacters$1.indexOf(url[0]) > -1;
|
|
5784
5785
|
}
|
|
5785
5786
|
// adapted from https://stackoverflow.com/a/29824550/2601552
|
|
5786
|
-
function decodeHtmlCharacters(str) {
|
|
5787
|
-
return str.replace(htmlEntitiesRegex, function (match, dec) {
|
|
5787
|
+
function decodeHtmlCharacters$1(str) {
|
|
5788
|
+
return str.replace(htmlEntitiesRegex$1, function (match, dec) {
|
|
5788
5789
|
return String.fromCharCode(dec);
|
|
5789
5790
|
});
|
|
5790
5791
|
}
|
|
5791
|
-
function sanitizeUrl(url) {
|
|
5792
|
-
var sanitizedUrl = decodeHtmlCharacters(url || "")
|
|
5793
|
-
.replace(
|
|
5792
|
+
function sanitizeUrl$1(url) {
|
|
5793
|
+
var sanitizedUrl = decodeHtmlCharacters$1(url || "")
|
|
5794
|
+
.replace(htmlCtrlEntityRegex, "")
|
|
5795
|
+
.replace(ctrlCharactersRegex$1, "")
|
|
5794
5796
|
.trim();
|
|
5795
5797
|
if (!sanitizedUrl) {
|
|
5796
5798
|
return "about:blank";
|
|
5797
5799
|
}
|
|
5798
|
-
if (isRelativeUrlWithoutProtocol(sanitizedUrl)) {
|
|
5800
|
+
if (isRelativeUrlWithoutProtocol$1(sanitizedUrl)) {
|
|
5799
5801
|
return sanitizedUrl;
|
|
5800
5802
|
}
|
|
5801
|
-
var urlSchemeParseResults = sanitizedUrl.match(urlSchemeRegex);
|
|
5803
|
+
var urlSchemeParseResults = sanitizedUrl.match(urlSchemeRegex$1);
|
|
5802
5804
|
if (!urlSchemeParseResults) {
|
|
5803
5805
|
return sanitizedUrl;
|
|
5804
5806
|
}
|
|
5805
5807
|
var urlScheme = urlSchemeParseResults[0];
|
|
5806
|
-
if (invalidProtocolRegex.test(urlScheme)) {
|
|
5808
|
+
if (invalidProtocolRegex$1.test(urlScheme)) {
|
|
5807
5809
|
return "about:blank";
|
|
5808
5810
|
}
|
|
5809
5811
|
return sanitizedUrl;
|
|
5810
5812
|
}
|
|
5811
|
-
sanitizeUrl_1 = dist$
|
|
5813
|
+
sanitizeUrl_1$1 = dist$2.sanitizeUrl = sanitizeUrl$1;
|
|
5812
5814
|
|
|
5813
5815
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var UnMemoizedSafeAnchor = function (props) {
|
|
5814
5816
|
var children = props.children, className = props.className, download = props.download, href = props.href, rel = props.rel, target = props.target;
|
|
5815
5817
|
if (!href)
|
|
5816
5818
|
return null;
|
|
5817
|
-
var sanitized = sanitizeUrl_1(href);
|
|
5819
|
+
var sanitized = sanitizeUrl_1$1(href);
|
|
5818
5820
|
return (React__default["default"].createElement("a", { "aria-label": 'Attachment', className: className, download: download, href: sanitized, rel: rel, target: target }, children));
|
|
5819
5821
|
};
|
|
5820
5822
|
var SafeAnchor = React__default["default"].memo(UnMemoizedSafeAnchor);
|
|
@@ -7101,16 +7103,31 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
7101
7103
|
}
|
|
7102
7104
|
}
|
|
7103
7105
|
|
|
7106
|
+
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};function _toPrimitive(input, hint) {
|
|
7107
|
+
if (_typeof$1(input) !== "object" || input === null) return input;
|
|
7108
|
+
var prim = input[Symbol.toPrimitive];
|
|
7109
|
+
if (prim !== undefined) {
|
|
7110
|
+
var res = prim.call(input, hint || "default");
|
|
7111
|
+
if (_typeof$1(res) !== "object") return res;
|
|
7112
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
7113
|
+
}
|
|
7114
|
+
return (hint === "string" ? String : Number)(input);
|
|
7115
|
+
}
|
|
7116
|
+
|
|
7117
|
+
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};function _toPropertyKey(arg) {
|
|
7118
|
+
var key = _toPrimitive(arg, "string");
|
|
7119
|
+
return _typeof$1(key) === "symbol" ? key : String(key);
|
|
7120
|
+
}
|
|
7121
|
+
|
|
7104
7122
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};function _defineProperties(target, props) {
|
|
7105
7123
|
for (var i = 0; i < props.length; i++) {
|
|
7106
7124
|
var descriptor = props[i];
|
|
7107
7125
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
7108
7126
|
descriptor.configurable = true;
|
|
7109
7127
|
if ("value" in descriptor) descriptor.writable = true;
|
|
7110
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
7128
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
7111
7129
|
}
|
|
7112
7130
|
}
|
|
7113
|
-
|
|
7114
7131
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
7115
7132
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
7116
7133
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
@@ -7124,16 +7141,14 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
7124
7141
|
if (self === void 0) {
|
|
7125
7142
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
7126
7143
|
}
|
|
7127
|
-
|
|
7128
7144
|
return self;
|
|
7129
7145
|
}
|
|
7130
7146
|
|
|
7131
7147
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};function _setPrototypeOf(o, p) {
|
|
7132
|
-
_setPrototypeOf = Object.setPrototypeOf
|
|
7148
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
7133
7149
|
o.__proto__ = p;
|
|
7134
7150
|
return o;
|
|
7135
7151
|
};
|
|
7136
|
-
|
|
7137
7152
|
return _setPrototypeOf(o, p);
|
|
7138
7153
|
}
|
|
7139
7154
|
|
|
@@ -7141,7 +7156,6 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
7141
7156
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
7142
7157
|
throw new TypeError("Super expression must either be null or a function");
|
|
7143
7158
|
}
|
|
7144
|
-
|
|
7145
7159
|
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
7146
7160
|
constructor: {
|
|
7147
7161
|
value: subClass,
|
|
@@ -7161,18 +7175,18 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
7161
7175
|
} else if (call !== void 0) {
|
|
7162
7176
|
throw new TypeError("Derived constructors may only return object or undefined");
|
|
7163
7177
|
}
|
|
7164
|
-
|
|
7165
7178
|
return _assertThisInitialized(self);
|
|
7166
7179
|
}
|
|
7167
7180
|
|
|
7168
7181
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};function _getPrototypeOf(o) {
|
|
7169
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
7182
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
7170
7183
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
7171
7184
|
};
|
|
7172
7185
|
return _getPrototypeOf(o);
|
|
7173
7186
|
}
|
|
7174
7187
|
|
|
7175
7188
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};function _defineProperty$4(obj, key, value) {
|
|
7189
|
+
key = _toPropertyKey(key);
|
|
7176
7190
|
if (key in obj) {
|
|
7177
7191
|
Object.defineProperty(obj, key, {
|
|
7178
7192
|
value: value,
|
|
@@ -7183,7 +7197,6 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
7183
7197
|
} else {
|
|
7184
7198
|
obj[key] = value;
|
|
7185
7199
|
}
|
|
7186
|
-
|
|
7187
7200
|
return obj;
|
|
7188
7201
|
}
|
|
7189
7202
|
|
|
@@ -7197,11 +7210,7 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
7197
7210
|
|
|
7198
7211
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};function _arrayLikeToArray$5(arr, len) {
|
|
7199
7212
|
if (len == null || len > arr.length) len = arr.length;
|
|
7200
|
-
|
|
7201
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
7202
|
-
arr2[i] = arr[i];
|
|
7203
|
-
}
|
|
7204
|
-
|
|
7213
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
7205
7214
|
return arr2;
|
|
7206
7215
|
}
|
|
7207
7216
|
|
|
@@ -10834,7 +10843,7 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
10834
10843
|
React__default["default"].createElement("p", null, t('{{ imageCount }} more', {
|
|
10835
10844
|
imageCount: images.length - countImagesDisplayedInPreview,
|
|
10836
10845
|
})))) : (React__default["default"].createElement("button", { className: 'str-chat__gallery-image', "data-testid": 'gallery-image', key: "gallery-image-".concat(i), onClick: function () { return toggleModal(i); } },
|
|
10837
|
-
React__default["default"].createElement("img", __assign$8({ alt: 'User uploaded content', src: sanitizeUrl_1(image.previewUrl || image.image_url || image.thumb_url), style: image.style }, ((innerRefs === null || innerRefs === void 0 ? void 0 : innerRefs.current) && { ref: function (r) { return (innerRefs.current[i] = r); } })))));
|
|
10846
|
+
React__default["default"].createElement("img", __assign$8({ alt: 'User uploaded content', src: sanitizeUrl_1$1(image.previewUrl || image.image_url || image.thumb_url), style: image.style }, ((innerRefs === null || innerRefs === void 0 ? void 0 : innerRefs.current) && { ref: function (r) { return (innerRefs.current[i] = r); } })))));
|
|
10838
10847
|
});
|
|
10839
10848
|
var className = clsx('str-chat__gallery', {
|
|
10840
10849
|
'str-chat__gallery--square': images.length > lastImageIndexInPreview,
|
|
@@ -10857,7 +10866,7 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
10857
10866
|
var _a = props.dimensions, dimensions = _a === void 0 ? {} : _a, fallback = props.fallback, image_url = props.image_url, thumb_url = props.thumb_url, innerRef = props.innerRef, previewUrl = props.previewUrl, style = props.style;
|
|
10858
10867
|
var _b = React$2.useState(false), modalIsOpen = _b[0], setModalIsOpen = _b[1];
|
|
10859
10868
|
var _c = useComponentContext('ImageComponent').ModalGallery, ModalGallery$1 = _c === void 0 ? ModalGallery : _c;
|
|
10860
|
-
var imageSrc = sanitizeUrl_1(previewUrl || image_url || thumb_url);
|
|
10869
|
+
var imageSrc = sanitizeUrl_1$1(previewUrl || image_url || thumb_url);
|
|
10861
10870
|
var toggleModal = function () { return setModalIsOpen(function (modalIsOpen) { return !modalIsOpen; }); };
|
|
10862
10871
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
10863
10872
|
React__default["default"].createElement("img", __assign$8({ alt: fallback, className: 'str-chat__message-attachment--img', "data-testid": 'image-test', onClick: toggleModal, src: imageSrc, style: style, tabIndex: 0 }, dimensions, (innerRef && { ref: innerRef }))),
|
|
@@ -15528,16 +15537,14 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
15528
15537
|
|
|
15529
15538
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var Item$1 = /*#__PURE__*/React__default["default"].forwardRef(function Item(props, innerRef) {
|
|
15530
15539
|
var className = props.className,
|
|
15531
|
-
|
|
15532
|
-
|
|
15533
|
-
|
|
15534
|
-
|
|
15535
|
-
|
|
15536
|
-
|
|
15537
|
-
|
|
15540
|
+
Component = props.component,
|
|
15541
|
+
item = props.item,
|
|
15542
|
+
onClickHandler = props.onClickHandler,
|
|
15543
|
+
onSelectHandler = props.onSelectHandler,
|
|
15544
|
+
selected = props.selected,
|
|
15545
|
+
style = props.style;
|
|
15538
15546
|
var _useChatContext = useChatContext('SuggestionItem'),
|
|
15539
|
-
|
|
15540
|
-
|
|
15547
|
+
themeVersion = _useChatContext.themeVersion;
|
|
15541
15548
|
var selectItem = React$2.useCallback(function () {
|
|
15542
15549
|
return onSelectHandler(item);
|
|
15543
15550
|
}, [item, onClickHandler]);
|
|
@@ -17743,12 +17750,12 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
17743
17750
|
};
|
|
17744
17751
|
|
|
17745
17752
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};function isPlainObject(value) {
|
|
17746
|
-
if (
|
|
17753
|
+
if (typeof value !== 'object' || value === null) {
|
|
17747
17754
|
return false;
|
|
17748
17755
|
}
|
|
17749
17756
|
|
|
17750
17757
|
const prototype = Object.getPrototypeOf(value);
|
|
17751
|
-
return prototype === null || prototype === Object.prototype;
|
|
17758
|
+
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
|
|
17752
17759
|
}
|
|
17753
17760
|
|
|
17754
17761
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};/**
|
|
@@ -37155,75 +37162,60 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
37155
37162
|
return null;
|
|
37156
37163
|
};
|
|
37157
37164
|
|
|
37158
|
-
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
|
|
37159
|
-
function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
37160
|
-
|
|
37165
|
+
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
37161
37166
|
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) { definePropertyExports(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
37162
37167
|
var List$1 = function List(_ref) {
|
|
37163
37168
|
var className = _ref.className,
|
|
37164
|
-
|
|
37165
|
-
|
|
37166
|
-
|
|
37167
|
-
|
|
37168
|
-
|
|
37169
|
-
|
|
37170
|
-
|
|
37171
|
-
|
|
37172
|
-
|
|
37173
|
-
|
|
37174
|
-
|
|
37175
|
-
|
|
37176
|
-
|
|
37177
|
-
|
|
37178
|
-
|
|
37169
|
+
component = _ref.component,
|
|
37170
|
+
currentTrigger = _ref.currentTrigger,
|
|
37171
|
+
dropdownScroll = _ref.dropdownScroll,
|
|
37172
|
+
getSelectedItem = _ref.getSelectedItem,
|
|
37173
|
+
getTextToReplace = _ref.getTextToReplace,
|
|
37174
|
+
PropHeader = _ref.Header,
|
|
37175
|
+
itemClassName = _ref.itemClassName,
|
|
37176
|
+
itemStyle = _ref.itemStyle,
|
|
37177
|
+
onSelect = _ref.onSelect,
|
|
37178
|
+
selectionEnd = _ref.selectionEnd,
|
|
37179
|
+
style = _ref.style,
|
|
37180
|
+
PropSuggestionItem = _ref.SuggestionItem,
|
|
37181
|
+
propValue = _ref.value,
|
|
37182
|
+
values = _ref.values;
|
|
37179
37183
|
var _useComponentContext = useComponentContext('SuggestionList'),
|
|
37180
|
-
|
|
37181
|
-
|
|
37182
|
-
|
|
37184
|
+
AutocompleteSuggestionHeader = _useComponentContext.AutocompleteSuggestionHeader,
|
|
37185
|
+
AutocompleteSuggestionItem = _useComponentContext.AutocompleteSuggestionItem;
|
|
37183
37186
|
var _useChatContext = useChatContext('SuggestionList'),
|
|
37184
|
-
|
|
37185
|
-
|
|
37187
|
+
themeVersion = _useChatContext.themeVersion;
|
|
37186
37188
|
var SuggestionItem = PropSuggestionItem || AutocompleteSuggestionItem || Item$1;
|
|
37187
37189
|
var SuggestionHeader = PropHeader || AutocompleteSuggestionHeader || DefaultSuggestionListHeader;
|
|
37188
|
-
|
|
37189
37190
|
var _useState = React$2.useState(undefined),
|
|
37190
|
-
|
|
37191
|
-
|
|
37192
|
-
|
|
37193
|
-
|
|
37191
|
+
_useState2 = _slicedToArray$2(_useState, 2),
|
|
37192
|
+
selectedItem = _useState2[0],
|
|
37193
|
+
setSelectedItem = _useState2[1];
|
|
37194
37194
|
var itemsRef = [];
|
|
37195
|
-
|
|
37196
37195
|
var isSelected = function isSelected(item) {
|
|
37197
37196
|
return selectedItem === values.findIndex(function (value) {
|
|
37198
37197
|
return getId(value) === getId(item);
|
|
37199
37198
|
});
|
|
37200
37199
|
};
|
|
37201
|
-
|
|
37202
37200
|
var getId = function getId(item) {
|
|
37203
37201
|
var textToReplace = getTextToReplace(item);
|
|
37204
|
-
|
|
37205
37202
|
if (textToReplace.key) {
|
|
37206
37203
|
return textToReplace.key;
|
|
37207
37204
|
}
|
|
37208
|
-
|
|
37209
37205
|
if (typeof item === 'string' || !item.key) {
|
|
37210
37206
|
return textToReplace.text;
|
|
37211
37207
|
}
|
|
37212
|
-
|
|
37213
37208
|
return item.key;
|
|
37214
37209
|
};
|
|
37215
|
-
|
|
37216
37210
|
var modifyText = function modifyText(value) {
|
|
37217
37211
|
if (!value) return;
|
|
37218
37212
|
onSelect(getTextToReplace(value));
|
|
37219
37213
|
if (getSelectedItem) getSelectedItem(value);
|
|
37220
37214
|
};
|
|
37221
|
-
|
|
37222
37215
|
var handleClick = function handleClick(e) {
|
|
37223
37216
|
e === null || e === void 0 ? void 0 : e.preventDefault();
|
|
37224
37217
|
modifyText(values[selectedItem]);
|
|
37225
37218
|
};
|
|
37226
|
-
|
|
37227
37219
|
var selectItem = React$2.useCallback(function (item) {
|
|
37228
37220
|
var index = values.findIndex(function (value) {
|
|
37229
37221
|
return value.id ? value.id === item.id : value.name === item.name;
|
|
@@ -37239,7 +37231,6 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
37239
37231
|
return newID;
|
|
37240
37232
|
});
|
|
37241
37233
|
}
|
|
37242
|
-
|
|
37243
37234
|
if (event.key === 'ArrowDown') {
|
|
37244
37235
|
setSelectedItem(function (prevSelected) {
|
|
37245
37236
|
if (prevSelected === undefined) return 0;
|
|
@@ -37248,14 +37239,13 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
37248
37239
|
return newID;
|
|
37249
37240
|
});
|
|
37250
37241
|
}
|
|
37251
|
-
|
|
37252
37242
|
if ((event.key === 'Enter' || event.key === 'Tab') && selectedItem !== undefined) {
|
|
37253
37243
|
handleClick(event);
|
|
37254
37244
|
}
|
|
37255
|
-
|
|
37256
37245
|
return null;
|
|
37257
37246
|
}, [selectedItem, values] // eslint-disable-line
|
|
37258
37247
|
);
|
|
37248
|
+
|
|
37259
37249
|
React$2.useEffect(function () {
|
|
37260
37250
|
document.addEventListener('keydown', handleKeyDown, false);
|
|
37261
37251
|
return function () {
|
|
@@ -37934,12 +37924,11 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
37934
37924
|
var containerHight = parseInt(getComputedStyle(container).getPropertyValue('height'), 10) - itemHeight;
|
|
37935
37925
|
var actualScrollTop = container.scrollTop;
|
|
37936
37926
|
var itemOffsetTop = item.offsetTop;
|
|
37937
|
-
|
|
37938
37927
|
if (itemOffsetTop < actualScrollTop + containerHight && actualScrollTop < itemOffsetTop) {
|
|
37939
37928
|
return;
|
|
37940
|
-
}
|
|
37941
|
-
|
|
37929
|
+
}
|
|
37942
37930
|
|
|
37931
|
+
// eslint-disable-next-line
|
|
37943
37932
|
container.scrollTop = itemOffsetTop;
|
|
37944
37933
|
}
|
|
37945
37934
|
var errorMessage = function errorMessage(message) {
|
|
@@ -37949,40 +37938,33 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
37949
37938
|
var trigger = _ref.trigger;
|
|
37950
37939
|
if (!trigger) return Error('Invalid prop trigger. Prop missing.');
|
|
37951
37940
|
var triggers = Object.entries(trigger);
|
|
37952
|
-
|
|
37953
37941
|
for (var i = 0; i < triggers.length; i += 1) {
|
|
37954
37942
|
var _triggers$i = _slicedToArray$2(triggers[i], 2),
|
|
37955
|
-
|
|
37956
|
-
|
|
37957
|
-
|
|
37943
|
+
triggerChar = _triggers$i[0],
|
|
37944
|
+
settings = _triggers$i[1];
|
|
37958
37945
|
if (typeof triggerChar !== 'string' || triggerChar.length !== 1) {
|
|
37959
37946
|
return Error('Invalid prop trigger. Keys of the object has to be string / one character.');
|
|
37960
|
-
}
|
|
37961
|
-
|
|
37947
|
+
}
|
|
37962
37948
|
|
|
37949
|
+
// $FlowFixMe
|
|
37963
37950
|
var triggerSetting = settings;
|
|
37964
37951
|
var callback = triggerSetting.callback,
|
|
37965
|
-
|
|
37966
|
-
|
|
37967
|
-
|
|
37968
|
-
|
|
37952
|
+
component = triggerSetting.component,
|
|
37953
|
+
dataProvider = triggerSetting.dataProvider,
|
|
37954
|
+
output = triggerSetting.output;
|
|
37969
37955
|
if (!reactIs$1.exports.isValidElementType(component)) {
|
|
37970
37956
|
return Error('Invalid prop trigger: component should be defined.');
|
|
37971
37957
|
}
|
|
37972
|
-
|
|
37973
37958
|
if (!dataProvider || typeof dataProvider !== 'function') {
|
|
37974
37959
|
return Error('Invalid prop trigger: dataProvider should be defined.');
|
|
37975
37960
|
}
|
|
37976
|
-
|
|
37977
37961
|
if (output && typeof output !== 'function') {
|
|
37978
37962
|
return Error('Invalid prop trigger: output should be a function.');
|
|
37979
37963
|
}
|
|
37980
|
-
|
|
37981
37964
|
if (callback && typeof callback !== 'function') {
|
|
37982
37965
|
return Error('Invalid prop trigger: callback should be a function.');
|
|
37983
37966
|
}
|
|
37984
37967
|
}
|
|
37985
|
-
|
|
37986
37968
|
return null;
|
|
37987
37969
|
};
|
|
37988
37970
|
|
|
@@ -38053,26 +38035,17 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
38053
38035
|
};
|
|
38054
38036
|
var UserItem = React__default["default"].memo(UnMemoizedUserItem);
|
|
38055
38037
|
|
|
38056
|
-
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
|
|
38057
|
-
function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
38058
|
-
|
|
38038
|
+
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
38059
38039
|
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { definePropertyExports(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
38060
|
-
|
|
38061
38040
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = getPrototypeOfExports(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOfExports(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturnExports(this, result); }; }
|
|
38062
|
-
|
|
38063
38041
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
38064
38042
|
var ReactTextareaAutocomplete = /*#__PURE__*/function (_React$Component) {
|
|
38065
38043
|
inheritsExports(ReactTextareaAutocomplete, _React$Component);
|
|
38066
|
-
|
|
38067
38044
|
var _super = _createSuper(ReactTextareaAutocomplete);
|
|
38068
|
-
|
|
38069
38045
|
function ReactTextareaAutocomplete(_props) {
|
|
38070
38046
|
var _this;
|
|
38071
|
-
|
|
38072
38047
|
classCallCheckExports(this, ReactTextareaAutocomplete);
|
|
38073
|
-
|
|
38074
38048
|
_this = _super.call(this, _props);
|
|
38075
|
-
|
|
38076
38049
|
definePropertyExports(assertThisInitializedExports(_this), "getSelectionPosition", function () {
|
|
38077
38050
|
if (!_this.textareaRef) return null;
|
|
38078
38051
|
return {
|
|
@@ -38080,72 +38053,58 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
38080
38053
|
selectionStart: _this.textareaRef.selectionStart
|
|
38081
38054
|
};
|
|
38082
38055
|
});
|
|
38083
|
-
|
|
38084
38056
|
definePropertyExports(assertThisInitializedExports(_this), "getSelectedText", function () {
|
|
38085
38057
|
if (!_this.textareaRef) return null;
|
|
38086
38058
|
var _this$textareaRef = _this.textareaRef,
|
|
38087
|
-
|
|
38088
|
-
|
|
38059
|
+
selectionEnd = _this$textareaRef.selectionEnd,
|
|
38060
|
+
selectionStart = _this$textareaRef.selectionStart;
|
|
38089
38061
|
if (selectionStart === selectionEnd) return null;
|
|
38090
38062
|
return _this.state.value.substr(selectionStart, selectionEnd - selectionStart);
|
|
38091
38063
|
});
|
|
38092
|
-
|
|
38093
38064
|
definePropertyExports(assertThisInitializedExports(_this), "setCaretPosition", function () {
|
|
38094
38065
|
var position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
38095
38066
|
if (!_this.textareaRef) return;
|
|
38096
|
-
|
|
38097
38067
|
_this.textareaRef.focus();
|
|
38098
|
-
|
|
38099
38068
|
_this.textareaRef.setSelectionRange(position, position);
|
|
38100
38069
|
});
|
|
38101
|
-
|
|
38102
38070
|
definePropertyExports(assertThisInitializedExports(_this), "getCaretPosition", function () {
|
|
38103
38071
|
if (!_this.textareaRef) return 0;
|
|
38104
38072
|
return _this.textareaRef.selectionEnd;
|
|
38105
38073
|
});
|
|
38106
|
-
|
|
38107
38074
|
definePropertyExports(assertThisInitializedExports(_this), "_defaultShouldSubmit", function (event) {
|
|
38108
38075
|
return event.key === 'Enter' && !event.shiftKey && !event.nativeEvent.isComposing;
|
|
38109
38076
|
});
|
|
38110
|
-
|
|
38111
38077
|
definePropertyExports(assertThisInitializedExports(_this), "_handleKeyDown", function (event) {
|
|
38112
38078
|
var _this$props$shouldSub = _this.props.shouldSubmit,
|
|
38113
|
-
|
|
38079
|
+
shouldSubmit = _this$props$shouldSub === void 0 ? _this._defaultShouldSubmit : _this$props$shouldSub;
|
|
38114
38080
|
|
|
38081
|
+
// prevent default behaviour when the selection list is rendered
|
|
38115
38082
|
if ((event.key === 'ArrowUp' || event.key === 'ArrowDown') && _this.dropdownRef) event.preventDefault();
|
|
38116
38083
|
if (shouldSubmit !== null && shouldSubmit !== void 0 && shouldSubmit(event)) return _this._onEnter(event);
|
|
38117
38084
|
if (event.key === ' ') return _this._onSpace(event);
|
|
38118
38085
|
if (event.key === 'Escape') return _this._closeAutocomplete();
|
|
38119
38086
|
});
|
|
38120
|
-
|
|
38121
38087
|
definePropertyExports(assertThisInitializedExports(_this), "_onEnter", function (event) {
|
|
38122
38088
|
if (!_this.textareaRef) return;
|
|
38123
38089
|
var trigger = _this.state.currentTrigger;
|
|
38124
|
-
|
|
38125
38090
|
if (!trigger || !_this.state.data) {
|
|
38126
38091
|
// trigger a submit
|
|
38127
38092
|
_this._replaceWord();
|
|
38128
|
-
|
|
38129
38093
|
if (_this.textareaRef) {
|
|
38130
38094
|
_this.textareaRef.selectionEnd = 0;
|
|
38131
38095
|
}
|
|
38132
|
-
|
|
38133
38096
|
_this.props.handleSubmit(event);
|
|
38134
|
-
|
|
38135
38097
|
_this._closeAutocomplete();
|
|
38136
38098
|
}
|
|
38137
38099
|
});
|
|
38138
|
-
|
|
38139
38100
|
definePropertyExports(assertThisInitializedExports(_this), "_onSpace", function () {
|
|
38140
|
-
if (!_this.props.replaceWord || !_this.textareaRef) return;
|
|
38101
|
+
if (!_this.props.replaceWord || !_this.textareaRef) return;
|
|
38141
38102
|
|
|
38103
|
+
// don't change characters if the element doesn't have focus
|
|
38142
38104
|
var hasFocus = _this.textareaRef.matches(':focus');
|
|
38143
|
-
|
|
38144
38105
|
if (!hasFocus) return;
|
|
38145
|
-
|
|
38146
38106
|
_this._replaceWord();
|
|
38147
38107
|
});
|
|
38148
|
-
|
|
38149
38108
|
definePropertyExports(assertThisInitializedExports(_this), "_replaceWord", function () {
|
|
38150
38109
|
var value = _this.state.value;
|
|
38151
38110
|
var lastWordRegex = /([^\s]+)(\s*)$/;
|
|
@@ -38153,14 +38112,11 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
38153
38112
|
var lastWord = match && match[1];
|
|
38154
38113
|
if (!lastWord) return;
|
|
38155
38114
|
var spaces = match[2];
|
|
38156
|
-
|
|
38157
38115
|
var newWord = _this.props.replaceWord(lastWord);
|
|
38158
|
-
|
|
38159
38116
|
if (newWord == null) return;
|
|
38160
38117
|
var textBeforeWord = value.slice(0, _this.getCaretPosition() - match[0].length);
|
|
38161
38118
|
var textAfterCaret = value.slice(_this.getCaretPosition(), -1);
|
|
38162
38119
|
var newText = textBeforeWord + newWord + spaces + textAfterCaret;
|
|
38163
|
-
|
|
38164
38120
|
_this.setState({
|
|
38165
38121
|
value: newText
|
|
38166
38122
|
}, function () {
|
|
@@ -38168,53 +38124,47 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
38168
38124
|
var e = new CustomEvent('change', {
|
|
38169
38125
|
bubbles: true
|
|
38170
38126
|
});
|
|
38171
|
-
|
|
38172
38127
|
_this.textareaRef.dispatchEvent(e);
|
|
38173
|
-
|
|
38174
38128
|
if (_this.props.onChange) _this.props.onChange(e);
|
|
38175
38129
|
});
|
|
38176
38130
|
});
|
|
38177
|
-
|
|
38178
38131
|
definePropertyExports(assertThisInitializedExports(_this), "_onSelect", function (newToken) {
|
|
38179
38132
|
var _this$props = _this.props,
|
|
38180
|
-
|
|
38181
|
-
|
|
38182
|
-
|
|
38183
|
-
|
|
38184
|
-
|
|
38133
|
+
closeCommandsList = _this$props.closeCommandsList,
|
|
38134
|
+
closeMentionsList = _this$props.closeMentionsList,
|
|
38135
|
+
onChange = _this$props.onChange,
|
|
38136
|
+
showCommandsList = _this$props.showCommandsList,
|
|
38137
|
+
showMentionsList = _this$props.showMentionsList;
|
|
38185
38138
|
var _this$state = _this.state,
|
|
38186
|
-
|
|
38187
|
-
|
|
38188
|
-
|
|
38139
|
+
stateTrigger = _this$state.currentTrigger,
|
|
38140
|
+
selectionEnd = _this$state.selectionEnd,
|
|
38141
|
+
textareaValue = _this$state.value;
|
|
38189
38142
|
var currentTrigger = showCommandsList ? '/' : showMentionsList ? '@' : stateTrigger;
|
|
38190
38143
|
if (!currentTrigger) return;
|
|
38191
|
-
|
|
38192
38144
|
var computeCaretPosition = function computeCaretPosition(position, token, startToken) {
|
|
38193
38145
|
switch (position) {
|
|
38194
38146
|
case 'start':
|
|
38195
38147
|
return startToken;
|
|
38196
|
-
|
|
38197
38148
|
case 'next':
|
|
38198
38149
|
case 'end':
|
|
38199
38150
|
return startToken + token.length;
|
|
38200
|
-
|
|
38201
38151
|
default:
|
|
38202
38152
|
if (!Number.isInteger(position)) {
|
|
38203
38153
|
throw new Error('RTA: caretPosition should be "start", "next", "end" or number.');
|
|
38204
38154
|
}
|
|
38205
|
-
|
|
38206
38155
|
return position;
|
|
38207
38156
|
}
|
|
38208
38157
|
};
|
|
38209
|
-
|
|
38210
38158
|
var textToModify = showCommandsList ? '/' : showMentionsList ? '@' : textareaValue.slice(0, selectionEnd);
|
|
38211
|
-
var startOfTokenPosition = textToModify.lastIndexOf(currentTrigger);
|
|
38159
|
+
var startOfTokenPosition = textToModify.lastIndexOf(currentTrigger);
|
|
38212
38160
|
|
|
38161
|
+
// we add space after emoji is selected if a caret position is next
|
|
38213
38162
|
var newTokenString = newToken.caretPosition === 'next' ? "".concat(newToken.text, " ") : newToken.text;
|
|
38214
38163
|
var newCaretPosition = computeCaretPosition(newToken.caretPosition, newTokenString, startOfTokenPosition);
|
|
38215
38164
|
var modifiedText = textToModify.substring(0, startOfTokenPosition) + newTokenString;
|
|
38216
|
-
var valueToReplace = textareaValue.replace(textToModify, modifiedText);
|
|
38165
|
+
var valueToReplace = textareaValue.replace(textToModify, modifiedText);
|
|
38217
38166
|
|
|
38167
|
+
// set the new textarea value and after that set the caret back to its position
|
|
38218
38168
|
_this.setState({
|
|
38219
38169
|
dataLoading: false,
|
|
38220
38170
|
value: valueToReplace
|
|
@@ -38223,25 +38173,17 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
38223
38173
|
var e = new CustomEvent('change', {
|
|
38224
38174
|
bubbles: true
|
|
38225
38175
|
});
|
|
38226
|
-
|
|
38227
38176
|
_this.textareaRef.dispatchEvent(e);
|
|
38228
|
-
|
|
38229
38177
|
if (onChange) onChange(e);
|
|
38230
|
-
|
|
38231
38178
|
_this.setCaretPosition(newCaretPosition);
|
|
38232
38179
|
});
|
|
38233
|
-
|
|
38234
38180
|
_this._closeAutocomplete();
|
|
38235
|
-
|
|
38236
38181
|
if (showCommandsList) closeCommandsList();
|
|
38237
38182
|
if (showMentionsList) closeMentionsList();
|
|
38238
38183
|
});
|
|
38239
|
-
|
|
38240
38184
|
definePropertyExports(assertThisInitializedExports(_this), "_getItemOnSelect", function (paramTrigger) {
|
|
38241
38185
|
var stateTrigger = _this.state.currentTrigger;
|
|
38242
|
-
|
|
38243
38186
|
var triggerSettings = _this._getCurrentTriggerSettings(paramTrigger);
|
|
38244
|
-
|
|
38245
38187
|
var currentTrigger = paramTrigger || stateTrigger;
|
|
38246
38188
|
if (!currentTrigger || !triggerSettings) return null;
|
|
38247
38189
|
var callback = triggerSettings.callback;
|
|
@@ -38250,22 +38192,17 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
38250
38192
|
if (typeof callback !== 'function') {
|
|
38251
38193
|
throw new Error('Output functor is not defined! You have to define "output" function. https://github.com/webscopeio/react-textarea-autocomplete#trigger-type');
|
|
38252
38194
|
}
|
|
38253
|
-
|
|
38254
38195
|
if (callback) {
|
|
38255
38196
|
return callback(item, currentTrigger);
|
|
38256
38197
|
}
|
|
38257
|
-
|
|
38258
38198
|
return null;
|
|
38259
38199
|
};
|
|
38260
38200
|
});
|
|
38261
|
-
|
|
38262
38201
|
definePropertyExports(assertThisInitializedExports(_this), "_getTextToReplace", function (paramTrigger) {
|
|
38263
38202
|
var _this$state2 = _this.state,
|
|
38264
|
-
|
|
38265
|
-
|
|
38266
|
-
|
|
38203
|
+
actualToken = _this$state2.actualToken,
|
|
38204
|
+
stateTrigger = _this$state2.currentTrigger;
|
|
38267
38205
|
var triggerSettings = _this._getCurrentTriggerSettings(paramTrigger);
|
|
38268
|
-
|
|
38269
38206
|
var currentTrigger = paramTrigger || stateTrigger;
|
|
38270
38207
|
if (!currentTrigger || !triggerSettings) return null;
|
|
38271
38208
|
var output = triggerSettings.output;
|
|
@@ -38273,91 +38210,74 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
38273
38210
|
if (_typeof$2(item) === 'object' && (!output || typeof output !== 'function')) {
|
|
38274
38211
|
throw new Error('Output functor is not defined! If you are using items as object you have to define "output" function. https://github.com/webscopeio/react-textarea-autocomplete#trigger-type');
|
|
38275
38212
|
}
|
|
38276
|
-
|
|
38277
38213
|
if (output) {
|
|
38278
38214
|
var textToReplace = output(item, currentTrigger);
|
|
38279
|
-
|
|
38280
38215
|
if (!textToReplace || typeof textToReplace === 'number') {
|
|
38281
38216
|
throw new Error("Output functor should return string or object in shape {text: string, caretPosition: string | number}.\nGot \"".concat(String(textToReplace), "\". Check the implementation for trigger \"").concat(currentTrigger, "\" and its token \"").concat(actualToken, "\"\n\nSee https://github.com/webscopeio/react-textarea-autocomplete#trigger-type for more informations.\n"));
|
|
38282
38217
|
}
|
|
38283
|
-
|
|
38284
38218
|
if (typeof textToReplace === 'string') {
|
|
38285
38219
|
return {
|
|
38286
38220
|
caretPosition: DEFAULT_CARET_POSITION,
|
|
38287
38221
|
text: textToReplace
|
|
38288
38222
|
};
|
|
38289
38223
|
}
|
|
38290
|
-
|
|
38291
38224
|
if (!textToReplace.text && currentTrigger !== ':') {
|
|
38292
38225
|
throw new Error("Output \"text\" is not defined! Object should has shape {text: string, caretPosition: string | number}. Check the implementation for trigger \"".concat(currentTrigger, "\" and its token \"").concat(actualToken, "\"\n"));
|
|
38293
38226
|
}
|
|
38294
|
-
|
|
38295
38227
|
if (!textToReplace.caretPosition) {
|
|
38296
38228
|
throw new Error("Output \"caretPosition\" is not defined! Object should has shape {text: string, caretPosition: string | number}. Check the implementation for trigger \"".concat(currentTrigger, "\" and its token \"").concat(actualToken, "\"\n"));
|
|
38297
38229
|
}
|
|
38298
|
-
|
|
38299
38230
|
return textToReplace;
|
|
38300
38231
|
}
|
|
38301
|
-
|
|
38302
38232
|
if (typeof item !== 'string') {
|
|
38303
38233
|
throw new Error('Output item should be string\n');
|
|
38304
38234
|
}
|
|
38305
|
-
|
|
38306
38235
|
return {
|
|
38307
38236
|
caretPosition: DEFAULT_CARET_POSITION,
|
|
38308
38237
|
text: "".concat(currentTrigger).concat(item).concat(currentTrigger)
|
|
38309
38238
|
};
|
|
38310
38239
|
};
|
|
38311
38240
|
});
|
|
38312
|
-
|
|
38313
38241
|
definePropertyExports(assertThisInitializedExports(_this), "_getCurrentTriggerSettings", function (paramTrigger) {
|
|
38314
38242
|
var stateTrigger = _this.state.currentTrigger;
|
|
38315
38243
|
var currentTrigger = paramTrigger || stateTrigger;
|
|
38316
38244
|
if (!currentTrigger) return null;
|
|
38317
38245
|
return _this.props.trigger[currentTrigger];
|
|
38318
38246
|
});
|
|
38319
|
-
|
|
38320
38247
|
definePropertyExports(assertThisInitializedExports(_this), "_getValuesFromProvider", function () {
|
|
38321
38248
|
var _this$state3 = _this.state,
|
|
38322
|
-
|
|
38323
|
-
|
|
38324
|
-
|
|
38249
|
+
actualToken = _this$state3.actualToken,
|
|
38250
|
+
currentTrigger = _this$state3.currentTrigger;
|
|
38325
38251
|
var triggerSettings = _this._getCurrentTriggerSettings();
|
|
38326
|
-
|
|
38327
38252
|
if (!currentTrigger || !triggerSettings) return;
|
|
38328
38253
|
var component = triggerSettings.component,
|
|
38329
|
-
|
|
38330
|
-
|
|
38254
|
+
dataProvider = triggerSettings.dataProvider;
|
|
38331
38255
|
if (typeof dataProvider !== 'function') {
|
|
38332
38256
|
throw new Error('Trigger provider has to be a function!');
|
|
38333
38257
|
}
|
|
38334
|
-
|
|
38335
38258
|
_this.setState({
|
|
38336
38259
|
dataLoading: true
|
|
38337
|
-
});
|
|
38338
|
-
|
|
38260
|
+
});
|
|
38339
38261
|
|
|
38262
|
+
// Modified: send the full text to support / style commands
|
|
38340
38263
|
dataProvider(actualToken, _this.state.value, function (data, token) {
|
|
38341
38264
|
// Make sure that the result is still relevant for current query
|
|
38342
38265
|
if (token !== _this.state.actualToken) return;
|
|
38343
|
-
|
|
38344
38266
|
if (!Array.isArray(data)) {
|
|
38345
38267
|
throw new Error('Trigger provider has to provide an array!');
|
|
38346
38268
|
}
|
|
38347
|
-
|
|
38348
38269
|
if (!reactIs$1.exports.isValidElementType(component)) {
|
|
38349
38270
|
throw new Error('Component should be defined!');
|
|
38350
|
-
}
|
|
38351
|
-
|
|
38271
|
+
}
|
|
38352
38272
|
|
|
38353
|
-
|
|
38273
|
+
// throw away if we resolved old trigger
|
|
38274
|
+
if (currentTrigger !== _this.state.currentTrigger) return;
|
|
38354
38275
|
|
|
38276
|
+
// if we haven't resolved any data let's close the autocomplete
|
|
38355
38277
|
if (!data.length) {
|
|
38356
38278
|
_this._closeAutocomplete();
|
|
38357
|
-
|
|
38358
38279
|
return;
|
|
38359
38280
|
}
|
|
38360
|
-
|
|
38361
38281
|
_this.setState({
|
|
38362
38282
|
component: component,
|
|
38363
38283
|
data: data,
|
|
@@ -38365,16 +38285,14 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
38365
38285
|
});
|
|
38366
38286
|
});
|
|
38367
38287
|
});
|
|
38368
|
-
|
|
38369
38288
|
definePropertyExports(assertThisInitializedExports(_this), "_getSuggestions", function (paramTrigger) {
|
|
38370
38289
|
var _this$state4 = _this.state,
|
|
38371
|
-
|
|
38372
|
-
|
|
38290
|
+
stateTrigger = _this$state4.currentTrigger,
|
|
38291
|
+
data = _this$state4.data;
|
|
38373
38292
|
var currentTrigger = paramTrigger || stateTrigger;
|
|
38374
38293
|
if (!currentTrigger || !data || data && !data.length) return null;
|
|
38375
38294
|
return data;
|
|
38376
38295
|
});
|
|
38377
|
-
|
|
38378
38296
|
definePropertyExports(assertThisInitializedExports(_this), "_closeAutocomplete", function () {
|
|
38379
38297
|
_this.setState({
|
|
38380
38298
|
currentTrigger: null,
|
|
@@ -38384,54 +38302,45 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
38384
38302
|
top: null
|
|
38385
38303
|
});
|
|
38386
38304
|
});
|
|
38387
|
-
|
|
38388
38305
|
definePropertyExports(assertThisInitializedExports(_this), "_cleanUpProps", function () {
|
|
38389
38306
|
var props = _objectSpread$2({}, _this.props);
|
|
38307
|
+
var notSafe = ['additionalTextareaProps', 'className', 'closeCommandsList', 'closeMentionsList', 'closeOnClickOutside', 'containerClassName', 'containerStyle', 'disableMentions', 'dropdownClassName', 'dropdownStyle', 'grow', 'handleSubmit', 'innerRef', 'itemClassName', 'itemStyle', 'listClassName', 'listStyle', 'loaderClassName', 'loaderStyle', 'loadingComponent', 'minChar', 'movePopupAsYouType', 'onCaretPositionChange', 'onChange', 'ref', 'replaceWord', 'scrollToItem', 'shouldSubmit', 'showCommandsList', 'showMentionsList', 'SuggestionItem', 'SuggestionList', 'trigger', 'value'];
|
|
38390
38308
|
|
|
38391
|
-
|
|
38392
|
-
|
|
38309
|
+
// eslint-disable-next-line
|
|
38393
38310
|
for (var prop in props) {
|
|
38394
38311
|
if (notSafe.includes(prop)) delete props[prop];
|
|
38395
38312
|
}
|
|
38396
|
-
|
|
38397
38313
|
return props;
|
|
38398
38314
|
});
|
|
38399
|
-
|
|
38400
38315
|
definePropertyExports(assertThisInitializedExports(_this), "_isCommand", function (text) {
|
|
38401
38316
|
if (text[0] !== '/') return false;
|
|
38402
38317
|
var tokens = text.split(' ');
|
|
38403
38318
|
return tokens.length <= 1;
|
|
38404
38319
|
});
|
|
38405
|
-
|
|
38406
38320
|
definePropertyExports(assertThisInitializedExports(_this), "_changeHandler", function (e) {
|
|
38407
38321
|
var _this$props2 = _this.props,
|
|
38408
|
-
|
|
38409
|
-
|
|
38410
|
-
|
|
38411
|
-
|
|
38412
|
-
|
|
38322
|
+
minChar = _this$props2.minChar,
|
|
38323
|
+
movePopupAsYouType = _this$props2.movePopupAsYouType,
|
|
38324
|
+
onCaretPositionChange = _this$props2.onCaretPositionChange,
|
|
38325
|
+
onChange = _this$props2.onChange,
|
|
38326
|
+
trigger = _this$props2.trigger;
|
|
38413
38327
|
var _this$state5 = _this.state,
|
|
38414
|
-
|
|
38415
|
-
|
|
38328
|
+
left = _this$state5.left,
|
|
38329
|
+
top = _this$state5.top;
|
|
38416
38330
|
var textarea = e.target;
|
|
38417
38331
|
var selectionEnd = textarea.selectionEnd,
|
|
38418
|
-
|
|
38419
|
-
|
|
38420
|
-
|
|
38332
|
+
selectionStart = textarea.selectionStart,
|
|
38333
|
+
value = textarea.value;
|
|
38421
38334
|
if (onChange) {
|
|
38422
38335
|
e.persist();
|
|
38423
38336
|
onChange(e);
|
|
38424
38337
|
}
|
|
38425
|
-
|
|
38426
38338
|
if (onCaretPositionChange) onCaretPositionChange(_this.getCaretPosition());
|
|
38427
|
-
|
|
38428
38339
|
_this.setState({
|
|
38429
38340
|
value: value
|
|
38430
38341
|
});
|
|
38431
|
-
|
|
38432
38342
|
var currentTrigger;
|
|
38433
38343
|
var lastToken;
|
|
38434
|
-
|
|
38435
38344
|
if (_this._isCommand(value)) {
|
|
38436
38345
|
currentTrigger = '/';
|
|
38437
38346
|
lastToken = value;
|
|
@@ -38445,35 +38354,31 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
38445
38354
|
return a === lastToken[0];
|
|
38446
38355
|
}) || null;
|
|
38447
38356
|
}
|
|
38357
|
+
|
|
38448
38358
|
/*
|
|
38449
38359
|
if we lost the trigger token or there is no following character we want to close
|
|
38450
38360
|
the autocomplete
|
|
38451
38361
|
*/
|
|
38452
|
-
|
|
38453
|
-
|
|
38454
38362
|
if (!lastToken || lastToken.length <= minChar) {
|
|
38455
38363
|
_this._closeAutocomplete();
|
|
38456
|
-
|
|
38457
38364
|
return;
|
|
38458
38365
|
}
|
|
38366
|
+
var actualToken = lastToken.slice(1);
|
|
38459
38367
|
|
|
38460
|
-
|
|
38461
|
-
|
|
38368
|
+
// if trigger is not configured step out from the function, otherwise proceed
|
|
38462
38369
|
if (!currentTrigger) return;
|
|
38463
|
-
|
|
38464
|
-
|
|
38370
|
+
if (movePopupAsYouType || top === null && left === null ||
|
|
38371
|
+
// if we have single char - trigger it means we want to re-position the autocomplete
|
|
38465
38372
|
lastToken.length === 1) {
|
|
38466
38373
|
var _getCaretCoordinates = getCaretCoordinates(textarea, selectionEnd),
|
|
38467
|
-
|
|
38468
|
-
|
|
38469
|
-
|
|
38374
|
+
newLeft = _getCaretCoordinates.left,
|
|
38375
|
+
newTop = _getCaretCoordinates.top;
|
|
38470
38376
|
_this.setState({
|
|
38471
38377
|
// make position relative to textarea
|
|
38472
38378
|
left: newLeft,
|
|
38473
38379
|
top: newTop - _this.textareaRef.scrollTop || 0
|
|
38474
38380
|
});
|
|
38475
38381
|
}
|
|
38476
|
-
|
|
38477
38382
|
_this.setState({
|
|
38478
38383
|
actualToken: actualToken,
|
|
38479
38384
|
currentTrigger: currentTrigger,
|
|
@@ -38487,77 +38392,62 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
38487
38392
|
}
|
|
38488
38393
|
});
|
|
38489
38394
|
});
|
|
38490
|
-
|
|
38491
38395
|
definePropertyExports(assertThisInitializedExports(_this), "_selectHandler", function (e) {
|
|
38492
38396
|
var _this$props3 = _this.props,
|
|
38493
|
-
|
|
38494
|
-
|
|
38397
|
+
onCaretPositionChange = _this$props3.onCaretPositionChange,
|
|
38398
|
+
onSelect = _this$props3.onSelect;
|
|
38495
38399
|
if (onCaretPositionChange) onCaretPositionChange(_this.getCaretPosition());
|
|
38496
|
-
|
|
38497
38400
|
if (onSelect) {
|
|
38498
38401
|
e.persist();
|
|
38499
38402
|
onSelect(e);
|
|
38500
38403
|
}
|
|
38501
38404
|
});
|
|
38502
|
-
|
|
38503
38405
|
definePropertyExports(assertThisInitializedExports(_this), "_onClickAndBlurHandler", function (e) {
|
|
38504
38406
|
var _this$props4 = _this.props,
|
|
38505
|
-
|
|
38506
|
-
|
|
38407
|
+
closeOnClickOutside = _this$props4.closeOnClickOutside,
|
|
38408
|
+
onBlur = _this$props4.onBlur;
|
|
38409
|
+
|
|
38410
|
+
// If this is a click: e.target is the textarea, and e.relatedTarget is the thing
|
|
38507
38411
|
// that was actually clicked. If we clicked inside the auto-select dropdown, then
|
|
38508
38412
|
// that's not a blur, from the auto-select point of view, so then do nothing.
|
|
38509
|
-
|
|
38510
38413
|
var el = e.relatedTarget;
|
|
38511
|
-
|
|
38512
38414
|
if (_this.dropdownRef && el instanceof Node && _this.dropdownRef.contains(el)) {
|
|
38513
38415
|
return;
|
|
38514
38416
|
}
|
|
38515
|
-
|
|
38516
38417
|
if (closeOnClickOutside) _this._closeAutocomplete();
|
|
38517
|
-
|
|
38518
38418
|
if (onBlur) {
|
|
38519
38419
|
e.persist();
|
|
38520
38420
|
onBlur(e);
|
|
38521
38421
|
}
|
|
38522
38422
|
});
|
|
38523
|
-
|
|
38524
38423
|
definePropertyExports(assertThisInitializedExports(_this), "_onScrollHandler", function () {
|
|
38525
38424
|
return _this._closeAutocomplete();
|
|
38526
38425
|
});
|
|
38527
|
-
|
|
38528
38426
|
definePropertyExports(assertThisInitializedExports(_this), "_dropdownScroll", function (item) {
|
|
38529
38427
|
var scrollToItem = _this.props.scrollToItem;
|
|
38530
38428
|
if (!scrollToItem) return;
|
|
38531
|
-
|
|
38532
38429
|
if (scrollToItem === true) {
|
|
38533
38430
|
defaultScrollToItem(_this.dropdownRef, item);
|
|
38534
38431
|
return;
|
|
38535
38432
|
}
|
|
38536
|
-
|
|
38537
38433
|
if (typeof scrollToItem !== 'function' || scrollToItem.length !== 2) {
|
|
38538
38434
|
throw new Error('`scrollToItem` has to be boolean (true for default implementation) or function with two parameters: container, item.');
|
|
38539
38435
|
}
|
|
38540
|
-
|
|
38541
38436
|
scrollToItem(_this.dropdownRef, item);
|
|
38542
38437
|
});
|
|
38543
|
-
|
|
38544
38438
|
definePropertyExports(assertThisInitializedExports(_this), "getTriggerProps", function () {
|
|
38545
38439
|
var _this$props5 = _this.props,
|
|
38546
|
-
|
|
38547
|
-
|
|
38548
|
-
|
|
38440
|
+
showCommandsList = _this$props5.showCommandsList,
|
|
38441
|
+
showMentionsList = _this$props5.showMentionsList,
|
|
38442
|
+
trigger = _this$props5.trigger;
|
|
38549
38443
|
var _this$state6 = _this.state,
|
|
38550
|
-
|
|
38551
|
-
|
|
38552
|
-
|
|
38553
|
-
|
|
38554
|
-
|
|
38444
|
+
component = _this$state6.component,
|
|
38445
|
+
currentTrigger = _this$state6.currentTrigger,
|
|
38446
|
+
selectionEnd = _this$state6.selectionEnd,
|
|
38447
|
+
value = _this$state6.value;
|
|
38555
38448
|
var selectedItem = _this._getItemOnSelect();
|
|
38556
|
-
|
|
38557
38449
|
var suggestionData = _this._getSuggestions();
|
|
38558
|
-
|
|
38559
38450
|
var textToReplace = _this._getTextToReplace();
|
|
38560
|
-
|
|
38561
38451
|
var triggerProps = {
|
|
38562
38452
|
component: component,
|
|
38563
38453
|
currentTrigger: currentTrigger,
|
|
@@ -38567,7 +38457,6 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
38567
38457
|
value: value,
|
|
38568
38458
|
values: suggestionData
|
|
38569
38459
|
};
|
|
38570
|
-
|
|
38571
38460
|
if (showCommandsList && trigger['/'] || showMentionsList && trigger['@']) {
|
|
38572
38461
|
var currentCommands;
|
|
38573
38462
|
var getCommands = trigger[showCommandsList ? '/' : '@'].dataProvider;
|
|
@@ -38582,28 +38471,25 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
38582
38471
|
triggerProps.value = showCommandsList ? '/' : '@';
|
|
38583
38472
|
triggerProps.values = currentCommands;
|
|
38584
38473
|
}
|
|
38585
|
-
|
|
38586
38474
|
return triggerProps;
|
|
38587
38475
|
});
|
|
38588
|
-
|
|
38589
38476
|
definePropertyExports(assertThisInitializedExports(_this), "setDropdownRef", function (element) {
|
|
38590
38477
|
_this.dropdownRef = element;
|
|
38591
38478
|
});
|
|
38592
|
-
|
|
38593
38479
|
var _this$props6 = _this.props,
|
|
38594
|
-
|
|
38595
|
-
|
|
38596
|
-
|
|
38480
|
+
loadingComponent = _this$props6.loadingComponent,
|
|
38481
|
+
_trigger = _this$props6.trigger,
|
|
38482
|
+
_value = _this$props6.value;
|
|
38483
|
+
|
|
38484
|
+
// TODO: it would be better to have the parent control state...
|
|
38597
38485
|
// if (value) this.state.value = value;
|
|
38598
38486
|
|
|
38599
38487
|
if (!loadingComponent) {
|
|
38600
38488
|
throw new Error('RTA: loadingComponent is not defined');
|
|
38601
38489
|
}
|
|
38602
|
-
|
|
38603
38490
|
if (!_trigger) {
|
|
38604
38491
|
throw new Error('RTA: trigger is not defined');
|
|
38605
38492
|
}
|
|
38606
|
-
|
|
38607
38493
|
_this.state = {
|
|
38608
38494
|
actualToken: '',
|
|
38609
38495
|
component: null,
|
|
@@ -38618,22 +38504,20 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
38618
38504
|
};
|
|
38619
38505
|
return _this;
|
|
38620
38506
|
}
|
|
38621
|
-
|
|
38622
38507
|
createClassExports(ReactTextareaAutocomplete, [{
|
|
38623
38508
|
key: "renderSuggestionListContainer",
|
|
38624
38509
|
value: function renderSuggestionListContainer() {
|
|
38625
38510
|
var _this$props7 = this.props,
|
|
38626
|
-
|
|
38627
|
-
|
|
38628
|
-
|
|
38629
|
-
|
|
38630
|
-
|
|
38631
|
-
|
|
38632
|
-
|
|
38633
|
-
|
|
38634
|
-
|
|
38511
|
+
disableMentions = _this$props7.disableMentions,
|
|
38512
|
+
dropdownClassName = _this$props7.dropdownClassName,
|
|
38513
|
+
dropdownStyle = _this$props7.dropdownStyle,
|
|
38514
|
+
itemClassName = _this$props7.itemClassName,
|
|
38515
|
+
itemStyle = _this$props7.itemStyle,
|
|
38516
|
+
listClassName = _this$props7.listClassName,
|
|
38517
|
+
SuggestionItem = _this$props7.SuggestionItem,
|
|
38518
|
+
_this$props7$Suggesti = _this$props7.SuggestionList,
|
|
38519
|
+
SuggestionList = _this$props7$Suggesti === void 0 ? List$1 : _this$props7$Suggesti;
|
|
38635
38520
|
var triggerProps = this.getTriggerProps();
|
|
38636
|
-
|
|
38637
38521
|
if (triggerProps.values && triggerProps.currentTrigger && !(disableMentions && triggerProps.currentTrigger === '@')) {
|
|
38638
38522
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
38639
38523
|
className: clsx('rta__autocomplete', 'str-chat__suggestion-list-container', dropdownClassName),
|
|
@@ -38648,24 +38532,24 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
38648
38532
|
SuggestionItem: SuggestionItem
|
|
38649
38533
|
}, triggerProps)));
|
|
38650
38534
|
}
|
|
38651
|
-
|
|
38652
38535
|
return null;
|
|
38653
38536
|
}
|
|
38654
38537
|
}, {
|
|
38655
38538
|
key: "render",
|
|
38656
38539
|
value: function render() {
|
|
38657
38540
|
var _this2 = this;
|
|
38658
|
-
|
|
38659
38541
|
var _this$props8 = this.props,
|
|
38660
|
-
|
|
38661
|
-
|
|
38662
|
-
|
|
38663
|
-
|
|
38542
|
+
className = _this$props8.className,
|
|
38543
|
+
containerClassName = _this$props8.containerClassName,
|
|
38544
|
+
containerStyle = _this$props8.containerStyle,
|
|
38545
|
+
style = _this$props8.style;
|
|
38664
38546
|
var maxRows = this.props.maxRows;
|
|
38665
38547
|
var _this$state7 = this.state,
|
|
38666
|
-
|
|
38667
|
-
|
|
38668
|
-
if (!this.props.grow) maxRows = 1;
|
|
38548
|
+
dataLoading = _this$state7.dataLoading,
|
|
38549
|
+
value = _this$state7.value;
|
|
38550
|
+
if (!this.props.grow) maxRows = 1;
|
|
38551
|
+
|
|
38552
|
+
// By setting defaultValue to undefined, avoid error:
|
|
38669
38553
|
// ForwardRef(TextareaAutosize) contains a textarea with both value and defaultValue props.
|
|
38670
38554
|
// Textarea elements must be either controlled or uncontrolled
|
|
38671
38555
|
|
|
@@ -38688,7 +38572,6 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
38688
38572
|
onSelect: this._selectHandler,
|
|
38689
38573
|
ref: function ref(_ref) {
|
|
38690
38574
|
var _this2$props;
|
|
38691
|
-
|
|
38692
38575
|
(_this2$props = _this2.props) === null || _this2$props === void 0 ? void 0 : _this2$props.innerRef(_ref);
|
|
38693
38576
|
_this2.textareaRef = _ref;
|
|
38694
38577
|
},
|
|
@@ -38717,12 +38600,9 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
38717
38600
|
/**
|
|
38718
38601
|
* Close autocomplete, also clean up trigger (to avoid slow promises)
|
|
38719
38602
|
*/
|
|
38720
|
-
|
|
38721
38603
|
}]);
|
|
38722
|
-
|
|
38723
38604
|
return ReactTextareaAutocomplete;
|
|
38724
38605
|
}(React__default["default"].Component);
|
|
38725
|
-
|
|
38726
38606
|
definePropertyExports(ReactTextareaAutocomplete, "defaultProps", {
|
|
38727
38607
|
closeOnClickOutside: true,
|
|
38728
38608
|
maxRows: 10,
|
|
@@ -38731,7 +38611,6 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
38731
38611
|
scrollToItem: true,
|
|
38732
38612
|
value: ''
|
|
38733
38613
|
});
|
|
38734
|
-
|
|
38735
38614
|
ReactTextareaAutocomplete.propTypes = {
|
|
38736
38615
|
className: propTypesExports.string,
|
|
38737
38616
|
closeOnClickOutside: propTypesExports.bool,
|
|
@@ -48476,7 +48355,7 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
48476
48355
|
|
|
48477
48356
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
|
|
48478
48357
|
|
|
48479
|
-
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var version$1 = '10.7.
|
|
48358
|
+
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var version$1 = '10.7.1';
|
|
48480
48359
|
|
|
48481
48360
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var useChat = function (_a) {
|
|
48482
48361
|
var _b, _c;
|
|
@@ -56469,6 +56348,46 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
56469
56348
|
|
|
56470
56349
|
var parseXml$1 = src;
|
|
56471
56350
|
|
|
56351
|
+
var dist$1 = {};
|
|
56352
|
+
|
|
56353
|
+
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};Object.defineProperty(dist$1, "__esModule", { value: true });
|
|
56354
|
+
var sanitizeUrl_1 = dist$1.sanitizeUrl = void 0;
|
|
56355
|
+
var invalidProtocolRegex = /^([^\w]*)(javascript|data|vbscript)/im;
|
|
56356
|
+
var htmlEntitiesRegex = /&#(\w+)(^\w|;)?/g;
|
|
56357
|
+
var ctrlCharactersRegex = /[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim;
|
|
56358
|
+
var urlSchemeRegex = /^([^:]+):/gm;
|
|
56359
|
+
var relativeFirstCharacters = [".", "/"];
|
|
56360
|
+
function isRelativeUrlWithoutProtocol(url) {
|
|
56361
|
+
return relativeFirstCharacters.indexOf(url[0]) > -1;
|
|
56362
|
+
}
|
|
56363
|
+
// adapted from https://stackoverflow.com/a/29824550/2601552
|
|
56364
|
+
function decodeHtmlCharacters(str) {
|
|
56365
|
+
return str.replace(htmlEntitiesRegex, function (match, dec) {
|
|
56366
|
+
return String.fromCharCode(dec);
|
|
56367
|
+
});
|
|
56368
|
+
}
|
|
56369
|
+
function sanitizeUrl(url) {
|
|
56370
|
+
var sanitizedUrl = decodeHtmlCharacters(url || "")
|
|
56371
|
+
.replace(ctrlCharactersRegex, "")
|
|
56372
|
+
.trim();
|
|
56373
|
+
if (!sanitizedUrl) {
|
|
56374
|
+
return "about:blank";
|
|
56375
|
+
}
|
|
56376
|
+
if (isRelativeUrlWithoutProtocol(sanitizedUrl)) {
|
|
56377
|
+
return sanitizedUrl;
|
|
56378
|
+
}
|
|
56379
|
+
var urlSchemeParseResults = sanitizedUrl.match(urlSchemeRegex);
|
|
56380
|
+
if (!urlSchemeParseResults) {
|
|
56381
|
+
return sanitizedUrl;
|
|
56382
|
+
}
|
|
56383
|
+
var urlScheme = urlSchemeParseResults[0];
|
|
56384
|
+
if (invalidProtocolRegex.test(urlScheme)) {
|
|
56385
|
+
return "about:blank";
|
|
56386
|
+
}
|
|
56387
|
+
return sanitizedUrl;
|
|
56388
|
+
}
|
|
56389
|
+
sanitizeUrl_1 = dist$1.sanitizeUrl = sanitizeUrl;
|
|
56390
|
+
|
|
56472
56391
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
|
|
56473
56392
|
var immutable = extend$1;
|
|
56474
56393
|
|