{"version":3,"file":"commonStyles.mjs","sources":["../../../../src/components/Forms/commonStyles.ts"],"sourcesContent":["import { css, cx } from '@emotion/css';\n\nimport { GrafanaTheme2 } from '@grafana/data';\n\nimport { getFocusStyles } from '../../themes/mixins';\nimport { ComponentSize } from '../../types/size';\n\nexport const getFocusStyle = (theme: GrafanaTheme2) =>\n  css({\n    '&:focus': getFocusStyles(theme),\n  });\n\nexport const sharedInputStyle = (theme: GrafanaTheme2, invalid = false) => {\n  const borderColor = invalid ? theme.colors.error.border : theme.components.input.borderColor;\n  const borderColorHover = invalid ? theme.colors.error.shade : theme.components.input.borderHover;\n  const background = theme.components.input.background;\n  const textColor = theme.components.input.text;\n\n  // Cannot use our normal borders for this color for some reason due the alpha values in them.\n  // Need to colors without alpha channel\n  const autoFillBorder = theme.isDark ? '#2e2f35' : '#bab4ca';\n\n  return cx(\n    inputPadding(theme),\n    css({\n      background,\n      lineHeight: theme.typography.body.lineHeight,\n      fontSize: theme.typography.size.md,\n      color: textColor,\n      border: `1px solid ${borderColor}`,\n\n      '&:-webkit-autofill, &:-webkit-autofill:hover': {\n        /* Welcome to 2005. This is a HACK to get rid od Chromes default autofill styling */\n        boxShadow: `inset 0 0 0 1px rgba(255, 255, 255, 0), inset 0 0 0 100px ${background}!important`,\n        WebkitTextFillColor: `${textColor} !important`,\n        borderColor: autoFillBorder,\n      },\n\n      '&:-webkit-autofill:focus': {\n        /* Welcome to 2005. This is a HACK to get rid od Chromes default autofill styling */\n        boxShadow: `0 0 0 2px ${theme.colors.background.primary}, 0 0 0px 4px ${theme.colors.primary.main}, inset 0 0 0 1px rgba(255, 255, 255, 0), inset 0 0 0 100px ${background}!important`,\n        WebkitTextFillColor: `${textColor} !important`,\n      },\n\n      '&:hover': {\n        borderColor: borderColorHover,\n      },\n\n      '&:focus': {\n        outline: 'none',\n      },\n\n      '&:disabled': {\n        backgroundColor: theme.colors.action.disabledBackground,\n        color: theme.colors.action.disabledText,\n        border: `1px solid ${theme.colors.action.disabledBackground}`,\n\n        '&:hover': {\n          borderColor,\n        },\n      },\n\n      '&::placeholder': {\n        color: theme.colors.text.disabled,\n        opacity: 1,\n      },\n    })\n  );\n};\n\nexport const inputPadding = (theme: GrafanaTheme2) => {\n  return css({\n    padding: theme.spacing(0, 1, 0, 1),\n  });\n};\n\nexport const inputSizes = () => {\n  return {\n    sm: css({\n      width: inputSizesPixels('sm'),\n    }),\n    md: css({\n      width: inputSizesPixels('md'),\n    }),\n    lg: css({\n      width: inputSizesPixels('lg'),\n    }),\n    auto: css({\n      width: inputSizesPixels('auto'),\n    }),\n  };\n};\n\nexport const inputSizesPixels = (size: string) => {\n  switch (size) {\n    case 'sm':\n      return '200px';\n    case 'md':\n      return '320px';\n    case 'lg':\n      return '580px';\n    case 'auto':\n    default:\n      return 'auto';\n  }\n};\n\nexport function getPropertiesForButtonSize(size: ComponentSize, theme: GrafanaTheme2) {\n  switch (size) {\n    case 'sm':\n      return {\n        padding: 1,\n        fontSize: theme.typography.size.sm,\n        height: theme.components.height.sm,\n      };\n\n    case 'lg':\n      return {\n        padding: 3,\n        fontSize: theme.typography.size.lg,\n        height: theme.components.height.lg,\n      };\n    case 'md':\n    default:\n      return {\n        padding: 2,\n        fontSize: theme.typography.size.md,\n        height: theme.components.height.md,\n      };\n  }\n}\n"],"names":[],"mappings":";;;AAOa,MAAA,aAAA,GAAgB,CAAC,KAAA,KAC5B,GAAI,CAAA;AAAA,EACF,SAAA,EAAW,eAAe,KAAK;AACjC,CAAC;AAEI,MAAM,gBAAmB,GAAA,CAAC,KAAsB,EAAA,OAAA,GAAU,KAAU,KAAA;AACzE,EAAM,MAAA,WAAA,GAAc,UAAU,KAAM,CAAA,MAAA,CAAO,MAAM,MAAS,GAAA,KAAA,CAAM,WAAW,KAAM,CAAA,WAAA;AACjF,EAAM,MAAA,gBAAA,GAAmB,UAAU,KAAM,CAAA,MAAA,CAAO,MAAM,KAAQ,GAAA,KAAA,CAAM,WAAW,KAAM,CAAA,WAAA;AACrF,EAA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