import QtQuick Rectangle { id: root required property Theme theme property alias text: input.text property alias echoMode: input.echoMode property alias inputMethodHints: input.inputMethodHints property string placeholderText: "" property string icon: "" property string fontFamily: "IBM Plex Sans" property int fontPixelSize: 14 property alias input: input signal accepted signal cancelled signal edited(string text) implicitWidth: 220 implicitHeight: 38 radius: 10 color: theme.withAlpha(theme.content.backdrop, input.activeFocus ? 0.9 : 0.68) border.width: input.activeFocus ? 2 : 1 border.color: input.activeFocus ? theme.content.focus : theme.withAlpha(theme.ui.minor, 0.55) Text { visible: root.icon.length > 0 anchors.left: parent.left anchors.leftMargin: 12 anchors.verticalCenter: parent.verticalCenter color: root.theme.ui.minor font.family: "Symbols Nerd Font Mono" font.pixelSize: 13 text: root.icon } NuguText { anchors.left: parent.left anchors.right: parent.right anchors.leftMargin: root.icon.length > 0 ? 34 : 12 anchors.rightMargin: 12 anchors.verticalCenter: parent.verticalCenter visible: input.text.length === 0 && !input.activeFocus theme: root.theme variant: "meta" text: root.placeholderText } TextInput { id: input anchors.fill: parent anchors.leftMargin: root.icon.length > 0 ? 34 : 12 anchors.rightMargin: 12 verticalAlignment: TextInput.AlignVCenter color: root.theme.content.normal selectionColor: root.theme.ui.accent selectedTextColor: root.theme.content.backdrop font.family: root.fontFamily font.pixelSize: root.fontPixelSize activeFocusOnTab: true clip: true Accessible.role: Accessible.EditableText Accessible.name: root.placeholderText onAccepted: root.accepted() onTextEdited: root.edited(text) Keys.onEscapePressed: event => { event.accepted = true; root.cancelled(); } } }