@atlaskit/select 15.3.1 → 15.5.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,34 @@
1
1
  # @atlaskit/select
2
2
 
3
+ ## 15.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`c17c6943be2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c17c6943be2) - Updated appearance of multi-select tags; when delete button is hovered, the appearance now matches @atlaskit/tag. The change is only visible with design token CSS enabled (in light or dark mode)
8
+ - [`45cae79ec0f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/45cae79ec0f) - [ux] Internal changes to <CountrySelect /> to no longer override container and menu width. The behaviour is now the same as the default Select component. Visual changes are possible if the <CountrySelect /> is being used in an unconstrained container (it will now expand to fill as is the default).
9
+
10
+ Component now also uses the correct types (previously set to `any`). Props are still passed through so there is no runtime effect, but this may effect compilation for users providing props that are unsupported by the runtime.
11
+
12
+ - [`6e6ff42cd4c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6e6ff42cd4c) - Replaces focus-trap with react-focus-lock in line with implementation in Jira Frontend.
13
+
14
+ ### Patch Changes
15
+
16
+ - [`1c4840e546a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1c4840e546a) - fix popup select alignment bug
17
+ - [`dec5021eefd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/dec5021eefd) - [ux] Trigger onMenuClose prop when popup select closes.
18
+ - [`fe575d49d66`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fe575d49d66) - Updated styles to use new input design tokens
19
+
20
+ ## 15.4.0
21
+
22
+ ### Minor Changes
23
+
24
+ - [`4609a8a733a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4609a8a733a) - Made SelectWithoutAnalytics component and InputActionMeta type available from @atlaskit/select
25
+
26
+ ## 15.3.2
27
+
28
+ ### Patch Changes
29
+
30
+ - [`8a5bdb3c844`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8a5bdb3c844) - Upgrading internal dependency (bind-event-listener) for improved internal types
31
+
3
32
  ## 15.3.1
4
33
 
5
34
  ### Patch Changes
@@ -9,41 +9,31 @@ exports.default = void 0;
9
9
 
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
 
12
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
-
14
12
  var _core = require("@emotion/core");
15
13
 
16
14
  var _countries = require("./data/countries");
17
15
 
18
16
  var _Select = _interopRequireDefault(require("./Select"));
19
17
 
20
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
21
-
22
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
23
-
18
+ /** @jsx jsx */
24
19
  // custom option renderer
25
- var labelCSS = function labelCSS() {
26
- return {
27
- alignItems: 'center',
28
- display: 'flex',
29
- lineHeight: 1.2
30
- };
31
- };
32
-
33
- var flagCSS = function flagCSS() {
34
- return {
35
- fontSize: '18px',
36
- marginRight: '8px'
37
- };
38
- };
20
+ var labelStyles = (0, _core.css)({
21
+ alignItems: 'center',
22
+ display: 'flex',
23
+ lineHeight: 1.2
24
+ });
25
+ var flagStyles = (0, _core.css)({
26
+ fontSize: '18px',
27
+ marginRight: '8px'
28
+ });
39
29
 
40
30
  var Opt = function Opt(_ref) {
41
31
  var children = _ref.children,
42
32
  icon = _ref.icon;
43
33
  return (0, _core.jsx)("div", {
44
- css: labelCSS()
34
+ css: labelStyles
45
35
  }, (0, _core.jsx)("span", {
46
- css: flagCSS()
36
+ css: flagStyles
47
37
  }, icon), children);
48
38
  }; // return the country name; used for searching
49
39
 
@@ -75,7 +65,11 @@ var optionLabel = function optionLabel(_ref3) {
75
65
  name = _ref3.name;
76
66
  return (0, _core.jsx)(Opt, {
77
67
  icon: icon
78
- }, name, " (", abbr.toUpperCase(), ") +", code);
68
+ }, getOptionLabel({
69
+ abbr: abbr,
70
+ code: code,
71
+ name: name
72
+ }));
79
73
  }; // switch formatters based on render context (menu | value)
80
74
 
81
75
 
@@ -92,24 +86,7 @@ var CountrySelect = function CountrySelect(props) {
92
86
  getOptionLabel: getOptionLabel,
93
87
  getOptionValue: getOptionValue,
94
88
  isMulti: false,
95
- options: _countries.groupedCountries,
96
- styles: {
97
- container: function container(css) {
98
- return _objectSpread(_objectSpread({}, css), {}, {
99
- width: 105
100
- });
101
- },
102
- dropdownIndicator: function dropdownIndicator(css) {
103
- return _objectSpread(_objectSpread({}, css), {}, {
104
- paddingLeft: 0
105
- });
106
- },
107
- menu: function menu(css) {
108
- return _objectSpread(_objectSpread({}, css), {}, {
109
- width: 300
110
- });
111
- }
112
- }
89
+ options: _countries.groupedCountries
113
90
  }, props));
114
91
  };
115
92
 
@@ -31,12 +31,12 @@ var _react = _interopRequireWildcard(require("react"));
31
31
 
32
32
  var _reactDom = require("react-dom");
33
33
 
34
+ var _reactFocusLock = _interopRequireDefault(require("react-focus-lock"));
35
+
34
36
  var _reactSelect = _interopRequireWildcard(require("react-select"));
35
37
 
36
38
  var _reactUid = require("react-uid");
37
39
 
38
- var _focusTrap = _interopRequireDefault(require("focus-trap"));
39
-
40
40
  var _reactPopper = require("react-popper");
41
41
 
42
42
  var _reactNodeResolver = _interopRequireDefault(require("react-node-resolver"));
@@ -116,7 +116,6 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
116
116
  }
117
117
 
118
118
  _this = _super.call.apply(_super, [this].concat(args));
119
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "focusTrap", null);
120
119
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "menuRef", null);
121
120
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "selectRef", null);
122
121
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "targetRef", null);
@@ -202,7 +201,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
202
201
 
203
202
  _this.setState({
204
203
  isOpen: true
205
- }, _this.initialiseFocusTrap);
204
+ });
206
205
 
207
206
  if (_this.selectRef) {
208
207
  _this.selectRef.select.openMenu('first'); // HACK
@@ -221,27 +220,12 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
221
220
  }
222
221
  });
223
222
  });
224
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "initialiseFocusTrap", function () {
225
- if (!_this.menuRef) {
226
- return;
227
- }
228
-
229
- var trapConfig = {
230
- clickOutsideDeactivates: true,
231
- escapeDeactivates: true,
232
- fallbackFocus: _this.menuRef,
233
- returnFocusOnDeactivate: true
234
- };
235
- _this.focusTrap = (0, _focusTrap.default)(_this.menuRef, trapConfig); // allow time for the HTMLElement to render
236
-
237
- setTimeout(function () {
238
- return _this.focusTrap.activate();
239
- }, 1);
240
- });
241
223
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "close", function (options) {
242
224
  var _this$unbindWindowKey, _this2;
243
225
 
244
- var onClose = _this.props.onClose;
226
+ var _this$props2 = _this.props,
227
+ onClose = _this$props2.onClose,
228
+ onMenuClose = _this$props2.onMenuClose;
245
229
 
246
230
  if (!(options !== null && options !== void 0 && options.controlOverride) && _this.isOpenControlled) {
247
231
  // Prevent popup closing if it's open state is already being controlled
@@ -252,14 +236,14 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
252
236
  onClose();
253
237
  }
254
238
 
239
+ if (onMenuClose) {
240
+ onMenuClose();
241
+ }
242
+
255
243
  _this.setState({
256
244
  isOpen: false
257
245
  });
258
246
 
259
- if (_this.focusTrap) {
260
- _this.focusTrap.deactivate();
261
- }
262
-
263
247
  if (_this.targetRef != null) {
264
248
  _this.targetRef.focus();
265
249
  }
@@ -334,12 +318,12 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
334
318
  return _this.getItemCount() > searchThreshold;
335
319
  });
336
320
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderSelect", function () {
337
- var _this$props2 = _this.props,
338
- footer = _this$props2.footer,
339
- maxMenuWidth = _this$props2.maxMenuWidth,
340
- minMenuWidth = _this$props2.minMenuWidth,
341
- target = _this$props2.target,
342
- props = (0, _objectWithoutProperties2.default)(_this$props2, _excluded);
321
+ var _this$props3 = _this.props,
322
+ footer = _this$props3.footer,
323
+ maxMenuWidth = _this$props3.maxMenuWidth,
324
+ minMenuWidth = _this$props3.minMenuWidth,
325
+ target = _this$props3.target,
326
+ props = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
343
327
  var _this$state = _this.state,
344
328
  isOpen = _this$state.isOpen,
345
329
  mergedComponents = _this$state.mergedComponents,
@@ -369,6 +353,8 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
369
353
  minWidth: minMenuWidth,
370
354
  maxWidth: maxMenuWidth,
371
355
  id: _this.popperWrapperId
356
+ }, /*#__PURE__*/_react.default.createElement(_reactFocusLock.default, {
357
+ returnFocus: true
372
358
  }, /*#__PURE__*/_react.default.createElement(_reactSelect.default, (0, _extends2.default)({
373
359
  backspaceRemovesValue: false,
374
360
  controlShouldRenderValue: false,
@@ -382,7 +368,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
382
368
  maxMenuHeight: _this.getMaxHeight(),
383
369
  components: components,
384
370
  onChange: _this.handleSelectChange
385
- })), footer));
371
+ })), footer)));
386
372
  });
387
373
 
388
374
  return mergedPopperProps.strategy === 'fixed' ? popper : /*#__PURE__*/(0, _reactDom.createPortal)(popper, portalDestination);
@@ -14,7 +14,7 @@ var _analyticsNext = require("@atlaskit/analytics-next");
14
14
  var _createSelect = _interopRequireDefault(require("./createSelect"));
15
15
 
16
16
  var packageName = "@atlaskit/select";
17
- var packageVersion = "15.3.1";
17
+ var packageVersion = "15.5.0";
18
18
  var SelectWithoutAnalytics = (0, _createSelect.default)(_reactSelect.default);
19
19
  exports.SelectWithoutAnalytics = SelectWithoutAnalytics;
20
20
  var createAndFireEventOnAtlaskit = (0, _analyticsNext.createAndFireEvent)('atlaskit');
package/dist/cjs/index.js CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
 
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
5
7
  Object.defineProperty(exports, "__esModule", {
6
8
  value: true
7
9
  });
@@ -59,6 +61,12 @@ Object.defineProperty(exports, "RadioSelect", {
59
61
  return _RadioSelect.default;
60
62
  }
61
63
  });
64
+ Object.defineProperty(exports, "SelectWithoutAnalytics", {
65
+ enumerable: true,
66
+ get: function get() {
67
+ return _Select.SelectWithoutAnalytics;
68
+ }
69
+ });
62
70
  Object.defineProperty(exports, "components", {
63
71
  enumerable: true,
64
72
  get: function get() {
@@ -104,7 +112,7 @@ var _creatable = require("react-select/creatable");
104
112
 
105
113
  var _inputOptions = require("./components/input-options");
106
114
 
107
- var _Select = _interopRequireDefault(require("./Select"));
115
+ var _Select = _interopRequireWildcard(require("./Select"));
108
116
 
109
117
  var _AsyncSelect = _interopRequireDefault(require("./AsyncSelect"));
110
118
 
@@ -118,4 +126,8 @@ var _CreatableSelect = _interopRequireDefault(require("./CreatableSelect"));
118
126
 
119
127
  var _AsyncCreatableSelect = _interopRequireDefault(require("./AsyncCreatableSelect"));
120
128
 
121
- var _PopupSelect = _interopRequireDefault(require("./PopupSelect"));
129
+ var _PopupSelect = _interopRequireDefault(require("./PopupSelect"));
130
+
131
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
132
+
133
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -41,12 +41,12 @@ function baseStyles(validationState, isCompact) {
41
41
  control: function control(css, _ref2) {
42
42
  var isFocused = _ref2.isFocused,
43
43
  isDisabled = _ref2.isDisabled;
44
- var borderColor = isFocused ? "var(--ds-border-focused, ".concat(_colors.B100, ")") : "var(--ds-border, ".concat(_colors.N20, ")");
45
- var backgroundColor = isFocused ? "var(--ds-surface, ".concat(_colors.N0, ")") : "var(--ds-background-neutral, ".concat(_colors.N20, ")");
46
- var backgroundColorHover = isFocused ? "var(--ds-surface, ".concat(_colors.N0, ")") : "var(--ds-surface, ".concat(_colors.N30, ")");
44
+ var borderColor = isFocused ? "var(--ds-border-focused, ".concat(_colors.B100, ")") : "var(--ds-border-input, ".concat(_colors.N20, ")");
45
+ var backgroundColor = isFocused ? "var(--ds-background-input-pressed, ".concat(_colors.N0, ")") : "var(--ds-background-input, ".concat(_colors.N20, ")");
46
+ var backgroundColorHover = isFocused ? "var(--ds-background-input-pressed, ".concat(_colors.N0, ")") : "var(--ds-background-input-hovered, ".concat(_colors.N30, ")");
47
47
 
48
48
  if (isDisabled) {
49
- backgroundColor = "var(--ds-background-neutral, ".concat(_colors.N20, ")");
49
+ backgroundColor = "var(--ds-background-disabled, ".concat(_colors.N20, ")");
50
50
  borderColor = "var(--ds-background-disabled, ".concat(_colors.N20, ")");
51
51
  }
52
52
 
@@ -176,7 +176,7 @@ function baseStyles(validationState, isCompact) {
176
176
  } else if (isSelected) {
177
177
  backgroundColor = "var(--ds-background-selected, ".concat(_colors.B50, ")");
178
178
  } else if (isFocused) {
179
- backgroundColor = "var(--ds-background-input-pressed, ".concat(_colors.N20, ")");
179
+ backgroundColor = "var(--ds-background-neutral-subtle-hovered, ".concat(_colors.N20, ")");
180
180
  }
181
181
 
182
182
  if (!isDisabled && (isFocused || isSelected)) {
@@ -228,11 +228,21 @@ function baseStyles(validationState, isCompact) {
228
228
  var isFocused = _ref7.isFocused;
229
229
  return _objectSpread(_objectSpread({}, css), {}, {
230
230
  borderRadius: '2px',
231
- backgroundColor: isFocused ? "var(--ds-background-selected, ".concat(_colors.N40, ")") : "var(--ds-background-neutral-subtle-hovered, ".concat(_colors.N40, ")"),
231
+ backgroundColor: isFocused ? "var(--ds-background-selected, ".concat(_colors.N40, ")") : "var(--ds-background-neutral, ".concat(_colors.N40, ")"),
232
232
  boxShadow: isFocused ? "0 0 0 2px ".concat("var(--ds-surface, transparent)", ", 0 0 0 4px ", "var(--ds-border-focused, transparent)") : 'none',
233
233
  maxWidth: '100%',
234
234
  '@media screen and (-ms-high-contrast: active)': {
235
235
  border: isFocused ? '1px solid transparent' : 'none'
236
+ },
237
+ pointerEvents: 'none',
238
+ color: isFocused ? "var(--ds-text-selected, hsl(0, 0%, 20%))" : "var(--ds-text, hsl(0, 0%, 20%))",
239
+ ':hover': {
240
+ backgroundColor: "var(--ds-background-danger-hovered, ".concat(_colors.N40, ")"),
241
+ color: "var(--ds-text-danger, inherit)"
242
+ },
243
+ ':active': {
244
+ backgroundColor: "var(--ds-background-danger-pressed, ".concat(_colors.N40, ")"),
245
+ color: "var(--ds-text-danger, inherit)"
236
246
  }
237
247
  });
238
248
  },
@@ -240,24 +250,25 @@ function baseStyles(validationState, isCompact) {
240
250
  var isFocused = _ref8.isFocused;
241
251
  return _objectSpread(_objectSpread({}, css), {}, {
242
252
  padding: '2px',
243
- color: isFocused ? "var(--ds-text-selected, hsl(0, 0%, 20%))" : "var(--ds-text, hsl(0, 0%, 20%))",
253
+ color: 'inherit',
244
254
  paddingRight: '2px'
245
255
  });
246
256
  },
247
257
  multiValueRemove: function multiValueRemove(css, _ref9) {
248
258
  var isFocused = _ref9.isFocused;
249
259
  return _objectSpread(_objectSpread({}, css), {}, {
250
- backgroundColor: isFocused && "var(--ds-background-selected, ".concat(_colors.R75, ")"),
260
+ pointerEvents: 'auto',
261
+ backgroundColor: isFocused && "var(--ds-UNSAFE_util-transparent, ".concat(_colors.R75, ")"),
251
262
  fill: isFocused ? "var(--ds-text-selected, #000)" : "var(--ds-text, #000)",
252
263
  paddingLeft: '2px',
253
264
  paddingRight: '2px',
254
265
  borderRadius: '0px 2px 2px 0px',
255
266
  ':hover': {
256
- backgroundColor: "var(--ds-background-danger-hovered, ".concat(_colors.R75, ")"),
267
+ backgroundColor: "var(--ds-UNSAFE_util-transparent, ".concat(_colors.R75, ")"),
257
268
  fill: "var(--ds-text-danger, #000)"
258
269
  },
259
270
  ':active': {
260
- backgroundColor: "var(--ds-background-danger-pressed, ".concat(_colors.R75, ")"),
271
+ backgroundColor: "var(--ds-UNSAFE_util-transparent, ".concat(_colors.R75, ")"),
261
272
  fill: "var(--ds-text-danger, #000)"
262
273
  }
263
274
  });
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/select",
3
- "version": "15.3.1",
3
+ "version": "15.5.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,18 +1,16 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
- import { jsx } from '@emotion/core';
4
+ import { jsx, css } from '@emotion/core';
5
5
  import { groupedCountries } from './data/countries';
6
6
  import Select from './Select';
7
-
8
7
  // custom option renderer
9
- const labelCSS = () => ({
8
+ const labelStyles = css({
10
9
  alignItems: 'center',
11
10
  display: 'flex',
12
11
  lineHeight: 1.2
13
12
  });
14
-
15
- const flagCSS = () => ({
13
+ const flagStyles = css({
16
14
  fontSize: '18px',
17
15
  marginRight: '8px'
18
16
  });
@@ -21,9 +19,9 @@ const Opt = ({
21
19
  children,
22
20
  icon
23
21
  }) => jsx("div", {
24
- css: labelCSS()
22
+ css: labelStyles
25
23
  }, jsx("span", {
26
- css: flagCSS()
24
+ css: flagStyles
27
25
  }, icon), children); // return the country name; used for searching
28
26
 
29
27
 
@@ -49,7 +47,11 @@ const optionLabel = ({
49
47
  name
50
48
  }) => jsx(Opt, {
51
49
  icon: icon
52
- }, name, " (", abbr.toUpperCase(), ") +", code); // switch formatters based on render context (menu | value)
50
+ }, getOptionLabel({
51
+ abbr,
52
+ code,
53
+ name
54
+ })); // switch formatters based on render context (menu | value)
53
55
 
54
56
 
55
57
  const formatOptionLabel = (opt, {
@@ -63,18 +65,7 @@ const CountrySelect = props => jsx(Select, _extends({
63
65
  getOptionLabel: getOptionLabel,
64
66
  getOptionValue: getOptionValue,
65
67
  isMulti: false,
66
- options: groupedCountries,
67
- styles: {
68
- container: css => ({ ...css,
69
- width: 105
70
- }),
71
- dropdownIndicator: css => ({ ...css,
72
- paddingLeft: 0
73
- }),
74
- menu: css => ({ ...css,
75
- width: 300
76
- })
77
- }
68
+ options: groupedCountries
78
69
  }, props));
79
70
 
80
71
  export default CountrySelect;
@@ -2,9 +2,9 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import React, { PureComponent } from 'react';
4
4
  import { createPortal } from 'react-dom';
5
+ import FocusLock from 'react-focus-lock';
5
6
  import Select, { mergeStyles } from 'react-select';
6
7
  import { uid } from 'react-uid';
7
- import createFocusTrap from 'focus-trap';
8
8
  import { Manager, Reference, Popper } from 'react-popper';
9
9
  import NodeResolver from 'react-node-resolver';
10
10
  import shallowEqualObjects from 'shallow-equal/objects';
@@ -49,8 +49,6 @@ export default class PopupSelect extends PureComponent {
49
49
 
50
50
  super(...args);
51
51
 
52
- _defineProperty(this, "focusTrap", null);
53
-
54
52
  _defineProperty(this, "menuRef", null);
55
53
 
56
54
  _defineProperty(this, "selectRef", null);
@@ -152,7 +150,7 @@ export default class PopupSelect extends PureComponent {
152
150
 
153
151
  this.setState({
154
152
  isOpen: true
155
- }, this.initialiseFocusTrap);
153
+ });
156
154
 
157
155
  if (this.selectRef) {
158
156
  this.selectRef.select.openMenu('first'); // HACK
@@ -171,27 +169,12 @@ export default class PopupSelect extends PureComponent {
171
169
  });
172
170
  });
173
171
 
174
- _defineProperty(this, "initialiseFocusTrap", () => {
175
- if (!this.menuRef) {
176
- return;
177
- }
178
-
179
- const trapConfig = {
180
- clickOutsideDeactivates: true,
181
- escapeDeactivates: true,
182
- fallbackFocus: this.menuRef,
183
- returnFocusOnDeactivate: true
184
- };
185
- this.focusTrap = createFocusTrap(this.menuRef, trapConfig); // allow time for the HTMLElement to render
186
-
187
- setTimeout(() => this.focusTrap.activate(), 1);
188
- });
189
-
190
172
  _defineProperty(this, "close", options => {
191
173
  var _this$unbindWindowKey;
192
174
 
193
175
  const {
194
- onClose
176
+ onClose,
177
+ onMenuClose
195
178
  } = this.props;
196
179
 
197
180
  if (!(options !== null && options !== void 0 && options.controlOverride) && this.isOpenControlled) {
@@ -203,14 +186,14 @@ export default class PopupSelect extends PureComponent {
203
186
  onClose();
204
187
  }
205
188
 
189
+ if (onMenuClose) {
190
+ onMenuClose();
191
+ }
192
+
206
193
  this.setState({
207
194
  isOpen: false
208
195
  });
209
196
 
210
- if (this.focusTrap) {
211
- this.focusTrap.deactivate();
212
- }
213
-
214
197
  if (this.targetRef != null) {
215
198
  this.targetRef.focus();
216
199
  }
@@ -328,6 +311,8 @@ export default class PopupSelect extends PureComponent {
328
311
  minWidth: minMenuWidth,
329
312
  maxWidth: maxMenuWidth,
330
313
  id: this.popperWrapperId
314
+ }, /*#__PURE__*/React.createElement(FocusLock, {
315
+ returnFocus: true
331
316
  }, /*#__PURE__*/React.createElement(Select, _extends({
332
317
  backspaceRemovesValue: false,
333
318
  controlShouldRenderValue: false,
@@ -343,7 +328,7 @@ export default class PopupSelect extends PureComponent {
343
328
  maxMenuHeight: this.getMaxHeight(),
344
329
  components: components,
345
330
  onChange: this.handleSelectChange
346
- })), footer));
331
+ })), footer)));
347
332
  });
348
333
  return mergedPopperProps.strategy === 'fixed' ? popper : /*#__PURE__*/createPortal(popper, portalDestination);
349
334
  });
@@ -2,7 +2,7 @@ import Select from 'react-select';
2
2
  import { withAnalyticsEvents, withAnalyticsContext, createAndFireEvent } from '@atlaskit/analytics-next';
3
3
  import createSelect from './createSelect';
4
4
  const packageName = "@atlaskit/select";
5
- const packageVersion = "15.3.1";
5
+ const packageVersion = "15.5.0";
6
6
  export const SelectWithoutAnalytics = createSelect(Select);
7
7
  const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
8
8
  export default withAnalyticsContext({
@@ -2,7 +2,7 @@ export { components, createFilter, mergeStyles } from 'react-select';
2
2
  export { makeAsyncSelect } from 'react-select/async';
3
3
  export { makeCreatableSelect } from 'react-select/creatable';
4
4
  export { CheckboxOption, RadioOption } from './components/input-options';
5
- export { default } from './Select';
5
+ export { default, SelectWithoutAnalytics } from './Select';
6
6
  export { default as AsyncSelect } from './AsyncSelect';
7
7
  export { default as CheckboxSelect } from './CheckboxSelect';
8
8
  export { default as CountrySelect } from './CountrySelect';
@@ -21,12 +21,12 @@ export default function baseStyles(validationState, isCompact) {
21
21
  isFocused,
22
22
  isDisabled
23
23
  }) => {
24
- let borderColor = isFocused ? `var(--ds-border-focused, ${B100})` : `var(--ds-border, ${N20})`;
25
- let backgroundColor = isFocused ? `var(--ds-surface, ${N0})` : `var(--ds-background-neutral, ${N20})`;
26
- let backgroundColorHover = isFocused ? `var(--ds-surface, ${N0})` : `var(--ds-surface, ${N30})`;
24
+ let borderColor = isFocused ? `var(--ds-border-focused, ${B100})` : `var(--ds-border-input, ${N20})`;
25
+ let backgroundColor = isFocused ? `var(--ds-background-input-pressed, ${N0})` : `var(--ds-background-input, ${N20})`;
26
+ let backgroundColorHover = isFocused ? `var(--ds-background-input-pressed, ${N0})` : `var(--ds-background-input-hovered, ${N30})`;
27
27
 
28
28
  if (isDisabled) {
29
- backgroundColor = `var(--ds-background-neutral, ${N20})`;
29
+ backgroundColor = `var(--ds-background-disabled, ${N20})`;
30
30
  borderColor = `var(--ds-background-disabled, ${N20})`;
31
31
  }
32
32
 
@@ -151,7 +151,7 @@ export default function baseStyles(validationState, isCompact) {
151
151
  } else if (isSelected) {
152
152
  backgroundColor = `var(--ds-background-selected, ${B50})`;
153
153
  } else if (isFocused) {
154
- backgroundColor = `var(--ds-background-input-pressed, ${N20})`;
154
+ backgroundColor = `var(--ds-background-neutral-subtle-hovered, ${N20})`;
155
155
  }
156
156
 
157
157
  if (!isDisabled && (isFocused || isSelected)) {
@@ -197,35 +197,46 @@ export default function baseStyles(validationState, isCompact) {
197
197
  isFocused
198
198
  }) => ({ ...css,
199
199
  borderRadius: '2px',
200
- backgroundColor: isFocused ? `var(--ds-background-selected, ${N40})` : `var(--ds-background-neutral-subtle-hovered, ${N40})`,
200
+ backgroundColor: isFocused ? `var(--ds-background-selected, ${N40})` : `var(--ds-background-neutral, ${N40})`,
201
201
  boxShadow: isFocused ? `0 0 0 2px ${"var(--ds-surface, transparent)"}, 0 0 0 4px ${"var(--ds-border-focused, transparent)"}` : 'none',
202
202
  maxWidth: '100%',
203
203
  '@media screen and (-ms-high-contrast: active)': {
204
204
  border: isFocused ? '1px solid transparent' : 'none'
205
+ },
206
+ pointerEvents: 'none',
207
+ color: isFocused ? "var(--ds-text-selected, hsl(0, 0%, 20%))" : "var(--ds-text, hsl(0, 0%, 20%))",
208
+ ':hover': {
209
+ backgroundColor: `var(--ds-background-danger-hovered, ${N40})`,
210
+ color: "var(--ds-text-danger, inherit)"
211
+ },
212
+ ':active': {
213
+ backgroundColor: `var(--ds-background-danger-pressed, ${N40})`,
214
+ color: "var(--ds-text-danger, inherit)"
205
215
  }
206
216
  }),
207
217
  multiValueLabel: (css, {
208
218
  isFocused
209
219
  }) => ({ ...css,
210
220
  padding: '2px',
211
- color: isFocused ? "var(--ds-text-selected, hsl(0, 0%, 20%))" : "var(--ds-text, hsl(0, 0%, 20%))",
221
+ color: 'inherit',
212
222
  paddingRight: '2px'
213
223
  }),
214
224
  multiValueRemove: (css, {
215
225
  // @ts-ignore: missing in @types/react-select
216
226
  isFocused
217
227
  }) => ({ ...css,
218
- backgroundColor: isFocused && `var(--ds-background-selected, ${R75})`,
228
+ pointerEvents: 'auto',
229
+ backgroundColor: isFocused && `var(--ds-UNSAFE_util-transparent, ${R75})`,
219
230
  fill: isFocused ? "var(--ds-text-selected, #000)" : "var(--ds-text, #000)",
220
231
  paddingLeft: '2px',
221
232
  paddingRight: '2px',
222
233
  borderRadius: '0px 2px 2px 0px',
223
234
  ':hover': {
224
- backgroundColor: `var(--ds-background-danger-hovered, ${R75})`,
235
+ backgroundColor: `var(--ds-UNSAFE_util-transparent, ${R75})`,
225
236
  fill: "var(--ds-text-danger, #000)"
226
237
  },
227
238
  ':active': {
228
- backgroundColor: `var(--ds-background-danger-pressed, ${R75})`,
239
+ backgroundColor: `var(--ds-UNSAFE_util-transparent, ${R75})`,
229
240
  fill: "var(--ds-text-danger, #000)"
230
241
  }
231
242
  })
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/select",
3
- "version": "15.3.1",
3
+ "version": "15.5.0",
4
4
  "sideEffects": false
5
5
  }