From 3ee881a25438bd75715ef1822e4bfc57243a5c00 Mon Sep 17 00:00:00 2001 From: doyakovlev Date: Mon, 17 Feb 2020 12:40:42 +0300 Subject: [PATCH] chore(modifiers): set private and protected (#1018) --- src/amount/amount.tsx | 2 +- src/attach/attach.tsx | 4 ++-- src/button/button.tsx | 4 ++-- src/calendar-input/calendar-input.tsx | 22 ++++++----------- src/calendar/calendar.tsx | 18 +++++++------- src/card-input/card-input.tsx | 3 ++- src/checkbox-group/checkbox-group.tsx | 3 ++- src/checkbox/checkbox.tsx | 4 ++-- src/collapse/collapse.tsx | 3 ++- src/dropdown/dropdown.tsx | 6 ++--- src/dropzone/dropzone.tsx | 5 ++-- src/email-input/email-input.tsx | 3 ++- src/flag-icon/flag-icon.tsx | 2 +- src/form-field/form-field.tsx | 2 +- src/form/form.tsx | 2 +- src/grid-col/grid-col.tsx | 2 +- src/grid-row/grid-row.tsx | 4 ++-- src/heading/heading.tsx | 2 +- src/icon/icon.tsx | 2 +- src/input-autocomplete/input-autocomplete.tsx | 2 +- src/input-group/input-group.tsx | 2 +- src/input/input.tsx | 9 ++++--- src/intl-phone-input/intl-phone-input.tsx | 13 +++++----- src/isolated-container/isolated-container.tsx | 2 +- src/label/label.tsx | 2 +- src/link/link.tsx | 4 ++-- src/list-header/list-header.tsx | 2 +- src/list/list.tsx | 2 +- src/masked-input/masked-input.tsx | 15 ++++++------ src/menu-item/menu-item.tsx | 6 ++--- src/menu/menu.tsx | 7 +++--- src/money-input/money-input.tsx | 8 +++---- src/mq/mq.tsx | 2 +- src/notification/notification.tsx | 10 ++++---- src/paragraph/paragraph.tsx | 2 +- src/phone-input/phone-input.tsx | 4 ++-- src/plate/plate.tsx | 3 ++- .../popup-container-provider.tsx | 6 ++--- src/popup-header/popup-header.tsx | 2 +- src/popup/popup.tsx | 24 +++++++++---------- src/progress-bar/progress-bar.tsx | 2 +- src/radio-group/radio-group.tsx | 4 ++-- src/radio/radio.tsx | 6 ++--- src/resize-sensor/resize-sensor.tsx | 2 +- src/select/select.tsx | 13 +++++----- src/sidebar/sidebar.tsx | 2 +- src/slide-down/slide-down.tsx | 6 ++--- src/spin/spin.tsx | 2 +- src/swipeable/swipeable.tsx | 8 +++---- src/tab-item/tab-item.tsx | 2 +- src/tabs/tabs.tsx | 2 +- src/textarea/textarea.tsx | 6 ++--- src/toggle/toggle.tsx | 2 +- 53 files changed, 139 insertions(+), 138 deletions(-) diff --git a/src/amount/amount.tsx b/src/amount/amount.tsx index fd328e5886..bc68fdd307 100644 --- a/src/amount/amount.tsx +++ b/src/amount/amount.tsx @@ -89,7 +89,7 @@ export type AmountProps = { */ @performance(true) export class Amount extends React.Component { - cn = createCn('amount'); + protected cn = createCn('amount'); static defaultProps: Partial = { size: 'm', diff --git a/src/attach/attach.tsx b/src/attach/attach.tsx index 4ae3078bea..20c4ecf8aa 100644 --- a/src/attach/attach.tsx +++ b/src/attach/attach.tsx @@ -180,7 +180,7 @@ export type AttachProps = { * Компонент прикрепления файлов. */ export class Attach extends React.PureComponent { - cn = createCn('attach'); + protected cn = createCn('attach'); static defaultProps: Partial = { buttonContent: 'Выберите файл', @@ -197,8 +197,8 @@ export class Attach extends React.PureComponent { value: [] }; + // TODO [issues/1018] переписать тесты нужно, что бы private был input: HTMLInputElement; - root: HTMLSpanElement; // eslint-disable-next-line camelcase diff --git a/src/button/button.tsx b/src/button/button.tsx index 5ba8433e3b..327d16abb3 100644 --- a/src/button/button.tsx +++ b/src/button/button.tsx @@ -180,7 +180,7 @@ export type ButtonProps = { * Компонент кнопки (да, она нажимается!). */ export class Button extends React.PureComponent { - cn = createCn('button'); + protected cn = createCn('button'); static defaultProps: Partial = { type: 'button', @@ -195,7 +195,7 @@ export class Button extends React.PureComponent { pressed: false }; - control: HTMLButtonElement | HTMLSpanElement; + private control: HTMLButtonElement | HTMLSpanElement; // eslint-disable-next-line camelcase UNSAFE_componentWillReceiveProps(nextProps) { diff --git a/src/calendar-input/calendar-input.tsx b/src/calendar-input/calendar-input.tsx index 1ca0efc821..aeee0463d4 100644 --- a/src/calendar-input/calendar-input.tsx +++ b/src/calendar-input/calendar-input.tsx @@ -222,7 +222,7 @@ export type CalendarInputProps = { */ @performance(true) export class CalendarInput extends React.Component { - cn = createCn('calendar-input'); + protected cn = createCn('calendar-input'); static defaultProps: Partial = { withIcon: true, @@ -245,35 +245,27 @@ export class CalendarInput extends React.Component { ) }; - /** - * @type {Number} - */ - timeoutId; + private timeoutId; - /** - * @type {Number} - */ - changeCloseTimeoutId; + private changeCloseTimeoutId; /** * @type {Calendar} */ - calendar; + private calendar; /** * @type {Popup} */ - calendarPopup; + private calendarPopup; /** * @type {Input} */ + // TODO [issues/1018] переписать тесты нужно, что бы private был customCalendarTarget; - /** - * @type {HTMLInputElement} - */ - nativeCalendarTarget; + private nativeCalendarTarget; componentDidMount() { if (this.calendarPopup) { diff --git a/src/calendar/calendar.tsx b/src/calendar/calendar.tsx index e26bb11a74..24b327a556 100644 --- a/src/calendar/calendar.tsx +++ b/src/calendar/calendar.tsx @@ -171,7 +171,7 @@ type CalendarState = { */ @performance(true) export class Calendar extends React.Component { - cn = createCn('calendar'); + protected cn = createCn('calendar'); static defaultProps: Partial = { selectedFrom: null, @@ -191,21 +191,21 @@ export class Calendar extends React.Component { month: startOfMonth(new Date()) }; - root: HTMLDivElement; + private root: HTMLDivElement; - blurTimeoutId: number = null; + private blurTimeoutId: number = null; - years = []; + private years = []; - earlierLimit: Date; + private earlierLimit: Date; - laterLimit: Date; + private laterLimit: Date; - value: Date; + private value: Date; - selectedTo: Date; + private selectedTo: Date; - selectedFrom: Date; + private selectedFrom: Date; // eslint-disable-next-line camelcase UNSAFE_componentWillMount() { diff --git a/src/card-input/card-input.tsx b/src/card-input/card-input.tsx index b30fdfa387..b369a7fecd 100644 --- a/src/card-input/card-input.tsx +++ b/src/card-input/card-input.tsx @@ -17,7 +17,7 @@ export type CardInputProps = InputProps & { * Поле ввода номера карты с маской. */ export class CardInput extends React.PureComponent { - cn = createCn('card-input'); + protected cn = createCn('card-input'); static defaultProps: Partial = { placeholder: '0000 0000 0000 0000 00' @@ -26,6 +26,7 @@ export class CardInput extends React.PureComponent { /** * @type {Input} */ + // TODO [issues/1018] переписать тесты нужно, что бы private был root; render() { diff --git a/src/checkbox-group/checkbox-group.tsx b/src/checkbox-group/checkbox-group.tsx index a3a14351a5..78a1f52a78 100644 --- a/src/checkbox-group/checkbox-group.tsx +++ b/src/checkbox-group/checkbox-group.tsx @@ -92,7 +92,7 @@ export type CheckBoxGroupProps = ({ * Компонент группы чекбоксов. */ export class CheckBoxGroup extends React.PureComponent { - cn = createCn('checkbox-group'); + protected cn = createCn('checkbox-group'); static defaultProps: Partial = { type: 'normal' @@ -102,6 +102,7 @@ export class CheckBoxGroup extends React.PureComponent { value: [] }; + // TODO [issues/1018] переписать тесты нужно, что бы private был checkboxes: any[]; render() { diff --git a/src/checkbox/checkbox.tsx b/src/checkbox/checkbox.tsx index 95df6d8323..9374989b26 100644 --- a/src/checkbox/checkbox.tsx +++ b/src/checkbox/checkbox.tsx @@ -126,7 +126,7 @@ export type CheckboxProps = ({ * Компонент чекбокса. */ export class CheckBox extends React.PureComponent { - cn = createCn('checkbox'); + protected cn = createCn('checkbox'); static defaultProps: Partial = { type: 'normal', @@ -139,7 +139,7 @@ export class CheckBox extends React.PureComponent { checked: false }; - root; + private root; render() { const checked = this.props.checked === undefined ? this.state.checked : this.props.checked; diff --git a/src/collapse/collapse.tsx b/src/collapse/collapse.tsx index f211245986..85aa42b107 100644 --- a/src/collapse/collapse.tsx +++ b/src/collapse/collapse.tsx @@ -62,7 +62,7 @@ export type CollapseProps = { * Компонент «подката» позволяет спрятать кусок текста за ссылку «Еще...». */ export class Collapse extends React.PureComponent { - cn = createCn('collapse'); + protected cn = createCn('collapse'); static defaultProps: Partial = { expandedLabel: 'Collapse', @@ -73,6 +73,7 @@ export class Collapse extends React.PureComponent { isExpanded: false }; + // TODO [issues/1018] переписать тесты нужно, что бы private был content; contentCase; diff --git a/src/dropdown/dropdown.tsx b/src/dropdown/dropdown.tsx index 096b4647f8..7b345abf82 100644 --- a/src/dropdown/dropdown.tsx +++ b/src/dropdown/dropdown.tsx @@ -119,7 +119,7 @@ export type DropdownProps = { * Компонент «выпадашка»: ссылка или кнопка. По клику показывается Popup. */ export class Dropdown extends React.PureComponent { - cn = createCn('dropdown'); + protected cn = createCn('dropdown'); static defaultProps: Partial = { switcherType: 'link', @@ -137,8 +137,8 @@ export class Dropdown extends React.PureComponent { popupHovered: false }; - popup; - switcher; + private popup; + private switcher; componentDidMount() { this.popup.setTarget(this.switcher.getNode()); diff --git a/src/dropzone/dropzone.tsx b/src/dropzone/dropzone.tsx index 97d1c65387..e8a0c12098 100644 --- a/src/dropzone/dropzone.tsx +++ b/src/dropzone/dropzone.tsx @@ -71,7 +71,7 @@ export type DropzoneProps = { * Компонент drag-and-drop контейнер для прикрепления файлов. */ export class Dropzone extends React.PureComponent { - cn = createCn('dropzone'); + protected cn = createCn('dropzone'); static defaultProps: Partial = { theme: 'alfa-on-white', @@ -82,9 +82,10 @@ export class Dropzone extends React.PureComponent { dragging: false }; + // TODO [issues/1018] на private ругается root: HTMLSpanElement; - dragCounter: number; + private dragCounter: number; private handleDragOver = (event) => { event.preventDefault(); diff --git a/src/email-input/email-input.tsx b/src/email-input/email-input.tsx index 8da20f2347..24dcc859b3 100644 --- a/src/email-input/email-input.tsx +++ b/src/email-input/email-input.tsx @@ -15,11 +15,12 @@ import Input, { InputProps } from '../input/input'; * @extends Input */ export class EmailInput extends React.PureComponent { - cn = createCn('email-input'); + protected cn = createCn('email-input'); /** * @type {Input} */ + // TODO [issues/1018] переписать тесты нужно, что бы private был root; render() { diff --git a/src/flag-icon/flag-icon.tsx b/src/flag-icon/flag-icon.tsx index 51edf0ce11..dda546429b 100644 --- a/src/flag-icon/flag-icon.tsx +++ b/src/flag-icon/flag-icon.tsx @@ -55,7 +55,7 @@ export type FlagIconProps = { * Компонент флага в виде иконки. */ export class FlagIcon extends React.PureComponent { - cn = createCn('flag-icon'); + protected cn = createCn('flag-icon'); static defaultProps: Partial = { isFlat: false, diff --git a/src/form-field/form-field.tsx b/src/form-field/form-field.tsx index adcf5013ad..3db55e34ac 100644 --- a/src/form-field/form-field.tsx +++ b/src/form-field/form-field.tsx @@ -44,7 +44,7 @@ export type FormFieldProps = { * Необходим для вертикального ритма в форме. */ export class FormField extends React.PureComponent { - cn = createCn('form-field'); + protected cn = createCn('form-field'); static defaultProps: Partial = { size: 'm' diff --git a/src/form/form.tsx b/src/form/form.tsx index 057e7add34..36bd9e7312 100644 --- a/src/form/form.tsx +++ b/src/form/form.tsx @@ -89,7 +89,7 @@ export type FormProps = { * Компонент формы. */ export class Form extends React.PureComponent { - cn = createCn('form'); + protected cn = createCn('form'); static defaultProps: Partial = { action: '/', diff --git a/src/grid-col/grid-col.tsx b/src/grid-col/grid-col.tsx index e613c1c82b..dda7fdd88a 100644 --- a/src/grid-col/grid-col.tsx +++ b/src/grid-col/grid-col.tsx @@ -88,7 +88,7 @@ export type GridColProps = { * Колонки должны быть помещены в строки (компонент `GridRow`). */ export class GridCol extends React.PureComponent { - cn = createCn('grid-col'); + protected cn = createCn('grid-col'); static defaultProps: Partial = { tag: 'div' diff --git a/src/grid-row/grid-row.tsx b/src/grid-row/grid-row.tsx index ed0aee92a8..99229b4752 100644 --- a/src/grid-row/grid-row.tsx +++ b/src/grid-row/grid-row.tsx @@ -68,7 +68,7 @@ export type GridRowProps = { * Сетка имеет резиновую систему разметки, которая масштабируется до 12 столбцов. */ export class GridRow extends React.PureComponent { - cn = createCn('grid-row'); + protected cn = createCn('grid-row'); static defaultProps: Partial = { tag: 'div', @@ -86,7 +86,7 @@ export class GridRow extends React.PureComponent { /** * Класс колонки */ - classCol = 'grid-col' + private classCol = 'grid-col' render() { const { diff --git a/src/heading/heading.tsx b/src/heading/heading.tsx index 568bc41a0a..cb4bb7a75c 100644 --- a/src/heading/heading.tsx +++ b/src/heading/heading.tsx @@ -57,7 +57,7 @@ export type HeadingProps = { * Компонент заголовка. */ export class Heading extends React.PureComponent { - cn = createCn('heading'); + protected cn = createCn('heading'); static defaultProps: Partial = { size: 'xl', diff --git a/src/icon/icon.tsx b/src/icon/icon.tsx index d4b852a183..995d8747e2 100644 --- a/src/icon/icon.tsx +++ b/src/icon/icon.tsx @@ -49,7 +49,7 @@ export type IconProps = { * Базовый компонент иконки. Содержит в себе только необходимые для компонентов иконки. */ export class Icon extends React.PureComponent { - cn = createCn('icon'); + protected cn = createCn('icon'); static defaultProps: Partial = { size: 'm' diff --git a/src/input-autocomplete/input-autocomplete.tsx b/src/input-autocomplete/input-autocomplete.tsx index ae372dfa81..7d6db5fd07 100644 --- a/src/input-autocomplete/input-autocomplete.tsx +++ b/src/input-autocomplete/input-autocomplete.tsx @@ -351,7 +351,7 @@ type InputAutocompleteState = { */ @performance(true) export class InputAutocomplete extends React.Component { - cn = createCn('input'); + protected cn = createCn('input'); static defaultProps: Partial = { disabled: false, diff --git a/src/input-group/input-group.tsx b/src/input-group/input-group.tsx index ab731b6874..858a3c43d9 100644 --- a/src/input-group/input-group.tsx +++ b/src/input-group/input-group.tsx @@ -43,7 +43,7 @@ export type InputGroupProps = { * Компонент группы полей для текстового ввода. */ export class InputGroup extends React.PureComponent { - cn = createCn('input-group'); + protected cn = createCn('input-group'); render() { let children = null; diff --git a/src/input/input.tsx b/src/input/input.tsx index 0f13f8522c..502d615085 100644 --- a/src/input/input.tsx +++ b/src/input/input.tsx @@ -251,7 +251,7 @@ export type InputProps = { * Компонент текстового поля ввода. */ export class Input extends React.PureComponent { - cn = createCn('input'); + protected cn = createCn('input'); static defaultProps: Partial = { formNoValidate: false, @@ -270,17 +270,16 @@ export class Input extends React.PureComponent { /** * @type {HTMLSpanElement} */ - root; - + private root; /** * @type {HTMLSpanElement} */ - box; + private box; /** * @type {HTMLInputElement} */ - control; + private control; // eslint-disable-next-line camelcase UNSAFE_componentWillReceiveProps(nextProps) { diff --git a/src/intl-phone-input/intl-phone-input.tsx b/src/intl-phone-input/intl-phone-input.tsx index c50775a809..ae05cc2970 100644 --- a/src/intl-phone-input/intl-phone-input.tsx +++ b/src/intl-phone-input/intl-phone-input.tsx @@ -31,7 +31,7 @@ type IntlPhoneInputState = { * Компонент ввода международного телефона по маске. */ export class IntlPhoneInput extends React.PureComponent { - cn = createCn('intl-phone-input'); + protected cn = createCn('intl-phone-input'); static defaultProps: Partial = { size: 'm', @@ -46,12 +46,13 @@ export class IntlPhoneInput extends React.PureComponent { - cn = createCn('label'); + protected cn = createCn('label'); static defaultProps: Partial = { size: 'm', diff --git a/src/link/link.tsx b/src/link/link.tsx index efc5b29e21..53f1340547 100644 --- a/src/link/link.tsx +++ b/src/link/link.tsx @@ -128,7 +128,7 @@ export type LinkProps = { * Компонент ссылки. */ export class Link extends React.PureComponent { - cn = createCn('link'); + protected cn = createCn('link'); static defaultProps: Partial = { iconPosition: 'left', @@ -145,7 +145,7 @@ export class Link extends React.PureComponent { focused: false }; - root: HTMLElement; + private root: HTMLElement; render() { const linkElement = this.props.checked || this.props.disabled ? 'span' : 'a'; diff --git a/src/list-header/list-header.tsx b/src/list-header/list-header.tsx index 271497b819..99976fe6c9 100644 --- a/src/list-header/list-header.tsx +++ b/src/list-header/list-header.tsx @@ -49,7 +49,7 @@ export type ListHeaderProps = { * Компонент для разделения списка по датам или смысловым группам. */ export class ListHeader extends React.PureComponent { - cn = createCn('list-header'); + protected cn = createCn('list-header'); render() { return ( diff --git a/src/list/list.tsx b/src/list/list.tsx index 1048feeb55..6fdd1a898d 100644 --- a/src/list/list.tsx +++ b/src/list/list.tsx @@ -64,7 +64,7 @@ export type ListProps = { */ @performance(true) export class List extends React.Component { - cn = createCn('list'); + protected cn = createCn('list'); render() { const { items, type } = this.props; diff --git a/src/masked-input/masked-input.tsx b/src/masked-input/masked-input.tsx index 60f6c8c3cf..16de57a430 100644 --- a/src/masked-input/masked-input.tsx +++ b/src/masked-input/masked-input.tsx @@ -108,21 +108,22 @@ export type MaskedInputProps = { */ class MaskedInput extends React.PureComponent { + // TODO [issues/1018] на private ругается input: HTMLInputElement; - maskPattern: string; + private maskPattern: string; - mask: Mask; + private mask: Mask; - beforeChangeMask: Mask; + private beforeChangeMask: Mask; - formatCharacters: FormatCharacters; + private formatCharacters: FormatCharacters; - value: string = ''; + private value: string = ''; - caretFixTimeout; + private caretFixTimeout: ReturnType = null;; - beforeInputSelection = { start: 0, end: 0 }; + private beforeInputSelection = { start: 0, end: 0 }; // eslint-disable-next-line camelcase UNSAFE_componentWillMount() { diff --git a/src/menu-item/menu-item.tsx b/src/menu-item/menu-item.tsx index 9585bfe1fc..03c6934196 100644 --- a/src/menu-item/menu-item.tsx +++ b/src/menu-item/menu-item.tsx @@ -116,7 +116,7 @@ export type MenuItemProps = { * Компонент элемента меню. Как правило, используется совместно с `Menu`. */ export class MenuItem extends React.PureComponent { - cn = createCn('menu-item'); + protected cn = createCn('menu-item'); static defaultProps: Partial = { type: 'link', @@ -128,8 +128,8 @@ export class MenuItem extends React.PureComponent { focused: false }; - root; - control; + private root; + private control; render() { const content: any = this.props.children || this.props.value; diff --git a/src/menu/menu.tsx b/src/menu/menu.tsx index 9afb65b47d..8b65028406 100644 --- a/src/menu/menu.tsx +++ b/src/menu/menu.tsx @@ -190,7 +190,7 @@ export type MenuProps = { */ @performance(true) export class Menu extends React.Component { - cn = createCn('menu'); + protected cn = createCn('menu'); static defaultProps: Partial = { size: 'm', @@ -205,9 +205,10 @@ export class Menu extends React.Component { hovered: false }; + // TODO [issues/1018] переписать тесты нужно, что бы private был root; - menuItemList = []; - blurTimeoutId = null; + private menuItemList = []; + private blurTimeoutId = null; componentDidMount() { if (!!this.props.content && this.props.content.length > 0 && diff --git a/src/money-input/money-input.tsx b/src/money-input/money-input.tsx index 4d2ec5365d..e7ce9a1fa5 100644 --- a/src/money-input/money-input.tsx +++ b/src/money-input/money-input.tsx @@ -85,7 +85,7 @@ type MoneyInputState = { * Компонент поля для ввода суммы. Может принимать в качестве значения либо число, либо число с сотой долей. */ export class MoneyInput extends React.PureComponent { - cn = createCn('money-input'); + protected cn = createCn('money-input'); static defaultProps: Partial = { fractionLength: DEFAULT_FRACTION_SIZE, @@ -99,11 +99,11 @@ export class MoneyInput extends React.PureComponent { isMatched: false }; - mql: MediaQueryList | null = null; + private mql: MediaQueryList | null = null; componentDidMount() { this.mql = getMatchMedia(this.props.query); diff --git a/src/notification/notification.tsx b/src/notification/notification.tsx index c0759a7047..c7543ac712 100644 --- a/src/notification/notification.tsx +++ b/src/notification/notification.tsx @@ -123,7 +123,7 @@ export type NotificationProps = { * Компонент всплывающего окна. */ export class Notification extends React.PureComponent { - cn = createCn('notification') + protected cn = createCn('notification') static defaultProps: Partial = { autoCloseDelay: 5000, @@ -136,11 +136,11 @@ export class Notification extends React.PureComponent { hovered: false }; - root: HTMLDivElement; + private root: HTMLDivElement; - closeTimeout = null; - clickEventBindTimeout = null; - isWindowClickBinded = false; + private closeTimeout = null; + private clickEventBindTimeout = null; + private isWindowClickBinded = false; componentDidMount() { this.startCloseTimer(); diff --git a/src/paragraph/paragraph.tsx b/src/paragraph/paragraph.tsx index c5a9ab5d13..00a2cf27a6 100644 --- a/src/paragraph/paragraph.tsx +++ b/src/paragraph/paragraph.tsx @@ -48,7 +48,7 @@ export type ParagraphProps = { * Компонент параграфа текста. */ export class Paragraph extends React.PureComponent { - cn = createCn('paragraph'); + protected cn = createCn('paragraph'); render() { return ( diff --git a/src/phone-input/phone-input.tsx b/src/phone-input/phone-input.tsx index 88f49bbfaa..1cb45b0e02 100644 --- a/src/phone-input/phone-input.tsx +++ b/src/phone-input/phone-input.tsx @@ -28,14 +28,14 @@ export type PhoneInputProps = InputProps & { * Компонент ввода телефона по маске. */ export class PhoneInput extends React.PureComponent { - cn = createCn('phone-input'); + protected cn = createCn('phone-input'); static defaultProps: Partial = { mask: '+1 111 111 11 11', placeholder: '+7 000 000 00 00' }; - root; + private root; render() { return ( diff --git a/src/plate/plate.tsx b/src/plate/plate.tsx index 13c059785a..8c921c109a 100644 --- a/src/plate/plate.tsx +++ b/src/plate/plate.tsx @@ -106,7 +106,7 @@ export type PlateProps = { * Компонент плашки. */ export class Plate extends React.PureComponent { - cn = createCn('plate'); + protected cn = createCn('plate'); static defaultProps: Partial = { foldable: false, @@ -120,6 +120,7 @@ export class Plate extends React.PureComponent { isFolded: this.props.folded }; + // TODO [issues/1018] на private ругается root: HTMLElement; render() { diff --git a/src/popup-container-provider/popup-container-provider.tsx b/src/popup-container-provider/popup-container-provider.tsx index 3bf3ecea17..3346cf56d5 100644 --- a/src/popup-container-provider/popup-container-provider.tsx +++ b/src/popup-container-provider/popup-container-provider.tsx @@ -79,14 +79,14 @@ type PopupContainerProviderState = { */ class PopupContainerProvider extends React.PureComponent { - cn = createCn('popup-container'); + protected cn = createCn('popup-container'); state = { didRender: false // eslint-disable-line react/no-unused-state }; - renderContainer: IsolatedContainer; - positioningContainer: HTMLElement; + private renderContainer: IsolatedContainer; + private positioningContainer: HTMLElement; getChildContext() { return { diff --git a/src/popup-header/popup-header.tsx b/src/popup-header/popup-header.tsx index d3877231c4..777673a450 100644 --- a/src/popup-header/popup-header.tsx +++ b/src/popup-header/popup-header.tsx @@ -50,7 +50,7 @@ export type PopupHeaderProps = { * Заголовок в Popup. */ export class PopupHeader extends React.PureComponent { - cn = createCn('popup-header'); + protected cn = createCn('popup-header'); render() { return ( diff --git a/src/popup/popup.tsx b/src/popup/popup.tsx index 98c33be417..26f4caa058 100644 --- a/src/popup/popup.tsx +++ b/src/popup/popup.tsx @@ -184,7 +184,7 @@ type PopupState = { */ @performance(true) export class Popup extends React.Component { - cn = createCn('popup'); + protected cn = createCn('popup'); static defaultProps: Partial = { visible: false, @@ -225,17 +225,17 @@ export class Popup extends React.Component { needRedrawAfterMount: false }; - anchor = null; - clickEventBindTimeout = null; - domElemPopup = null; - domElemPopupInner: HTMLElement = null; - domElemPopupContent = null; - isWindowClickBinded = false; - position = null; - - popup; - inner; - content; + private anchor = null; + private clickEventBindTimeout = null; + private domElemPopup = null; + private domElemPopupInner: HTMLElement = null; + private domElemPopupContent = null; + private isWindowClickBinded = false; + private position = null; + + private popup; + private inner; + private content; private handleWindowResize = debounce(() => { if (this.isPropsToPositionCorrect()) { diff --git a/src/progress-bar/progress-bar.tsx b/src/progress-bar/progress-bar.tsx index 8d527b2d24..edd0e6e25d 100644 --- a/src/progress-bar/progress-bar.tsx +++ b/src/progress-bar/progress-bar.tsx @@ -35,7 +35,7 @@ export type ProgressBarProps = { * Компонент прогресс-бара. */ export class ProgressBar extends React.PureComponent { - cn = createCn('progress-bar'); + protected cn = createCn('progress-bar'); static defaultProps: Partial = { percent: 0, diff --git a/src/radio-group/radio-group.tsx b/src/radio-group/radio-group.tsx index 747019e8dd..73f0bcc369 100644 --- a/src/radio-group/radio-group.tsx +++ b/src/radio-group/radio-group.tsx @@ -96,7 +96,7 @@ export type RadioGroupProps = { * Компонент группы радио-кнопок. */ export class RadioGroup extends React.PureComponent { - cn = createCn('radio-group'); + protected cn = createCn('radio-group'); static defaultProps: Partial = { type: 'normal', @@ -106,7 +106,7 @@ export class RadioGroup extends React.PureComponent { state = { value: '' }; - + // TODO [issues/1018] переписать тесты нужно, что бы private был radios: Radio[]; render() { diff --git a/src/radio/radio.tsx b/src/radio/radio.tsx index 498e5879c1..ac4b96cc1d 100644 --- a/src/radio/radio.tsx +++ b/src/radio/radio.tsx @@ -128,7 +128,7 @@ type RadioState = { * Компонент радио-кнопки. */ export class Radio extends React.PureComponent { - cn = createCn('radio'); + protected cn = createCn('radio'); static defaultProps: Partial = { size: 'm', @@ -141,8 +141,8 @@ export class Radio extends React.PureComponent { checked: false }; - label; - control; + private label; + private control; render() { const checked = this.props.checked === undefined ? this.state.checked : this.props.checked; diff --git a/src/resize-sensor/resize-sensor.tsx b/src/resize-sensor/resize-sensor.tsx index 39904f4f93..0b9390f133 100644 --- a/src/resize-sensor/resize-sensor.tsx +++ b/src/resize-sensor/resize-sensor.tsx @@ -21,7 +21,7 @@ export type ResizeSensorProps = { * css свойством `position: relative;`. */ export class ResizeSensor extends React.Component { - iframe: HTMLIFrameElement; + private iframe: HTMLIFrameElement; componentDidMount() { if (this.iframe.contentWindow) { diff --git a/src/select/select.tsx b/src/select/select.tsx index b2270ff59b..6e188495e9 100644 --- a/src/select/select.tsx +++ b/src/select/select.tsx @@ -318,7 +318,7 @@ type SelectState = { */ @performance(true) export class Select extends React.Component { - cn = createCn('select'); + protected cn = createCn('select'); static defaultProps: Partial = { mode: 'check', @@ -348,15 +348,16 @@ export class Select extends React.Component { value: this.props.value || [] }; - root: HTMLDivElement; + private root: HTMLDivElement; - button; + private button; + // TODO [issues/1018] переписать тесты нужно, что бы private был popup; - menu; + private menu; - nativeSelect: HTMLSelectElement; + private nativeSelect: HTMLSelectElement; /** * При открытом меню, нажатие на Esc устанавливает значение этой переменной в true @@ -364,7 +365,7 @@ export class Select extends React.Component { * В обработчике закрываем попап, если ожидаем закрытия(this.awaitClosing) или фокус за пределами селекта. * Это нужно, т.к. в случае в renderPopupOnFocus={true} меню исчезнет быстрее, чем сработает onMenuBlur */ - awaitClosing = false; + private awaitClosing = false; // eslint-disable-next-line camelcase UNSAFE_componentWillMount() { diff --git a/src/sidebar/sidebar.tsx b/src/sidebar/sidebar.tsx index bf06b2c204..9edd2f5185 100644 --- a/src/sidebar/sidebar.tsx +++ b/src/sidebar/sidebar.tsx @@ -120,7 +120,7 @@ export type SidebarProps = { * Компонент боковой панели aka холодильник. */ export class Sidebar extends React.PureComponent { - cn = createCn('sidebar'); + protected cn = createCn('sidebar'); static defaultProps: Partial = { hasOverlay: true, diff --git a/src/slide-down/slide-down.tsx b/src/slide-down/slide-down.tsx index 51985518d6..6013629cd7 100644 --- a/src/slide-down/slide-down.tsx +++ b/src/slide-down/slide-down.tsx @@ -54,15 +54,15 @@ export type SlideDownProps = { * Позволяет скрывать и отображать контент. */ export class SlideDown extends React.PureComponent { - cn = createCn('slide-down'); + protected cn = createCn('slide-down'); state = { height: this.props.isExpanded ? 'auto' : 0, isHeightAuto: this.props.isExpanded }; - slideDown; - slideDownContent; + private slideDown; + private slideDownContent; // eslint-disable-next-line camelcase UNSAFE_componentWillReceiveProps(nextProps) { diff --git a/src/spin/spin.tsx b/src/spin/spin.tsx index 6b9463ae93..9785efb0bb 100644 --- a/src/spin/spin.tsx +++ b/src/spin/spin.tsx @@ -43,7 +43,7 @@ export type SpinProps = { * Компонент показывающий крутящееся кольцо загрузки. */ export class Spin extends React.PureComponent { - cn = createCn('spin'); + protected cn = createCn('spin'); static defaultProps: Partial = { visible: false, diff --git a/src/swipeable/swipeable.tsx b/src/swipeable/swipeable.tsx index 809799ad14..caeaa02118 100644 --- a/src/swipeable/swipeable.tsx +++ b/src/swipeable/swipeable.tsx @@ -35,10 +35,10 @@ class Swipeable extends React.PureComponent { delta: 100 }; - swipeStartX = 0; - swipeStartY = 0; - deltaX = 0; - deltaY = 0; + private swipeStartX = 0; + private swipeStartY = 0; + private deltaX = 0; + private deltaY = 0; componentWillUnmount() { this.removeListeners(); diff --git a/src/tab-item/tab-item.tsx b/src/tab-item/tab-item.tsx index 60be6b3716..f5c0d1252a 100644 --- a/src/tab-item/tab-item.tsx +++ b/src/tab-item/tab-item.tsx @@ -10,7 +10,7 @@ import { LinkProps, Link } from '../link/link'; * Компонент таба. Как правило, используется совместно с `Tabs`. */ export class TabItem extends Link { - cn = createCn('tab-item'); + protected cn = createCn('tab-item'); static defaultProps: Partial = { size: 'l', view: 'default', diff --git a/src/tabs/tabs.tsx b/src/tabs/tabs.tsx index fad69f3d15..f2166f2453 100644 --- a/src/tabs/tabs.tsx +++ b/src/tabs/tabs.tsx @@ -44,7 +44,7 @@ export type TabsProps = { * Компонент навигации в виде табов. Как правило используется совместно с `TabItem`. */ export class Tabs extends React.PureComponent { - cn = createCn('tabs'); + protected cn = createCn('tabs'); static defaultProps: Partial = { scrollable: true diff --git a/src/textarea/textarea.tsx b/src/textarea/textarea.tsx index 484334c608..37d5aefe5c 100644 --- a/src/textarea/textarea.tsx +++ b/src/textarea/textarea.tsx @@ -168,7 +168,7 @@ export type TextareaProps = { * Компонент многострочного текстового ввода. */ export class Textarea extends React.PureComponent { - cn = createCn('textarea'); + protected cn = createCn('textarea'); static defaultProps: Partial = { view: 'default', @@ -188,12 +188,12 @@ export class Textarea extends React.PureComponent { /** * @type {HtmlSpanElement} */ - root; + private root; /** * @type {HTMLTextareaElement} */ - control; + private control; render() { const value = this.props.value === undefined ? this.state.value : this.props.value; diff --git a/src/toggle/toggle.tsx b/src/toggle/toggle.tsx index f7834ed3e6..d3aedf746d 100644 --- a/src/toggle/toggle.tsx +++ b/src/toggle/toggle.tsx @@ -87,7 +87,7 @@ export type ToggleProps = { * Компонент переключателя. */ export class Toggle extends React.PureComponent { - cn = createCn('toggle'); + protected cn = createCn('toggle'); static defaultProps: Partial = { size: 'm',