import QtQuick
import QtQuick.Templates as T

T.TextField
{
    id: control

    background: Rectangle
    {
        id: background
        color: Colors.mantle
        radius: Dimensions.radius
        border.width: !control.focus ? 1 : 2
        border.color: Colors.interactive
        height: control.implicitHeight
    }

    color: Colors.foreground
    implicitHeight: Typography.body.pixelSize + topPadding + bottomPadding
    placeholderTextColor: Colors.interactive
    font: Typography.body
    padding: Dimensions.m

    verticalAlignment: Text.AlignVCenter




    /**
     * Placeholder
     */
    Text {
        x: control.leftPadding
        y: control.topPadding
        width: control.width - (control.leftPadding + control.rightPadding)
        height: control.height - (control.topPadding + control.bottomPadding)

        font: control.font
        text: control.placeholderText
        color: control.placeholderTextColor
        verticalAlignment: control.verticalAlignment
        visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
        elide: Text.ElideRight
        renderType: control.renderType
    }
}

