import { jsx as _jsx } from "react/jsx-runtime";
import { forwardRef } from 'react';
import styled, { css } from 'styled-components';
import { mix } from 'polished';
import * as micIcon from '../Icon/icons/send-solid.icon';
import * as micSolidIcon from '../Icon/icons/square-solid.icon';
import { useI18n, useTestIds } from '../../hooks';
import Button from '../Button';
import Icon, { registerIcon } from '../Icon';
import { tryCatch, withTestIds } from '../../utils';
import { defaultThemeProp } from '../../theme';
import { getSpeechToTextButtonTestIds } from './SpeechToTextButton.test-ids';
registerIcon(micIcon, micSolidIcon);
const StyledSpeechToTextButton = styled(Button)(({ theme }) => {
    const activeColor = tryCatch(() => mix(0.85, theme.base.palette['primary-background'], theme.base.palette.interactive));
    return css `
    &[aria-pressed='true'] {
      background-color: ${activeColor};
    }
  `;
});
StyledSpeechToTextButton.defaultProps = defaultThemeProp;
const SpeechToTextButton = forwardRef(function SpeechToTextButton({ active, testId, ...restProps }, ref) {
    const t = useI18n();
    const testIds = useTestIds(testId, getSpeechToTextButtonTestIds);
    return (_jsx(StyledSpeechToTextButton, { ref: ref, "data-testid": testIds.root, ...restProps, label: active ? t('stop_dictation') : t('dictate'), "aria-pressed": active, variant: 'simple', icon: true, children: _jsx(Icon, { name: active ? 'mic-solid' : 'mic' }) }));
});
export default withTestIds(SpeechToTextButton, getSpeechToTextButtonTestIds);
//# sourceMappingURL=SpeechToTextButton.js.map