1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, '__esModule', { value: true });
|
4 |
|
5 | function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
6 |
|
7 | require('./slicedToArray-0711941d.js');
|
8 | require('./unsupportedIterableToArray-68db1d3b.js');
|
9 | var React = require('react');
|
10 | var React__default = _interopDefault(React);
|
11 | require('./_commonjsHelpers-72d386ba.js');
|
12 | var index = require('./index-b0606964.js');
|
13 | var defineProperty$1 = require('./defineProperty-0921a47c.js');
|
14 | require('./toConsumableArray-d8a4a2c3.js');
|
15 | var _styled = require('styled-components');
|
16 | var _styled__default = _interopDefault(_styled);
|
17 | var getPrototypeOf = require('./getPrototypeOf-2a661a20.js');
|
18 | require('./color.js');
|
19 | require('./components.js');
|
20 | require('./contains-component.js');
|
21 | var css = require('./css.js');
|
22 | require('./dayjs.min-e07657bf.js');
|
23 | require('./date.js');
|
24 | var miscellaneous = require('./miscellaneous.js');
|
25 | require('./environment.js');
|
26 | require('./font.js');
|
27 | require('./math-f4029164.js');
|
28 | require('./characters.js');
|
29 | require('./format.js');
|
30 | require('./keycodes.js');
|
31 | require('./url.js');
|
32 | require('./web3.js');
|
33 | require('./constants.js');
|
34 | require('./breakpoints.js');
|
35 | var springs = require('./springs.js');
|
36 | require('./text-styles.js');
|
37 | require('./theme-dark.js');
|
38 | require('./theme-light.js');
|
39 | var Theme = require('./Theme.js');
|
40 | var _extends$1 = require('./extends-40571110.js');
|
41 | var objectWithoutProperties = require('./objectWithoutProperties-35db8ab0.js');
|
42 | var index$1 = require('./index-ecc57c9f.js');
|
43 | require('./objectWithoutPropertiesLoose-1af20ad0.js');
|
44 | require('react-dom');
|
45 | var web = require('./web-d0294535.js');
|
46 | require('./getDisplayName-7ab6d318.js');
|
47 | var index$2 = require('./index-bc84a358.js');
|
48 | var Text = require('./Text.js');
|
49 |
|
50 | var chevronSvg = "data:image/svg+xml,%3Csvg%20width%3D%227%22%20height%3D%2212%22%20viewBox%3D%220%200%207%2012%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M.446%2012a.512.512%200%2001-.172-.03.422.422%200%2001-.146-.087A.37.37%200%20010%2011.6a.37.37%200%2001.128-.281l5.826-5.361L.217.692A.376.376%200%2001.089.405.378.378%200%2001.217.117.444.444%200%2001.529%200c.123%200%20.228.04.313.117l6.03%205.56A.37.37%200%20017%205.96a.37.37%200%2001-.128.281l-6.12%205.643A.477.477%200%2001.446%2012z%22%20fill%3D%22%2300CBE6%22%20fill-rule%3D%22evenodd%22%2F%3E%3C%2Fsvg%3E";
|
51 |
|
52 | function _createSuper(Derived) { return function () { var Super = getPrototypeOf._getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = getPrototypeOf._getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return getPrototypeOf._possibleConstructorReturn(this, result); }; }
|
53 |
|
54 | function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
55 |
|
56 | var BAR_HEIGHT = 64;
|
57 |
|
58 | var _StyledDiv = _styled__default("div").withConfig({
|
59 | displayName: "AppBar___StyledDiv",
|
60 | componentId: "sc-11q0awo-0"
|
61 | })(["overflow:hidden;display:flex;flex-direction:column;width:100%;min-height:", "px;background:", ";", ";padding-bottom:1px;&:after{content:'';position:absolute;left:0;right:0;bottom:0;border-bottom:1px solid ", ";}"], BAR_HEIGHT, function (p) {
|
62 | return p._css;
|
63 | }, function (p) {
|
64 | return p._css2;
|
65 | }, function (p) {
|
66 | return p._css3;
|
67 | });
|
68 |
|
69 | var _StyledDiv2 = _styled__default("div").withConfig({
|
70 | displayName: "AppBar___StyledDiv2",
|
71 | componentId: "sc-11q0awo-1"
|
72 | })(["display:flex;align-items:center;justify-content:flex-start;width:100%;height:", "px;"], function (p) {
|
73 | return p._css4;
|
74 | });
|
75 |
|
76 | var _StyledDiv3 = _styled__default("div").withConfig({
|
77 | displayName: "AppBar___StyledDiv3",
|
78 | componentId: "sc-11q0awo-2"
|
79 | })(["display:flex;align-items:center;height:100%;padding-left:", "px;"], function (p) {
|
80 | return p._css5;
|
81 | });
|
82 |
|
83 | var _StyledDiv4 = _styled__default("div").withConfig({
|
84 | displayName: "AppBar___StyledDiv4",
|
85 | componentId: "sc-11q0awo-3"
|
86 | })(["display:flex;align-items:center;height:100%;margin-left:auto;padding-right:", "px;"], function (p) {
|
87 | return p._css6;
|
88 | });
|
89 |
|
90 | var AppBar = function (_React$Component) {
|
91 | getPrototypeOf._inherits(AppBar, _React$Component);
|
92 |
|
93 | var _super = _createSuper(AppBar);
|
94 |
|
95 | function AppBar() {
|
96 | var _this;
|
97 |
|
98 | getPrototypeOf._classCallCheck(this, AppBar);
|
99 |
|
100 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
101 | args[_key] = arguments[_key];
|
102 | }
|
103 |
|
104 | _this = _super.call.apply(_super, [this].concat(args));
|
105 |
|
106 | defineProperty$1._defineProperty(getPrototypeOf._assertThisInitialized(_this), "state", {
|
107 | tabsHeight: 0
|
108 | });
|
109 |
|
110 | defineProperty$1._defineProperty(getPrototypeOf._assertThisInitialized(_this), "_tabsRef", React__default.createRef());
|
111 |
|
112 | return _this;
|
113 | }
|
114 |
|
115 | getPrototypeOf._createClass(AppBar, [{
|
116 | key: "componentDidMount",
|
117 | value: function componentDidMount() {
|
118 | this.updateTabsHeight();
|
119 | }
|
120 | }, {
|
121 | key: "componentDidUpdate",
|
122 | value: function componentDidUpdate(prevProps) {
|
123 | if (Boolean(prevProps.tabs) !== Boolean(this.props.tabs)) {
|
124 | this.updateTabsHeight();
|
125 | }
|
126 | }
|
127 | }, {
|
128 | key: "updateTabsHeight",
|
129 | value: function updateTabsHeight() {
|
130 | var el = this._tabsRef.current;
|
131 |
|
132 | if (el) {
|
133 | this.setState({
|
134 | tabsHeight: el.clientHeight
|
135 | });
|
136 | }
|
137 | }
|
138 | }, {
|
139 | key: "render",
|
140 | value: function render() {
|
141 | var _this2 = this;
|
142 |
|
143 | var tabsHeight = this.state.tabsHeight;
|
144 |
|
145 | var _this$props = this.props,
|
146 | children = _this$props.children,
|
147 | endContent = _this$props.endContent,
|
148 | onTitleClick = _this$props.onTitleClick,
|
149 | padding = _this$props.padding,
|
150 | tabs = _this$props.tabs,
|
151 | title = _this$props.title,
|
152 | theme = _this$props.theme,
|
153 | props = objectWithoutProperties._objectWithoutProperties(_this$props, ["children", "endContent", "onTitleClick", "padding", "tabs", "title", "theme"]);
|
154 |
|
155 | return React__default.createElement(index$1.i, {
|
156 | name: "AppBar"
|
157 | }, React__default.createElement(_StyledDiv, {
|
158 | _css: theme.surface,
|
159 | _css2: css.unselectable(),
|
160 | _css3: theme.border
|
161 | }, React__default.createElement(_StyledDiv2, _extends$1._extends({}, props, {
|
162 | _css4: BAR_HEIGHT - 1
|
163 | }), title && React__default.createElement(_StyledDiv3, {
|
164 | _css5: padding
|
165 | }, React__default.createElement(AppBarTitle, {
|
166 | chevron: Boolean(children),
|
167 | clickable: Boolean(onTitleClick),
|
168 | onClick: onTitleClick
|
169 | }, typeof title === 'string' ? React__default.createElement(Text.default, {
|
170 | size: "xxlarge",
|
171 | deprecationNotice: false
|
172 | }, title) : title)), children, endContent && React__default.createElement(_StyledDiv4, {
|
173 | _css6: padding
|
174 | }, endContent)), React__default.createElement(web.Transition, {
|
175 | items: tabs,
|
176 | from: {
|
177 | opacity: 0,
|
178 | height: 0
|
179 | },
|
180 | enter: {
|
181 | opacity: 1,
|
182 | height: tabsHeight || 'auto'
|
183 | },
|
184 | leave: {
|
185 | opacity: 0,
|
186 | height: 0
|
187 | },
|
188 | initial: null,
|
189 | config: springs.springs.smooth,
|
190 | native: true
|
191 | }, function (tabs) {
|
192 | return tabs && function (styles) {
|
193 | return React__default.createElement(TabsWrapper, {
|
194 | style: styles
|
195 | }, React__default.createElement("div", {
|
196 | ref: _this2._tabsRef
|
197 | }, tabs));
|
198 | };
|
199 | })));
|
200 | }
|
201 | }]);
|
202 |
|
203 | return AppBar;
|
204 | }(React__default.Component);
|
205 |
|
206 | defineProperty$1._defineProperty(AppBar, "propTypes", {
|
207 | children: index.PropTypes.node,
|
208 | endContent: index.PropTypes.node,
|
209 | onTitleClick: index.PropTypes.func,
|
210 | padding: index.PropTypes.number,
|
211 | tabs: index.PropTypes.element,
|
212 | theme: index.PropTypes.object,
|
213 | title: index.PropTypes.node
|
214 | });
|
215 |
|
216 | defineProperty$1._defineProperty(AppBar, "defaultProps", {
|
217 | onTitleClick: miscellaneous.noop,
|
218 | padding: 30,
|
219 | title: ''
|
220 | });
|
221 |
|
222 | var AppBarTitle = index$2.PublicUrl.hocWrap(_styled__default.h1.withConfig({
|
223 | displayName: "AppBar__AppBarTitle",
|
224 | componentId: "sc-11q0awo-4"
|
225 | })(["padding-right:20px;margin-right:calc(20px - 7px);white-space:nowrap;background-image:", ";background-position:100% 50%;background-repeat:no-repeat;cursor:", ";"], function (_ref) {
|
226 | var chevron = _ref.chevron;
|
227 | return chevron ? _styled.css(["url(", ")"], index$2.PublicUrl.styledUrl(chevronSvg)) : 'none';
|
228 | }, function (_ref2) {
|
229 | var clickable = _ref2.clickable;
|
230 | return clickable ? 'pointer' : 'default';
|
231 | }));
|
232 | var TabsWrapper = _styled__default(web.extendedAnimated.div).withConfig({
|
233 | displayName: "AppBar__TabsWrapper",
|
234 | componentId: "sc-11q0awo-5"
|
235 | })(["position:relative;z-index:1;"]);
|
236 | function AppBar$1 (props) {
|
237 | var theme = Theme.useTheme();
|
238 | return React__default.createElement(AppBar, _extends$1._extends({}, props, {
|
239 | theme: theme
|
240 | }));
|
241 | }
|
242 |
|
243 | exports.default = AppBar$1;
|
244 |
|