@props([ // name of the input field for use in passing form submission data // this is prefixed with bw- when used as a class name 'name' => 'bw-filepicker', // the default text to display in the file picker 'placeholder' => 'Select a file', // by default all file audo, video, image and pdf file types can be selected // either restrict or allow more file types by modifying this value 'accepted_file_types' => config('bladewind.filepicker.accepted_file_types', 'audio/*,video/*,image/*, .pdf'), 'acceptedFileTypes' => config('bladewind.filepicker.accepted_file_types', 'audio/*,video/*,image/*, .pdf'), // should the user be forced to select a file. used in conjunction with validation scripts // default is false. 'required' => false, // maximum allowed filezie in MB 'max_file_size' => config('bladewind.filepicker.max_file_size', 5), 'maxFileSize' => config('bladewind.filepicker.max_file_size', 5), // adds margin after the input box 'add_clearing' => config('bladewind.filepicker.max_file_size', true), 'addClearing' => config('bladewind.filepicker.max_file_size', true), // display a selected value by default 'selected_value' => '', 'selectedValue' => '', // the css to apply to the selected value 'selected_value_class' => config('bladewind.filepicker.selected_value_class', 'h-52'), 'selectedValueClass' => config('bladewind.filepicker.selected_value_class', 'h-52'), // file to display in edit mode 'url' => '', // allow base64 output 'base64' => true, ]) @php $name = preg_replace('/[\s-]/', '_', $name); $required = parseBladewindVariable($required); $add_clearing = parseBladewindVariable($add_clearing); $addClearing = parseBladewindVariable($addClearing); $base64 = parseBladewindVariable($base64); if (!$addClearing) $add_clearing = $addClearing; if ($acceptedFileTypes !== $accepted_file_types) $accepted_file_types = $acceptedFileTypes; if ($selectedValue !== $selected_value) $selected_value = $selectedValue; if ($selectedValueClass !== $selected_value_class) $selected_value_class = $selectedValueClass; if ($maxFileSize !== $max_file_size) $max_file_size = $maxFileSize; if (! is_numeric($max_file_size)) $max_file_size = 5; $image_file_types = [ "png", "jpg", "jpeg", "gif", "svg" ]; @endphp