[CL-442] Fix toggle group display in extension and add fullWidth input to main (#10803)

This commit is contained in:
Victoria League 2024-08-30 09:25:16 -04:00 committed by GitHub
parent 7f537efa46
commit f44b7b361d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 2 deletions

View File

@ -1,4 +1,11 @@
import { Component, EventEmitter, HostBinding, Input, Output } from "@angular/core";
import {
booleanAttribute,
Component,
EventEmitter,
HostBinding,
Input,
Output,
} from "@angular/core";
let nextId = 0;
@ -11,11 +18,15 @@ export class ToggleGroupComponent<TValue = unknown> {
private id = nextId++;
name = `bit-toggle-group-${this.id}`;
@Input({ transform: booleanAttribute }) fullWidth?: boolean;
@Input() selected?: TValue;
@Output() selectedChange = new EventEmitter<TValue>();
@HostBinding("attr.role") role = "radiogroup";
@HostBinding("class") classList = ["tw-flex"];
@HostBinding("class")
get classList() {
return ["tw-flex"].concat(this.fullWidth ? ["tw-w-full", "[&>*]:tw-grow"] : []);
}
onInputInteraction(value: TValue) {
this.selected = value;

View File

@ -33,7 +33,10 @@ export class ToggleComponent<TValue> {
get labelClasses() {
return [
"tw-w-full",
"tw-justify-center",
"!tw-font-semibold",
"tw-inline-block",
"tw-transition",
"tw-text-center",
"tw-border-text-muted",