office-ui-fabric-react
Version:
Reusable React components for building experiences for Office 365.
58 lines • 2.7 kB
JavaScript
import * as tslib_1 from "tslib";
import * as React from 'react';
import { Customizer } from '@uifabric/utilities';
import { Panel } from '../../../Panel';
import { Checkbox } from '../../../Checkbox';
import { LayerHost } from '../LayerHost';
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: true,
trapPanel: true
};
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'
} })));
};
return LayerCustomizedExample;
}(React.Component));
export { LayerCustomizedExample };
//# sourceMappingURL=Layer.Customized.Example.js.map