carbon-react
Version:
A library of reusable React components for easily building user interfaces.
2 lines (1 loc) • 2.25 kB
JavaScript
;Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("styled-system"),i=require("../../__internal__/utils/logger/index.js"),o=require("../../style/themes/apply-base-theme.js"),s=require("../../style/utils/add-focus-styling.js"),r=require("../../style/utils/color.js"),n=require("../../__internal__/dom/globals.js"),l=require("../../__internal__/utils/helpers/browser-type-check/index.js"),a=require("./icon-config.js"),c=require("./icon-unicodes.js");function u(e){return e&&e.__esModule?e:{default:e}}const d=u(e).default.span.attrs(o.default).withConfig({displayName:"icon.style__StyledIcon",componentId:"sc-74150e41-0"})(["",""],(({theme:o,color:u,bg:d,isInteractive:f,bgSize:g,bgShape:m,type:h,fontSize:b,disabled:p,hasTooltip:y})=>{let _="var(--colorsYin090)",S="transparent";const v=n.getWindow(),z=n.getNavigator(),j=function(e,t){const o={small:1,medium:2,large:3,"extra-large":4};return e&&t?o[t]<o[e]?(i.default.warn(`[WARNING - Icon] The "${t}" \`bgSize\` is smaller than "${e}" \`fontSize\`, the \`bgSize\` has been auto adjusted to a larger size.`),a.default.backgroundSize[e]):a.default.backgroundSize[t]:t?a.default.backgroundSize[t]:void 0}(b,g);if(p)_="var(--colorsYin030)";else if(u){const{color:e}=r.default({color:u,theme:o});_=e}if(d){const{backgroundColor:e}=r.default({bg:d,theme:o});S=e}return e.css(["position:relative;color:",";background-color:",";vertical-align:middle;align-items:center;display:inline-flex;justify-content:center;height:",";width:",";",";",' &::before{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:CarbonIcons;content:"','";font-style:normal;font-weight:normal;vertical-align:middle;'," "," "," display:block;}"," ",""],_,S,j,j,m?`border-radius: ${a.default.backgroundShape[m]}`:"",f&&e.css(["&:not(:focus):hover{filter:brightness(0.9);}"]),c.default[h],b&&e.css(["font-size:",";line-height:",";"],a.default.iconSize[b],a.default.iconSize[b]),v&&"services"===h&&l.default(v)&&e.css(["margin-top:",";"],"small"===b?"-7px":"-8px"),z&&v&&"services"===h&&l.isSafari(z)&&!l.default(v)&&e.css(["margin-top:-6px;"]),y&&`\n :focus {\n ${s.default()}\n }\n `,t.margin)}));exports.default=d;