{{-- The chrome of M3's text fields, around whichever control is in the slot. Not used at call sites: ``, ``, ``, ``, `` and the pickers wrap their control in it, so a form reads as one family. The states — the label resting or floating, the notch, focus, disabled, required — are selectors in resources/css/components/field.css, which explains the anatomy; the only state this file decides is `data-invalid`, because only the server knows that. `variant` is M3's two: `outlined` (a notched outline) and `filled` (a surface-container-highest box with an indicator line); without it, `config('livewire-material.fields.variant')`. A field with a label is a form field, M3's 56px. A field without one is a control in a toolbar or an editor row, and is given `size="sm"` (40px, a button's height) or `size="xs"` (32px). The error replaces the hint rather than stacking under it, as M3 has it. `class` from the call site lands on the outermost element, never the control, so a margin or a width is safe here. --}} @props([ 'id', 'label' => null, 'hint' => null, 'hintClass' => null, 'messages' => [], 'icon' => null, 'prefix' => null, 'suffix' => null, 'size' => 'md', 'variant' => null, 'floated' => false, 'mono' => false, ]) @php $variant = in_array($variant, ['outlined', 'filled'], true) ? $variant : (config('livewire-material.fields.variant') === 'filled' ? 'filled' : 'outlined'); @endphp
class(['field']) }} data-variant="{{ $variant }}" data-size="{{ in_array($size, ['sm', 'xs'], true) ? $size : 'md' }}" @if ($messages !== []) data-invalid @endif @if ($floated) data-floated @endif @if ($mono) data-mono @endif >
@if ($icon) @endif @if (filled($prefix)) {{ $prefix }} @endif {{ $slot }} @if (filled($suffix)) {{ $suffix }} @endif {{ $trailing ?? '' }} @if (filled($label)) @endif
@if ($messages !== []) @elseif (filled($hint))

{{ $hint }}

@endif