UNPKG

kepler.gl

Version:

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

58 lines (57 loc) 10.1 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 _momentTimezone = _interopRequireDefault(require("moment-timezone")); var _styledComponents = _interopRequireWildcard(require("styled-components")); var _constants = require("@kepler.gl/constants"); var _itemSelector = _interopRequireDefault(require("../common/item-selector/item-selector")); 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 getValue = function getValue(op) { return (op === null || op === void 0 ? void 0 : op.name) || _constants.DEFAULT_TIMEZONE; }; var StyledItemSelector = (0, _styledComponents["default"])(_itemSelector["default"])(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n .item-selector__dropdown {\n padding-left: 30px;\n border-radius: 4px;\n }\n .active {\n border-color: ", ";\n border-radius: 4px 4px 0px 0px !important;\n }\n"])), function (props) { return props.theme.activeColor; }); var defaultTimezones = _momentTimezone["default"].tz.names().map(function (name) { return { name: name }; }); function TimezoneSelectorFactory() { var TimezoneTypeSelector = function TimezoneTypeSelector(_ref) { var selected = _ref.selected, _ref$options = _ref.options, options = _ref$options === void 0 ? defaultTimezones : _ref$options, onSelect = _ref.onSelect; var selectedItems = (0, _react.useMemo)(function () { return selected ? [{ name: selected }] : []; }, [selected]); return /*#__PURE__*/_react["default"].createElement(StyledItemSelector, { selectedItems: selectedItems, options: options, multiSelect: false, disabled: false, placeholder: "effectManager.timezone", onChange: onSelect, filterOption: "name", getOptionValue: getValue, displayOption: getValue, searchable: true, showArrow: true }); }; return (0, _styledComponents.withTheme)(TimezoneTypeSelector); } var _default = exports["default"] = TimezoneSelectorFactory; //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfcmVhY3QiLCJfaW50ZXJvcFJlcXVpcmVXaWxkY2FyZCIsInJlcXVpcmUiLCJfbW9tZW50VGltZXpvbmUiLCJfaW50ZXJvcFJlcXVpcmVEZWZhdWx0IiwiX3N0eWxlZENvbXBvbmVudHMiLCJfY29uc3RhbnRzIiwiX2l0ZW1TZWxlY3RvciIsIl90ZW1wbGF0ZU9iamVjdCIsIl9nZXRSZXF1aXJlV2lsZGNhcmRDYWNoZSIsImUiLCJXZWFrTWFwIiwiciIsInQiLCJfX2VzTW9kdWxlIiwiX3R5cGVvZiIsImhhcyIsImdldCIsIm4iLCJfX3Byb3RvX18iLCJhIiwiT2JqZWN0IiwiZGVmaW5lUHJvcGVydHkiLCJnZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IiLCJ1IiwiaGFzT3duUHJvcGVydHkiLCJjYWxsIiwiaSIsInNldCIsImdldFZhbHVlIiwib3AiLCJuYW1lIiwiREVGQVVMVF9USU1FWk9ORSIsIlN0eWxlZEl0ZW1TZWxlY3RvciIsInN0eWxlZCIsIkl0ZW1TZWxlY3RvciIsIl90YWdnZWRUZW1wbGF0ZUxpdGVyYWwyIiwicHJvcHMiLCJ0aGVtZSIsImFjdGl2Z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