baseui 0.0.0-next-6bede4f → 0.0.0-next-e047a0a

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,6 +19,7 @@ class Textarea extends React.Component<TextareaPropsT, { isFocused: boolean }> {
19
19
  static defaultProps = {
20
20
  autoFocus: false,
21
21
  disabled: false,
22
+ readOnly: false,
22
23
  error: false,
23
24
  name: '',
24
25
  onBlur: () => {},
@@ -35,17 +36,21 @@ class Textarea extends React.Component<TextareaPropsT, { isFocused: boolean }> {
35
36
  };
36
37
 
37
38
  state = {
38
- isFocused: this.props.autoFocus || false,
39
+ isFocused: (this.props.autoFocus && !this.props.readOnly) || false,
39
40
  };
40
41
 
41
42
  onFocus = (e: SyntheticFocusEvent<HTMLTextAreaElement>) => {
42
- this.setState({ isFocused: true });
43
- this.props.onFocus(e);
43
+ if (!this.props.readOnly) {
44
+ this.setState({ isFocused: true });
45
+ this.props.onFocus(e);
46
+ }
44
47
  };
45
48
 
46
49
  onBlur = (e: SyntheticFocusEvent<HTMLTextAreaElement>) => {
47
- this.setState({ isFocused: false });
48
- this.props.onBlur(e);
50
+ if (!this.props.readOnly) {
51
+ this.setState({ isFocused: false });
52
+ this.props.onBlur(e);
53
+ }
49
54
  };
50
55
 
51
56
  render() {
@@ -63,6 +68,7 @@ class Textarea extends React.Component<TextareaPropsT, { isFocused: boolean }> {
63
68
  <Root
64
69
  data-baseweb="textarea"
65
70
  $isFocused={this.state.isFocused}
71
+ $isReadOnly={this.props.readOnly}
66
72
  $disabled={this.props.disabled}
67
73
  $error={this.props.error}
68
74
  $positive={this.props.positive}
@@ -20,6 +20,7 @@ export type SharedStylePropsT = {
20
20
  $disabled: boolean,
21
21
  $error: boolean,
22
22
  $isFocused: boolean,
23
+ $isReadOnly: boolean,
23
24
  $positive?: boolean,
24
25
  $required: boolean,
25
26
  $size: SizeT,