@microsoft/omnichannel-chat-components 1.1.12 → 1.1.14
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/lib/cjs/common/Constants.js +1 -0
- package/lib/cjs/components/citationpane/CitationPane.js +132 -0
- package/lib/cjs/components/citationpane/ScalingTest.js +77 -0
- package/lib/cjs/components/citationpane/common/defaultProps/defaultCitationPaneControlProps.js +22 -0
- package/lib/cjs/components/citationpane/common/defaultProps/defaultCitationPaneProps.js +16 -0
- package/lib/cjs/components/citationpane/common/defaultProps/defaultCitationPaneStyleProps.js +25 -0
- package/lib/cjs/components/citationpane/common/defaultStyles/defaultCitationPaneCloseButtonStyles.js +40 -0
- package/lib/cjs/components/citationpane/common/defaultStyles/defaultCitationPaneContentStyles.js +21 -0
- package/lib/cjs/components/citationpane/common/defaultStyles/defaultCitationPaneGeneralStyles.js +29 -0
- package/lib/cjs/components/citationpane/common/defaultStyles/defaultCitationPaneTitleStyles.js +8 -0
- package/lib/cjs/components/citationpane/common/defaultStyles/defaultCitationPaneTopCloseButtonStyles.js +43 -0
- package/lib/cjs/components/citationpane/interfaces/ICitationPaneClassNames.js +1 -0
- package/lib/cjs/components/citationpane/interfaces/ICitationPaneComponentOverrides.js +1 -0
- package/lib/cjs/components/citationpane/interfaces/ICitationPaneControlProps.js +1 -0
- package/lib/cjs/components/citationpane/interfaces/ICitationPaneProps.js +1 -0
- package/lib/cjs/components/citationpane/interfaces/ICitationPaneStyleProps.js +1 -0
- package/lib/cjs/index.js +8 -0
- package/lib/cjs/interfaces/IPostMessageOptions.js +1 -0
- package/lib/cjs/services/BroadcastService.js +33 -2
- package/lib/cjs/services/EventQueue.js +91 -0
- package/lib/esm/common/Constants.js +1 -0
- package/lib/esm/components/citationpane/CitationPane.js +106 -0
- package/lib/esm/components/citationpane/ScalingTest.js +64 -0
- package/lib/esm/components/citationpane/common/defaultProps/defaultCitationPaneControlProps.js +15 -0
- package/lib/esm/components/citationpane/common/defaultProps/defaultCitationPaneProps.js +6 -0
- package/lib/esm/components/citationpane/common/defaultProps/defaultCitationPaneStyleProps.js +12 -0
- package/lib/esm/components/citationpane/common/defaultStyles/defaultCitationPaneCloseButtonStyles.js +33 -0
- package/lib/esm/components/citationpane/common/defaultStyles/defaultCitationPaneContentStyles.js +14 -0
- package/lib/esm/components/citationpane/common/defaultStyles/defaultCitationPaneGeneralStyles.js +22 -0
- package/lib/esm/components/citationpane/common/defaultStyles/defaultCitationPaneTitleStyles.js +1 -0
- package/lib/esm/components/citationpane/common/defaultStyles/defaultCitationPaneTopCloseButtonStyles.js +36 -0
- package/lib/esm/components/citationpane/interfaces/ICitationPaneClassNames.js +1 -0
- package/lib/esm/components/citationpane/interfaces/ICitationPaneComponentOverrides.js +1 -0
- package/lib/esm/components/citationpane/interfaces/ICitationPaneControlProps.js +1 -0
- package/lib/esm/components/citationpane/interfaces/ICitationPaneProps.js +1 -0
- package/lib/esm/components/citationpane/interfaces/ICitationPaneStyleProps.js +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/interfaces/IPostMessageOptions.js +1 -0
- package/lib/esm/services/BroadcastService.js +29 -2
- package/lib/esm/services/EventQueue.js +83 -0
- package/lib/types/common/Constants.d.ts +1 -0
- package/lib/types/components/citationpane/CitationPane.d.ts +4 -0
- package/lib/types/components/citationpane/ScalingTest.d.ts +7 -0
- package/lib/types/components/citationpane/common/defaultProps/defaultCitationPaneControlProps.d.ts +2 -0
- package/lib/types/components/citationpane/common/defaultProps/defaultCitationPaneProps.d.ts +2 -0
- package/lib/types/components/citationpane/common/defaultProps/defaultCitationPaneStyleProps.d.ts +2 -0
- package/lib/types/components/citationpane/common/defaultStyles/defaultCitationPaneCloseButtonStyles.d.ts +2 -0
- package/lib/types/components/citationpane/common/defaultStyles/defaultCitationPaneContentStyles.d.ts +2 -0
- package/lib/types/components/citationpane/common/defaultStyles/defaultCitationPaneGeneralStyles.d.ts +2 -0
- package/lib/types/components/citationpane/common/defaultStyles/defaultCitationPaneTitleStyles.d.ts +2 -0
- package/lib/types/components/citationpane/common/defaultStyles/defaultCitationPaneTopCloseButtonStyles.d.ts +2 -0
- package/lib/types/components/citationpane/interfaces/ICitationPaneClassNames.d.ts +7 -0
- package/lib/types/components/citationpane/interfaces/ICitationPaneComponentOverrides.d.ts +7 -0
- package/lib/types/components/citationpane/interfaces/ICitationPaneControlProps.d.ts +16 -0
- package/lib/types/components/citationpane/interfaces/ICitationPaneProps.d.ts +8 -0
- package/lib/types/components/citationpane/interfaces/ICitationPaneStyleProps.d.ts +10 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/interfaces/ICustomEvent.d.ts +1 -0
- package/lib/types/interfaces/IPostMessageOptions.d.ts +4 -0
- package/lib/types/services/BroadcastService.d.ts +2 -1
- package/lib/types/services/EventQueue.d.ts +17 -0
- package/package.json +2 -2
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { DefaultButton, IconButton, Label, Stack } from "@fluentui/react";
|
|
2
|
+
import { ElementType, EventNames } from "../../common/Constants";
|
|
3
|
+
import React, { useCallback } from "react";
|
|
4
|
+
import { BroadcastService } from "../../services/BroadcastService";
|
|
5
|
+
import { decodeComponentString } from "../../common/decodeComponentString";
|
|
6
|
+
import { defaultCitationPaneCloseButtonStyles } from "./common/defaultStyles/defaultCitationPaneCloseButtonStyles";
|
|
7
|
+
import { defaultCitationPaneContentStyles } from "./common/defaultStyles/defaultCitationPaneContentStyles";
|
|
8
|
+
import { defaultCitationPaneControlProps } from "./common/defaultProps/defaultCitationPaneControlProps";
|
|
9
|
+
import { defaultCitationPaneGeneralStyles } from "./common/defaultStyles/defaultCitationPaneGeneralStyles";
|
|
10
|
+
import { defaultCitationPaneTitleStyles } from "./common/defaultStyles/defaultCitationPaneTitleStyles";
|
|
11
|
+
import { defaultCitationPaneTopCloseButtonStyles } from "./common/defaultStyles/defaultCitationPaneTopCloseButtonStyles";
|
|
12
|
+
|
|
13
|
+
function CitationPane(props) {
|
|
14
|
+
var _props$controlProps, _props$styleProps, _props$styleProps2, _props$styleProps3, _props$styleProps4, _props$controlProps4, _props$styleProps5, _props$controlProps5, _props$styleProps6, _props$styleProps6$cl, _props$controlProps6, _props$componentOverr, _props$controlProps7, _props$styleProps7, _props$styleProps7$cl, _props$controlProps8, _props$componentOverr2, _props$styleProps8, _props$styleProps8$cl, _props$controlProps9, _props$styleProps9, _props$styleProps9$cl, _props$controlProps10, _props$controlProps11, _props$componentOverr3, _props$controlProps12, _props$controlProps13, _props$styleProps10, _props$styleProps10$c;
|
|
15
|
+
|
|
16
|
+
const elementId = ((_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.id) ?? defaultCitationPaneControlProps.id;
|
|
17
|
+
const handleClose = useCallback(() => {
|
|
18
|
+
var _props$controlProps2;
|
|
19
|
+
|
|
20
|
+
if ((_props$controlProps2 = props.controlProps) !== null && _props$controlProps2 !== void 0 && _props$controlProps2.onClose) {
|
|
21
|
+
var _props$controlProps3;
|
|
22
|
+
|
|
23
|
+
const customEvent = {
|
|
24
|
+
elementType: ElementType.CitationPaneCloseButton,
|
|
25
|
+
elementId: elementId + "-close",
|
|
26
|
+
eventName: EventNames.OnClick
|
|
27
|
+
};
|
|
28
|
+
BroadcastService.postMessage(customEvent);
|
|
29
|
+
(_props$controlProps3 = props.controlProps) === null || _props$controlProps3 === void 0 ? void 0 : _props$controlProps3.onClose();
|
|
30
|
+
}
|
|
31
|
+
}, [props.controlProps, elementId]);
|
|
32
|
+
const handleTopClose = useCallback(() => {
|
|
33
|
+
if (handleClose) {
|
|
34
|
+
const customEvent = {
|
|
35
|
+
elementType: ElementType.CitationPaneCloseButton,
|
|
36
|
+
elementId: elementId + "-top-close",
|
|
37
|
+
eventName: EventNames.OnClick
|
|
38
|
+
};
|
|
39
|
+
BroadcastService.postMessage(customEvent);
|
|
40
|
+
handleClose();
|
|
41
|
+
}
|
|
42
|
+
}, [props.controlProps, elementId]);
|
|
43
|
+
const containerStyles = {
|
|
44
|
+
root: Object.assign({}, defaultCitationPaneGeneralStyles, (_props$styleProps = props.styleProps) === null || _props$styleProps === void 0 ? void 0 : _props$styleProps.generalStyleProps, {
|
|
45
|
+
position: "relative" // Ensure container is positioned for absolute positioning of top close button
|
|
46
|
+
|
|
47
|
+
})
|
|
48
|
+
};
|
|
49
|
+
const titleStyles = {
|
|
50
|
+
root: Object.assign({}, defaultCitationPaneTitleStyles, (_props$styleProps2 = props.styleProps) === null || _props$styleProps2 === void 0 ? void 0 : _props$styleProps2.titleStyleProps)
|
|
51
|
+
};
|
|
52
|
+
const contentStyles = { ...defaultCitationPaneContentStyles,
|
|
53
|
+
...((_props$styleProps3 = props.styleProps) === null || _props$styleProps3 === void 0 ? void 0 : _props$styleProps3.contentStyleProps)
|
|
54
|
+
};
|
|
55
|
+
const closeButtonStyles = {
|
|
56
|
+
root: Object.assign({}, defaultCitationPaneCloseButtonStyles, (_props$styleProps4 = props.styleProps) === null || _props$styleProps4 === void 0 ? void 0 : _props$styleProps4.closeButtonStyleProps)
|
|
57
|
+
};
|
|
58
|
+
const topCloseButtonPosition = ((_props$controlProps4 = props.controlProps) === null || _props$controlProps4 === void 0 ? void 0 : _props$controlProps4.topCloseButtonPosition) || defaultCitationPaneControlProps.topCloseButtonPosition;
|
|
59
|
+
const topCloseButtonStyles = {
|
|
60
|
+
root: Object.assign({}, defaultCitationPaneTopCloseButtonStyles, (_props$styleProps5 = props.styleProps) === null || _props$styleProps5 === void 0 ? void 0 : _props$styleProps5.topCloseButtonStyleProps, topCloseButtonPosition === "topLeft" ? {
|
|
61
|
+
left: "0.5em",
|
|
62
|
+
right: "auto"
|
|
63
|
+
} : {
|
|
64
|
+
right: "0.5em",
|
|
65
|
+
left: "auto"
|
|
66
|
+
})
|
|
67
|
+
};
|
|
68
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Stack, {
|
|
69
|
+
id: elementId,
|
|
70
|
+
role: "dialog",
|
|
71
|
+
"aria-labelledby": elementId + "-title",
|
|
72
|
+
"aria-describedby": elementId + "-content",
|
|
73
|
+
dir: ((_props$controlProps5 = props.controlProps) === null || _props$controlProps5 === void 0 ? void 0 : _props$controlProps5.dir) || defaultCitationPaneControlProps.dir,
|
|
74
|
+
styles: containerStyles,
|
|
75
|
+
className: (_props$styleProps6 = props.styleProps) === null || _props$styleProps6 === void 0 ? void 0 : (_props$styleProps6$cl = _props$styleProps6.classNames) === null || _props$styleProps6$cl === void 0 ? void 0 : _props$styleProps6$cl.containerClassName
|
|
76
|
+
}, !((_props$controlProps6 = props.controlProps) !== null && _props$controlProps6 !== void 0 && _props$controlProps6.hideTopCloseButton) && (decodeComponentString((_props$componentOverr = props.componentOverrides) === null || _props$componentOverr === void 0 ? void 0 : _props$componentOverr.topCloseButton) || /*#__PURE__*/React.createElement(IconButton, {
|
|
77
|
+
onClick: handleTopClose,
|
|
78
|
+
id: elementId + "-top-close",
|
|
79
|
+
iconProps: {
|
|
80
|
+
iconName: "ChromeClose"
|
|
81
|
+
},
|
|
82
|
+
ariaLabel: ((_props$controlProps7 = props.controlProps) === null || _props$controlProps7 === void 0 ? void 0 : _props$controlProps7.topCloseButtonAriaLabel) || defaultCitationPaneControlProps.topCloseButtonAriaLabel,
|
|
83
|
+
styles: topCloseButtonStyles,
|
|
84
|
+
className: (_props$styleProps7 = props.styleProps) === null || _props$styleProps7 === void 0 ? void 0 : (_props$styleProps7$cl = _props$styleProps7.classNames) === null || _props$styleProps7$cl === void 0 ? void 0 : _props$styleProps7$cl.topCloseButtonClassName
|
|
85
|
+
})), !((_props$controlProps8 = props.controlProps) !== null && _props$controlProps8 !== void 0 && _props$controlProps8.hideTitle) && (decodeComponentString((_props$componentOverr2 = props.componentOverrides) === null || _props$componentOverr2 === void 0 ? void 0 : _props$componentOverr2.title) || /*#__PURE__*/React.createElement(Label, {
|
|
86
|
+
id: elementId + "-title",
|
|
87
|
+
styles: titleStyles,
|
|
88
|
+
className: (_props$styleProps8 = props.styleProps) === null || _props$styleProps8 === void 0 ? void 0 : (_props$styleProps8$cl = _props$styleProps8.classNames) === null || _props$styleProps8$cl === void 0 ? void 0 : _props$styleProps8$cl.titleClassName
|
|
89
|
+
}, ((_props$controlProps9 = props.controlProps) === null || _props$controlProps9 === void 0 ? void 0 : _props$controlProps9.titleText) || defaultCitationPaneControlProps.titleText)), /*#__PURE__*/React.createElement("div", {
|
|
90
|
+
id: elementId + "-content",
|
|
91
|
+
style: contentStyles,
|
|
92
|
+
className: (_props$styleProps9 = props.styleProps) === null || _props$styleProps9 === void 0 ? void 0 : (_props$styleProps9$cl = _props$styleProps9.classNames) === null || _props$styleProps9$cl === void 0 ? void 0 : _props$styleProps9$cl.contentClassName,
|
|
93
|
+
dangerouslySetInnerHTML: {
|
|
94
|
+
__html: ((_props$controlProps10 = props.controlProps) === null || _props$controlProps10 === void 0 ? void 0 : _props$controlProps10.contentHtml) ?? ""
|
|
95
|
+
}
|
|
96
|
+
}), !((_props$controlProps11 = props.controlProps) !== null && _props$controlProps11 !== void 0 && _props$controlProps11.hideCloseButton) && (decodeComponentString((_props$componentOverr3 = props.componentOverrides) === null || _props$componentOverr3 === void 0 ? void 0 : _props$componentOverr3.closeButton) || /*#__PURE__*/React.createElement(DefaultButton, {
|
|
97
|
+
onClick: handleClose,
|
|
98
|
+
id: elementId + "-close",
|
|
99
|
+
text: ((_props$controlProps12 = props.controlProps) === null || _props$controlProps12 === void 0 ? void 0 : _props$controlProps12.closeButtonText) || defaultCitationPaneControlProps.closeButtonText,
|
|
100
|
+
ariaLabel: ((_props$controlProps13 = props.controlProps) === null || _props$controlProps13 === void 0 ? void 0 : _props$controlProps13.closeButtonAriaLabel) || defaultCitationPaneControlProps.closeButtonAriaLabel,
|
|
101
|
+
styles: closeButtonStyles,
|
|
102
|
+
className: (_props$styleProps10 = props.styleProps) === null || _props$styleProps10 === void 0 ? void 0 : (_props$styleProps10$c = _props$styleProps10.classNames) === null || _props$styleProps10$c === void 0 ? void 0 : _props$styleProps10$c.closeButtonClassName
|
|
103
|
+
}))));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export default CitationPane;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import CitationPane from "./CitationPane";
|
|
2
|
+
import React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Test component to verify CitationPane scaling behavior at different zoom levels
|
|
5
|
+
* This demonstrates how the component responds to 50% to 400% view sizes
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export const CitationPaneScalingTest = () => {
|
|
9
|
+
const baseProps = {
|
|
10
|
+
controlProps: {
|
|
11
|
+
id: "scaling-test-citation",
|
|
12
|
+
titleText: "Scaling Test Citation",
|
|
13
|
+
contentHtml: `
|
|
14
|
+
<div>
|
|
15
|
+
<p>This citation pane is designed to scale properly from 50% to 400% zoom levels.</p>
|
|
16
|
+
<p><strong>Key improvements for scaling:</strong></p>
|
|
17
|
+
<ul>
|
|
18
|
+
<li>Uses <code>em</code> units instead of <code>px</code> for dimensions</li>
|
|
19
|
+
<li>Scalable padding, margins, and positioning</li>
|
|
20
|
+
<li>Relative font sizes throughout</li>
|
|
21
|
+
<li>Container-relative maximum height instead of viewport-based</li>
|
|
22
|
+
</ul>
|
|
23
|
+
<p><strong>Test Instructions:</strong></p>
|
|
24
|
+
<ol>
|
|
25
|
+
<li>Use your browser's zoom controls (Ctrl/Cmd + or -)</li>
|
|
26
|
+
<li>Test zoom levels: 50%, 75%, 100%, 150%, 200%, 300%, 400%</li>
|
|
27
|
+
<li>Verify all elements remain proportional and usable</li>
|
|
28
|
+
<li>Check that buttons remain clickable and text remains readable</li>
|
|
29
|
+
</ol>
|
|
30
|
+
</div>
|
|
31
|
+
`,
|
|
32
|
+
closeButtonText: "Close Test",
|
|
33
|
+
onClose: () => {
|
|
34
|
+
console.log("Scaling test close button clicked at current zoom level");
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
39
|
+
style: {
|
|
40
|
+
padding: "2em",
|
|
41
|
+
backgroundColor: "#f5f5f5",
|
|
42
|
+
minHeight: "100vh",
|
|
43
|
+
display: "flex",
|
|
44
|
+
alignItems: "center",
|
|
45
|
+
justifyContent: "center"
|
|
46
|
+
}
|
|
47
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
48
|
+
style: {
|
|
49
|
+
maxWidth: "600px"
|
|
50
|
+
}
|
|
51
|
+
}, /*#__PURE__*/React.createElement("h2", {
|
|
52
|
+
style: {
|
|
53
|
+
marginBottom: "1em",
|
|
54
|
+
textAlign: "center"
|
|
55
|
+
}
|
|
56
|
+
}, "CitationPane Scaling Test"), /*#__PURE__*/React.createElement("p", {
|
|
57
|
+
style: {
|
|
58
|
+
marginBottom: "2em",
|
|
59
|
+
textAlign: "center",
|
|
60
|
+
fontSize: "0.9em"
|
|
61
|
+
}
|
|
62
|
+
}, "Test this component at browser zoom levels from 50% to 400%"), /*#__PURE__*/React.createElement(CitationPane, baseProps)));
|
|
63
|
+
};
|
|
64
|
+
export default CitationPaneScalingTest;
|
package/lib/esm/components/citationpane/common/defaultProps/defaultCitationPaneControlProps.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const defaultCitationPaneControlProps = {
|
|
2
|
+
id: "ocw-citation-pane",
|
|
3
|
+
dir: "ltr",
|
|
4
|
+
hideTitle: false,
|
|
5
|
+
titleText: "Citation",
|
|
6
|
+
hideCloseButton: false,
|
|
7
|
+
closeButtonText: "Close",
|
|
8
|
+
closeButtonAriaLabel: "Close citation",
|
|
9
|
+
hideTopCloseButton: false,
|
|
10
|
+
topCloseButtonAriaLabel: "Close",
|
|
11
|
+
topCloseButtonPosition: "topRight",
|
|
12
|
+
onClose: () => {
|
|
13
|
+
console.log("Citation pane close");
|
|
14
|
+
}
|
|
15
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { defaultCitationPaneControlProps } from "./defaultCitationPaneControlProps";
|
|
2
|
+
import { defaultCitationPaneStyleProps } from "./defaultCitationPaneStyleProps";
|
|
3
|
+
export const defaultCitationPaneProps = {
|
|
4
|
+
controlProps: defaultCitationPaneControlProps,
|
|
5
|
+
styleProps: defaultCitationPaneStyleProps
|
|
6
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defaultCitationPaneCloseButtonStyles } from "../defaultStyles/defaultCitationPaneCloseButtonStyles";
|
|
2
|
+
import { defaultCitationPaneContentStyles } from "../defaultStyles/defaultCitationPaneContentStyles";
|
|
3
|
+
import { defaultCitationPaneGeneralStyles } from "../defaultStyles/defaultCitationPaneGeneralStyles";
|
|
4
|
+
import { defaultCitationPaneTitleStyles } from "../defaultStyles/defaultCitationPaneTitleStyles";
|
|
5
|
+
import { defaultCitationPaneTopCloseButtonStyles } from "../defaultStyles/defaultCitationPaneTopCloseButtonStyles";
|
|
6
|
+
export const defaultCitationPaneStyleProps = {
|
|
7
|
+
generalStyleProps: defaultCitationPaneGeneralStyles,
|
|
8
|
+
titleStyleProps: defaultCitationPaneTitleStyles,
|
|
9
|
+
contentStyleProps: defaultCitationPaneContentStyles,
|
|
10
|
+
closeButtonStyleProps: defaultCitationPaneCloseButtonStyles,
|
|
11
|
+
topCloseButtonStyleProps: defaultCitationPaneTopCloseButtonStyles
|
|
12
|
+
};
|
package/lib/esm/components/citationpane/common/defaultStyles/defaultCitationPaneCloseButtonStyles.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export const defaultCitationPaneCloseButtonStyles = {
|
|
2
|
+
marginTop: "1em",
|
|
3
|
+
// Space between content and close button (scalable)
|
|
4
|
+
alignSelf: "center",
|
|
5
|
+
// Center the button horizontally
|
|
6
|
+
backgroundColor: "#f3f2f1",
|
|
7
|
+
border: "1px solid #d2d0ce",
|
|
8
|
+
borderRadius: "0.25em",
|
|
9
|
+
// Scalable border radius
|
|
10
|
+
color: "#323130",
|
|
11
|
+
cursor: "pointer",
|
|
12
|
+
fontSize: "1em",
|
|
13
|
+
// Use relative font size for better scaling
|
|
14
|
+
fontWeight: "500",
|
|
15
|
+
minHeight: "2em",
|
|
16
|
+
// Scalable minimum height
|
|
17
|
+
minWidth: "5em",
|
|
18
|
+
// Scalable minimum width
|
|
19
|
+
padding: "0.5em 1em",
|
|
20
|
+
// Scalable padding
|
|
21
|
+
selectors: {
|
|
22
|
+
":hover": {
|
|
23
|
+
backgroundColor: "#e1dfdd",
|
|
24
|
+
borderColor: "#c8c6c4"
|
|
25
|
+
},
|
|
26
|
+
":focus": {
|
|
27
|
+
outline: "0.125em solid #0078d4",
|
|
28
|
+
// Scalable outline
|
|
29
|
+
outlineOffset: "0.125em" // Scalable offset
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
package/lib/esm/components/citationpane/common/defaultStyles/defaultCitationPaneContentStyles.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const defaultCitationPaneContentStyles = {
|
|
2
|
+
fontSize: "1em",
|
|
3
|
+
// Use relative units for better scaling
|
|
4
|
+
lineHeight: "1.5",
|
|
5
|
+
// Already relative, good for scaling
|
|
6
|
+
marginBottom: "0",
|
|
7
|
+
// No bottom margin since close button has top margin
|
|
8
|
+
flex: "1",
|
|
9
|
+
// Allow content to grow and push close button to bottom
|
|
10
|
+
overflow: "auto",
|
|
11
|
+
// Enable scrolling for long content
|
|
12
|
+
paddingRight: "0.25em" // Small padding to prevent scrollbar from touching border (scalable)
|
|
13
|
+
|
|
14
|
+
};
|
package/lib/esm/components/citationpane/common/defaultStyles/defaultCitationPaneGeneralStyles.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const defaultCitationPaneGeneralStyles = {
|
|
2
|
+
position: "relative",
|
|
3
|
+
// Required for absolute positioning of top close button
|
|
4
|
+
paddingTop: "2.5em",
|
|
5
|
+
// Space for top close button to prevent overlap (scalable)
|
|
6
|
+
padding: "1em",
|
|
7
|
+
// Scalable padding using em units
|
|
8
|
+
backgroundColor: "#ffffff",
|
|
9
|
+
border: "1px solid #d2d0ce",
|
|
10
|
+
borderRadius: "0.5em",
|
|
11
|
+
// Scalable border radius
|
|
12
|
+
boxShadow: "0px 0.125em 0.25em rgba(0, 0, 0, 0.1)",
|
|
13
|
+
// Scalable shadow
|
|
14
|
+
display: "flex",
|
|
15
|
+
flexDirection: "column",
|
|
16
|
+
minHeight: "7.5em",
|
|
17
|
+
// Minimum height to ensure proper layout (scalable)
|
|
18
|
+
maxHeight: "30em",
|
|
19
|
+
// Container-relative height instead of viewport-based
|
|
20
|
+
overflow: "hidden" // Hide overflow on container, let content area handle scrolling
|
|
21
|
+
|
|
22
|
+
};
|
package/lib/esm/components/citationpane/common/defaultStyles/defaultCitationPaneTitleStyles.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const defaultCitationPaneTitleStyles = {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export const defaultCitationPaneTopCloseButtonStyles = {
|
|
2
|
+
position: "absolute",
|
|
3
|
+
top: "0.5em",
|
|
4
|
+
// Scalable positioning
|
|
5
|
+
right: "0.5em",
|
|
6
|
+
// Scalable positioning
|
|
7
|
+
minWidth: "2em",
|
|
8
|
+
// Scalable minimum width
|
|
9
|
+
height: "2em",
|
|
10
|
+
// Scalable height
|
|
11
|
+
padding: "0",
|
|
12
|
+
fontSize: "1em",
|
|
13
|
+
// Scalable font size
|
|
14
|
+
fontWeight: "bold",
|
|
15
|
+
color: "#605e5c",
|
|
16
|
+
backgroundColor: "transparent",
|
|
17
|
+
border: "none",
|
|
18
|
+
borderRadius: "0.25em",
|
|
19
|
+
// Scalable border radius
|
|
20
|
+
cursor: "pointer",
|
|
21
|
+
zIndex: 1000,
|
|
22
|
+
":hover": {
|
|
23
|
+
backgroundColor: "#f3f2f1",
|
|
24
|
+
color: "#323130"
|
|
25
|
+
},
|
|
26
|
+
":active": {
|
|
27
|
+
backgroundColor: "#edebe9",
|
|
28
|
+
color: "#201f1e"
|
|
29
|
+
},
|
|
30
|
+
":focus": {
|
|
31
|
+
outline: "0.125em solid #605e5c",
|
|
32
|
+
// Scalable outline
|
|
33
|
+
outlineOffset: "0.125em" // Scalable offset
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/esm/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { default as Header } from "./components/header/Header";
|
|
2
2
|
export { default as Footer } from "./components/footer/Footer";
|
|
3
3
|
export { default as ConfirmationPane } from "./components/confirmationpane/ConfirmationPane";
|
|
4
|
+
export { default as CitationPane } from "./components/citationpane/CitationPane";
|
|
4
5
|
export { default as ChatButton } from "./components/chatbutton/ChatButton";
|
|
5
6
|
export { default as InputValidationPane } from "./components/inputvalidationpane/InputValidationPane";
|
|
6
7
|
export { default as ProactiveChatPane } from "./components/proactivechatpane/ProactiveChatPane";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Subject } from "rxjs";
|
|
2
2
|
import { filter } from "rxjs/operators";
|
|
3
3
|
import { BroadcastChannel } from "broadcast-channel";
|
|
4
|
+
import { uuidv4 } from "../common/utils";
|
|
5
|
+
import EventQueue from "./EventQueue";
|
|
4
6
|
const newMessage = new Subject(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
7
|
|
|
6
8
|
const broadcastServicePubList = {}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -10,7 +12,10 @@ const broadcastServiceSubList = {}; // eslint-disable-next-line @typescript-esli
|
|
|
10
12
|
let pubChannel; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
13
|
|
|
12
14
|
let subChannel;
|
|
15
|
+
let eventQueue;
|
|
13
16
|
export const BroadcastServiceInitialize = channelName => {
|
|
17
|
+
eventQueue = new EventQueue(newMessage);
|
|
18
|
+
|
|
14
19
|
if (broadcastServicePubList[channelName]) {
|
|
15
20
|
pubChannel = broadcastServicePubList[channelName];
|
|
16
21
|
} else {
|
|
@@ -30,16 +35,37 @@ export const BroadcastServiceInitialize = channelName => {
|
|
|
30
35
|
|
|
31
36
|
subChannel.onmessage = message => {
|
|
32
37
|
newMessage.next(message);
|
|
38
|
+
eventQueue.popEvent(message);
|
|
39
|
+
eventQueue.stopIfEmpty();
|
|
33
40
|
};
|
|
34
41
|
};
|
|
35
42
|
export const BroadcastService = {
|
|
36
43
|
//broadcast a message
|
|
37
|
-
postMessage: message
|
|
44
|
+
postMessage: function (message) {
|
|
45
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
46
|
+
retry: true
|
|
47
|
+
};
|
|
48
|
+
|
|
38
49
|
/**
|
|
39
50
|
* Omit copying methods to prevent 'DataCloneError' in older browsers when passing an object with functions
|
|
40
51
|
* This exception occurs when an object can't be clone with the 'structured clone algorithm' (used by postMessage)
|
|
41
52
|
*/
|
|
42
|
-
|
|
53
|
+
try {
|
|
54
|
+
const messageCopy = JSON.parse(JSON.stringify(message));
|
|
55
|
+
const eventId = uuidv4();
|
|
56
|
+
const event = { ...messageCopy,
|
|
57
|
+
eventId
|
|
58
|
+
};
|
|
59
|
+
eventQueue.pushEvent(event);
|
|
60
|
+
pubChannel.postMessage(event);
|
|
61
|
+
} catch (error) {
|
|
62
|
+
console.error("Error in BroadcastService.postMessage:", error);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (options !== null && options !== void 0 && options.retry) {
|
|
66
|
+
const queueTimeout = (options === null || options === void 0 ? void 0 : options.queueTimeout) || 500;
|
|
67
|
+
eventQueue.startQueue(queueTimeout);
|
|
68
|
+
}
|
|
43
69
|
},
|
|
44
70
|
getMessage: message => {
|
|
45
71
|
return newMessage.pipe(filter(msg => msg.elementId == message.elementId && msg.elementType == message.elementType && msg.eventName == message.eventName));
|
|
@@ -53,5 +79,6 @@ export const BroadcastService = {
|
|
|
53
79
|
disposeChannel: () => {
|
|
54
80
|
pubChannel.close();
|
|
55
81
|
subChannel.close();
|
|
82
|
+
eventQueue.dispose();
|
|
56
83
|
}
|
|
57
84
|
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
|
|
3
|
+
class EventQueue {
|
|
4
|
+
constructor(newMessage) {
|
|
5
|
+
_defineProperty(this, "queueing", false);
|
|
6
|
+
|
|
7
|
+
_defineProperty(this, "channelEventQueue", void 0);
|
|
8
|
+
|
|
9
|
+
_defineProperty(this, "queueingId", void 0);
|
|
10
|
+
|
|
11
|
+
_defineProperty(this, "newMessage", void 0);
|
|
12
|
+
|
|
13
|
+
this.channelEventQueue = new Map();
|
|
14
|
+
this.newMessage = newMessage;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
processEvents() {
|
|
18
|
+
this.channelEventQueue.forEach((event, eventId) => {
|
|
19
|
+
// Process entry based on insertion order
|
|
20
|
+
this.newMessage.next(event); // Post event directly instead of using pubChannel
|
|
21
|
+
|
|
22
|
+
this.channelEventQueue.delete(eventId); // Remove event from queue regardless of outcome
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
queueEvents() {
|
|
27
|
+
let timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 500;
|
|
28
|
+
this.stopIfEmpty();
|
|
29
|
+
|
|
30
|
+
if (this.queueingId) {
|
|
31
|
+
// Queueing in progress
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (this.queueing) {
|
|
36
|
+
this.queueingId = setTimeout(() => {
|
|
37
|
+
this.processEvents();
|
|
38
|
+
this.queueEvents(timeout);
|
|
39
|
+
}, timeout);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
startQueue() {
|
|
44
|
+
let timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 500;
|
|
45
|
+
this.queueing = true;
|
|
46
|
+
this.queueEvents(timeout);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
stopIfEmpty() {
|
|
50
|
+
if (this.channelEventQueue.size === 0) {
|
|
51
|
+
if (this.queueingId) {
|
|
52
|
+
clearTimeout(this.queueingId);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
this.queueing = false;
|
|
56
|
+
this.queueingId = undefined;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
pushEvent(event) {
|
|
61
|
+
if (event.eventId) {
|
|
62
|
+
this.channelEventQueue.set(event.eventId, event);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
popEvent(event) {
|
|
67
|
+
if (event.eventId) {
|
|
68
|
+
this.channelEventQueue.delete(event.eventId);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
dispose() {
|
|
73
|
+
if (this.queueingId) {
|
|
74
|
+
clearTimeout(this.queueingId);
|
|
75
|
+
this.queueingId = undefined;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
this.channelEventQueue.clear();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export default EventQueue;
|
|
@@ -31,6 +31,7 @@ export declare enum ElementType {
|
|
|
31
31
|
ReconnectChatPane = "ReconnectChatPane",
|
|
32
32
|
ConfirmationPaneConfirmButton = "ConfirmationPaneConfirmButton",
|
|
33
33
|
ConfirmationPaneCancelButton = "ConfirmationPaneCancelButton",
|
|
34
|
+
CitationPaneCloseButton = "CitationPaneCloseButton",
|
|
34
35
|
PreChatSurveySubmitButton = "PreChatSurveySubmitButton",
|
|
35
36
|
PreChatSurveyError = "PreChatSurveyError",
|
|
36
37
|
IncomingCallDeclineCallButton = "IncomingCallDeclineCallButton",
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Test component to verify CitationPane scaling behavior at different zoom levels
|
|
4
|
+
* This demonstrates how the component responds to 50% to 400% view sizes
|
|
5
|
+
*/
|
|
6
|
+
export declare const CitationPaneScalingTest: React.FC;
|
|
7
|
+
export default CitationPaneScalingTest;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface ICitationPaneControlProps {
|
|
2
|
+
id?: string;
|
|
3
|
+
dir?: "ltr" | "rtl" | "auto";
|
|
4
|
+
hideCitationPane?: boolean;
|
|
5
|
+
hideTitle?: boolean;
|
|
6
|
+
titleText?: string;
|
|
7
|
+
contentHtml?: string;
|
|
8
|
+
hideCloseButton?: boolean;
|
|
9
|
+
closeButtonText?: string;
|
|
10
|
+
closeButtonAriaLabel?: string;
|
|
11
|
+
hideTopCloseButton?: boolean;
|
|
12
|
+
topCloseButtonAriaLabel?: string;
|
|
13
|
+
topCloseButtonPosition?: "topLeft" | "topRight";
|
|
14
|
+
brightnessValueOnDim?: string;
|
|
15
|
+
onClose?: () => void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ICitationPaneComponentOverrides } from "./ICitationPaneComponentOverrides";
|
|
2
|
+
import { ICitationPaneControlProps } from "./ICitationPaneControlProps";
|
|
3
|
+
import { ICitationPaneStyleProps } from "./ICitationPaneStyleProps";
|
|
4
|
+
export interface ICitationPaneProps {
|
|
5
|
+
controlProps?: ICitationPaneControlProps;
|
|
6
|
+
styleProps?: ICitationPaneStyleProps;
|
|
7
|
+
componentOverrides?: ICitationPaneComponentOverrides;
|
|
8
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ICitationPaneClassNames } from "./ICitationPaneClassNames";
|
|
2
|
+
import { IStyle } from "@fluentui/react";
|
|
3
|
+
export interface ICitationPaneStyleProps {
|
|
4
|
+
generalStyleProps?: IStyle;
|
|
5
|
+
titleStyleProps?: IStyle;
|
|
6
|
+
contentStyleProps?: IStyle;
|
|
7
|
+
closeButtonStyleProps?: IStyle;
|
|
8
|
+
topCloseButtonStyleProps?: IStyle;
|
|
9
|
+
classNames?: ICitationPaneClassNames;
|
|
10
|
+
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { default as Header } from "./components/header/Header";
|
|
2
2
|
export { default as Footer } from "./components/footer/Footer";
|
|
3
3
|
export { default as ConfirmationPane } from "./components/confirmationpane/ConfirmationPane";
|
|
4
|
+
export { default as CitationPane } from "./components/citationpane/CitationPane";
|
|
4
5
|
export { default as ChatButton } from "./components/chatbutton/ChatButton";
|
|
5
6
|
export { default as InputValidationPane } from "./components/inputvalidationpane/InputValidationPane";
|
|
6
7
|
export { default as ProactiveChatPane } from "./components/proactivechatpane/ProactiveChatPane";
|