@azure/communication-react 1.5.1-alpha-202305230013 → 1.5.1-alpha-202305250013
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 +23 -0
- package/dist/dist-cjs/communication-react/index.js +179 -38
- 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/northstar-wrapper/src/index.js +2 -0
- package/dist/dist-esm/northstar-wrapper/src/index.js.LICENSE.txt +41 -0
- package/dist/dist-esm/react-components/src/components/Announcer/Announcer.d.ts +20 -0
- package/dist/dist-esm/react-components/src/components/Announcer/Announcer.js +44 -0
- package/dist/dist-esm/react-components/src/components/Announcer/Announcer.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/Announcer/AnnouncerContext.d.ts +10 -0
- package/dist/dist-esm/react-components/src/components/Announcer/AnnouncerContext.js +14 -0
- package/dist/dist-esm/react-components/src/components/Announcer/AnnouncerContext.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/Announcer/AnnouncerMessage.d.ts +10 -0
- package/dist/dist-esm/react-components/src/components/Announcer/AnnouncerMessage.js +29 -0
- package/dist/dist-esm/react-components/src/components/Announcer/AnnouncerMessage.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/Announcer/LiveAnnouncer.d.ts +7 -0
- package/dist/dist-esm/react-components/src/components/Announcer/LiveAnnouncer.js +26 -0
- package/dist/dist-esm/react-components/src/components/Announcer/LiveAnnouncer.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/Announcer/LiveMessage.d.ts +9 -0
- package/dist/dist-esm/react-components/src/components/Announcer/LiveMessage.js +10 -0
- package/dist/dist-esm/react-components/src/components/Announcer/LiveMessage.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/Announcer/MessageBlock.d.ts +8 -0
- package/dist/dist-esm/react-components/src/components/Announcer/MessageBlock.js +19 -0
- package/dist/dist-esm/react-components/src/components/Announcer/MessageBlock.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/CaptionsBanner.js +1 -1
- package/dist/dist-esm/react-components/src/components/CaptionsBanner.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageActionMenu.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageActionMenu.js +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageActionMenu.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageActionsFlyout.js +11 -2
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageActionsFlyout.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponent.d.ts +1 -2
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsMessageBubble.d.ts +1 -2
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsMessageBubble.js +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsMessageBubble.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js +2 -2
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/MessageStatusIndicator.js +5 -5
- package/dist/dist-esm/react-components/src/components/MessageStatusIndicator.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/MessageThread.d.ts +1 -2
- package/dist/dist-esm/react-components/src/components/MessageThread.js +2 -2
- package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/SystemMessage.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/SystemMessage.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery.js +2 -2
- package/dist/dist-esm/react-components/src/components/VideoGallery.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/theming/FluentThemeProvider.js +1 -1
- package/dist/dist-esm/react-components/src/theming/FluentThemeProvider.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.d.ts +22 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/MediaGallery.d.ts +2 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/MediaGallery.js +20 -5
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/MediaGallery.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/index.d.ts +1 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/index.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js +3 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js.map +1 -1
- package/package.json +20 -23
@@ -0,0 +1,41 @@
|
|
1
|
+
/*
|
2
|
+
* __ ___
|
3
|
+
* _____/ /___ __/ (_)____
|
4
|
+
* / ___/ __/ / / / / / ___/
|
5
|
+
* (__ ) /_/ /_/ / / (__ )
|
6
|
+
* /____/\__/\__, /_/_/____/
|
7
|
+
* /____/
|
8
|
+
*
|
9
|
+
* light - weight css preprocessor @licence MIT
|
10
|
+
*/
|
11
|
+
|
12
|
+
/*!
|
13
|
+
Copyright (c) 2018 Jed Watson.
|
14
|
+
Licensed under the MIT License (MIT), see
|
15
|
+
http://jedwatson.github.io/classnames
|
16
|
+
*/
|
17
|
+
|
18
|
+
/*!
|
19
|
+
* isobject <https://github.com/jonschlinkert/isobject>
|
20
|
+
*
|
21
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
22
|
+
* Released under the MIT License.
|
23
|
+
*/
|
24
|
+
|
25
|
+
/** @license React v0.20.2
|
26
|
+
* scheduler.production.min.js
|
27
|
+
*
|
28
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
29
|
+
*
|
30
|
+
* This source code is licensed under the MIT license found in the
|
31
|
+
* LICENSE file in the root directory of this source tree.
|
32
|
+
*/
|
33
|
+
|
34
|
+
/** @license React v16.13.1
|
35
|
+
* react-is.production.min.js
|
36
|
+
*
|
37
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
38
|
+
*
|
39
|
+
* This source code is licensed under the MIT license found in the
|
40
|
+
* LICENSE file in the root directory of this source tree.
|
41
|
+
*/
|
@@ -0,0 +1,20 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
/** @private */
|
3
|
+
export declare type AnnouncerMessageBag = {
|
4
|
+
message: string;
|
5
|
+
id: string;
|
6
|
+
};
|
7
|
+
/** @private */
|
8
|
+
export declare type AnnouncerProps = {
|
9
|
+
polite?: AnnouncerMessageBag;
|
10
|
+
assertive?: AnnouncerMessageBag;
|
11
|
+
};
|
12
|
+
/** @private */
|
13
|
+
export declare const EMPTY_MESSAGE: {
|
14
|
+
message: string;
|
15
|
+
id: string;
|
16
|
+
};
|
17
|
+
/** @private */
|
18
|
+
declare const Announcer: (props: AnnouncerProps) => JSX.Element;
|
19
|
+
export default Announcer;
|
20
|
+
//# sourceMappingURL=Announcer.d.ts.map
|
@@ -0,0 +1,44 @@
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
2
|
+
// Licensed under the MIT license.
|
3
|
+
/// Adapted from: https://github.com/AlmeroSteyn/react-aria-live/blob/master/src/modules/Announcer.js
|
4
|
+
import React, { useEffect } from 'react';
|
5
|
+
import MessageBlock from './MessageBlock';
|
6
|
+
/** @private */
|
7
|
+
export const EMPTY_MESSAGE = { message: '', id: '' };
|
8
|
+
/** @private */
|
9
|
+
const Announcer = (props) => {
|
10
|
+
var _a, _b;
|
11
|
+
const newAssertive = (_a = props.assertive) !== null && _a !== void 0 ? _a : EMPTY_MESSAGE;
|
12
|
+
const oldAssertive = React.useRef(EMPTY_MESSAGE);
|
13
|
+
const [activeAssertive1, setActiveAssertive1] = React.useState(EMPTY_MESSAGE);
|
14
|
+
const [activeAssertive2, setActiveAssertive2] = React.useState(EMPTY_MESSAGE);
|
15
|
+
const alternateAssertive = React.useRef(false);
|
16
|
+
useEffect(() => {
|
17
|
+
if (oldAssertive.current.message !== (newAssertive === null || newAssertive === void 0 ? void 0 : newAssertive.message) || oldAssertive.current.id !== (newAssertive === null || newAssertive === void 0 ? void 0 : newAssertive.id)) {
|
18
|
+
setActiveAssertive1(alternateAssertive.current ? EMPTY_MESSAGE : newAssertive);
|
19
|
+
setActiveAssertive2(alternateAssertive.current ? newAssertive : EMPTY_MESSAGE);
|
20
|
+
oldAssertive.current = newAssertive;
|
21
|
+
alternateAssertive.current = !alternateAssertive.current;
|
22
|
+
}
|
23
|
+
}, [newAssertive]);
|
24
|
+
const newPolite = (_b = props.polite) !== null && _b !== void 0 ? _b : EMPTY_MESSAGE;
|
25
|
+
const oldPolite = React.useRef(EMPTY_MESSAGE);
|
26
|
+
const [activePolite1, setActivePolite1] = React.useState(EMPTY_MESSAGE);
|
27
|
+
const [activePolite2, setActivePolite2] = React.useState(EMPTY_MESSAGE);
|
28
|
+
const alternatePolite = React.useRef(false);
|
29
|
+
useEffect(() => {
|
30
|
+
if (oldPolite.current.message !== (newPolite === null || newPolite === void 0 ? void 0 : newPolite.message) || oldPolite.current.id !== (newPolite === null || newPolite === void 0 ? void 0 : newPolite.id)) {
|
31
|
+
setActivePolite1(alternatePolite.current ? EMPTY_MESSAGE : newPolite);
|
32
|
+
setActivePolite2(alternatePolite.current ? newPolite : EMPTY_MESSAGE);
|
33
|
+
oldPolite.current = newPolite;
|
34
|
+
alternatePolite.current = !alternatePolite.current;
|
35
|
+
}
|
36
|
+
}, [newPolite]);
|
37
|
+
return (React.createElement("div", null,
|
38
|
+
React.createElement(MessageBlock, { ariaLive: "assertive", message: activeAssertive1.message }),
|
39
|
+
React.createElement(MessageBlock, { ariaLive: "assertive", message: activeAssertive2.message }),
|
40
|
+
React.createElement(MessageBlock, { ariaLive: "polite", message: activePolite1.message }),
|
41
|
+
React.createElement(MessageBlock, { ariaLive: "polite", message: activePolite2.message })));
|
42
|
+
};
|
43
|
+
export default Announcer;
|
44
|
+
//# sourceMappingURL=Announcer.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Announcer.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Announcer/Announcer.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,qGAAqG;AAErG,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAc1C,eAAe;AACf,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;AAErD,eAAe;AACf,MAAM,SAAS,GAAG,CAAC,KAAqB,EAAe,EAAE;;IACvD,MAAM,YAAY,GAAG,MAAA,KAAK,CAAC,SAAS,mCAAI,aAAa,CAAC;IACtD,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAsB,aAAa,CAAC,CAAC;IACtE,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAsB,aAAa,CAAC,CAAC;IACnG,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAsB,aAAa,CAAC,CAAC;IACnG,MAAM,kBAAkB,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAE/C,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,YAAY,CAAC,OAAO,CAAC,OAAO,MAAK,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,OAAO,CAAA,IAAI,YAAY,CAAC,OAAO,CAAC,EAAE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aAAa,CAAC,CAAC;YACtE,SAAS,CAAC,OAAO,GAAG,SAAS,CAAC;YAC9B,eAAe,CAAC,OAAO,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC;SACpD;IACH,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,OAAO,CACL;QACE,oBAAC,YAAY,IAAC,QAAQ,EAAC,WAAW,EAAC,OAAO,EAAE,gBAAgB,CAAC,OAAO,GAAI;QACxE,oBAAC,YAAY,IAAC,QAAQ,EAAC,WAAW,EAAC,OAAO,EAAE,gBAAgB,CAAC,OAAO,GAAI;QACxE,oBAAC,YAAY,IAAC,QAAQ,EAAC,QAAQ,EAAC,OAAO,EAAE,aAAa,CAAC,OAAO,GAAI;QAClE,oBAAC,YAAY,IAAC,QAAQ,EAAC,QAAQ,EAAC,OAAO,EAAE,aAAa,CAAC,OAAO,GAAI,CAC9D,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/// Adapted from: https://github.com/AlmeroSteyn/react-aria-live/blob/master/src/modules/Announcer.js\n\nimport React, { useEffect } from 'react';\nimport MessageBlock from './MessageBlock';\n\n/** @private */\nexport type AnnouncerMessageBag = {\n message: string;\n id: string;\n};\n\n/** @private */\nexport type AnnouncerProps = {\n polite?: AnnouncerMessageBag;\n assertive?: AnnouncerMessageBag;\n};\n\n/** @private */\nexport const EMPTY_MESSAGE = { message: '', id: '' };\n\n/** @private */\nconst Announcer = (props: AnnouncerProps): JSX.Element => {\n const newAssertive = props.assertive ?? EMPTY_MESSAGE;\n const oldAssertive = React.useRef<AnnouncerMessageBag>(EMPTY_MESSAGE);\n const [activeAssertive1, setActiveAssertive1] = React.useState<AnnouncerMessageBag>(EMPTY_MESSAGE);\n const [activeAssertive2, setActiveAssertive2] = React.useState<AnnouncerMessageBag>(EMPTY_MESSAGE);\n const alternateAssertive = React.useRef(false);\n\n useEffect(() => {\n if (oldAssertive.current.message !== newAssertive?.message || oldAssertive.current.id !== newAssertive?.id) {\n setActiveAssertive1(alternateAssertive.current ? EMPTY_MESSAGE : newAssertive);\n setActiveAssertive2(alternateAssertive.current ? newAssertive : EMPTY_MESSAGE);\n oldAssertive.current = newAssertive;\n alternateAssertive.current = !alternateAssertive.current;\n }\n }, [newAssertive]);\n\n const newPolite = props.polite ?? EMPTY_MESSAGE;\n const oldPolite = React.useRef<AnnouncerMessageBag>(EMPTY_MESSAGE);\n const [activePolite1, setActivePolite1] = React.useState<AnnouncerMessageBag>(EMPTY_MESSAGE);\n const [activePolite2, setActivePolite2] = React.useState<AnnouncerMessageBag>(EMPTY_MESSAGE);\n const alternatePolite = React.useRef(false);\n\n useEffect(() => {\n if (oldPolite.current.message !== newPolite?.message || oldPolite.current.id !== newPolite?.id) {\n setActivePolite1(alternatePolite.current ? EMPTY_MESSAGE : newPolite);\n setActivePolite2(alternatePolite.current ? newPolite : EMPTY_MESSAGE);\n oldPolite.current = newPolite;\n alternatePolite.current = !alternatePolite.current;\n }\n }, [newPolite]);\n\n return (\n <div>\n <MessageBlock ariaLive=\"assertive\" message={activeAssertive1.message} />\n <MessageBlock ariaLive=\"assertive\" message={activeAssertive2.message} />\n <MessageBlock ariaLive=\"polite\" message={activePolite1.message} />\n <MessageBlock ariaLive=\"polite\" message={activePolite2.message} />\n </div>\n );\n};\n\nexport default Announcer;\n"]}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
/** @private */
|
3
|
+
export declare type AnnouncerContextType = {
|
4
|
+
announceAssertive: (message: string, id: string) => void;
|
5
|
+
announcePolite: (message: string, id: string) => void;
|
6
|
+
};
|
7
|
+
/** @private */
|
8
|
+
declare const AnnouncerContext: React.Context<AnnouncerContextType>;
|
9
|
+
export default AnnouncerContext;
|
10
|
+
//# sourceMappingURL=AnnouncerContext.d.ts.map
|
@@ -0,0 +1,14 @@
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
2
|
+
// Licensed under the MIT license.
|
3
|
+
/// Adapted from: https://github.com/AlmeroSteyn/react-aria-live/blob/master/src/modules/AnnouncerContext.js
|
4
|
+
import React from 'react';
|
5
|
+
/** @private */
|
6
|
+
const AnnouncerContext = React.createContext({
|
7
|
+
announceAssertive: logContextWarning,
|
8
|
+
announcePolite: logContextWarning
|
9
|
+
});
|
10
|
+
function logContextWarning() {
|
11
|
+
console.warn('Announcement failed, LiveAnnouncer context is missing');
|
12
|
+
}
|
13
|
+
export default AnnouncerContext;
|
14
|
+
//# sourceMappingURL=AnnouncerContext.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"AnnouncerContext.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Announcer/AnnouncerContext.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,4GAA4G;AAE5G,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,eAAe;AACf,MAAM,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAAuB;IACjE,iBAAiB,EAAE,iBAAiB;IACpC,cAAc,EAAE,iBAAiB;CAClC,CAAC,CAAC;AAEH,SAAS,iBAAiB;IACxB,OAAO,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;AACxE,CAAC;AAED,eAAe,gBAAgB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/// Adapted from: https://github.com/AlmeroSteyn/react-aria-live/blob/master/src/modules/AnnouncerContext.js\n\nimport React from 'react';\n\n/** @private */\nexport type AnnouncerContextType = {\n announceAssertive: (message: string, id: string) => void;\n announcePolite: (message: string, id: string) => void;\n};\n\n/** @private */\nconst AnnouncerContext = React.createContext<AnnouncerContextType>({\n announceAssertive: logContextWarning,\n announcePolite: logContextWarning\n});\n\nfunction logContextWarning(): void {\n console.warn('Announcement failed, LiveAnnouncer context is missing');\n}\n\nexport default AnnouncerContext;\n"]}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
/** @private */
|
2
|
+
declare const AnnouncerMessage: (props: {
|
3
|
+
message: string;
|
4
|
+
ariaLive: string;
|
5
|
+
clearOnUnmount?: boolean | undefined;
|
6
|
+
announceAssertive: (message: string, id: string) => void;
|
7
|
+
announcePolite: (message: string, id: string) => void;
|
8
|
+
}) => null;
|
9
|
+
export default AnnouncerMessage;
|
10
|
+
//# sourceMappingURL=AnnouncerMessage.d.ts.map
|
@@ -0,0 +1,29 @@
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
2
|
+
// Licensed under the MIT license.
|
3
|
+
/// Adapted from: https://github.com/AlmeroSteyn/react-aria-live/blob/master/src/modules/AnnouncerMessage.js
|
4
|
+
import { useCallback, useEffect } from 'react';
|
5
|
+
import { v1 as createGUID } from 'uuid';
|
6
|
+
/** @private */
|
7
|
+
const AnnouncerMessage = (props) => {
|
8
|
+
const { message, ariaLive, clearOnUnmount, announceAssertive, announcePolite } = props;
|
9
|
+
const announce = useCallback(() => {
|
10
|
+
if (ariaLive === 'assertive') {
|
11
|
+
announceAssertive(message || '', createGUID());
|
12
|
+
}
|
13
|
+
if (ariaLive === 'polite') {
|
14
|
+
announcePolite(message || '', createGUID());
|
15
|
+
}
|
16
|
+
}, [announceAssertive, announcePolite, ariaLive, message]);
|
17
|
+
useEffect(() => {
|
18
|
+
announce();
|
19
|
+
return () => {
|
20
|
+
if (clearOnUnmount) {
|
21
|
+
announceAssertive('', createGUID());
|
22
|
+
announcePolite('', createGUID());
|
23
|
+
}
|
24
|
+
};
|
25
|
+
}, [message, clearOnUnmount, announce, announceAssertive, announcePolite]);
|
26
|
+
return null;
|
27
|
+
};
|
28
|
+
export default AnnouncerMessage;
|
29
|
+
//# sourceMappingURL=AnnouncerMessage.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"AnnouncerMessage.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Announcer/AnnouncerMessage.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,4GAA4G;AAE5G,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,EAAE,EAAE,IAAI,UAAU,EAAE,MAAM,MAAM,CAAC;AAExC,eAAe;AACf,MAAM,gBAAgB,GAAG,CAAC,KAMzB,EAAQ,EAAE;IACT,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,iBAAiB,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IAEvF,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE;QAChC,IAAI,QAAQ,KAAK,WAAW,EAAE;YAC5B,iBAAiB,CAAC,OAAO,IAAI,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;SAChD;QACD,IAAI,QAAQ,KAAK,QAAQ,EAAE;YACzB,cAAc,CAAC,OAAO,IAAI,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;SAC7C;IACH,CAAC,EAAE,CAAC,iBAAiB,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IAE3D,SAAS,CAAC,GAAG,EAAE;QACb,QAAQ,EAAE,CAAC;QACX,OAAO,GAAG,EAAE;YACV,IAAI,cAAc,EAAE;gBAClB,iBAAiB,CAAC,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;gBACpC,cAAc,CAAC,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;aAClC;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,iBAAiB,EAAE,cAAc,CAAC,CAAC,CAAC;IAE3E,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/// Adapted from: https://github.com/AlmeroSteyn/react-aria-live/blob/master/src/modules/AnnouncerMessage.js\n\nimport { useCallback, useEffect } from 'react';\nimport { v1 as createGUID } from 'uuid';\n\n/** @private */\nconst AnnouncerMessage = (props: {\n message: string;\n ariaLive: string;\n clearOnUnmount?: boolean;\n announceAssertive: (message: string, id: string) => void;\n announcePolite: (message: string, id: string) => void;\n}): null => {\n const { message, ariaLive, clearOnUnmount, announceAssertive, announcePolite } = props;\n\n const announce = useCallback(() => {\n if (ariaLive === 'assertive') {\n announceAssertive(message || '', createGUID());\n }\n if (ariaLive === 'polite') {\n announcePolite(message || '', createGUID());\n }\n }, [announceAssertive, announcePolite, ariaLive, message]);\n\n useEffect(() => {\n announce();\n return () => {\n if (clearOnUnmount) {\n announceAssertive('', createGUID());\n announcePolite('', createGUID());\n }\n };\n }, [message, clearOnUnmount, announce, announceAssertive, announcePolite]);\n\n return null;\n};\n\nexport default AnnouncerMessage;\n"]}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
2
|
+
// Licensed under the MIT license.
|
3
|
+
/// Adapted from: https://github.com/AlmeroSteyn/react-aria-live/blob/master/src/modules/LiveAnnouncer.js
|
4
|
+
import React, { useCallback, useMemo } from 'react';
|
5
|
+
import Announcer, { EMPTY_MESSAGE } from './Announcer';
|
6
|
+
import AnnouncerContext from './AnnouncerContext';
|
7
|
+
/** @private */
|
8
|
+
const LiveAnnouncer = (props) => {
|
9
|
+
const [politeMessage, setPoliteMessage] = React.useState(EMPTY_MESSAGE);
|
10
|
+
const [assertiveMessage, setAssertiveMessage] = React.useState(EMPTY_MESSAGE);
|
11
|
+
const announcePolite = useCallback((message, id) => {
|
12
|
+
setPoliteMessage({ message, id });
|
13
|
+
}, []);
|
14
|
+
const announceAssertive = useCallback((message, id) => {
|
15
|
+
setAssertiveMessage({ message, id });
|
16
|
+
}, []);
|
17
|
+
const updateFunctions = useMemo(() => ({
|
18
|
+
announcePolite,
|
19
|
+
announceAssertive
|
20
|
+
}), [announceAssertive, announcePolite]);
|
21
|
+
return (React.createElement(AnnouncerContext.Provider, { value: updateFunctions },
|
22
|
+
props.children,
|
23
|
+
React.createElement(Announcer, { assertive: assertiveMessage, polite: politeMessage })));
|
24
|
+
};
|
25
|
+
export default LiveAnnouncer;
|
26
|
+
//# sourceMappingURL=LiveAnnouncer.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"LiveAnnouncer.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Announcer/LiveAnnouncer.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,yGAAyG;AAEzG,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,SAAS,EAAE,EAAuB,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD,eAAe;AACf,MAAM,aAAa,GAAG,CAAC,KAAqC,EAAe,EAAE;IAC3E,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAsB,aAAa,CAAC,CAAC;IAC7F,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAsB,aAAa,CAAC,CAAC;IAEnG,MAAM,cAAc,GAAG,WAAW,CAAC,CAAC,OAAe,EAAE,EAAU,EAAE,EAAE;QACjE,gBAAgB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;IACpC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,iBAAiB,GAAG,WAAW,CAAC,CAAC,OAAe,EAAE,EAAU,EAAE,EAAE;QACpE,mBAAmB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;IACvC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,eAAe,GAAG,OAAO,CAC7B,GAAG,EAAE,CAAC,CAAC;QACL,cAAc;QACd,iBAAiB;KAClB,CAAC,EACF,CAAC,iBAAiB,EAAE,cAAc,CAAC,CACpC,CAAC;IAEF,OAAO,CACL,oBAAC,gBAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,eAAe;QAC9C,KAAK,CAAC,QAAQ;QACf,oBAAC,SAAS,IAAC,SAAS,EAAE,gBAAgB,EAAE,MAAM,EAAE,aAAa,GAAI,CACvC,CAC7B,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/// Adapted from: https://github.com/AlmeroSteyn/react-aria-live/blob/master/src/modules/LiveAnnouncer.js\n\nimport React, { useCallback, useMemo } from 'react';\nimport Announcer, { AnnouncerMessageBag, EMPTY_MESSAGE } from './Announcer';\nimport AnnouncerContext from './AnnouncerContext';\n\n/** @private */\nconst LiveAnnouncer = (props: { children: React.ReactChild }): JSX.Element => {\n const [politeMessage, setPoliteMessage] = React.useState<AnnouncerMessageBag>(EMPTY_MESSAGE);\n const [assertiveMessage, setAssertiveMessage] = React.useState<AnnouncerMessageBag>(EMPTY_MESSAGE);\n\n const announcePolite = useCallback((message: string, id: string) => {\n setPoliteMessage({ message, id });\n }, []);\n\n const announceAssertive = useCallback((message: string, id: string) => {\n setAssertiveMessage({ message, id });\n }, []);\n\n const updateFunctions = useMemo(\n () => ({\n announcePolite,\n announceAssertive\n }),\n [announceAssertive, announcePolite]\n );\n\n return (\n <AnnouncerContext.Provider value={updateFunctions}>\n {props.children}\n <Announcer assertive={assertiveMessage} polite={politeMessage} />\n </AnnouncerContext.Provider>\n );\n};\n\nexport default LiveAnnouncer;\n"]}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
2
|
+
// Licensed under the MIT license.
|
3
|
+
/// Adapted from: https://github.com/AlmeroSteyn/react-aria-live/blob/master/src/modules/LiveMessage.js
|
4
|
+
import React from 'react';
|
5
|
+
import AnnouncerContext from './AnnouncerContext';
|
6
|
+
import AnnouncerMessage from './AnnouncerMessage';
|
7
|
+
/** @private */
|
8
|
+
const LiveMessage = (props) => (React.createElement(AnnouncerContext.Consumer, null, (contextProps) => React.createElement(AnnouncerMessage, Object.assign({}, contextProps, props))));
|
9
|
+
export default LiveMessage;
|
10
|
+
//# sourceMappingURL=LiveMessage.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"LiveMessage.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Announcer/LiveMessage.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,uGAAuG;AAEvG,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD,eAAe;AACf,MAAM,WAAW,GAAG,CAAC,KAAsE,EAAe,EAAE,CAAC,CAC3G,oBAAC,gBAAgB,CAAC,QAAQ,QACvB,CAAC,YAAY,EAAE,EAAE,CAAC,oBAAC,gBAAgB,oBAAK,YAAY,EAAM,KAAK,EAAI,CAC1C,CAC7B,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/// Adapted from: https://github.com/AlmeroSteyn/react-aria-live/blob/master/src/modules/LiveMessage.js\n\nimport React from 'react';\nimport AnnouncerContext from './AnnouncerContext';\nimport AnnouncerMessage from './AnnouncerMessage';\n\n/** @private */\nconst LiveMessage = (props: { message: string; ariaLive: string; clearOnUnmount?: boolean }): JSX.Element => (\n <AnnouncerContext.Consumer>\n {(contextProps) => <AnnouncerMessage {...contextProps} {...props} />}\n </AnnouncerContext.Consumer>\n);\n\nexport default LiveMessage;\n"]}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
2
|
+
// Licensed under the MIT license.
|
3
|
+
/// Adapted from: https://github.com/AlmeroSteyn/react-aria-live/blob/master/src/modules/MessageBlock.js
|
4
|
+
import React from 'react';
|
5
|
+
const offScreenStyle = {
|
6
|
+
border: 0,
|
7
|
+
clip: 'rect(0 0 0 0)',
|
8
|
+
height: '1px',
|
9
|
+
margin: '-1px',
|
10
|
+
overflow: 'hidden',
|
11
|
+
whiteSpace: 'nowrap',
|
12
|
+
padding: 0,
|
13
|
+
width: '1px',
|
14
|
+
position: 'absolute'
|
15
|
+
};
|
16
|
+
/** @private */
|
17
|
+
const MessageBlock = (props) => (React.createElement("div", { style: offScreenStyle, role: "log", "aria-live": props.ariaLive }, props.message ? props.message : ''));
|
18
|
+
export default MessageBlock;
|
19
|
+
//# sourceMappingURL=MessageBlock.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"MessageBlock.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Announcer/MessageBlock.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,wGAAwG;AAExG,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,cAAc,GAAwB;IAC1C,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,eAAe;IACrB,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,MAAM;IACd,QAAQ,EAAE,QAAQ;IAClB,UAAU,EAAE,QAAQ;IACpB,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,KAAK;IACZ,QAAQ,EAAE,UAAU;CACrB,CAAC;AAEF,eAAe;AACf,MAAM,YAAY,GAAG,CAAC,KAGrB,EAAe,EAAE,CAAC,CACjB,6BAAK,KAAK,EAAE,cAAc,EAAE,IAAI,EAAC,KAAK,eAAY,KAAK,CAAC,QAAQ,IAC7D,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAC/B,CACP,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/// Adapted from: https://github.com/AlmeroSteyn/react-aria-live/blob/master/src/modules/MessageBlock.js\n\nimport React from 'react';\n\nconst offScreenStyle: React.CSSProperties = {\n border: 0,\n clip: 'rect(0 0 0 0)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n padding: 0,\n width: '1px',\n position: 'absolute'\n};\n\n/** @private */\nconst MessageBlock = (props: {\n message: string;\n ariaLive: 'assertive' | 'polite' | 'off' | undefined;\n}): JSX.Element => (\n <div style={offScreenStyle} role=\"log\" aria-live={props.ariaLive}>\n {props.message ? props.message : ''}\n </div>\n);\n\nexport default MessageBlock;\n"]}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
// Licensed under the MIT license.
|
3
3
|
import { Stack, FocusZone } from '@fluentui/react';
|
4
4
|
import React, { useEffect, useRef, useState, useCallback } from 'react';
|
5
|
-
import { Ref } from
|
5
|
+
import { Ref } from "../../../northstar-wrapper/src";
|
6
6
|
import { _Caption } from './Caption';
|
7
7
|
import { captionContainerClassName, captionsBannerClassName, captionsContainerClassName } from './styles/Captions.style';
|
8
8
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CaptionsBanner.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/CaptionsBanner.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAExE,OAAO,EAAE,GAAG,EAAE,
|
1
|
+
{"version":3,"file":"CaptionsBanner.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/CaptionsBanner.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAExE,OAAO,EAAE,GAAG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CAAE,mBAAmB,CAAC,QAAQ,EAAE,uBAAuB,CAAC,CAAC;QAC5E,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,uBAAuB,CAAC,CAAC,CAAC;IAE9B,SAAS,CAAC,GAAG,EAAE;QACb,2FAA2F;QAC3F,IAAI,kBAAkB,EAAE;YACtB,cAAc,EAAE,CAAC;SAClB;IACH,CAAC,EAAE,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAEnC,OAAO,CACL,0CACG,YAAY,IAAI,CACf,oBAAC,SAAS,IAAC,EAAE,EAAC,IAAI,EAAC,SAAS,EAAE,0BAA0B;QACtD,oBAAC,GAAG,IAAC,QAAQ,EAAE,oBAAoB;YACjC,oBAAC,KAAK,IAAC,aAAa,EAAC,OAAO,EAAC,SAAS,EAAE,uBAAuB,IAC5D,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;gBACxB,OAAO,CACL,6BAAK,GAAG,EAAE,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,yBAAyB,uBAAqB,IAAI;oBACjF,oBAAC,QAAQ,oBAAK,OAAO,IAAE,cAAc,EAAE,cAAc,IAAI,CACrD,CACP,CAAC;YACJ,CAAC,CAAC,CACI,CACJ,CACI,CACb,CACA,CACJ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { Stack, FocusZone } from '@fluentui/react';\nimport React, { useEffect, useRef, useState, useCallback } from 'react';\nimport { _FileUploadCardsStrings } from './FileUploadCards';\nimport { Ref } from '@internal/northstar-wrapper';\nimport { _Caption } from './Caption';\nimport {\n captionContainerClassName,\n captionsBannerClassName,\n captionsContainerClassName\n} from './styles/Captions.style';\nimport { OnRenderAvatarCallback } from '../types';\n\n/**\n * @internal\n * information required for each line of caption\n */\nexport type _CaptionsInfo = {\n id: string;\n displayName: string;\n captionText: string;\n userId?: string;\n};\n\n/**\n * @internal\n * _CaptionsBanner Component Props.\n */\nexport interface _CaptionsBannerProps {\n captions: _CaptionsInfo[];\n isCaptionsOn?: boolean;\n /**\n * Optional callback to override render of the avatar.\n *\n * @param userId - user Id\n */\n onRenderAvatar?: OnRenderAvatarCallback;\n}\n\n/**\n * @internal\n * A component for displaying a CaptionsBanner with user icon, displayName and captions text.\n */\nexport const _CaptionsBanner = (props: _CaptionsBannerProps): JSX.Element => {\n const { captions, isCaptionsOn, onRenderAvatar } = props;\n const captionsScrollDivRef = useRef<HTMLElement>(null);\n const [isAtBottomOfScroll, setIsAtBottomOfScroll] = useState<boolean>(true);\n\n const scrollToBottom = (): void => {\n if (captionsScrollDivRef.current) {\n captionsScrollDivRef.current.scrollTop = captionsScrollDivRef.current.scrollHeight;\n }\n };\n\n const handleScrollToTheBottom = useCallback((): void => {\n if (!captionsScrollDivRef.current) {\n return;\n }\n const atBottom =\n Math.ceil(captionsScrollDivRef.current.scrollTop) >=\n captionsScrollDivRef.current.scrollHeight - captionsScrollDivRef.current.clientHeight;\n\n setIsAtBottomOfScroll(atBottom);\n }, []);\n\n useEffect(() => {\n const captionsScrollDiv = captionsScrollDivRef.current;\n captionsScrollDiv?.addEventListener('scroll', handleScrollToTheBottom);\n\n return () => {\n captionsScrollDiv?.removeEventListener('scroll', handleScrollToTheBottom);\n };\n }, [handleScrollToTheBottom]);\n\n useEffect(() => {\n // only auto scroll to bottom is already is at bottom of scroll before new caption comes in\n if (isAtBottomOfScroll) {\n scrollToBottom();\n }\n }, [captions, isAtBottomOfScroll]);\n\n return (\n <>\n {isCaptionsOn && (\n <FocusZone as=\"ul\" className={captionsContainerClassName}>\n <Ref innerRef={captionsScrollDivRef}>\n <Stack verticalAlign=\"start\" className={captionsBannerClassName}>\n {captions.map((caption) => {\n return (\n <div key={caption.id} className={captionContainerClassName} data-is-focusable={true}>\n <_Caption {...caption} onRenderAvatar={onRenderAvatar} />\n </div>\n );\n })}\n </Stack>\n </Ref>\n </FocusZone>\n )}\n </>\n );\n};\n\"../../../northstar-wrapper/src\""]}
|
package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageActionMenu.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Theme } from '@fluentui/react';
|
2
|
-
import { MenuProps } from
|
2
|
+
import { MenuProps } from "../../../../northstar-wrapper/src";
|
3
3
|
import React from 'react';
|
4
4
|
/** @private */
|
5
5
|
export declare type ChatMessageActionMenuProps = MenuProps & {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
2
2
|
// Licensed under the MIT license.
|
3
3
|
import { Icon, mergeStyles } from '@fluentui/react';
|
4
|
-
import { Ref } from
|
4
|
+
import { Ref } from "../../../../northstar-wrapper/src";
|
5
5
|
import React from 'react';
|
6
6
|
import { chatActionsCSS, iconWrapperStyle } from '../styles/ChatMessageComponent.styles';
|
7
7
|
/**
|
package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageActionMenu.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ChatMessageActionMenu.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/ChatMessage/ChatMessageActionMenu.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAS,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAa,GAAG,EAAE,
|
1
|
+
{"version":3,"file":"ChatMessageActionMenu.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/ChatMessage/ChatMessageActionMenu.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAS,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAa,GAAG,EAAE,0CAAoC;AAE7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAOzF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,SAU1C,EAA0C,EAAE;IAC3C,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE;QACtB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,SAAS,GAAG,WAAW,CAAC,cAAc,EAAE;QAC5C,KAAK,EAAE,EAAE,SAAS,EAAE,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,eAAe,EAAE,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE;KACzG,CAAC,CAAC;IAEH,MAAM,eAAe,GAA+B;QAClD,cAAc,EAAE,SAAS,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;QAC/D,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,CAAC,CAAC;QACf,SAAS,EAAE,SAAS;QACpB,WAAW,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,mBAAmB,EAAE;QAClD,KAAK,EAAE;YACL;gBACE,QAAQ,EAAE,CACR,oBAAC,GAAG,IAAC,QAAQ,EAAE,SAAS,CAAC,aAAa;oBACpC,oBAAC,IAAI,IACH,QAAQ,EAAC,oBAAoB,gBAClB,oCAAoC,gBACnC,SAAS,CAAC,SAAS,EAC/B,MAAM,EAAE,gBAAgB,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,GAC9D,CACE,CACP;gBAED,GAAG,EAAE,YAAY;gBACjB,SAAS,EAAE,KAAK;aACjB;SACF;KACF,CAAC;IAEF,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Icon, mergeStyles, Theme } from '@fluentui/react';\nimport { MenuProps, Ref } from '@internal/northstar-wrapper';\nimport { _formatString } from '@internal/acs-ui-common';\nimport React from 'react';\nimport { chatActionsCSS, iconWrapperStyle } from '../styles/ChatMessageComponent.styles';\n\n/** @private */\nexport type ChatMessageActionMenuProps = MenuProps & {\n showActionMenu?: boolean | undefined;\n};\n\n/**\n * Props for the Chat.Message action menu.\n * This is the 3 dots that appear when hovering over one of your own chat messages.\n *\n * @private\n */\nexport const chatMessageActionMenuProps = (menuProps: {\n /** String for aria label that is read by Screen readers */\n ariaLabel?: string;\n /** Whether the action menu button is enabled, if not this will always return undefined */\n enabled: boolean;\n /** Whether to force showing the action menu button - this has no effect if the action menu button is not enabled */\n forceShow: boolean;\n menuButtonRef: React.MutableRefObject<HTMLElement | null>;\n onActionButtonClick: () => void;\n theme: Theme;\n}): ChatMessageActionMenuProps | undefined => {\n if (!menuProps.enabled) {\n return undefined;\n }\n\n const menuClass = mergeStyles(chatActionsCSS, {\n 'ul&': { boxShadow: menuProps.theme.effects.elevation4, backgroundColor: menuProps.theme.palette.white }\n });\n\n const actionMenuProps: ChatMessageActionMenuProps = {\n showActionMenu: menuProps.forceShow === true ? true : undefined,\n iconOnly: true,\n activeIndex: -1,\n className: menuClass,\n onItemClick: () => menuProps.onActionButtonClick(),\n items: [\n {\n children: (\n <Ref innerRef={menuProps.menuButtonRef}>\n <Icon\n iconName=\"ChatMessageOptions\"\n data-ui-id=\"chat-composite-message-action-icon\"\n aria-label={menuProps.ariaLabel}\n styles={iconWrapperStyle(menuProps.theme, menuProps.forceShow)}\n />\n </Ref>\n ),\n\n key: 'menuButton',\n indicator: false\n }\n ]\n };\n\n return actionMenuProps;\n};\n\"../../../../northstar-wrapper/src\"\"../../../../acs-ui-common/src\""]}
|
package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageActionsFlyout.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
2
2
|
// Licensed under the MIT license.
|
3
3
|
import { concatStyleSets, ContextualMenu, DirectionalHint, Persona, PersonaSize, useTheme } from '@fluentui/react';
|
4
|
-
import { _formatString } from "../../../../acs-ui-common/src";
|
4
|
+
import { _pxToRem, _formatString } from "../../../../acs-ui-common/src";
|
5
5
|
import React, { useMemo } from 'react';
|
6
6
|
import { chatMessageMenuStyle, menuIconStyleSet, menuItemIncreasedSizeStyles, menuSubIconStyleSet } from '../styles/ChatMessageComponent.styles';
|
7
7
|
/**
|
@@ -89,7 +89,16 @@ export const ChatMessageActionFlyout = (props) => {
|
|
89
89
|
subMenuProps: {
|
90
90
|
id: 'chat-composite-message-contextual-menu-read-name-list',
|
91
91
|
items: messageReadByList !== null && messageReadByList !== void 0 ? messageReadByList : [],
|
92
|
-
calloutProps: preventUnwantedDismissProps
|
92
|
+
calloutProps: preventUnwantedDismissProps,
|
93
|
+
styles: concatStyleSets({
|
94
|
+
root: {
|
95
|
+
maxWidth: _pxToRem(320),
|
96
|
+
span: {
|
97
|
+
overflow: 'hidden',
|
98
|
+
textOverflow: 'ellipsis'
|
99
|
+
}
|
100
|
+
}
|
101
|
+
})
|
93
102
|
},
|
94
103
|
iconProps: {
|
95
104
|
iconName: 'MessageSeen',
|
package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageActionsFlyout.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ChatMessageActionsFlyout.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/ChatMessage/ChatMessageActionsFlyout.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,eAAe,EACf,cAAc,EACd,eAAe,EAGf,OAAO,EACP,WAAW,EAEX,QAAQ,EACT,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,sCAAgC;AACxD,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,2BAA2B,EAC3B,mBAAmB,EACpB,MAAM,uCAAuC,CAAC;AA+B/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,KAAmC,EAAe,EAAE;;IAC1F,MAAM,KAAK,GAAG,QAAQ,EAAE,C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ACpB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,eAAe,EAAE,eAAe,CAAC,YAAY,EAC7C,SAAS,EAAE,oBAAoB,EAC/B,YAAY,EAAE,2BAA2B,GACzC,CACH,CAAC;AACJ,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,2BAA2B,GAAG;IAClC,qBAAqB,EAAE,CAAC,EAAqE,EAAW,EAAE;QACxG,OAAO,EAAE,CAAC,IAAI,KAAK,QAAQ,CAAC;IAC9B,CAAC;CACF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n concatStyleSets,\n ContextualMenu,\n DirectionalHint,\n IContextualMenuItem,\n IPersona,\n Persona,\n PersonaSize,\n Target,\n useTheme\n} from '@fluentui/react';\nimport { _formatString } from '@internal/acs-ui-common';\nimport React, { useMemo } from 'react';\nimport { OnRenderAvatarCallback } from '../../types';\nimport { MessageThreadStrings } from '../MessageThread';\nimport {\n chatMessageMenuStyle,\n menuIconStyleSet,\n menuItemIncreasedSizeStyles,\n menuSubIconStyleSet\n} from '../styles/ChatMessageComponent.styles';\n\n/** @private */\nexport interface ChatMessageActionFlyoutProps {\n target?: Target;\n hidden: boolean;\n strings: MessageThreadStrings;\n onEditClick?: () => void;\n onRemoveClick?: () => void;\n onResendClick?: () => void;\n onDismiss: () => void;\n messageReadBy?: { id: string; displayName: string }[];\n remoteParticipantsCount?: number;\n messageStatus?: string;\n /**\n * Whether the status indicator for each message is displayed or not.\n */\n showMessageStatus?: boolean;\n /**\n * Increase the height of the flyout items.\n * Recommended when interacting with the chat message using touch.\n */\n increaseFlyoutItemSize: boolean;\n /**\n * Optional callback to override render of the avatar.\n *\n * @param userId - user Id\n */\n onRenderAvatar?: OnRenderAvatarCallback;\n}\n\n/**\n * Chat message actions flyout that contains actions such as Edit Message, or Remove Message.\n *\n * @private\n */\nexport const ChatMessageActionFlyout = (props: ChatMessageActionFlyoutProps): JSX.Element => {\n const theme = useTheme();\n const messageReadByCount = props.messageReadBy?.length;\n\n const sortedMessageReadyByList = [...(props.messageReadBy ?? [])].sort((a, b) =>\n a.displayName.localeCompare(b.displayName)\n );\n\n const messageReadByList: IContextualMenuItem[] | undefined = sortedMessageReadyByList?.map((person) => {\n const personaOptions: IPersona = {\n hidePersonaDetails: true,\n size: PersonaSize.size24,\n text: person.displayName,\n showOverflowTooltip: false,\n styles: {\n root: {\n margin: '0.25rem'\n }\n }\n };\n const { onRenderAvatar } = props;\n return {\n key: person.displayName,\n text: person.displayName,\n itemProps: { styles: props.increaseFlyoutItemSize ? menuItemIncreasedSizeStyles : undefined },\n onRenderIcon: () =>\n onRenderAvatar ? onRenderAvatar(person.id ?? '', personaOptions) : <Persona {...personaOptions} />,\n iconProps: {\n styles: menuIconStyleSet\n }\n };\n });\n\n const menuItems = useMemo((): IContextualMenuItem[] => {\n const items: IContextualMenuItem[] = [\n {\n key: 'Edit',\n 'data-ui-id': 'chat-composite-message-contextual-menu-edit-action',\n text: props.strings.editMessage,\n itemProps: {\n styles: props.increaseFlyoutItemSize ? menuItemIncreasedSizeStyles : undefined\n },\n iconProps: { iconName: 'MessageEdit', styles: menuIconStyleSet },\n onClick: props.onEditClick\n },\n {\n key: 'Remove',\n text: props.strings.removeMessage,\n itemProps: { styles: props.increaseFlyoutItemSize ? menuItemIncreasedSizeStyles : undefined },\n iconProps: {\n iconName: 'MessageRemove',\n styles: menuIconStyleSet\n },\n onClick: props.onRemoveClick\n }\n ];\n // only show read by x of x if more than 3 participants in total including myself\n // TODO: change strings.messageReadCount to be required if we can fallback to our own en-us strings for anything that Contoso doesn't provide\n if (\n props.remoteParticipantsCount &&\n messageReadByCount !== undefined &&\n props.remoteParticipantsCount >= 2 &&\n props.showMessageStatus &&\n props.strings.messageReadCount &&\n props.messageStatus !== 'failed'\n ) {\n items.push({\n key: 'Read Count',\n 'data-ui-id': 'chat-composite-message-contextual-menu-read-info',\n text: _formatString(props.strings.messageReadCount, {\n messageReadByCount: `${messageReadByCount}`,\n remoteParticipantsCount: `${props.remoteParticipantsCount}`\n }),\n itemProps: {\n styles: concatStyleSets(\n {\n linkContent: {\n color: messageReadByCount > 0 ? theme.palette.neutralPrimary : theme.palette.neutralTertiary\n },\n root: {\n borderTop: `1px solid ${theme.palette.neutralLighter}`\n }\n },\n props.increaseFlyoutItemSize ? menuItemIncreasedSizeStyles : undefined\n )\n },\n calloutProps: preventUnwantedDismissProps,\n subMenuProps: {\n id: 'chat-composite-message-contextual-menu-read-name-list',\n items: messageReadByList ?? [],\n calloutProps: preventUnwantedDismissProps\n },\n iconProps: {\n iconName: 'MessageSeen',\n styles: {\n root: {\n color: messageReadByCount > 0 ? theme.palette.themeDarkAlt : theme.palette.neutralTertiary\n }\n }\n },\n submenuIconProps: {\n iconName: 'HorizontalGalleryRightButton',\n styles: menuSubIconStyleSet\n },\n disabled: messageReadByCount <= 0\n });\n } else if (props.messageStatus === 'failed' && props.strings.resendMessage) {\n items.push({\n key: 'Resend',\n text: props.strings.resendMessage,\n itemProps: {\n styles: concatStyleSets(\n {\n linkContent: {\n color: theme.palette.neutralPrimary\n },\n root: {\n borderTop: `1px solid ${theme.palette.neutralLighter}`\n }\n },\n props.increaseFlyoutItemSize ? menuItemIncreasedSizeStyles : undefined\n )\n },\n calloutProps: preventUnwantedDismissProps,\n iconProps: {\n iconName: 'MessageResend',\n styles: {\n root: {\n color: theme.palette.themeDarkAlt\n }\n }\n },\n onClick: props.onResendClick\n });\n }\n\n return items;\n }, [\n props.strings.editMessage,\n props.strings.removeMessage,\n props.strings.messageReadCount,\n props.strings.resendMessage,\n props.messageStatus,\n props.increaseFlyoutItemSize,\n props.onEditClick,\n props.onRemoveClick,\n props.onResendClick,\n props.remoteParticipantsCount,\n props.showMessageStatus,\n messageReadByCount,\n theme.palette.neutralPrimary,\n theme.palette.neutralTertiary,\n theme.palette.neutralLighter,\n theme.palette.themeDarkAlt,\n messageReadByList\n ]);\n\n // gap space uses pixels\n return (\n <ContextualMenu\n id=\"chat-composite-message-contextual-menu\"\n alignTargetEdge={true}\n gapSpace={5 /*px*/}\n isBeakVisible={false}\n items={menuItems}\n hidden={props.hidden}\n target={props.target}\n onDismiss={props.onDismiss}\n directionalHint={DirectionalHint.topRightEdge}\n className={chatMessageMenuStyle}\n calloutProps={preventUnwantedDismissProps}\n />\n );\n};\n\n/**\n * Similar to {@link preventDismissOnEvent}, but not prevent dismissing from scrolling, since it is causing bugs in chat thread.\n */\nconst preventUnwantedDismissProps = {\n preventDismissOnEvent: (ev: Event | React.FocusEvent | React.KeyboardEvent | React.MouseEvent): boolean => {\n return ev.type === 'resize';\n }\n};\n\"../../../../acs-ui-common/src\""]}
|
1
|
+
{"version":3,"file":"ChatMessageActionsFlyout.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/ChatMessage/ChatMessageActionsFlyout.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,eAAe,EACf,cAAc,EACd,eAAe,EAGf,OAAO,EACP,WAAW,EAEX,QAAQ,EACT,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,sCAAgC;AAClE,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,2BAA2B,EAC3B,mBAAmB,EACpB,MAAM,uCAAuC,CAAC;AA+B/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,KAAmC,EAAe,EAAE;;IAC1F,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,kBAAkB,GAAG,MAAA,KAAK,CAAC,aAAa,0CAAE,MAAM,CAAC;IAEvD,MAAM,wBAAwB,GAAG,CAAC,GAAG,CAAC,MAAA,KAAK,CAAC,aAAa,mCAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAC9E,CAAC,CAAC,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E,eAAe,CAAC,YAAY,EAC7C,SAAS,EAAE,oBAAoB,EAC/B,YAAY,EAAE,2BAA2B,GACzC,CACH,CAAC;AACJ,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,2BAA2B,GAAG;IAClC,qBAAqB,EAAE,CAAC,EAAqE,EAAW,EAAE;QACxG,OAAO,EAAE,CAAC,IAAI,KAAK,QAAQ,CAAC;IAC9B,CAAC;CACF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n concatStyleSets,\n ContextualMenu,\n DirectionalHint,\n IContextualMenuItem,\n IPersona,\n Persona,\n PersonaSize,\n Target,\n useTheme\n} from '@fluentui/react';\nimport { _pxToRem, _formatString } from '@internal/acs-ui-common';\nimport React, { useMemo } from 'react';\nimport { OnRenderAvatarCallback } from '../../types';\nimport { MessageThreadStrings } from '../MessageThread';\nimport {\n chatMessageMenuStyle,\n menuIconStyleSet,\n menuItemIncreasedSizeStyles,\n menuSubIconStyleSet\n} from '../styles/ChatMessageComponent.styles';\n\n/** @private */\nexport interface ChatMessageActionFlyoutProps {\n target?: Target;\n hidden: boolean;\n strings: MessageThreadStrings;\n onEditClick?: () => void;\n onRemoveClick?: () => void;\n onResendClick?: () => void;\n onDismiss: () => void;\n messageReadBy?: { id: string; displayName: string }[];\n remoteParticipantsCount?: number;\n messageStatus?: string;\n /**\n * Whether the status indicator for each message is displayed or not.\n */\n showMessageStatus?: boolean;\n /**\n * Increase the height of the flyout items.\n * Recommended when interacting with the chat message using touch.\n */\n increaseFlyoutItemSize: boolean;\n /**\n * Optional callback to override render of the avatar.\n *\n * @param userId - user Id\n */\n onRenderAvatar?: OnRenderAvatarCallback;\n}\n\n/**\n * Chat message actions flyout that contains actions such as Edit Message, or Remove Message.\n *\n * @private\n */\nexport const ChatMessageActionFlyout = (props: ChatMessageActionFlyoutProps): JSX.Element => {\n const theme = useTheme();\n const messageReadByCount = props.messageReadBy?.length;\n\n const sortedMessageReadyByList = [...(props.messageReadBy ?? [])].sort((a, b) =>\n a.displayName.localeCompare(b.displayName)\n );\n\n const messageReadByList: IContextualMenuItem[] | undefined = sortedMessageReadyByList?.map((person) => {\n const personaOptions: IPersona = {\n hidePersonaDetails: true,\n size: PersonaSize.size24,\n text: person.displayName,\n showOverflowTooltip: false,\n styles: {\n root: {\n margin: '0.25rem'\n }\n }\n };\n const { onRenderAvatar } = props;\n return {\n key: person.displayName,\n text: person.displayName,\n itemProps: { styles: props.increaseFlyoutItemSize ? menuItemIncreasedSizeStyles : undefined },\n onRenderIcon: () =>\n onRenderAvatar ? onRenderAvatar(person.id ?? '', personaOptions) : <Persona {...personaOptions} />,\n iconProps: {\n styles: menuIconStyleSet\n }\n };\n });\n\n const menuItems = useMemo((): IContextualMenuItem[] => {\n const items: IContextualMenuItem[] = [\n {\n key: 'Edit',\n 'data-ui-id': 'chat-composite-message-contextual-menu-edit-action',\n text: props.strings.editMessage,\n itemProps: {\n styles: props.increaseFlyoutItemSize ? menuItemIncreasedSizeStyles : undefined\n },\n iconProps: { iconName: 'MessageEdit', styles: menuIconStyleSet },\n onClick: props.onEditClick\n },\n {\n key: 'Remove',\n text: props.strings.removeMessage,\n itemProps: { styles: props.increaseFlyoutItemSize ? menuItemIncreasedSizeStyles : undefined },\n iconProps: {\n iconName: 'MessageRemove',\n styles: menuIconStyleSet\n },\n onClick: props.onRemoveClick\n }\n ];\n // only show read by x of x if more than 3 participants in total including myself\n // TODO: change strings.messageReadCount to be required if we can fallback to our own en-us strings for anything that Contoso doesn't provide\n if (\n props.remoteParticipantsCount &&\n messageReadByCount !== undefined &&\n props.remoteParticipantsCount >= 2 &&\n props.showMessageStatus &&\n props.strings.messageReadCount &&\n props.messageStatus !== 'failed'\n ) {\n items.push({\n key: 'Read Count',\n 'data-ui-id': 'chat-composite-message-contextual-menu-read-info',\n text: _formatString(props.strings.messageReadCount, {\n messageReadByCount: `${messageReadByCount}`,\n remoteParticipantsCount: `${props.remoteParticipantsCount}`\n }),\n itemProps: {\n styles: concatStyleSets(\n {\n linkContent: {\n color: messageReadByCount > 0 ? theme.palette.neutralPrimary : theme.palette.neutralTertiary\n },\n root: {\n borderTop: `1px solid ${theme.palette.neutralLighter}`\n }\n },\n props.increaseFlyoutItemSize ? menuItemIncreasedSizeStyles : undefined\n )\n },\n calloutProps: preventUnwantedDismissProps,\n subMenuProps: {\n id: 'chat-composite-message-contextual-menu-read-name-list',\n items: messageReadByList ?? [],\n calloutProps: preventUnwantedDismissProps,\n styles: concatStyleSets({\n root: {\n maxWidth: _pxToRem(320),\n span: {\n overflow: 'hidden',\n textOverflow: 'ellipsis'\n }\n }\n })\n },\n iconProps: {\n iconName: 'MessageSeen',\n styles: {\n root: {\n color: messageReadByCount > 0 ? theme.palette.themeDarkAlt : theme.palette.neutralTertiary\n }\n }\n },\n submenuIconProps: {\n iconName: 'HorizontalGalleryRightButton',\n styles: menuSubIconStyleSet\n },\n disabled: messageReadByCount <= 0\n });\n } else if (props.messageStatus === 'failed' && props.strings.resendMessage) {\n items.push({\n key: 'Resend',\n text: props.strings.resendMessage,\n itemProps: {\n styles: concatStyleSets(\n {\n linkContent: {\n color: theme.palette.neutralPrimary\n },\n root: {\n borderTop: `1px solid ${theme.palette.neutralLighter}`\n }\n },\n props.increaseFlyoutItemSize ? menuItemIncreasedSizeStyles : undefined\n )\n },\n calloutProps: preventUnwantedDismissProps,\n iconProps: {\n iconName: 'MessageResend',\n styles: {\n root: {\n color: theme.palette.themeDarkAlt\n }\n }\n },\n onClick: props.onResendClick\n });\n }\n\n return items;\n }, [\n props.strings.editMessage,\n props.strings.removeMessage,\n props.strings.messageReadCount,\n props.strings.resendMessage,\n props.messageStatus,\n props.increaseFlyoutItemSize,\n props.onEditClick,\n props.onRemoveClick,\n props.onResendClick,\n props.remoteParticipantsCount,\n props.showMessageStatus,\n messageReadByCount,\n theme.palette.neutralPrimary,\n theme.palette.neutralTertiary,\n theme.palette.neutralLighter,\n theme.palette.themeDarkAlt,\n messageReadByList\n ]);\n\n // gap space uses pixels\n return (\n <ContextualMenu\n id=\"chat-composite-message-contextual-menu\"\n alignTargetEdge={true}\n gapSpace={5 /*px*/}\n isBeakVisible={false}\n items={menuItems}\n hidden={props.hidden}\n target={props.target}\n onDismiss={props.onDismiss}\n directionalHint={DirectionalHint.topRightEdge}\n className={chatMessageMenuStyle}\n calloutProps={preventUnwantedDismissProps}\n />\n );\n};\n\n/**\n * Similar to {@link preventDismissOnEvent}, but not prevent dismissing from scrolling, since it is causing bugs in chat thread.\n */\nconst preventUnwantedDismissProps = {\n preventDismissOnEvent: (ev: Event | React.FocusEvent | React.KeyboardEvent | React.MouseEvent): boolean => {\n return ev.type === 'resize';\n }\n};\n\"../../../../acs-ui-common/src\""]}
|
@@ -1,10 +1,9 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { MessageThreadStrings } from '../MessageThread';
|
3
|
-
import { ChatMessage, OnRenderAvatarCallback } from '../../types';
|
3
|
+
import { ChatMessage, ComponentSlotStyle, OnRenderAvatarCallback } from '../../types';
|
4
4
|
import { BlockedMessage } from '../../types';
|
5
5
|
import { FileDownloadHandler, FileMetadata } from '../FileDownloadCards';
|
6
6
|
import { MentionOptions } from '../MentionPopover';
|
7
|
-
import { ComponentSlotStyle } from '../../types/ComponentSlotStyle';
|
8
7
|
declare type ChatMessageComponentProps = {
|
9
8
|
message: ChatMessage | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage;
|
10
9
|
userId: string;
|
package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponent.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ChatMessageComponent.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/ChatMessage/ChatMessageComponent.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAGlC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAKhF,OAAO,EAAE,mCAAmC,EAAE,MAAM,uCAAuC,CAAC;
|
1
|
+
{"version":3,"file":"ChatMessageComponent.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/ChatMessage/ChatMessageComponent.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAGlC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAKhF,OAAO,EAAE,mCAAmC,EAAE,MAAM,uCAAuC,CAAC;AAyF5F;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAgC,EAAe,EAAE;;IACpF,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAElD,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAE1E,MAAM,EAAE,eAAe,EAAE,aAAa,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAC1D,MAAM,eAAe,GAAG,iBAAiB,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3F,MAAM,OAAO,GAAG,SAAS,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IACnE,MAAM,aAAa,GAAG,WAAW,CAAC,GAAG,EAAE;QACrC,IAAI,eAAe,IAAI,OAAO,CAAC,SAAS,EAAE;YACxC,eAAe,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;SACpC;QACD,4FAA4F;aACvF,IAAI,eAAe,IAAI,OAAO,CAAC,WAAW,KAAK,MAAM,IAAI,eAAe,EAAE;YAC7E,eAAe,CAA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9B,KAAK,IACT,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,KAAK,CAAC,cAAc;YACpC,0DAA0D;YAC1D,uBAAuB,EAAE,KAAK,CAAC,uBAAuB,EACtD,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,sDAAsD;YACtD,kBAAkB,EAAE,KAAK,CAAC,kBAAkB;YAC5C,sDAAsD;YACtD,cAAc,EAAE,KAAK,CAAC,cAAc;YACpC,0CAA0C;YAC1C,qBAAqB,EAAE,MAAA,KAAK,CAAC,cAAc,0CAAE,cAAc,IAC3D,CACH,CAAC;KACH;AACH,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { _formatString } from '@internal/acs-ui-common';\nimport React, { useCallback, useState } from 'react';\nimport { ChatMessageComponentAsEditBox } from './ChatMessageComponentAsEditBox';\nimport { MessageThreadStrings } from '../MessageThread';\nimport { ChatMessage, ComponentSlotStyle, OnRenderAvatarCallback } from '../../types';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '../../types';\nimport { ChatMessageComponentAsMessageBubble } from './ChatMessageComponentAsMessageBubble';\nimport { FileDownloadHandler, FileMetadata } from '../FileDownloadCards';\n/* @conditional-compile-remove(mention) */\nimport { MentionOptions } from '../MentionPopover';\n\ntype ChatMessageComponentProps = {\n message: ChatMessage | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage;\n userId: string;\n messageContainerStyle?: ComponentSlotStyle;\n showDate?: boolean;\n disableEditing?: boolean;\n onUpdateMessage?: (\n messageId: string,\n content: string,\n metadata?: Record<string, string>,\n options?: {\n attachedFilesMetadata?: FileMetadata[];\n }\n ) => Promise<void>;\n onCancelMessageEdit?: (messageId: string) => void;\n /**\n * Callback to delete a message. Also called before resending a message that failed to send.\n * @param messageId ID of the message to delete\n */\n onDeleteMessage?: (messageId: string) => Promise<void>;\n /**\n * Callback to send a message\n * @param content The message content to send\n */\n onSendMessage?: (content: string) => Promise<void>;\n strings: MessageThreadStrings;\n messageStatus?: string;\n /**\n * Optional text to display when the message status is 'failed'.\n */\n failureReason?: string;\n /**\n * Whether the status indicator for each message is displayed or not.\n */\n showMessageStatus?: boolean;\n /**\n * Inline the accept and reject edit buttons when editing a message.\n * Setting to false will mean they are on a new line inside the editable chat message.\n */\n inlineAcceptRejectEditButtons: boolean;\n /**\n * Optional callback to render uploaded files in the message component.\n */\n onRenderFileDownloads?: (userId: string, message: ChatMessage) => JSX.Element;\n /**\n * Optional function called when someone clicks on the file download icon.\n */\n fileDownloadHandler?: FileDownloadHandler;\n remoteParticipantsCount?: number;\n onActionButtonClick: (\n message: ChatMessage,\n setMessageReadBy: (readBy: { id: string; displayName: string }[]) => void\n ) => void;\n /**\n * Optional callback to override render of the avatar.\n *\n * @param userId - user Id\n */\n onRenderAvatar?: OnRenderAvatarCallback;\n\n /**\n * Optional function to provide customized date format.\n * @beta\n */\n onDisplayDateTimeString?: (messageDate: Date) => string;\n /* @conditional-compile-remove(mention) */\n /**\n * Optional props needed to lookup suggestions and display mentions in the mention scenario.\n * @beta\n */\n mentionOptions?: MentionOptions;\n /* @conditional-compile-remove(teams-inline-images) */\n /**\n * Optional function to fetch attachments.\n * @beta\n */\n onFetchAttachments?: (attachment: FileMetadata) => Promise<void>;\n /* @conditional-compile-remove(teams-inline-images) */\n /**\n * Optional map of attachment ids to blob urls.\n */\n attachmentsMap?: Record<string, string>;\n};\n\n/**\n * @private\n */\nexport const ChatMessageComponent = (props: ChatMessageComponentProps): JSX.Element => {\n const [isEditing, setIsEditing] = useState(false);\n\n const onEditClick = useCallback(() => setIsEditing(true), [setIsEditing]);\n\n const { onDeleteMessage, onSendMessage, message } = props;\n const clientMessageId = 'clientMessageId' in message ? message.clientMessageId : undefined;\n const content = 'content' in message ? message.content : undefined;\n const onRemoveClick = useCallback(() => {\n if (onDeleteMessage && message.messageId) {\n onDeleteMessage(message.messageId);\n }\n // when fail to send, message does not have message id, delete message using clientMessageId\n else if (onDeleteMessage && message.messageType === 'chat' && clientMessageId) {\n onDeleteMessage(clientMessageId);\n }\n }, [onDeleteMessage, message.messageId, message.messageType, clientMessageId]);\n const onResendClick = useCallback(() => {\n onDeleteMessage && clientMessageId && onDeleteMessage(clientMessageId);\n onSendMessage && onSendMessage(content !== undefined ? content : '');\n }, [clientMessageId, content, onSendMessage, onDeleteMessage]);\n\n if (isEditing && message.messageType === 'chat') {\n return (\n <ChatMessageComponentAsEditBox\n message={message}\n inlineEditButtons={props.inlineAcceptRejectEditButtons}\n strings={props.strings}\n onSubmit={async (text, metadata, options) => {\n props.onUpdateMessage &&\n message.messageId &&\n (await props.onUpdateMessage(message.messageId, text, metadata, options));\n setIsEditing(false);\n }}\n onCancel={(messageId) => {\n props.onCancelMessageEdit && props.onCancelMessageEdit(messageId);\n setIsEditing(false);\n }}\n /* @conditional-compile-remove(mention) */\n mentionLookupOptions={props.mentionOptions?.lookupOptions}\n />\n );\n } else {\n return (\n <ChatMessageComponentAsMessageBubble\n {...props}\n onRemoveClick={onRemoveClick}\n onEditClick={onEditClick}\n onResendClick={onResendClick}\n onRenderAvatar={props.onRenderAvatar}\n /* @conditional-compile-remove(date-time-customization) */\n onDisplayDateTimeString={props.onDisplayDateTimeString}\n strings={props.strings}\n /* @conditional-compile-remove(teams-inline-images) */\n onFetchAttachments={props.onFetchAttachments}\n /* @conditional-compile-remove(teams-inline-images) */\n attachmentsMap={props.attachmentsMap}\n /* @conditional-compile-remove(mention) */\n mentionDisplayOptions={props.mentionOptions?.displayOptions}\n />\n );\n }\n};\n\"../../../../acs-ui-common/src\""]}
|
@@ -3,10 +3,9 @@ import { ChatMessage } from '../../types/ChatMessage';
|
|
3
3
|
import { FileMetadata } from '../FileDownloadCards';
|
4
4
|
import { BlockedMessage } from '../../types/ChatMessage';
|
5
5
|
import { MessageThreadStrings } from '../MessageThread';
|
6
|
-
import { OnRenderAvatarCallback } from '../../types';
|
6
|
+
import { ComponentSlotStyle, OnRenderAvatarCallback } from '../../types';
|
7
7
|
import { FileDownloadHandler } from '../FileDownloadCards';
|
8
8
|
import { MentionDisplayOptions } from '../MentionPopover';
|
9
|
-
import { ComponentSlotStyle } from '../../types/ComponentSlotStyle';
|
10
9
|
declare type ChatMessageComponentAsMessageBubbleProps = {
|
11
10
|
message: ChatMessage | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage;
|
12
11
|
messageContainerStyle?: ComponentSlotStyle;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
2
2
|
// Licensed under the MIT license.
|
3
3
|
import { mergeStyles } from '@fluentui/react';
|
4
|
-
import { Chat, Text } from
|
4
|
+
import { Chat, Text } from "../../../../northstar-wrapper/src";
|
5
5
|
import React, { useCallback, useRef, useState } from 'react';
|
6
6
|
import { chatMessageEditedTagStyle, chatMessageDateStyle, chatMessageFailedTagStyle } from '../styles/ChatMessageComponent.styles';
|
7
7
|
import { formatTimeForChatMessage, formatTimestampForChatMessage } from '../utils/Datetime';
|