- Added `Choices` component for dropdowns with search and multi-selection functionality. - Implemented foundational classes for service connection: - `ConnectServiceData` - `ConnectedServiceFactory` - `ConnectedServicesService` - Added `ConnectServiceForm` Livewire component for managing service connections. - Introduced shared utility traits (`HasAttributeHelpers`) and error components. - Added components for generic use: `Input` and `ListItem`.
63 lines
1.7 KiB
PHP
63 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\View\Components;
|
|
|
|
use App\Concerns\UI\HasAttributeHelpers;
|
|
use Closure;
|
|
use Illuminate\Contracts\View\View;
|
|
use Illuminate\View\Component;
|
|
|
|
final class Input extends Component
|
|
{
|
|
use HasAttributeHelpers;
|
|
|
|
public string $uuid;
|
|
|
|
/**
|
|
* Create a new component instance.
|
|
*/
|
|
public function __construct(
|
|
public ?string $name = null,
|
|
public ?string $label = null,
|
|
public ?string $id = null,
|
|
) {
|
|
$this->uuid = 'component'.md5(serialize($this)).$id;
|
|
}
|
|
|
|
/**
|
|
* Get the view / contents that represent the component.
|
|
*/
|
|
public function render(): View|Closure|string
|
|
{
|
|
return <<<'BLADE'
|
|
<div>
|
|
<fieldset class="flex flex-col">
|
|
@if($label)
|
|
<legend class="text-sm font-medium text-gray-900 mb-2 ml-1">
|
|
{{$label}}
|
|
@if($hasAttribute('required'))
|
|
<span class="text-red-400">*</span>
|
|
@endif
|
|
</legend>
|
|
@endif
|
|
<input
|
|
id="{{$uuid}}"
|
|
"
|
|
placeholder="{{$attributes->get('placeholder') ?? ''}}"
|
|
@if($isAutofocus()) autofocus @endif
|
|
{{
|
|
$attributes->merge([
|
|
'type' => 'text',
|
|
'class' => 'rounded-xl border border-gray-300 px-4 py-2'
|
|
])
|
|
}}
|
|
/>
|
|
<x-shared.error :errorFieldName="$errorFieldName()" />
|
|
</fieldset>
|
|
</div>
|
|
BLADE;
|
|
}
|
|
}
|