UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

43 lines 2.39 kB
import * as tslib_1 from "tslib"; import * as React from 'react'; import { BaseComponent, classNamesFunction, divProperties, getNativeProps } from '../../Utilities'; import { TooltipDelay } from './Tooltip.types'; import { Callout } from '../../Callout'; var getClassNames = classNamesFunction(); var TooltipBase = /** @class */ (function (_super) { tslib_1.__extends(TooltipBase, _super); function TooltipBase() { var _this = _super !== null && _super.apply(this, arguments) || this; _this._onRenderContent = function (props) { return React.createElement("p", { className: _this._classNames.subText }, props.content); }; return _this; } TooltipBase.prototype.render = function () { var _a = this.props, className = _a.className, calloutProps = _a.calloutProps, delay = _a.delay, directionalHint = _a.directionalHint, directionalHintForRTL = _a.directionalHintForRTL, styles = _a.styles, id = _a.id, maxWidth = _a.maxWidth, _b = _a.onRenderContent, onRenderContent = _b === void 0 ? this._onRenderContent : _b, targetElement = _a.targetElement, theme = _a.theme; this._classNames = getClassNames(styles, { theme: theme, className: className || (calloutProps && calloutProps.className), delay: delay, maxWidth: maxWidth }); return (React.createElement(Callout, tslib_1.__assign({ target: targetElement, directionalHint: directionalHint, directionalHintForRTL: directionalHintForRTL }, calloutProps, getNativeProps(this.props, divProperties, ['id']), { className: this._classNames.root }), React.createElement("div", { className: this._classNames.content, id: id, role: "tooltip", onMouseEnter: this.props.onMouseEnter, onMouseLeave: this.props.onMouseLeave }, onRenderContent(this.props, this._onRenderContent)))); }; // Specify default props values TooltipBase.defaultProps = { directionalHint: 1 /* topCenter */, delay: TooltipDelay.medium, maxWidth: '364px', calloutProps: { isBeakVisible: true, beakWidth: 16, gapSpace: 0, setInitialFocus: true, doNotLayer: false } }; return TooltipBase; }(BaseComponent)); export { TooltipBase }; //# sourceMappingURL=Tooltip.base.js.map