@theredhead — Frontend Library - v1.0.0
    Preparing search index...

    Adapter for credit card numbers.

    Strips whitespace, dashes, and spaces. Validates that the input contains 13–19 digits and passes the Luhn checksum. The value produced contains only digits.

    Shows a credit-card prefix icon.

    readonly adapter = new CreditCardTextAdapter();
    // "4111 1111 1111 1111" → value "4111111111111111"

    Implements

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    prefixIcon: "<rect width=\"20\" height=\"14\" x=\"2\" y=\"5\" rx=\"2\" /><line x1=\"2\" x2=\"22\" y1=\"10\" y2=\"10\" />" = UIIcons.Lucide.Account.CreditCard

    Optional SVG icon content to display before the input.

    Should be a Lucide SVG inner-content string (e.g. UIIcons.Lucide.Text.AtSign).

    Methods

    • Transform the raw text into the adapted value.

      Called on every input event. The result is stored in the value model and written back to the native input element, so the user sees the adapted text. The original keystrokes are preserved in the text model.

      Parameters

      • text: string

        Raw text from the input element.

      Returns string

      Adapted value string (displayed in the field and emitted via value).

    • Validate the raw text and return a result indicating whether the current input is valid.

      When present, UIInput exposes a valid signal and applies the invalid host class when validation fails.

      Parameters

      • text: string

        Raw text from the input element.

      Returns TextAdapterValidationResult

      Validation result with valid flag and error messages.