@azure/communication-react 1.13.0-alpha-202402230012 → 1.13.0-alpha-202402240011
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/dist/communication-react.d.ts +67 -11
- package/dist/dist-cjs/communication-react/index.js +419 -107
- 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/calling-component-bindings/src/baseSelectors.d.ts +5 -4
- package/dist/dist-esm/calling-component-bindings/src/baseSelectors.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/captionsSelector.d.ts +5 -5
- package/dist/dist-esm/calling-component-bindings/src/captionsSelector.js +1 -1
- package/dist/dist-esm/calling-component-bindings/src/captionsSelector.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.d.ts +1 -1
- package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.js +2 -2
- package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/index.d.ts +1 -0
- package/dist/dist-esm/calling-component-bindings/src/index.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/utils/participantListSelectorUtils.js +1 -1
- package/dist/dist-esm/calling-component-bindings/src/utils/participantListSelectorUtils.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/utils/videoGalleryUtils.d.ts +3 -1
- package/dist/dist-esm/calling-component-bindings/src/utils/videoGalleryUtils.js +5 -4
- package/dist/dist-esm/calling-component-bindings/src/utils/videoGalleryUtils.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CallClientState.d.ts +4 -4
- package/dist/dist-esm/calling-stateful-client/src/CallClientState.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CallContext.js +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CallContext.js.map +1 -1
- package/dist/dist-esm/communication-react/src/index.d.ts +1 -0
- package/dist/dist-esm/communication-react/src/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/CaptionsSettingsModal.d.ts +7 -7
- package/dist/dist-esm/react-components/src/components/CaptionsSettingsModal.js +11 -17
- package/dist/dist-esm/react-components/src/components/CaptionsSettingsModal.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/Dialpad/DTMFToneGenerator.d.ts +7 -0
- package/dist/dist-esm/react-components/src/components/Dialpad/DTMFToneGenerator.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/Dialpad/Dialpad.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/LocalVideoTile.js +3 -3
- package/dist/dist-esm/react-components/src/components/LocalVideoTile.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/MessageStatusIcon.d.ts +19 -0
- package/dist/dist-esm/react-components/src/components/MessageStatusIcon.js +20 -0
- package/dist/dist-esm/react-components/src/components/MessageStatusIcon.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/MessageStatusIndicator.js +4 -64
- package/dist/dist-esm/react-components/src/components/MessageStatusIndicator.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/MessageStatusIndicatorInternal.d.ts +42 -0
- package/dist/dist-esm/react-components/src/components/MessageStatusIndicatorInternal.js +73 -0
- package/dist/dist-esm/react-components/src/components/MessageStatusIndicatorInternal.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/MessageThread.js +36 -4
- package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ModalClone/ModalClone.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ParticipantItem.d.ts +2 -0
- package/dist/dist-esm/react-components/src/components/ParticipantItem.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ParticipantList.js +4 -8
- package/dist/dist-esm/react-components/src/components/ParticipantList.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RTE/RTEInputBoxComponent.d.ts +2 -0
- package/dist/dist-esm/react-components/src/components/RTE/RTEInputBoxComponent.js +1 -1
- package/dist/dist-esm/react-components/src/components/RTE/RTEInputBoxComponent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RTE/RTERibbonButtons.d.ts +12 -0
- package/dist/dist-esm/react-components/src/components/RTE/RTERibbonButtons.js +86 -0
- package/dist/dist-esm/react-components/src/components/RTE/RTERibbonButtons.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/RTE/RTESendBox.d.ts +39 -4
- package/dist/dist-esm/react-components/src/components/RTE/RTESendBox.js +10 -5
- package/dist/dist-esm/react-components/src/components/RTE/RTESendBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RTE/RichTextEditor.d.ts +2 -0
- package/dist/dist-esm/react-components/src/components/RTE/RichTextEditor.js +52 -20
- package/dist/dist-esm/react-components/src/components/RTE/RichTextEditor.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ReactionButton.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/ReactionButton.js +1 -1
- package/dist/dist-esm/react-components/src/components/ReactionButton.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RemoteVideoTile.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/RemoteVideoTile.js +4 -6
- package/dist/dist-esm/react-components/src/components/RemoteVideoTile.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/Survey/TagsSurvey/TagsSurvey.d.ts +4 -6
- package/dist/dist-esm/react-components/src/components/Survey/TagsSurvey/TagsSurvey.js +21 -11
- package/dist/dist-esm/react-components/src/components/Survey/TagsSurvey/TagsSurvey.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery.d.ts +2 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoTile.js +1 -1
- package/dist/dist-esm/react-components/src/components/VideoTile.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/index.d.ts +2 -2
- package/dist/dist-esm/react-components/src/components/index.js +1 -1
- package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.d.ts +13 -0
- package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.js +112 -0
- package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/videoTileStylesUtils.d.ts +2 -2
- package/dist/dist-esm/react-components/src/components/utils/videoTileStylesUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils.d.ts +8 -1
- package/dist/dist-esm/react-components/src/components/utils.js +8 -0
- package/dist/dist-esm/react-components/src/components/utils.js.map +1 -1
- package/dist/dist-esm/react-components/src/index.d.ts +1 -1
- package/dist/dist-esm/react-components/src/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/localization/LocalizationProvider.d.ts +3 -2
- package/dist/dist-esm/react-components/src/localization/LocalizationProvider.js.map +1 -1
- package/dist/dist-esm/react-components/src/localization/locales/en-US/strings.json +21 -4
- package/dist/dist-esm/react-components/src/localization/locales/utils.js +5 -1
- package/dist/dist-esm/react-components/src/localization/locales/utils.js.map +1 -1
- package/dist/dist-esm/react-components/src/theming/icons.d.ts +8 -0
- package/dist/dist-esm/react-components/src/theming/icons.js +19 -1
- package/dist/dist-esm/react-components/src/theming/icons.js.map +1 -1
- package/dist/dist-esm/react-components/src/types/CaptionsAvailableLanguageStrings.d.ts +21 -0
- package/dist/dist-esm/react-components/src/types/CaptionsAvailableLanguageStrings.js.map +1 -1
- package/dist/dist-esm/react-components/src/types/ParticipantListParticipant.d.ts +1 -1
- package/dist/dist-esm/react-components/src/types/ParticipantListParticipant.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +3 -3
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.d.ts +1 -1
- 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/LocalAndRemotePIP.js +2 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalAndRemotePIP.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js +2 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.d.ts +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +3 -3
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.d.ts +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.d.ts +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.js +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/Drawer/MoreDrawer.js +3 -5
- package/dist/dist-esm/react-composites/src/composites/common/Drawer/MoreDrawer.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/ModalLocalAndRemotePIP.js +5 -2
- package/dist/dist-esm/react-composites/src/composites/common/ModalLocalAndRemotePIP.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/icons.d.ts +8 -0
- package/dist/tsdoc-metadata.json +1 -1
- package/package.json +7 -7
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CaptionsSettingsModal.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/CaptionsSettingsModal.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAEL,KAAK,EACL,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,QAAQ,EAER,aAAa,EACb,aAAa,EACd,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,yBAAyB,EACzB,YAAY,EACZ,0BAA0B,EAC1B,qBAAqB,EACrB,cAAc,EACd,gCAAgC,EAChC,cAAc,EACd,uBAAuB,EACxB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAiD,gCAAgC,EAAE,MAAM,UAAU,CAAC;AAC3G,OAAO,EAAE,sBAAsB,EAAE,mCAAgC;AAuCjE;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAkC,EAAe,EAAE;IACxF,MAAM,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,SAAS,EACT,mBAAmB,EACnB,oBAAoB,EACpB,yBAAyB,EACzB,eAAe,EACf,OAAO,EACP,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,GAAG,KAAK,EAC9B,GAAG,KAAK,CAAC;IAEV,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IAEzB,MAAM,CAAC,oBAAoB,EAAE,uBAAuB,CAAC,GAAG,QAAQ,CAAC,KAA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MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,SAAS;gBAC5D,kCAAO,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,kCAAkC,CAAQ,CAC5C;YAChB,oBAAC,aAAa,IAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC;gBAC5D,kCAAO,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,iCAAiC,CAAQ,CAC3C,CACV,CACF,CAET,CACJ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useCallback } from 'react';\nimport { useMemo, useState, useEffect } from 'react';\nimport {\n IModalStyles,\n Modal,\n Stack,\n useTheme,\n Text,\n IconButton,\n Dropdown,\n IDropdownOption,\n DefaultButton,\n PrimaryButton\n} from '@fluentui/react';\n\nimport {\n buttonsContainerClassName,\n buttonStyles,\n dropdownContainerClassName,\n dropdownInfoTextStyle,\n dropdownStyles,\n themedCaptionsSettingsModalStyle,\n titleClassName,\n titleContainerClassName\n} from './styles/CaptionsSettingsModal.styles';\nimport { _captionsOptions } from './StartCaptionsButton';\nimport { defaultSpokenLanguage } from './utils';\nimport { SpokenLanguageStrings, CaptionLanguageStrings, _spokenLanguageToCaptionLanguage } from '../types';\nimport { _preventDismissOnEvent } from '@internal/acs-ui-common';\n\n/**\n * @internal\n * strings for captions setting modal\n */\nexport interface _CaptionsSettingsModalStrings {\n captionsSettingsModalTitle?: string;\n captionsSettingsSpokenLanguageDropdownLabel?: string;\n captionsSettingsCaptionLanguageDropdownLabel?: string;\n captionsSettingsSpokenLanguageDropdownInfoText?: string;\n captionsSettingsCaptionLanguageDropdownInfoText?: string;\n captionsSettingsConfirmButtonLabel?: string;\n captionsSettingsCancelButtonLabel?: string;\n captionsSettingsModalAriaLabel?: string;\n captionsSettingsCloseModalButtonAriaLabel?: string;\n}\n\n/**\n * @internal\n * _CaptionsSettingsModal Component Props.\n */\nexport interface _CaptionsSettingsModalProps {\n supportedSpokenLanguages: string[];\n supportedCaptionLanguages: string[];\n onSetSpokenLanguage: (language: string) => Promise<void>;\n onSetCaptionLanguage: (language: string) => Promise<void>;\n onStartCaptions: (options?: _captionsOptions) => Promise<void>;\n currentSpokenLanguage: string;\n currentCaptionLanguage: string;\n spokenLanguageStrings?: SpokenLanguageStrings;\n captionLanguageStrings?: CaptionLanguageStrings;\n isCaptionsFeatureActive?: boolean;\n strings?: _CaptionsSettingsModalStrings;\n showModal?: boolean;\n onDismissCaptionsSettings?: () => void;\n changeCaptionLanguage?: boolean;\n}\n\n/**\n * @internal\n * a component for setting spoken languages\n */\nexport const _CaptionsSettingsModal = (props: _CaptionsSettingsModalProps): JSX.Element => {\n const {\n supportedSpokenLanguages,\n supportedCaptionLanguages,\n currentSpokenLanguage,\n currentCaptionLanguage,\n isCaptionsFeatureActive,\n showModal,\n onSetSpokenLanguage,\n onSetCaptionLanguage,\n onDismissCaptionsSettings,\n onStartCaptions,\n strings,\n spokenLanguageStrings,\n captionLanguageStrings,\n changeCaptionLanguage = false\n } = props;\n\n const theme = useTheme();\n\n const [hasSetSpokenLanguage, setHasSetSpokenLanguage] = useState(false);\n\n const [selectedSpokenLanguage, setSelectedSpokenLanguage] = useState<IDropdownOption>({\n key: currentSpokenLanguage !== '' ? currentSpokenLanguage : defaultSpokenLanguage,\n text: currentSpokenLanguage !== '' ? currentSpokenLanguage : defaultSpokenLanguage\n });\n\n const [selectedCaptionLanguage, setSelectedCaptionLanguage] = useState<IDropdownOption>({\n key:\n currentCaptionLanguage !== ''\n ? currentCaptionLanguage\n : _spokenLanguageToCaptionLanguage[selectedSpokenLanguage.key],\n text:\n currentCaptionLanguage !== ''\n ? currentCaptionLanguage\n : _spokenLanguageToCaptionLanguage[selectedSpokenLanguage.key]\n });\n\n useEffect(() => {\n // set spoken language when start captions with a spoken language specified.\n // this is to fix the bug when a second user starts captions with a new spoken language, captions bot ignore that spoken language\n if (isCaptionsFeatureActive && !hasSetSpokenLanguage) {\n onSetSpokenLanguage(selectedSpokenLanguage.key.toString());\n // we only need to call set spoken language once when first starting captions\n setHasSetSpokenLanguage(true);\n }\n }, [isCaptionsFeatureActive, onSetSpokenLanguage, selectedSpokenLanguage.key, hasSetSpokenLanguage]);\n\n const onDismiss = useCallback((): void => {\n if (onDismissCaptionsSettings) {\n onDismissCaptionsSettings();\n }\n }, [onDismissCaptionsSettings]);\n\n const onConfirm = useCallback(async (): Promise<void> => {\n const spokenLanguageCode = selectedSpokenLanguage.key.toString();\n const captionLanguageCode = selectedCaptionLanguage.key.toString();\n if (isCaptionsFeatureActive) {\n onSetSpokenLanguage(spokenLanguageCode);\n onSetCaptionLanguage(captionLanguageCode);\n } else {\n await onStartCaptions({ spokenLanguage: spokenLanguageCode });\n }\n onDismiss();\n }, [\n onDismiss,\n isCaptionsFeatureActive,\n onSetSpokenLanguage,\n onSetCaptionLanguage,\n onStartCaptions,\n selectedSpokenLanguage.key,\n selectedCaptionLanguage.key\n ]);\n\n const spokenLanguageDropdownOptions: IDropdownOption[] = useMemo(() => {\n return supportedSpokenLanguages.map((languageCode) => {\n return {\n key: languageCode,\n text: spokenLanguageStrings ? spokenLanguageStrings[languageCode] : languageCode\n };\n });\n }, [supportedSpokenLanguages, spokenLanguageStrings]);\n\n const captionLanguageDropdownOptions: IDropdownOption[] = useMemo(() => {\n return supportedCaptionLanguages.map((languageCode) => {\n return {\n key: languageCode,\n text: captionLanguageStrings ? captionLanguageStrings[languageCode] : languageCode\n };\n });\n }, [supportedCaptionLanguages, captionLanguageStrings]);\n\n const sortedSpokenLanguageDropdownOptions: IDropdownOption[] = useMemo(() => {\n const copy = [...spokenLanguageDropdownOptions];\n return copy.sort((a, b) => (a.text > b.text ? 1 : -1));\n }, [spokenLanguageDropdownOptions]);\n\n const sortedCaptionLanguageDropdownOptions: IDropdownOption[] = useMemo(() => {\n const copy = [...captionLanguageDropdownOptions];\n return copy.sort((a, b) => (a.text > b.text ? 1 : -1));\n }, [captionLanguageDropdownOptions]);\n\n const onSpokenLanguageChange = (\n event: React.FormEvent<HTMLDivElement>,\n option: IDropdownOption | undefined\n ): void => {\n if (option) {\n setSelectedSpokenLanguage(option);\n }\n };\n\n const onCaptionLanguageChange = (\n event: React.FormEvent<HTMLDivElement>,\n option: IDropdownOption | undefined\n ): void => {\n if (option) {\n setSelectedCaptionLanguage(option);\n }\n };\n\n const calloutProps = useMemo(\n () => ({\n preventDismissOnEvent: _preventDismissOnEvent\n }),\n []\n );\n\n const CaptionsSettingsComponent = useCallback((): JSX.Element => {\n const placeholderSpokenLanguage = currentSpokenLanguage !== '' ? currentSpokenLanguage : defaultSpokenLanguage;\n const placeholderCaptionLanguage =\n currentCaptionLanguage !== ''\n ? currentCaptionLanguage\n : _spokenLanguageToCaptionLanguage[placeholderSpokenLanguage];\n return (\n <Stack>\n <Dropdown\n label={strings?.captionsSettingsSpokenLanguageDropdownLabel}\n selectedKey={selectedSpokenLanguage ? selectedSpokenLanguage.key : undefined}\n onChange={onSpokenLanguageChange}\n calloutProps={calloutProps}\n placeholder={placeholderSpokenLanguage}\n options={sortedSpokenLanguageDropdownOptions}\n styles={dropdownStyles}\n />\n <Text className={dropdownInfoTextStyle(theme)}>{strings?.captionsSettingsSpokenLanguageDropdownInfoText}</Text>\n {changeCaptionLanguage && (\n <>\n <Dropdown\n label={strings?.captionsSettingsCaptionLanguageDropdownLabel}\n selectedKey={selectedCaptionLanguage ? selectedCaptionLanguage.key : undefined}\n onChange={onCaptionLanguageChange}\n calloutProps={calloutProps}\n placeholder={placeholderCaptionLanguage}\n options={sortedCaptionLanguageDropdownOptions}\n styles={dropdownStyles}\n />\n <Text className={dropdownInfoTextStyle(theme)}>\n {strings?.captionsSettingsCaptionLanguageDropdownInfoText}\n </Text>\n </>\n )}\n </Stack>\n );\n }, [\n calloutProps,\n currentSpokenLanguage,\n currentCaptionLanguage,\n sortedSpokenLanguageDropdownOptions,\n sortedCaptionLanguageDropdownOptions,\n selectedCaptionLanguage,\n selectedSpokenLanguage,\n strings?.captionsSettingsSpokenLanguageDropdownInfoText,\n strings?.captionsSettingsCaptionLanguageDropdownLabel,\n strings?.captionsSettingsSpokenLanguageDropdownLabel,\n strings?.captionsSettingsCaptionLanguageDropdownInfoText,\n theme,\n changeCaptionLanguage\n ]);\n\n const CaptionsSettingsModalStyle: Partial<IModalStyles> = useMemo(\n () => themedCaptionsSettingsModalStyle(theme),\n [theme]\n );\n\n return (\n <>\n {\n <Modal\n titleAriaId={strings?.captionsSettingsModalAriaLabel}\n isOpen={showModal}\n onDismiss={onDismiss}\n isBlocking={true}\n styles={CaptionsSettingsModalStyle}\n >\n <Stack horizontal horizontalAlign=\"space-between\" verticalAlign=\"center\" className={titleContainerClassName}>\n <Text className={titleClassName}>{strings?.captionsSettingsModalTitle}</Text>\n <IconButton\n iconProps={{ iconName: 'Cancel' }}\n ariaLabel={strings?.captionsSettingsCloseModalButtonAriaLabel}\n onClick={onDismiss}\n style={{ color: theme.palette.black }}\n />\n </Stack>\n\n <Stack className={dropdownContainerClassName}>{CaptionsSettingsComponent()}</Stack>\n <Stack horizontal horizontalAlign=\"end\" className={buttonsContainerClassName}>\n <PrimaryButton styles={buttonStyles(theme)} onClick={onConfirm}>\n <span>{strings?.captionsSettingsConfirmButtonLabel}</span>\n </PrimaryButton>\n <DefaultButton onClick={onDismiss} styles={buttonStyles(theme)}>\n <span>{strings?.captionsSettingsCancelButtonLabel}</span>\n </DefaultButton>\n </Stack>\n </Modal>\n }\n </>\n );\n};\n"]}
|
1
|
+
{"version":3,"file":"CaptionsSettingsModal.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/CaptionsSettingsModal.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC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react';\nimport { useMemo, useState, useEffect } from 'react';\nimport {\n IModalStyles,\n Modal,\n Stack,\n useTheme,\n Text,\n IconButton,\n Dropdown,\n IDropdownOption,\n DefaultButton,\n PrimaryButton\n} from '@fluentui/react';\n\nimport {\n buttonsContainerClassName,\n buttonStyles,\n dropdownContainerClassName,\n dropdownInfoTextStyle,\n dropdownStyles,\n themedCaptionsSettingsModalStyle,\n titleClassName,\n titleContainerClassName\n} from './styles/CaptionsSettingsModal.styles';\nimport { _captionsOptions } from './StartCaptionsButton';\nimport { defaultSpokenLanguage } from './utils';\nimport {\n SpokenLanguageStrings,\n CaptionLanguageStrings,\n _spokenLanguageToCaptionLanguage,\n _SupportedSpokenLanguage,\n _SupportedCaptionLanguage,\n SpokenLanguageDropdownOptions,\n CaptionLanguageDropdownOptions\n} from '../types';\nimport { _preventDismissOnEvent } from '@internal/acs-ui-common';\n\n/**\n * @internal\n * strings for captions setting modal\n */\nexport interface _CaptionsSettingsModalStrings {\n captionsSettingsModalTitle?: string;\n captionsSettingsSpokenLanguageDropdownLabel?: string;\n captionsSettingsCaptionLanguageDropdownLabel?: string;\n captionsSettingsSpokenLanguageDropdownInfoText?: string;\n captionsSettingsCaptionLanguageDropdownInfoText?: string;\n captionsSettingsConfirmButtonLabel?: string;\n captionsSettingsCancelButtonLabel?: string;\n captionsSettingsModalAriaLabel?: string;\n captionsSettingsCloseModalButtonAriaLabel?: string;\n}\n\n/**\n * @internal\n * _CaptionsSettingsModal Component Props.\n */\nexport interface _CaptionsSettingsModalProps {\n supportedSpokenLanguages: _SupportedSpokenLanguage[];\n supportedCaptionLanguages: _SupportedCaptionLanguage[];\n onSetSpokenLanguage: (language: _SupportedSpokenLanguage) => Promise<void>;\n onSetCaptionLanguage: (language: _SupportedCaptionLanguage) => Promise<void>;\n onStartCaptions: (options?: _captionsOptions) => Promise<void>;\n currentSpokenLanguage: _SupportedSpokenLanguage;\n currentCaptionLanguage: _SupportedCaptionLanguage;\n spokenLanguageStrings?: SpokenLanguageStrings;\n captionLanguageStrings?: CaptionLanguageStrings;\n isCaptionsFeatureActive?: boolean;\n strings?: _CaptionsSettingsModalStrings;\n showModal?: boolean;\n onDismissCaptionsSettings?: () => void;\n changeCaptionLanguage?: boolean;\n}\n\n/**\n * @internal\n * a component for setting spoken languages\n */\nexport const _CaptionsSettingsModal = (props: _CaptionsSettingsModalProps): JSX.Element => {\n const {\n supportedSpokenLanguages,\n supportedCaptionLanguages,\n currentSpokenLanguage,\n currentCaptionLanguage,\n isCaptionsFeatureActive,\n showModal,\n onSetSpokenLanguage,\n onSetCaptionLanguage,\n onDismissCaptionsSettings,\n onStartCaptions,\n strings,\n spokenLanguageStrings,\n captionLanguageStrings,\n changeCaptionLanguage = false\n } = props;\n\n const theme = useTheme();\n\n const [hasSetSpokenLanguage, setHasSetSpokenLanguage] = useState(false);\n\n const [selectedSpokenLanguage, setSelectedSpokenLanguage] = useState<SpokenLanguageDropdownOptions>({\n key: currentSpokenLanguage ?? defaultSpokenLanguage,\n text: currentSpokenLanguage ?? defaultSpokenLanguage\n });\n\n const [selectedCaptionLanguage, setSelectedCaptionLanguage] = useState<CaptionLanguageDropdownOptions>({\n key: currentCaptionLanguage ?? _spokenLanguageToCaptionLanguage[selectedSpokenLanguage.key],\n text: currentCaptionLanguage ?? _spokenLanguageToCaptionLanguage[selectedSpokenLanguage.key]\n });\n\n useEffect(() => {\n // set spoken language when start captions with a spoken language specified.\n // this is to fix the bug when a second user starts captions with a new spoken language, captions bot ignore that spoken language\n if (isCaptionsFeatureActive && !hasSetSpokenLanguage) {\n onSetSpokenLanguage(selectedSpokenLanguage.key);\n // we only need to call set spoken language once when first starting captions\n setHasSetSpokenLanguage(true);\n }\n }, [isCaptionsFeatureActive, onSetSpokenLanguage, selectedSpokenLanguage.key, hasSetSpokenLanguage]);\n\n const onDismiss = useCallback((): void => {\n if (onDismissCaptionsSettings) {\n onDismissCaptionsSettings();\n }\n }, [onDismissCaptionsSettings]);\n\n const onConfirm = useCallback(async (): Promise<void> => {\n const spokenLanguageCode = selectedSpokenLanguage.key;\n const captionLanguageCode = selectedCaptionLanguage.key;\n if (isCaptionsFeatureActive) {\n onSetSpokenLanguage(spokenLanguageCode);\n onSetCaptionLanguage(captionLanguageCode);\n } else {\n await onStartCaptions({ spokenLanguage: spokenLanguageCode });\n }\n onDismiss();\n }, [\n onDismiss,\n isCaptionsFeatureActive,\n onSetSpokenLanguage,\n onSetCaptionLanguage,\n onStartCaptions,\n selectedSpokenLanguage.key,\n selectedCaptionLanguage.key\n ]);\n\n const spokenLanguageDropdownOptions: IDropdownOption[] = useMemo(() => {\n return supportedSpokenLanguages.map((languageCode) => {\n return {\n key: languageCode,\n text: spokenLanguageStrings ? spokenLanguageStrings[languageCode] : languageCode\n };\n });\n }, [supportedSpokenLanguages, spokenLanguageStrings]);\n\n const captionLanguageDropdownOptions: IDropdownOption[] = useMemo(() => {\n return supportedCaptionLanguages.map((languageCode) => {\n return {\n key: languageCode,\n text: captionLanguageStrings ? captionLanguageStrings[languageCode] : languageCode\n };\n });\n }, [supportedCaptionLanguages, captionLanguageStrings]);\n\n const sortedSpokenLanguageDropdownOptions: IDropdownOption[] = useMemo(() => {\n const copy = [...spokenLanguageDropdownOptions];\n return copy.sort((a, b) => (a.text > b.text ? 1 : -1));\n }, [spokenLanguageDropdownOptions]);\n\n const sortedCaptionLanguageDropdownOptions: IDropdownOption[] = useMemo(() => {\n const copy = [...captionLanguageDropdownOptions];\n return copy.sort((a, b) => (a.text > b.text ? 1 : -1));\n }, [captionLanguageDropdownOptions]);\n\n const onSpokenLanguageChange = (\n event: React.FormEvent<HTMLDivElement>,\n option: SpokenLanguageDropdownOptions | undefined\n ): void => {\n if (option) {\n setSelectedSpokenLanguage(option);\n }\n };\n\n const onCaptionLanguageChange = (\n event: React.FormEvent<HTMLDivElement>,\n option: CaptionLanguageDropdownOptions | undefined\n ): void => {\n if (option) {\n setSelectedCaptionLanguage(option);\n }\n };\n\n const calloutProps = useMemo(\n () => ({\n preventDismissOnEvent: _preventDismissOnEvent\n }),\n []\n );\n\n const CaptionsSettingsComponent = useCallback((): JSX.Element => {\n const placeholderSpokenLanguage = currentSpokenLanguage ?? defaultSpokenLanguage;\n const placeholderCaptionLanguage =\n currentCaptionLanguage ?? _spokenLanguageToCaptionLanguage[placeholderSpokenLanguage];\n return (\n <Stack>\n <Dropdown\n label={strings?.captionsSettingsSpokenLanguageDropdownLabel}\n selectedKey={selectedSpokenLanguage ? selectedSpokenLanguage.key : undefined}\n onChange={(ev, option) => onSpokenLanguageChange(ev, option as SpokenLanguageDropdownOptions)}\n calloutProps={calloutProps}\n placeholder={placeholderSpokenLanguage}\n options={sortedSpokenLanguageDropdownOptions}\n styles={dropdownStyles}\n />\n <Text className={dropdownInfoTextStyle(theme)}>{strings?.captionsSettingsSpokenLanguageDropdownInfoText}</Text>\n {changeCaptionLanguage && (\n <>\n <Dropdown\n label={strings?.captionsSettingsCaptionLanguageDropdownLabel}\n selectedKey={selectedCaptionLanguage ? selectedCaptionLanguage.key : undefined}\n onChange={(ev, option) => onCaptionLanguageChange(ev, option as CaptionLanguageDropdownOptions)}\n calloutProps={calloutProps}\n placeholder={placeholderCaptionLanguage}\n options={sortedCaptionLanguageDropdownOptions}\n styles={dropdownStyles}\n />\n <Text className={dropdownInfoTextStyle(theme)}>\n {strings?.captionsSettingsCaptionLanguageDropdownInfoText}\n </Text>\n </>\n )}\n </Stack>\n );\n }, [\n calloutProps,\n currentSpokenLanguage,\n currentCaptionLanguage,\n sortedSpokenLanguageDropdownOptions,\n sortedCaptionLanguageDropdownOptions,\n selectedCaptionLanguage,\n selectedSpokenLanguage,\n strings?.captionsSettingsSpokenLanguageDropdownInfoText,\n strings?.captionsSettingsCaptionLanguageDropdownLabel,\n strings?.captionsSettingsSpokenLanguageDropdownLabel,\n strings?.captionsSettingsCaptionLanguageDropdownInfoText,\n theme,\n changeCaptionLanguage\n ]);\n\n const CaptionsSettingsModalStyle: Partial<IModalStyles> = useMemo(\n () => themedCaptionsSettingsModalStyle(theme),\n [theme]\n );\n\n return (\n <>\n {\n <Modal\n titleAriaId={strings?.captionsSettingsModalAriaLabel}\n isOpen={showModal}\n onDismiss={onDismiss}\n isBlocking={true}\n styles={CaptionsSettingsModalStyle}\n >\n <Stack horizontal horizontalAlign=\"space-between\" verticalAlign=\"center\" className={titleContainerClassName}>\n <Text className={titleClassName}>{strings?.captionsSettingsModalTitle}</Text>\n <IconButton\n iconProps={{ iconName: 'Cancel' }}\n ariaLabel={strings?.captionsSettingsCloseModalButtonAriaLabel}\n onClick={onDismiss}\n style={{ color: theme.palette.black }}\n />\n </Stack>\n\n <Stack className={dropdownContainerClassName}>{CaptionsSettingsComponent()}</Stack>\n <Stack horizontal horizontalAlign=\"end\" className={buttonsContainerClassName}>\n <PrimaryButton styles={buttonStyles(theme)} onClick={onConfirm}>\n <span>{strings?.captionsSettingsConfirmButtonLabel}</span>\n </PrimaryButton>\n <DefaultButton onClick={onDismiss} styles={buttonStyles(theme)}>\n <span>{strings?.captionsSettingsCancelButtonLabel}</span>\n </DefaultButton>\n </Stack>\n </Modal>\n }\n </>\n );\n};\n"]}
|
@@ -77,4 +77,11 @@ export declare const dtmfFrequencies: {
|
|
77
77
|
f2: number;
|
78
78
|
};
|
79
79
|
};
|
80
|
+
/**
|
81
|
+
* Key of the mapping of the different dtmf frequencies that are needed for the creation of sound that
|
82
|
+
* matches the dtmf tones.
|
83
|
+
*
|
84
|
+
* @internal
|
85
|
+
*/
|
86
|
+
export type DtmfFrequenciesKeys = keyof typeof dtmfFrequencies;
|
80
87
|
//# sourceMappingURL=DTMFToneGenerator.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DTMFToneGenerator.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Dialpad/DTMFToneGenerator.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;GAIG;AACH,MAAM,OAAO,IAAI;IAQf,YAAY,OAAqB,EAAE,UAAkB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.\n\n/**\n * Class for playing individual DTMF Tones.\n *\n * @internal\n */\nexport class Tone {\n private context: AudioContext;\n private frequency1: number;\n private frequency2: number;\n private oscillatorNode1?: OscillatorNode;\n private oscillatorNode2?: OscillatorNode;\n private isPlaying: boolean = false;\n\n constructor(context: AudioContext, frequency1: number, frequency2: number) {\n this.context = context;\n this.frequency1 = frequency1;\n this.frequency2 = frequency2;\n }\n\n /**\n * Function to play the tone. will create new ocillators because they are one use objects so we need to make\n * new ones every time we play a tone.\n */\n public play = (): void => {\n if (this.isPlaying) {\n return;\n }\n const gainNode = this.context.createGain();\n gainNode.gain.value = 0.1;\n gainNode.connect(this.context.destination);\n\n this.oscillatorNode1 = this.context.createOscillator();\n this.oscillatorNode1.frequency.value = this.frequency1;\n this.oscillatorNode1.connect(gainNode);\n\n this.oscillatorNode2 = this.context.createOscillator();\n this.oscillatorNode2.frequency.value = this.frequency2;\n this.oscillatorNode2.connect(gainNode);\n this.oscillatorNode1.start();\n this.oscillatorNode2.start();\n this.isPlaying = true;\n };\n\n /**\n * Function to stop the tone.\n */\n public stop = (): void => {\n if (this.oscillatorNode1 && this.oscillatorNode2) {\n this.oscillatorNode1.stop();\n this.oscillatorNode2.stop();\n this.oscillatorNode1.disconnect();\n this.oscillatorNode2.disconnect();\n this.isPlaying = false;\n }\n };\n}\n\n/**\n * Mapping of the different dtmf frequencies that are needed for the creation of sound that\n * matches the dtmf tones.\n *\n * @internal\n */\nexport const dtmfFrequencies = {\n '1': { f1: 697, f2: 1209 },\n '2': { f1: 697, f2: 1336 },\n '3': { f1: 697, f2: 1477 },\n '4': { f1: 770, f2: 1209 },\n '5': { f1: 770, f2: 1336 },\n '6': { f1: 770, f2: 1477 },\n '7': { f1: 852, f2: 1209 },\n '8': { f1: 852, f2: 1336 },\n '9': { f1: 852, f2: 1477 },\n '*': { f1: 941, f2: 1209 },\n '0': { f1: 941, f2: 1336 },\n '#': { f1: 941, f2: 1477 }\n};\n"]}
|
1
|
+
{"version":3,"file":"D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AAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE;IAC1B,GAAG,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE;CAC3B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Class for playing individual DTMF Tones.\n *\n * @internal\n */\nexport class Tone {\n private context: AudioContext;\n private frequency1: number;\n private frequency2: number;\n private oscillatorNode1?: OscillatorNode;\n private oscillatorNode2?: OscillatorNode;\n private isPlaying: boolean = false;\n\n constructor(context: AudioContext, frequency1: number, frequency2: number) {\n this.context = context;\n this.frequency1 = frequency1;\n this.frequency2 = frequency2;\n }\n\n /**\n * Function to play the tone. will create new ocillators because they are one use objects so we need to make\n * new ones every time we play a tone.\n */\n public play = (): void => {\n if (this.isPlaying) {\n return;\n }\n const gainNode = this.context.createGain();\n gainNode.gain.value = 0.1;\n gainNode.connect(this.context.destination);\n\n this.oscillatorNode1 = this.context.createOscillator();\n this.oscillatorNode1.frequency.value = this.frequency1;\n this.oscillatorNode1.connect(gainNode);\n\n this.oscillatorNode2 = this.context.createOscillator();\n this.oscillatorNode2.frequency.value = this.frequency2;\n this.oscillatorNode2.connect(gainNode);\n this.oscillatorNode1.start();\n this.oscillatorNode2.start();\n this.isPlaying = true;\n };\n\n /**\n * Function to stop the tone.\n */\n public stop = (): void => {\n if (this.oscillatorNode1 && this.oscillatorNode2) {\n this.oscillatorNode1.stop();\n this.oscillatorNode2.stop();\n this.oscillatorNode1.disconnect();\n this.oscillatorNode2.disconnect();\n this.isPlaying = false;\n }\n };\n}\n\n/**\n * Mapping of the different dtmf frequencies that are needed for the creation of sound that\n * matches the dtmf tones.\n *\n * @internal\n */\nexport const dtmfFrequencies = {\n '1': { f1: 697, f2: 1209 },\n '2': { f1: 697, f2: 1336 },\n '3': { f1: 697, f2: 1477 },\n '4': { f1: 770, f2: 1209 },\n '5': { f1: 770, f2: 1336 },\n '6': { f1: 770, f2: 1477 },\n '7': { f1: 852, f2: 1209 },\n '8': { f1: 852, f2: 1336 },\n '9': { f1: 852, f2: 1477 },\n '*': { f1: 941, f2: 1209 },\n '0': { f1: 941, f2: 1336 },\n '#': { f1: 941, f2: 1477 }\n};\n\n/**\n * Key of the mapping of the different dtmf frequencies that are needed for the creation of sound that\n * matches the dtmf tones.\n *\n * @internal\n */\nexport type DtmfFrequenciesKeys = keyof typeof dtmfFrequencies;\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Dialpad.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Dialpad/Dialpad.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAGjD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EACL,eAAe,EACf,aAAa,EACb,SAAS,EACT,WAAW,EACX,KAAK,EACL,IAAI,EACJ,SAAS,EACT,QAAQ,EACT,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,0CAA0C;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EACL,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,YAAY,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAsH5D,MAAM,qBAAqB,GAA6B;IACtD,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,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GAAG,CAAC,KAAa,EAAU,EAAE;IAC9C,sFAAsF;IACtF,OAAO,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;AACxC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useEffect, useRef } from 'react';\nimport { IStyle, IButtonStyles, ITextFieldStyles } from '@fluentui/react';\n\nimport { IconButton } from '@fluentui/react';\nimport {\n concatStyleSets,\n DefaultButton,\n FocusZone,\n mergeStyles,\n Stack,\n Text,\n TextField,\n useTheme\n} from '@fluentui/react';\nimport { _formatString } from '@internal/acs-ui-common';\nimport { useState } from 'react';\n/* @conditional-compile-remove(dialpad) */\nimport { useLocale } from '../../localization';\nimport {\n buttonStyles,\n containerStyles,\n iconButtonStyles,\n digitStyles,\n letterStyles,\n textFieldStyles\n} from '../styles/Dialpad.styles';\nimport { formatPhoneNumber } from '../utils/formatPhoneNumber';\nimport useLongPress from '../utils/useLongPress';\n\nimport { dtmfFrequencies, Tone } from './DTMFToneGenerator';\n\n/**\n * Strings of {@link Dialpad} that can be overridden.\n *\n * @public\n */\nexport interface DialpadStrings {\n placeholderText: string;\n deleteButtonAriaLabel?: string;\n}\n\n/**\n * Styles for {@link Dialpad} component.\n *\n * @public\n */\nexport interface DialpadStyles {\n root?: IStyle;\n button?: IButtonStyles;\n textField?: Partial<ITextFieldStyles>;\n digit?: IStyle;\n letter?: IStyle;\n deleteIcon?: IButtonStyles;\n}\n\n/**\n * DTMF tone for PSTN calls.\n *\n * @public\n */\nexport type DtmfTone =\n | 'A'\n | 'B'\n | 'C'\n | 'D'\n | 'Flash'\n | 'Num0'\n | 'Num1'\n | 'Num2'\n | 'Num3'\n | 'Num4'\n | 'Num5'\n | 'Num6'\n | 'Num7'\n | 'Num8'\n | 'Num9'\n | 'Pound'\n | 'Star';\n\n/**\n * Modes of the dialpad component.\n * @public\n */\nexport type DialpadMode = 'dtmf' | 'dialer';\n\n/**\n * Modes of how the longpress handlers can be tiggered.\n * @public\n */\nexport type LongPressTrigger = 'mouseAndTouch' | 'touch';\n\n/**\n * Props for {@link Dialpad} component.\n *\n * @public\n */\nexport interface DialpadProps {\n strings?: DialpadStrings;\n /**\n * function to send dtmf tones on button click\n */\n onSendDtmfTone?: (dtmfTone: DtmfTone) => Promise<void>;\n /**\n * Callback for dialpad button behavior\n */\n onClickDialpadButton?: (buttonValue: string, buttonIndex: number) => void;\n /**\n * set dialpad textfield content\n */\n textFieldValue?: string;\n /**\n * on change function for text field, provides an unformatted plain text\n */\n onChange?: (input: string) => void;\n /**\n * flag to determine when to show/hide delete button, default true\n */\n showDeleteButton?: boolean;\n /**\n * Determines what kind of device that the user is on and should respect that based on interaction\n * interfaces available to the user\n */\n longPressTrigger?: LongPressTrigger;\n /**\n * Styles for customizing the dialpad component\n */\n styles?: DialpadStyles;\n /**\n * Disables DTMF sounds when dialpad buttons are pressed. the actual\n * tones are still sent to the call.\n */\n disableDtmfPlayback?: boolean;\n /**\n * Dialer mode for the dialpad. The dtmf mode is for sending dtmf tones and the appearence of\n * the dialpad is changed like hiding the input box. When using dialer mode the input box is there\n * and can be edited to change the number being dialed.\n */\n dialpadMode?: DialpadMode;\n}\n\ntype DialpadButtonContent = {\n /** Number displayed on each dialpad button */\n digit: string;\n /** Letters displayed on each dialpad button */\n letter?: string;\n};\n\nconst dialPadButtonsDefault: DialpadButtonContent[][] = [\n [{ digit: '1' }, { digit: '2', letter: 'ABC' }, { digit: '3', letter: 'DEF' }],\n [\n { digit: '4', letter: 'GHI' },\n { digit: '5', letter: 'JKL' },\n { digit: '6', letter: 'MNO' }\n ],\n [\n { digit: '7', letter: 'PQRS' },\n { digit: '8', letter: 'TUV' },\n { digit: '9', letter: 'WXYZ' }\n ],\n [{ digit: '*' }, { digit: '0', letter: '+' }, { digit: '#' }]\n];\n\nconst DtmfTones: DtmfTone[] = [\n 'Num1',\n 'Num2',\n 'Num3',\n 'Num4',\n 'Num5',\n 'Num6',\n 'Num7',\n 'Num8',\n 'Num9',\n 'Star',\n 'Num0',\n 'Pound'\n];\n\nconst DialpadButton = (props: {\n digit: string;\n letter?: string;\n styles?: DialpadStyles;\n index: number;\n onClick: (input: string, index: number) => void;\n onLongPress: (input: string, index: number) => void;\n longPressTrigger: LongPressTrigger;\n dtmfToneAudioContext: AudioContext;\n disableDtmfPlayback?: boolean;\n}): JSX.Element => {\n const theme = useTheme();\n\n const { digit, index, onClick, onLongPress, longPressTrigger, dtmfToneAudioContext, disableDtmfPlayback } = props;\n const [buttonPressed, setButtonPressed] = useState(false);\n\n const dtmfToneSound = useRef<Tone>(\n new Tone(dtmfToneAudioContext, dtmfFrequencies[digit].f1, dtmfFrequencies[digit].f2)\n );\n\n const useLongPressProps = React.useMemo(\n () => ({\n onClick: async () => {\n onClick(digit, index);\n },\n onLongPress: async () => {\n onLongPress(digit, index);\n },\n touchEventsOnly: longPressTrigger === 'touch'\n }),\n [digit, index, longPressTrigger, onClick, onLongPress]\n );\n\n const longPressHandlers = useLongPress(useLongPressProps);\n\n return (\n <DefaultButton\n data-test-id={`dialpad-button-${props.index}`}\n styles={concatStyleSets(buttonStyles(theme), props.styles?.button)}\n {...longPressHandlers}\n onKeyDown={(e) => {\n if ((e.key === 'Enter' || e.key === ' ') && !buttonPressed) {\n if (!disableDtmfPlayback) {\n dtmfToneSound.current.play();\n }\n longPressHandlers.onKeyDown();\n setButtonPressed(true);\n return;\n }\n if (\n e.key === 'Tab' ||\n e.key === 'ArrowLeft' ||\n e.key === 'ArrowRight' ||\n e.key === 'ArrowUp' ||\n e.key === 'ArrowDown'\n ) {\n dtmfToneSound.current.stop();\n }\n longPressHandlers.onKeyDown();\n }}\n onKeyUp={(e) => {\n if ((e.key === 'Enter' || e.key === ' ') && buttonPressed) {\n dtmfToneSound.current.stop();\n longPressHandlers.onKeyUp();\n setButtonPressed(false);\n }\n longPressHandlers.onKeyUp();\n }}\n onMouseDown={() => {\n if (!disableDtmfPlayback) {\n dtmfToneSound.current.play();\n }\n longPressHandlers.onMouseDown();\n }}\n onMouseUp={() => {\n dtmfToneSound.current.stop();\n longPressHandlers.onMouseUp();\n }}\n onMouseLeave={() => {\n dtmfToneSound.current.stop();\n }}\n onTouchStart={() => {\n if (!disableDtmfPlayback) {\n dtmfToneSound.current.play();\n }\n longPressHandlers.onTouchStart();\n }}\n onTouchEnd={() => {\n dtmfToneSound.current.stop();\n longPressHandlers.onTouchEnd();\n }}\n >\n <Stack>\n <Text className={mergeStyles(digitStyles(theme), props.styles?.digit)}>{props.digit}</Text>\n\n <Text className={mergeStyles(letterStyles(theme), props.styles?.letter)}>{props.letter ?? ' '}</Text>\n </Stack>\n </DefaultButton>\n );\n};\n\nconst DialpadContainer = (props: {\n strings: DialpadStrings;\n onSendDtmfTone?: (dtmfTone: DtmfTone) => Promise<void>;\n /** Callback for dialpad button behavior */\n onClickDialpadButton?: (buttonValue: string, buttonIndex: number) => void;\n /** Pass in custom content to dialpad textfield */\n textFieldValue?: string;\n /** on change function for text field, provides an unformatted plain text */\n onChange?: (input: string) => void;\n /** boolean input to determine when to show/hide delete button, default true */\n showDeleteButton?: boolean;\n /** boolean input to determine if dialpad is in mobile view, default false */\n longPressTrigger?: LongPressTrigger;\n styles?: DialpadStyles;\n disableDtmfPlayback?: boolean;\n dialpadMode?: DialpadMode;\n}): JSX.Element => {\n const theme = useTheme();\n\n const {\n onSendDtmfTone,\n onClickDialpadButton,\n textFieldValue,\n onChange,\n showDeleteButton = true,\n longPressTrigger = 'mouseAndTouch',\n disableDtmfPlayback,\n dialpadMode = 'dialer'\n } = props;\n\n const dtmfToneAudioContext = useRef(new AudioContext());\n\n const [plainTextValue, setPlainTextValue] = useState(textFieldValue ?? '');\n const plainTextValuePreviousRenderValue = useRef(plainTextValue);\n\n useEffect(() => {\n if (plainTextValuePreviousRenderValue.current !== plainTextValue) {\n onChange?.(plainTextValue);\n }\n plainTextValuePreviousRenderValue.current = plainTextValue;\n }, [plainTextValuePreviousRenderValue, plainTextValue, onChange]);\n\n useEffect(() => {\n setText(textFieldValue ?? '');\n }, [textFieldValue]);\n\n const onClickDialpad = (input: string, index: number): void => {\n setText(plainTextValue + input);\n if (onSendDtmfTone) {\n onSendDtmfTone(DtmfTones[index]);\n }\n if (onClickDialpadButton) {\n onClickDialpadButton(input, index);\n }\n };\n\n const onLongPressDialpad = (input: string, index: number): void => {\n if (input === '0' && index === 10) {\n setText(plainTextValue + '+');\n } else {\n setText(plainTextValue + input);\n }\n if (onSendDtmfTone) {\n onSendDtmfTone(DtmfTones[index]);\n }\n if (onClickDialpadButton) {\n onClickDialpadButton(input, index);\n }\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const setText = (input: string): void => {\n // remove non-valid characters from input: letters,special characters excluding +, *,#\n const plainInput = sanitizeInput(input);\n setPlainTextValue(plainInput);\n };\n\n const deleteNumbers = (): void => {\n const modifiedInput = plainTextValue.substring(0, plainTextValue.length - 1);\n setText(modifiedInput);\n };\n\n return (\n <Stack\n className={mergeStyles(containerStyles(theme), props.styles?.root)}\n data-test-id=\"dialpadContainer\"\n data-ui-id=\"dialpadContainer\"\n horizontalAlign={'center'}\n >\n {dialpadMode === 'dialer' && (\n <TextField\n styles={concatStyleSets(textFieldStyles(theme, plainTextValue !== ''), props.styles?.textField)}\n value={textFieldValue ? textFieldValue : formatPhoneNumber(plainTextValue)}\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onChange={(e: any) => {\n setText(e.target.value);\n }}\n onClick={(e) => {\n e.preventDefault();\n }}\n placeholder={props.strings.placeholderText}\n data-test-id=\"dialpad-input\"\n onRenderSuffix={(): JSX.Element => (\n <>\n {showDeleteButton && plainTextValue.length !== 0 && (\n <IconButton\n ariaLabel={props.strings.deleteButtonAriaLabel}\n onClick={deleteNumbers}\n styles={concatStyleSets(iconButtonStyles(theme), props.styles?.deleteIcon)}\n iconProps={{ iconName: 'DialpadBackspace' }}\n />\n )}\n </>\n )}\n />\n )}\n <FocusZone>\n {dialPadButtonsDefault.map((rows, rowIndex) => {\n return (\n <Stack horizontal key={`row_${rowIndex}`} horizontalAlign=\"stretch\" tokens={{ childrenGap: '1rem' }}>\n {rows.map((button, columnIndex) => (\n <DialpadButton\n key={`button_${columnIndex}`}\n /* row index = 0\n columnIndex: (0,1,2) => (0,1,2)\n row index = 1\n columnIndex: (0,1,2)=> (3,4,5)\n row index = 2\n columnIndex: (0,1,2)=> (6,7,8)\n row index = 3\n columnIndex: (0,1,2)=> (9,10,11)\n columnIndex + rowIndex*rows.length calculates the corresponding index for each button\n dialpad index:\n 0 1 2\n 3 4 5\n 6 7 8\n 9 10 11\n then use this index to locate the corresponding dtmf tones\n DtmfTones[index]\n */\n index={columnIndex + rowIndex * rows.length}\n digit={button.digit}\n letter={button.letter}\n styles={props.styles}\n onClick={onClickDialpad}\n onLongPress={onLongPressDialpad}\n longPressTrigger={longPressTrigger}\n dtmfToneAudioContext={dtmfToneAudioContext.current}\n disableDtmfPlayback={disableDtmfPlayback}\n />\n ))}\n </Stack>\n );\n })}\n </FocusZone>\n </Stack>\n );\n};\n\n/**\n * A component to allow users to enter phone number through clicking on dialpad/using keyboard\n * It will return empty component for stable builds\n *\n * @public\n */\nexport const Dialpad = (props: DialpadProps): JSX.Element => {\n /* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */\n const localeStrings = useLocale().strings.dialpad;\n\n const dialpadLocaleStringsTrampoline = (): DialpadStrings => {\n /* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */\n return localeStrings;\n // Even though the component strings type doesn't have `DialpadStrings` in stable build,\n // the string values exist. So unsafe cast for stable build.\n return '' as unknown as DialpadStrings;\n };\n const strings = { ...dialpadLocaleStringsTrampoline(), ...props.strings };\n return <DialpadContainer strings={strings} {...props} />;\n};\n\nconst sanitizeInput = (input: string): string => {\n // remove non-valid characters from input: letters,special characters excluding +, *,#\n return input.replace(/[^\\d*#+]/g, '');\n};\n"]}
|
1
|
+
{"version":3,"file":"Dialpad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AG,IAAI,CAAC,MAAM,EAC3C,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,MAAM,EAAE,MAAM,CAAC,MAAM,EACrB,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,OAAO,EAAE,cAAc,EACvB,WAAW,EAAE,kBAAkB,EAC/B,gBAAgB,EAAE,gBAAgB,EAClC,oBAAoB,EAAE,oBAAoB,CAAC,OAAO,EAClD,mBAAmB,EAAE,mBAAmB,GACxC,CACH,CAAC,CACI,CACT,CAAC;QACJ,CAAC,CAAC,CACQ,CACN,CACT,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAmB,EAAe,EAAE;IAC1D,0CAA0C,CAAC,6CAA6C;IACxF,MAAM,aAAa,GAAG,SAAS,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;IAElD,MAAM,8BAA8B,GAAG,GAAmB,EAAE;QAC1D,0CAA0C,CAAC,6CAA6C;QACxF,OAAO,aAAa,CAAC;QACrB,wFAAwF;QACxF,4DAA4D;QAC5D,OAAO,EAA+B,CAAC;IACzC,CAAC,CAAC;IACF,MAAM,OAAO,mCAAQ,8BAA8B,EAAE,GAAK,KAAK,CAAC,OAAO,CAAE,CAAC;IAC1E,OAAO,oBAAC,gBAAgB,kBAAC,OAAO,EAAE,OAAO,IAAM,KAAK,EAAI,CAAC;AAC3D,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,KAAa,EAAU,EAAE;IAC9C,sFAAsF;IACtF,OAAO,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;AACxC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useEffect, useRef } from 'react';\nimport { IStyle, IButtonStyles, ITextFieldStyles } from '@fluentui/react';\n\nimport { IconButton } from '@fluentui/react';\nimport {\n concatStyleSets,\n DefaultButton,\n FocusZone,\n mergeStyles,\n Stack,\n Text,\n TextField,\n useTheme\n} from '@fluentui/react';\nimport { _formatString } from '@internal/acs-ui-common';\nimport { useState } from 'react';\n/* @conditional-compile-remove(dialpad) */\nimport { useLocale } from '../../localization';\nimport {\n buttonStyles,\n containerStyles,\n iconButtonStyles,\n digitStyles,\n letterStyles,\n textFieldStyles\n} from '../styles/Dialpad.styles';\nimport { formatPhoneNumber } from '../utils/formatPhoneNumber';\nimport useLongPress from '../utils/useLongPress';\n\nimport { dtmfFrequencies, DtmfFrequenciesKeys, Tone } from './DTMFToneGenerator';\n\n/**\n * Strings of {@link Dialpad} that can be overridden.\n *\n * @public\n */\nexport interface DialpadStrings {\n placeholderText: string;\n deleteButtonAriaLabel?: string;\n}\n\n/**\n * Styles for {@link Dialpad} component.\n *\n * @public\n */\nexport interface DialpadStyles {\n root?: IStyle;\n button?: IButtonStyles;\n textField?: Partial<ITextFieldStyles>;\n digit?: IStyle;\n letter?: IStyle;\n deleteIcon?: IButtonStyles;\n}\n\n/**\n * DTMF tone for PSTN calls.\n *\n * @public\n */\nexport type DtmfTone =\n | 'A'\n | 'B'\n | 'C'\n | 'D'\n | 'Flash'\n | 'Num0'\n | 'Num1'\n | 'Num2'\n | 'Num3'\n | 'Num4'\n | 'Num5'\n | 'Num6'\n | 'Num7'\n | 'Num8'\n | 'Num9'\n | 'Pound'\n | 'Star';\n\n/**\n * Modes of the dialpad component.\n * @public\n */\nexport type DialpadMode = 'dtmf' | 'dialer';\n\n/**\n * Modes of how the longpress handlers can be tiggered.\n * @public\n */\nexport type LongPressTrigger = 'mouseAndTouch' | 'touch';\n\n/**\n * Props for {@link Dialpad} component.\n *\n * @public\n */\nexport interface DialpadProps {\n strings?: DialpadStrings;\n /**\n * function to send dtmf tones on button click\n */\n onSendDtmfTone?: (dtmfTone: DtmfTone) => Promise<void>;\n /**\n * Callback for dialpad button behavior\n */\n onClickDialpadButton?: (buttonValue: string, buttonIndex: number) => void;\n /**\n * set dialpad textfield content\n */\n textFieldValue?: string;\n /**\n * on change function for text field, provides an unformatted plain text\n */\n onChange?: (input: string) => void;\n /**\n * flag to determine when to show/hide delete button, default true\n */\n showDeleteButton?: boolean;\n /**\n * Determines what kind of device that the user is on and should respect that based on interaction\n * interfaces available to the user\n */\n longPressTrigger?: LongPressTrigger;\n /**\n * Styles for customizing the dialpad component\n */\n styles?: DialpadStyles;\n /**\n * Disables DTMF sounds when dialpad buttons are pressed. the actual\n * tones are still sent to the call.\n */\n disableDtmfPlayback?: boolean;\n /**\n * Dialer mode for the dialpad. The dtmf mode is for sending dtmf tones and the appearence of\n * the dialpad is changed like hiding the input box. When using dialer mode the input box is there\n * and can be edited to change the number being dialed.\n */\n dialpadMode?: DialpadMode;\n}\n\ntype DialpadButtonContent = {\n /** Number displayed on each dialpad button */\n digit: DtmfFrequenciesKeys;\n /** Letters displayed on each dialpad button */\n letter?: string;\n};\n\nconst dialPadButtonsDefault: DialpadButtonContent[][] = [\n [{ digit: '1' }, { digit: '2', letter: 'ABC' }, { digit: '3', letter: 'DEF' }],\n [\n { digit: '4', letter: 'GHI' },\n { digit: '5', letter: 'JKL' },\n { digit: '6', letter: 'MNO' }\n ],\n [\n { digit: '7', letter: 'PQRS' },\n { digit: '8', letter: 'TUV' },\n { digit: '9', letter: 'WXYZ' }\n ],\n [{ digit: '*' }, { digit: '0', letter: '+' }, { digit: '#' }]\n];\n\nconst DtmfTones: DtmfTone[] = [\n 'Num1',\n 'Num2',\n 'Num3',\n 'Num4',\n 'Num5',\n 'Num6',\n 'Num7',\n 'Num8',\n 'Num9',\n 'Star',\n 'Num0',\n 'Pound'\n];\n\nconst DialpadButton = (props: {\n digit: DtmfFrequenciesKeys;\n letter?: string;\n styles?: DialpadStyles;\n index: number;\n onClick: (input: string, index: number) => void;\n onLongPress: (input: string, index: number) => void;\n longPressTrigger: LongPressTrigger;\n dtmfToneAudioContext: AudioContext;\n disableDtmfPlayback?: boolean;\n}): JSX.Element => {\n const theme = useTheme();\n\n const { digit, index, onClick, onLongPress, longPressTrigger, dtmfToneAudioContext, disableDtmfPlayback } = props;\n const [buttonPressed, setButtonPressed] = useState(false);\n\n const dtmfToneSound = useRef<Tone>(\n new Tone(dtmfToneAudioContext, dtmfFrequencies[digit].f1, dtmfFrequencies[digit].f2)\n );\n\n const useLongPressProps = React.useMemo(\n () => ({\n onClick: async () => {\n onClick(digit, index);\n },\n onLongPress: async () => {\n onLongPress(digit, index);\n },\n touchEventsOnly: longPressTrigger === 'touch'\n }),\n [digit, index, longPressTrigger, onClick, onLongPress]\n );\n\n const longPressHandlers = useLongPress(useLongPressProps);\n\n return (\n <DefaultButton\n data-test-id={`dialpad-button-${props.index}`}\n styles={concatStyleSets(buttonStyles(theme), props.styles?.button)}\n {...longPressHandlers}\n onKeyDown={(e) => {\n if ((e.key === 'Enter' || e.key === ' ') && !buttonPressed) {\n if (!disableDtmfPlayback) {\n dtmfToneSound.current.play();\n }\n longPressHandlers.onKeyDown();\n setButtonPressed(true);\n return;\n }\n if (\n e.key === 'Tab' ||\n e.key === 'ArrowLeft' ||\n e.key === 'ArrowRight' ||\n e.key === 'ArrowUp' ||\n e.key === 'ArrowDown'\n ) {\n dtmfToneSound.current.stop();\n }\n longPressHandlers.onKeyDown();\n }}\n onKeyUp={(e) => {\n if ((e.key === 'Enter' || e.key === ' ') && buttonPressed) {\n dtmfToneSound.current.stop();\n longPressHandlers.onKeyUp();\n setButtonPressed(false);\n }\n longPressHandlers.onKeyUp();\n }}\n onMouseDown={() => {\n if (!disableDtmfPlayback) {\n dtmfToneSound.current.play();\n }\n longPressHandlers.onMouseDown();\n }}\n onMouseUp={() => {\n dtmfToneSound.current.stop();\n longPressHandlers.onMouseUp();\n }}\n onMouseLeave={() => {\n dtmfToneSound.current.stop();\n }}\n onTouchStart={() => {\n if (!disableDtmfPlayback) {\n dtmfToneSound.current.play();\n }\n longPressHandlers.onTouchStart();\n }}\n onTouchEnd={() => {\n dtmfToneSound.current.stop();\n longPressHandlers.onTouchEnd();\n }}\n >\n <Stack>\n <Text className={mergeStyles(digitStyles(theme), props.styles?.digit)}>{props.digit}</Text>\n\n <Text className={mergeStyles(letterStyles(theme), props.styles?.letter)}>{props.letter ?? ' '}</Text>\n </Stack>\n </DefaultButton>\n );\n};\n\nconst DialpadContainer = (props: {\n strings: DialpadStrings;\n onSendDtmfTone?: (dtmfTone: DtmfTone) => Promise<void>;\n /** Callback for dialpad button behavior */\n onClickDialpadButton?: (buttonValue: string, buttonIndex: number) => void;\n /** Pass in custom content to dialpad textfield */\n textFieldValue?: string;\n /** on change function for text field, provides an unformatted plain text */\n onChange?: (input: string) => void;\n /** boolean input to determine when to show/hide delete button, default true */\n showDeleteButton?: boolean;\n /** boolean input to determine if dialpad is in mobile view, default false */\n longPressTrigger?: LongPressTrigger;\n styles?: DialpadStyles;\n disableDtmfPlayback?: boolean;\n dialpadMode?: DialpadMode;\n}): JSX.Element => {\n const theme = useTheme();\n\n const {\n onSendDtmfTone,\n onClickDialpadButton,\n textFieldValue,\n onChange,\n showDeleteButton = true,\n longPressTrigger = 'mouseAndTouch',\n disableDtmfPlayback,\n dialpadMode = 'dialer'\n } = props;\n\n const dtmfToneAudioContext = useRef(new AudioContext());\n\n const [plainTextValue, setPlainTextValue] = useState(textFieldValue ?? '');\n const plainTextValuePreviousRenderValue = useRef(plainTextValue);\n\n useEffect(() => {\n if (plainTextValuePreviousRenderValue.current !== plainTextValue) {\n onChange?.(plainTextValue);\n }\n plainTextValuePreviousRenderValue.current = plainTextValue;\n }, [plainTextValuePreviousRenderValue, plainTextValue, onChange]);\n\n useEffect(() => {\n setText(textFieldValue ?? '');\n }, [textFieldValue]);\n\n const onClickDialpad = (input: string, index: number): void => {\n setText(plainTextValue + input);\n if (onSendDtmfTone) {\n onSendDtmfTone(DtmfTones[index]);\n }\n if (onClickDialpadButton) {\n onClickDialpadButton(input, index);\n }\n };\n\n const onLongPressDialpad = (input: string, index: number): void => {\n if (input === '0' && index === 10) {\n setText(plainTextValue + '+');\n } else {\n setText(plainTextValue + input);\n }\n if (onSendDtmfTone) {\n onSendDtmfTone(DtmfTones[index]);\n }\n if (onClickDialpadButton) {\n onClickDialpadButton(input, index);\n }\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const setText = (input: string): void => {\n // remove non-valid characters from input: letters,special characters excluding +, *,#\n const plainInput = sanitizeInput(input);\n setPlainTextValue(plainInput);\n };\n\n const deleteNumbers = (): void => {\n const modifiedInput = plainTextValue.substring(0, plainTextValue.length - 1);\n setText(modifiedInput);\n };\n\n return (\n <Stack\n className={mergeStyles(containerStyles(theme), props.styles?.root)}\n data-test-id=\"dialpadContainer\"\n data-ui-id=\"dialpadContainer\"\n horizontalAlign={'center'}\n >\n {dialpadMode === 'dialer' && (\n <TextField\n styles={concatStyleSets(textFieldStyles(theme, plainTextValue !== ''), props.styles?.textField)}\n value={textFieldValue ? textFieldValue : formatPhoneNumber(plainTextValue)}\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onChange={(e: any) => {\n setText(e.target.value);\n }}\n onClick={(e) => {\n e.preventDefault();\n }}\n placeholder={props.strings.placeholderText}\n data-test-id=\"dialpad-input\"\n onRenderSuffix={(): JSX.Element => (\n <>\n {showDeleteButton && plainTextValue.length !== 0 && (\n <IconButton\n ariaLabel={props.strings.deleteButtonAriaLabel}\n onClick={deleteNumbers}\n styles={concatStyleSets(iconButtonStyles(theme), props.styles?.deleteIcon)}\n iconProps={{ iconName: 'DialpadBackspace' }}\n />\n )}\n </>\n )}\n />\n )}\n <FocusZone>\n {dialPadButtonsDefault.map((rows, rowIndex) => {\n return (\n <Stack horizontal key={`row_${rowIndex}`} horizontalAlign=\"stretch\" tokens={{ childrenGap: '1rem' }}>\n {rows.map((button, columnIndex) => (\n <DialpadButton\n key={`button_${columnIndex}`}\n /* row index = 0\n columnIndex: (0,1,2) => (0,1,2)\n row index = 1\n columnIndex: (0,1,2)=> (3,4,5)\n row index = 2\n columnIndex: (0,1,2)=> (6,7,8)\n row index = 3\n columnIndex: (0,1,2)=> (9,10,11)\n columnIndex + rowIndex*rows.length calculates the corresponding index for each button\n dialpad index:\n 0 1 2\n 3 4 5\n 6 7 8\n 9 10 11\n then use this index to locate the corresponding dtmf tones\n DtmfTones[index]\n */\n index={columnIndex + rowIndex * rows.length}\n digit={button.digit}\n letter={button.letter}\n styles={props.styles}\n onClick={onClickDialpad}\n onLongPress={onLongPressDialpad}\n longPressTrigger={longPressTrigger}\n dtmfToneAudioContext={dtmfToneAudioContext.current}\n disableDtmfPlayback={disableDtmfPlayback}\n />\n ))}\n </Stack>\n );\n })}\n </FocusZone>\n </Stack>\n );\n};\n\n/**\n * A component to allow users to enter phone number through clicking on dialpad/using keyboard\n * It will return empty component for stable builds\n *\n * @public\n */\nexport const Dialpad = (props: DialpadProps): JSX.Element => {\n /* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */\n const localeStrings = useLocale().strings.dialpad;\n\n const dialpadLocaleStringsTrampoline = (): DialpadStrings => {\n /* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */\n return localeStrings;\n // Even though the component strings type doesn't have `DialpadStrings` in stable build,\n // the string values exist. So unsafe cast for stable build.\n return '' as unknown as DialpadStrings;\n };\n const strings = { ...dialpadLocaleStringsTrampoline(), ...props.strings };\n return <DialpadContainer strings={strings} {...props} />;\n};\n\nconst sanitizeInput = (input: string): string => {\n // remove non-valid characters from input: letters,special characters excluding +, *,#\n return input.replace(/[^\\d*#+]/g, '');\n};\n"]}
|
@@ -13,11 +13,11 @@ import { useLocalVideoStreamLifecycleMaintainer } from './VideoGallery/useVideoS
|
|
13
13
|
import { VideoTile } from './VideoTile';
|
14
14
|
/* @conditional-compile-remove(spotlight) */
|
15
15
|
import { useTheme } from '../theming';
|
16
|
-
/* @conditional-compile-remove(
|
16
|
+
/* @conditional-compile-remove(spotlight) */
|
17
17
|
import { useVideoTileContextualMenuProps } from './VideoGallery/useVideoTileContextualMenuProps';
|
18
|
-
/* @conditional-compile-remove(
|
18
|
+
/* @conditional-compile-remove(spotlight) */
|
19
19
|
import { _DrawerMenu } from './Drawer';
|
20
|
-
/* @conditional-compile-remove(
|
20
|
+
/* @conditional-compile-remove(spotlight) */
|
21
21
|
import { drawerMenuWrapperStyles } from './VideoGallery/styles/RemoteVideoTile.styles';
|
22
22
|
/**
|
23
23
|
* A memoized version of VideoTile for rendering local participant.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"LocalVideoTile.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/LocalVideoTile.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACrD,4CAA4C;AAC5C,OAAO,EAAE,eAAe,EAAwB,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,mCAAgC;AACxD,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,4CAA4C;AAC5C,OAAO,EAAiB,WAAW,EAAE,MAAM,OAAO,CAAC;AAInD,OAAO,EAAE,2BAA2B,EAAoC,MAAM,0BAA0B,CAAC;AACzG,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACL,sCAAsC,EAEvC,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAwB,MAAM,aAAa,CAAC;AAG9D,4CAA4C;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,2CAA2C;AAC3C,OAAO,EAAE,+BAA+B,EAAE,MAAM,gDAAgD,CAAC;AAGjG,2CAA2C;AAC3C,OAAO,EAAE,WAAW,EAAwB,MAAM,UAAU,CAAC;AAC7D,2CAA2C;AAC3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AACvF;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC,IAAI,C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B,CAAA,gCAAgC,aAAhC,gCAAgC,uBAAhC,gCAAgC,CAAE,OAAO,MAAK,SAAS;QACvD,CAAA,gCAAgC,aAAhC,gCAAgC,uBAAhC,gCAAgC,CAAE,cAAc,MAAK,SAAS;QAC9D,CAAA,gCAAgC,aAAhC,gCAAgC,uBAAhC,gCAAgC,CAAE,cAAc,MAAK,SAAS,IAAI,CAChE,oBAAC,2BAA2B,IAC1B,OAAO,EAAE,gCAAgC,CAAC,OAAO,EACjD,cAAc,EAAE,gCAAgC,CAAC,cAAc,EAC/D,cAAc,EAAE,gCAAgC,CAAC,cAAc,EAC/D,KAAK,EAAE,6BAA6B,EACpC,eAAe,EAAE,eAAe,GAChC,CACH,CACG,CACT,CAAC;AACJ,CAAC,CAAC;AAEF,4CAA4C;AAC5C,MAAM,+CAA+C,GAAG,CACtD,mBAA0C,EAC1C,cAA2B,EACH,EAAE;IAC1B,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACzB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,mBAAmB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAC5C,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,GAAG;YACjB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,WAAW,EAAE,GAAG,EAAE;;gBAChB,MAAA,IAAI,CAAC,OAAO,oDAAI,CAAC;gBACjB,cAAc,aAAd,cAAc,uBAAd,cAAc,EAAI,CAAC;YACrB,CAAC;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { mergeStyles, Stack } from '@fluentui/react';\n/* @conditional-compile-remove(spotlight) */\nimport { concatStyleSets, IContextualMenuProps, Layer } from '@fluentui/react';\nimport { _formatString } from '@internal/acs-ui-common';\nimport React, { useMemo } from 'react';\n/* @conditional-compile-remove(spotlight) */\nimport { KeyboardEvent, useCallback } from 'react';\nimport { OnRenderAvatarCallback, VideoStreamOptions, CreateVideoStreamViewResult } from '../types';\n/* @conditional-compile-remove(reaction) */\nimport { Reaction } from '../types';\nimport { LocalVideoCameraCycleButton, LocalVideoCameraCycleButtonProps } from './LocalVideoCameraButton';\nimport { StreamMedia } from './StreamMedia';\nimport {\n useLocalVideoStreamLifecycleMaintainer,\n LocalVideoStreamLifecycleMaintainerProps\n} from './VideoGallery/useVideoStreamLifecycleMaintainer';\nimport { VideoTile, VideoTileStylesProps } from './VideoTile';\n/* @conditional-compile-remove(raise-hand) */\nimport { RaisedHand } from '../types';\n/* @conditional-compile-remove(spotlight) */\nimport { useTheme } from '../theming';\n/* @conditional-compile-remove(reaction) */\nimport { ReactionResources } from '../types/ReactionTypes';\n/* @conditional-compile-remove(reaction) */\nimport { useVideoTileContextualMenuProps } from './VideoGallery/useVideoTileContextualMenuProps';\n/* @conditional-compile-remove(reaction) */\nimport { VideoGalleryStrings } from './VideoGallery';\n/* @conditional-compile-remove(reaction) */\nimport { _DrawerMenu, _DrawerMenuItemProps } from './Drawer';\n/* @conditional-compile-remove(reaction) */\nimport { drawerMenuWrapperStyles } from './VideoGallery/styles/RemoteVideoTile.styles';\n/**\n * A memoized version of VideoTile for rendering local participant.\n *\n * @internal\n */\nexport const _LocalVideoTile = React.memo(\n (props: {\n userId?: string;\n onCreateLocalStreamView?: (options?: VideoStreamOptions) => Promise<void | CreateVideoStreamViewResult>;\n onDisposeLocalStreamView?: () => void;\n isAvailable?: boolean;\n isMuted?: boolean;\n renderElement?: HTMLElement;\n displayName?: string;\n initialsName?: string;\n localVideoViewOptions?: VideoStreamOptions;\n onRenderAvatar?: OnRenderAvatarCallback;\n showLabel: boolean;\n showMuteIndicator?: boolean;\n showCameraSwitcherInLocalPreview?: boolean;\n localVideoCameraCycleButtonProps?: LocalVideoCameraCycleButtonProps;\n localVideoCameraSwitcherLabel?: string;\n localVideoSelectedDescription?: string;\n styles?: VideoTileStylesProps;\n personaMinSize?: number;\n /* @conditional-compile-remove(raise-hand) */\n raisedHand?: RaisedHand;\n /* @conditional-compile-remove(reaction) */\n reaction?: Reaction;\n /* @conditional-compile-remove(spotlight) */\n spotlightedParticipantUserIds?: string[];\n /* @conditional-compile-remove(spotlight) */\n isSpotlighted?: boolean;\n /* @conditional-compile-remove(spotlight) */\n onStartSpotlight?: () => void;\n /* @conditional-compile-remove(spotlight) */\n onStopSpotlight?: () => void;\n /* @conditional-compile-remove(spotlight) */\n maxParticipantsToSpotlight?: number;\n /* @conditional-compile-remove(spotlight) */\n menuKind?: 'contextual' | 'drawer';\n /* @conditional-compile-remove(spotlight) */\n drawerMenuHostId?: string;\n /* @conditional-compile-remove(spotlight) */\n strings?: VideoGalleryStrings;\n /* @conditional-compile-remove(reaction) */\n reactionResources?: ReactionResources;\n }) => {\n const {\n isAvailable,\n isMuted,\n onCreateLocalStreamView,\n onDisposeLocalStreamView,\n localVideoViewOptions,\n renderElement,\n userId,\n showLabel,\n displayName,\n initialsName,\n onRenderAvatar,\n showMuteIndicator,\n styles,\n showCameraSwitcherInLocalPreview,\n localVideoCameraCycleButtonProps,\n localVideoCameraSwitcherLabel,\n localVideoSelectedDescription,\n /* @conditional-compile-remove(raise-hand) */\n raisedHand,\n /* @conditional-compile-remove(reaction) */\n reaction,\n /* @conditional-compile-remove(spotlight) */\n isSpotlighted,\n /* @conditional-compile-remove(spotlight) */\n spotlightedParticipantUserIds,\n /* @conditional-compile-remove(spotlight) */\n onStartSpotlight,\n /* @conditional-compile-remove(spotlight) */\n onStopSpotlight,\n /* @conditional-compile-remove(spotlight) */\n maxParticipantsToSpotlight,\n /* @conditional-compile-remove(spotlight) */\n menuKind,\n /* @conditional-compile-remove(spotlight) */\n strings,\n /* @conditional-compile-remove(reaction) */\n reactionResources\n } = props;\n\n /* @conditional-compile-remove(spotlight) */\n const theme = useTheme();\n\n const localVideoStreamProps: LocalVideoStreamLifecycleMaintainerProps = useMemo(\n () => ({\n isMirrored: localVideoViewOptions?.isMirrored,\n isStreamAvailable: isAvailable,\n onCreateLocalStreamView,\n onDisposeLocalStreamView,\n renderElementExists: !!renderElement,\n scalingMode: localVideoViewOptions?.scalingMode\n }),\n [\n isAvailable,\n localVideoViewOptions?.isMirrored,\n localVideoViewOptions?.scalingMode,\n onCreateLocalStreamView,\n onDisposeLocalStreamView,\n renderElement\n ]\n );\n\n // Handle creating, destroying and updating the video stream as necessary\n useLocalVideoStreamLifecycleMaintainer(localVideoStreamProps);\n\n /* @conditional-compile-remove(spotlight) */\n const contextualMenuProps = useVideoTileContextualMenuProps({\n participant: { userId: userId ?? '' },\n strings: { ...strings },\n spotlightedParticipantUserIds,\n isSpotlighted,\n onStartSpotlight,\n onStopSpotlight,\n maxParticipantsToSpotlight,\n myUserId: userId\n });\n\n const videoTileContextualMenuProps = useMemo(() => {\n /* @conditional-compile-remove(spotlight) */\n if (menuKind !== 'contextual' || !contextualMenuProps) {\n return {};\n }\n /* @conditional-compile-remove(spotlight) */\n return {\n contextualMenu: contextualMenuProps\n };\n return {};\n }, [\n /* @conditional-compile-remove(spotlight) */ contextualMenuProps,\n /* @conditional-compile-remove(spotlight) */ menuKind\n ]);\n\n const videoTileStyles = useMemo(() => {\n /* @conditional-compile-remove(spotlight) */\n if (isSpotlighted) {\n return concatStyleSets(\n {\n root: {\n outline: `0.25rem solid ${theme.palette.neutralTertiaryAlt}`,\n outlineOffset: '-0.25rem'\n }\n },\n styles\n );\n }\n return styles;\n }, [\n /* @conditional-compile-remove(spotlight) */ isSpotlighted,\n /* @conditional-compile-remove(spotlight) */ theme.palette.neutralTertiaryAlt,\n styles\n ]);\n\n /* @conditional-compile-remove(spotlight) */\n const [drawerMenuItemProps, setDrawerMenuItemProps] = React.useState<_DrawerMenuItemProps[]>([]);\n\n /* @conditional-compile-remove(spotlight) */\n const onKeyDown = useCallback(\n (e: KeyboardEvent) => {\n if (e.key === 'Enter') {\n setDrawerMenuItemProps(\n convertContextualMenuItemsToDrawerMenuItemProps(contextualMenuProps, () => setDrawerMenuItemProps([]))\n );\n }\n },\n [setDrawerMenuItemProps, contextualMenuProps]\n );\n\n const renderVideoStreamElement = useMemo(() => {\n // Checking if renderElement is well defined or not as calling SDK has a number of video streams limitation which\n // implies that, after their threshold, all streams have no child (blank video)\n if (!renderElement || !renderElement.childElementCount) {\n // Returning `undefined` results in the placeholder with avatar being shown\n return undefined;\n }\n\n return (\n <>\n <FloatingLocalCameraCycleButton\n showCameraSwitcherInLocalPreview={showCameraSwitcherInLocalPreview ?? false}\n localVideoCameraCycleButtonProps={localVideoCameraCycleButtonProps}\n localVideoCameraSwitcherLabel={localVideoCameraSwitcherLabel}\n localVideoSelectedDescription={localVideoSelectedDescription}\n />\n <StreamMedia videoStreamElement={renderElement} isMirrored={true} />\n </>\n );\n }, [\n localVideoCameraCycleButtonProps,\n localVideoCameraSwitcherLabel,\n localVideoSelectedDescription,\n renderElement,\n showCameraSwitcherInLocalPreview\n ]);\n\n return (\n <Stack\n className={mergeStyles({ width: '100%', height: '100%' })}\n /* @conditional-compile-remove(spotlight) */ onKeyDown={menuKind === 'drawer' ? onKeyDown : undefined}\n >\n <VideoTile\n key={userId ?? 'local-video-tile'}\n userId={userId}\n renderElement={renderVideoStreamElement}\n showLabel={showLabel}\n displayName={displayName}\n initialsName={initialsName}\n styles={videoTileStyles}\n onRenderPlaceholder={onRenderAvatar}\n isMuted={isMuted}\n showMuteIndicator={showMuteIndicator}\n personaMinSize={props.personaMinSize}\n /* @conditional-compile-remove(raise-hand) */\n raisedHand={raisedHand}\n /* @conditional-compile-remove(reaction) */\n reaction={reaction}\n /* @conditional-compile-remove(spotlight) */\n isSpotlighted={isSpotlighted}\n {...videoTileContextualMenuProps}\n /* @conditional-compile-remove(spotlight) */\n onLongTouch={() =>\n setDrawerMenuItemProps(\n convertContextualMenuItemsToDrawerMenuItemProps(contextualMenuProps, () => setDrawerMenuItemProps([]))\n )\n }\n /* @conditional-compile-remove(reaction) */\n reactionResources={reactionResources}\n >\n {\n /* @conditional-compile-remove(spotlight) */ drawerMenuItemProps.length > 0 && (\n <Layer hostId={props.drawerMenuHostId}>\n <Stack styles={drawerMenuWrapperStyles}>\n <_DrawerMenu onLightDismiss={() => setDrawerMenuItemProps([])} items={drawerMenuItemProps} />\n </Stack>\n </Layer>\n )\n }\n </VideoTile>\n </Stack>\n );\n }\n);\n\nconst FloatingLocalCameraCycleButton = (props: {\n showCameraSwitcherInLocalPreview: boolean;\n localVideoCameraCycleButtonProps?: LocalVideoCameraCycleButtonProps;\n localVideoCameraSwitcherLabel?: string;\n localVideoSelectedDescription?: string;\n}): JSX.Element => {\n const {\n showCameraSwitcherInLocalPreview,\n localVideoCameraCycleButtonProps,\n localVideoCameraSwitcherLabel,\n localVideoSelectedDescription\n } = props;\n const ariaDescription =\n localVideoCameraCycleButtonProps?.selectedCamera &&\n localVideoSelectedDescription &&\n _formatString(localVideoSelectedDescription, {\n cameraName: localVideoCameraCycleButtonProps.selectedCamera.name\n });\n return (\n <Stack horizontalAlign=\"end\">\n {showCameraSwitcherInLocalPreview &&\n localVideoCameraCycleButtonProps?.cameras !== undefined &&\n localVideoCameraCycleButtonProps?.selectedCamera !== undefined &&\n localVideoCameraCycleButtonProps?.onSelectCamera !== undefined && (\n <LocalVideoCameraCycleButton\n cameras={localVideoCameraCycleButtonProps.cameras}\n selectedCamera={localVideoCameraCycleButtonProps.selectedCamera}\n onSelectCamera={localVideoCameraCycleButtonProps.onSelectCamera}\n label={localVideoCameraSwitcherLabel}\n ariaDescription={ariaDescription}\n />\n )}\n </Stack>\n );\n};\n\n/* @conditional-compile-remove(spotlight) */\nconst convertContextualMenuItemsToDrawerMenuItemProps = (\n contextualMenuProps?: IContextualMenuProps,\n onLightDismiss?: () => void\n): _DrawerMenuItemProps[] => {\n if (!contextualMenuProps) {\n return [];\n }\n return contextualMenuProps.items.map((item) => {\n return {\n itemKey: item.key,\n text: item.text,\n iconProps: item.iconProps,\n disabled: item.disabled,\n onItemClick: () => {\n item.onClick?.();\n onLightDismiss?.();\n }\n };\n });\n};\n"]}
|
1
|
+
{"version":3,"file":"LocalVideoTile.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/LocalVideoTile.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACrD,4CAA4C;AAC5C,OAAO,EAAE,eAAe,EAAwB,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,mCAAgC;AACxD,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,4CAA4C;AAC5C,OAAO,EAAiB,WAAW,EAAE,MAAM,OAAO,CAAC;AAInD,OAAO,EAAE,2BAA2B,EAAoC,MAAM,0BAA0B,CAAC;AACzG,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACL,sCAAsC,EAEvC,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAwB,MAAM,aAAa,CAAC;AAG9D,4CAA4C;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,4CAA4C;AAC5C,OAAO,EAAE,+BAA+B,EAAE,MAAM,gDAAgD,CAAC;AAGjG,4CAA4C;AAC5C,OAAO,EAAE,WAAW,EAAwB,MAAM,UAAU,CAAC;AAC7D,4CAA4C;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AACvF;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC,IAAI,CACvC,CAAC,KAyCA,EAAE,EAAE;IACH,MAAM,EACJ,WAAW,EACX,OAAO,EACP,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACrB,aAAa,EACb,MAAM,EACN,SAAS,EACT,WAAW,EACX,YAAY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AA,gCAAgC,aAAhC,gCAAgC,uBAAhC,gCAAgC,CAAE,cAAc,MAAK,SAAS,IAAI,CAChE,oBAAC,2BAA2B,IAC1B,OAAO,EAAE,gCAAgC,CAAC,OAAO,EACjD,cAAc,EAAE,gCAAgC,CAAC,cAAc,EAC/D,cAAc,EAAE,gCAAgC,CAAC,cAAc,EAC/D,KAAK,EAAE,6BAA6B,EACpC,eAAe,EAAE,eAAe,GAChC,CACH,CACG,CACT,CAAC;AACJ,CAAC,CAAC;AAEF,4CAA4C;AAC5C,MAAM,+CAA+C,GAAG,CACtD,mBAA0C,EAC1C,cAA2B,EACH,EAAE;IAC1B,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACzB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,mBAAmB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAC5C,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,GAAG;YACjB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,WAAW,EAAE,GAAG,EAAE;;gBAChB,MAAA,IAAI,CAAC,OAAO,oDAAI,CAAC;gBACjB,cAAc,aAAd,cAAc,uBAAd,cAAc,EAAI,CAAC;YACrB,CAAC;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { mergeStyles, Stack } from '@fluentui/react';\n/* @conditional-compile-remove(spotlight) */\nimport { concatStyleSets, IContextualMenuProps, Layer } from '@fluentui/react';\nimport { _formatString } from '@internal/acs-ui-common';\nimport React, { useMemo } from 'react';\n/* @conditional-compile-remove(spotlight) */\nimport { KeyboardEvent, useCallback } from 'react';\nimport { OnRenderAvatarCallback, VideoStreamOptions, CreateVideoStreamViewResult } from '../types';\n/* @conditional-compile-remove(reaction) */\nimport { Reaction } from '../types';\nimport { LocalVideoCameraCycleButton, LocalVideoCameraCycleButtonProps } from './LocalVideoCameraButton';\nimport { StreamMedia } from './StreamMedia';\nimport {\n useLocalVideoStreamLifecycleMaintainer,\n LocalVideoStreamLifecycleMaintainerProps\n} from './VideoGallery/useVideoStreamLifecycleMaintainer';\nimport { VideoTile, VideoTileStylesProps } from './VideoTile';\n/* @conditional-compile-remove(raise-hand) */\nimport { RaisedHand } from '../types';\n/* @conditional-compile-remove(spotlight) */\nimport { useTheme } from '../theming';\n/* @conditional-compile-remove(reaction) */\nimport { ReactionResources } from '../types/ReactionTypes';\n/* @conditional-compile-remove(spotlight) */\nimport { useVideoTileContextualMenuProps } from './VideoGallery/useVideoTileContextualMenuProps';\n/* @conditional-compile-remove(spotlight) */\nimport { VideoGalleryStrings } from './VideoGallery';\n/* @conditional-compile-remove(spotlight) */\nimport { _DrawerMenu, _DrawerMenuItemProps } from './Drawer';\n/* @conditional-compile-remove(spotlight) */\nimport { drawerMenuWrapperStyles } from './VideoGallery/styles/RemoteVideoTile.styles';\n/**\n * A memoized version of VideoTile for rendering local participant.\n *\n * @internal\n */\nexport const _LocalVideoTile = React.memo(\n (props: {\n userId?: string;\n onCreateLocalStreamView?: (options?: VideoStreamOptions) => Promise<void | CreateVideoStreamViewResult>;\n onDisposeLocalStreamView?: () => void;\n isAvailable?: boolean;\n isMuted?: boolean;\n renderElement?: HTMLElement;\n displayName?: string;\n initialsName?: string;\n localVideoViewOptions?: VideoStreamOptions;\n onRenderAvatar?: OnRenderAvatarCallback;\n showLabel: boolean;\n showMuteIndicator?: boolean;\n showCameraSwitcherInLocalPreview?: boolean;\n localVideoCameraCycleButtonProps?: LocalVideoCameraCycleButtonProps;\n localVideoCameraSwitcherLabel?: string;\n localVideoSelectedDescription?: string;\n styles?: VideoTileStylesProps;\n personaMinSize?: number;\n /* @conditional-compile-remove(raise-hand) */\n raisedHand?: RaisedHand;\n /* @conditional-compile-remove(reaction) */\n reaction?: Reaction;\n /* @conditional-compile-remove(spotlight) */\n spotlightedParticipantUserIds?: string[];\n /* @conditional-compile-remove(spotlight) */\n isSpotlighted?: boolean;\n /* @conditional-compile-remove(spotlight) */\n onStartSpotlight?: () => void;\n /* @conditional-compile-remove(spotlight) */\n onStopSpotlight?: () => void;\n /* @conditional-compile-remove(spotlight) */\n maxParticipantsToSpotlight?: number;\n /* @conditional-compile-remove(spotlight) */\n menuKind?: 'contextual' | 'drawer';\n /* @conditional-compile-remove(spotlight) */\n drawerMenuHostId?: string;\n /* @conditional-compile-remove(spotlight) */\n strings?: VideoGalleryStrings;\n /* @conditional-compile-remove(reaction) */\n reactionResources?: ReactionResources;\n }) => {\n const {\n isAvailable,\n isMuted,\n onCreateLocalStreamView,\n onDisposeLocalStreamView,\n localVideoViewOptions,\n renderElement,\n userId,\n showLabel,\n displayName,\n initialsName,\n onRenderAvatar,\n showMuteIndicator,\n styles,\n showCameraSwitcherInLocalPreview,\n localVideoCameraCycleButtonProps,\n localVideoCameraSwitcherLabel,\n localVideoSelectedDescription,\n /* @conditional-compile-remove(raise-hand) */\n raisedHand,\n /* @conditional-compile-remove(reaction) */\n reaction,\n /* @conditional-compile-remove(spotlight) */\n isSpotlighted,\n /* @conditional-compile-remove(spotlight) */\n spotlightedParticipantUserIds,\n /* @conditional-compile-remove(spotlight) */\n onStartSpotlight,\n /* @conditional-compile-remove(spotlight) */\n onStopSpotlight,\n /* @conditional-compile-remove(spotlight) */\n maxParticipantsToSpotlight,\n /* @conditional-compile-remove(spotlight) */\n menuKind,\n /* @conditional-compile-remove(spotlight) */\n strings,\n /* @conditional-compile-remove(reaction) */\n reactionResources\n } = props;\n\n /* @conditional-compile-remove(spotlight) */\n const theme = useTheme();\n\n const localVideoStreamProps: LocalVideoStreamLifecycleMaintainerProps = useMemo(\n () => ({\n isMirrored: localVideoViewOptions?.isMirrored,\n isStreamAvailable: isAvailable,\n onCreateLocalStreamView,\n onDisposeLocalStreamView,\n renderElementExists: !!renderElement,\n scalingMode: localVideoViewOptions?.scalingMode\n }),\n [\n isAvailable,\n localVideoViewOptions?.isMirrored,\n localVideoViewOptions?.scalingMode,\n onCreateLocalStreamView,\n onDisposeLocalStreamView,\n renderElement\n ]\n );\n\n // Handle creating, destroying and updating the video stream as necessary\n useLocalVideoStreamLifecycleMaintainer(localVideoStreamProps);\n\n /* @conditional-compile-remove(spotlight) */\n const contextualMenuProps = useVideoTileContextualMenuProps({\n participant: { userId: userId ?? '' },\n strings: { ...strings },\n spotlightedParticipantUserIds,\n isSpotlighted,\n onStartSpotlight,\n onStopSpotlight,\n maxParticipantsToSpotlight,\n myUserId: userId\n });\n\n const videoTileContextualMenuProps = useMemo(() => {\n /* @conditional-compile-remove(spotlight) */\n if (menuKind !== 'contextual' || !contextualMenuProps) {\n return {};\n }\n /* @conditional-compile-remove(spotlight) */\n return {\n contextualMenu: contextualMenuProps\n };\n return {};\n }, [\n /* @conditional-compile-remove(spotlight) */ contextualMenuProps,\n /* @conditional-compile-remove(spotlight) */ menuKind\n ]);\n\n const videoTileStyles = useMemo(() => {\n /* @conditional-compile-remove(spotlight) */\n if (isSpotlighted) {\n return concatStyleSets(\n {\n root: {\n outline: `0.25rem solid ${theme.palette.neutralTertiaryAlt}`,\n outlineOffset: '-0.25rem'\n }\n },\n styles\n );\n }\n return styles;\n }, [\n /* @conditional-compile-remove(spotlight) */ isSpotlighted,\n /* @conditional-compile-remove(spotlight) */ theme.palette.neutralTertiaryAlt,\n styles\n ]);\n\n /* @conditional-compile-remove(spotlight) */\n const [drawerMenuItemProps, setDrawerMenuItemProps] = React.useState<_DrawerMenuItemProps[]>([]);\n\n /* @conditional-compile-remove(spotlight) */\n const onKeyDown = useCallback(\n (e: KeyboardEvent) => {\n if (e.key === 'Enter') {\n setDrawerMenuItemProps(\n convertContextualMenuItemsToDrawerMenuItemProps(contextualMenuProps, () => setDrawerMenuItemProps([]))\n );\n }\n },\n [setDrawerMenuItemProps, contextualMenuProps]\n );\n\n const renderVideoStreamElement = useMemo(() => {\n // Checking if renderElement is well defined or not as calling SDK has a number of video streams limitation which\n // implies that, after their threshold, all streams have no child (blank video)\n if (!renderElement || !renderElement.childElementCount) {\n // Returning `undefined` results in the placeholder with avatar being shown\n return undefined;\n }\n\n return (\n <>\n <FloatingLocalCameraCycleButton\n showCameraSwitcherInLocalPreview={showCameraSwitcherInLocalPreview ?? false}\n localVideoCameraCycleButtonProps={localVideoCameraCycleButtonProps}\n localVideoCameraSwitcherLabel={localVideoCameraSwitcherLabel}\n localVideoSelectedDescription={localVideoSelectedDescription}\n />\n <StreamMedia videoStreamElement={renderElement} isMirrored={true} />\n </>\n );\n }, [\n localVideoCameraCycleButtonProps,\n localVideoCameraSwitcherLabel,\n localVideoSelectedDescription,\n renderElement,\n showCameraSwitcherInLocalPreview\n ]);\n\n return (\n <Stack\n className={mergeStyles({ width: '100%', height: '100%' })}\n /* @conditional-compile-remove(spotlight) */ onKeyDown={menuKind === 'drawer' ? onKeyDown : undefined}\n >\n <VideoTile\n key={userId ?? 'local-video-tile'}\n userId={userId}\n renderElement={renderVideoStreamElement}\n showLabel={showLabel}\n displayName={displayName}\n initialsName={initialsName}\n styles={videoTileStyles}\n onRenderPlaceholder={onRenderAvatar}\n isMuted={isMuted}\n showMuteIndicator={showMuteIndicator}\n personaMinSize={props.personaMinSize}\n /* @conditional-compile-remove(raise-hand) */\n raisedHand={raisedHand}\n /* @conditional-compile-remove(reaction) */\n reaction={reaction}\n /* @conditional-compile-remove(spotlight) */\n isSpotlighted={isSpotlighted}\n {...videoTileContextualMenuProps}\n /* @conditional-compile-remove(spotlight) */\n onLongTouch={() =>\n setDrawerMenuItemProps(\n convertContextualMenuItemsToDrawerMenuItemProps(contextualMenuProps, () => setDrawerMenuItemProps([]))\n )\n }\n /* @conditional-compile-remove(reaction) */\n reactionResources={reactionResources}\n >\n {\n /* @conditional-compile-remove(spotlight) */ drawerMenuItemProps.length > 0 && (\n <Layer hostId={props.drawerMenuHostId}>\n <Stack styles={drawerMenuWrapperStyles}>\n <_DrawerMenu onLightDismiss={() => setDrawerMenuItemProps([])} items={drawerMenuItemProps} />\n </Stack>\n </Layer>\n )\n }\n </VideoTile>\n </Stack>\n );\n }\n);\n\nconst FloatingLocalCameraCycleButton = (props: {\n showCameraSwitcherInLocalPreview: boolean;\n localVideoCameraCycleButtonProps?: LocalVideoCameraCycleButtonProps;\n localVideoCameraSwitcherLabel?: string;\n localVideoSelectedDescription?: string;\n}): JSX.Element => {\n const {\n showCameraSwitcherInLocalPreview,\n localVideoCameraCycleButtonProps,\n localVideoCameraSwitcherLabel,\n localVideoSelectedDescription\n } = props;\n const ariaDescription =\n localVideoCameraCycleButtonProps?.selectedCamera &&\n localVideoSelectedDescription &&\n _formatString(localVideoSelectedDescription, {\n cameraName: localVideoCameraCycleButtonProps.selectedCamera.name\n });\n return (\n <Stack horizontalAlign=\"end\">\n {showCameraSwitcherInLocalPreview &&\n localVideoCameraCycleButtonProps?.cameras !== undefined &&\n localVideoCameraCycleButtonProps?.selectedCamera !== undefined &&\n localVideoCameraCycleButtonProps?.onSelectCamera !== undefined && (\n <LocalVideoCameraCycleButton\n cameras={localVideoCameraCycleButtonProps.cameras}\n selectedCamera={localVideoCameraCycleButtonProps.selectedCamera}\n onSelectCamera={localVideoCameraCycleButtonProps.onSelectCamera}\n label={localVideoCameraSwitcherLabel}\n ariaDescription={ariaDescription}\n />\n )}\n </Stack>\n );\n};\n\n/* @conditional-compile-remove(spotlight) */\nconst convertContextualMenuItemsToDrawerMenuItemProps = (\n contextualMenuProps?: IContextualMenuProps,\n onLightDismiss?: () => void\n): _DrawerMenuItemProps[] => {\n if (!contextualMenuProps) {\n return [];\n }\n return contextualMenuProps.items.map((item) => {\n return {\n itemKey: item.key,\n text: item.text,\n iconProps: item.iconProps,\n disabled: item.disabled,\n onItemClick: () => {\n item.onClick?.();\n onLightDismiss?.();\n }\n };\n });\n};\n"]}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
/**
|
3
|
+
* Props for {@link MessageStatusIndicatorInternal}.
|
4
|
+
*
|
5
|
+
* @internal
|
6
|
+
*/
|
7
|
+
export interface MessageStatusIconProps {
|
8
|
+
shouldAnnounce: boolean;
|
9
|
+
iconName: string;
|
10
|
+
iconClassName: string;
|
11
|
+
ariaLabel?: string;
|
12
|
+
}
|
13
|
+
/**
|
14
|
+
* Component to display message status icon
|
15
|
+
*
|
16
|
+
* @internal
|
17
|
+
*/
|
18
|
+
export declare const MessageStatusIcon: (props: MessageStatusIconProps) => JSX.Element;
|
19
|
+
//# sourceMappingURL=MessageStatusIcon.d.ts.map
|
@@ -0,0 +1,20 @@
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
2
|
+
// Licensed under the MIT License.
|
3
|
+
import { Icon } from '@fluentui/react';
|
4
|
+
import React from 'react';
|
5
|
+
import LiveMessage from './Announcer/LiveMessage';
|
6
|
+
/**
|
7
|
+
* Component to display message status icon
|
8
|
+
*
|
9
|
+
* @internal
|
10
|
+
*/
|
11
|
+
export const MessageStatusIcon = (props) => {
|
12
|
+
const { shouldAnnounce, iconName, iconClassName, ariaLabel } = props;
|
13
|
+
return (React.createElement(React.Fragment, null,
|
14
|
+
ariaLabel && React.createElement(LiveMessage, { message: ariaLabel, ariaLive: "polite" }),
|
15
|
+
React.createElement("div", {
|
16
|
+
// make icon accessible
|
17
|
+
tabIndex: 0 },
|
18
|
+
React.createElement(Icon, { role: 'status', "aria-live": shouldAnnounce ? 'polite' : 'off', "data-ui-id": 'chat-composite-message-status-icon', "aria-label": ariaLabel, iconName: iconName, className: iconClassName }))));
|
19
|
+
};
|
20
|
+
//# sourceMappingURL=MessageStatusIcon.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"MessageStatusIcon.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/MessageStatusIcon.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,WAAW,MAAM,yBAAyB,CAAC;AAclD;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAA6B,EAAe,EAAE;IAC9E,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IAErE,OAAO,CACL;QAEG,SAAS,IAAI,oBAAC,WAAW,IAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAC,QAAQ,GAAG;QACnE;YACE,uBAAuB;YACvB,QAAQ,EAAE,CAAC;YAEX,oBAAC,IAAI,IACH,IAAI,EAAE,QAAQ,eAKH,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,gBAChC,oCAAoC,gBACpC,SAAS,EACrB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,aAAa,GACxB,CACE,CACL,CACJ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Icon } from '@fluentui/react';\nimport React from 'react';\nimport LiveMessage from './Announcer/LiveMessage';\n\n/**\n * Props for {@link MessageStatusIndicatorInternal}.\n *\n * @internal\n */\nexport interface MessageStatusIconProps {\n shouldAnnounce: boolean;\n iconName: string;\n iconClassName: string;\n ariaLabel?: string;\n}\n\n/**\n * Component to display message status icon\n *\n * @internal\n */\nexport const MessageStatusIcon = (props: MessageStatusIconProps): JSX.Element => {\n const { shouldAnnounce, iconName, iconClassName, ariaLabel } = props;\n\n return (\n <>\n {/* live message is used here so that aria labels are announced on mobile */}\n {ariaLabel && <LiveMessage message={ariaLabel} ariaLive=\"polite\" />}\n <div\n // make icon accessible\n tabIndex={0}\n >\n <Icon\n role={'status'}\n // Role `status` is one of the live region roles and is used to notify screen readers of changes to the status of the message\n // it has aria-live prop set to `polite` by default.\n // By setting it to `off` value, we disable live updates when they aren't needed\n // and keep it available in the accessibility tree\n aria-live={shouldAnnounce ? 'polite' : 'off'}\n data-ui-id={'chat-composite-message-status-icon'}\n aria-label={ariaLabel}\n iconName={iconName}\n className={iconClassName}\n />\n </div>\n </>\n );\n};\n"]}
|
@@ -1,13 +1,7 @@
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
2
2
|
// Licensed under the MIT License.
|
3
|
-
import
|
4
|
-
import {
|
5
|
-
import React, { useState } from 'react';
|
6
|
-
import { useLocale } from '../localization';
|
7
|
-
import { useTheme } from '../theming';
|
8
|
-
import { isDarkThemed } from '../theming/themeUtils';
|
9
|
-
import { MessageStatusIndicatorErrorIconStyle, MessageStatusIndicatorIconStyle } from './styles/MessageStatusIndicator.styles';
|
10
|
-
import LiveMessage from './Announcer/LiveMessage';
|
3
|
+
import React from 'react';
|
4
|
+
import { MessageStatusIndicatorInternal } from './MessageStatusIndicatorInternal';
|
11
5
|
/**
|
12
6
|
* Component to display the status of a sent message.
|
13
7
|
*
|
@@ -16,61 +10,7 @@ import LiveMessage from './Announcer/LiveMessage';
|
|
16
10
|
* @public
|
17
11
|
*/
|
18
12
|
export const MessageStatusIndicator = (props) => {
|
19
|
-
const
|
20
|
-
|
21
|
-
const [isTooltipToggled, setIsTooltipToggled] = useState(false);
|
22
|
-
const strings = Object.assign(Object.assign({}, localeStrings), props.strings);
|
23
|
-
const theme = useTheme();
|
24
|
-
const calloutStyle = { root: { padding: 0 }, calloutMain: { padding: '0.5rem' } };
|
25
|
-
// Place callout with no gap between it and the button.
|
26
|
-
const calloutProps = {
|
27
|
-
gapSpace: 0,
|
28
|
-
styles: calloutStyle,
|
29
|
-
backgroundColor: isDarkThemed(theme) ? theme.palette.neutralLighter : ''
|
30
|
-
};
|
31
|
-
switch (status) {
|
32
|
-
case 'failed':
|
33
|
-
return (React.createElement(TooltipHost, { content: strings.failedToSendTooltipText, "data-ui-id": "chat-composite-message-tooltip", calloutProps: Object.assign({}, calloutProps), styles: hostStyles },
|
34
|
-
strings.failedToSendAriaLabel && (
|
35
|
-
// live message is used here and in the following tooltips so that aria labels are announced on mobile
|
36
|
-
React.createElement(LiveMessage, { message: strings.failedToSendAriaLabel, ariaLive: "polite" })),
|
37
|
-
React.createElement(Icon, { role: "status", "data-ui-id": "chat-composite-message-status-icon", "aria-label": strings.failedToSendAriaLabel, iconName: "MessageFailed", className: mergeStyles(MessageStatusIndicatorErrorIconStyle, { color: theme.palette.redDark }, styles === null || styles === void 0 ? void 0 : styles.root) })));
|
38
|
-
case 'sending':
|
39
|
-
return (React.createElement(TooltipHost, { content: strings.sendingTooltipText, "data-ui-id": "chat-composite-message-tooltip", calloutProps: Object.assign({}, calloutProps), styles: hostStyles },
|
40
|
-
strings.sendingAriaLabel && React.createElement(LiveMessage, { message: strings.sendingAriaLabel, ariaLive: "polite" }),
|
41
|
-
React.createElement(Icon, { role: "status", "data-ui-id": "chat-composite-message-status-icon", "aria-label": strings.sendingAriaLabel, iconName: "MessageSending", className: mergeStyles(MessageStatusIndicatorIconStyle, { color: theme.palette.themePrimary }, styles === null || styles === void 0 ? void 0 : styles.root) })));
|
42
|
-
case 'seen':
|
43
|
-
return (React.createElement(TooltipHost, { calloutProps: Object.assign({}, calloutProps), "data-ui-id": "chat-composite-message-tooltip", styles: hostStyles, content:
|
44
|
-
// when it's just 1 to 1 texting, we don't need to know who has read the message, just show message as 'seen'
|
45
|
-
// when readcount is 0, we have a bug, show 'seen' to cover up as a fall back
|
46
|
-
// when participant count is 0, we have a bug, show 'seen' to cover up as a fall back
|
47
|
-
readCount === 0 ||
|
48
|
-
(remoteParticipantsCount && remoteParticipantsCount <= 1) ||
|
49
|
-
!readCount ||
|
50
|
-
!remoteParticipantsCount ||
|
51
|
-
strings.readByTooltipText === undefined
|
52
|
-
? strings.seenTooltipText
|
53
|
-
: _formatString(strings.readByTooltipText, {
|
54
|
-
messageThreadReadCount: `${readCount}`,
|
55
|
-
remoteParticipantsCount: `${remoteParticipantsCount}`
|
56
|
-
}), onTooltipToggle: () => {
|
57
|
-
if (onToggleToolTip) {
|
58
|
-
onToggleToolTip(!isTooltipToggled);
|
59
|
-
setIsTooltipToggled(!isTooltipToggled);
|
60
|
-
}
|
61
|
-
} },
|
62
|
-
strings.seenAriaLabel && React.createElement(LiveMessage, { message: strings.seenAriaLabel, ariaLive: "polite" }),
|
63
|
-
React.createElement(Icon, { "data-ui-id": "chat-composite-message-status-icon", role: "status", "aria-label": strings.seenAriaLabel, iconName: "MessageSeen", className: mergeStyles({ color: theme.palette.themePrimary }, styles === null || styles === void 0 ? void 0 : styles.root) })));
|
64
|
-
case 'delivered':
|
65
|
-
return (React.createElement(TooltipHost, { calloutProps: Object.assign({}, calloutProps), content: strings.deliveredTooltipText, "data-ui-id": "chat-composite-message-tooltip", styles: hostStyles },
|
66
|
-
strings.deliveredAriaLabel && React.createElement(LiveMessage, { message: strings.deliveredAriaLabel, ariaLive: "polite" }),
|
67
|
-
React.createElement(Icon, { role: "status", "data-ui-id": "chat-composite-message-status-icon", "aria-label": strings.deliveredAriaLabel, iconName: "MessageDelivered", className: mergeStyles(MessageStatusIndicatorIconStyle, { color: theme.palette.themePrimary }, styles === null || styles === void 0 ? void 0 : styles.root) })));
|
68
|
-
default:
|
69
|
-
return React.createElement(React.Fragment, null);
|
70
|
-
}
|
13
|
+
const internalProps = Object.assign(Object.assign({}, props), { shouldAnnounce: true });
|
14
|
+
return React.createElement(MessageStatusIndicatorInternal, Object.assign({}, internalProps));
|
71
15
|
};
|
72
|
-
// The TooltipHost root uses display: inline by default.
|
73
|
-
// To prevent sizing issues or tooltip positioning issues, we override to inline-block.
|
74
|
-
// For more details see "Icon Button with Tooltip" on https://developer.microsoft.com/en-us/fluentui#/controls/web/button
|
75
|
-
const hostStyles = { root: { display: 'inline-block' } };
|
76
16
|
//# sourceMappingURL=MessageStatusIndicator.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"MessageStatusIndicator.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/MessageStatusIndicator.tsx"],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EjB,OAAO,CAAC,kBAAkB,IAAI,oBAAC,WAAW,IAAC,OAAO,EAAE,OAAO,CAAC,kBAAkB,EAAE,QAAQ,EAAC,QAAQ,GAAG;gBACrG,oBAAC,IAAI,IACH,IAAI,EAAC,QAAQ,gBACF,oCAAoC,gBACnC,OAAO,CAAC,kBAAkB,EACtC,QAAQ,EAAC,kBAAkB,EAC3B,SAAS,EAAE,WAAW,CACpB,+BAA+B,EAC/B,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,YAAY,EAAE,EACrC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,CACb,GACD,CACU,CACf,CAAC;QACJ;YACE,OAAO,yCAAK,CAAC;IACjB,CAAC;AACH,CAAC,CAAC;AAEF,wDAAwD;AACxD,uFAAuF;AACvF,yHAAyH;AACzH,MAAM,UAAU,GAAgC,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE,EAAE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ICalloutContentStyles, Icon, ITooltipHostStyles, mergeStyles, TooltipHost } from '@fluentui/react';\nimport { MessageStatus, _formatString } from '@internal/acs-ui-common';\nimport React, { useState } from 'react';\nimport { useLocale } from '../localization';\nimport { useTheme } from '../theming';\nimport { isDarkThemed } from '../theming/themeUtils';\nimport { BaseCustomStyles } from '../types';\nimport {\n MessageStatusIndicatorErrorIconStyle,\n MessageStatusIndicatorIconStyle\n} from './styles/MessageStatusIndicator.styles';\nimport LiveMessage from './Announcer/LiveMessage';\n\n/**\n * Strings of {@link MessageStatusIndicator} that can be overridden.\n *\n * @public\n */\nexport interface MessageStatusIndicatorStrings {\n /** Aria label to notify user when their message has been delivered. */\n deliveredAriaLabel?: string;\n /** Text to display in the delivered message icon tooltip. */\n deliveredTooltipText: string;\n /** Aria label to notify user when their message has been seen by others. */\n seenAriaLabel?: string;\n /** Text to display in the seen message icon tooltip if read number/ participant number is 1 */\n seenTooltipText: string;\n /** Text to display in the seen message icon tooltip if read number logic is working correctly (more than 1 read number and more than 1 particiants)*/\n readByTooltipText?: string;\n /** Aria label to notify user when their message is being sent. */\n sendingAriaLabel?: string;\n /** Text to display in the sending message icon tooltip. */\n sendingTooltipText: string;\n /** Aria label to notify user when their message has failed to be sent. */\n failedToSendAriaLabel?: string;\n /** Text to display in the failed message icon tooltip. */\n failedToSendTooltipText: string;\n}\n\n/**\n * Props for {@link MessageStatusIndicator}.\n *\n * @public\n */\nexport interface MessageStatusIndicatorProps {\n /** Message status that determines the icon to display. */\n status?: MessageStatus;\n readCount?: number;\n onToggleToolTip?: (isToggled: boolean) => void;\n /** number of participants not including myself */\n remoteParticipantsCount?: number;\n /**\n * Allows users to pass an object containing custom CSS styles.\n * @Example\n * ```\n * <MessageStatus styles={{ root: { background: 'blue' } }} />\n * ```\n */\n styles?: BaseCustomStyles;\n /**\n * Optional strings to override in component\n */\n strings?: MessageStatusIndicatorStrings;\n}\n\n/**\n * Component to display the status of a sent message.\n *\n * Adds an icon and tooltip corresponding to the message status.\n *\n * @public\n */\nexport const MessageStatusIndicator = (props: MessageStatusIndicatorProps): JSX.Element => {\n const { status, styles, remoteParticipantsCount, onToggleToolTip, readCount } = props;\n const localeStrings = useLocale().strings.messageStatusIndicator;\n const [isTooltipToggled, setIsTooltipToggled] = useState<boolean>(false);\n const strings = { ...localeStrings, ...props.strings };\n const theme = useTheme();\n\n const calloutStyle: Partial<ICalloutContentStyles> = { root: { padding: 0 }, calloutMain: { padding: '0.5rem' } };\n\n // Place callout with no gap between it and the button.\n const calloutProps = {\n gapSpace: 0,\n styles: calloutStyle,\n backgroundColor: isDarkThemed(theme) ? theme.palette.neutralLighter : ''\n };\n\n switch (status) {\n case 'failed':\n return (\n <TooltipHost\n content={strings.failedToSendTooltipText}\n data-ui-id=\"chat-composite-message-tooltip\"\n calloutProps={{ ...calloutProps }}\n styles={hostStyles}\n >\n {strings.failedToSendAriaLabel && (\n // live message is used here and in the following tooltips so that aria labels are announced on mobile\n <LiveMessage message={strings.failedToSendAriaLabel} ariaLive=\"polite\" />\n )}\n <Icon\n role=\"status\"\n data-ui-id=\"chat-composite-message-status-icon\"\n aria-label={strings.failedToSendAriaLabel}\n iconName=\"MessageFailed\"\n className={mergeStyles(\n MessageStatusIndicatorErrorIconStyle,\n { color: theme.palette.redDark },\n styles?.root\n )}\n />\n </TooltipHost>\n );\n case 'sending':\n return (\n <TooltipHost\n content={strings.sendingTooltipText}\n data-ui-id=\"chat-composite-message-tooltip\"\n calloutProps={{ ...calloutProps }}\n styles={hostStyles}\n >\n {strings.sendingAriaLabel && <LiveMessage message={strings.sendingAriaLabel} ariaLive=\"polite\" />}\n\n <Icon\n role=\"status\"\n data-ui-id=\"chat-composite-message-status-icon\"\n aria-label={strings.sendingAriaLabel}\n iconName=\"MessageSending\"\n className={mergeStyles(\n MessageStatusIndicatorIconStyle,\n { color: theme.palette.themePrimary },\n styles?.root\n )}\n />\n </TooltipHost>\n );\n case 'seen':\n return (\n <TooltipHost\n calloutProps={{ ...calloutProps }}\n data-ui-id=\"chat-composite-message-tooltip\"\n styles={hostStyles}\n content={\n // when it's just 1 to 1 texting, we don't need to know who has read the message, just show message as 'seen'\n // when readcount is 0, we have a bug, show 'seen' to cover up as a fall back\n // when participant count is 0, we have a bug, show 'seen' to cover up as a fall back\n readCount === 0 ||\n (remoteParticipantsCount && remoteParticipantsCount <= 1) ||\n !readCount ||\n !remoteParticipantsCount ||\n strings.readByTooltipText === undefined\n ? strings.seenTooltipText\n : _formatString(strings.readByTooltipText, {\n messageThreadReadCount: `${readCount}`,\n remoteParticipantsCount: `${remoteParticipantsCount}`\n })\n }\n onTooltipToggle={() => {\n if (onToggleToolTip) {\n onToggleToolTip(!isTooltipToggled);\n setIsTooltipToggled(!isTooltipToggled);\n }\n }}\n >\n {strings.seenAriaLabel && <LiveMessage message={strings.seenAriaLabel} ariaLive=\"polite\" />}\n\n <Icon\n data-ui-id=\"chat-composite-message-status-icon\"\n role=\"status\"\n aria-label={strings.seenAriaLabel}\n iconName=\"MessageSeen\"\n className={mergeStyles({ color: theme.palette.themePrimary }, styles?.root)}\n />\n </TooltipHost>\n );\n case 'delivered':\n return (\n <TooltipHost\n calloutProps={{ ...calloutProps }}\n content={strings.deliveredTooltipText}\n data-ui-id=\"chat-composite-message-tooltip\"\n styles={hostStyles}\n >\n {strings.deliveredAriaLabel && <LiveMessage message={strings.deliveredAriaLabel} ariaLive=\"polite\" />}\n <Icon\n role=\"status\"\n data-ui-id=\"chat-composite-message-status-icon\"\n aria-label={strings.deliveredAriaLabel}\n iconName=\"MessageDelivered\"\n className={mergeStyles(\n MessageStatusIndicatorIconStyle,\n { color: theme.palette.themePrimary },\n styles?.root\n )}\n />\n </TooltipHost>\n );\n default:\n return <></>;\n }\n};\n\n// The TooltipHost root uses display: inline by default.\n// To prevent sizing issues or tooltip positioning issues, we override to inline-block.\n// For more details see \"Icon Button with Tooltip\" on https://developer.microsoft.com/en-us/fluentui#/controls/web/button\nconst hostStyles: Partial<ITooltipHostStyles> = { root: { display: 'inline-block' } };\n"]}
|
1
|
+
{"version":3,"file":"MessageStatusIndicator.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/MessageStatusIndicator.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,8BAA8B,EAAuC,MAAM,kCAAkC,CAAC;AAsDvH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAkC,EAAe,EAAE;IACxF,MAAM,aAAa,mCACd,KAAK,KACR,cAAc,EAAE,IAAI,GACrB,CAAC;IAEF,OAAO,oBAAC,8BAA8B,oBAAK,aAAa,EAAmC,CAAC;AAC9F,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { MessageStatus, _formatString } from '@internal/acs-ui-common';\nimport React from 'react';\nimport { BaseCustomStyles } from '../types';\nimport { MessageStatusIndicatorInternal, MessageStatusIndicatorInternalProps } from './MessageStatusIndicatorInternal';\n\n/**\n * Strings of {@link MessageStatusIndicator} that can be overridden.\n *\n * @public\n */\nexport interface MessageStatusIndicatorStrings {\n /** Aria label to notify user when their message has been delivered. */\n deliveredAriaLabel?: string;\n /** Text to display in the delivered message icon tooltip. */\n deliveredTooltipText: string;\n /** Aria label to notify user when their message has been seen by others. */\n seenAriaLabel?: string;\n /** Text to display in the seen message icon tooltip if read number/ participant number is 1 */\n seenTooltipText: string;\n /** Text to display in the seen message icon tooltip if read number logic is working correctly (more than 1 read number and more than 1 particiants)*/\n readByTooltipText?: string;\n /** Aria label to notify user when their message is being sent. */\n sendingAriaLabel?: string;\n /** Text to display in the sending message icon tooltip. */\n sendingTooltipText: string;\n /** Aria label to notify user when their message has failed to be sent. */\n failedToSendAriaLabel?: string;\n /** Text to display in the failed message icon tooltip. */\n failedToSendTooltipText: string;\n}\n\n/**\n * Props for {@link MessageStatusIndicator}.\n *\n * @public\n */\nexport interface MessageStatusIndicatorProps {\n /** Message status that determines the icon to display. */\n status?: MessageStatus;\n readCount?: number;\n onToggleToolTip?: (isToggled: boolean) => void;\n /** number of participants not including myself */\n remoteParticipantsCount?: number;\n /**\n * Allows users to pass an object containing custom CSS styles.\n * @Example\n * ```\n * <MessageStatus styles={{ root: { background: 'blue' } }} />\n * ```\n */\n styles?: BaseCustomStyles;\n /**\n * Optional strings to override in component\n */\n strings?: MessageStatusIndicatorStrings;\n}\n\n/**\n * Component to display the status of a sent message.\n *\n * Adds an icon and tooltip corresponding to the message status.\n *\n * @public\n */\nexport const MessageStatusIndicator = (props: MessageStatusIndicatorProps): JSX.Element => {\n const internalProps: MessageStatusIndicatorInternalProps = {\n ...props,\n shouldAnnounce: true\n };\n\n return <MessageStatusIndicatorInternal {...internalProps}></MessageStatusIndicatorInternal>;\n};\n"]}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { MessageStatus } from "../../../acs-ui-common/src";
|
3
|
+
import { BaseCustomStyles } from '../types';
|
4
|
+
import { MessageStatusIndicatorStrings } from './MessageStatusIndicator';
|
5
|
+
/**
|
6
|
+
* Props for {@link MessageStatusIndicatorInternal}.
|
7
|
+
*
|
8
|
+
* @internal
|
9
|
+
*/
|
10
|
+
export interface MessageStatusIndicatorInternalProps {
|
11
|
+
/** Message status that determines the icon to display. */
|
12
|
+
status?: MessageStatus;
|
13
|
+
readCount?: number;
|
14
|
+
onToggleToolTip?: (isToggled: boolean) => void;
|
15
|
+
/** number of participants not including myself */
|
16
|
+
remoteParticipantsCount?: number;
|
17
|
+
/**
|
18
|
+
* Allows users to pass an object containing custom CSS styles.
|
19
|
+
* @Example
|
20
|
+
* ```
|
21
|
+
* <MessageStatus styles={{ root: { background: 'blue' } }} />
|
22
|
+
* ```
|
23
|
+
*/
|
24
|
+
styles?: BaseCustomStyles;
|
25
|
+
/**
|
26
|
+
* Optional strings to override in component
|
27
|
+
*/
|
28
|
+
strings?: MessageStatusIndicatorStrings;
|
29
|
+
/**
|
30
|
+
* Optional call back to provide LiveMessage component for accessibility
|
31
|
+
*/
|
32
|
+
shouldAnnounce: boolean;
|
33
|
+
}
|
34
|
+
/**
|
35
|
+
* Component to display the status of a sent message.
|
36
|
+
*
|
37
|
+
* Adds an icon and tooltip corresponding to the message status.
|
38
|
+
*
|
39
|
+
* @internal
|
40
|
+
*/
|
41
|
+
export declare const MessageStatusIndicatorInternal: (props: MessageStatusIndicatorInternalProps) => JSX.Element;
|
42
|
+
//# sourceMappingURL=MessageStatusIndicatorInternal.d.ts.map
|