@atlaskit/user-picker 9.2.2 → 9.3.2

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,23 @@
1
1
  # @atlaskit/user-picker
2
2
 
3
+ ## 9.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade Typescript from `4.2.4` to `4.3.5`.
8
+
9
+ ## 9.3.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [`fd025cbb820`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fd025cbb820) - [ux] Fix input cursor position relative to the placeholder
14
+
15
+ ## 9.3.0
16
+
17
+ ### Minor Changes
18
+
19
+ - [`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.
20
+
3
21
  ## 9.2.2
4
22
 
5
23
  ### 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
  }
@@ -29,10 +29,14 @@ var ExternalUserSourcesContainer = function ExternalUserSourcesContainer(_ref) {
29
29
  }
30
30
 
31
31
  return _react.default.Children.map(children, function (child) {
32
- return /*#__PURE__*/_react.default.cloneElement(child, {
33
- sources: sources,
34
- sourcesLoading: sourcesLoading
35
- });
32
+ return (
33
+ /*#__PURE__*/
34
+ // @ts-expect-error
35
+ _react.default.cloneElement(child, {
36
+ sources: sources,
37
+ sourcesLoading: sourcesLoading
38
+ })
39
+ );
36
40
  });
37
41
  };
38
42
 
@@ -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
  }
@@ -39,7 +39,6 @@ var INDICATOR_WIDTH = 39;
39
39
  exports.INDICATOR_WIDTH = INDICATOR_WIDTH;
40
40
  var TOTAL_PADDING_TAG_TO_CONTAINER = 10;
41
41
  var TAG_MARGIN_WIDTH = 4;
42
- var PLACEHOLDER_MARGIN = 2;
43
42
  var getStyles = (0, _memoizeOne.default)(function (width, isMulti, overrideStyles) {
44
43
  var styles = {
45
44
  menu: function menu(css, state) {
@@ -172,7 +171,6 @@ var getStyles = (0, _memoizeOne.default)(function (width, isMulti, overrideStyle
172
171
  /* Necessary to make input height and tag height the same. */
173
172
  marginBottom: TAG_MARGIN_WIDTH,
174
173
  marginTop: TAG_MARGIN_WIDTH,
175
- marginLeft: PLACEHOLDER_MARGIN,
176
174
 
177
175
  /* Padding top and bottom of 2 is set by default. */
178
176
  paddingTop: 0,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "9.2.2",
3
+ "version": "9.3.2",
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
  }
@@ -18,7 +18,10 @@ export const ExternalUserSourcesContainer = ({
18
18
  });
19
19
  }
20
20
 
21
- return React.Children.map(children, child => /*#__PURE__*/React.cloneElement(child, {
21
+ return React.Children.map(children, child =>
22
+ /*#__PURE__*/
23
+ // @ts-expect-error
24
+ React.cloneElement(child, {
22
25
  sources,
23
26
  sourcesLoading
24
27
  }));
@@ -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
  }
@@ -9,7 +9,6 @@ export const AVATAR_PADDING = 6;
9
9
  export const INDICATOR_WIDTH = 39;
10
10
  const TOTAL_PADDING_TAG_TO_CONTAINER = 10;
11
11
  const TAG_MARGIN_WIDTH = 4;
12
- const PLACEHOLDER_MARGIN = 2;
13
12
  export const getStyles = memoizeOne((width, isMulti, overrideStyles) => {
14
13
  let styles = {
15
14
  menu: (css, state) => ({ ...css,
@@ -130,7 +129,6 @@ export const getStyles = memoizeOne((width, isMulti, overrideStyles) => {
130
129
  /* Necessary to make input height and tag height the same. */
131
130
  marginBottom: TAG_MARGIN_WIDTH,
132
131
  marginTop: TAG_MARGIN_WIDTH,
133
- marginLeft: PLACEHOLDER_MARGIN,
134
132
 
135
133
  /* Padding top and bottom of 2 is set by default. */
136
134
  paddingTop: 0,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "9.2.2",
3
+ "version": "9.3.2",
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
  }
@@ -18,9 +18,13 @@ export var ExternalUserSourcesContainer = function ExternalUserSourcesContainer(
18
18
  }
19
19
 
20
20
  return React.Children.map(children, function (child) {
21
- return /*#__PURE__*/React.cloneElement(child, {
22
- sources: sources,
23
- sourcesLoading: sourcesLoading
24
- });
21
+ return (
22
+ /*#__PURE__*/
23
+ // @ts-expect-error
24
+ React.cloneElement(child, {
25
+ sources: sources,
26
+ sourcesLoading: sourcesLoading
27
+ })
28
+ );
25
29
  });
26
30
  };
@@ -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
  }
@@ -19,7 +19,6 @@ export var AVATAR_PADDING = 6;
19
19
  export var INDICATOR_WIDTH = 39;
20
20
  var TOTAL_PADDING_TAG_TO_CONTAINER = 10;
21
21
  var TAG_MARGIN_WIDTH = 4;
22
- var PLACEHOLDER_MARGIN = 2;
23
22
  export var getStyles = memoizeOne(function (width, isMulti, overrideStyles) {
24
23
  var styles = {
25
24
  menu: function menu(css, state) {
@@ -155,7 +154,6 @@ export var getStyles = memoizeOne(function (width, isMulti, overrideStyles) {
155
154
  /* Necessary to make input height and tag height the same. */
156
155
  marginBottom: TAG_MARGIN_WIDTH,
157
156
  marginTop: TAG_MARGIN_WIDTH,
158
- marginLeft: PLACEHOLDER_MARGIN,
159
157
 
160
158
  /* Padding top and bottom of 2 is set by default. */
161
159
  paddingTop: 0,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "9.2.2",
3
+ "version": "9.3.2",
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.2",
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.6.0",
36
36
  "@atlaskit/spinner": "^15.1.4",
37
37
  "@atlaskit/theme": "^12.1.0",
38
38
  "@atlaskit/tokens": "^0.10.0",
@@ -73,7 +73,7 @@
73
73
  "faker": "^4.1.0",
74
74
  "mock-apollo-client": "^0.1.0",
75
75
  "react-intl-next": "npm:react-intl@^5.18.1",
76
- "typescript": "4.2.4"
76
+ "typescript": "4.3.5"
77
77
  },
78
78
  "techstack": {
79
79
  "@repo/internal": {
package/report.api.md CHANGED
@@ -1,6 +1,8 @@
1
- ## API Report File for "@atlaskit/user-picker"
1
+ ## API Report File for "@atlaskit/user-picker".
2
2
 
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
3
+ > Do not edit this file. This report is auto-generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
4
6
 
5
7
  ```ts
6
8
  import { Placement } from '@atlaskit/popper';