chore(ui): consolidates field label, error, and description components

This commit is contained in:
Jacob Fletcher
2024-03-21 11:23:51 -04:00
parent 85ffc5d8bf
commit 64d6163f13
30 changed files with 124 additions and 87 deletions

View File

@@ -198,14 +198,14 @@ export const ArrayField: React.FC<ArrayFieldProps> = (props) => {
>
{showError && (
<div className={`${baseClass}__error-wrap`}>
{CustomError !== undefined ? CustomError : <FieldError {...(errorProps || {})} />}
<FieldError CustomError={CustomError} {...(errorProps || {})} />
</div>
)}
<header className={`${baseClass}__header`}>
<div className={`${baseClass}__header-wrap`}>
<div className={`${baseClass}__header-content`}>
<h3 className={`${baseClass}__title`}>
{CustomLabel !== undefined ? CustomLabel : <FieldLabel {...(labelProps || {})} />}
<FieldLabel CustomLabel={CustomLabel} {...(labelProps || {})} />
</h3>
{fieldHasErrors && fieldErrorCount > 0 && (
<ErrorPill count={fieldErrorCount} i18n={i18n} withMessage />
@@ -234,11 +234,7 @@ export const ArrayField: React.FC<ArrayFieldProps> = (props) => {
</ul>
)}
</div>
{CustomDescription !== undefined ? (
CustomDescription
) : (
<FieldDescription {...(descriptionProps || {})} />
)}
<FieldDescription CustomDescription={CustomDescription} {...(descriptionProps || {})} />
</header>
<NullifyLocaleField fieldValue={value} localized={localized} path={path} />
{(rows.length > 0 || (!valid && (showRequired || showMinRows))) && (