UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

88 lines 5.87 kB
define(["require", "exports", "tslib", "react", "office-ui-fabric-react/lib/Dropdown", "office-ui-fabric-react/lib/Slider", "../Stack", "office-ui-fabric-react/lib/Styling"], function (require, exports, tslib_1, React, Dropdown_1, Slider_1, Stack_1, Styling_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Non-mutating styles definition var itemStyles = { alignItems: 'center', background: Styling_1.DefaultPalette.themePrimary, color: Styling_1.DefaultPalette.white, display: 'flex', height: 50, justifyContent: 'center', width: 50 }; // Tokens definition var sectionStackTokens = { childrenGap: 10 }; var wrapStackTokens = { childrenGap: 20 }; var VerticalStackWrapAdvancedExample = /** @class */ (function (_super) { tslib_1.__extends(VerticalStackWrapAdvancedExample, _super); function VerticalStackWrapAdvancedExample(props) { var _this = _super.call(this, props) || this; _this._onWidthChange = function (value) { _this.setState({ stackWidth: value }); }; _this._onHeightChange = function (value) { _this.setState({ containerHeight: value }); }; _this._onHorizontalAlignChange = function (ev, option) { _this.setState({ horizontalAlignment: option.key }); }; _this._onVerticalAlignChange = function (ev, option) { _this.setState({ verticalAlignment: option.key }); }; _this._onOverflowChange = function (ev, option) { _this.setState({ overflow: option.key }); }; _this.state = { stackWidth: 100, containerHeight: 420, horizontalAlignment: 'start', verticalAlignment: 'start', overflow: 'visible' }; return _this; } VerticalStackWrapAdvancedExample.prototype.render = function () { var _a = this.state, stackWidth = _a.stackWidth, containerHeight = _a.containerHeight, overflow = _a.overflow, horizontalAlignment = _a.horizontalAlignment, verticalAlignment = _a.verticalAlignment; // Mutating styles definition var stackStyles = { root: { background: Styling_1.DefaultPalette.themeTertiary, overflow: overflow, width: stackWidth + "%" } }; var containerStyles = { height: containerHeight }; return (React.createElement(Stack_1.Stack, { tokens: sectionStackTokens }, React.createElement(Stack_1.Stack, { horizontal: true }, React.createElement(Stack_1.Stack.Item, { grow: true }, React.createElement(Slider_1.Slider, { label: "Stack height:", min: 1, max: 420, step: 1, defaultValue: 420, showValue: true, onChange: this._onHeightChange })), React.createElement(Stack_1.Stack.Item, { grow: true }, React.createElement(Slider_1.Slider, { label: "Container width:", min: 1, max: 100, step: 1, defaultValue: 100, showValue: true, onChange: this._onWidthChange }))), React.createElement(Stack_1.Stack, { horizontal: true, tokens: wrapStackTokens }, React.createElement(Stack_1.Stack.Item, { grow: true }, React.createElement(Dropdown_1.Dropdown, { selectedKey: horizontalAlignment, placeholder: "Select Horizontal Alignment", label: "Horizontal alignment:", options: [{ key: 'start', text: 'Left' }, { key: 'center', text: 'Center' }, { key: 'end', text: 'Right' }], onChange: this._onHorizontalAlignChange })), React.createElement(Stack_1.Stack.Item, { grow: true }, React.createElement(Dropdown_1.Dropdown, { selectedKey: verticalAlignment, placeholder: "Select Vertical Alignment", label: "Vertical alignment:", options: [ { key: 'start', text: 'Top' }, { key: 'center', text: 'Center' }, { key: 'end', text: 'Bottom' }, { key: 'space-around', text: 'Space around' }, { key: 'space-between', text: 'Space between' }, { key: 'space-evenly', text: 'Space evenly' } ], onChange: this._onVerticalAlignChange })), React.createElement(Stack_1.Stack.Item, { grow: true }, React.createElement(Dropdown_1.Dropdown, { selectedKey: overflow, placeholder: "Select Overflow", label: "Overflow:", options: [{ key: 'visible', text: 'Visible' }, { key: 'auto', text: 'Auto' }, { key: 'hidden', text: 'Hidden' }], onChange: this._onOverflowChange }))), React.createElement("div", { style: containerStyles }, React.createElement(Stack_1.Stack, { wrap: true, horizontalAlign: horizontalAlignment, verticalAlign: verticalAlignment, styles: stackStyles, tokens: wrapStackTokens }, React.createElement("span", { style: itemStyles }, "1"), React.createElement("span", { style: itemStyles }, "2"), React.createElement("span", { style: itemStyles }, "3"), React.createElement("span", { style: itemStyles }, "4"), React.createElement("span", { style: itemStyles }, "5"))))); }; return VerticalStackWrapAdvancedExample; }(React.Component)); exports.VerticalStackWrapAdvancedExample = VerticalStackWrapAdvancedExample; }); //# sourceMappingURL=Stack.Vertical.WrapAdvanced.Example.js.map