Account for input styles

This commit is contained in:
snipe
2025-10-29 16:15:22 +00:00
parent 4bbf923eb6
commit 3426afe5a8
2 changed files with 40 additions and 19 deletions
+27 -16
View File
@@ -6,30 +6,40 @@
'info_tooltip_text' => null,
'help_text' => null,
'label' => null,
'input_div_class' => 'col-md-8',
'errors_class' => $errors->has('support_url') ? ' has-error' : '',
'input_icon' => null,
'input_group_addon' => null,
'rows' => null,
'placeholder' => null,
])
<div {{ $attributes->merge(['class' => 'form-group']) }}>
<div {{ $attributes->merge(['class' => 'form-group'. $errors_class]) }}>
<!-- form label -->
@if (isset($label))
<x-form-label
:for="$name"
:style="$label_style ?? null"
class="{{ $label_class ?? null }}"
>
{{ $label }}
</x-form-label>
<x-form-label :for="$name" class="{{ $label_class ?? 'col-md-3' }}">{{ $label }}</x-form-label>
@endif
@php
$blade_type = in_array($type, ['text', 'email', 'url', 'tel', 'number', 'password']) ? 'text' : $type;
@endphp
<div class="col-xs-12 col-sm-12 col-md-8 col-lg-6 col-xl-6">
<div class="{{ $input_div_class }}">
<x-dynamic-component
:$name
:$type
:aria-label="$name"
:component="'input.'.$blade_type"
:id="$name"
:required="Helper::checkIfRequired($item, $name)"
:value="old($name, $item->{$name})"
:input_icon="$input_icon"
:input_group_addon="$input_group_addon"
:rows="$rows"
:placeholder="$placeholder"
/>
</div>
@@ -44,22 +54,23 @@
@error($name)
<!-- Form Error -->
<div {{ $attributes->merge(['class' => $error_offset_class]) }}>
<span class="alert-msg" role="alert">
<i class="fas fa-times" aria-hidden="true"></i>
{{ $message }}
</span>
<div class="col-md-8 col-md-offset-3">
<span class="alert-msg" aria-hidden="true">
<x-icon type="x" />
{{ $message }}
</span>
</div>
@enderror
@if ($help_text)
<!-- Help Text -->
<div {{ $attributes->merge(['class' => $error_offset_class]) }}>
<div class="col-md-8 col-md-offset-3">
<p class="help-block">
{!! $help_text !!}
</p>
</div>
@endif
</div>
+13 -3
View File
@@ -1,12 +1,22 @@
@props([
'input_style' => null,
'input_group_addon' => null,
'input_icon' => null,
'required' => false,
'item' => null,
])
<!-- input-text blade component -->
<input
@if ($input_group_addon)
<div class="input-group">
@endif
<input
{{ $attributes->merge(['class' => 'form-control']) }}
@required($required)
/>
/>
@if ($input_group_addon)
<span class="input-group-addon">
<x-icon :type="$input_icon" />
</span>
</div>
@endif