@props(['label', 'name', 'type' => 'text', 'span' => '4', 'placeholder' => '', 'required' => false])
@php
    $placeholder = $placeholder ?: match (true) {
        str_contains($name, 'rut') => '12.345.678-9',
        $name === 'work_phone' => '+56 55 123 4567',
        str_contains($name, 'phone') => '+56 9 1234 5678',
        default => '',
    };
@endphp
<div class="col-md-{{ $span }}"><label class="form-label" for="{{ $name }}">{{ $label }} @if($required)<span class="required">*</span>@endif</label><input id="{{ $name }}" type="{{ $type }}" class="form-control" :class="errors.{{ $name }} && 'is-invalid'" x-model="form.{{ $name }}" placeholder="{{ $placeholder }}" @input="fieldChanged('{{ $name }}')" @if(str_contains($name, 'rut')) maxlength="12" inputmode="text" @endif><div class="field-error" x-text="errors.{{ $name }}"></div></div>
