Add id to form elements instead of uuid

This commit is contained in:
philipp lang 2025-03-28 00:49:26 +01:00
parent 6bcea543fb
commit 520c1d0a62
4 changed files with 9 additions and 13 deletions

View File

@ -10,16 +10,15 @@ class Editor extends Component
use HasFormDimensions;
public string $id;
public function __construct(
public string $name,
public string $size = 'default',
public ?string $hint = null,
public bool $required = false,
public string $label = '',
public string $id = ''
) {
$this->id = str()->uuid()->toString();
$this->id = $this->id ? $this->id : $this->name;
}
public function render()

View File

@ -10,8 +10,6 @@ class Lever extends Component
use HasFormDimensions;
public string $id;
public function __construct(
public string $name,
public string $size = 'default',
@ -20,8 +18,9 @@ class Lever extends Component
public bool $disabled = false,
public bool $required = false,
public string $label = '',
public string $id = ''
) {
$this->id = str()->uuid()->toString();
$this->id = $this->id ? $this->id : $this->name;
}
public function render()

View File

@ -10,8 +10,6 @@ class Select extends Component
use HasFormDimensions;
public string $id;
public function __construct(
public string $name,
public string $size = 'default',
@ -20,8 +18,9 @@ class Select extends Component
public string $label = '',
public $options = [],
public bool $disabled = false,
public string $id = ''
) {
$this->id = str()->uuid()->toString();
$this->id = $this->id ? $this->id : $this->name;
}
public function render()

View File

@ -10,17 +10,16 @@ class Text extends Component
use HasFormDimensions;
public string $id;
public function __construct(
public string $name,
public string $size = 'default',
public ?string $hint = null,
public bool $required = false,
public string $label = '',
public string $type = 'text'
public string $type = 'text',
public string $id = ''
) {
$this->id = str()->uuid()->toString();
$this->id = $this->id ? $this->id : $this->name;
}
public function render()