Skip to content

Commit

Permalink
refactor: change onLabelClick to be a class method (#3165)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcfranco authored and driskull committed Oct 18, 2021
1 parent 0310df1 commit 8ed45e3
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions src/components/calcite-button/calcite-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,10 @@ export class CalciteButton implements LabelableComponent {
//
//--------------------------------------------------------------------------

onLabelClick = (event: CustomEvent): void => {
onLabelClick(event: CustomEvent): void {
this.handleClick(event);
this.setFocus();
};
}

// act on a requested or nearby form based on type
private handleClick = (e: Event): void => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/calcite-checkbox/calcite-checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ export class CalciteCheckbox implements LabelableComponent {
this.calciteInternalCheckboxFocus.emit(true);
}

onLabelClick = (): void => {
onLabelClick(): void {
this.toggle();
};
}

//--------------------------------------------------------------------------
//
Expand Down
4 changes: 2 additions & 2 deletions src/components/calcite-combobox/calcite-combobox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,9 @@ export class CalciteCombobox implements LabelableComponent {
//
// --------------------------------------------------------------------------

onLabelClick = (): void => {
onLabelClick(): void {
this.setFocus();
};
}

keydownHandler = (event: KeyboardEvent): void => {
const key = getKey(event.key, getElementDir(this.el));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ export class CalciteInlineEditable implements LabelableComponent {
}
}

onLabelClick = (): void => {
onLabelClick(): void {
this.setFocus();
};
}

//--------------------------------------------------------------------------
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,9 @@ export class CalciteInputDatePicker implements LabelableComponent {
//
//--------------------------------------------------------------------------

onLabelClick = (): void => {
onLabelClick(): void {
this.setFocus();
};
}

transitionEnd = (event: TransitionEvent): void => {
if (event.propertyName === this.activeTransitionProp) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ export class CalciteInputTimePicker implements LabelableComponent {
//
// --------------------------------------------------------------------------

onLabelClick = (): void => {
onLabelClick(): void {
this.setFocus();
};
}

private setCalciteInputEl = (el: HTMLCalciteInputElement): void => {
this.calciteInputEl = el;
Expand Down
4 changes: 2 additions & 2 deletions src/components/calcite-input/calcite-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,9 @@ export class CalciteInput implements LabelableComponent {
//
//--------------------------------------------------------------------------

onLabelClick = (): void => {
onLabelClick(): void {
this.setFocus();
};
}

private clearInputValue = (nativeEvent: KeyboardEvent | MouseEvent): void => {
this.setValue(null, nativeEvent, true);
Expand Down
4 changes: 2 additions & 2 deletions src/components/calcite-radio-button/calcite-radio-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export class CalciteRadioButton implements LabelableComponent {
this.toggle();
};

onLabelClick = (event: CustomEvent): void => {
onLabelClick(event: CustomEvent): void {
if (!this.disabled && !this.hidden) {
this.uncheckOtherRadioButtonsInGroup();
const label = event.currentTarget as HTMLCalciteLabelElement;
Expand All @@ -206,7 +206,7 @@ export class CalciteRadioButton implements LabelableComponent {
this.calciteRadioButtonChange.emit();
this.setFocus();
}
};
}

private checkLastRadioButton(): void {
const radioButtons = Array.from(this.rootNode.querySelectorAll("calcite-radio-button")).filter(
Expand Down
4 changes: 2 additions & 2 deletions src/components/calcite-radio-group/calcite-radio-group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,9 @@ export class CalciteRadioGroup implements LabelableComponent {
//
//--------------------------------------------------------------------------

onLabelClick = (): void => {
onLabelClick(): void {
this.setFocus();
};
}

private getItems(): NodeListOf<HTMLCalciteRadioGroupItemElement> {
return this.el.querySelectorAll("calcite-radio-group-item");
Expand Down
4 changes: 2 additions & 2 deletions src/components/calcite-rating/calcite-rating.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ export class CalciteRating implements LabelableComponent {
//
//--------------------------------------------------------------------------

onLabelClick = (): void => {
onLabelClick(): void {
this.setFocus();
};
}

private updateValue(value: number) {
this.value = value;
Expand Down
4 changes: 2 additions & 2 deletions src/components/calcite-select/calcite-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ export class CalciteSelect implements LabelableComponent {
//
//--------------------------------------------------------------------------

onLabelClick = (): void => {
onLabelClick(): void {
this.setFocus();
};
}

private updateNativeElement(
optionOrGroup: CalciteOptionOrGroup,
Expand Down
4 changes: 2 additions & 2 deletions src/components/calcite-slider/calcite-slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -839,9 +839,9 @@ export class CalciteSlider implements LabelableComponent {
//
//--------------------------------------------------------------------------

onLabelClick = (): void => {
onLabelClick(): void {
this.setFocus();
};
}

private shouldMirror(): boolean {
return this.mirrored && !this.hasHistogram;
Expand Down
4 changes: 2 additions & 2 deletions src/components/calcite-switch/calcite-switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ export class CalciteSwitch implements LabelableComponent {
//
//--------------------------------------------------------------------------

onLabelClick = (): void => {
onLabelClick(): void {
if (!this.disabled) {
this.toggle();
this.setFocus();
}
};
}

private setupInput(): void {
this.checked && this.inputEl.setAttribute("checked", "");
Expand Down

0 comments on commit 8ed45e3

Please sign in to comment.