@azure/communication-react 1.13.0-alpha-202402020012 → 1.13.0-alpha-202402030013

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 (24) hide show
  1. package/dist/dist-cjs/communication-react/index.js +75 -27
  2. package/dist/dist-cjs/communication-react/index.js.map +1 -1
  3. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  4. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  5. package/dist/dist-esm/react-components/src/components/RTE/RTEInputBoxComponent.d.ts +4 -1
  6. package/dist/dist-esm/react-components/src/components/RTE/RTEInputBoxComponent.js +2 -2
  7. package/dist/dist-esm/react-components/src/components/RTE/RTEInputBoxComponent.js.map +1 -1
  8. package/dist/dist-esm/react-components/src/components/RTE/RTESendBox.d.ts +5 -1
  9. package/dist/dist-esm/react-components/src/components/RTE/RTESendBox.js +85 -24
  10. package/dist/dist-esm/react-components/src/components/RTE/RTESendBox.js.map +1 -1
  11. package/dist/dist-esm/react-components/src/components/RTE/RTESendBoxErrors.d.ts +2 -1
  12. package/dist/dist-esm/react-components/src/components/RTE/RTESendBoxErrors.js +52 -8
  13. package/dist/dist-esm/react-components/src/components/RTE/RTESendBoxErrors.js.map +1 -1
  14. package/dist/dist-esm/react-components/src/components/RTE/RichTextEditor.d.ts +10 -2
  15. package/dist/dist-esm/react-components/src/components/RTE/RichTextEditor.js +12 -3
  16. package/dist/dist-esm/react-components/src/components/RTE/RichTextEditor.js.map +1 -1
  17. package/dist/dist-esm/react-components/src/components/SendBox.js +4 -21
  18. package/dist/dist-esm/react-components/src/components/SendBox.js.map +1 -1
  19. package/dist/dist-esm/react-components/src/components/SendBoxErrorBar.js +1 -1
  20. package/dist/dist-esm/react-components/src/components/SendBoxErrorBar.js.map +1 -1
  21. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.d.ts +12 -0
  22. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js +22 -0
  23. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js.map +1 -1
  24. package/package.json +1 -1
@@ -14,9 +14,9 @@ var textareaCaretTs = require('textarea-caret-ts');
14
14
  var reactComponents = require('@fluentui/react-components');
15
15
  var useDebounce = require('use-debounce');
16
16
  var reactFileTypeIcons = require('@fluentui/react-file-type-icons');
17
- require('roosterjs-editor-plugins');
18
- require('roosterjs-editor-core');
19
- require('roosterjs-react');
17
+ var roosterjsEditorPlugins = require('roosterjs-editor-plugins');
18
+ var roosterjsEditorCore = require('roosterjs-editor-core');
19
+ var roosterjsReact = require('roosterjs-react');
20
20
  var uuid = require('uuid');
21
21
  var reactChat = require('@fluentui-contrib/react-chat');
22
22
  var react$1 = require('@griffel/react');
@@ -173,7 +173,7 @@ function getDefaultExportFromCjs (x) {
173
173
  // Copyright (c) Microsoft Corporation.
174
174
  // Licensed under the MIT License.
175
175
  // GENERATED FILE. DO NOT EDIT MANUALLY.
176
- var telemetryVersion = '1.13.0-alpha-202402020012';
176
+ var telemetryVersion = '1.13.0-alpha-202402030013';
177
177
 
178
178
 
179
179
  var telemetryVersion$1 = /*@__PURE__*/getDefaultExportFromCjs(telemetryVersion);
@@ -8378,7 +8378,7 @@ const SendBoxErrorBar = (props) => {
8378
8378
  if (errorMessage) {
8379
8379
  return (React.createElement(React.Fragment, null,
8380
8380
  React.createElement(Announcer$1, { announcementString: errorMessage, ariaLive: 'polite' }),
8381
- React.createElement(react.MessageBar, { messageBarType: react.MessageBarType.warning, styles: {
8381
+ React.createElement(react.MessageBar, { "data-test-id": 'send-box-message-bar', messageBarType: react.MessageBarType.warning, styles: {
8382
8382
  iconContainer: {
8383
8383
  display: 'none'
8384
8384
  }
@@ -8576,6 +8576,11 @@ const _FileUploadCards = (props) => {
8576
8576
 
8577
8577
  // Copyright (c) Microsoft Corporation.
8578
8578
  // Licensed under the MIT License.
8579
+ /**
8580
+ * @private
8581
+ */
8582
+ const MAXIMUM_LENGTH_OF_MESSAGE$1 = 8000;
8583
+ const EMPTY_MESSAGE_REGEX = /^\s*$/;
8579
8584
  /* @conditional-compile-remove(file-sharing) */
8580
8585
  /**
8581
8586
  * @private
@@ -8591,11 +8596,26 @@ const hasIncompleteFileUploads = (activeFileUploads) => {
8591
8596
  const hasCompletedFileUploads = (activeFileUploads) => {
8592
8597
  return !!(activeFileUploads === null || activeFileUploads === void 0 ? void 0 : activeFileUploads.find((file) => !file.error));
8593
8598
  };
8599
+ /**
8600
+ * @private
8601
+ */
8602
+ const exceedsMaxAllowedLength = (valueLength) => {
8603
+ return valueLength > MAXIMUM_LENGTH_OF_MESSAGE$1;
8604
+ };
8605
+ /**
8606
+ * @private
8607
+ */
8608
+ const sanitizeText = (message) => {
8609
+ if (EMPTY_MESSAGE_REGEX.test(message)) {
8610
+ return '';
8611
+ }
8612
+ else {
8613
+ return message;
8614
+ }
8615
+ };
8594
8616
 
8595
8617
  // Copyright (c) Microsoft Corporation.
8596
8618
  // Licensed under the MIT License.
8597
- const MAXIMUM_LENGTH_OF_MESSAGE$1 = 8000;
8598
- const EMPTY_MESSAGE_REGEX = /^\s*$/;
8599
8619
  /**
8600
8620
  * Component for typing and sending messages.
8601
8621
  *
@@ -8636,9 +8656,9 @@ const SendBox = (props) => {
8636
8656
  const message = textValue;
8637
8657
  // we don't want to send empty messages including spaces, newlines, tabs
8638
8658
  // Message can be empty if there is a valid file upload
8639
- if (!EMPTY_MESSAGE_REGEX.test(message) ||
8659
+ if (sanitizeText(message).length > 0 ||
8640
8660
  /* @conditional-compile-remove(file-sharing) */ hasCompletedFileUploads(activeFileUploads)) {
8641
- onSendMessage && onSendMessage(sanitizeText(message));
8661
+ onSendMessage && onSendMessage(message);
8642
8662
  setTextValue('');
8643
8663
  }
8644
8664
  (_a = sendTextFieldRef.current) === null || _a === void 0 ? void 0 : _a.focus();
@@ -8647,12 +8667,7 @@ const SendBox = (props) => {
8647
8667
  if (newValue === undefined) {
8648
8668
  return;
8649
8669
  }
8650
- if (newValue.length > MAXIMUM_LENGTH_OF_MESSAGE$1) {
8651
- setTextValueOverflow(true);
8652
- }
8653
- else {
8654
- setTextValueOverflow(false);
8655
- }
8670
+ setTextValueOverflow(exceedsMaxAllowedLength(newValue.length));
8656
8671
  setTextValue(newValue);
8657
8672
  };
8658
8673
  const textTooLongMessage = textValueOverflow ? strings.textTooLong : undefined;
@@ -8728,17 +8743,6 @@ const SendBox = (props) => {
8728
8743
  /* @conditional-compile-remove(file-sharing) */
8729
8744
  onRenderFileUploads())));
8730
8745
  };
8731
- /**
8732
- * @private
8733
- */
8734
- const sanitizeText = (message) => {
8735
- if (EMPTY_MESSAGE_REGEX.test(message)) {
8736
- return '';
8737
- }
8738
- else {
8739
- return message;
8740
- }
8741
- };
8742
8746
 
8743
8747
  // Copyright (c) Microsoft Corporation.
8744
8748
  // Licensed under the MIT License.
@@ -8991,7 +8995,7 @@ const ImageGallery = (props) => {
8991
8995
  /**
8992
8996
  * @private
8993
8997
  */
8994
- react.mergeStyles({
8998
+ const richTextEditorStyle = react.mergeStyles({
8995
8999
  border: 'none',
8996
9000
  overflow: 'auto',
8997
9001
  padding: '10px',
@@ -9001,6 +9005,50 @@ react.mergeStyles({
9001
9005
  maxHeight: '8.25rem'
9002
9006
  });
9003
9007
 
9008
+ // Copyright (c) Microsoft Corporation.
9009
+ // Licensed under the MIT License.
9010
+ /**
9011
+ * A component to wrap RoosterJS Rich Text Editor.
9012
+ *
9013
+ * @beta
9014
+ */
9015
+ React.forwardRef((props, ref) => {
9016
+ const { content, onChange, placeholderText } = props;
9017
+ const editor = React.useRef(null);
9018
+ React.useImperativeHandle(ref, () => {
9019
+ return {
9020
+ focus() {
9021
+ if (editor.current) {
9022
+ editor.current.focus();
9023
+ }
9024
+ }
9025
+ };
9026
+ }, []);
9027
+ React.useEffect(() => {
9028
+ var _a, _b;
9029
+ if (content !== ((_a = editor.current) === null || _a === void 0 ? void 0 : _a.getContent())) {
9030
+ (_b = editor.current) === null || _b === void 0 ? void 0 : _b.setContent(content || '');
9031
+ }
9032
+ }, [content]);
9033
+ const editorCreator = React.useMemo(() => {
9034
+ return (div) => {
9035
+ const contentEdit = new roosterjsEditorPlugins.ContentEdit();
9036
+ const placeholderPlugin = new roosterjsEditorPlugins.Watermark(placeholderText || '');
9037
+ const updateContentPlugin = roosterjsReact.createUpdateContentPlugin(roosterjsReact.UpdateMode.OnContentChangedEvent | roosterjsReact.UpdateMode.OnUserInput, (content) => {
9038
+ onChange && onChange(content);
9039
+ });
9040
+ const options = {
9041
+ plugins: [placeholderPlugin, contentEdit, updateContentPlugin],
9042
+ imageSelectionBorderColor: 'blue'
9043
+ };
9044
+ editor.current = new roosterjsEditorCore.Editor(div, options);
9045
+ return editor.current;
9046
+ };
9047
+ }, [onChange, placeholderText]);
9048
+ return (React.createElement("div", null,
9049
+ React.createElement(roosterjsReact.Rooster, { className: richTextEditorStyle, editorCreator: editorCreator })));
9050
+ });
9051
+
9004
9052
  // Copyright (c) Microsoft Corporation.
9005
9053
  // Licensed under the MIT License.
9006
9054
  /** @private */