fix(knobs): update visibility of methods to avoid too broad .d.ts files

All theses functions shouldn't be used outside the class, making them private simplify the types generated in type definition files (`.d.ts`).
This enable us to move some deps to devDeps if they are not used (imported) in generated definition files.
This commit is contained in:
Gaëtan Maisse 2020-07-25 20:13:15 +02:00
parent 59a3c87a99
commit 5b59ae62f4
No known key found for this signature in database
GPG Key ID: D934C0EF3714A8A8
6 changed files with 11 additions and 11 deletions

View File

@ -78,7 +78,7 @@ export default class CheckboxesType extends Component<CheckboxesTypeProps, Check
};
}
handleChange = (e: ChangeEvent<HTMLInputElement>) => {
private handleChange = (e: ChangeEvent<HTMLInputElement>) => {
const { onChange } = this.props;
const currentValue = (e.target as HTMLInputElement).value;
const { values } = this.state;
@ -94,10 +94,10 @@ export default class CheckboxesType extends Component<CheckboxesTypeProps, Check
onChange(values);
};
renderCheckboxList = ({ options }: CheckboxesTypeKnob) =>
private renderCheckboxList = ({ options }: CheckboxesTypeKnob) =>
Object.keys(options).map((key) => this.renderCheckbox(key, options[key]));
renderCheckbox = (label: string, value: string) => {
private renderCheckbox = (label: string, value: string) => {
const { knob } = this.props;
const { name } = knob;
const id = `${name}-${value}`;

View File

@ -95,7 +95,7 @@ export default class ColorType extends Component<ColorTypeProps, ColorTypeState>
});
};
handleClick = () => {
private handleClick = () => {
const { displayColorPicker } = this.state;
this.setState({
@ -103,7 +103,7 @@ export default class ColorType extends Component<ColorTypeProps, ColorTypeState>
});
};
handleChange = (color: ColorResult) => {
private handleChange = (color: ColorResult) => {
const { onChange } = this.props;
onChange(`rgba(${color.rgb.r},${color.rgb.g},${color.rgb.b},${color.rgb.a})`);

View File

@ -78,7 +78,7 @@ export default class DateType extends Component<DateTypeProps, DateTypeState> {
}
}
onDateChange = (e: ChangeEvent<HTMLInputElement>) => {
private onDateChange = (e: ChangeEvent<HTMLInputElement>) => {
const { knob, onChange } = this.props;
const { state } = this;
@ -99,7 +99,7 @@ export default class DateType extends Component<DateTypeProps, DateTypeState> {
}
};
onTimeChange = (e: ChangeEvent<HTMLInputElement>) => {
private onTimeChange = (e: ChangeEvent<HTMLInputElement>) => {
const { knob, onChange } = this.props;
const { state } = this;

View File

@ -80,7 +80,7 @@ export default class NumberType extends Component<NumberTypeProps> {
return nextProps.knob.value !== knob.value;
}
handleChange = (event: ChangeEvent<HTMLInputElement>) => {
private handleChange = (event: ChangeEvent<HTMLInputElement>) => {
const { onChange } = this.props;
const { value } = event.target;

View File

@ -59,14 +59,14 @@ class RadiosType extends Component<RadiosTypeProps> {
static deserialize = (value: RadiosTypeKnobValue) => value;
renderRadioButtonList({ options }: RadiosTypeKnob) {
private renderRadioButtonList({ options }: RadiosTypeKnob) {
if (Array.isArray(options)) {
return options.map((val) => this.renderRadioButton(val, val));
}
return Object.keys(options).map((key) => this.renderRadioButton(key, options[key]));
}
renderRadioButton(label: string, value: RadiosTypeKnobValue) {
private renderRadioButton(label: string, value: RadiosTypeKnobValue) {
const opts = { label, value };
const { onChange, knob } = this.props;
const { name } = knob;

View File

@ -32,7 +32,7 @@ export default class TextType extends Component<TextTypeProps> {
return nextProps.knob.value !== knob.value;
}
handleChange = (event: ChangeEvent<HTMLTextAreaElement>) => {
private handleChange = (event: ChangeEvent<HTMLTextAreaElement>) => {
const { onChange } = this.props;
const { value } = event.target;