@azure/communication-react 1.5.1-alpha-202305260013 → 1.5.1-alpha-202305300013
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/README.md +1 -1
- package/dist/communication-react.d.ts +2 -2
- package/dist/dist-cjs/communication-react/index.js +187 -45
- package/dist/dist-cjs/communication-react/index.js.map +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js +11 -1
- package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/DevicesButton.js +9 -0
- package/dist/dist-esm/react-components/src/components/DevicesButton.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/Drawer/DrawerMenu.d.ts +5 -0
- package/dist/dist-esm/react-components/src/components/Drawer/DrawerMenu.js +1 -1
- package/dist/dist-esm/react-components/src/components/Drawer/DrawerMenu.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/Drawer/DrawerSurface.d.ts +5 -0
- package/dist/dist-esm/react-components/src/components/Drawer/DrawerSurface.js +23 -5
- package/dist/dist-esm/react-components/src/components/Drawer/DrawerSurface.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/InputBoxComponent.js +127 -28
- package/dist/dist-esm/react-components/src/components/InputBoxComponent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/VideoTile.styles.js +2 -1
- package/dist/dist-esm/react-components/src/components/styles/VideoTile.styles.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.d.ts +2 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallReadinessModal.js +3 -3
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallReadinessModal.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/SidePane.js +5 -3
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/SidePane.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/index.d.ts +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/index.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/AddPeopleDropdown.js +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/AddPeopleDropdown.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.js +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/Drawer/SpokenLanguageDrawer.styles.js +0 -1
- package/dist/dist-esm/react-composites/src/composites/common/Drawer/SpokenLanguageDrawer.styles.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/SendDtmfDialpad.js +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/SendDtmfDialpad.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/VideoEffectsPane.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/styles/ParticipantContainer.styles.d.ts +4 -0
- package/dist/dist-esm/react-composites/src/composites/common/styles/ParticipantContainer.styles.js +4 -0
- package/dist/dist-esm/react-composites/src/composites/common/styles/ParticipantContainer.styles.js.map +1 -1
- package/package.json +11 -11
- package/CHANGELOG.beta.md +0 -883
- package/CHANGELOG.json +0 -11992
- package/CHANGELOG.stable.md +0 -373
@@ -56,9 +56,17 @@ export const InputBoxComponent = (props) => {
|
|
56
56
|
// Index of the previous selection end in the text field
|
57
57
|
const [selectionEndValue, setSelectionEndValue] = useState(null);
|
58
58
|
/* @conditional-compile-remove(mention) */
|
59
|
-
// Boolean value to check if onMouseDown event should be handled during select as selection range
|
59
|
+
// Boolean value to check if onMouseDown event should be handled during select as selection range
|
60
|
+
// for onMouseDown event is not updated yet and the selection range for mouse click/taps will be
|
61
|
+
// updated in onSelect event if needed.
|
60
62
|
const [shouldHandleOnMouseDownDuringSelect, setShouldHandleOnMouseDownDuringSelect] = useState(true);
|
61
63
|
/* @conditional-compile-remove(mention) */
|
64
|
+
// Point of start of touch/mouse selection
|
65
|
+
const [interactionStartPoint, setInteractionStartPoint] = useState();
|
66
|
+
/* @conditional-compile-remove(mention) */
|
67
|
+
// Target selection from mouse movement
|
68
|
+
const [targetSelection, setTargetSelection] = useState();
|
69
|
+
/* @conditional-compile-remove(mention) */
|
62
70
|
// Caret position in the text field
|
63
71
|
const [caretPosition, setCaretPosition] = useState(undefined);
|
64
72
|
/* @conditional-compile-remove(mention) */
|
@@ -227,10 +235,6 @@ export const InputBoxComponent = (props) => {
|
|
227
235
|
/* @conditional-compile-remove(mention) */
|
228
236
|
const debouncedQueryUpdate = useDebouncedCallback((query) => __awaiter(void 0, void 0, void 0, function* () {
|
229
237
|
var _a;
|
230
|
-
if (query === undefined) {
|
231
|
-
updateMentionSuggestions([]);
|
232
|
-
return;
|
233
|
-
}
|
234
238
|
const suggestions = (_a = (yield (mentionLookupOptions === null || mentionLookupOptions === void 0 ? void 0 : mentionLookupOptions.onQueryUpdated(query)))) !== null && _a !== void 0 ? _a : [];
|
235
239
|
if (suggestions.length === 0) {
|
236
240
|
setActiveSuggestionIndex(undefined);
|
@@ -320,33 +324,54 @@ export const InputBoxComponent = (props) => {
|
|
320
324
|
}, [setSelectionStartValue, setSelectionEndValue]);
|
321
325
|
/* @conditional-compile-remove(mention) */
|
322
326
|
const handleOnSelect = useCallback((event, inputTextValue, tags, shouldHandleOnMouseDownDuringSelect, selectionStartValue, selectionEndValue) => {
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
327
|
+
if (shouldHandleOnMouseDownDuringSelect) {
|
328
|
+
if (targetSelection !== undefined) {
|
329
|
+
setSelectionStartValue(targetSelection.start);
|
330
|
+
setSelectionEndValue(targetSelection.end);
|
331
|
+
event.currentTarget.setSelectionRange(targetSelection.start, targetSelection.end);
|
332
|
+
setTargetSelection(undefined);
|
333
|
+
}
|
334
|
+
else if (event.currentTarget.selectionStart !== null) {
|
335
|
+
// on select was triggered by mouse down/up with no movement
|
336
|
+
const mentionTag = findMentionTagForSelection(tags, event.currentTarget.selectionStart);
|
337
|
+
if (mentionTag !== undefined && mentionTag.plainTextBeginIndex !== undefined) {
|
338
|
+
// handle mention click
|
339
|
+
// Get range of word that was clicked on
|
340
|
+
const selectionRange = rangeOfWordInSelection({
|
341
|
+
textInput: inputTextValue,
|
342
|
+
selectionStart: event.currentTarget.selectionStart,
|
343
|
+
selectionEnd: event.currentTarget.selectionEnd,
|
344
|
+
tag: mentionTag
|
345
|
+
});
|
346
|
+
if (event.currentTarget.selectionDirection === null) {
|
347
|
+
event.currentTarget.setSelectionRange(selectionRange.start, selectionRange.end);
|
348
|
+
}
|
349
|
+
else {
|
350
|
+
event.currentTarget.setSelectionRange(selectionRange.start, selectionRange.end, event.currentTarget.selectionDirection);
|
351
|
+
}
|
352
|
+
setSelectionStartValue(selectionRange.start);
|
353
|
+
setSelectionEndValue(selectionRange.end);
|
332
354
|
}
|
333
355
|
else {
|
334
|
-
|
356
|
+
setSelectionStartValue(event.currentTarget.selectionStart);
|
357
|
+
setSelectionEndValue(event.currentTarget.selectionEnd);
|
335
358
|
}
|
336
|
-
setSelectionStartValue(mentionTag.plainTextBeginIndex);
|
337
|
-
setSelectionEndValue((_c = mentionTag.plainTextEndIndex) !== null && _c !== void 0 ? _c : mentionTag.plainTextBeginIndex);
|
338
|
-
}
|
339
|
-
else {
|
340
|
-
setSelectionStartValue(event.currentTarget.selectionStart);
|
341
|
-
setSelectionEndValue(event.currentTarget.selectionEnd);
|
342
359
|
}
|
343
360
|
}
|
344
361
|
else {
|
345
362
|
// selection was changed by keyboard
|
346
363
|
updateSelectionIndexesWithMentionIfNeeded(event, inputTextValue, selectionStartValue, selectionEndValue, tags);
|
347
364
|
}
|
348
|
-
// don't set setShouldHandleOnMouseDownDuringSelect(false) here as setSelectionRange
|
349
|
-
|
365
|
+
// don't set setShouldHandleOnMouseDownDuringSelect(false) here as setSelectionRange
|
366
|
+
// could trigger additional calls of onSelect event and they may not be handled correctly
|
367
|
+
// (because of setSelectionRange calls or rerender)
|
368
|
+
}, [
|
369
|
+
updateSelectionIndexesWithMentionIfNeeded,
|
370
|
+
targetSelection,
|
371
|
+
setTargetSelection,
|
372
|
+
setSelectionStartValue,
|
373
|
+
setSelectionEndValue
|
374
|
+
]);
|
350
375
|
/* @conditional-compile-remove(mention) */
|
351
376
|
const handleOnChange = useCallback((event, tagsValue, htmlTextValue, inputTextValue, currentTriggerStartIndex, previousSelectionStart, previousSelectionEnd, currentSelectionStart, currentSelectionEnd, updatedValue) => __awaiter(void 0, void 0, void 0, function* () {
|
352
377
|
var _b;
|
@@ -405,7 +430,7 @@ export const InputBoxComponent = (props) => {
|
|
405
430
|
setCurrentTriggerStartIndex(tagIndex);
|
406
431
|
}
|
407
432
|
if (tagIndex === -1) {
|
408
|
-
|
433
|
+
updateMentionSuggestions([]);
|
409
434
|
}
|
410
435
|
else {
|
411
436
|
// In the middle of a @mention lookup
|
@@ -455,12 +480,44 @@ export const InputBoxComponent = (props) => {
|
|
455
480
|
}
|
456
481
|
}
|
457
482
|
onChange && onChange(event, result);
|
458
|
-
}), [onChange, mentionLookupOptions, setCaretIndex, setCaretPosition, debouncedQueryUpdate]);
|
483
|
+
}), [onChange, mentionLookupOptions, setCaretIndex, setCaretPosition, updateMentionSuggestions, debouncedQueryUpdate]);
|
459
484
|
const getInputFieldTextValue = () => {
|
460
485
|
/* @conditional-compile-remove(mention) */
|
461
486
|
return inputTextValue;
|
462
487
|
return textValue;
|
463
488
|
};
|
489
|
+
/* @conditional-compile-remove(mention) */
|
490
|
+
// Adjust the selection range based on a mouse / touch interaction
|
491
|
+
const handleOnMove = useCallback((event) => {
|
492
|
+
var _a;
|
493
|
+
let targetStart = event.currentTarget.selectionStart;
|
494
|
+
let targetEnd = event.currentTarget.selectionEnd;
|
495
|
+
// Should we do anything?
|
496
|
+
if (interactionStartPoint !== undefined &&
|
497
|
+
// And did selection change?
|
498
|
+
targetStart !== null &&
|
499
|
+
(targetStart !== (targetSelection === null || targetSelection === void 0 ? void 0 : targetSelection.start) || targetEnd !== (targetSelection === null || targetSelection === void 0 ? void 0 : targetSelection.end))) {
|
500
|
+
const direction = event.clientX > interactionStartPoint.x ? 'forward' : 'backward';
|
501
|
+
const mentionTag = findMentionTagForSelection(tagsValue, direction === 'backward'
|
502
|
+
? event.currentTarget.selectionStart
|
503
|
+
: (_a = event.currentTarget.selectionEnd) !== null && _a !== void 0 ? _a : event.currentTarget.selectionStart);
|
504
|
+
let updateCurrentTarget = false;
|
505
|
+
if (mentionTag !== undefined && mentionTag.plainTextBeginIndex !== undefined) {
|
506
|
+
targetStart = Math.min(mentionTag.plainTextBeginIndex, targetStart);
|
507
|
+
if (mentionTag.plainTextEndIndex !== undefined && targetEnd !== null) {
|
508
|
+
targetEnd = Math.max(mentionTag.plainTextEndIndex, targetEnd);
|
509
|
+
}
|
510
|
+
updateCurrentTarget = true;
|
511
|
+
setShouldHandleOnMouseDownDuringSelect(false);
|
512
|
+
}
|
513
|
+
// Update selection range
|
514
|
+
setTargetSelection({ start: targetStart, end: targetEnd });
|
515
|
+
if (updateCurrentTarget) {
|
516
|
+
// Only set the control, if the values are updated
|
517
|
+
event.currentTarget.setSelectionRange(targetStart, targetEnd, direction);
|
518
|
+
}
|
519
|
+
}
|
520
|
+
}, [setTargetSelection, targetSelection, setShouldHandleOnMouseDownDuringSelect, interactionStartPoint, tagsValue]);
|
464
521
|
return (React.createElement(Stack, { className: mergedRootStyle },
|
465
522
|
React.createElement("div", { className: mergedTextContainerStyle },
|
466
523
|
/* @conditional-compile-remove(mention) */ mentionSuggestions.length > 0 && (React.createElement(_MentionPopover, { suggestions: mentionSuggestions, activeSuggestionIndex: activeSuggestionIndex, target: inputBoxRef, targetPositionOffset: caretPosition, onRenderSuggestionItem: mentionLookupOptions === null || mentionLookupOptions === void 0 ? void 0 : mentionLookupOptions.onRenderSuggestionItem, onSuggestionSelected: onSuggestionSelected, onDismiss: () => {
|
@@ -493,8 +550,9 @@ export const InputBoxComponent = (props) => {
|
|
493
550
|
handleOnSelect(e, inputTextValue, tagsValue, shouldHandleOnMouseDownDuringSelect, selectionStartValue, selectionEndValue);
|
494
551
|
},
|
495
552
|
/* @conditional-compile-remove(mention) */
|
496
|
-
onMouseDown: () => {
|
497
|
-
|
553
|
+
onMouseDown: (e) => {
|
554
|
+
setInteractionStartPoint({ x: e.clientX, y: e.clientY });
|
555
|
+
// as events order is onMouseDown -> onMouseMove -> onMouseUp -> onSelect -> onClick
|
498
556
|
// onClick and onMouseDown can't handle clicking on mention event because
|
499
557
|
// onMouseDown doesn't have correct selectionRange yet and
|
500
558
|
// onClick already has wrong range as it's called after onSelect that updates the selection range
|
@@ -502,11 +560,27 @@ export const InputBoxComponent = (props) => {
|
|
502
560
|
setShouldHandleOnMouseDownDuringSelect(true);
|
503
561
|
},
|
504
562
|
/* @conditional-compile-remove(mention) */
|
505
|
-
|
563
|
+
onMouseMove: handleOnMove,
|
564
|
+
/* @conditional-compile-remove(mention) */
|
565
|
+
onMouseUp: () => {
|
566
|
+
setInteractionStartPoint(undefined);
|
567
|
+
},
|
568
|
+
/* @conditional-compile-remove(mention) */
|
569
|
+
onTouchStart: (e) => {
|
570
|
+
setInteractionStartPoint({
|
571
|
+
x: e.targetTouches.item(0).clientX,
|
572
|
+
y: e.targetTouches.item(0).clientY
|
573
|
+
});
|
506
574
|
// see onMouseDown for more details
|
507
575
|
setShouldHandleOnMouseDownDuringSelect(true);
|
508
576
|
},
|
509
577
|
/* @conditional-compile-remove(mention) */
|
578
|
+
onTouchMove: handleOnMove,
|
579
|
+
/* @conditional-compile-remove(mention) */
|
580
|
+
onTouchEnd: () => {
|
581
|
+
setInteractionStartPoint(undefined);
|
582
|
+
},
|
583
|
+
/* @conditional-compile-remove(mention) */
|
510
584
|
onBlur: () => {
|
511
585
|
// setup all flags to default values when text field loses focus
|
512
586
|
setShouldHandleOnMouseDownDuringSelect(false);
|
@@ -592,6 +666,31 @@ const findMentionTagForSelection = (tags, selection) => {
|
|
592
666
|
return mentionTag;
|
593
667
|
};
|
594
668
|
/* @conditional-compile-remove(mention) */
|
669
|
+
const rangeOfWordInSelection = ({ textInput, selectionStart, selectionEnd, tag }) => {
|
670
|
+
var _a;
|
671
|
+
if (tag.plainTextBeginIndex === undefined) {
|
672
|
+
return { start: selectionStart, end: selectionEnd === null ? selectionStart : selectionEnd };
|
673
|
+
}
|
674
|
+
// Look at start word index and optionally end word index.
|
675
|
+
// Select combination of the two and return the range.
|
676
|
+
let start = selectionStart;
|
677
|
+
let end = selectionEnd === null ? selectionStart : selectionEnd;
|
678
|
+
const firstWordStartIndex = textInput.lastIndexOf(' ', selectionStart);
|
679
|
+
if (firstWordStartIndex === tag.plainTextBeginIndex) {
|
680
|
+
start = firstWordStartIndex;
|
681
|
+
}
|
682
|
+
else {
|
683
|
+
start = Math.max(firstWordStartIndex + 1, tag.plainTextBeginIndex);
|
684
|
+
}
|
685
|
+
const firstWordEndIndex = textInput.indexOf(' ', selectionStart);
|
686
|
+
end = Math.max(firstWordEndIndex + 1, (_a = tag.plainTextEndIndex) !== null && _a !== void 0 ? _a : firstWordEndIndex + 1);
|
687
|
+
if (selectionEnd !== null && tag.plainTextEndIndex !== undefined) {
|
688
|
+
const lastWordEndIndex = textInput.indexOf(' ', selectionEnd);
|
689
|
+
end = Math.max(lastWordEndIndex > -1 ? lastWordEndIndex : tag.plainTextEndIndex, selectionEnd);
|
690
|
+
}
|
691
|
+
return { start, end };
|
692
|
+
};
|
693
|
+
/* @conditional-compile-remove(mention) */
|
595
694
|
/**
|
596
695
|
* Find a new the selection index.
|
597
696
|
*
|