UNPKG

kepler.gl

Version:

kepler.gl is a webgl based application to visualize large scale location data in the browser

48 lines (47 loc) 8.78 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); var _typeof = require("@babel/runtime/helpers/typeof"); Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral")); var _react = _interopRequireWildcard(require("react")); var _styledComponents = _interopRequireDefault(require("styled-components")); var _panelTab = _interopRequireDefault(require("./panel-tab")); var _templateObject; // SPDX-License-Identifier: MIT // Copyright contributors to the kepler.gl project function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; } var PanelHeaderBottom = _styledComponents["default"].div.attrs({ className: 'side-side-panel__header__bottom' })(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n background-color: ", ";\n border-bottom: 1px solid ", ";\n padding: 0 16px;\n display: flex;\n min-height: 30px;\n"])), function (props) { return props.theme.sidePanelHeaderBg; }, function (props) { return props.theme.sidePanelHeaderBorder; }); PanelToggleFactory.deps = [_panelTab["default"]]; function PanelToggleFactory(PanelTab) { var PanelToggle = function PanelToggle(_ref) { var activePanel = _ref.activePanel, panels = _ref.panels, togglePanel = _ref.togglePanel; var _onClick = (0, _react.useCallback)(function (panel) { var callback = panel.onClick || togglePanel; callback(panel.id); }, [togglePanel]); return /*#__PURE__*/_react["default"].createElement(PanelHeaderBottom, null, panels.map(function (panel) { return /*#__PURE__*/_react["default"].createElement(PanelTab, { key: panel.id, panel: panel, isActive: activePanel === panel.id, onClick: function onClick() { return _onClick(panel); } }); })); }; return PanelToggle; } var _default = exports["default"] = PanelToggleFactory; //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfcmVhY3QiLCJfaW50ZXJvcFJlcXVpcmVXaWxkY2FyZCIsInJlcXVpcmUiLCJfc3R5bGVkQ29tcG9uZW50cyIsIl9pbnRlcm9wUmVxdWlyZURlZmF1bHQiLCJfcGFuZWxUYWIiLCJfdGVtcGxhdGVPYmplY3QiLCJfZ2V0UmVxdWlyZVdpbGRjYXJkQ2FjaGUiLCJlIiwiV2Vha01hcCIsInIiLCJ0IiwiX19lc01vZHVsZSIsIl90eXBlb2YiLCJoYXMiLCJnZXQiLCJuIiwiX19wcm90b19fIiwiYSIsIk9iamVjdCIsImRlZmluZVByb3BlcnR5IiwiZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yIiwidSIsImhhc093blByb3BlcnR5IiwiY2FsbCIsImkiLCJzZXQiLCJQYW5lbEhlYWRlckJvdHRvbSIsInN0eWxlZCIsImRpdiIsImF0dHJzIiwiY2xhc3NOYW1lIiwiX3RhZ2dlZFRlbXBsYXRlTGl0ZXJhbDIiLCJwcm9wcyIsInRoZW1lIiwic2lkZVBhbmVsSGVhZGVyQmciLCJzaWRlUGFuZWxIZWFkZXJCb3JkZXIiLCJQYW5lbFRvZ2dsZUZhY3RvcnkiLCJkZXBzIiwiUGFuZWxUYWJGYWN0b3J5IiwiUGFuZWxUYWIiLCJQYW5lbFRvZ2dsZSIsIl9yZWYiLCJhY3RpdmVQYW5lbCIsInBhbmVscyIsInRvZ2dsZVBhbmVsIiwib25DbGljayIsInVzZUNhbGxiYWNrIiwicGFuZWwiLCJjYW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