"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Text = void 0;
const react_1 = __importDefault(require("react"));
const inlines_1 = require("inlines");
const varsUtilities_1 = require("../../varsUtilities");
const hooks_1 = require("../../hooks");
const Text = ({ children, color = 'default', size = 14, style, light, underline, weight = 'normal', valueFormat, onClick, transform = 'none', align = 'left', truncate = false, selectable = 'text', }) => {
    const newLineHeight = size === 10
        ? '16px'
        : size === 12
            ? '20px'
            : size === 14
                ? '24px'
                : size === 16
                    ? '28px'
                    : size === 18
                        ? '32px'
                        : size === 24
                            ? '36px'
                            : size === 32
                                ? '44px'
                                : size === 40
                                    ? '56px'
                                    : size === 48
                                        ? '64px'
                                        : '16px';
    const parsedColor = color === 'inherit'
        ? 'inherit'
        : (0, varsUtilities_1.color)('content', color, light ? 'secondary' : 'primary');
    if (onClick) {
        selectable = 'none';
    }
    const parsedChildren = (0, hooks_1.useTextFormat)(children, valueFormat);
    return (react_1.default.createElement(inlines_1.styled.div, { onClick: onClick, style: {
            display: truncate ? '-webkit-box' : 'block',
            color: parsedColor,
            cursor: onClick ? 'pointer' : null,
            fontSize: size,
            fontFamily: 'Inter',
            fontWeight: weight === 'strong' ? 600 : weight === 'medium' ? 500 : 400,
            lineHeight: newLineHeight,
            textTransform: transform,
            textAlign: align,
            overflow: truncate ? 'hidden' : 'visible',
            userSelect: selectable,
            WebkitUserSelect: selectable,
            WebkitLineClamp: typeof truncate === 'number' ? truncate : truncate ? 1 : null,
            WebkitBoxOrient: 'vertical',
            '& b': {
                fontWeight: 600,
            },
            ...style,
        } },
        parsedChildren,
        underline ? (react_1.default.createElement(inlines_1.styled.div, { style: {
                width: '100%',
                marginBottom: 3,
                marginTop: -4,
                borderBottom: `${1}px solid ${parsedColor}`,
            } })) : null));
};
exports.Text = Text;
//# sourceMappingURL=index.js.map