@microsoft/omnichannel-chat-components 1.1.13 → 1.1.15
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 +154 -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 +37 -0
- package/lib/cjs/components/citationpane/common/defaultStyles/defaultCitationPaneCloseButtonFocusedStyles.js +11 -0
- package/lib/cjs/components/citationpane/common/defaultStyles/defaultCitationPaneCloseButtonHoveredStyles.js +11 -0
- package/lib/cjs/components/citationpane/common/defaultStyles/defaultCitationPaneCloseButtonStyles.js +49 -0
- package/lib/cjs/components/citationpane/common/defaultStyles/defaultCitationPaneContentStyles.js +21 -0
- package/lib/cjs/components/citationpane/common/defaultStyles/defaultCitationPaneGeneralStyles.js +33 -0
- package/lib/cjs/components/citationpane/common/defaultStyles/defaultCitationPaneStyles.js +37 -0
- package/lib/cjs/components/citationpane/common/defaultStyles/defaultCitationPaneTitleStyles.js +8 -0
- package/lib/cjs/components/citationpane/common/defaultStyles/defaultCitationPaneTopCloseButtonFocusedStyles.js +11 -0
- package/lib/cjs/components/citationpane/common/defaultStyles/defaultCitationPaneTopCloseButtonHoveredStyles.js +11 -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/esm/common/Constants.js +1 -0
- package/lib/esm/components/citationpane/CitationPane.js +124 -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 +20 -0
- package/lib/esm/components/citationpane/common/defaultStyles/defaultCitationPaneCloseButtonFocusedStyles.js +4 -0
- package/lib/esm/components/citationpane/common/defaultStyles/defaultCitationPaneCloseButtonHoveredStyles.js +4 -0
- package/lib/esm/components/citationpane/common/defaultStyles/defaultCitationPaneCloseButtonStyles.js +42 -0
- package/lib/esm/components/citationpane/common/defaultStyles/defaultCitationPaneContentStyles.js +14 -0
- package/lib/esm/components/citationpane/common/defaultStyles/defaultCitationPaneGeneralStyles.js +26 -0
- package/lib/esm/components/citationpane/common/defaultStyles/defaultCitationPaneStyles.js +20 -0
- package/lib/esm/components/citationpane/common/defaultStyles/defaultCitationPaneTitleStyles.js +1 -0
- package/lib/esm/components/citationpane/common/defaultStyles/defaultCitationPaneTopCloseButtonFocusedStyles.js +4 -0
- package/lib/esm/components/citationpane/common/defaultStyles/defaultCitationPaneTopCloseButtonHoveredStyles.js +4 -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/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/defaultCitationPaneCloseButtonFocusedStyles.d.ts +2 -0
- package/lib/types/components/citationpane/common/defaultStyles/defaultCitationPaneCloseButtonHoveredStyles.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/defaultCitationPaneStyles.d.ts +2 -0
- package/lib/types/components/citationpane/common/defaultStyles/defaultCitationPaneTitleStyles.d.ts +2 -0
- package/lib/types/components/citationpane/common/defaultStyles/defaultCitationPaneTopCloseButtonFocusedStyles.d.ts +2 -0
- package/lib/types/components/citationpane/common/defaultStyles/defaultCitationPaneTopCloseButtonHoveredStyles.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 +6 -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 +14 -0
- package/lib/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,124 @@
|
|
|
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 { defaultCitationPaneCloseButtonFocusedStyles } from "./common/defaultStyles/defaultCitationPaneCloseButtonFocusedStyles";
|
|
7
|
+
import { defaultCitationPaneCloseButtonHoveredStyles } from "./common/defaultStyles/defaultCitationPaneCloseButtonHoveredStyles";
|
|
8
|
+
import { defaultCitationPaneCloseButtonStyles } from "./common/defaultStyles/defaultCitationPaneCloseButtonStyles";
|
|
9
|
+
import { defaultCitationPaneContentStyles } from "./common/defaultStyles/defaultCitationPaneContentStyles";
|
|
10
|
+
import { defaultCitationPaneControlProps } from "./common/defaultProps/defaultCitationPaneControlProps";
|
|
11
|
+
import { defaultCitationPaneGeneralStyles } from "./common/defaultStyles/defaultCitationPaneGeneralStyles";
|
|
12
|
+
import { defaultCitationPaneTitleStyles } from "./common/defaultStyles/defaultCitationPaneTitleStyles";
|
|
13
|
+
import { defaultCitationPaneTopCloseButtonFocusedStyles } from "./common/defaultStyles/defaultCitationPaneTopCloseButtonFocusedStyles";
|
|
14
|
+
import { defaultCitationPaneTopCloseButtonHoveredStyles } from "./common/defaultStyles/defaultCitationPaneTopCloseButtonHoveredStyles";
|
|
15
|
+
import { defaultCitationPaneTopCloseButtonStyles } from "./common/defaultStyles/defaultCitationPaneTopCloseButtonStyles";
|
|
16
|
+
|
|
17
|
+
function CitationPane(props) {
|
|
18
|
+
var _props$controlProps, _props$styleProps, _props$styleProps2, _props$styleProps3, _props$styleProps4, _props$styleProps5, _props$styleProps6, _props$styleProps7, _props$controlProps4, _props$styleProps8, _props$styleProps9, _props$styleProps10, _props$styleProps11, _props$controlProps5, _props$styleProps12, _props$styleProps12$c, _props$controlProps6, _props$componentOverr, _props$controlProps7, _props$styleProps13, _props$styleProps13$c, _props$controlProps8, _props$componentOverr2, _props$styleProps14, _props$styleProps14$c, _props$controlProps9, _props$styleProps15, _props$styleProps15$c, _props$controlProps10, _props$controlProps11, _props$componentOverr3, _props$controlProps12, _props$controlProps13, _props$styleProps16, _props$styleProps16$c;
|
|
19
|
+
|
|
20
|
+
const elementId = ((_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.id) ?? defaultCitationPaneControlProps.id;
|
|
21
|
+
const handleClose = useCallback(() => {
|
|
22
|
+
var _props$controlProps2;
|
|
23
|
+
|
|
24
|
+
if ((_props$controlProps2 = props.controlProps) !== null && _props$controlProps2 !== void 0 && _props$controlProps2.onClose) {
|
|
25
|
+
var _props$controlProps3;
|
|
26
|
+
|
|
27
|
+
const customEvent = {
|
|
28
|
+
elementType: ElementType.CitationPaneCloseButton,
|
|
29
|
+
elementId: elementId + "-close",
|
|
30
|
+
eventName: EventNames.OnClick
|
|
31
|
+
};
|
|
32
|
+
BroadcastService.postMessage(customEvent);
|
|
33
|
+
(_props$controlProps3 = props.controlProps) === null || _props$controlProps3 === void 0 ? void 0 : _props$controlProps3.onClose();
|
|
34
|
+
}
|
|
35
|
+
}, [props.controlProps, elementId]);
|
|
36
|
+
const handleTopClose = useCallback(() => {
|
|
37
|
+
if (handleClose) {
|
|
38
|
+
const customEvent = {
|
|
39
|
+
elementType: ElementType.CitationPaneCloseButton,
|
|
40
|
+
elementId: elementId + "-top-close",
|
|
41
|
+
eventName: EventNames.OnClick
|
|
42
|
+
};
|
|
43
|
+
BroadcastService.postMessage(customEvent);
|
|
44
|
+
handleClose();
|
|
45
|
+
}
|
|
46
|
+
}, [props.controlProps, elementId]); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
47
|
+
|
|
48
|
+
const handleEscKeyDown = useCallback(e => {
|
|
49
|
+
if (e.key === "Escape") {
|
|
50
|
+
handleClose();
|
|
51
|
+
}
|
|
52
|
+
}, [handleClose]);
|
|
53
|
+
const containerStyles = {
|
|
54
|
+
root: Object.assign({}, defaultCitationPaneGeneralStyles, (_props$styleProps = props.styleProps) === null || _props$styleProps === void 0 ? void 0 : _props$styleProps.generalStyleProps, {
|
|
55
|
+
position: "relative" // Ensure container is positioned for absolute positioning of top close button
|
|
56
|
+
|
|
57
|
+
})
|
|
58
|
+
};
|
|
59
|
+
const titleStyles = {
|
|
60
|
+
root: Object.assign({}, defaultCitationPaneTitleStyles, (_props$styleProps2 = props.styleProps) === null || _props$styleProps2 === void 0 ? void 0 : _props$styleProps2.titleStyleProps)
|
|
61
|
+
};
|
|
62
|
+
const contentStyles = { ...defaultCitationPaneContentStyles,
|
|
63
|
+
...((_props$styleProps3 = props.styleProps) === null || _props$styleProps3 === void 0 ? void 0 : _props$styleProps3.contentStyleProps)
|
|
64
|
+
};
|
|
65
|
+
const closeButtonStyles = {
|
|
66
|
+
root: Object.assign({}, defaultCitationPaneCloseButtonStyles, (_props$styleProps4 = props.styleProps) === null || _props$styleProps4 === void 0 ? void 0 : _props$styleProps4.closeButtonStyleProps),
|
|
67
|
+
rootHovered: Object.assign({}, defaultCitationPaneCloseButtonHoveredStyles, (_props$styleProps5 = props.styleProps) === null || _props$styleProps5 === void 0 ? void 0 : _props$styleProps5.closeButtonHoveredStyleProps),
|
|
68
|
+
rootFocused: Object.assign({}, defaultCitationPaneCloseButtonFocusedStyles, (_props$styleProps6 = props.styleProps) === null || _props$styleProps6 === void 0 ? void 0 : _props$styleProps6.closeButtonFocusedStyleProps),
|
|
69
|
+
rootPressed: Object.assign({}, defaultCitationPaneCloseButtonHoveredStyles, (_props$styleProps7 = props.styleProps) === null || _props$styleProps7 === void 0 ? void 0 : _props$styleProps7.closeButtonHoveredStyleProps)
|
|
70
|
+
};
|
|
71
|
+
const topCloseButtonPosition = ((_props$controlProps4 = props.controlProps) === null || _props$controlProps4 === void 0 ? void 0 : _props$controlProps4.topCloseButtonPosition) || defaultCitationPaneControlProps.topCloseButtonPosition;
|
|
72
|
+
const topCloseButtonStyles = {
|
|
73
|
+
root: Object.assign({}, defaultCitationPaneTopCloseButtonStyles, (_props$styleProps8 = props.styleProps) === null || _props$styleProps8 === void 0 ? void 0 : _props$styleProps8.topCloseButtonStyleProps, topCloseButtonPosition === "topLeft" ? {
|
|
74
|
+
left: "0.5em",
|
|
75
|
+
right: "auto"
|
|
76
|
+
} : {
|
|
77
|
+
right: "0.5em",
|
|
78
|
+
left: "auto"
|
|
79
|
+
}),
|
|
80
|
+
rootHovered: Object.assign({}, defaultCitationPaneTopCloseButtonHoveredStyles, (_props$styleProps9 = props.styleProps) === null || _props$styleProps9 === void 0 ? void 0 : _props$styleProps9.topCloseButtonHoveredStyleProps),
|
|
81
|
+
rootFocused: Object.assign({}, defaultCitationPaneTopCloseButtonFocusedStyles, (_props$styleProps10 = props.styleProps) === null || _props$styleProps10 === void 0 ? void 0 : _props$styleProps10.topCloseButtonFocusedStyleProps),
|
|
82
|
+
rootPressed: Object.assign({}, defaultCitationPaneTopCloseButtonHoveredStyles, (_props$styleProps11 = props.styleProps) === null || _props$styleProps11 === void 0 ? void 0 : _props$styleProps11.topCloseButtonHoveredStyleProps)
|
|
83
|
+
};
|
|
84
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Stack, {
|
|
85
|
+
id: elementId,
|
|
86
|
+
role: "dialog",
|
|
87
|
+
"aria-labelledby": elementId + "-title",
|
|
88
|
+
"aria-describedby": elementId + "-content",
|
|
89
|
+
dir: ((_props$controlProps5 = props.controlProps) === null || _props$controlProps5 === void 0 ? void 0 : _props$controlProps5.dir) || defaultCitationPaneControlProps.dir,
|
|
90
|
+
styles: containerStyles,
|
|
91
|
+
className: (_props$styleProps12 = props.styleProps) === null || _props$styleProps12 === void 0 ? void 0 : (_props$styleProps12$c = _props$styleProps12.classNames) === null || _props$styleProps12$c === void 0 ? void 0 : _props$styleProps12$c.containerClassName,
|
|
92
|
+
onKeyDown: handleEscKeyDown,
|
|
93
|
+
tabIndex: -1
|
|
94
|
+
}, !((_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, {
|
|
95
|
+
onClick: handleTopClose,
|
|
96
|
+
id: elementId + "-top-close",
|
|
97
|
+
iconProps: {
|
|
98
|
+
iconName: "ChromeClose"
|
|
99
|
+
},
|
|
100
|
+
ariaLabel: ((_props$controlProps7 = props.controlProps) === null || _props$controlProps7 === void 0 ? void 0 : _props$controlProps7.topCloseButtonAriaLabel) || defaultCitationPaneControlProps.topCloseButtonAriaLabel,
|
|
101
|
+
styles: topCloseButtonStyles,
|
|
102
|
+
className: (_props$styleProps13 = props.styleProps) === null || _props$styleProps13 === void 0 ? void 0 : (_props$styleProps13$c = _props$styleProps13.classNames) === null || _props$styleProps13$c === void 0 ? void 0 : _props$styleProps13$c.topCloseButtonClassName
|
|
103
|
+
})), !((_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, {
|
|
104
|
+
id: elementId + "-title",
|
|
105
|
+
styles: titleStyles,
|
|
106
|
+
className: (_props$styleProps14 = props.styleProps) === null || _props$styleProps14 === void 0 ? void 0 : (_props$styleProps14$c = _props$styleProps14.classNames) === null || _props$styleProps14$c === void 0 ? void 0 : _props$styleProps14$c.titleClassName
|
|
107
|
+
}, ((_props$controlProps9 = props.controlProps) === null || _props$controlProps9 === void 0 ? void 0 : _props$controlProps9.titleText) || defaultCitationPaneControlProps.titleText)), /*#__PURE__*/React.createElement("div", {
|
|
108
|
+
id: elementId + "-content",
|
|
109
|
+
style: contentStyles,
|
|
110
|
+
className: (_props$styleProps15 = props.styleProps) === null || _props$styleProps15 === void 0 ? void 0 : (_props$styleProps15$c = _props$styleProps15.classNames) === null || _props$styleProps15$c === void 0 ? void 0 : _props$styleProps15$c.contentClassName,
|
|
111
|
+
dangerouslySetInnerHTML: {
|
|
112
|
+
__html: ((_props$controlProps10 = props.controlProps) === null || _props$controlProps10 === void 0 ? void 0 : _props$controlProps10.contentHtml) ?? ""
|
|
113
|
+
}
|
|
114
|
+
}), !((_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, {
|
|
115
|
+
onClick: handleClose,
|
|
116
|
+
id: elementId + "-close",
|
|
117
|
+
text: ((_props$controlProps12 = props.controlProps) === null || _props$controlProps12 === void 0 ? void 0 : _props$controlProps12.closeButtonText) || defaultCitationPaneControlProps.closeButtonText,
|
|
118
|
+
ariaLabel: ((_props$controlProps13 = props.controlProps) === null || _props$controlProps13 === void 0 ? void 0 : _props$controlProps13.closeButtonAriaLabel) || defaultCitationPaneControlProps.closeButtonAriaLabel,
|
|
119
|
+
styles: closeButtonStyles,
|
|
120
|
+
className: (_props$styleProps16 = props.styleProps) === null || _props$styleProps16 === void 0 ? void 0 : (_props$styleProps16$c = _props$styleProps16.classNames) === null || _props$styleProps16$c === void 0 ? void 0 : _props$styleProps16$c.closeButtonClassName
|
|
121
|
+
}))));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
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,20 @@
|
|
|
1
|
+
import { defaultCitationPaneCloseButtonFocusedStyles } from "../defaultStyles/defaultCitationPaneCloseButtonFocusedStyles";
|
|
2
|
+
import { defaultCitationPaneCloseButtonHoveredStyles } from "../defaultStyles/defaultCitationPaneCloseButtonHoveredStyles";
|
|
3
|
+
import { defaultCitationPaneCloseButtonStyles } from "../defaultStyles/defaultCitationPaneCloseButtonStyles";
|
|
4
|
+
import { defaultCitationPaneContentStyles } from "../defaultStyles/defaultCitationPaneContentStyles";
|
|
5
|
+
import { defaultCitationPaneGeneralStyles } from "../defaultStyles/defaultCitationPaneGeneralStyles";
|
|
6
|
+
import { defaultCitationPaneTitleStyles } from "../defaultStyles/defaultCitationPaneTitleStyles";
|
|
7
|
+
import { defaultCitationPaneTopCloseButtonFocusedStyles } from "../defaultStyles/defaultCitationPaneTopCloseButtonFocusedStyles";
|
|
8
|
+
import { defaultCitationPaneTopCloseButtonHoveredStyles } from "../defaultStyles/defaultCitationPaneTopCloseButtonHoveredStyles";
|
|
9
|
+
import { defaultCitationPaneTopCloseButtonStyles } from "../defaultStyles/defaultCitationPaneTopCloseButtonStyles";
|
|
10
|
+
export const defaultCitationPaneStyleProps = {
|
|
11
|
+
generalStyleProps: defaultCitationPaneGeneralStyles,
|
|
12
|
+
titleStyleProps: defaultCitationPaneTitleStyles,
|
|
13
|
+
contentStyleProps: defaultCitationPaneContentStyles,
|
|
14
|
+
closeButtonStyleProps: defaultCitationPaneCloseButtonStyles,
|
|
15
|
+
closeButtonHoveredStyleProps: defaultCitationPaneCloseButtonHoveredStyles,
|
|
16
|
+
closeButtonFocusedStyleProps: defaultCitationPaneCloseButtonFocusedStyles,
|
|
17
|
+
topCloseButtonStyleProps: defaultCitationPaneTopCloseButtonStyles,
|
|
18
|
+
topCloseButtonHoveredStyleProps: defaultCitationPaneTopCloseButtonHoveredStyles,
|
|
19
|
+
topCloseButtonFocusedStyleProps: defaultCitationPaneTopCloseButtonFocusedStyles
|
|
20
|
+
};
|
package/lib/esm/components/citationpane/common/defaultStyles/defaultCitationPaneCloseButtonStyles.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
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: "2.75em",
|
|
16
|
+
// A11Y compliant minimum height (44px at 16px base)
|
|
17
|
+
minWidth: "5.5em",
|
|
18
|
+
// A11Y compliant minimum width (88px at 16px base)
|
|
19
|
+
padding: "0.5em 1em",
|
|
20
|
+
// Scalable padding
|
|
21
|
+
// Responsive hiding at high zoom levels for better content space
|
|
22
|
+
"@media (min-resolution: 2.5dppx), (min-resolution: 240dpi)": {
|
|
23
|
+
display: "none" // Hide at 250%+ zoom to preserve content space
|
|
24
|
+
|
|
25
|
+
},
|
|
26
|
+
selectors: {
|
|
27
|
+
":hover": {
|
|
28
|
+
backgroundColor: "#e1dfdd",
|
|
29
|
+
borderColor: "#c8c6c4"
|
|
30
|
+
},
|
|
31
|
+
":focus": {
|
|
32
|
+
outline: "0.125em solid #0078d4",
|
|
33
|
+
// Scalable outline
|
|
34
|
+
outlineOffset: "0.125em" // Scalable offset
|
|
35
|
+
|
|
36
|
+
},
|
|
37
|
+
":active": {
|
|
38
|
+
backgroundColor: "#d2d0ce",
|
|
39
|
+
borderColor: "#c8c6c4"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
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.125em" // Reduced padding to give more space for text at high zoom (scalable)
|
|
13
|
+
|
|
14
|
+
};
|
package/lib/esm/components/citationpane/common/defaultStyles/defaultCitationPaneGeneralStyles.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const defaultCitationPaneGeneralStyles = {
|
|
2
|
+
position: "relative",
|
|
3
|
+
// Required for absolute positioning of top close button
|
|
4
|
+
paddingTop: "2em",
|
|
5
|
+
// Reduced space for top close button (scalable)
|
|
6
|
+
paddingLeft: "0.75em",
|
|
7
|
+
// Reduced left padding (scalable)
|
|
8
|
+
paddingRight: "0.75em",
|
|
9
|
+
// Reduced right padding (scalable)
|
|
10
|
+
paddingBottom: "0.75em",
|
|
11
|
+
// Reduced bottom padding (scalable)
|
|
12
|
+
backgroundColor: "#ffffff",
|
|
13
|
+
border: "1px solid #d2d0ce",
|
|
14
|
+
borderRadius: "0.5em",
|
|
15
|
+
// Scalable border radius
|
|
16
|
+
boxShadow: "0px 0.125em 0.25em rgba(0, 0, 0, 0.1)",
|
|
17
|
+
// Scalable shadow
|
|
18
|
+
display: "flex",
|
|
19
|
+
flexDirection: "column",
|
|
20
|
+
minHeight: "7.5em",
|
|
21
|
+
// Minimum height to ensure proper layout (scalable)
|
|
22
|
+
maxHeight: "30em",
|
|
23
|
+
// Container-relative height instead of viewport-based
|
|
24
|
+
overflow: "hidden" // Hide overflow on container, let content area handle scrolling
|
|
25
|
+
|
|
26
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defaultCitationPaneCloseButtonFocusedStyles } from "./defaultCitationPaneCloseButtonFocusedStyles";
|
|
2
|
+
import { defaultCitationPaneCloseButtonHoveredStyles } from "./defaultCitationPaneCloseButtonHoveredStyles";
|
|
3
|
+
import { defaultCitationPaneCloseButtonStyles } from "./defaultCitationPaneCloseButtonStyles";
|
|
4
|
+
import { defaultCitationPaneContentStyles } from "./defaultCitationPaneContentStyles";
|
|
5
|
+
import { defaultCitationPaneGeneralStyles } from "./defaultCitationPaneGeneralStyles";
|
|
6
|
+
import { defaultCitationPaneTitleStyles } from "./defaultCitationPaneTitleStyles";
|
|
7
|
+
import { defaultCitationPaneTopCloseButtonFocusedStyles } from "./defaultCitationPaneTopCloseButtonFocusedStyles";
|
|
8
|
+
import { defaultCitationPaneTopCloseButtonHoveredStyles } from "./defaultCitationPaneTopCloseButtonHoveredStyles";
|
|
9
|
+
import { defaultCitationPaneTopCloseButtonStyles } from "./defaultCitationPaneTopCloseButtonStyles";
|
|
10
|
+
export const defaultCitationPaneStyles = {
|
|
11
|
+
generalStyleProps: defaultCitationPaneGeneralStyles,
|
|
12
|
+
titleStyleProps: defaultCitationPaneTitleStyles,
|
|
13
|
+
contentStyleProps: defaultCitationPaneContentStyles,
|
|
14
|
+
closeButtonStyleProps: defaultCitationPaneCloseButtonStyles,
|
|
15
|
+
closeButtonHoveredStyleProps: defaultCitationPaneCloseButtonHoveredStyles,
|
|
16
|
+
closeButtonFocusedStyleProps: defaultCitationPaneCloseButtonFocusedStyles,
|
|
17
|
+
topCloseButtonStyleProps: defaultCitationPaneTopCloseButtonStyles,
|
|
18
|
+
topCloseButtonHoveredStyleProps: defaultCitationPaneTopCloseButtonHoveredStyles,
|
|
19
|
+
topCloseButtonFocusedStyleProps: defaultCitationPaneTopCloseButtonFocusedStyles
|
|
20
|
+
};
|
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";
|
|
@@ -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,14 @@
|
|
|
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
|
+
closeButtonHoveredStyleProps?: IStyle;
|
|
9
|
+
closeButtonFocusedStyleProps?: IStyle;
|
|
10
|
+
topCloseButtonStyleProps?: IStyle;
|
|
11
|
+
topCloseButtonHoveredStyleProps?: IStyle;
|
|
12
|
+
topCloseButtonFocusedStyleProps?: IStyle;
|
|
13
|
+
classNames?: ICitationPaneClassNames;
|
|
14
|
+
}
|
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";
|