{{-- A file picker, in the text field's chrome (resources/views/components/field.blade.php).
M3 has no file field, and building one would redo what the browser's input already does — the
picker, a file dropped on it, the keyboard, what a screen reader announces, the `change` a
Livewire upload listens for. So the input stays native, its label always floats (the button
stands where a resting label would), and only its `::file-selector-button` is restyled: a tonal
pill, so it reads as the thing to press (resources/css/components/file.css, on the field's
chrome; the field's root carries `data-md-file`).
The browser's own line beside the button ("No file chosen", "3 files") is drawn transparent:
it cannot be truncated or wrapped, and the caller shows what was chosen anyway, as previews. A
screen reader still hears it. The errors are the model's and, for a `multiple` input, each
file's (`photos.*`): a file refused for its size belongs under this field as much as the
batch's own count does. `label`, `hint`, `variant`; `full` takes the 40rem bound off a field its container already bounds. Every other attribute reaches the ``. --}}
@props([
'label' => null,
'hint' => null,
'variant' => null,
'full' => false,
])
@php
$model = $attributes->whereStartsWith('wire:model')->first();
$id = $attributes->get('id') ?? 'field-'.substr(md5('file|'.$model.'|'.$label), 0, 12);
$field = \NoNameWeb\LivewireMaterial\Support\Field::class;
$errorKey = $field::key($model, $attributes->get('name'));
$messages = $field::messages($errors ?? null, $errorKey, wildcard: true);
@endphp
except(['class', 'style', 'id', 'type']) }}
type="file"
id="{{ $id }}"
@if ($messages !== []) aria-invalid="true" @endif
@if ($messages !== [] || filled($hint)) aria-describedby="{{ $id }}-support" @endif
data-md-field-control
/>