kepler.gl
Version:
kepler.gl is a webgl based application to visualize large scale location data in the browser
61 lines (60 loc) • 8.45 kB
JavaScript
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
var _react = _interopRequireDefault(require("react"));
var _reactIntl = require("react-intl");
var _localization = require("@kepler.gl/localization");
var _styledComponents = require("./styled-components");
var _icons = require("./icons");
var _styledComponents2 = _interopRequireDefault(require("styled-components"));
var _utils = require("@kepler.gl/utils");
var _templateObject; // SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
var StyledInfoHelper = _styledComponents2["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n align-items: center;\n margin-left: 10px;\n color: ", ";\n display: inline-flex;\n .info-helper__content {\n width: ", ";\n max-width: ", ";\n }\n &:hover {\n cursor: pointer;\n color: ", ";\n }\n"])), function (props) {
return props.theme.labelColor;
}, function (props) {
return props.width ? "".concat(props.width, "px") : 'auto';
}, function (props) {
return props.width ? 'auto' : '100px';
}, function (props) {
return props.theme.textColorHl;
});
function InfoHelperFactory() {
var InfoHelper = function InfoHelper(_ref) {
var description = _ref.description,
property = _ref.property,
containerClass = _ref.containerClass,
width = _ref.width,
id = _ref.id;
// TODO: move intl out
var intl = (0, _reactIntl.useIntl)();
return /*#__PURE__*/_react["default"].createElement(StyledInfoHelper, {
className: "info-helper ".concat(containerClass || ''),
width: width,
"data-tip": true,
"data-for": id
}, /*#__PURE__*/_react["default"].createElement(_icons.Docs, {
height: "16px"
}), /*#__PURE__*/_react["default"].createElement(_styledComponents.Tooltip, {
id: id,
effect: "solid"
}, /*#__PURE__*/_react["default"].createElement("div", {
className: "info-helper__content"
}, description && /*#__PURE__*/_react["default"].createElement(_localization.FormattedMessage, {
id: description,
defaultValue: description,
values: {
property: intl.formatMessage({
id: property ? "property.".concat((0, _utils.camelize)(property)) : 'misc.empty'
})
}
}))));
};
return InfoHelper;
}
var _default = exports["default"] = InfoHelperFactory;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfcmVhY3QiLCJfaW50ZXJvcFJlcXVpcmVEZWZhdWx0IiwicmVxdWlyZSIsIl9yZWFjdEludGwiLCJfbG9jYWxpemF0aW9uIiwiX3N0eWxlZENvbXBvbmVudHMiLCJfaWNvbnMiLCJfc3R5bGVkQ29tcG9uZW50czIiLCJfdXRpbHMiLCJfdGVtcGxhdGVPYmplY3QiLCJTdHlsZWRJbmZvSGVscGVyIiwic3R5bGVkIiwiZGl2IiwiX3RhZ2dlZFRlbXBsYXRlTGl0ZXJhbDIiLCJwcm9wcyIsInRoZW1lIiwibGFiZWxDb2xvciIsIndpZHRoIiwiY29uY2F0IiwidGV4dENvbG9ySGwiLCJJbmZvSGVscGVyRmFjdG9yeSIsIkluZm9IZWxwZXIiLCJfcmVmIiwiZGVzY3JpcHRpb24iLCJwcm9wZXJ0eSIsImNvbnRhaW5lckNsYXNzIiwiaWQiLCJpbnRsIiwidXNlSW50bCIsImNyZWF0ZUVsZW1lbnQiLCJjbGFzc05hbWUiLCJEb2NzIiwiaGVpZ2h0IiwiVG9vbHRpcCIsImVmZmVjdCIsIkZvcm1hdHRlZE1lc3NhZ2UiLCJkZWZhdWx0VmFsdWUiLCJ2YWx1ZXMiLCJmb3JtYXRNZXNzYWdlIiwiY2FtZWxpemUiLCJfZGVmYXVsdCIsImV4cG9ydHMiXSwic291cmNlcyI6WyIuLi8uLi9zcmMvY29tbW9uL2luZm8taGVscGVyLnRzeCJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBTUERYLUxpY2Vuc2UtSWRlbnRpZmllcjogTUlUXG4vLyBDb3B5cmlnaHQgY29udHJpYnV0b3JzIHRvIHRoZSBrZXBsZXIuZ2wgcHJvamVjdFxuXG5pbXBvcnQgUmVhY3QgZnJvbSAncm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