From 2f28cba40330e0e98be97a1c0cef148cbd4d261c Mon Sep 17 00:00:00 2001 From: Vladislav Polyakov <39828645+polRk@users.noreply.github.com> Date: Mon, 13 Jul 2020 17:16:59 +0300 Subject: [PATCH 1/4] feat: add isVisible prop --- src/components/Textinput/_hasClear/Textinput_hasClear.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/Textinput/_hasClear/Textinput_hasClear.tsx b/src/components/Textinput/_hasClear/Textinput_hasClear.tsx index 72d49429..fc8eaf56 100644 --- a/src/components/Textinput/_hasClear/Textinput_hasClear.tsx +++ b/src/components/Textinput/_hasClear/Textinput_hasClear.tsx @@ -6,6 +6,12 @@ import { ITextinputRegistry } from './Textinput_hasClear.registry'; import { ITextinputProps, cnTextinput } from '../Textinput'; export interface ITextinputHasClearProps { + /** + * Видимость крестика. Если указан, + * работает как stateless комопнент. + */ + isVisible?: boolean; + /** * Наличие крестика для очистки текстового поля. */ @@ -75,7 +81,7 @@ export const withHasClear = withBemMod size={this.props.size} theme={this.props.theme} view={this.props.view} - visible={Boolean(this.props.value)} + visible={this.props.isVisible ?? this.props.isVisible : Boolean(this.props.value)} /> {addonBefore} From 26ece9086f861545545b14032275abece34764b1 Mon Sep 17 00:00:00 2001 From: Vladislav Polyakov <39828645+polRk@users.noreply.github.com> Date: Mon, 13 Jul 2020 17:19:47 +0300 Subject: [PATCH 2/4] fix: typo --- src/components/Textinput/_hasClear/Textinput_hasClear.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Textinput/_hasClear/Textinput_hasClear.tsx b/src/components/Textinput/_hasClear/Textinput_hasClear.tsx index fc8eaf56..ffb23433 100644 --- a/src/components/Textinput/_hasClear/Textinput_hasClear.tsx +++ b/src/components/Textinput/_hasClear/Textinput_hasClear.tsx @@ -8,7 +8,7 @@ import { ITextinputProps, cnTextinput } from '../Textinput'; export interface ITextinputHasClearProps { /** * Видимость крестика. Если указан, - * работает как stateless комопнент. + * состояние более не зависит от value. */ isVisible?: boolean; From a84234647ca4a5527de3533896006f7481050686 Mon Sep 17 00:00:00 2001 From: Vladislav Polyakov <39828645+polRk@users.noreply.github.com> Date: Mon, 13 Jul 2020 17:27:08 +0300 Subject: [PATCH 3/4] fix: invalid usage of nullish coalescing --- src/components/Textinput/_hasClear/Textinput_hasClear.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Textinput/_hasClear/Textinput_hasClear.tsx b/src/components/Textinput/_hasClear/Textinput_hasClear.tsx index ffb23433..b285079b 100644 --- a/src/components/Textinput/_hasClear/Textinput_hasClear.tsx +++ b/src/components/Textinput/_hasClear/Textinput_hasClear.tsx @@ -81,7 +81,7 @@ export const withHasClear = withBemMod size={this.props.size} theme={this.props.theme} view={this.props.view} - visible={this.props.isVisible ?? this.props.isVisible : Boolean(this.props.value)} + visible={this.props.isVisible ?? Boolean(this.props.value)} /> {addonBefore} From d781c85e7a833a1c80a2eea348479336b29feb1c Mon Sep 17 00:00:00 2001 From: Vladislav Polyakov <39828645+polRk@users.noreply.github.com> Date: Mon, 13 Jul 2020 17:28:54 +0300 Subject: [PATCH 4/4] refactor: update prop name --- src/components/Textinput/_hasClear/Textinput_hasClear.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/Textinput/_hasClear/Textinput_hasClear.tsx b/src/components/Textinput/_hasClear/Textinput_hasClear.tsx index b285079b..58c9796f 100644 --- a/src/components/Textinput/_hasClear/Textinput_hasClear.tsx +++ b/src/components/Textinput/_hasClear/Textinput_hasClear.tsx @@ -10,7 +10,7 @@ export interface ITextinputHasClearProps { * Видимость крестика. Если указан, * состояние более не зависит от value. */ - isVisible?: boolean; + isClearVisible?: boolean; /** * Наличие крестика для очистки текстового поля. @@ -81,7 +81,9 @@ export const withHasClear = withBemMod size={this.props.size} theme={this.props.theme} view={this.props.view} - visible={this.props.isVisible ?? Boolean(this.props.value)} + visible={ + this.props.isClearVisible ?? Boolean(this.props.value) + } /> {addonBefore}