UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

62 lines 2.98 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var React = require("react"); var utilities_1 = require("@uifabric/utilities"); var Panel_1 = require("office-ui-fabric-react/lib/Panel"); var Checkbox_1 = require("office-ui-fabric-react/lib/Checkbox"); var Layer_1 = require("office-ui-fabric-react/lib/Layer"); var LayerCustomizedExample = /** @class */ (function (_super) { tslib_1.__extends(LayerCustomizedExample, _super); function LayerCustomizedExample(props) { var _this = _super.call(this, props) || this; _this._onDismissPanel = function () { _this.setState({ showPanel: false }); }; _this._onShowPanelChange = function (event, checked) { _this.setState({ showPanel: !!checked }); }; _this._onTrapPanelChange = function (event, checked) { _this.setState({ trapPanel: !!checked }); }; _this.state = { showPanel: false, trapPanel: false }; return _this; } LayerCustomizedExample.prototype.render = function () { return (React.createElement("div", null, React.createElement("p", null, "A ", React.createElement("code", null, "Panel"), " is rendered, trapped in a specified container. Use 'Show panel' to show/hide the panel (or click the X to dismiss it). Use 'Trap panel' to release the panel from its bounds."), React.createElement(Checkbox_1.Checkbox, { label: "Show panel", checked: this.state.showPanel, onChange: this._onShowPanelChange }), React.createElement(Checkbox_1.Checkbox, { label: "Trap panel", checked: this.state.trapPanel, onChange: this._onTrapPanelChange }), React.createElement(utilities_1.Customizer, { scopedSettings: this.state.trapPanel ? { Layer: { hostId: 'test' } } : {} }, this.state.showPanel ? (React.createElement(Panel_1.Panel, { isOpen: true, hasCloseButton: true, headerText: "Test", focusTrapZoneProps: { isClickableOutsideFocusTrap: true, forceFocusInsideTrap: false }, onDismissed: this._onDismissPanel })) : (React.createElement("div", null))), React.createElement(Layer_1.LayerHost, { id: "test", style: { position: 'relative', height: '400px', overflow: 'hidden', border: '1px solid #ccc' } }))); }; return LayerCustomizedExample; }(React.Component)); exports.LayerCustomizedExample = LayerCustomizedExample; //# sourceMappingURL=Layer.Customized.Example.js.map