Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/ui/src/fields/FieldDescription/index.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@layer payload-default {
.field-description {
display: flex;
color: var(--text-tertiary);
color: var(--text-secondary);
}

.field-description--margin-bottom {
Expand Down
14 changes: 7 additions & 7 deletions packages/ui/src/fields/Group/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
&::before {
content: '';
position: absolute;
top: calc(var(--spacer-5) / 2);
top: calc(var(--spacer-5) / -2);
left: calc(var(--gutter-h) * -1);
right: calc(var(--gutter-h) * -1);
height: 0;
Expand Down Expand Up @@ -87,15 +87,15 @@

.group-field__header {
margin-bottom: var(--spacer-2-5);
display: flex;
flex-direction: column;
gap: var(--spacer-1);
}

.group-field__title-row {
display: flex;
align-items: center;
gap: var(--spacer-2);

> header {
display: flex;
flex-direction: column;
gap: var(--spacer-1);
}
}

.group-field__title {
Expand Down
44 changes: 21 additions & 23 deletions packages/ui/src/fields/Group/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,29 +81,27 @@ export const GroupFieldComponent: GroupFieldClientComponent = (props) => {
<div className={`${baseClass}__wrap`}>
{Boolean(Label || Description || label || fieldHasErrors) && (
<div className={`${baseClass}__header`}>
{Boolean(Label || Description || label) && (
<header>
<RenderCustomComponent
CustomComponent={Label}
Fallback={
<h3 className={`${baseClass}__title`}>
<FieldLabel
as="span"
label={getTranslation(label, i18n)}
localized={false}
path={path}
required={false}
/>
</h3>
}
/>
<RenderCustomComponent
CustomComponent={Description}
Fallback={<FieldDescription description={description} path={path} />}
/>
</header>
)}
{fieldHasErrors && <ErrorPill count={errorCount} i18n={i18n} withMessage />}
<div className={`${baseClass}__title-row`}>
Comment thread
PatrikKozak marked this conversation as resolved.
<RenderCustomComponent
CustomComponent={Label}
Fallback={
<h3 className={`${baseClass}__title`}>
<FieldLabel
as="span"
label={getTranslation(label, i18n)}
localized={false}
path={path}
required={false}
/>
</h3>
}
/>
{fieldHasErrors && <ErrorPill count={errorCount} i18n={i18n} withMessage />}
</div>
<RenderCustomComponent
CustomComponent={Description}
Fallback={<FieldDescription description={description} path={path} />}
/>
</div>
)}
{BeforeInput}
Expand Down
25 changes: 25 additions & 0 deletions test/v4/collections/Group/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ const GroupFields: CollectionConfig = {
name: 'shippingInfo',
type: 'group',
label: 'Shipping Info',
admin: {
description: 'Enter the shipping address details',
},
fields: [
{
name: 'name',
Expand Down Expand Up @@ -37,6 +40,28 @@ const GroupFields: CollectionConfig = {
},
],
},
{
name: 'requiredInfo',
type: 'group',
label: 'Required Info',
admin: {
description: 'This group has required fields to test error state',
},
fields: [
{
name: 'requiredField',
type: 'text',
label: 'Required Field',
required: true,
},
{
name: 'anotherRequired',
type: 'text',
label: 'Another Required',
required: true,
},
],
},
],
}

Expand Down
Loading