// Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial import { MaterialPalette, MaterialFontSettings } from "styling.slint"; import { LineEditBase} from "../common/lineedit-base.slint"; // Single line text input field with Material Design Outline TextField look and feel. export component LineEdit { in property font-size <=> i-base.font-size; in property placeholder-text <=> i-base.placeholder-text; in property enabled <=> i-base.enabled; in property input-type <=> i-base.input-type; in property horizontal-alignment <=> i-base.horizontal-alignment; in property read-only <=> i-base.read-only; out property has-focus: i-base.has-focus; in-out property text <=> i-base.text; callback accepted <=> i-base.accepted; callback edited <=> i-base.edited; public function select-all() { i-base.select-all(); } public function clear-selection() { i-base.clear-selection(); } public function cut() { i-base.cut(); } public function copy() { i-base.copy(); } public function paste() { i-base.paste(); } min-width: max(120px, i-layout.min-width); min-height: max(56px, i-layout.min-height); forward-focus: i-base; states [ disabled when !root.enabled : { i-background.border-color: MaterialPalette.control-foreground; i-background.opacity: 0.38; i-base.opacity: 0.38; } focused when root.has-focus : { i-background.border-width: 2px; i-background.border-color: MaterialPalette.accent-background; i-base.text-color: MaterialPalette.accent-background; } ] i-background := Rectangle { width: 100%; height: 100%; border-radius: 4px; border-width: 1px; border-color: MaterialPalette.border; } i-layout := HorizontalLayout { padding-left: 16px; padding-right: 16px; i-base := LineEditBase { text-color: MaterialPalette.foreground; font-size: MaterialFontSettings.body-large.font-size; font-weight: MaterialFontSettings.body-large.font-weight; selection-foreground-color: MaterialPalette.selection-foreground; margin: i-layout.padding-left + i-layout.padding-right; placeholder-color: MaterialPalette.border-variant; selection-background-color: MaterialPalette.selection-background; } } }