Skip to content
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

Allow input properties with enum type to be provided as string #2099

Merged
merged 7 commits into from
Apr 4, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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 @@ -21,7 +21,7 @@ export class AvatarComponent {
@Input() shadow: boolean;
@Input() text: string;
@Input() overlay: boolean;
@Input() size: AvatarSize = AvatarSize.SM;
@Input() size: AvatarSize | `${AvatarSize}` = AvatarSize.SM;
@Input()
themeColor: NotificationColor | BrandColor | 'medium' | 'white' | 'dark' | 'light' | 'semi-light';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class ButtonComponent implements AfterContentInit {
@Input() expand: 'full' | 'block';
@Input() isFloating: boolean = false;
@Input()
size: ButtonSize = ButtonSize.MD;
size: ButtonSize | 'sm' | 'md' | 'lg' = ButtonSize.MD;
MadsBuchmann marked this conversation as resolved.
Show resolved Hide resolved

@ContentChild(IconComponent) icon: IconComponent;
@ContentChild(IconComponent, { read: ElementRef })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ export class DropdownComponent
static readonly OPEN_DELAY_IN_MS = 100;
private state = OpenState.closed;
private hasConfiguredSlottedItems = false;
private horizontalDirection = HorizontalDirection.right;
private verticalDirection = VerticalDirection.down;
private horizontalDirection: HorizontalDirection | `${HorizontalDirection}` =
HorizontalDirection.right;
private verticalDirection: VerticalDirection | `${VerticalDirection}` = VerticalDirection.down;

private _items: string[] | any[] = [];
get items(): string[] | any[] {
Expand Down Expand Up @@ -80,7 +81,7 @@ export class DropdownComponent
@Input()
placeholder = 'Please select:';

@Input() set popout(direction: HorizontalDirection) {
@Input() set popout(direction: HorizontalDirection | `${HorizontalDirection}`) {
this.horizontalDirection = direction || HorizontalDirection.right;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class InputComponent implements OnChanges {

@HostBinding('class')
@Input()
size: InputSize = InputSize.large;
size: InputSize | `${InputSize}` = InputSize.large;

/**
* Removes padding, width, rounded borders and drop-shadow when set to `true`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class IconComponent implements OnChanges {
private _icon = (this.icon = this.defaultIcon);
@HostBinding('class')
@Input()
size: IconSize;
size: IconSize | `${IconSize}`;

@Input() name: string;
@Input() customName: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class ItemComponent {
reorderable: boolean;
@HostBinding('class')
@Input()
size: ItemSize = ItemSize.MD;
size: ItemSize | `${ItemSize}` = ItemSize.MD;

// Prevent default when inside kirby-dropdown to avoid blurring dropdown:
onMouseDown(event: MouseEvent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class PopoverComponent implements AfterViewInit, OnDestroy {
wrapperElement: ElementRef<HTMLDivElement>;

@Input()
popout: HorizontalDirection = HorizontalDirection.right;
popout: HorizontalDirection | `${HorizontalDirection}` = HorizontalDirection.right;

@Input()
target: HTMLElement | ElementRef<HTMLElement>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class SegmentedControlComponent {
}
}

@Input() mode: SegmentedControlMode = SegmentedControlMode.default;
@Input() mode: SegmentedControlMode | `${SegmentedControlMode}` = SegmentedControlMode.default;

@HostBinding('class')
get _modeCssClass() {
Expand Down