Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ export class FormFieldDemoService {
description: this._widgetDocs.getDescription(
FORM_FIELD_SLOTS_DOCS_PATH,
'errorMessage',
'Projected <ids-error-message> element, shown in the subscript area when the field is in an error state.',
'Error message shown between the field and its hints when the field is in an error state.',
),
},
{
Expand All @@ -276,7 +276,7 @@ export class FormFieldDemoService {
description: this._widgetDocs.getDescription(
FORM_FIELD_SLOTS_DOCS_PATH,
'successMessage',
'Projected <ids-success-message> element, shown in the subscript area when the field is in a success state.',
'Success message shown between the field and its hints. Error messages take precedence.',
),
},
{
Expand All @@ -285,7 +285,7 @@ export class FormFieldDemoService {
description: this._widgetDocs.getDescription(
FORM_FIELD_SLOTS_DOCS_PATH,
'hintMessage',
'Projected <ids-hint-message> element, shown in the subscript area by default.',
'Hint shown below the field, remaining visible below error or success messages.',
),
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,18 @@
</div>

<div class="ids-form-field__subscript-wrapper">
@let messages = _displayedMessages();
@if (messages) {
@let stateMessage = _displayedStateMessage();
@if (stateMessage || _hasHintMessages()) {
<div class="ids-form-field__message-container">
@switch (messages) {
@switch (stateMessage) {
@case ("error") {
<ng-content select="ids-error-message" />
}
@case ("success") {
<ng-content select="ids-success-message" />
}
@case ("hint") {
<ng-content select="ids-hint-message" />
}
}
<ng-content select="ids-hint-message" />
</div>
}
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@
},
"errorMessage": {
"description": {
"en": "Projected <ids-error-message> element, shown in the subscript area when the field is in an error state.",
"hu": "Beillesztett <ids-error-message> elem, amely hibaállapot esetén jelenik meg a mező alatti területen."
"en": "Error message shown between the field and its hints when the field is in an error state.",
"hu": "Hibaállapotban a mező és a súgóüzenetek között megjelenő hibaüzenet."
}
},
"successMessage": {
"description": {
"en": "Projected <ids-success-message> element, shown in the subscript area when the field is in a success state.",
"hu": "Beillesztett <ids-success-message> elem, amely sikeres állapot esetén jelenik meg a mező alatti területen."
"en": "Success message shown between the field and its hints. Error messages take precedence.",
"hu": "Sikeres állapotban a mező és a súgóüzenetek között megjelenő üzenet. A hibaüzenet elsőbbséget élvez."
}
},
"hintMessage": {
"description": {
"en": "Projected <ids-hint-message> element, shown in the subscript area by default.",
"hu": "Beillesztett <ids-hint-message> elem, amely alapértelmezetten a mező alatti területen jelenik meg."
"en": "Hint shown below the field, remaining visible below error or success messages.",
"hu": "A mező alatt megjelenő súgóüzenet, amely hiba vagy sikeres állapotban is látható marad az állapotüzenet alatt."
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,15 @@ export class IdsFormFieldComponent extends ComponentBaseWithDefaults<IdsFormFiel
]),
);

protected _displayedMessages = computed<'error' | 'success' | 'hint' | undefined>(() => {
protected _hasHintMessages = computed(() => this._hintMessages().length > 0);

protected _displayedStateMessage = computed<'error' | 'success' | undefined>(() => {
if (this._errorMessages().length > 0 && this._hasErrorState()) {
return 'error';
}
if (this._successMessages().length > 0 && this._hasSuccessState()) {
return 'success';
}
if (this._hintMessages().length > 0) {
return 'hint';
}
return undefined;
});

Expand Down
Loading