import QtQuick import "../services" as S import NovaStats as NS Item { id: root required property string buffer required property string state implicitHeight: 48 implicitWidth: 280 // Background pill Rectangle { anchors.fill: parent color: { if (root.state === "fail" || root.state === "error") return Qt.rgba(NS.ThemeService.base08.r, NS.ThemeService.base08.g, NS.ThemeService.base08.b, 0.15); if (root.state === "busy") return Qt.rgba(NS.ThemeService.base0D.r, NS.ThemeService.base0D.g, NS.ThemeService.base0D.b, 0.1); return NS.ThemeService.base02; } radius: height / 2 border.color: { if (root.state === "fail" || root.state === "error") return NS.ThemeService.base08; if (root.state === "busy") return NS.ThemeService.base0D; return NS.ThemeService.base03; } border.width: 1 Behavior on color { ColorAnimation { duration: 200 } } Behavior on border.color { ColorAnimation { duration: 200 } } } // Placeholder text Text { anchors.centerIn: parent text: { if (root.state === "busy") return "Authenticating..."; if (root.state === "max") return "Too many attempts"; return "Enter password"; } color: NS.ThemeService.base04 font.pixelSize: NS.ThemeService.fontSize font.family: NS.ThemeService.fontFamily opacity: root.buffer.length === 0 ? 1 : 0 Behavior on opacity { NumberAnimation { duration: 150 } } } // Password dots Row { anchors.centerIn: parent spacing: 6 width: Math.min(implicitWidth, root.width - root.height) clip: implicitWidth > root.width - root.height Repeater { model: root.buffer.length delegate: Rectangle { required property int index width: 10 height: 10 radius: 5 color: NS.ThemeService.base05 scale: 0 opacity: 0 Component.onCompleted: { scale = 1; opacity = 1; } Behavior on scale { NumberAnimation { duration: 120 easing.type: Easing.OutBack } } Behavior on opacity { NumberAnimation { duration: 100 } } } } } }