Skip to content

Commit

Permalink
fix(ui-library): fixing radio group caption group
Browse files Browse the repository at this point in the history
  • Loading branch information
davidken91 committed Nov 22, 2023
1 parent 5bf5319 commit d0bfe92
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { formDark, formLight } from '../../../../foundation/semantic-tokens/form
import { radioDark, radioLight } from '../../../../foundation/component-tokens/radio.css';
import { InputSizesType, RadioOption } from '../../../../globals/types';
import { BlrFormLabelInline } from '../../../internal-components/form-label/form-label-inline';
import { BlrFormCaptionGroupRenderFunction } from '../../../internal-components/form-caption-group';
import { SizelessIconType } from '@boiler/icons';
import { ThemeType } from '../../../../foundation/_tokens-generated/index.themes';
import { genericBlrComponentRenderer } from '../../../../utils/typesafe-generic-component-renderer';
import { BlrFormCaptionGroupRenderFunction } from '../../../internal-components/form-caption-group';
import { BlrFormCaptionRenderFunction } from '../../../internal-components/form-caption-group/form-caption';

const TAG_NAME = 'blr-radio-group';
Expand All @@ -32,8 +32,9 @@ export class BlrRadioGroup extends LitElement {
@property() hideLabel!: boolean;
@property() options!: RadioOption[];
@property() layout!: string;
@property() showGroupHintMessage = true;
@property() showHint = true;
@property() groupHintIcon: SizelessIconType = 'blrInfo';
@property() errorMessage?: string;
@property() showGroupErrorMessage = true;
@property() groupErrorMessage?: string;
@property() groupHintMessage?: string;
Expand Down Expand Up @@ -71,7 +72,7 @@ export class BlrRadioGroup extends LitElement {
};

const captionContent = html`
${this.showGroupHintMessage
${this.showHint
? BlrFormCaptionRenderFunction({
variant: 'hint',
theme: this.theme,
Expand Down Expand Up @@ -130,17 +131,14 @@ export class BlrRadioGroup extends LitElement {
})}
</div>
${this.showGroupErrorMessage || this.hasError
${this.showHint || this.hasError
? html` <div class="caption-group ${classes}">
${this.showGroupErrorMessage || this.hasError
? BlrFormCaptionGroupRenderFunction({ size: this.size }, captionContent)
: nothing}
${BlrFormCaptionGroupRenderFunction({ size: this.size }, captionContent)}
</div>`
: nothing} `;
}
}
}

export type BlrRadioGroupType = Omit<BlrRadioGroup, keyof LitElement>;

export const BlrRadioGroupRenderFunction = (params: BlrRadioGroupType) =>
Expand Down

0 comments on commit d0bfe92

Please sign in to comment.