{"version":3,"file":"Button.mjs","sources":["../../../../../../../../web/src/adminPortal/components/Button.tsx"],"sourcesContent":["import { styled } from '@mui/material';\nimport React, { FC } from 'react';\n\nimport { ButtonCore, ButtonCoreProps, Variant } from '../shared/components/Button';\n\nconst mixed = (color: string) => `color-mix(in srgb, ${color} 80%, #333)`;\n\nconst StyledButton = styled(ButtonCore)<{\n  variant?: Variant;\n  warning?: boolean;\n}>(\n  ({ theme }) => ({\n    '&:disabled': {\n      backgroundColor: theme.styleConfig.buttons.disabled.backgroundColor,\n      borderColor: theme.styleConfig.buttons.disabled.borderColor,\n      color: theme.styleConfig.buttons.disabled.textColor,\n    },\n    fontSize: 12,\n    minHeight: 32,\n    borderRadius: theme.styleConfig.borderRadius,\n    fontWeight: 700,\n    borderWidth: 1,\n    borderStyle: 'solid',\n  }),\n  ({ theme, variant, warning }) => {\n    if (warning) {\n      switch (variant) {\n        case 'ghost':\n          return {\n            '&:hover': {\n              backgroundColor: mixed(theme.styleConfig.buttons.secondary.backgroundColor),\n              borderColor: theme.styleConfig.colors.error,\n              color: theme.styleConfig.colors.error,\n            },\n            backgroundColor: theme.styleConfig.buttons.secondary.backgroundColor,\n            borderColor: theme.styleConfig.colors.error,\n            color: theme.styleConfig.colors.error,\n          };\n        case 'primary':\n          return {\n            '&:hover': {\n              backgroundColor: mixed(theme.styleConfig.colors.error),\n              color: theme.styleConfig.buttons.primary.textColor,\n            },\n            backgroundColor: theme.styleConfig.colors.error,\n            color: theme.styleConfig.buttons.primary.textColor,\n          };\n        case 'text':\n          return {\n            '&:hover': {\n              backgroundColor: 'rgba(0, 0, 0, 0.1)',\n              color: theme.styleConfig.colors.error,\n            },\n            backgroundColor: 'transparent',\n            color: theme.styleConfig.colors.error,\n            borderWidth: 0,\n          };\n        default:\n          return {\n            '&:hover': {\n              backgroundColor: mixed(theme.styleConfig.colors.error),\n              color: theme.styleConfig.buttons.primary.textColor,\n            },\n            backgroundColor: theme.styleConfig.colors.error,\n            color: theme.styleConfig.colors.error,\n          };\n      }\n    }\n    switch (variant) {\n      case 'ghost':\n        return {\n          '&:hover': {\n            backgroundColor: mixed(theme.styleConfig.buttons.secondary.backgroundColor),\n          },\n          backgroundColor: theme.styleConfig.buttons.secondary.backgroundColor,\n          color: theme.styleConfig.buttons.secondary.textColor,\n          borderRadius: theme.styleConfig.buttons.secondary.borderRadius,\n          borderColor: theme.styleConfig.buttons.secondary.borderColor,\n        };\n      case 'primary':\n        return {\n          '&:hover': {\n            backgroundColor: mixed(theme.styleConfig.buttons.primary.backgroundColor),\n          },\n          backgroundColor: theme.styleConfig.buttons.primary.backgroundColor,\n          color: theme.styleConfig.buttons.primary.textColor,\n          borderRadius: theme.styleConfig.buttons.primary.borderRadius,\n          borderColor: theme.styleConfig.buttons.primary.borderColor,\n        };\n      case 'text':\n        return {\n          '&:hover': {\n            backgroundColor: 'rgba(0, 0, 0, 0.1)',\n          },\n          backgroundColor: 'transparent',\n          color: theme.styleConfig.colors.primary,\n          borderWidth: 0,\n        };\n      default:\n        return {\n          '&:hover': {\n            backgroundColor: mixed(theme.styleConfig.buttons.primary.backgroundColor),\n          },\n          backgroundColor: theme.styleConfig.buttons.primary.backgroundColor,\n          color: theme.styleConfig.buttons.primary.textColor,\n          borderRadius: theme.styleConfig.buttons.primary.borderRadius,\n          borderColor: theme.styleConfig.buttons.primary.borderColor,\n        };\n    }\n  },\n);\n\nexport type ButtonProps = ButtonCoreProps & {\n  component?: 'span' | 'button' | 'div' | 'label';\n};\n\nexport const Button: FC<ButtonProps & React.ButtonHTMLAttributes<HTMLButtonElement>> = ({ ...props }): JSX.Element => {\n  return <StyledButton compact {...props} />;\n};\n"],"names":["mixed","color","StyledButton","styled","ButtonCore","theme","backgroundColor","styleConfig","buttons","disabled","borderColor","textColor","fontSize","minHeight","borderRadius","fontWeight","borderWidth","borderStyle","variant","warning","secondary","colors","error","primary","Button","props","React","compact"],"mappings":";;;;AAKA,MAAMA,KAAAA,GAAQ,CAACC,KAAAA,GAAkB,CAA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