stream-chat-react 10.22.1 → 10.22.3

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.
@@ -21,6 +21,7 @@ export class ReactTextareaAutocomplete extends React.Component<any, any, any> {
21
21
  currentTrigger: null;
22
22
  data: null;
23
23
  dataLoading: boolean;
24
+ isComposing: boolean;
24
25
  left: null;
25
26
  selectionEnd: number;
26
27
  selectionStart: number;
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../../src/components/AutoCompleteTextarea/Textarea.jsx"],"names":[],"mappings":"AAmBA;IACE;;;;;;;MAOE;IA6WF;;OAEG;IACH;;;aAMC;IApXD,wBA4BC;IAZC;;;;;;;;;;;MAWC;IAIH;;;aAOE;IAGF,2BAOE;IAEF,8CAKE;IAEF,+BAIE;IAEF;;;;;;OAMG;IACH,8CAC6E;IAE7E,qCAUE;IAEF,+BAcE;IAEF,qBAQE;IAEF,yBA6BE;IAEF,mCAqEE;IAEF,qEAuBE;IAEF,sEA2DE;IAEF,uDAQE;IAEF,mCA0CE;IAEF,6CAQE;IAYF;;OAEG;IACH,+BAQE;IAEF;;MA6CE;IAEF,mCAME;IAEF,iCA+EE;IAEF,iCASE;IAGF,yCA0BE;IAEF,6BAAmD;IAEnD,qCAiBE;IAEF;;;;;;;;MAoCE;IAEF,uCAEE;IADA,iBAA0B;IAG5B,oDA2CC;IAED,sBA2EC;IATS,oDAAsB;CAUjC"}
1
+ {"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../../src/components/AutoCompleteTextarea/Textarea.jsx"],"names":[],"mappings":"AAmBA;IACE;;;;;;;MAOE;IA8WF;;OAEG;IACH;;;aAMC;IArXD,wBA6BC;IAbC;;;;;;;;;;;;MAYC;IAIH;;;aAOE;IAGF,2BAOE;IAEF,8CAKE;IAEF,+BAIE;IAEF;;;;;;OAMG;IACH,8CAC6E;IAE7E,qCAUE;IAEF,+BAcE;IAEF,qBAQE;IAEF,yBA6BE;IAEF,mCAqEE;IAEF,qEAuBE;IAEF,sEA2DE;IAEF,uDAQE;IAEF,mCA0CE;IAEF,6CAQE;IAYF;;OAEG;IACH,+BAQE;IAEF;;MA6CE;IAEF,mCAME;IAEF,iCA+EE;IAEF,iCASE;IAGF,yCA0BE;IAEF,6BAAmD;IAEnD,qCAiBE;IAEF;;;;;;;;MAoCE;IAEF,uCAEE;IADA,iBAA0B;IAG5B,oDA6CC;IAED,sBA6EC;IATS,oDAAsB;CAUjC"}
@@ -492,6 +492,7 @@ var ReactTextareaAutocomplete = /** @class */ (function (_super) {
492
492
  currentTrigger: null,
493
493
  data: null,
494
494
  dataLoading: false,
495
+ isComposing: false,
495
496
  left: null,
496
497
  selectionEnd: 0,
497
498
  selectionStart: 0,
@@ -513,14 +514,15 @@ var ReactTextareaAutocomplete = /** @class */ (function (_super) {
513
514
  };
514
515
  ReactTextareaAutocomplete.prototype.renderSuggestionListContainer = function () {
515
516
  var _a = this.props, disableMentions = _a.disableMentions, dropdownClassName = _a.dropdownClassName, dropdownStyle = _a.dropdownStyle, itemClassName = _a.itemClassName, itemStyle = _a.itemStyle, listClassName = _a.listClassName, SuggestionItem = _a.SuggestionItem, _b = _a.SuggestionList, SuggestionList = _b === void 0 ? DefaultSuggestionList : _b;
517
+ var isComposing = this.state.isComposing;
516
518
  var triggerProps = this.getTriggerProps();
517
- if (triggerProps.values &&
518
- triggerProps.currentTrigger &&
519
- !(disableMentions && triggerProps.currentTrigger === '@')) {
520
- return (React.createElement("div", { className: clsx('rta__autocomplete', 'str-chat__suggestion-list-container', dropdownClassName), ref: this.setDropdownRef, style: dropdownStyle },
521
- React.createElement(SuggestionList, __assign({ className: clsx('str-chat__suggestion-list', listClassName), dropdownScroll: this._dropdownScroll, itemClassName: clsx('str-chat__suggestion-list-item', itemClassName), itemStyle: itemStyle, onSelect: this._onSelect, SuggestionItem: SuggestionItem }, triggerProps))));
522
- }
523
- return null;
519
+ if (isComposing ||
520
+ !triggerProps.values ||
521
+ !triggerProps.currentTrigger ||
522
+ (disableMentions && triggerProps.currentTrigger === '@'))
523
+ return null;
524
+ return (React.createElement("div", { className: clsx('rta__autocomplete', 'str-chat__suggestion-list-container', dropdownClassName), ref: this.setDropdownRef, style: dropdownStyle },
525
+ React.createElement(SuggestionList, __assign({ className: clsx('str-chat__suggestion-list', listClassName), dropdownScroll: this._dropdownScroll, itemClassName: clsx('str-chat__suggestion-list-item', itemClassName), itemStyle: itemStyle, onSelect: this._onSelect, SuggestionItem: SuggestionItem }, triggerProps))));
524
526
  };
525
527
  ReactTextareaAutocomplete.prototype.render = function () {
526
528
  var _this = this;
@@ -546,7 +548,7 @@ var ReactTextareaAutocomplete = /** @class */ (function (_super) {
546
548
  }, onClick: function (e) {
547
549
  _this._onClickAndBlurHandler(e);
548
550
  onClick === null || onClick === void 0 ? void 0 : onClick(e);
549
- }, onFocus: function (e) {
551
+ }, onCompositionEnd: function () { return _this.setState(function (pv) { return (__assign(__assign({}, pv), { isComposing: false })); }); }, onCompositionStart: function () { return _this.setState(function (pv) { return (__assign(__assign({}, pv), { isComposing: true })); }); }, onFocus: function (e) {
550
552
  var _a, _b;
551
553
  (_b = (_a = _this.props).onFocus) === null || _b === void 0 ? void 0 : _b.call(_a, e);
552
554
  onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
@@ -1 +1 @@
1
- {"version":3,"file":"ModalGallery.d.ts","sourceRoot":"","sources":["../../../src/components/Gallery/ModalGallery.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAEnE,oBAAY,iBAAiB,CAC3B,kBAAkB,SAAS,yBAAyB,GAAG,yBAAyB,IAC9E;IACF,4CAA4C;IAC5C,MAAM,EAAE,UAAU,CAAC,kBAAkB,CAAC,EAAE,CAAC;IACzC,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,YAAY,iJA8BxB,CAAC"}
1
+ {"version":3,"file":"ModalGallery.d.ts","sourceRoot":"","sources":["../../../src/components/Gallery/ModalGallery.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAEnE,oBAAY,iBAAiB,CAC3B,kBAAkB,SAAS,yBAAyB,GAAG,yBAAyB,IAC9E;IACF,4CAA4C;IAC5C,MAAM,EAAE,UAAU,CAAC,kBAAkB,CAAC,EAAE,CAAC;IACzC,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAYF,eAAO,MAAM,YAAY,iJA+BxB,CAAC"}
@@ -1,6 +1,16 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import ImageGallery from 'react-image-gallery';
3
+ import { BaseImage } from './BaseImage';
3
4
  import { useTranslationContext } from '../../context';
5
+ var onError = function (e) {
6
+ // Prevent having alt attribute on img as the img takes the height of the alt text
7
+ // instead of the CSS / element width & height when the CSS mask (fallback) is applied.
8
+ e.target.alt = '';
9
+ };
10
+ var renderItem = function (_a) {
11
+ var original = _a.original, originalAlt = _a.originalAlt;
12
+ return (React.createElement(BaseImage, { alt: originalAlt, className: 'image-gallery-image', onError: onError, src: original }));
13
+ };
4
14
  export var ModalGallery = function (props) {
5
15
  var images = props.images, index = props.index;
6
16
  var t = useTranslationContext('ModalGallery').t;
@@ -14,5 +24,5 @@ export var ModalGallery = function (props) {
14
24
  };
15
25
  });
16
26
  }, [images]);
17
- return (React.createElement(ImageGallery, { items: formattedArray, showIndex: true, showPlayButton: false, showThumbnails: false, startIndex: index }));
27
+ return (React.createElement(ImageGallery, { items: formattedArray, renderItem: renderItem, showIndex: true, showPlayButton: false, showThumbnails: false, startIndex: index }));
18
28
  };