import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { omitThemingProps, styled, useStyleConfig, vui } from '../core';
import Icon from '../icon';
import T from '../t';
import Tooltip from '../tooltip';
import { cs } from '../utils';
export const LabelBase = styled.labelBox `
  display: block;
  color: darkBlue.main;
  font-weight: 600;
  width: 100%;

  &[aria-disabled='true'] {
    color: sandstone.75;
    cursor: not-allowed;
  }
`;
/** Displays a paragraph of text. */
export const Label = vui((props, ref) => {
    const { children, className, markAsOptional, tooltipText, text, fontSize, ...rest } = omitThemingProps(props);
    const styles = useStyleConfig('Label', props);
    const isOnlyText = text && !markAsOptional && !tooltipText && !children;
    return (_jsx(T, { as: LabelBase, className: cs('vui-label', className), fontSize: fontSize, ref: ref, ...rest, children: children ??
            (isOnlyText ? (text) : (_jsxs(_Fragment, { children: [_jsx(T, { fontSize: fontSize, children: text }), !!markAsOptional && (_jsx(T, { fontSize: fontSize, ...styles.helper, children: "(optional)" })), !!tooltipText && (_jsx(T, { fontSize: fontSize, ...styles.helper, children: _jsx(Tooltip, { text: tooltipText, children: _jsx(Icon, { mb: fontSize === 'xs' ? '-6px' : '-5px', name: "falInfoCircle", role: "button", size: "sm" }) }) }))] }))) }));
});
Label.displayName = 'Label';
export default Label;
//# sourceMappingURL=label.js.map