UNPKG

@kubit-ui-web/react-components

Version:

Kubit React Components is a customizable, accessible library of React web components, designed to enhance your application's user experience

247 lines (240 loc) 8.75 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || (function () { var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; return function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.IconTitleStyled = exports.IconButtonStyled = exports.IconComplexStyled = exports.IconStyled = exports.IconSVGStyled = void 0; const styled_components_1 = __importStar(require("styled-components")); const srOnly_mixin_1 = require("../../styles/mixins/srOnly.mixin"); const commonIconSVGStyled = (styles) => styles && (0, styled_components_1.css) ` background-color: ${styles.color}; width: ${styles.width}; height: ${styles.height}; min-width: ${styles.width}; min-height: ${styles.height}; `; exports.IconSVGStyled = styled_components_1.default.svg ` ${({ $customIconStyles, theme: { MEDIA_QUERIES: { onlyDesktop, onlyTablet, onlyMobile }, }, }) => $customIconStyles && (0, styled_components_1.css) ` ${commonIconSVGStyled($customIconStyles)} ${onlyDesktop} { ${commonIconSVGStyled($customIconStyles.DESKTOP)} } ${onlyTablet} { ${commonIconSVGStyled($customIconStyles.TABLET)} } ${onlyMobile} { ${commonIconSVGStyled($customIconStyles.MOBILE)} } `} display: inline-block; -webkit-mask-image: ${({ $srcImage }) => `url("${$srcImage}")`}; -webkit-mask-repeat: no-repeat; -webkit-mask-position: center; -webkit-mask-size: contain; mask-image: ${({ $srcImage }) => `url("${$srcImage}")`}; mask-repeat: no-repeat; mask-position: center; mask-size: contain; justify-content: center; transform: rotate(${props => props.$moveRound}); transition-property: transform; transition-duration: ${props => props.$transitionDuration}; background-size: contain; background-position: center; background-repeat: no-repeat; ${({ twistAnimationTransformValue }) => { if (twistAnimationTransformValue) { return (0, styled_components_1.css) ` position: absolute; top: 0; left: 0; backface-visibility: hidden; transform: ${twistAnimationTransformValue}; `; } return null; }} ${({ theme: { MEDIA_QUERIES: { onlyDesktop, onlyTablet, onlyMobile }, }, $width, $height, $color, }) => (0, styled_components_1.css) ` ${commonIconSVGStyled({ color: $color, height: $height, width: $width })} ${onlyDesktop} { ${commonIconSVGStyled({ color: $color, height: $height, width: $width })} } ${onlyTablet} { ${commonIconSVGStyled({ color: $color, height: $height, width: $width })} } ${onlyMobile} { ${commonIconSVGStyled({ color: $color, height: $height, width: $width })} } `} `; const commonIconStyled = (styles) => styles && (0, styled_components_1.css) ` width: ${styles.width}; height: ${styles.height}; min-width: ${styles.width}; min-height: ${styles.height}; `; exports.IconStyled = styled_components_1.default.img ` ${({ $customIconStyles, theme: { MEDIA_QUERIES } }) => $customIconStyles && (0, styled_components_1.css) ` ${commonIconStyled($customIconStyles)} ${MEDIA_QUERIES?.onlyDesktop} { ${commonIconStyled($customIconStyles.DESKTOP)} } ${MEDIA_QUERIES?.onlyTablet} { ${commonIconStyled($customIconStyles.TABLET)} } ${MEDIA_QUERIES?.onlyMobile} { ${commonIconStyled($customIconStyles.MOBILE)} } `} transform: rotate(${props => props.$moveRound}); transition-duration: ${props => props.$transitionDuration}; ${({ theme: { MEDIA_QUERIES: { onlyDesktop, onlyTablet, onlyMobile }, }, $width, $height, }) => (0, styled_components_1.css) ` ${commonIconStyled({ width: $width, height: $height })} ${onlyDesktop} { ${commonIconStyled({ width: $width, height: $height })} } ${onlyTablet} { ${commonIconStyled({ width: $width, height: $height })} } ${onlyMobile} { ${commonIconStyled({ width: $width, height: $height })} } `} `; const commonIconComplexStyled = (styles) => styles && (0, styled_components_1.css) ` width: ${styles.width}; height: ${styles.height}; min-width: ${styles.width}; min-height: ${styles.height}; path { fill: ${styles.color}; } `; exports.IconComplexStyled = styled_components_1.default.span ` display: inline-flex; transform: rotate(${props => props.$moveRound}); transition-duration: ${props => props.$transitionDuration}; align-items: center; ${({ twistAnimationTransformValue }) => { if (twistAnimationTransformValue) { return (0, styled_components_1.css) ` position: absolute; top: 0; left: 0; backface-visibility: hidden; transform: ${twistAnimationTransformValue}; `; } return null; }} svg { ${({ $customIconStyles, theme: { MEDIA_QUERIES: { onlyDesktop, onlyTablet, onlyMobile }, }, }) => $customIconStyles && (0, styled_components_1.css) ` ${commonIconComplexStyled($customIconStyles)}; ${onlyDesktop} { ${commonIconComplexStyled($customIconStyles.DESKTOP)}; } ${onlyTablet} { ${commonIconComplexStyled($customIconStyles.TABLET)}; } ${onlyMobile} { ${commonIconComplexStyled($customIconStyles.MOBILE)}; } `} ${({ theme: { MEDIA_QUERIES: { onlyDesktop, onlyTablet, onlyMobile }, }, $width, $height, $color, }) => (0, styled_components_1.css) ` ${commonIconComplexStyled({ color: $color, width: $width, height: $height })}; ${onlyDesktop} { ${commonIconComplexStyled({ color: $color, width: $width, height: $height })}; } ${onlyTablet} { ${commonIconComplexStyled({ color: $color, width: $width, height: $height })}; } ${onlyMobile} { ${commonIconComplexStyled({ color: $color, width: $width, height: $height })}; } `} } `; const commonIconButtonStyled = (styles) => styles && (0, styled_components_1.css) ` max-width: ${styles.width}; max-height: ${styles.height}; `; exports.IconButtonStyled = styled_components_1.default.button ` ${({ $customIconStyles, theme: { MEDIA_QUERIES: { onlyDesktop, onlyTablet, onlyMobile }, }, }) => $customIconStyles && (0, styled_components_1.css) ` ${commonIconButtonStyled($customIconStyles)} ${onlyDesktop} { ${commonIconButtonStyled($customIconStyles.DESKTOP)} } ${onlyTablet} { ${commonIconButtonStyled($customIconStyles.TABLET)} } ${onlyMobile} { ${commonIconButtonStyled($customIconStyles.MOBILE)} } `} cursor: pointer; display: inline-flex; align-items: center; justify-content: center; :disabled { cursor: default; } :focus { border-radius: 0.25rem; } min-width: 1.5rem; //accesibility min-height: 1.5rem; //accesibility ${({ theme: { MEDIA_QUERIES: { onlyDesktop, onlyTablet, onlyMobile }, }, $width, $height, }) => (0, styled_components_1.css) ` ${commonIconButtonStyled({ height: $height, width: $width })} ${onlyDesktop} { ${commonIconButtonStyled({ height: $height, width: $width })} } ${onlyTablet} { ${commonIconButtonStyled({ height: $height, width: $width })} } ${onlyMobile} { ${commonIconButtonStyled({ height: $height, width: $width })} } `} `; exports.IconTitleStyled = styled_components_1.default.span ` ${srOnly_mixin_1.srOnlyMixin} `; //# sourceMappingURL=icon.styled.js.map