UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

60 lines 2.84 kB
import * as tslib_1 from "tslib"; import * as React from 'react'; import { Customizer } from '@uifabric/utilities'; import { Panel } from 'office-ui-fabric-react/lib/Panel'; import { Checkbox } from 'office-ui-fabric-react/lib/Checkbox'; import { LayerHost } from '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, { label: "Show panel", checked: this.state.showPanel, onChange: this._onShowPanelChange }), React.createElement(Checkbox, { label: "Trap panel", checked: this.state.trapPanel, onChange: this._onTrapPanelChange }), React.createElement(Customizer, { scopedSettings: this.state.trapPanel ? { Layer: { hostId: 'test' } } : {} }, this.state.showPanel ? (React.createElement(Panel, { isOpen: true, hasCloseButton: true, headerText: "Test", focusTrapZoneProps: { isClickableOutsideFocusTrap: true, forceFocusInsideTrap: false }, onDismissed: this._onDismissPanel })) : (React.createElement("div", null))), React.createElement(LayerHost, { id: "test", style: { position: 'relative', height: '400px', overflow: 'hidden', border: '1px solid #ccc' } }))); }; return LayerCustomizedExample; }(React.Component)); export { LayerCustomizedExample }; //# sourceMappingURL=Layer.Customized.Example.js.map