Yassine Doghri 9da1d0a1b6 feat(plugins): add aside with plugin metadata next to plugin's readme
- enhance plugin card ui
- refactor components to be more consistent
- invert toggler label for better UX
- edit view components regex
2024-05-28 10:14:10 +00:00

37 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Views\Components\Forms;
class Select extends FormComponent
{
protected array $props = ['options', 'selected'];
protected array $casts = [
'options' => 'array',
];
/**
* @var array<string, string>
*/
protected array $options = [];
protected string $selected = '';
public function render(): string
{
$this->mergeClass('w-full focus:border-contrast border-3 rounded-lg bg-elevated border-contrast');
$defaultAttributes = [
'data-select-text' => lang('Common.forms.multiSelect.selectText'),
'data-loading-text' => lang('Common.forms.multiSelect.loadingText'),
'data-no-results-text' => lang('Common.forms.multiSelect.noResultsText'),
'data-no-choices-text' => lang('Common.forms.multiSelect.noChoicesText'),
'data-max-item-text' => lang('Common.forms.multiSelect.maxItemText'),
];
$extra = [...$defaultAttributes, ...$this->attributes];
return form_dropdown($this->name, $this->options, old($this->name, $this->selected !== '' ? [$this->selected] : []), $extra);
}
}