Skip to content

Commit

Permalink
fix(search-bar): lint ts
Browse files Browse the repository at this point in the history
  • Loading branch information
skhamvon authored and dpellier committed Feb 15, 2024
1 parent 95750a8 commit 0dd161f
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import type { OdsSearchBarAttribute, OdsSearchbarOption } from './interfaces/att
import type { OdsSearchBarEvent } from './interfaces/events';
import type { OdsInputValueChangeEvent, OdsInputValueChangeEventDetail } from '../../../../input/src';
import type { OdsSelectValueChangeEvent } from '../../../../select/src';
import type { EventEmitter } from '@stencil/core';
import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming';
import { Component, Element, Event, Host, Listen, Prop, h } from '@stencil/core';
import { DEFAULT_ATTRIBUTE } from './constants/default-attributes';
import { ODS_BUTTON_SIZE } from '../../../../button/src';
import { ODS_ICON_NAME, ODS_ICON_SIZE } from '../../../../icon/src';
import { ODS_INPUT_TYPE } from '../../../../input/src';
import { Component, Element, Event, EventEmitter, Host, Listen, Prop, h } from '@stencil/core';
import { DEFAULT_ATTRIBUTE } from './constants/default-attributes';

@Component({
shadow: true,
Expand All @@ -24,20 +25,20 @@ export class OsdsSearchBar implements OdsSearchBarAttribute, OdsSearchBarEvent {
@Prop({ reflect: true }) public loading?: boolean = DEFAULT_ATTRIBUTE.loading;
@Prop({ reflect: true }) public placeholder?: string = DEFAULT_ATTRIBUTE.placeholder;
@Prop({ reflect: true }) public options?: OdsSearchbarOption[] = DEFAULT_ATTRIBUTE.options;
@Prop({ reflect: true, mutable: true }) public value: string = DEFAULT_ATTRIBUTE.value;
@Prop({ mutable: true, reflect: true }) public value: string = DEFAULT_ATTRIBUTE.value;

@Event() odsBlur!: EventEmitter<void>;
@Event() odsFocus!: EventEmitter<void>;
@Event() odsSearchSubmit!: EventEmitter<{ optionValue: string; inputValue: string }>;
@Event() odsValueChange!: EventEmitter<OdsInputValueChangeEventDetail>;

@Listen('odsInputBlur')
onInputBlur() {
onInputBlur(): void {
this.odsBlur.emit();
}

@Listen('odsInputFocus')
onInputFocus() {
onInputFocus(): void {
this.odsFocus.emit();
}

Expand All @@ -63,10 +64,10 @@ export class OsdsSearchBar implements OdsSearchBarAttribute, OdsSearchBarEvent {
}

emitSearchSubmit(): void {
this.odsSearchSubmit.emit({ optionValue: this.optionValue, inputValue: this.value });
this.odsSearchSubmit.emit({ inputValue: this.value, optionValue: this.optionValue });
}

render() {
render(): JSX.Element {
const hasSelect = Boolean(this.options?.length);

return (
Expand Down Expand Up @@ -96,7 +97,7 @@ export class OsdsSearchBar implements OdsSearchBarAttribute, OdsSearchBarEvent {

<osds-button
tabindex="2"
onClick={ () => this.handlerOnClickSearchButton() }
onClick={ (): void => this.handlerOnClickSearchButton() }
size={ ODS_BUTTON_SIZE.sm }
color={ ODS_THEME_COLOR_INTENT.primary }
disabled={ this.disabled }
Expand Down

0 comments on commit 0dd161f

Please sign in to comment.