@kiwicom/orbit-components
Version:
Orbit-components is a React component library which provides developers with the easiest possible way of building Kiwi.com’s products.
43 lines (33 loc) • 1.83 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var React = _interopRequireWildcard(require("react"));
var _styledComponents = _interopRequireWildcard(require("styled-components"));
var _Text = require("../Text");
var _Heading = require("../Heading");
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
var StyledTruncate = _styledComponents.default.div.withConfig({
displayName: "Truncate__StyledTruncate",
componentId: "jwxsw1-0"
})(["min-width:0;", ";"], function (_ref) {
var maxWidth = _ref.maxWidth;
return (0, _styledComponents.css)(["flex:0 1 ", ";max-width:", ";"], maxWidth === "none" ? "100%" : maxWidth, maxWidth);
});
var StyledTruncateContent = _styledComponents.default.div.withConfig({
displayName: "Truncate__StyledTruncateContent",
componentId: "jwxsw1-1"
})(["&,", ",", "{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}"], _Text.StyledText, _Heading.StyledHeading);
var Truncate = function Truncate(_ref2) {
var children = _ref2.children,
_ref2$maxWidth = _ref2.maxWidth,
maxWidth = _ref2$maxWidth === void 0 ? "100%" : _ref2$maxWidth,
dataTest = _ref2.dataTest;
return React.createElement(StyledTruncate, {
maxWidth: maxWidth,
"data-test": dataTest
}, React.createElement(StyledTruncateContent, null, children));
};
var _default = Truncate;
exports.default = _default;