repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

quickshell/nuguland/SetupField.qml

Raw
import QtQuick

Rectangle {
    id: root

    required property Theme theme
    property alias field: input
    property string placeholder: ""
    property bool secret: false
    property string text: ""
    signal edited(string text)

    width: parent ? parent.width : 0
    height: 30
    radius: 10
    color: theme ? theme.withAlpha(theme.ui.minor, 0.14) : "transparent"

    TextInput {
        id: input

        anchors.fill: parent
        anchors.leftMargin: 10
        anchors.rightMargin: 10
        verticalAlignment: TextInput.AlignVCenter
        color: root.theme ? root.theme.content.normal : "white"
        selectionColor: root.theme ? root.theme.ui.focus : "#ffffff"
        selectedTextColor: root.theme ? root.theme.content.backdrop : "black"
        font.family: "IBM Plex Sans"
        font.pixelSize: 13
        echoMode: root.secret ? TextInput.Password : TextInput.Normal
        text: root.text
        clip: true
        onTextEdited: root.edited(text)
    }

    NuguText {
        anchors.left: parent.left
        anchors.leftMargin: 10
        anchors.verticalCenter: parent.verticalCenter
        visible: input.text.length === 0
        theme: root.theme
        variant: "meta"
        text: root.placeholder
    }
}