vibe.handlers.amount¶
Handler for Amount/Currency Data Type.
Implements the DataTypeHandler interface for a composite amount type, which includes both a numeric value and a currency unit.
AmountHandler ¶
Handler for a composite amount including a value and a currency.
__init__ ¶
__init__(definition: dict[str, Any]) -> None
Initialize with currency list, position, and min/max constraints.
render_widget ¶
render_widget(name: str, current_value: AmountValue, error_message: str | None = None) -> str
Render amount input (value + optional currency selector).
get_additional_widget_context ¶
get_additional_widget_context(name: str, current_value: AmountValue, error_message: str | None = None) -> dict[str, Any]
Provide amount-specific context for the template.
process_form_data ¶
process_form_data(name: str, form_data: MultiDictLike) -> dict[str, Any]
Parse form fields into a {value, currency} mapping if present.
validate_input ¶
validate_input(value: AmountValue, check_required: bool = True) -> str | None
Validate number coercion and currency presence/range constraints.
get_probe_placeholder ¶
get_probe_placeholder() -> dict[str, Any]
Return placeholder for preview/probing respecting defaults if configured.
get_preview_placeholder_value ¶
get_preview_placeholder_value() -> dict[str, Any]
Return a preview placeholder; mirrors probe placeholder shape.
supports_structured_access ¶
supports_structured_access() -> bool
Allow dot-notation access to value and currency subfields.
get_structured_access_fields ¶
get_structured_access_fields() -> set[str]
Return 'value' and 'currency' as accessible subfields.