1 | import { __assign, __extends } from "tslib";
|
2 | import * as React from 'react';
|
3 | import { initializeComponentRef, classNamesFunction } from '../../Utilities';
|
4 | import { TeachingBubbleContent } from './TeachingBubbleContent';
|
5 | import { Callout } from '../../Callout';
|
6 | import { DirectionalHint } from '../../common/DirectionalHint';
|
7 | var getClassNames = classNamesFunction();
|
8 | var TeachingBubbleBase = (function (_super) {
|
9 | __extends(TeachingBubbleBase, _super);
|
10 |
|
11 | function TeachingBubbleBase(props) {
|
12 | var _this = _super.call(this, props) || this;
|
13 | _this.rootElement = React.createRef();
|
14 | initializeComponentRef(_this);
|
15 | _this.state = {};
|
16 | _this._defaultCalloutProps = {
|
17 | beakWidth: 16,
|
18 | gapSpace: 0,
|
19 | setInitialFocus: true,
|
20 | doNotLayer: false,
|
21 | directionalHint: DirectionalHint.rightCenter,
|
22 | };
|
23 | return _this;
|
24 | }
|
25 | TeachingBubbleBase.prototype.focus = function () {
|
26 | if (this.rootElement.current) {
|
27 | this.rootElement.current.focus();
|
28 | }
|
29 | };
|
30 | TeachingBubbleBase.prototype.render = function () {
|
31 | var _a = this.props, setCalloutProps = _a.calloutProps,
|
32 |
|
33 | targetElement = _a.targetElement, onDismiss = _a.onDismiss,
|
34 |
|
35 |
|
36 | _b = _a.hasCloseButton,
|
37 |
|
38 |
|
39 | hasCloseButton = _b === void 0 ? this.props.hasCloseIcon : _b, isWide = _a.isWide, styles = _a.styles, theme = _a.theme, target = _a.target;
|
40 | var calloutProps = __assign(__assign({}, this._defaultCalloutProps), setCalloutProps);
|
41 | var stylesProps = {
|
42 | theme: theme,
|
43 | isWide: isWide,
|
44 | calloutProps: __assign(__assign({}, calloutProps), { theme: calloutProps.theme }),
|
45 | hasCloseButton: hasCloseButton,
|
46 | };
|
47 | var classNames = getClassNames(styles, stylesProps);
|
48 | var calloutStyles = classNames.subComponentStyles
|
49 | ? classNames.subComponentStyles.callout
|
50 | : undefined;
|
51 | return (React.createElement(Callout, __assign({ target: target || targetElement, onDismiss: onDismiss }, calloutProps, { className: classNames.root, styles: calloutStyles, hideOverflow: true }),
|
52 | React.createElement("div", { ref: this.rootElement },
|
53 | React.createElement(TeachingBubbleContent, __assign({}, this.props)))));
|
54 | };
|
55 | TeachingBubbleBase.defaultProps = {
|
56 | |
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 | calloutProps: {
|
63 | beakWidth: 16,
|
64 | gapSpace: 0,
|
65 | setInitialFocus: true,
|
66 | doNotLayer: false,
|
67 | directionalHint: DirectionalHint.rightCenter,
|
68 | },
|
69 | };
|
70 | return TeachingBubbleBase;
|
71 | }(React.Component));
|
72 | export { TeachingBubbleBase };
|
73 |
|
\ | No newline at end of file |