import { jsx as _jsx } from "react/jsx-runtime";
import { forwardRef } from 'react';
import styled, { css } from 'styled-components';
import { hideVisually, rgba } from 'polished';
import { defaultThemeProp } from '../../theme';
import { tryCatch } from '../../utils';
import { calculateFontSize, readableColor } from '../../styles';
export const StyledLabel = styled.label(({ theme, labelHidden }) => {
    const color = tryCatch(() => {
        return rgba(readableColor(theme.base.palette['primary-background']), theme.base.transparency['transparent-3']);
    });
    const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);
    return labelHidden
        ? hideVisually
        : css `
          max-width: max-content;
          font-size: ${fontSize[theme.components.label['font-size']]};
          font-weight: ${theme.base['font-weight']['semi-bold']};
          color: ${color};
        `;
});
StyledLabel.defaultProps = defaultThemeProp;
const Label = forwardRef(function Label({ children, labelHidden = false, htmlFor, ...restProps }, ref) {
    return (_jsx(StyledLabel, { ref: ref, labelHidden: labelHidden, htmlFor: htmlFor === '' ? undefined : htmlFor, ...restProps, children: children }));
});
export default Label;
//# sourceMappingURL=Label.js.map