@azure/communication-react 1.7.0-alpha-202307120016 → 1.7.0-alpha-202307140015

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.
@@ -178,7 +178,7 @@ const _isValidIdentifier = (identifier) => {
178
178
  // Copyright (c) Microsoft Corporation.
179
179
  // Licensed under the MIT license.
180
180
  // GENERATED FILE. DO NOT EDIT MANUALLY.
181
- var telemetryVersion = '1.7.0-alpha-202307120016';
181
+ var telemetryVersion = '1.7.0-alpha-202307140015';
182
182
 
183
183
  // Copyright (c) Microsoft Corporation.
184
184
  /**
@@ -6992,7 +6992,8 @@ react.mergeStyles({
6992
6992
  */
6993
6993
  const suggestionListStyle = react.mergeStyles({
6994
6994
  padding: '0.25rem 0rem 0',
6995
- overflow: 'visible'
6995
+ overflow: 'visible',
6996
+ overflowY: 'scroll'
6996
6997
  });
6997
6998
  /**
6998
6999
  * @private
@@ -7032,7 +7033,7 @@ const _MentionPopover = (props) => {
7032
7033
  const ids = useIdentifiers();
7033
7034
  const localeStrings = useLocale$1().strings;
7034
7035
  const popoverRef = React.useRef();
7035
- const [position, setPosition] = React.useState({ left: 0 });
7036
+ const [position, setPosition] = React.useState();
7036
7037
  const [hoveredSuggestion, setHoveredSuggestion] = React.useState(undefined);
7037
7038
  const [changedSelection, setChangedSelection] = React.useState(undefined); // Selection UI as per teams
7038
7039
  const dismissPopoverWhenClickingOutside = React.useCallback((e) => {
@@ -7119,20 +7120,19 @@ const _MentionPopover = (props) => {
7119
7120
  /* @conditional-compile-remove(mention) */
7120
7121
  return localeStrings.mentionPopover.mentionPopoverHeader;
7121
7122
  }, [localeStrings, title]);
7122
- return (React__default['default'].createElement("div", { ref: popoverRef },
7123
- React__default['default'].createElement(react.Stack, { "data-testid": 'mention-suggestion-list-container', className: react.mergeStyles({
7124
- maxHeight: 212,
7125
- maxWidth: position.maxWidth
7126
- }, mentionPopoverContainerStyle(theme), Object.assign(Object.assign({}, position), { position: 'absolute' })) },
7127
- React__default['default'].createElement(react.Stack.Item, { styles: headerStyleThemed(theme), "aria-label": title }, getHeaderTitle()),
7128
- React__default['default'].createElement(react.Stack
7129
- /* @conditional-compile-remove(mention) */
7130
- , { "data-ui-id": ids.mentionSuggestionList, className: suggestionListStyle }, suggestions.map((suggestion, index) => {
7131
- const active = index === activeSuggestionIndex;
7132
- return onRenderSuggestionItem
7133
- ? onRenderSuggestionItem(suggestion, onSuggestionSelected, active)
7134
- : defaultOnRenderSuggestionItem(suggestion, onSuggestionSelected, active);
7135
- })))));
7123
+ return (React__default['default'].createElement("div", { ref: popoverRef }, position && (React__default['default'].createElement(react.Stack, { "data-testid": 'mention-suggestion-list-container', className: react.mergeStyles({
7124
+ maxHeight: 212,
7125
+ maxWidth: position.maxWidth
7126
+ }, mentionPopoverContainerStyle(theme), Object.assign(Object.assign({}, position), { position: 'absolute' })) },
7127
+ React__default['default'].createElement(react.Stack.Item, { styles: headerStyleThemed(theme), "aria-label": title }, getHeaderTitle()),
7128
+ React__default['default'].createElement(react.Stack
7129
+ /* @conditional-compile-remove(mention) */
7130
+ , { "data-ui-id": ids.mentionSuggestionList, className: suggestionListStyle }, suggestions.map((suggestion, index) => {
7131
+ const active = index === activeSuggestionIndex;
7132
+ return onRenderSuggestionItem
7133
+ ? onRenderSuggestionItem(suggestion, onSuggestionSelected, active)
7134
+ : defaultOnRenderSuggestionItem(suggestion, onSuggestionSelected, active);
7135
+ }))))));
7136
7136
  };
7137
7137
 
7138
7138
  // Copyright (c) Microsoft Corporation.
@@ -7398,7 +7398,14 @@ const TextFieldWithMention = (props) => {
7398
7398
  }, [setSelectionStartValue, setSelectionEndValue]);
7399
7399
  const handleOnSelect = React.useCallback(({ event, inputTextValue, tags, shouldHandleOnMouseDownDuringSelect, selectionStartValue, selectionEndValue, interactionStartSelection }) => {
7400
7400
  var _a;
7401
- if (shouldHandleOnMouseDownDuringSelect) {
7401
+ if (event.currentTarget.selectionStart === 0 && event.currentTarget.selectionEnd === inputTextValue.length) {
7402
+ // entire text is selected, no need to change anything
7403
+ setSelectionStartValue(event.currentTarget.selectionStart);
7404
+ setSelectionEndValue(event.currentTarget.selectionEnd);
7405
+ setInteractionStartSelection(undefined);
7406
+ setShouldHandleOnMouseDownDuringSelect(false);
7407
+ }
7408
+ else if (shouldHandleOnMouseDownDuringSelect) {
7402
7409
  if (interactionStartSelection !== undefined &&
7403
7410
  (interactionStartSelection.start !== event.currentTarget.selectionStart ||
7404
7411
  interactionStartSelection.end !== event.currentTarget.selectionEnd)) {
@@ -7425,15 +7432,27 @@ const TextFieldWithMention = (props) => {
7425
7432
  setInteractionStartSelection(undefined);
7426
7433
  setShouldHandleOnMouseDownDuringSelect(false);
7427
7434
  }
7428
- else if (event.currentTarget.selectionStart !== null) {
7435
+ else if (event.currentTarget.selectionStart !== null && event.currentTarget.selectionEnd !== null) {
7429
7436
  // on select was triggered by mouse down/up with no movement
7430
7437
  const mentionTag = findMentionTagForSelection(tags, event.currentTarget.selectionStart);
7431
7438
  if (mentionTag !== undefined && mentionTag.plainTextBeginIndex !== undefined) {
7432
7439
  // handle mention click by selecting the whole mention
7433
7440
  // if the selection is not on the bounds of the mention
7434
- const mentionEndIndex = (_a = mentionTag.plainTextEndIndex) !== null && _a !== void 0 ? _a : mentionTag.plainTextBeginIndex;
7435
7441
  // disable selection for clicks on mention bounds
7436
- if (event.currentTarget.selectionStart !== event.currentTarget.selectionEnd ||
7442
+ const mentionEndIndex = (_a = mentionTag.plainTextEndIndex) !== null && _a !== void 0 ? _a : mentionTag.plainTextBeginIndex;
7443
+ if (event.currentTarget.selectionStart !== event.currentTarget.selectionEnd &&
7444
+ event.currentTarget.selectionEnd > mentionEndIndex) {
7445
+ // handle triple click when the text starts from mention
7446
+ if (event.currentTarget.selectionDirection === null) {
7447
+ event.currentTarget.setSelectionRange(mentionTag.plainTextBeginIndex, event.currentTarget.selectionEnd);
7448
+ }
7449
+ else {
7450
+ event.currentTarget.setSelectionRange(mentionTag.plainTextBeginIndex, event.currentTarget.selectionEnd, event.currentTarget.selectionDirection);
7451
+ }
7452
+ setSelectionStartValue(mentionTag.plainTextBeginIndex);
7453
+ setSelectionEndValue(event.currentTarget.selectionEnd);
7454
+ }
7455
+ else if (event.currentTarget.selectionStart !== event.currentTarget.selectionEnd ||
7437
7456
  (event.currentTarget.selectionStart !== mentionTag.plainTextBeginIndex &&
7438
7457
  event.currentTarget.selectionStart !== mentionEndIndex)) {
7439
7458
  if (event.currentTarget.selectionDirection === null) {
@@ -7457,7 +7476,6 @@ const TextFieldWithMention = (props) => {
7457
7476
  setSelectionEndValue(nullToUndefined(event.currentTarget.selectionEnd));
7458
7477
  }
7459
7478
  setInteractionStartSelection(undefined);
7460
- setShouldHandleOnMouseDownDuringSelect(false);
7461
7479
  }
7462
7480
  }
7463
7481
  else {