diff --git a/libs/components/src/radio-button/radio-button.component.ts b/libs/components/src/radio-button/radio-button.component.ts index 967718f4079..dc294103d42 100644 --- a/libs/components/src/radio-button/radio-button.component.ts +++ b/libs/components/src/radio-button/radio-button.component.ts @@ -11,7 +11,7 @@ let nextId = 0; export class RadioButtonComponent { @HostBinding("attr.id") @Input() id = `bit-radio-button-${nextId++}`; @HostBinding("class") get classList() { - return [this.block ? "tw-block" : "tw-inline-block", "tw-mb-2"]; + return [this.block ? "tw-block" : "tw-inline-block", "tw-mb-1"]; } @Input() value: unknown; diff --git a/libs/components/src/radio-button/radio-button.stories.ts b/libs/components/src/radio-button/radio-button.stories.ts index 534bc4bfa1d..dcef13a19be 100644 --- a/libs/components/src/radio-button/radio-button.stories.ts +++ b/libs/components/src/radio-button/radio-button.stories.ts @@ -164,3 +164,32 @@ export const BlockHint: Story = { `, }), }; + +export const Disabled: Story = { + render: () => ({ + props: { + formObj: new FormGroup({ + radio: new FormControl(0), + }), + }, + template: /* HTML */ ` +
+ `, + }), +}; diff --git a/libs/components/src/radio-button/radio-input.component.ts b/libs/components/src/radio-button/radio-input.component.ts index df549a751b1..573f240a263 100644 --- a/libs/components/src/radio-button/radio-input.component.ts +++ b/libs/components/src/radio-button/radio-input.component.ts @@ -25,8 +25,8 @@ export class RadioInputComponent implements BitFormControlAbstraction { "tw-border", "tw-border-solid", "tw-border-secondary-600", - "tw-w-3.5", - "tw-h-3.5", + "tw-w-5", + "tw-h-5", "tw-mr-1.5", "tw-bottom-[-1px]", // Fix checkbox looking off-center "tw-flex-none", // Flexbox fix for bit-form-control @@ -34,6 +34,11 @@ export class RadioInputComponent implements BitFormControlAbstraction { "hover:tw-border-2", "[&>label:hover]:tw-border-2", + // if it exists, the parent form control handles focus + "[&:not(bit-form-control_*)]:focus-visible:tw-ring-2", + "[&:not(bit-form-control_*)]:focus-visible:tw-ring-offset-2", + "[&:not(bit-form-control_*)]:focus-visible:tw-ring-primary-500", + "before:tw-content-['']", "before:tw-transition", "before:tw-block", @@ -41,18 +46,15 @@ export class RadioInputComponent implements BitFormControlAbstraction { "before:tw-rounded-full", "before:tw-inset-[2px]", - "focus-visible:tw-ring-2", - "focus-visible:tw-ring-offset-2", - "focus-visible:tw-ring-primary-700", - "disabled:tw-cursor-auto", - "disabled:tw-border", "disabled:tw-bg-secondary-100", + "disabled:hover:tw-border", "checked:tw-bg-text-contrast", "checked:tw-border-primary-600", + "checked:tw-border-2", - "checked:hover:tw-border", + "checked:hover:tw-border-2", "checked:hover:tw-border-primary-700", "checked:hover:before:tw-bg-primary-700", "[&>label:hover]:checked:tw-bg-primary-700", @@ -60,10 +62,13 @@ export class RadioInputComponent implements BitFormControlAbstraction { "checked:before:tw-bg-primary-600", - "checked:disabled:tw-border-secondary-100", - "checked:disabled:tw-bg-secondary-100", + "checked:disabled:tw-border-secondary-600", + "checked:disabled:hover:tw-border-secondary-600", + "checked:disabled:hover:tw-border-2", + "checked:disabled:tw-bg-background", - "checked:disabled:before:tw-bg-text-muted", + "checked:disabled:hover:before:tw-bg-secondary-600", + "checked:disabled:before:tw-bg-secondary-600", ]; constructor(@Optional() @Self() private ngControl?: NgControl) {}