botframework-webchat-component 4.13.0 → 4.15.0
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/.eslintrc.yml +4 -100
- package/.prettierrc.yml +1 -1
- package/lib/Activity/Avatar.d.ts +10 -0
- package/lib/Activity/Avatar.d.ts.map +1 -0
- package/lib/Activity/Avatar.js +2 -1
- package/lib/Activity/Bubble.d.ts +11 -0
- package/lib/Activity/Bubble.d.ts.map +1 -0
- package/lib/Activity/Bubble.js +2 -2
- package/lib/Activity/CarouselFilmStrip.js +21 -31
- package/lib/Activity/CarouselFilmStripAttachment.js +120 -0
- package/lib/Activity/CarouselLayout.js +5 -5
- package/lib/Activity/Speak.d.ts +10 -0
- package/lib/Activity/Speak.d.ts.map +1 -0
- package/lib/Activity/Speak.js +11 -13
- package/lib/Activity/StackedLayout.d.ts +18 -0
- package/lib/Activity/StackedLayout.d.ts.map +1 -0
- package/lib/Activity/StackedLayout.js +19 -15
- package/lib/Assets/TypingAnimation.js +2 -2
- package/lib/Attachment/Assets/DownloadIcon.js +3 -1
- package/lib/Attachment/AudioAttachment.js +2 -2
- package/lib/Attachment/AudioContent.d.ts +11 -0
- package/lib/Attachment/AudioContent.d.ts.map +1 -0
- package/lib/Attachment/AudioContent.js +4 -4
- package/lib/Attachment/FileAttachment.js +2 -2
- package/lib/Attachment/FileContent.d.ts +10 -0
- package/lib/Attachment/FileContent.d.ts.map +1 -0
- package/lib/Attachment/FileContent.js +14 -9
- package/lib/Attachment/HTMLVideoContent.d.ts +11 -0
- package/lib/Attachment/HTMLVideoContent.d.ts.map +1 -0
- package/lib/Attachment/HTMLVideoContent.js +2 -2
- package/lib/Attachment/ImageContent.d.ts +8 -0
- package/lib/Attachment/ImageContent.d.ts.map +1 -0
- package/lib/Attachment/ImageContent.js +2 -2
- package/lib/Attachment/TextContent.d.ts +8 -0
- package/lib/Attachment/TextContent.d.ts.map +1 -0
- package/lib/Attachment/TextContent.js +4 -4
- package/lib/Attachment/VideoAttachment.js +2 -2
- package/lib/Attachment/VideoContent.d.ts +11 -0
- package/lib/Attachment/VideoContent.d.ts.map +1 -0
- package/lib/Attachment/VideoContent.js +1 -1
- package/lib/Attachment/VimeoContent.d.ts +10 -0
- package/lib/Attachment/VimeoContent.d.ts.map +1 -0
- package/lib/Attachment/VimeoContent.js +8 -8
- package/lib/Attachment/YouTubeContent.d.ts +10 -0
- package/lib/Attachment/YouTubeContent.d.ts.map +1 -0
- package/lib/Attachment/YouTubeContent.js +5 -5
- package/lib/Avatar/ImageAvatar.js +2 -2
- package/lib/Avatar/InitialsAvatar.js +2 -2
- package/lib/BasicConnectivityStatus.js +2 -2
- package/lib/BasicSendBox.d.ts +9 -0
- package/lib/BasicSendBox.d.ts.map +1 -0
- package/lib/BasicSendBox.js +7 -6
- package/lib/BasicToast.js +4 -4
- package/lib/BasicToaster.js +8 -5
- package/lib/BasicTranscript.d.ts +7 -0
- package/lib/BasicTranscript.d.ts.map +1 -0
- package/lib/BasicTranscript.js +406 -743
- package/lib/BasicTypingIndicator.d.ts +6 -0
- package/lib/BasicTypingIndicator.d.ts.map +1 -0
- package/lib/BasicTypingIndicator.js +13 -5
- package/lib/BasicWebChat.d.ts +9 -0
- package/lib/BasicWebChat.d.ts.map +1 -0
- package/lib/BasicWebChat.js +6 -4
- package/lib/Composer.d.ts +23 -0
- package/lib/Composer.d.ts.map +1 -0
- package/lib/Composer.js +65 -82
- package/lib/ConnectivityStatus/Assets/ErrorNotificationIcon.js +2 -2
- package/lib/ConnectivityStatus/Assets/SpinnerAnimation.js +2 -2
- package/lib/ConnectivityStatus/Assets/WarningNotificationIcon.js +2 -2
- package/lib/ConnectivityStatus/Connected.js +1 -1
- package/lib/ConnectivityStatus/Connecting.js +4 -4
- package/lib/ConnectivityStatus/FailedToConnect.js +2 -2
- package/lib/ConnectivityStatus/JavaScriptError.js +2 -2
- package/lib/Dictation.js +13 -4
- package/lib/ErrorBox.d.ts +8 -0
- package/lib/ErrorBox.d.ts.map +1 -0
- package/lib/ErrorBox.js +2 -2
- package/lib/Middleware/Activity/createCoreMiddleware.d.ts +3 -0
- package/lib/Middleware/Activity/createCoreMiddleware.d.ts.map +1 -0
- package/lib/Middleware/Activity/createCoreMiddleware.js +1 -1
- package/lib/Middleware/ActivityStatus/AbsoluteTime.js +1 -1
- package/lib/Middleware/ActivityStatus/RelativeTime.js +1 -1
- package/lib/Middleware/ActivityStatus/SendStatus/SendFailedRetry.js +3 -3
- package/lib/Middleware/ActivityStatus/SendStatus/SendStatus.d.ts +11 -0
- package/lib/Middleware/ActivityStatus/SendStatus/SendStatus.d.ts.map +1 -0
- package/lib/Middleware/ActivityStatus/SendStatus/SendStatus.js +5 -5
- package/lib/Middleware/ActivityStatus/Timestamp.d.ts +9 -0
- package/lib/Middleware/ActivityStatus/Timestamp.d.ts.map +1 -0
- package/lib/Middleware/ActivityStatus/Timestamp.js +2 -2
- package/lib/Middleware/ActivityStatus/createCoreMiddleware.d.ts +3 -0
- package/lib/Middleware/ActivityStatus/createCoreMiddleware.d.ts.map +1 -0
- package/lib/Middleware/ActivityStatus/createCoreMiddleware.js +1 -1
- package/lib/Middleware/ActivityStatus/createSendStatusMiddleware.js +21 -16
- package/lib/Middleware/ActivityStatus/createTimestampMiddleware.js +1 -1
- package/lib/Middleware/Attachment/createCoreMiddleware.d.ts +3 -0
- package/lib/Middleware/Attachment/createCoreMiddleware.d.ts.map +1 -0
- package/lib/Middleware/Attachment/createCoreMiddleware.js +10 -13
- package/lib/Middleware/AttachmentForScreenReader/AudioAttachment.js +1 -1
- package/lib/Middleware/AttachmentForScreenReader/FileAttachment.js +1 -1
- package/lib/Middleware/AttachmentForScreenReader/ImageAttachment.js +1 -1
- package/lib/Middleware/AttachmentForScreenReader/TextAttachment.js +1 -1
- package/lib/Middleware/AttachmentForScreenReader/VideoAttachment.js +1 -1
- package/lib/Middleware/AttachmentForScreenReader/createCoreMiddleware.d.ts +3 -0
- package/lib/Middleware/AttachmentForScreenReader/createCoreMiddleware.d.ts.map +1 -0
- package/lib/Middleware/AttachmentForScreenReader/createCoreMiddleware.js +9 -5
- package/lib/Middleware/Avatar/createCoreMiddleware.d.ts +11 -0
- package/lib/Middleware/Avatar/createCoreMiddleware.d.ts.map +1 -0
- package/lib/Middleware/Avatar/createCoreMiddleware.js +3 -4
- package/lib/Middleware/CardAction/createCoreMiddleware.js +11 -4
- package/lib/Middleware/GroupActivities/createCoreMiddleware.js +1 -1
- package/lib/Middleware/ScrollToEndButton/ScrollToEndButton.js +71 -0
- package/lib/Middleware/ScrollToEndButton/createScrollToEndButtonMiddleware.d.ts +3 -0
- package/lib/Middleware/ScrollToEndButton/createScrollToEndButtonMiddleware.d.ts.map +1 -0
- package/lib/Middleware/ScrollToEndButton/createScrollToEndButtonMiddleware.js +27 -0
- package/lib/Middleware/Toast/createCoreMiddleware.d.ts +4 -0
- package/lib/Middleware/Toast/createCoreMiddleware.d.ts.map +1 -0
- package/lib/Middleware/Toast/createCoreMiddleware.js +1 -1
- package/lib/Middleware/TypingIndicator/createCoreMiddleware.d.ts +3 -0
- package/lib/Middleware/TypingIndicator/createCoreMiddleware.d.ts.map +1 -0
- package/lib/Middleware/TypingIndicator/createCoreMiddleware.js +9 -6
- package/lib/ReactWebChat.d.ts +10 -0
- package/lib/ReactWebChat.d.ts.map +1 -0
- package/lib/ReactWebChat.js +19 -7
- package/lib/ScreenReaderActivity.js +76 -48
- package/lib/ScreenReaderText.d.ts +9 -0
- package/lib/ScreenReaderText.d.ts.map +1 -0
- package/lib/ScreenReaderText.js +22 -8
- package/lib/SendBox/Assets/AttachmentIcon.js +3 -1
- package/lib/SendBox/Assets/MicrophoneIcon.js +3 -1
- package/lib/SendBox/Assets/SendIcon.js +2 -2
- package/lib/SendBox/AutoResizeTextArea.d.ts +23 -0
- package/lib/SendBox/AutoResizeTextArea.d.ts.map +1 -0
- package/lib/SendBox/AutoResizeTextArea.js +6 -6
- package/lib/SendBox/DictationInterims.d.ts +9 -0
- package/lib/SendBox/DictationInterims.d.ts.map +1 -0
- package/lib/SendBox/DictationInterims.js +3 -3
- package/lib/SendBox/IconButton.d.ts +11 -0
- package/lib/SendBox/IconButton.d.ts.map +1 -0
- package/lib/SendBox/IconButton.js +27 -7
- package/lib/SendBox/MicrophoneButton.d.ts +11 -0
- package/lib/SendBox/MicrophoneButton.d.ts.map +1 -0
- package/lib/SendBox/MicrophoneButton.js +25 -24
- package/lib/SendBox/SendButton.d.ts +9 -0
- package/lib/SendBox/SendButton.d.ts.map +1 -0
- package/lib/SendBox/SendButton.js +8 -6
- package/lib/SendBox/SuggestedAction.d.ts +17 -0
- package/lib/SendBox/SuggestedAction.d.ts.map +1 -0
- package/lib/SendBox/SuggestedAction.js +29 -24
- package/lib/SendBox/SuggestedActions.d.ts +5 -0
- package/lib/SendBox/SuggestedActions.d.ts.map +1 -0
- package/lib/SendBox/SuggestedActions.js +33 -13
- package/lib/SendBox/TextBox.d.ts +28 -0
- package/lib/SendBox/TextBox.d.ts.map +1 -0
- package/lib/SendBox/TextBox.js +13 -8
- package/lib/SendBox/UploadButton.d.ts +9 -0
- package/lib/SendBox/UploadButton.d.ts.map +1 -0
- package/lib/SendBox/UploadButton.js +6 -6
- package/lib/Styles/StyleSet/Activities.d.ts +5 -0
- package/lib/Styles/StyleSet/Activities.d.ts.map +1 -0
- package/lib/Styles/StyleSet/AudioAttachment.d.ts +6 -0
- package/lib/Styles/StyleSet/AudioAttachment.d.ts.map +1 -0
- package/lib/Styles/StyleSet/AudioContent.d.ts +4 -0
- package/lib/Styles/StyleSet/AudioContent.d.ts.map +1 -0
- package/lib/Styles/StyleSet/AutoResizeTextArea.d.ts +37 -0
- package/lib/Styles/StyleSet/AutoResizeTextArea.d.ts.map +1 -0
- package/lib/Styles/StyleSet/Avatar.d.ts +9 -0
- package/lib/Styles/StyleSet/Avatar.d.ts.map +1 -0
- package/lib/Styles/StyleSet/BasicTranscript.d.ts +85 -0
- package/lib/Styles/StyleSet/BasicTranscript.d.ts.map +1 -0
- package/lib/Styles/StyleSet/BasicTranscript.js +21 -9
- package/lib/Styles/StyleSet/Bubble.d.ts +5 -0
- package/lib/Styles/StyleSet/Bubble.d.ts.map +1 -0
- package/lib/Styles/StyleSet/Bubble.js +2 -2
- package/lib/Styles/StyleSet/CarouselFilmStrip.d.ts +5 -0
- package/lib/Styles/StyleSet/CarouselFilmStrip.d.ts.map +1 -0
- package/lib/Styles/StyleSet/CarouselFilmStrip.js +2 -18
- package/lib/Styles/StyleSet/CarouselFilmStripAttachment.d.ts +3 -0
- package/lib/Styles/StyleSet/CarouselFilmStripAttachment.d.ts.map +1 -0
- package/lib/Styles/StyleSet/CarouselFilmStripAttachment.js +63 -0
- package/lib/Styles/StyleSet/CarouselFlipper.d.ts +27 -0
- package/lib/Styles/StyleSet/CarouselFlipper.d.ts.map +1 -0
- package/lib/Styles/StyleSet/ConnectivityNotification.d.ts +13 -0
- package/lib/Styles/StyleSet/ConnectivityNotification.d.ts.map +1 -0
- package/lib/Styles/StyleSet/DictationInterims.d.ts +13 -0
- package/lib/Styles/StyleSet/DictationInterims.d.ts.map +1 -0
- package/lib/Styles/StyleSet/ErrorBox.d.ts +33 -0
- package/lib/Styles/StyleSet/ErrorBox.d.ts.map +1 -0
- package/lib/Styles/StyleSet/ErrorNotification.d.ts +23 -0
- package/lib/Styles/StyleSet/ErrorNotification.d.ts.map +1 -0
- package/lib/Styles/StyleSet/FileContent.d.ts +32 -0
- package/lib/Styles/StyleSet/FileContent.d.ts.map +1 -0
- package/lib/Styles/StyleSet/ImageAvatar.d.ts +7 -0
- package/lib/Styles/StyleSet/ImageAvatar.d.ts.map +1 -0
- package/lib/Styles/StyleSet/InitialsAvatar.d.ts +19 -0
- package/lib/Styles/StyleSet/InitialsAvatar.d.ts.map +1 -0
- package/lib/Styles/StyleSet/KeyboardHelp.d.ts +123 -0
- package/lib/Styles/StyleSet/KeyboardHelp.d.ts.map +1 -0
- package/lib/Styles/StyleSet/KeyboardHelp.js +145 -0
- package/lib/Styles/StyleSet/MicrophoneButton.d.ts +13 -0
- package/lib/Styles/StyleSet/MicrophoneButton.d.ts.map +1 -0
- package/lib/Styles/StyleSet/Root.d.ts +8 -0
- package/lib/Styles/StyleSet/Root.d.ts.map +1 -0
- package/lib/Styles/StyleSet/ScrollToEndButton.d.ts +36 -0
- package/lib/Styles/StyleSet/ScrollToEndButton.d.ts.map +1 -0
- package/lib/Styles/StyleSet/ScrollToEndButton.js +36 -34
- package/lib/Styles/StyleSet/SendBox.d.ts +24 -0
- package/lib/Styles/StyleSet/SendBox.d.ts.map +1 -0
- package/lib/Styles/StyleSet/SendBoxButton.d.ts +79 -0
- package/lib/Styles/StyleSet/SendBoxButton.d.ts.map +1 -0
- package/lib/Styles/StyleSet/SendBoxButton.js +76 -12
- package/lib/Styles/StyleSet/SendBoxTextBox.d.ts +41 -0
- package/lib/Styles/StyleSet/SendBoxTextBox.d.ts.map +1 -0
- package/lib/Styles/StyleSet/SendBoxTextBox.js +3 -3
- package/lib/Styles/StyleSet/SendStatus.d.ts +8 -0
- package/lib/Styles/StyleSet/SendStatus.d.ts.map +1 -0
- package/lib/Styles/StyleSet/SingleAttachmentActivity.d.ts +11 -0
- package/lib/Styles/StyleSet/SingleAttachmentActivity.d.ts.map +1 -0
- package/lib/Styles/StyleSet/SpinnerAnimation.d.ts +15 -0
- package/lib/Styles/StyleSet/SpinnerAnimation.d.ts.map +1 -0
- package/lib/Styles/StyleSet/StackedLayout.d.ts +63 -0
- package/lib/Styles/StyleSet/StackedLayout.d.ts.map +1 -0
- package/lib/Styles/StyleSet/StackedLayout.js +1 -1
- package/lib/Styles/StyleSet/SuggestedAction.d.ts +94 -0
- package/lib/Styles/StyleSet/SuggestedAction.d.ts.map +1 -0
- package/lib/Styles/StyleSet/SuggestedAction.js +116 -41
- package/lib/Styles/StyleSet/SuggestedActions.d.ts +125 -0
- package/lib/Styles/StyleSet/SuggestedActions.d.ts.map +1 -0
- package/lib/Styles/StyleSet/SuggestedActions.js +13 -6
- package/lib/Styles/StyleSet/TextContent.d.ts +28 -0
- package/lib/Styles/StyleSet/TextContent.d.ts.map +1 -0
- package/lib/Styles/StyleSet/Toast.d.ts +65 -0
- package/lib/Styles/StyleSet/Toast.d.ts.map +1 -0
- package/lib/Styles/StyleSet/Toaster.d.ts +111 -0
- package/lib/Styles/StyleSet/Toaster.d.ts.map +1 -0
- package/lib/Styles/StyleSet/TypingAnimation.d.ts +8 -0
- package/lib/Styles/StyleSet/TypingAnimation.d.ts.map +1 -0
- package/lib/Styles/StyleSet/TypingIndicator.d.ts +11 -0
- package/lib/Styles/StyleSet/TypingIndicator.d.ts.map +1 -0
- package/lib/Styles/StyleSet/UploadButton.d.ts +14 -0
- package/lib/Styles/StyleSet/UploadButton.d.ts.map +1 -0
- package/lib/Styles/StyleSet/VideoAttachment.d.ts +2 -0
- package/lib/Styles/StyleSet/VideoAttachment.d.ts.map +1 -0
- package/lib/Styles/StyleSet/VideoContent.d.ts +6 -0
- package/lib/Styles/StyleSet/VideoContent.d.ts.map +1 -0
- package/lib/Styles/StyleSet/VimeoContent.d.ts +7 -0
- package/lib/Styles/StyleSet/VimeoContent.d.ts.map +1 -0
- package/lib/Styles/StyleSet/WarningNotification.d.ts +22 -0
- package/lib/Styles/StyleSet/WarningNotification.d.ts.map +1 -0
- package/lib/Styles/StyleSet/YouTubeContent.d.ts +7 -0
- package/lib/Styles/StyleSet/YouTubeContent.d.ts.map +1 -0
- package/lib/Styles/createStyleSet.d.ts +1372 -0
- package/lib/Styles/createStyleSet.d.ts.map +1 -0
- package/lib/Styles/createStyleSet.js +47 -41
- package/lib/Styles/mirrorStyle.js +13 -4
- package/lib/Toast/CollapseIcon.js +3 -1
- package/lib/Toast/DismissIcon.js +3 -1
- package/lib/Toast/ExpandIcon.js +3 -1
- package/lib/Toast/NotificationIcon.js +7 -3
- package/lib/Toast/createToastMiddleware.d.ts +4 -0
- package/lib/Toast/createToastMiddleware.d.ts.map +1 -0
- package/lib/Toast/createToastMiddleware.js +2 -2
- package/lib/Transcript/ActivityRow.d.ts +9 -0
- package/lib/Transcript/ActivityRow.d.ts.map +1 -0
- package/lib/Transcript/ActivityRow.js +157 -0
- package/lib/Transcript/ActivityTextAlt.js +57 -0
- package/lib/Transcript/FocusTrap.d.ts +8 -0
- package/lib/Transcript/FocusTrap.d.ts.map +1 -0
- package/lib/Transcript/FocusTrap.js +74 -0
- package/lib/Transcript/KeyboardHelp.d.ts +4 -0
- package/lib/Transcript/KeyboardHelp.d.ts.map +1 -0
- package/lib/Transcript/KeyboardHelp.js +550 -0
- package/lib/Transcript/LiveRegionTranscript.d.ts +8 -0
- package/lib/Transcript/LiveRegionTranscript.d.ts.map +1 -0
- package/lib/Transcript/LiveRegionTranscript.js +214 -0
- package/lib/Transcript/types.d.ts +2 -0
- package/lib/Transcript/types.d.ts.map +1 -0
- package/lib/Transcript/types.js +2 -0
- package/lib/Transcript/useActivityAccessibleName.d.ts +4 -0
- package/lib/Transcript/useActivityAccessibleName.d.ts.map +1 -0
- package/lib/Transcript/useActivityAccessibleName.js +97 -0
- package/lib/Utils/AccessKeySink/Surface.js +7 -5
- package/lib/Utils/AccessibleButton.d.ts +11 -0
- package/lib/Utils/AccessibleButton.d.ts.map +1 -0
- package/lib/Utils/AccessibleButton.js +15 -8
- package/lib/Utils/AccessibleInputText.d.ts +21 -0
- package/lib/Utils/AccessibleInputText.d.ts.map +1 -0
- package/lib/Utils/AccessibleInputText.js +29 -25
- package/lib/Utils/AccessibleTextArea.d.ts +20 -0
- package/lib/Utils/AccessibleTextArea.d.ts.map +1 -0
- package/lib/Utils/AccessibleTextArea.js +35 -24
- package/lib/Utils/CroppedImage.js +2 -2
- package/lib/Utils/Fade.js +2 -2
- package/lib/Utils/FocusRedirector.d.ts +9 -0
- package/lib/Utils/FocusRedirector.d.ts.map +1 -0
- package/lib/Utils/FocusRedirector.js +18 -15
- package/lib/Utils/InlineMarkdown.js +17 -10
- package/lib/Utils/TypeFocusSink/FocusBox.js +6 -4
- package/lib/Utils/TypeFocusSink/getTabIndex.d.ts +2 -0
- package/lib/Utils/TypeFocusSink/getTabIndex.d.ts.map +1 -0
- package/lib/Utils/TypeFocusSink/getTabIndex.js +1 -1
- package/lib/Utils/TypeFocusSink/inputtableKey.d.ts +2 -0
- package/lib/Utils/TypeFocusSink/inputtableKey.d.ts.map +1 -0
- package/lib/Utils/TypeFocusSink/inputtableKey.js +5 -2
- package/lib/Utils/TypeFocusSink/navigableEvent.js +1 -1
- package/lib/Utils/activityAltText.d.ts +8 -0
- package/lib/Utils/activityAltText.d.ts.map +1 -0
- package/lib/Utils/activityAltText.js +100 -0
- package/lib/Utils/addTargetBlankToHyperlinksMarkdown.js +1 -1
- package/lib/Utils/createCustomEvent.js +9 -3
- package/lib/Utils/debounce.js +1 -1
- package/lib/Utils/detectBrowser.js +4 -2
- package/lib/Utils/downscaleImageToDataURL/downscaleImageToDataURLUsingWorker.js +3 -3
- package/lib/Utils/downscaleImageToDataURL/index.js +2 -2
- package/lib/Utils/filterMap.js +1 -1
- package/lib/Utils/findAncestor.js +17 -0
- package/lib/Utils/getActivityUniqueId.js +4 -2
- package/lib/Utils/intersectionOf.d.ts +5 -0
- package/lib/Utils/intersectionOf.d.ts.map +1 -0
- package/lib/Utils/intersectionOf.js +17 -2
- package/lib/Utils/isZeroOrPositive.d.ts +5 -0
- package/lib/Utils/isZeroOrPositive.d.ts.map +1 -0
- package/lib/Utils/isZeroOrPositive.js +4 -1
- package/lib/Utils/mapMap.js +10 -3
- package/lib/Utils/readDataURIToBlob.js +3 -3
- package/lib/Utils/scrollIntoViewWithBlockNearest.d.ts +7 -0
- package/lib/Utils/scrollIntoViewWithBlockNearest.d.ts.map +1 -0
- package/lib/Utils/scrollIntoViewWithBlockNearest.js +48 -0
- package/lib/Utils/shallowEquals.js +7 -3
- package/lib/Utils/singleToArray.js +1 -1
- package/lib/Utils/supportPseudoClass.d.ts +2 -0
- package/lib/Utils/supportPseudoClass.d.ts.map +1 -0
- package/lib/Utils/supportPseudoClass.js +23 -0
- package/lib/Utils/tabbableElements.d.ts +2 -0
- package/lib/Utils/tabbableElements.d.ts.map +1 -0
- package/lib/Utils/tabbableElements.js +2 -2
- package/lib/connectToWebChat.js +17 -7
- package/lib/hooks/index.d.ts +21 -0
- package/lib/hooks/index.d.ts.map +1 -0
- package/lib/hooks/index.js +25 -25
- package/lib/hooks/internal/BypassSpeechSynthesisPonyfill.js +100 -41
- package/lib/hooks/internal/UITracker.js +2 -2
- package/lib/hooks/internal/useChanged.js +8 -1
- package/lib/hooks/internal/useDispatchScrollPosition.js +3 -7
- package/lib/hooks/internal/useDispatchTranscriptFocusByActivityKey.d.ts +2 -0
- package/lib/hooks/internal/useDispatchTranscriptFocusByActivityKey.d.ts.map +1 -0
- package/lib/hooks/internal/useDispatchTranscriptFocusByActivityKey.js +15 -0
- package/lib/hooks/internal/useEnterKeyHint.js +1 -1
- package/lib/hooks/internal/useFocusVisible.d.ts +3 -0
- package/lib/hooks/internal/useFocusVisible.d.ts.map +1 -0
- package/lib/hooks/internal/useFocusVisible.js +48 -0
- package/lib/hooks/internal/useForceRender.js +2 -2
- package/lib/hooks/internal/useForceRenderAtInterval.js +2 -2
- package/lib/hooks/internal/useInternalRenderMarkdownInline.js +1 -1
- package/lib/hooks/internal/useLocalizeAccessKey.js +2 -2
- package/lib/hooks/internal/useMemoWithPrevious.d.ts +3 -0
- package/lib/hooks/internal/useMemoWithPrevious.d.ts.map +1 -0
- package/lib/hooks/internal/useMemoWithPrevious.js +22 -0
- package/lib/hooks/internal/useMemoize.d.ts +14 -0
- package/lib/hooks/internal/useMemoize.d.ts.map +1 -0
- package/lib/hooks/internal/useMemoize.js +12 -3
- package/lib/hooks/internal/useNavigatorPlatform.js +1 -1
- package/lib/hooks/internal/useNonce.js +1 -1
- package/lib/hooks/internal/useObserveFocusVisible.d.ts +3 -0
- package/lib/hooks/internal/useObserveFocusVisible.d.ts.map +1 -0
- package/lib/hooks/internal/useObserveFocusVisible.js +208 -0
- package/lib/hooks/internal/usePrevious.d.ts +2 -0
- package/lib/hooks/internal/usePrevious.d.ts.map +1 -0
- package/lib/hooks/internal/usePrevious.js +18 -0
- package/lib/hooks/internal/useRegisterFocusSendBox.js +1 -1
- package/lib/hooks/internal/useRegisterFocusTranscript.js +1 -1
- package/lib/hooks/internal/useRegisterScrollRelative.js +1 -1
- package/lib/hooks/internal/useRegisterScrollTo.js +1 -1
- package/lib/hooks/internal/useRegisterScrollToEnd.js +1 -1
- package/lib/hooks/internal/useReplaceEmoticon.js +2 -2
- package/lib/hooks/internal/useResumeAudioContext.js +33 -0
- package/lib/hooks/internal/useScrollRelative.js +1 -1
- package/lib/hooks/internal/useSettableDictateAbortable.js +1 -1
- package/lib/hooks/internal/useStateRef.d.ts +3 -0
- package/lib/hooks/internal/useStateRef.d.ts.map +1 -0
- package/lib/hooks/internal/useStateRef.js +40 -0
- package/lib/hooks/internal/useSuggestedActionsAccessKey.js +1 -1
- package/lib/hooks/internal/useUniqueId.d.ts +2 -0
- package/lib/hooks/internal/useUniqueId.d.ts.map +1 -0
- package/lib/hooks/internal/useUniqueId.js +1 -1
- package/lib/hooks/internal/useValueRef.d.ts +3 -0
- package/lib/hooks/internal/useValueRef.d.ts.map +1 -0
- package/lib/hooks/internal/useValueRef.js +25 -0
- package/lib/hooks/useDictateAbortable.d.ts +2 -0
- package/lib/hooks/useDictateAbortable.d.ts.map +1 -0
- package/lib/hooks/useDictateAbortable.js +2 -2
- package/lib/hooks/useFocus.d.ts +2 -0
- package/lib/hooks/useFocus.d.ts.map +1 -0
- package/lib/hooks/useFocus.js +1 -1
- package/lib/hooks/useFocusSendBox.d.ts +3 -0
- package/lib/hooks/useFocusSendBox.d.ts.map +1 -0
- package/lib/hooks/useFocusSendBox.js +2 -1
- package/lib/hooks/useObserveScrollPosition.d.ts +3 -0
- package/lib/hooks/useObserveScrollPosition.d.ts.map +1 -0
- package/lib/hooks/useObserveScrollPosition.js +2 -2
- package/lib/hooks/useObserveTranscriptFocus.d.ts +5 -0
- package/lib/hooks/useObserveTranscriptFocus.d.ts.map +1 -0
- package/lib/hooks/useObserveTranscriptFocus.js +2 -2
- package/lib/hooks/useRenderMarkdownAsHTML.d.ts +5 -0
- package/lib/hooks/useRenderMarkdownAsHTML.d.ts.map +1 -0
- package/lib/hooks/useRenderMarkdownAsHTML.js +2 -2
- package/lib/hooks/useScrollDown.d.ts +4 -0
- package/lib/hooks/useScrollDown.d.ts.map +1 -0
- package/lib/hooks/useScrollDown.js +1 -1
- package/lib/hooks/useScrollTo.d.ts +5 -0
- package/lib/hooks/useScrollTo.d.ts.map +1 -0
- package/lib/hooks/useScrollTo.js +1 -1
- package/lib/hooks/useScrollToEnd.d.ts +2 -0
- package/lib/hooks/useScrollToEnd.d.ts.map +1 -0
- package/lib/hooks/useScrollToEnd.js +1 -1
- package/lib/hooks/useScrollUp.d.ts +4 -0
- package/lib/hooks/useScrollUp.d.ts.map +1 -0
- package/lib/hooks/useScrollUp.js +1 -1
- package/lib/hooks/useSendFiles.d.ts +2 -0
- package/lib/hooks/useSendFiles.d.ts.map +1 -0
- package/lib/hooks/useSendFiles.js +3 -3
- package/lib/hooks/useStyleSet.d.ts +2 -0
- package/lib/hooks/useStyleSet.d.ts.map +1 -0
- package/lib/hooks/useStyleSet.js +1 -1
- package/lib/hooks/useWebSpeechPonyfill.d.ts +3 -0
- package/lib/hooks/useWebSpeechPonyfill.d.ts.map +1 -0
- package/lib/hooks/useWebSpeechPonyfill.js +1 -1
- package/lib/index.d.ts +219 -22
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +22 -20
- package/lib/providers/ActivityTree/ActivityTreeComposer.d.ts +5 -0
- package/lib/providers/ActivityTree/ActivityTreeComposer.d.ts.map +1 -0
- package/lib/providers/ActivityTree/ActivityTreeComposer.js +86 -0
- package/lib/providers/ActivityTree/private/Context.d.ts +9 -0
- package/lib/providers/ActivityTree/private/Context.d.ts.map +1 -0
- package/lib/providers/ActivityTree/private/Context.js +13 -0
- package/lib/providers/ActivityTree/private/types.d.ts +10 -0
- package/lib/providers/ActivityTree/private/types.d.ts.map +1 -0
- package/lib/providers/ActivityTree/private/types.js +2 -0
- package/lib/providers/ActivityTree/private/useActivitiesWithRenderer.d.ts +4 -0
- package/lib/providers/ActivityTree/private/useActivitiesWithRenderer.d.ts.map +1 -0
- package/lib/providers/ActivityTree/private/useActivitiesWithRenderer.js +58 -0
- package/lib/providers/ActivityTree/private/useActivityTreeWithRenderer.d.ts +5 -0
- package/lib/providers/ActivityTree/private/useActivityTreeWithRenderer.d.ts.map +1 -0
- package/lib/providers/ActivityTree/private/useActivityTreeWithRenderer.js +166 -0
- package/lib/providers/ActivityTree/private/useContext.d.ts +3 -0
- package/lib/providers/ActivityTree/private/useContext.d.ts.map +1 -0
- package/lib/providers/ActivityTree/private/useContext.js +24 -0
- package/lib/providers/ActivityTree/useActivityTreeWithRenderer.d.ts +8 -0
- package/lib/providers/ActivityTree/useActivityTreeWithRenderer.d.ts.map +1 -0
- package/lib/providers/ActivityTree/useActivityTreeWithRenderer.js +17 -0
- package/lib/providers/LiveRegionTwin/LiveRegionTwinComposer.d.ts +35 -0
- package/lib/providers/LiveRegionTwin/LiveRegionTwinComposer.d.ts.map +1 -0
- package/lib/providers/LiveRegionTwin/LiveRegionTwinComposer.js +156 -0
- package/lib/providers/LiveRegionTwin/private/Context.d.ts +10 -0
- package/lib/providers/LiveRegionTwin/private/Context.d.ts.map +1 -0
- package/lib/providers/LiveRegionTwin/private/Context.js +13 -0
- package/lib/providers/LiveRegionTwin/private/LiveRegionTwinContainer.d.ts +11 -0
- package/lib/providers/LiveRegionTwin/private/LiveRegionTwinContainer.d.ts.map +1 -0
- package/lib/providers/LiveRegionTwin/private/LiveRegionTwinContainer.js +86 -0
- package/lib/providers/LiveRegionTwin/private/types.d.ts +8 -0
- package/lib/providers/LiveRegionTwin/private/types.d.ts.map +1 -0
- package/lib/providers/LiveRegionTwin/private/types.js +2 -0
- package/lib/providers/LiveRegionTwin/private/useContext.d.ts +3 -0
- package/lib/providers/LiveRegionTwin/private/useContext.d.ts.map +1 -0
- package/lib/providers/LiveRegionTwin/private/useContext.js +24 -0
- package/lib/providers/LiveRegionTwin/private/useMarkAllAsRenderedEffect.d.ts +2 -0
- package/lib/providers/LiveRegionTwin/private/useMarkAllAsRenderedEffect.d.ts.map +1 -0
- package/lib/providers/LiveRegionTwin/private/useMarkAllAsRenderedEffect.js +24 -0
- package/lib/providers/LiveRegionTwin/private/useStaticElementEntries.d.ts +3 -0
- package/lib/providers/LiveRegionTwin/private/useStaticElementEntries.d.ts.map +1 -0
- package/lib/providers/LiveRegionTwin/private/useStaticElementEntries.js +15 -0
- package/lib/providers/LiveRegionTwin/useQueueStaticElement.d.ts +8 -0
- package/lib/providers/LiveRegionTwin/useQueueStaticElement.d.ts.map +1 -0
- package/lib/providers/LiveRegionTwin/useQueueStaticElement.js +20 -0
- package/lib/providers/TranscriptFocus/TranscriptFocusComposer.d.ts +7 -0
- package/lib/providers/TranscriptFocus/TranscriptFocusComposer.d.ts.map +1 -0
- package/lib/providers/TranscriptFocus/TranscriptFocusComposer.js +184 -0
- package/lib/providers/TranscriptFocus/private/Context.d.ts +12 -0
- package/lib/providers/TranscriptFocus/private/Context.d.ts.map +1 -0
- package/lib/providers/TranscriptFocus/private/Context.js +13 -0
- package/lib/providers/TranscriptFocus/private/useContext.d.ts +2 -0
- package/lib/providers/TranscriptFocus/private/useContext.d.ts.map +1 -0
- package/lib/providers/TranscriptFocus/private/useContext.js +24 -0
- package/lib/providers/TranscriptFocus/useActiveDescendantId.d.ts +2 -0
- package/lib/providers/TranscriptFocus/useActiveDescendantId.d.ts.map +1 -0
- package/lib/providers/TranscriptFocus/useActiveDescendantId.js +15 -0
- package/lib/providers/TranscriptFocus/useFocusByActivityKey.d.ts +8 -0
- package/lib/providers/TranscriptFocus/useFocusByActivityKey.d.ts.map +1 -0
- package/lib/providers/TranscriptFocus/useFocusByActivityKey.js +21 -0
- package/lib/providers/TranscriptFocus/useFocusRelativeActivity.d.ts +2 -0
- package/lib/providers/TranscriptFocus/useFocusRelativeActivity.d.ts.map +1 -0
- package/lib/providers/TranscriptFocus/useFocusRelativeActivity.js +15 -0
- package/lib/providers/TranscriptFocus/useFocusedActivityKey.d.ts +2 -0
- package/lib/providers/TranscriptFocus/useFocusedActivityKey.d.ts.map +1 -0
- package/lib/providers/TranscriptFocus/useFocusedActivityKey.js +15 -0
- package/lib/providers/TranscriptFocus/useFocusedExplicitly.d.ts +2 -0
- package/lib/providers/TranscriptFocus/useFocusedExplicitly.d.ts.map +1 -0
- package/lib/providers/TranscriptFocus/useFocusedExplicitly.js +15 -0
- package/lib/providers/TranscriptFocus/useGetDescendantIdByActivityKey.d.ts +2 -0
- package/lib/providers/TranscriptFocus/useGetDescendantIdByActivityKey.d.ts.map +1 -0
- package/lib/providers/TranscriptFocus/useGetDescendantIdByActivityKey.js +15 -0
- package/lib/tsconfig.json +1 -1
- package/lib/types/ScrollPosition.d.ts +6 -0
- package/lib/types/ScrollPosition.d.ts.map +1 -0
- package/lib/types/ScrollPosition.js +2 -0
- package/package.json +33 -40
- package/src/Activity/{Avatar.js → Avatar.tsx} +9 -2
- package/src/Activity/{Bubble.js → Bubble.tsx} +10 -2
- package/src/Activity/CarouselFilmStrip.js +20 -29
- package/src/Activity/CarouselFilmStripAttachment.js +91 -0
- package/src/Activity/{Speak.js → Speak.tsx} +12 -5
- package/src/Activity/{StackedLayout.js → StackedLayout.tsx} +46 -20
- package/src/Attachment/Assets/DownloadIcon.js +8 -1
- package/src/Attachment/{AudioContent.js → AudioContent.tsx} +12 -3
- package/src/Attachment/FileAttachment.js +1 -1
- package/src/Attachment/{FileContent.js → FileContent.tsx} +22 -7
- package/src/Attachment/{HTMLVideoContent.js → HTMLVideoContent.tsx} +10 -2
- package/src/Attachment/{ImageContent.js → ImageContent.tsx} +7 -2
- package/src/Attachment/{TextContent.js → TextContent.tsx} +14 -7
- package/src/Attachment/{VideoContent.js → VideoContent.tsx} +10 -2
- package/src/Attachment/{VimeoContent.js → VimeoContent.tsx} +15 -8
- package/src/Attachment/{YouTubeContent.js → YouTubeContent.tsx} +12 -5
- package/src/{BasicSendBox.js → BasicSendBox.tsx} +9 -5
- package/src/BasicToaster.js +9 -5
- package/src/BasicTranscript.tsx +878 -0
- package/src/{BasicTypingIndicator.js → BasicTypingIndicator.tsx} +4 -3
- package/src/{BasicWebChat.js → BasicWebChat.tsx} +13 -4
- package/src/{Composer.js → Composer.tsx} +82 -71
- package/src/Dictation.js +13 -4
- package/src/{ErrorBox.js → ErrorBox.tsx} +7 -2
- package/src/Middleware/Activity/createCoreMiddleware.tsx +78 -0
- package/src/Middleware/ActivityStatus/SendStatus/{SendStatus.js → SendStatus.tsx} +8 -3
- package/src/Middleware/ActivityStatus/{Timestamp.js → Timestamp.tsx} +8 -2
- package/src/Middleware/ActivityStatus/{createCoreMiddleware.js → createCoreMiddleware.tsx} +3 -1
- package/src/Middleware/ActivityStatus/createSendStatusMiddleware.js +10 -6
- package/src/Middleware/ActivityStatus/createTimestampMiddleware.js +10 -8
- package/src/Middleware/Attachment/createCoreMiddleware.tsx +44 -0
- package/src/Middleware/AttachmentForScreenReader/createCoreMiddleware.tsx +40 -0
- package/src/Middleware/Avatar/{createCoreMiddleware.js → createCoreMiddleware.tsx} +19 -11
- package/src/Middleware/CardAction/createCoreMiddleware.js +51 -42
- package/src/Middleware/GroupActivities/createCoreMiddleware.js +6 -4
- package/src/Middleware/ScrollToEndButton/ScrollToEndButton.js +45 -0
- package/src/Middleware/ScrollToEndButton/createScrollToEndButtonMiddleware.ts +19 -0
- package/src/Middleware/Toast/createCoreMiddleware.tsx +24 -0
- package/src/Middleware/TypingIndicator/{createCoreMiddleware.js → createCoreMiddleware.tsx} +10 -5
- package/src/{ReactWebChat.js → ReactWebChat.tsx} +25 -7
- package/src/ScreenReaderActivity.js +65 -40
- package/src/{ScreenReaderText.js → ScreenReaderText.tsx} +27 -9
- package/src/SendBox/Assets/AttachmentIcon.js +1 -1
- package/src/SendBox/Assets/MicrophoneIcon.js +1 -1
- package/src/SendBox/{AutoResizeTextArea.js → AutoResizeTextArea.tsx} +30 -4
- package/src/SendBox/{DictationInterims.js → DictationInterims.tsx} +6 -2
- package/src/SendBox/{IconButton.js → IconButton.tsx} +19 -3
- package/src/SendBox/{MicrophoneButton.js → MicrophoneButton.tsx} +35 -25
- package/src/SendBox/{SendButton.js → SendButton.tsx} +8 -3
- package/src/SendBox/{SuggestedAction.js → SuggestedAction.tsx} +62 -39
- package/src/SendBox/{SuggestedActions.js → SuggestedActions.tsx} +70 -22
- package/src/SendBox/{TextBox.js → TextBox.tsx} +21 -7
- package/src/SendBox/{UploadButton.js → UploadButton.tsx} +7 -3
- package/src/Styles/StyleSet/BasicTranscript.ts +34 -20
- package/src/Styles/StyleSet/Bubble.ts +0 -1
- package/src/Styles/StyleSet/CarouselFilmStrip.ts +12 -30
- package/src/Styles/StyleSet/CarouselFilmStripAttachment.ts +57 -0
- package/src/Styles/StyleSet/KeyboardHelp.ts +157 -0
- package/src/Styles/StyleSet/ScrollToEndButton.ts +33 -31
- package/src/Styles/StyleSet/SendBoxButton.ts +84 -13
- package/src/Styles/StyleSet/SendBoxTextBox.ts +1 -2
- package/src/Styles/StyleSet/StackedLayout.ts +13 -11
- package/src/Styles/StyleSet/SuggestedAction.ts +130 -43
- package/src/Styles/StyleSet/SuggestedActions.ts +13 -5
- package/src/Styles/createStyleSet.ts +43 -40
- package/src/Styles/mirrorStyle.js +10 -2
- package/src/Toast/CollapseIcon.js +9 -1
- package/src/Toast/DismissIcon.js +9 -1
- package/src/Toast/ExpandIcon.js +9 -1
- package/src/Toast/NotificationIcon.js +4 -1
- package/src/Toast/createToastMiddleware.tsx +15 -0
- package/src/Transcript/ActivityRow.tsx +124 -0
- package/src/Transcript/ActivityTextAlt.tsx +32 -0
- package/src/Transcript/FocusTrap.tsx +64 -0
- package/src/Transcript/KeyboardHelp.tsx +282 -0
- package/src/Transcript/LiveRegionTranscript.tsx +181 -0
- package/src/Transcript/types.ts +1 -0
- package/src/Transcript/useActivityAccessibleName.ts +85 -0
- package/src/Utils/{AccessibleButton.js → AccessibleButton.tsx} +19 -4
- package/src/Utils/{AccessibleInputText.js → AccessibleInputText.tsx} +48 -5
- package/src/Utils/{AccessibleTextArea.js → AccessibleTextArea.tsx} +67 -6
- package/src/Utils/{FocusRedirector.js → FocusRedirector.tsx} +21 -8
- package/src/Utils/InlineMarkdown.js +18 -2
- package/src/Utils/TypeFocusSink/FocusBox.js +4 -4
- package/src/Utils/TypeFocusSink/getTabIndex.ts +1 -1
- package/src/Utils/TypeFocusSink/inputtableKey.ts +5 -1
- package/src/Utils/activityAltText.ts +135 -0
- package/src/Utils/createCustomEvent.js +7 -1
- package/src/Utils/detectBrowser.js +2 -1
- package/src/Utils/findAncestor.ts +12 -0
- package/src/Utils/getActivityUniqueId.ts +5 -0
- package/src/Utils/intersectionOf.spec.js +2 -0
- package/src/Utils/intersectionOf.ts +14 -0
- package/src/Utils/isZeroOrPositive.ts +7 -0
- package/src/Utils/mapMap.js +7 -1
- package/src/Utils/mapMap.spec.js +2 -0
- package/src/Utils/removeInline.spec.js +2 -0
- package/src/Utils/scrollIntoViewWithBlockNearest.ts +20 -0
- package/src/Utils/shallowEquals.js +8 -1
- package/src/Utils/{singleToArray.js → singleToArray.ts} +1 -1
- package/src/Utils/supportPseudoClass.ts +17 -0
- package/src/Utils/{tabbableElements.js → tabbableElements.ts} +6 -5
- package/src/Utils/walkMarkdownTokens.spec.js +3 -3
- package/src/connectToWebChat.js +11 -4
- package/src/hooks/{index.js → index.ts} +1 -0
- package/src/hooks/internal/BypassSpeechSynthesisPonyfill.js +70 -17
- package/src/hooks/internal/useChanged.ts +17 -0
- package/src/hooks/internal/useDispatchScrollPosition.js +1 -3
- package/src/hooks/internal/useDispatchTranscriptFocusByActivityKey.ts +5 -0
- package/src/hooks/internal/useFocusVisible.ts +22 -0
- package/src/hooks/internal/useMemoWithPrevious.ts +16 -0
- package/src/hooks/internal/useMemoize.spec.js +3 -1
- package/src/hooks/internal/useMemoize.ts +53 -0
- package/src/hooks/internal/useObserveFocusVisible.ts +252 -0
- package/src/hooks/internal/usePrevious.ts +12 -0
- package/src/hooks/internal/useResumeAudioContext.ts +7 -0
- package/src/hooks/internal/useScrollRelative.js +4 -3
- package/src/hooks/internal/useStateRef.ts +31 -0
- package/src/hooks/internal/{useUniqueId.js → useUniqueId.ts} +1 -1
- package/src/hooks/internal/useValueRef.ts +22 -0
- package/src/hooks/{useDictateAbortable.js → useDictateAbortable.ts} +1 -1
- package/src/hooks/{useFocus.js → useFocus.ts} +1 -1
- package/src/hooks/{useFocusSendBox.js → useFocusSendBox.ts} +2 -1
- package/src/hooks/{useObserveScrollPosition.js → useObserveScrollPosition.ts} +6 -1
- package/src/hooks/{useObserveTranscriptFocus.js → useObserveTranscriptFocus.ts} +6 -1
- package/src/hooks/useRenderMarkdownAsHTML.ts +23 -0
- package/src/hooks/{useScrollDown.js → useScrollDown.ts} +1 -1
- package/src/hooks/useScrollTo.ts +16 -0
- package/src/hooks/useScrollToEnd.ts +12 -0
- package/src/hooks/{useScrollUp.js → useScrollUp.ts} +1 -1
- package/src/hooks/{useSendFiles.js → useSendFiles.ts} +3 -2
- package/src/hooks/{useStyleSet.js → useStyleSet.ts} +1 -1
- package/src/hooks/useWebSpeechPonyfill.ts +7 -0
- package/src/index.ts +7 -12
- package/src/providers/ActivityTree/ActivityTreeComposer.tsx +74 -0
- package/src/providers/ActivityTree/private/Context.ts +12 -0
- package/src/providers/ActivityTree/private/types.ts +12 -0
- package/src/providers/ActivityTree/private/useActivitiesWithRenderer.ts +66 -0
- package/src/providers/ActivityTree/private/useActivityTreeWithRenderer.ts +140 -0
- package/src/providers/ActivityTree/private/useContext.ts +15 -0
- package/src/providers/ActivityTree/useActivityTreeWithRenderer.ts +16 -0
- package/src/providers/LiveRegionTwin/LiveRegionTwinComposer.tsx +154 -0
- package/src/providers/LiveRegionTwin/private/Context.ts +15 -0
- package/src/providers/LiveRegionTwin/private/LiveRegionTwinContainer.tsx +64 -0
- package/src/providers/LiveRegionTwin/private/types.ts +10 -0
- package/src/providers/LiveRegionTwin/private/useContext.ts +15 -0
- package/src/providers/LiveRegionTwin/private/useMarkAllAsRenderedEffect.ts +13 -0
- package/src/providers/LiveRegionTwin/private/useStaticElementEntries.ts +7 -0
- package/src/providers/LiveRegionTwin/useQueueStaticElement.ts +12 -0
- package/src/providers/TranscriptFocus/TranscriptFocusComposer.tsx +180 -0
- package/src/providers/TranscriptFocus/private/Context.ts +16 -0
- package/src/providers/TranscriptFocus/private/useContext.ts +13 -0
- package/src/providers/TranscriptFocus/useActiveDescendantId.ts +5 -0
- package/src/providers/TranscriptFocus/useFocusByActivityKey.ts +14 -0
- package/src/providers/TranscriptFocus/useFocusRelativeActivity.ts +5 -0
- package/src/providers/TranscriptFocus/useFocusedActivityKey.ts +5 -0
- package/src/providers/TranscriptFocus/useFocusedExplicitly.ts +5 -0
- package/src/providers/TranscriptFocus/useGetDescendantIdByActivityKey.ts +5 -0
- package/src/tsconfig.json +1 -1
- package/src/types/ScrollPosition.ts +6 -0
- package/.eslintignore +0 -9
- package/lib/Activity/ScrollToEndButton.js +0 -81
- package/lib/Attachment/Assets/ErrorIcon.js +0 -22
- package/lib/Utils/findLastIndex.js +0 -32
- package/lib/Utils/remarkStripMarkdown.js +0 -26
- package/lib/hooks/internal/useAcknowledgedActivity.js +0 -90
- package/lib/hooks/internal/useDispatchTranscriptFocus.js +0 -19
- package/lib/hooks/internal/useStripMarkdown.js +0 -19
- package/src/Activity/ScrollToEndButton.js +0 -58
- package/src/Attachment/Assets/ErrorIcon.js +0 -9
- package/src/BasicTranscript.js +0 -1123
- package/src/Middleware/Activity/createCoreMiddleware.js +0 -71
- package/src/Middleware/Attachment/createCoreMiddleware.js +0 -43
- package/src/Middleware/AttachmentForScreenReader/createCoreMiddleware.js +0 -37
- package/src/Middleware/Toast/createCoreMiddleware.js +0 -20
- package/src/Toast/createToastMiddleware.js +0 -11
- package/src/Utils/findLastIndex.js +0 -11
- package/src/Utils/findLastIndex.spec.js +0 -29
- package/src/Utils/getActivityUniqueId.js +0 -3
- package/src/Utils/intersectionOf.js +0 -11
- package/src/Utils/isZeroOrPositive.js +0 -4
- package/src/Utils/remarkStripMarkdown.js +0 -13
- package/src/hooks/internal/useAcknowledgedActivity.js +0 -65
- package/src/hooks/internal/useChanged.js +0 -10
- package/src/hooks/internal/useDispatchTranscriptFocus.js +0 -7
- package/src/hooks/internal/useMemoize.js +0 -37
- package/src/hooks/internal/useStripMarkdown.js +0 -7
- package/src/hooks/useRenderMarkdownAsHTML.js +0 -20
- package/src/hooks/useScrollTo.js +0 -11
- package/src/hooks/useScrollToEnd.js +0 -11
- package/src/hooks/useWebSpeechPonyfill.js +0 -5
- package/src/index.tsx +0 -35
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React, { Fragment, useCallback, useRef } from 'react';
|
|
3
|
+
|
|
4
|
+
import type { FC, KeyboardEventHandler, PropsWithChildren } from 'react';
|
|
5
|
+
|
|
6
|
+
import FocusRedirector from '../Utils/FocusRedirector';
|
|
7
|
+
import tabbableElements from '../Utils/tabbableElements';
|
|
8
|
+
import useValueRef from '../hooks/internal/useValueRef';
|
|
9
|
+
|
|
10
|
+
type FocusTrapProps = PropsWithChildren<{
|
|
11
|
+
onFocus: () => void;
|
|
12
|
+
onLeave: () => void;
|
|
13
|
+
}>;
|
|
14
|
+
|
|
15
|
+
const FocusTrap: FC<FocusTrapProps> = ({ children, onFocus, onLeave }) => {
|
|
16
|
+
const bodyRef = useRef<HTMLDivElement>();
|
|
17
|
+
const onLeaveRef = useValueRef<() => void>(onLeave);
|
|
18
|
+
|
|
19
|
+
const handleBodyKeyDown: KeyboardEventHandler = useCallback(
|
|
20
|
+
event => {
|
|
21
|
+
if (event.key === 'Escape') {
|
|
22
|
+
event.preventDefault();
|
|
23
|
+
event.stopPropagation();
|
|
24
|
+
|
|
25
|
+
onLeaveRef.current?.();
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
[onLeaveRef]
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const handleFirstSentinelFocus: () => void = useCallback(() => {
|
|
32
|
+
const focusables = tabbableElements(bodyRef.current);
|
|
33
|
+
|
|
34
|
+
focusables[focusables.length - 1]?.focus();
|
|
35
|
+
}, [bodyRef]);
|
|
36
|
+
|
|
37
|
+
const handleLastSentinelFocus: () => void = useCallback(
|
|
38
|
+
() => tabbableElements(bodyRef.current)[0]?.focus(),
|
|
39
|
+
[bodyRef]
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<Fragment>
|
|
44
|
+
<FocusRedirector onFocus={handleFirstSentinelFocus} />
|
|
45
|
+
<div onFocus={onFocus} onKeyDown={handleBodyKeyDown} ref={bodyRef}>
|
|
46
|
+
{children}
|
|
47
|
+
</div>
|
|
48
|
+
<FocusRedirector onFocus={handleLastSentinelFocus} />
|
|
49
|
+
</Fragment>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
FocusTrap.defaultProps = {
|
|
54
|
+
children: undefined,
|
|
55
|
+
onFocus: undefined
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
FocusTrap.propTypes = {
|
|
59
|
+
children: PropTypes.any,
|
|
60
|
+
onFocus: PropTypes.func,
|
|
61
|
+
onLeave: PropTypes.func.isRequired
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export default FocusTrap;
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { hooks } from 'botframework-webchat-api';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import React, { useCallback, useState } from 'react';
|
|
5
|
+
|
|
6
|
+
import type { VFC } from 'react';
|
|
7
|
+
|
|
8
|
+
import useFocus from '../hooks/useFocus';
|
|
9
|
+
import useStyleSet from '../hooks/useStyleSet';
|
|
10
|
+
|
|
11
|
+
const { useLocalizer } = hooks;
|
|
12
|
+
|
|
13
|
+
type NotesBodyProps = {
|
|
14
|
+
header: string;
|
|
15
|
+
text: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const Notes: VFC<NotesBodyProps> = ({ header, text }) => (
|
|
19
|
+
<section className="webchat__keyboard-help__notes">
|
|
20
|
+
<h4 className="webchat__keyboard-help__notes-header">{header}</h4>
|
|
21
|
+
{text.split('\n').map((line, index) => (
|
|
22
|
+
// We are splitting lines into paragraphs, index as key is legitimate here.
|
|
23
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
24
|
+
<p className="webchat__keyboard-help__notes-text" key={index}>
|
|
25
|
+
{line}
|
|
26
|
+
</p>
|
|
27
|
+
))}
|
|
28
|
+
</section>
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
Notes.propTypes = {
|
|
32
|
+
header: PropTypes.string.isRequired,
|
|
33
|
+
text: PropTypes.string.isRequired
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const KeyboardHelp: VFC<{}> = () => {
|
|
37
|
+
const [{ keyboardHelp: keyboardHelpStyleSet }] = useStyleSet();
|
|
38
|
+
const [shown, setShown] = useState(false);
|
|
39
|
+
const focus = useFocus();
|
|
40
|
+
const localize = useLocalizer();
|
|
41
|
+
|
|
42
|
+
const chatHistoryAccessItemsInMessageBody = localize('KEYBOARD_HELP_CHAT_HISTORY_ACCESS_ITEMS_IN_MESSAGE_BODY');
|
|
43
|
+
const chatHistoryAccessItemsInMessageHeader = localize('KEYBOARD_HELP_CHAT_HISTORY_ACCESS_ITEMS_IN_MESSAGE_HEADER');
|
|
44
|
+
const chatHistoryHeader = localize('KEYBOARD_HELP_CHAT_HISTORY_HEADER');
|
|
45
|
+
const chatHistoryLeaveMessageBody = localize('KEYBOARD_HELP_CHAT_HISTORY_LEAVE_MESSAGE_BODY');
|
|
46
|
+
const chatHistoryLeaveMessageHeader = localize('KEYBOARD_HELP_CHAT_HISTORY_LEAVE_MESSAGE_HEADER');
|
|
47
|
+
const chatHistoryMoveBetweenItemsBody = localize('KEYBOARD_HELP_CHAT_HISTORY_MOVE_BETWEEN_ITEMS_BODY');
|
|
48
|
+
const chatHistoryMoveBetweenItemsHeader = localize('KEYBOARD_HELP_CHAT_HISTORY_MOVE_BETWEEN_ITEMS_HEADER');
|
|
49
|
+
const chatHistoryMoveBetweenMessagesBody = localize('KEYBOARD_HELP_CHAT_HISTORY_MOVE_BETWEEN_MESSAGES_BODY');
|
|
50
|
+
const chatHistoryMoveBetweenMessagesHeader = localize('KEYBOARD_HELP_CHAT_HISTORY_MOVE_BETWEEN_MESSAGES_HEADER');
|
|
51
|
+
const chatWindowBodyDoActionBody = localize('KEYBOARD_HELP_CHAT_WINDOW_BODY_DO_ACTION_BODY');
|
|
52
|
+
const chatWindowBodyDoActionHeader = localize('KEYBOARD_HELP_CHAT_WINDOW_BODY_DO_ACTION_HEADER');
|
|
53
|
+
const chatWindowBodyMoveBetweenItemsBody = localize('KEYBOARD_HELP_CHAT_WINDOW_BODY_MOVE_BETWEEN_ITEMS_BODY');
|
|
54
|
+
const chatWindowBodyMoveBetweenItemsHeader = localize('KEYBOARD_HELP_CHAT_WINDOW_BODY_MOVE_BETWEEN_ITEMS_HEADER');
|
|
55
|
+
const chatWindowHeader = localize('KEYBOARD_HELP_CHAT_WINDOW_HEADER');
|
|
56
|
+
const closeButtonAlt = localize('KEYBOARD_HELP_CLOSE_BUTTON_ALT');
|
|
57
|
+
const header = localize('KEYBOARD_HELP_HEADER');
|
|
58
|
+
|
|
59
|
+
const handleBlur = useCallback(
|
|
60
|
+
// We will keep the help screen shown if the blur is caused by switch app.
|
|
61
|
+
// When switch app, `document.activeElement` will remains.
|
|
62
|
+
event => document.activeElement !== event.target && setShown(false),
|
|
63
|
+
[setShown]
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
const handleCloseButtonClick = useCallback(() => focus('main'), [focus]);
|
|
67
|
+
|
|
68
|
+
const handleFocusWithin = useCallback(() => setShown(true), [setShown]);
|
|
69
|
+
|
|
70
|
+
const handleKeyPress = useCallback(
|
|
71
|
+
({ key }) => (key === 'Enter' || key === 'Escape' || key === ' ') && focus('main'),
|
|
72
|
+
[focus]
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<div
|
|
77
|
+
// When the dialog is not shown, "aria-hidden" helps to prevent scan mode from able to scan the content of the dialog.
|
|
78
|
+
aria-hidden={!shown}
|
|
79
|
+
className={classNames('webchat__keyboard-help', keyboardHelpStyleSet + '', {
|
|
80
|
+
'webchat__keyboard-help--shown': shown
|
|
81
|
+
})}
|
|
82
|
+
onBlur={handleBlur}
|
|
83
|
+
onFocus={handleFocusWithin}
|
|
84
|
+
onKeyPress={handleKeyPress}
|
|
85
|
+
role="dialog"
|
|
86
|
+
tabIndex={0}
|
|
87
|
+
>
|
|
88
|
+
<div className="webchat__keyboard-help__box">
|
|
89
|
+
<header>
|
|
90
|
+
<h2 className="webchat__keyboard-help__header">{header}</h2>
|
|
91
|
+
</header>
|
|
92
|
+
<button
|
|
93
|
+
aria-label={closeButtonAlt}
|
|
94
|
+
className="webchat__keyboard-help__close-button"
|
|
95
|
+
onClick={handleCloseButtonClick}
|
|
96
|
+
onFocus={handleFocusWithin}
|
|
97
|
+
tabIndex={-1}
|
|
98
|
+
type="button"
|
|
99
|
+
>
|
|
100
|
+
<svg
|
|
101
|
+
className="webchat__keyboard-help__close-button_image"
|
|
102
|
+
role="presentation"
|
|
103
|
+
viewBox="0 0 2048 2048"
|
|
104
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
105
|
+
>
|
|
106
|
+
<path d="M2048 136l-888 888 888 888-136 136-888-888-888 888L0 1912l888-888L0 136 136 0l888 888L1912 0l136 136z" />
|
|
107
|
+
</svg>
|
|
108
|
+
</button>
|
|
109
|
+
<article className="webchat__keyboard-help__section">
|
|
110
|
+
<header>
|
|
111
|
+
<h3 className="webchat__keyboard-help__sub-header">{chatWindowHeader}</h3>
|
|
112
|
+
</header>
|
|
113
|
+
<div className="webchat__keyboard-help__two-panes">
|
|
114
|
+
<svg
|
|
115
|
+
className="webchat__keyboard-help__image webchat__keyboard-help__image--light"
|
|
116
|
+
fill="none"
|
|
117
|
+
height="200"
|
|
118
|
+
role="presentation"
|
|
119
|
+
viewBox="0 0 121 200"
|
|
120
|
+
width="121"
|
|
121
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
122
|
+
>
|
|
123
|
+
<rect height="199" stroke="#C8C6C4" width="109" x="0.5" y="0.5" />
|
|
124
|
+
<rect height="156" stroke="#323130" width="102" x="3.5" y="4.5" />
|
|
125
|
+
<rect height="42" stroke="#C8C6C4" width="93" x="7.5" y="8.5" />
|
|
126
|
+
<rect height="99" stroke="#C8C6C4" width="93" x="7.5" y="55.5" />
|
|
127
|
+
<rect height="13" stroke="#323130" width="102" x="3.5" y="182.5" />
|
|
128
|
+
<rect height="13" stroke="#323130" width="32" x="3.5" y="165.5" />
|
|
129
|
+
<rect height="13" stroke="#323130" width="32" x="38.5" y="165.5" />
|
|
130
|
+
<rect height="13" stroke="#323130" width="32" x="73.5" y="165.5" />
|
|
131
|
+
<path
|
|
132
|
+
clipRule="evenodd"
|
|
133
|
+
d="M116.328 5.64645C116.524 5.45118 116.84 5.45118 117.036 5.64645L120.218 8.82843C120.413 9.02369 120.413 9.34027 120.218 9.53553C120.022 9.7308 119.706 9.7308 119.51 9.53553L117.182 7.20711V192.793L119.51 190.464C119.706 190.269 120.022 190.269 120.218 190.464C120.413 190.66 120.413 190.976 120.218 191.172L117.036 194.354C116.84 194.549 116.524 194.549 116.328 194.354L113.146 191.172C112.951 190.976 112.951 190.66 113.146 190.464C113.342 190.269 113.658 190.269 113.854 190.464L116.182 192.793V7.20711L113.854 9.53553C113.658 9.7308 113.342 9.7308 113.146 9.53553C112.951 9.34027 112.951 9.02369 113.146 8.82843L116.328 5.64645Z"
|
|
134
|
+
fill="#323130"
|
|
135
|
+
fillRule="evenodd"
|
|
136
|
+
/>
|
|
137
|
+
</svg>
|
|
138
|
+
<svg
|
|
139
|
+
className="webchat__keyboard-help__image webchat__keyboard-help__image--dark"
|
|
140
|
+
fill="none"
|
|
141
|
+
height="200"
|
|
142
|
+
role="presentation"
|
|
143
|
+
viewBox="0 0 121 200"
|
|
144
|
+
width="121"
|
|
145
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
146
|
+
>
|
|
147
|
+
<rect height="199" stroke="#484644" width="109" x="0.5" y="0.5" />
|
|
148
|
+
<rect height="156" stroke="#F3F2F1" width="102" x="3.5" y="4.5" />
|
|
149
|
+
<rect height="42" stroke="#484644" width="93" x="7.5" y="8.5" />
|
|
150
|
+
<rect height="99" stroke="#484644" width="93" x="7.5" y="55.5" />
|
|
151
|
+
<rect height="13" stroke="#F3F2F1" width="102" x="3.5" y="182.5" />
|
|
152
|
+
<rect height="13" stroke="#F3F2F1" width="32" x="3.5" y="165.5" />
|
|
153
|
+
<rect height="13" stroke="#F3F2F1" width="32" x="38.5" y="165.5" />
|
|
154
|
+
<rect height="13" stroke="#F3F2F1" width="32" x="73.5" y="165.5" />
|
|
155
|
+
<path
|
|
156
|
+
clipRule="evenodd"
|
|
157
|
+
d="M116.328 5.64645C116.524 5.45118 116.84 5.45118 117.036 5.64645L120.218 8.82843C120.413 9.02369 120.413 9.34027 120.218 9.53553C120.022 9.7308 119.706 9.7308 119.51 9.53553L117.182 7.20711V192.793L119.51 190.464C119.706 190.269 120.022 190.269 120.218 190.464C120.413 190.66 120.413 190.976 120.218 191.172L117.036 194.354C116.84 194.549 116.524 194.549 116.328 194.354L113.146 191.172C112.951 190.976 112.951 190.66 113.146 190.464C113.342 190.269 113.658 190.269 113.854 190.464L116.182 192.793V7.20711L113.854 9.53553C113.658 9.7308 113.342 9.7308 113.146 9.53553C112.951 9.34027 112.951 9.02369 113.146 8.82843L116.328 5.64645Z"
|
|
158
|
+
fill="#F3F2F1"
|
|
159
|
+
fillRule="evenodd"
|
|
160
|
+
/>
|
|
161
|
+
</svg>
|
|
162
|
+
<svg
|
|
163
|
+
className="webchat__keyboard-help__image webchat__keyboard-help__image--high-contrast"
|
|
164
|
+
fill="none"
|
|
165
|
+
height="200"
|
|
166
|
+
role="presentation"
|
|
167
|
+
viewBox="0 0 121 200"
|
|
168
|
+
width="121"
|
|
169
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
170
|
+
>
|
|
171
|
+
<rect height="199" stroke="white" width="109" x="0.5" y="0.5" />
|
|
172
|
+
<rect height="156" stroke="white" width="102" x="3.5" y="4.5" />
|
|
173
|
+
<rect height="42" stroke="white" width="93" x="7.5" y="8.5" />
|
|
174
|
+
<rect height="99" stroke="white" width="93" x="7.5" y="55.5" />
|
|
175
|
+
<rect height="13" stroke="white" width="102" x="3.5" y="182.5" />
|
|
176
|
+
<rect height="13" stroke="white" width="32" x="3.5" y="165.5" />
|
|
177
|
+
<rect height="13" stroke="white" width="32" x="38.5" y="165.5" />
|
|
178
|
+
<rect height="13" stroke="white" width="32" x="73.5" y="165.5" />
|
|
179
|
+
<path
|
|
180
|
+
clipRule="evenodd"
|
|
181
|
+
d="M116.328 5.64645C116.524 5.45118 116.84 5.45118 117.036 5.64645L120.218 8.82843C120.413 9.02369 120.413 9.34027 120.218 9.53553C120.022 9.7308 119.706 9.7308 119.51 9.53553L117.182 7.20711V192.793L119.51 190.464C119.706 190.269 120.022 190.269 120.218 190.464C120.413 190.66 120.413 190.976 120.218 191.172L117.036 194.354C116.84 194.549 116.524 194.549 116.328 194.354L113.146 191.172C112.951 190.976 112.951 190.66 113.146 190.464C113.342 190.269 113.658 190.269 113.854 190.464L116.182 192.793V7.20711L113.854 9.53553C113.658 9.7308 113.342 9.7308 113.146 9.53553C112.951 9.34027 112.951 9.02369 113.146 8.82843L116.328 5.64645Z"
|
|
182
|
+
fill="white"
|
|
183
|
+
fillRule="evenodd"
|
|
184
|
+
/>
|
|
185
|
+
</svg>
|
|
186
|
+
<div className="webchat__keyboard-help__notes-pane">
|
|
187
|
+
<Notes header={chatWindowBodyMoveBetweenItemsHeader} text={chatWindowBodyMoveBetweenItemsBody} />
|
|
188
|
+
<Notes header={chatWindowBodyDoActionHeader} text={chatWindowBodyDoActionBody} />
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
</article>
|
|
192
|
+
<article className="webchat__keyboard-help__section">
|
|
193
|
+
<header>
|
|
194
|
+
<h3 className="webchat__keyboard-help__header">{chatHistoryHeader}</h3>
|
|
195
|
+
</header>
|
|
196
|
+
<div className="webchat__keyboard-help__two-panes">
|
|
197
|
+
<svg
|
|
198
|
+
className="webchat__keyboard-help__image webchat__keyboard-help__image--light"
|
|
199
|
+
fill="none"
|
|
200
|
+
height="200"
|
|
201
|
+
role="presentation"
|
|
202
|
+
viewBox="0 0 121 200"
|
|
203
|
+
width="121"
|
|
204
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
205
|
+
>
|
|
206
|
+
<rect height="199" stroke="#C8C6C4" width="109" x="0.5" y="0.5" />
|
|
207
|
+
<rect height="156" stroke="#323130" width="102" x="3.5" y="4.5" />
|
|
208
|
+
<rect height="42" stroke="#323130" strokeDasharray="2 2" width="93" x="7.5" y="8.5" />
|
|
209
|
+
<rect height="99" stroke="#323130" strokeDasharray="2 2" width="93" x="7.5" y="55.5" />
|
|
210
|
+
<rect height="13" stroke="#C8C6C4" width="102" x="3.5" y="182.5" />
|
|
211
|
+
<rect height="13" stroke="#C8C6C4" width="32" x="3.5" y="165.5" />
|
|
212
|
+
<rect height="13" stroke="#C8C6C4" width="32" x="38.5" y="165.5" />
|
|
213
|
+
<rect height="13" stroke="#C8C6C4" width="32" x="73.5" y="165.5" />
|
|
214
|
+
<path
|
|
215
|
+
clipRule="evenodd"
|
|
216
|
+
d="M116.328 7.64645C116.524 7.45118 116.84 7.45118 117.036 7.64645L120.218 10.8284C120.413 11.0237 120.413 11.3403 120.218 11.5355C120.022 11.7308 119.706 11.7308 119.51 11.5355L117.182 9.20711V156.793L119.51 154.464C119.706 154.269 120.022 154.269 120.218 154.464C120.413 154.66 120.413 154.976 120.218 155.172L117.036 158.354C116.84 158.549 116.524 158.549 116.328 158.354L113.146 155.172C112.951 154.976 112.951 154.66 113.146 154.464C113.342 154.269 113.658 154.269 113.854 154.464L116.182 156.793V9.20711L113.854 11.5355C113.658 11.7308 113.342 11.7308 113.146 11.5355C112.951 11.3403 112.951 11.0237 113.146 10.8284L116.328 7.64645Z"
|
|
217
|
+
fill="#323130"
|
|
218
|
+
fillRule="evenodd"
|
|
219
|
+
/>
|
|
220
|
+
</svg>
|
|
221
|
+
<svg
|
|
222
|
+
className="webchat__keyboard-help__image webchat__keyboard-help__image--dark"
|
|
223
|
+
fill="none"
|
|
224
|
+
height="200"
|
|
225
|
+
role="presentation"
|
|
226
|
+
viewBox="0 0 121 200"
|
|
227
|
+
width="121"
|
|
228
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
229
|
+
>
|
|
230
|
+
<rect height="199" stroke="#484644" width="109" x="0.5" y="0.5" />
|
|
231
|
+
<rect height="156" stroke="#F3F2F1" width="102" x="3.5" y="4.5" />
|
|
232
|
+
<rect height="42" stroke="#F3F2F1" strokeDasharray="2 2" width="93" x="7.5" y="8.5" />
|
|
233
|
+
<rect height="99" stroke="#F3F2F1" strokeDasharray="2 2" width="93" x="7.5" y="55.5" />
|
|
234
|
+
<rect height="13" stroke="#484644" width="102" x="3.5" y="182.5" />
|
|
235
|
+
<rect height="13" stroke="#484644" width="32" x="3.5" y="165.5" />
|
|
236
|
+
<rect height="13" stroke="#484644" width="32" x="38.5" y="165.5" />
|
|
237
|
+
<rect height="13" stroke="#484644" width="32" x="73.5" y="165.5" />
|
|
238
|
+
<path
|
|
239
|
+
clipRule="evenodd"
|
|
240
|
+
d="M116.328 7.64645C116.524 7.45118 116.84 7.45118 117.036 7.64645L120.218 10.8284C120.413 11.0237 120.413 11.3403 120.218 11.5355C120.022 11.7308 119.706 11.7308 119.51 11.5355L117.182 9.20711V156.793L119.51 154.464C119.706 154.269 120.022 154.269 120.218 154.464C120.413 154.66 120.413 154.976 120.218 155.172L117.036 158.354C116.84 158.549 116.524 158.549 116.328 158.354L113.146 155.172C112.951 154.976 112.951 154.66 113.146 154.464C113.342 154.269 113.658 154.269 113.854 154.464L116.182 156.793V9.20711L113.854 11.5355C113.658 11.7308 113.342 11.7308 113.146 11.5355C112.951 11.3403 112.951 11.0237 113.146 10.8284L116.328 7.64645Z"
|
|
241
|
+
fill="#F3F2F1"
|
|
242
|
+
fillRule="evenodd"
|
|
243
|
+
/>
|
|
244
|
+
</svg>
|
|
245
|
+
<svg
|
|
246
|
+
className="webchat__keyboard-help__image webchat__keyboard-help__image--high-contrast"
|
|
247
|
+
fill="none"
|
|
248
|
+
height="200"
|
|
249
|
+
role="presentation"
|
|
250
|
+
viewBox="0 0 121 200"
|
|
251
|
+
width="121"
|
|
252
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
253
|
+
>
|
|
254
|
+
<rect height="199" stroke="white" width="109" x="0.5" y="0.5" />
|
|
255
|
+
<rect height="156" stroke="white" width="102" x="3.5" y="4.5" />
|
|
256
|
+
<rect height="42" stroke="white" strokeDasharray="2 2" width="93" x="7.5" y="8.5" />
|
|
257
|
+
<rect height="99" stroke="white" strokeDasharray="2 2" width="93" x="7.5" y="55.5" />
|
|
258
|
+
<rect height="13" stroke="white" width="102" x="3.5" y="182.5" />
|
|
259
|
+
<rect height="13" stroke="white" width="32" x="3.5" y="165.5" />
|
|
260
|
+
<rect height="13" stroke="white" width="32" x="38.5" y="165.5" />
|
|
261
|
+
<rect height="13" stroke="white" width="32" x="73.5" y="165.5" />
|
|
262
|
+
<path
|
|
263
|
+
clipRule="evenodd"
|
|
264
|
+
d="M116.328 7.64645C116.524 7.45118 116.84 7.45118 117.036 7.64645L120.218 10.8284C120.413 11.0237 120.413 11.3403 120.218 11.5355C120.022 11.7308 119.706 11.7308 119.51 11.5355L117.182 9.20711V156.793L119.51 154.464C119.706 154.269 120.022 154.269 120.218 154.464C120.413 154.66 120.413 154.976 120.218 155.172L117.036 158.354C116.84 158.549 116.524 158.549 116.328 158.354L113.146 155.172C112.951 154.976 112.951 154.66 113.146 154.464C113.342 154.269 113.658 154.269 113.854 154.464L116.182 156.793V9.20711L113.854 11.5355C113.658 11.7308 113.342 11.7308 113.146 11.5355C112.951 11.3403 112.951 11.0237 113.146 10.8284L116.328 7.64645Z"
|
|
265
|
+
fill="white"
|
|
266
|
+
fillRule="evenodd"
|
|
267
|
+
/>
|
|
268
|
+
</svg>
|
|
269
|
+
<div className="webchat__keyboard-help__notes-pane">
|
|
270
|
+
<Notes header={chatHistoryMoveBetweenMessagesHeader} text={chatHistoryMoveBetweenMessagesBody} />
|
|
271
|
+
<Notes header={chatHistoryAccessItemsInMessageHeader} text={chatHistoryAccessItemsInMessageBody} />
|
|
272
|
+
<Notes header={chatHistoryMoveBetweenItemsHeader} text={chatHistoryMoveBetweenItemsBody} />
|
|
273
|
+
<Notes header={chatHistoryLeaveMessageHeader} text={chatHistoryLeaveMessageBody} />
|
|
274
|
+
</div>
|
|
275
|
+
</div>
|
|
276
|
+
</article>
|
|
277
|
+
</div>
|
|
278
|
+
</div>
|
|
279
|
+
);
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
export default KeyboardHelp;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { hooks } from 'botframework-webchat-api';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import random from 'math-random';
|
|
4
|
+
import React, { useEffect, useMemo, useRef } from 'react';
|
|
5
|
+
|
|
6
|
+
import type { DirectLineActivity } from 'botframework-webchat-core';
|
|
7
|
+
import type { FC, RefObject, VFC } from 'react';
|
|
8
|
+
|
|
9
|
+
import LiveRegionTwinComposer from '../providers/LiveRegionTwin/LiveRegionTwinComposer';
|
|
10
|
+
import ScreenReaderActivity from '../ScreenReaderActivity';
|
|
11
|
+
import tabbableElements from '../Utils/tabbableElements';
|
|
12
|
+
import useActivityTreeWithRenderer from '../providers/ActivityTree/useActivityTreeWithRenderer';
|
|
13
|
+
import useQueueStaticElement from '../providers/LiveRegionTwin/useQueueStaticElement';
|
|
14
|
+
import useStyleToEmotionObject from '../hooks/internal/useStyleToEmotionObject';
|
|
15
|
+
|
|
16
|
+
import type { ActivityElementMap } from './types';
|
|
17
|
+
import classNames from 'classnames';
|
|
18
|
+
|
|
19
|
+
const { useGetKeyByActivity, useLocalizer, useStyleOptions } = hooks;
|
|
20
|
+
|
|
21
|
+
const ROOT_STYLE = {
|
|
22
|
+
'&.webchat__live-region-transcript': {
|
|
23
|
+
'& .webchat__live-region-transcript__interactive_note': {
|
|
24
|
+
color: 'transparent',
|
|
25
|
+
height: 1,
|
|
26
|
+
overflow: 'hidden',
|
|
27
|
+
position: 'absolute',
|
|
28
|
+
top: 0,
|
|
29
|
+
whiteSpace: 'nowrap',
|
|
30
|
+
width: 1
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Checks if the rendering activity is presentational or not. Returns `true` if presentational, otherwise, `false`.
|
|
37
|
+
*
|
|
38
|
+
* Presentational activity, will be rendered visually but not going through screen reader.
|
|
39
|
+
*/
|
|
40
|
+
function isPresentational(activity: DirectLineActivity): boolean {
|
|
41
|
+
const { channelData }: { attachments?: []; channelData?: { messageBack?: { displayText?: string } }; text?: string } =
|
|
42
|
+
activity;
|
|
43
|
+
|
|
44
|
+
// "Fallback text" includes both message text and narratives for attachments.
|
|
45
|
+
// Emptying out "fallback text" essentially mute for both message and attachments.
|
|
46
|
+
const fallbackText = channelData?.['webchat:fallback-text'];
|
|
47
|
+
|
|
48
|
+
if (typeof fallbackText === 'string') {
|
|
49
|
+
return !fallbackText;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// If there are "displayText" (MessageBack), "text", or any attachments, there are something to narrate.
|
|
53
|
+
return !(channelData?.messageBack?.displayText || activity.text || activity.attachments?.length);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
type RenderingActivities = Map<string, DirectLineActivity>;
|
|
57
|
+
|
|
58
|
+
type LiveRegionTranscriptCoreProps = {
|
|
59
|
+
activityElementMapRef: RefObject<ActivityElementMap>;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const LiveRegionTranscriptCore: FC<LiveRegionTranscriptCoreProps> = ({ activityElementMapRef }) => {
|
|
63
|
+
const [flattenedActivityTree] = useActivityTreeWithRenderer({ flat: true });
|
|
64
|
+
const getKeyByActivity = useGetKeyByActivity();
|
|
65
|
+
const localize = useLocalizer();
|
|
66
|
+
const queueStaticElement = useQueueStaticElement();
|
|
67
|
+
|
|
68
|
+
const liveRegionInteractiveLabelAlt = localize('TRANSCRIPT_LIVE_REGION_INTERACTIVE_LABEL_ALT');
|
|
69
|
+
const liveRegionInteractiveWithLinkLabelAlt = localize('TRANSCRIPT_LIVE_REGION_INTERACTIVE_WITH_LINKS_LABEL_ALT');
|
|
70
|
+
|
|
71
|
+
const renderingActivities = useMemo<Readonly<RenderingActivities>>(
|
|
72
|
+
() =>
|
|
73
|
+
Object.freeze(
|
|
74
|
+
flattenedActivityTree.reduce<RenderingActivities>(
|
|
75
|
+
(intermediate, { activity }) => intermediate.set(getKeyByActivity(activity), activity),
|
|
76
|
+
new Map<string, DirectLineActivity>()
|
|
77
|
+
)
|
|
78
|
+
),
|
|
79
|
+
[flattenedActivityTree, getKeyByActivity]
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
const prevRenderingActivitiesRef = useRef<Readonly<RenderingActivities>>();
|
|
83
|
+
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
const { current: prevRenderingActivities } = prevRenderingActivitiesRef;
|
|
86
|
+
const appendedActivities: { activity: DirectLineActivity; key: string }[] = [];
|
|
87
|
+
|
|
88
|
+
// Bottom-up, find activities which are recently appended (i.e. new activity will have a new key).
|
|
89
|
+
// We only consider new activities added to the bottom of the chat history.
|
|
90
|
+
// Based on how `aria-relevant="additions"` works, activities that are updated, deleted, or reordered, should be ignored.
|
|
91
|
+
for (const [key, activity] of Array.from(renderingActivities.entries()).reverse()) {
|
|
92
|
+
if (prevRenderingActivities?.has(key)) {
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
appendedActivities.unshift({ activity, key });
|
|
97
|
+
|
|
98
|
+
isPresentational(activity) || queueStaticElement(<ScreenReaderActivity activity={activity} />);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const hasNewLink = appendedActivities.some(({ key }) => activityElementMapRef.current.get(key)?.querySelector('a'));
|
|
102
|
+
|
|
103
|
+
const hasNewWidget = appendedActivities.some(
|
|
104
|
+
({ key }) =>
|
|
105
|
+
!!tabbableElements(
|
|
106
|
+
activityElementMapRef.current.get(key)?.querySelector('.webchat__basic-transcript__activity-body')
|
|
107
|
+
).length
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
if (hasNewLink || hasNewWidget) {
|
|
111
|
+
// eslint-disable-next-line no-magic-numbers
|
|
112
|
+
const labelId = `webchat__live-region-transcript__interactive_note--${random().toString(36).substr(2, 5)}`;
|
|
113
|
+
|
|
114
|
+
queueStaticElement(
|
|
115
|
+
// Inside ARIA live region:
|
|
116
|
+
// - Edge + Narrator:
|
|
117
|
+
// - It read if `aria-labelledby` or `aria-label` is set;
|
|
118
|
+
// - It read nothing if `aria-labelledby` or `aria-label` are not set (in this case, it read "note").
|
|
119
|
+
// - Safari + VoiceOver and Chrome + NVDA:
|
|
120
|
+
// - They read its content and ignore `aria-labelledby` or `aria-label`
|
|
121
|
+
// - They will not read if it is simply <div aria-label="Something" /> without content (self-closing tag).
|
|
122
|
+
// For best compatibility, we need both `aria-labelledby` and contented <div>.
|
|
123
|
+
<div
|
|
124
|
+
aria-atomic="true"
|
|
125
|
+
aria-labelledby={labelId}
|
|
126
|
+
className="webchat__live-region-transcript__interactive_note"
|
|
127
|
+
role="note"
|
|
128
|
+
>
|
|
129
|
+
{/* "id" is required for "aria-activedescendant" */}
|
|
130
|
+
{/* eslint-disable-next-line react/forbid-dom-props */}
|
|
131
|
+
<span id={labelId}>{hasNewLink ? liveRegionInteractiveWithLinkLabelAlt : liveRegionInteractiveLabelAlt}</span>
|
|
132
|
+
</div>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
prevRenderingActivitiesRef.current = renderingActivities;
|
|
137
|
+
}, [
|
|
138
|
+
activityElementMapRef,
|
|
139
|
+
getKeyByActivity,
|
|
140
|
+
liveRegionInteractiveLabelAlt,
|
|
141
|
+
liveRegionInteractiveWithLinkLabelAlt,
|
|
142
|
+
prevRenderingActivitiesRef,
|
|
143
|
+
queueStaticElement,
|
|
144
|
+
renderingActivities
|
|
145
|
+
]);
|
|
146
|
+
|
|
147
|
+
return null;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
type LiveRegionTranscriptProps = {
|
|
151
|
+
activityElementMapRef: RefObject<ActivityElementMap>;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const LiveRegionTranscript: VFC<LiveRegionTranscriptProps> = ({ activityElementMapRef }) => {
|
|
155
|
+
const [{ internalLiveRegionFadeAfter }] = useStyleOptions();
|
|
156
|
+
const localize = useLocalizer();
|
|
157
|
+
const rootClassName = useStyleToEmotionObject()(ROOT_STYLE) + '';
|
|
158
|
+
|
|
159
|
+
const transcriptRoleDescription = localize('TRANSCRIPT_ARIA_ROLE_ALT');
|
|
160
|
+
|
|
161
|
+
return (
|
|
162
|
+
<LiveRegionTwinComposer
|
|
163
|
+
aria-roledescription={transcriptRoleDescription}
|
|
164
|
+
className={classNames('webchat__live-region-transcript', rootClassName)}
|
|
165
|
+
fadeAfter={internalLiveRegionFadeAfter}
|
|
166
|
+
role="log"
|
|
167
|
+
>
|
|
168
|
+
<LiveRegionTranscriptCore activityElementMapRef={activityElementMapRef} />
|
|
169
|
+
</LiveRegionTwinComposer>
|
|
170
|
+
);
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
LiveRegionTranscript.propTypes = {
|
|
174
|
+
// PropTypes cannot be fully expressed in TypeScript.
|
|
175
|
+
// @ts-ignore
|
|
176
|
+
activityElementMapRef: PropTypes.shape({
|
|
177
|
+
current: PropTypes.instanceOf(Map)
|
|
178
|
+
}).isRequired
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export default LiveRegionTranscript;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ActivityElementMap = Map<string, HTMLElement>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { hooks } from 'botframework-webchat-api';
|
|
2
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
import type { DirectLineActivity } from 'botframework-webchat-core';
|
|
5
|
+
import type { RefObject } from 'react';
|
|
6
|
+
|
|
7
|
+
import activityAltText from '../Utils/activityAltText';
|
|
8
|
+
import tabbableElements from '../Utils/tabbableElements';
|
|
9
|
+
import useRenderMarkdownAsHTML from '../hooks/useRenderMarkdownAsHTML';
|
|
10
|
+
import useValueRef from '../hooks/internal/useValueRef';
|
|
11
|
+
|
|
12
|
+
enum InteractiveType {
|
|
13
|
+
LINK,
|
|
14
|
+
WIDGET
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const { useAvatarForBot, useLocalizer } = hooks;
|
|
18
|
+
|
|
19
|
+
const ACTIVITY_NUM_ATTACHMENTS_ALT_IDS = {
|
|
20
|
+
few: 'ACTIVITY_NUM_ATTACHMENTS_FEW_ALT',
|
|
21
|
+
many: 'ACTIVITY_NUM_ATTACHMENTS_MANY_ALT',
|
|
22
|
+
one: 'ACTIVITY_NUM_ATTACHMENTS_ONE_ALT',
|
|
23
|
+
other: 'ACTIVITY_NUM_ATTACHMENTS_OTHER_ALT',
|
|
24
|
+
two: 'ACTIVITY_NUM_ATTACHMENTS_TWO_ALT'
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default function useActivityAccessibleName(activity: DirectLineActivity, bodyRef: RefObject<HTMLElement>) {
|
|
28
|
+
const [{ initials: botInitials }] = useAvatarForBot();
|
|
29
|
+
const [interactiveType, setInteractiveType] = useState<InteractiveType | false>(false);
|
|
30
|
+
const fromSelf = activity.from?.role === 'user';
|
|
31
|
+
const localize = useLocalizer();
|
|
32
|
+
const localizeWithPlural = useLocalizer({ plural: true });
|
|
33
|
+
const numAttachments = activity.attachments?.length || 0;
|
|
34
|
+
const renderMarkdownAsHTML = useRenderMarkdownAsHTML();
|
|
35
|
+
|
|
36
|
+
const activityInteractiveAlt = localize('ACTIVITY_INTERACTIVE_LABEL_ALT'); // "Click to interact."
|
|
37
|
+
const activityInteractiveWithLinkAlt = localize('ACTIVITY_INTERACTIVE_WITH_LINKS_LABEL_ALT'); // "Click to interact."
|
|
38
|
+
const greetingAlt = useMemo(
|
|
39
|
+
() =>
|
|
40
|
+
(fromSelf ? localize('ACTIVITY_YOU_SAID_ALT') : localize('ACTIVITY_BOT_SAID_ALT', botInitials || '')).replace(
|
|
41
|
+
/\s{2,}/gu,
|
|
42
|
+
' '
|
|
43
|
+
),
|
|
44
|
+
[botInitials, fromSelf, localize]
|
|
45
|
+
);
|
|
46
|
+
const interactiveTypeRef = useValueRef(interactiveType);
|
|
47
|
+
const messageTextAlt = useMemo(
|
|
48
|
+
() => activityAltText(activity, renderMarkdownAsHTML),
|
|
49
|
+
[activity, renderMarkdownAsHTML]
|
|
50
|
+
);
|
|
51
|
+
const numAttachmentsAlt = useMemo(
|
|
52
|
+
() => (numAttachments ? localizeWithPlural(ACTIVITY_NUM_ATTACHMENTS_ALT_IDS, numAttachments) : ''),
|
|
53
|
+
[localizeWithPlural, numAttachments]
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const accessibleName = useMemo(
|
|
57
|
+
// We are concatenating in a single string for Safari. If we split it up, Safari will only narrate the first section.
|
|
58
|
+
() =>
|
|
59
|
+
`${greetingAlt} ${messageTextAlt} ${numAttachmentsAlt} ${
|
|
60
|
+
interactiveType === InteractiveType.LINK
|
|
61
|
+
? activityInteractiveWithLinkAlt
|
|
62
|
+
: interactiveType === InteractiveType.WIDGET
|
|
63
|
+
? activityInteractiveAlt
|
|
64
|
+
: ''
|
|
65
|
+
}`,
|
|
66
|
+
[
|
|
67
|
+
activityInteractiveAlt,
|
|
68
|
+
activityInteractiveWithLinkAlt,
|
|
69
|
+
greetingAlt,
|
|
70
|
+
interactiveType,
|
|
71
|
+
messageTextAlt,
|
|
72
|
+
numAttachmentsAlt
|
|
73
|
+
]
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
const hasLinks = !!bodyRef.current?.querySelector('a');
|
|
78
|
+
const hasWidgets = !!tabbableElements(bodyRef.current).length;
|
|
79
|
+
|
|
80
|
+
interactiveTypeRef.current !== hasWidgets &&
|
|
81
|
+
setInteractiveType(hasLinks ? InteractiveType.LINK : hasWidgets ? InteractiveType.WIDGET : false);
|
|
82
|
+
}, [bodyRef, interactiveTypeRef, setInteractiveType]);
|
|
83
|
+
|
|
84
|
+
return [accessibleName];
|
|
85
|
+
}
|