office-ui-fabric-react
Version:
Reusable React components for building experiences for Office 365.
64 lines • 2.92 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = require("react");
var Utilities_1 = require("../../Utilities");
var TeachingBubbleContent_1 = require("./TeachingBubbleContent");
var Callout_1 = require("../../Callout");
var DirectionalHint_1 = require("../../common/DirectionalHint");
var getClassNames = Utilities_1.classNamesFunction();
var TeachingBubbleBase = /** @class */ (function (_super) {
tslib_1.__extends(TeachingBubbleBase, _super);
// Constructor
function TeachingBubbleBase(props) {
var _this = _super.call(this, props) || this;
_this.rootElement = React.createRef();
_this.state = {};
_this._defaultCalloutProps = {
beakWidth: 16,
gapSpace: 0,
setInitialFocus: true,
doNotLayer: false,
directionalHint: DirectionalHint_1.DirectionalHint.rightCenter
};
return _this;
}
TeachingBubbleBase.prototype.focus = function () {
if (this.rootElement.current) {
this.rootElement.current.focus();
}
};
TeachingBubbleBase.prototype.render = function () {
var _a = this.props, setCalloutProps = _a.calloutProps, targetElement = _a.targetElement, onDismiss = _a.onDismiss, isWide = _a.isWide, styles = _a.styles, theme = _a.theme, target = _a.target;
var calloutProps = tslib_1.__assign({}, this._defaultCalloutProps, setCalloutProps);
var stylesProps = {
theme: theme,
isWide: isWide,
calloutClassName: calloutProps ? calloutProps.className : undefined
};
var classNames = getClassNames(styles, stylesProps);
var calloutStyles = classNames.subComponentStyles
? classNames.subComponentStyles.callout
: undefined;
return (React.createElement(Callout_1.Callout, tslib_1.__assign({ target: target || targetElement, onDismiss: onDismiss }, calloutProps, { className: classNames.root, styles: calloutStyles, hideOverflow: true }),
React.createElement("div", { ref: this.rootElement },
React.createElement(TeachingBubbleContent_1.TeachingBubbleContent, tslib_1.__assign({}, this.props)))));
};
TeachingBubbleBase.defaultProps = {
/**
* Default calloutProps is deprecated in favor of private `_defaultCalloutProps`.
* Remove in next release.
* @deprecated In favor of private `_defaultCalloutProps`.
*/
calloutProps: {
beakWidth: 16,
gapSpace: 0,
setInitialFocus: true,
doNotLayer: false,
directionalHint: DirectionalHint_1.DirectionalHint.rightCenter
}
};
return TeachingBubbleBase;
}(Utilities_1.BaseComponent));
exports.TeachingBubbleBase = TeachingBubbleBase;
//# sourceMappingURL=TeachingBubble.base.js.map
;