Skip to content

[Patch] Fixed error height in radio group #836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 25, 2022
Merged
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 @@ -115,9 +115,12 @@
<td>error: string</td>
<td></td>
<td>
If it is defined, the component will change its appearance, showing the
error below the radio group component. If it is not defined, the error
messages will be managed internally, but never displayed on its own.
If it is a defined value and also a truthy string, the component will
change its appearance, showing the error below the radio group. If the
defined value is an empty string, it will reserve a space below the
component for a future error, but it would not change its look. In case of
being undefined or null, both the appearance and the space for the error
message would not be modified.
</td>
</tr>
<tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,42 +26,98 @@ import { RadioItem } from "./interfaces/radio-item.interface";
export class DxcRadioGroupComponent implements OnInit {
@HostBinding("class") styles;

/**
* Value of the radio group. If undefined, the component will be uncontrolled
* and the value will be managed internally by the component.
*/
@Input()
label: string = "";

/**
* Helper text to be placed above the radio group.
*/
@Input()
helperText: string = "";

/**
* Name attribute of the input element. This attribute will allow users to
* find the component's value during the submit event.
*/
@Input()
name: string;

/**
* Value of the radio group. If undefined, the component will be uncontrolled
* and the value will be managed internally by the component.
*/
@Input()
value?: string;

/**
* If true, the component will be marked as readonly.
*/
@Input()
readOnly: boolean = false;

/**
* If true, the component will be disabled.
*/
@Input()
disabled: boolean = false;

/**
* If true, the radio group will be optional, showing (Optional) next to the
* label and adding a default last option with an empty string as value.
* Otherwise, the field will be considered required and an error will be
* passed as a parameter to the OnBlur functions if an option wasn't selected.
*/
@Input()
optional: boolean = false;

/**
* Label of the optional item.
*/
@Input()
optionalItemLabel?: string = "N/A";

/**
* Default value of the radio group, this property is used to have a default
* value and also have uncontrolled behaviour.
*/
@Input()
defaultValue: string;

/**
* An array of objects representing the selectable options. Each object
* RadioItem has the following properties:
* - label: string: Label of the option placed next to the radio input.
* - value: string: Value of the option. It should be unique and not
* an empty string, which is reserved to the optional item added by optional prop.
* - disabled: boolean: disables the option.
*/
@Input()
options: RadioItem[];

/**
* Sets the orientation of the options within the radio group.
*/
@Input()
stacking: "row" | "column" = "column";

/**
* Value of the tabindex attribute.
*/
@Input()
tabIndexValue: number = 0;

/**
* If it is a defined value and also a truthy string, the component will
* change its appearance, showing the error below the radio group. If the
* defined value is an empty string, it will reserve a space below the
* component for a future error, but it would not change its look. In case of
* being undefined or null, both the appearance and the space for the error
* message would not be modified.
*/
@Input()
error: string;

Expand Down Expand Up @@ -290,7 +346,7 @@ export class DxcRadioGroupComponent implements OnInit {
font-weight: var(--radioGroup-errorMessageFontWeight);
line-height: var(--radioGroup-errorMessageLineHeight);
font-family: var(--radioGroup-labelFontFamily);
height: var(--radioGroup-errorMessageLineHeight);
min-height: var(--radioGroup-errorMessageLineHeight);
}
.valueInput {
display: none;
Expand Down