PhiaUi.Components.SpecialEntry (phia_ui v0.1.17)

Copy Markdown View Source

Special entry input components for PhiaUI.

Provides compound input widgets for structured data entry:

Summary

Functions

A four-panel credit card entry form: number (4×4 formatted), expiry (MM/YY), CVV, and optional cardholder name. The PhiaCreditCard JS hook formats input and auto-advances between fields.

Renders HH:MM:SS segmented time-duration inputs. Each segment is a constrained number input. A hidden input carries the total seconds for form submission.

A labeled wrapper for credit_card_input/1 matching the form component style.

FormField-integrated wrapper for duration_input/1.

FormField-integrated wrapper for verifiable_input/1. Derives names/values from fields; computes matched from field values.

A multi-slot input that concatenates slot values into one hidden field value. The PhiaSplitInput hook handles auto-advance on fill, backspace, and paste.

A single slot within a split_input/1. The hook auto-advances on fill and backs up on backspace when empty.

Renders two inputs that must match. The second field shows a check (matched), error (mismatch), or nothing (untouched) based on the matched attr.

Functions

credit_card_input(assigns)

A four-panel credit card entry form: number (4×4 formatted), expiry (MM/YY), CVV, and optional cardholder name. The PhiaCreditCard JS hook formats input and auto-advances between fields.

Attributes

  • id (:string) (required) - Root element ID — required for PhiaCreditCard hook.
  • card_number_name (:string) - Form field name for the card number. Defaults to "card_number".
  • expiry_name (:string) - Form field name for the expiry (MM/YY). Defaults to "expiry".
  • cvv_name (:string) - Form field name for the CVV. Defaults to "cvv".
  • cardholder_name (:string) - Form field name for the cardholder. Defaults to "cardholder".
  • show_cardholder (:boolean) - Show the cardholder name field. Defaults to true.
  • class (:string) - Additional CSS classes on the root element. Defaults to nil.

duration_input(assigns)

Renders HH:MM:SS segmented time-duration inputs. Each segment is a constrained number input. A hidden input carries the total seconds for form submission.

Attributes

  • id (:string) - HTML id prefix for the inner inputs. Defaults to nil.
  • name (:string) - Form field name for the hidden total-seconds input. Defaults to "duration".
  • value (:any) - Duration as integer seconds (e.g. 3661) or "HH:MM:SS" string. Defaults to 0.
  • show_hours (:boolean) - Show the hours field. Defaults to true.
  • show_seconds (:boolean) - Show the seconds field. Defaults to true.
  • max_hours (:integer) - Maximum allowed hours value. Defaults to 99.
  • disabled (:boolean) - Disables all fields. Defaults to false.
  • class (:string) - Additional CSS classes. Defaults to nil.

form_credit_card_input(assigns)

A labeled wrapper for credit_card_input/1 matching the form component style.

Attributes

  • id (:string) (required) - Root element ID — required for PhiaCreditCard hook.
  • label (:string) - Section label shown above the card form. Defaults to nil.
  • description (:string) - Helper text. Defaults to nil.
  • card_number_name (:string) - Card number field name. Defaults to "card_number".
  • expiry_name (:string) - Expiry field name. Defaults to "expiry".
  • cvv_name (:string) - CVV field name. Defaults to "cvv".
  • cardholder_name (:string) - Cardholder name field name. Defaults to "cardholder".
  • show_cardholder (:boolean) - Show the cardholder name field. Defaults to true.
  • class (:string) - Additional CSS classes. Defaults to nil.

form_duration_input(assigns)

FormField-integrated wrapper for duration_input/1.

Attributes

  • field (Phoenix.HTML.FormField) (required) - A Phoenix.HTML.FormField struct.
  • label (:string) - Label text. Defaults to nil.
  • description (:string) - Helper text. Defaults to nil.
  • show_hours (:boolean) - Show the hours field. Defaults to true.
  • show_seconds (:boolean) - Show the seconds field. Defaults to true.
  • max_hours (:integer) - Maximum allowed hours. Defaults to 99.
  • class (:string) - Additional CSS classes. Defaults to nil.

form_verifiable_input(assigns)

FormField-integrated wrapper for verifiable_input/1. Derives names/values from fields; computes matched from field values.

Attributes

  • field (Phoenix.HTML.FormField) (required) - Primary form field.
  • confirm_field (Phoenix.HTML.FormField) (required) - Confirmation form field.
  • label (:string) - Label text shown above the inputs. Defaults to nil.
  • description (:string) - Helper text. Defaults to nil.
  • type (:atom) - Input type. Defaults to :password. Must be one of :text, :password, or :email.
  • placeholder (:string) - Primary placeholder. Defaults to nil.
  • confirm_placeholder (:string) - Confirmation placeholder. Defaults to nil.
  • class (:string) - Additional CSS classes. Defaults to nil.

split_input(assigns)

A multi-slot input that concatenates slot values into one hidden field value. The PhiaSplitInput hook handles auto-advance on fill, backspace, and paste.

Attributes

  • id (:string) (required) - Root element ID — required for PhiaSplitInput hook.
  • name (:string) - Hidden input name carrying the concatenated value. Defaults to nil.
  • separator (:string) - String inserted between slot values when joining. Defaults to "".
  • class (:string) - Additional CSS classes on the container. Defaults to nil.

Slots

split_input_field(assigns)

A single slot within a split_input/1. The hook auto-advances on fill and backs up on backspace when empty.

Attributes

  • placeholder (:string) - Placeholder character(s) for the slot. Defaults to nil.
  • maxlength (:integer) - Maximum number of characters in this slot. Defaults to 1.
  • width (:string) - Tailwind width class for this slot. Defaults to "w-10".
  • class (:string) - Additional CSS classes. Defaults to nil.

verifiable_input(assigns)

Renders two inputs that must match. The second field shows a check (matched), error (mismatch), or nothing (untouched) based on the matched attr.

Attributes

  • id (:string) - HTML id prefix for both input elements. Defaults to nil.
  • type (:atom) - Input type for both fields. Defaults to :password. Must be one of :text, :password, or :email.
  • name (:string) - Name for the primary input. Defaults to "value".
  • confirm_name (:string) - Name for the confirmation input. Defaults to "confirm_value".
  • value (:string) - Value for the primary input. Defaults to "".
  • confirm_value (:string) - Value for the confirmation input. Defaults to "".
  • matched (:boolean) - Server-computed match status. nil = untouched, true = match, false = mismatch. Defaults to nil.
  • placeholder (:string) - Placeholder for the primary input. Defaults to nil.
  • confirm_placeholder (:string) - Placeholder for the confirmation input. Defaults to nil.
  • size (:atom) - Input size. Defaults to :default. Must be one of :sm, :default, or :lg.
  • disabled (:boolean) - Disables both inputs. Defaults to false.
  • class (:string) - Additional CSS classes on the wrapper. Defaults to nil.