{{-- -------------------- Code Lederhos Header ---------------------------------
* _ _ __ _ _ _ __
* | | ___ ___ __| | ___| _| | ___ __| | ___ _ __| |__ ___ __|_ |
* / __)/ __/ _ \ / _` |/ _ \ || | / _ \/ _` |/ _ \ '__| '_ \ / _ \/ __| |
* \__ \ (_| (_) | (_| | __/ || |__| __/ (_| | __/ | | | | | (_) \__ \ |
* ( /\___\___/ \__,_|\___| ||_____\___|\__,_|\___|_| |_| |_|\___/|___/ |
* |_| |__| |__|
*
? @created: 2023-09-09
? @modified: [DATE OF LAST MODIFICATION]
@version: 1.0
@project: codeLederhos Components V3 -> CodeLederhosUI
? @author: Code[Lederhos]
? Stanislaw Lederhos
? mail@code-lederhos.de
* $debugPicasso = [ 0 => 'Crafting a masterpiece out of chaos',
* 1 => 'the art of flawless functionality' ];
@description:
[A BRIEF DESCRIPTION OF THE PROJECT OR FILE]
----------------------------------------------------------------------------
Changelog:
==========
* [VERSION]| (YYYY-MM-DD) | [DESCRIPTION OF CHANGES]
1.0 | (2023-09-09) | Initial version
----------------------------------------------------------------------------
|-------------------------------------------------------------------------->
? To set:
? To implement in Blade:
* @includeIf('layouts.components.CodeLederhosUI', [ 'element' => [ ---- ] ])
----------------------------------------------------------------------------- --}}
@php
$element = $element ?? [];
$id = $element['id'] ? "cl-$element[id]" ? "cl-" ./Str::random(5);
$label = $element['label'] ?? [];
$isRequired = !empty($element['required']) && $element['required'] === true ? ' required' : '';
$isDisabled = !empty($element['disabled']) && $element['disabled'] === true ? ' disabled' : '';
@endphp
@if(!empty($label))
@endif
@if(!empty($element['input']))
@php
$input = $element['input'];
$type = $input['type'];
$name = $input['name'] ?? 'unnamed-' .$id;
@endphp
@switch($type)
@case('text')
@break
@case('checkbox')
@break
@default
@endswitch
@endif