@atlaskit/user-picker 9.2.2 → 9.3.0

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/user-picker
2
2
 
3
+ ## 9.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`bc0b47732f8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bc0b47732f8) - [ux] Fix bug where user picker input is not being unfocused when disableInput is set. The new behavior will enable you to still focus on the input but not interact with it, unless it is to delete selected users.
8
+
3
9
  ## 9.2.2
4
10
 
5
11
  ### Patch Changes
@@ -152,7 +152,8 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
152
152
  });
153
153
 
154
154
  _this.setState({
155
- value: remainingValues ? remainingValues : []
155
+ value: remainingValues ? remainingValues : [],
156
+ menuIsOpen: true
156
157
  });
157
158
  }
158
159
 
@@ -366,8 +367,7 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
366
367
 
367
368
  if (event.keyCode === 32 && !_this.state.inputValue) {
368
369
  event.preventDefault();
369
-
370
- _this.setState({
370
+ !_this.props.disableInput && _this.setState({
371
371
  inputValue: ' '
372
372
  });
373
373
  }
@@ -582,6 +582,10 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
582
582
  value: function getDerivedStateFromProps(nextProps, prevState) {
583
583
  var derivedState = {};
584
584
 
585
+ if (nextProps.isDisabled || nextProps.disableInput) {
586
+ derivedState.menuIsOpen = false;
587
+ }
588
+
585
589
  if (nextProps.open !== undefined) {
586
590
  derivedState.menuIsOpen = nextProps.open;
587
591
  }
@@ -47,9 +47,15 @@ var Input = /*#__PURE__*/function (_React$Component) {
47
47
 
48
48
  _this = _super.call.apply(_super, [this].concat(args));
49
49
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleKeyPress", function (e) {
50
+ var _this$props$selectPro;
51
+
50
52
  if (e.key === 'Enter') {
51
53
  e.preventDefault();
52
54
  }
55
+
56
+ if ((_this$props$selectPro = _this.props.selectProps) !== null && _this$props$selectPro !== void 0 && _this$props$selectPro.disableInput) {
57
+ e.preventDefault();
58
+ }
53
59
  });
54
60
  return _this;
55
61
  }
@@ -57,10 +63,8 @@ var Input = /*#__PURE__*/function (_React$Component) {
57
63
  (0, _createClass2.default)(Input, [{
58
64
  key: "render",
59
65
  value: function render() {
60
- var selectProps = this.props.selectProps;
61
66
  return /*#__PURE__*/_react.default.createElement(_select.components.Input, (0, _extends2.default)({}, this.props, {
62
67
  innerRef: this.props.innerRef,
63
- isDisabled: selectProps && selectProps.disableInput,
64
68
  onKeyPress: this.handleKeyPress
65
69
  }));
66
70
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "9.2.2",
3
+ "version": "9.3.0",
4
4
  "sideEffects": false
5
5
  }
@@ -18,6 +18,10 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
18
18
  static getDerivedStateFromProps(nextProps, prevState) {
19
19
  const derivedState = {};
20
20
 
21
+ if (nextProps.isDisabled || nextProps.disableInput) {
22
+ derivedState.menuIsOpen = false;
23
+ }
24
+
21
25
  if (nextProps.open !== undefined) {
22
26
  derivedState.menuIsOpen = nextProps.open;
23
27
  }
@@ -119,7 +123,8 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
119
123
  if (removedValue && this.state.value && Array.isArray(this.state.value)) {
120
124
  const remainingValues = this.state.value.filter(val => val.data.id !== removedValue.data.id);
121
125
  this.setState({
122
- value: remainingValues ? remainingValues : []
126
+ value: remainingValues ? remainingValues : [],
127
+ menuIsOpen: true
123
128
  });
124
129
  }
125
130
 
@@ -324,7 +329,7 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
324
329
 
325
330
  if (event.keyCode === 32 && !this.state.inputValue) {
326
331
  event.preventDefault();
327
- this.setState({
332
+ !this.props.disableInput && this.setState({
328
333
  inputValue: ' '
329
334
  });
330
335
  }
@@ -7,19 +7,21 @@ export class Input extends React.Component {
7
7
  super(...args);
8
8
 
9
9
  _defineProperty(this, "handleKeyPress", e => {
10
+ var _this$props$selectPro;
11
+
10
12
  if (e.key === 'Enter') {
11
13
  e.preventDefault();
12
14
  }
15
+
16
+ if ((_this$props$selectPro = this.props.selectProps) !== null && _this$props$selectPro !== void 0 && _this$props$selectPro.disableInput) {
17
+ e.preventDefault();
18
+ }
13
19
  });
14
20
  }
15
21
 
16
22
  render() {
17
- const {
18
- selectProps
19
- } = this.props;
20
23
  return /*#__PURE__*/React.createElement(components.Input, _extends({}, this.props, {
21
24
  innerRef: this.props.innerRef,
22
- isDisabled: selectProps && selectProps.disableInput,
23
25
  onKeyPress: this.handleKeyPress
24
26
  }));
25
27
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "9.2.2",
3
+ "version": "9.3.0",
4
4
  "sideEffects": false
5
5
  }
@@ -135,7 +135,8 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
135
135
  });
136
136
 
137
137
  _this.setState({
138
- value: remainingValues ? remainingValues : []
138
+ value: remainingValues ? remainingValues : [],
139
+ menuIsOpen: true
139
140
  });
140
141
  }
141
142
 
@@ -364,8 +365,7 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
364
365
 
365
366
  if (event.keyCode === 32 && !_this.state.inputValue) {
366
367
  event.preventDefault();
367
-
368
- _this.setState({
368
+ !_this.props.disableInput && _this.setState({
369
369
  inputValue: ' '
370
370
  });
371
371
  }
@@ -584,6 +584,10 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
584
584
  value: function getDerivedStateFromProps(nextProps, prevState) {
585
585
  var derivedState = {};
586
586
 
587
+ if (nextProps.isDisabled || nextProps.disableInput) {
588
+ derivedState.menuIsOpen = false;
589
+ }
590
+
587
591
  if (nextProps.open !== undefined) {
588
592
  derivedState.menuIsOpen = nextProps.open;
589
593
  }
@@ -30,9 +30,15 @@ export var Input = /*#__PURE__*/function (_React$Component) {
30
30
  _this = _super.call.apply(_super, [this].concat(args));
31
31
 
32
32
  _defineProperty(_assertThisInitialized(_this), "handleKeyPress", function (e) {
33
+ var _this$props$selectPro;
34
+
33
35
  if (e.key === 'Enter') {
34
36
  e.preventDefault();
35
37
  }
38
+
39
+ if ((_this$props$selectPro = _this.props.selectProps) !== null && _this$props$selectPro !== void 0 && _this$props$selectPro.disableInput) {
40
+ e.preventDefault();
41
+ }
36
42
  });
37
43
 
38
44
  return _this;
@@ -41,10 +47,8 @@ export var Input = /*#__PURE__*/function (_React$Component) {
41
47
  _createClass(Input, [{
42
48
  key: "render",
43
49
  value: function render() {
44
- var selectProps = this.props.selectProps;
45
50
  return /*#__PURE__*/React.createElement(components.Input, _extends({}, this.props, {
46
51
  innerRef: this.props.innerRef,
47
- isDisabled: selectProps && selectProps.disableInput,
48
52
  onKeyPress: this.handleKeyPress
49
53
  }));
50
54
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "9.2.2",
3
+ "version": "9.3.0",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "9.2.2",
3
+ "version": "9.3.0",
4
4
  "description": "Fabric component for display a dropdown to select a user from",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -32,7 +32,7 @@
32
32
  "@atlaskit/logo": "^13.8.0",
33
33
  "@atlaskit/lozenge": "^11.0.0",
34
34
  "@atlaskit/popper": "^5.0.0",
35
- "@atlaskit/select": "^15.3.0",
35
+ "@atlaskit/select": "^15.4.0",
36
36
  "@atlaskit/spinner": "^15.1.4",
37
37
  "@atlaskit/theme": "^12.1.0",
38
38
  "@atlaskit/tokens": "^0.10.0",