mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 14:23:32 +00:00
[CL-442] Fix toggle group display in extension and add fullWidth input to main (#10803)
This commit is contained in:
@@ -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;
|
let nextId = 0;
|
||||||
|
|
||||||
@@ -11,11 +18,15 @@ export class ToggleGroupComponent<TValue = unknown> {
|
|||||||
private id = nextId++;
|
private id = nextId++;
|
||||||
name = `bit-toggle-group-${this.id}`;
|
name = `bit-toggle-group-${this.id}`;
|
||||||
|
|
||||||
|
@Input({ transform: booleanAttribute }) fullWidth?: boolean;
|
||||||
@Input() selected?: TValue;
|
@Input() selected?: TValue;
|
||||||
@Output() selectedChange = new EventEmitter<TValue>();
|
@Output() selectedChange = new EventEmitter<TValue>();
|
||||||
|
|
||||||
@HostBinding("attr.role") role = "radiogroup";
|
@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) {
|
onInputInteraction(value: TValue) {
|
||||||
this.selected = value;
|
this.selected = value;
|
||||||
|
|||||||
@@ -33,7 +33,10 @@ export class ToggleComponent<TValue> {
|
|||||||
|
|
||||||
get labelClasses() {
|
get labelClasses() {
|
||||||
return [
|
return [
|
||||||
|
"tw-w-full",
|
||||||
|
"tw-justify-center",
|
||||||
"!tw-font-semibold",
|
"!tw-font-semibold",
|
||||||
|
"tw-inline-block",
|
||||||
"tw-transition",
|
"tw-transition",
|
||||||
"tw-text-center",
|
"tw-text-center",
|
||||||
"tw-border-text-muted",
|
"tw-border-text-muted",
|
||||||
|
|||||||
Reference in New Issue
Block a user