Skip to content

Commit

Permalink
chore: validation error
Browse files Browse the repository at this point in the history
reduced background transparency horizontal menu and full rounded for notifications indicator
  • Loading branch information
DissNik committed Feb 5, 2025
1 parent 6a036f0 commit 26efa71
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/UI/resources/css/components/forms.css
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ input[type='number'] {

/* Form Error */
.form-error {
@apply text-3xs text-red-600 dark:text-red-500;
@apply !mt-0 text-3xs text-red-600 dark:text-red-500;
}

/* Form Switcher */
Expand Down
8 changes: 4 additions & 4 deletions src/UI/resources/js/Components/FormBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,13 +360,13 @@ function inputsErrors(data, form) {
if (inputs.length) {
inputs.forEach(input => input.classList.add('form-invalid'))

const errorWrapper = inputs[0].closest('.moonshine-field').querySelector('.error-wrapper')
console.log(errorWrapper)
if (errorWrapper) {
const fieldArea = inputs[0].closest('[data-inside="field"]') ?? null

if (fieldArea) {
const errorDiv = document.createElement('div')
errorDiv.classList.add('form-error')
errorDiv.textContent = data.errors[key]
errorWrapper.appendChild(errorDiv)
fieldArea.after(errorDiv)
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/UI/resources/views/components/form/wrapper.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
'after',
])
<div {{ $attributes->merge(['class' => 'form-group moonshine-field'])->except('required') }}
x-id="['input-wrapper', 'field-{{ $formName }}']" :id="$id('input-wrapper')"
x-id="['input-wrapper', 'field-{{ $formName }}']"
:id="$id('input-wrapper')"
data-inside="field"
>
{{ $beforeLabel && !$insideLabel ? $slot : '' }}

Expand All @@ -23,7 +25,7 @@
</x-moonshine::form.label>
@endif

<div class="error-wrapper">
<div data-inside="field">
{{ $before ?? '' }}

{{ !$beforeLabel && !$insideLabel ? $slot : '' }}
Expand Down

0 comments on commit 26efa71

Please sign in to comment.