2024-08-16 21:35:12 +02:00
|
|
|
import { VLabeledComponent } from "LabeledComponent.slint";
|
|
|
|
import { Palette } from "Palette.slint";
|
2024-10-09 17:07:17 +02:00
|
|
|
import { VText } from "Text.slint";
|
2024-08-16 21:35:12 +02:00
|
|
|
|
|
|
|
export component VTextInput inherits VLabeledComponent {
|
|
|
|
in-out property text <=> textInputComponent.text;
|
2024-10-09 17:07:17 +02:00
|
|
|
out property has-focus <=> textInputComponent.has-focus;
|
|
|
|
in-out property placeholder <=> textInputComponent.accessible-placeholder-text;
|
2024-08-16 21:35:12 +02:00
|
|
|
in-out property wrap <=> textInputComponent.wrap;
|
|
|
|
callback accepted();
|
|
|
|
|
2024-10-09 17:07:17 +02:00
|
|
|
VerticalLayout {
|
|
|
|
padding: 4px;
|
|
|
|
padding-left: 8px;
|
|
|
|
padding-right: 8px;
|
|
|
|
textInputComponent := TextInput {
|
|
|
|
color: Palette.foreground;
|
|
|
|
accepted => { root.accepted() }
|
|
|
|
HorizontalLayout {
|
|
|
|
alignment: start;
|
|
|
|
VText {
|
|
|
|
visible: textInputComponent.text == "";
|
|
|
|
color: Palette.foreground-hint;
|
|
|
|
text: root.placeholder;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2024-08-16 21:35:12 +02:00
|
|
|
}
|
2024-10-09 17:07:17 +02:00
|
|
|
|
2024-08-16 21:35:12 +02:00
|
|
|
}
|