nexusLIMS.tui.common.widgets#
Reusable widgets for NexusLIMS TUI applications.
Provides form inputs, validation feedback, and other common UI components.
Module Contents#
Classes#
Input widget that accepts numpad key entry. |
|
Input widget with validation support. |
|
Input widget with autocomplete suggestions. |
|
Container for a labeled form field with validation error display. |
API#
- class nexusLIMS.tui.common.widgets.NumpadInput(value: str | None = None, placeholder: str = '', highlighter: rich.highlighter.Highlighter | None = None, password: bool = False, *, restrict: str | None = None, type: textual.widgets._input.InputType = 'text', max_length: int = 0, suggester: textual.suggester.Suggester | None = None, validators: textual.validation.Validator | Iterable[textual.validation.Validator] | None = None, validate_on: Iterable[textual.widgets._input.InputValidationOn] | None = None, valid_empty: bool = False, select_on_focus: bool = True, name: str | None = None, id: str | None = None, classes: str | None = None, disabled: bool = False, tooltip: rich.console.RenderableType | None = None, compact: bool = False)[source]#
Bases:
textual.widgets.InputInput widget that accepts numpad key entry.
Extends Textual’s Input to map numpad keys to their regular equivalents, fixing the issue where numpad minus and other numpad keys don’t work.
- class nexusLIMS.tui.common.widgets.ValidatedInput(*args, validator: Callable | None = None, **kwargs)[source]#
Bases:
textual.widgets.InputInput widget with validation support.
Displays validation errors below the input field and provides custom messages for invalid states.
- Variables:
validator (Callable | None) – Validation function that takes the input value and returns (is_valid, error_message) tuple
- class nexusLIMS.tui.common.widgets.AutocompleteInput(suggestions: list[str] | None = None, *args, **kwargs)[source]#
Bases:
textual.widgets.InputInput widget with autocomplete suggestions.
Uses Textual’s built-in Suggester for dropdown suggestions.
- class nexusLIMS.tui.common.widgets.FormField(label_text: str, input_widget: textual.widgets.Input, *, required: bool = False, help_text: str | None = None, **kwargs)[source]#
Bases:
textual.containers.VerticalContainer for a labeled form field with validation error display.
Provides consistent layout for label + input + error message.
- Variables:
- class Changed(field: FormField, value: str)[source]#
Bases:
textual.message.MessageMessage emitted when field value changes.