UNPKG

@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.

79 lines (63 loc) 3.07 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default; var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = exports.StyledTileWrapper = void 0; var React = _interopRequireWildcard(require("react")); var _styledComponents = _interopRequireWildcard(require("styled-components")); var _transition = _interopRequireDefault(require("../../../utils/transition")); var _TileHeader = require("../TileHeader"); var _defaultTheme = _interopRequireDefault(require("../../../defaultTheme")); const StyledTileWrapper = _styledComponents.default.div.withConfig({ displayName: "TileWrapper__StyledTileWrapper", componentId: "sc-u2u00m-0" })(["", ""], ({ theme }) => (0, _styledComponents.css)(["display:block;width:100%;box-sizing:border-box;font-family:", ";color:", ";text-decoration:none;background:", ";border-radius:", ";box-shadow:", ";transition:", ";:hover,:focus{outline:none;box-shadow:", ";", "{color:", ";}}"], theme.orbit.fontFamily, theme.orbit.paletteInkNormal, theme.orbit.paletteWhite, theme.orbit.borderRadiusLarge, theme.orbit.boxShadowAction, (0, _transition.default)(["box-shadow"], "fast", "ease-in-out"), theme.orbit.boxShadowActionActive, _TileHeader.StyledIconRight, theme.orbit.paletteInkLightHover)); // $FlowFixMe: https://github.com/flow-typed/flow-typed/issues/3653#issuecomment-568539198 exports.StyledTileWrapper = StyledTileWrapper; StyledTileWrapper.defaultProps = { theme: _defaultTheme.default }; const StyledTileAnchor = _styledComponents.default.a.withConfig({ displayName: "TileWrapper__StyledTileAnchor", componentId: "sc-u2u00m-1" })(["", ""], ({ theme }) => (0, _styledComponents.css)(["display:block;height:100%;width:100%;outline:none;text-decoration:none;color:", ";&:focus{outline:none;box-shadow:", ";", "{color:", ";}}&:link,&:visited{color:", ";font-weight:", ";}"], theme.orbit.paletteInkNormal, theme.orbit.boxShadowActionActive, _TileHeader.StyledIconRight, theme.orbit.paletteInkLightHover, theme.orbit.paletteInkNormal, theme.orbit.fontWeightLinks)); // $FlowFixMe: https://github.com/flow-typed/flow-typed/issues/3653#issuecomment-568539198 StyledTileAnchor.defaultProps = { theme: _defaultTheme.default }; const TileWrapper = ({ href, external, dataTest, onClick, onKeyDown, children, as, tabIndex, role, ariaExpanded, ariaControls, id, htmlTitle }) => /*#__PURE__*/React.createElement(StyledTileWrapper, { "data-test": dataTest, onClick: onClick, onKeyDown: onKeyDown, as: as, tabIndex: tabIndex, role: role, "aria-expanded": ariaExpanded, "aria-controls": ariaControls, id: id }, href ? /*#__PURE__*/React.createElement(StyledTileAnchor, { target: href && external ? "_blank" : undefined, rel: href && external ? "noopener" : undefined, href: href || undefined, title: htmlTitle }, children) : children); var _default = TileWrapper; exports.default = _default;