@atlaskit/select 15.4.0 → 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 +17 -0
- package/dist/cjs/CountrySelect.js +18 -41
- package/dist/cjs/PopupSelect/PopupSelect.js +19 -33
- package/dist/cjs/Select.js +1 -1
- package/dist/cjs/styles.js +21 -10
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/CountrySelect.js +11 -20
- package/dist/es2019/PopupSelect/PopupSelect.js +11 -26
- package/dist/es2019/Select.js +1 -1
- package/dist/es2019/styles.js +21 -10
- package/dist/es2019/version.json +1 -1
- package/dist/esm/CountrySelect.js +18 -42
- package/dist/esm/PopupSelect/PopupSelect.js +18 -34
- package/dist/esm/Select.js +1 -1
- package/dist/esm/styles.js +21 -10
- package/dist/esm/version.json +1 -1
- package/dist/types/CountrySelect.d.ts +4 -1
- package/dist/types/PopupSelect/PopupSelect.d.ts +0 -3
- package/dist/types/data/countries.d.ts +7 -4
- package/package.json +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
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
|
+
|
|
3
20
|
## 15.4.0
|
|
4
21
|
|
|
5
22
|
### Minor 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
|
-
|
|
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
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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:
|
|
34
|
+
css: labelStyles
|
|
45
35
|
}, (0, _core.jsx)("span", {
|
|
46
|
-
css:
|
|
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
|
-
},
|
|
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
|
-
}
|
|
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
|
|
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$
|
|
338
|
-
footer = _this$
|
|
339
|
-
maxMenuWidth = _this$
|
|
340
|
-
minMenuWidth = _this$
|
|
341
|
-
target = _this$
|
|
342
|
-
props = (0, _objectWithoutProperties2.default)(_this$
|
|
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);
|
package/dist/cjs/Select.js
CHANGED
|
@@ -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.
|
|
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/styles.js
CHANGED
|
@@ -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-
|
|
46
|
-
var backgroundColorHover = isFocused ? "var(--ds-
|
|
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-
|
|
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-
|
|
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
|
|
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:
|
|
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
|
-
|
|
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-
|
|
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-
|
|
271
|
+
backgroundColor: "var(--ds-UNSAFE_util-transparent, ".concat(_colors.R75, ")"),
|
|
261
272
|
fill: "var(--ds-text-danger, #000)"
|
|
262
273
|
}
|
|
263
274
|
});
|
package/dist/cjs/version.json
CHANGED
|
@@ -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
|
|
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:
|
|
22
|
+
css: labelStyles
|
|
25
23
|
}, jsx("span", {
|
|
26
|
-
css:
|
|
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
|
-
},
|
|
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
|
-
}
|
|
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
|
});
|
package/dist/es2019/Select.js
CHANGED
|
@@ -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.
|
|
5
|
+
const packageVersion = "15.5.0";
|
|
6
6
|
export const SelectWithoutAnalytics = createSelect(Select);
|
|
7
7
|
const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
8
8
|
export default withAnalyticsContext({
|
package/dist/es2019/styles.js
CHANGED
|
@@ -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-
|
|
26
|
-
let backgroundColorHover = isFocused ? `var(--ds-
|
|
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-
|
|
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-
|
|
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
|
|
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:
|
|
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
|
-
|
|
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-
|
|
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-
|
|
239
|
+
backgroundColor: `var(--ds-UNSAFE_util-transparent, ${R75})`,
|
|
229
240
|
fill: "var(--ds-text-danger, #000)"
|
|
230
241
|
}
|
|
231
242
|
})
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,38 +1,27 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
|
|
4
|
-
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; }
|
|
5
|
-
|
|
6
|
-
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) { _defineProperty(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; }
|
|
7
2
|
|
|
8
3
|
/** @jsx jsx */
|
|
9
|
-
import { jsx } from '@emotion/core';
|
|
4
|
+
import { jsx, css } from '@emotion/core';
|
|
10
5
|
import { groupedCountries } from './data/countries';
|
|
11
6
|
import Select from './Select';
|
|
12
|
-
|
|
13
7
|
// custom option renderer
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return {
|
|
24
|
-
fontSize: '18px',
|
|
25
|
-
marginRight: '8px'
|
|
26
|
-
};
|
|
27
|
-
};
|
|
8
|
+
var labelStyles = css({
|
|
9
|
+
alignItems: 'center',
|
|
10
|
+
display: 'flex',
|
|
11
|
+
lineHeight: 1.2
|
|
12
|
+
});
|
|
13
|
+
var flagStyles = css({
|
|
14
|
+
fontSize: '18px',
|
|
15
|
+
marginRight: '8px'
|
|
16
|
+
});
|
|
28
17
|
|
|
29
18
|
var Opt = function Opt(_ref) {
|
|
30
19
|
var children = _ref.children,
|
|
31
20
|
icon = _ref.icon;
|
|
32
21
|
return jsx("div", {
|
|
33
|
-
css:
|
|
22
|
+
css: labelStyles
|
|
34
23
|
}, jsx("span", {
|
|
35
|
-
css:
|
|
24
|
+
css: flagStyles
|
|
36
25
|
}, icon), children);
|
|
37
26
|
}; // return the country name; used for searching
|
|
38
27
|
|
|
@@ -64,7 +53,11 @@ var optionLabel = function optionLabel(_ref3) {
|
|
|
64
53
|
name = _ref3.name;
|
|
65
54
|
return jsx(Opt, {
|
|
66
55
|
icon: icon
|
|
67
|
-
},
|
|
56
|
+
}, getOptionLabel({
|
|
57
|
+
abbr: abbr,
|
|
58
|
+
code: code,
|
|
59
|
+
name: name
|
|
60
|
+
}));
|
|
68
61
|
}; // switch formatters based on render context (menu | value)
|
|
69
62
|
|
|
70
63
|
|
|
@@ -81,24 +74,7 @@ var CountrySelect = function CountrySelect(props) {
|
|
|
81
74
|
getOptionLabel: getOptionLabel,
|
|
82
75
|
getOptionValue: getOptionValue,
|
|
83
76
|
isMulti: false,
|
|
84
|
-
options: groupedCountries
|
|
85
|
-
styles: {
|
|
86
|
-
container: function container(css) {
|
|
87
|
-
return _objectSpread(_objectSpread({}, css), {}, {
|
|
88
|
-
width: 105
|
|
89
|
-
});
|
|
90
|
-
},
|
|
91
|
-
dropdownIndicator: function dropdownIndicator(css) {
|
|
92
|
-
return _objectSpread(_objectSpread({}, css), {}, {
|
|
93
|
-
paddingLeft: 0
|
|
94
|
-
});
|
|
95
|
-
},
|
|
96
|
-
menu: function menu(css) {
|
|
97
|
-
return _objectSpread(_objectSpread({}, css), {}, {
|
|
98
|
-
width: 300
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
}
|
|
77
|
+
options: groupedCountries
|
|
102
78
|
}, props));
|
|
103
79
|
};
|
|
104
80
|
|
|
@@ -19,9 +19,9 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
19
19
|
|
|
20
20
|
import React, { PureComponent } from 'react';
|
|
21
21
|
import { createPortal } from 'react-dom';
|
|
22
|
+
import FocusLock from 'react-focus-lock';
|
|
22
23
|
import Select, { mergeStyles } from 'react-select';
|
|
23
24
|
import { uid } from 'react-uid';
|
|
24
|
-
import createFocusTrap from 'focus-trap';
|
|
25
25
|
import { Manager, Reference, Popper } from 'react-popper';
|
|
26
26
|
import NodeResolver from 'react-node-resolver';
|
|
27
27
|
import shallowEqualObjects from 'shallow-equal/objects';
|
|
@@ -82,8 +82,6 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
82
82
|
|
|
83
83
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
84
84
|
|
|
85
|
-
_defineProperty(_assertThisInitialized(_this), "focusTrap", null);
|
|
86
|
-
|
|
87
85
|
_defineProperty(_assertThisInitialized(_this), "menuRef", null);
|
|
88
86
|
|
|
89
87
|
_defineProperty(_assertThisInitialized(_this), "selectRef", null);
|
|
@@ -182,7 +180,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
182
180
|
|
|
183
181
|
_this.setState({
|
|
184
182
|
isOpen: true
|
|
185
|
-
}
|
|
183
|
+
});
|
|
186
184
|
|
|
187
185
|
if (_this.selectRef) {
|
|
188
186
|
_this.selectRef.select.openMenu('first'); // HACK
|
|
@@ -202,28 +200,12 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
202
200
|
});
|
|
203
201
|
});
|
|
204
202
|
|
|
205
|
-
_defineProperty(_assertThisInitialized(_this), "initialiseFocusTrap", function () {
|
|
206
|
-
if (!_this.menuRef) {
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
var trapConfig = {
|
|
211
|
-
clickOutsideDeactivates: true,
|
|
212
|
-
escapeDeactivates: true,
|
|
213
|
-
fallbackFocus: _this.menuRef,
|
|
214
|
-
returnFocusOnDeactivate: true
|
|
215
|
-
};
|
|
216
|
-
_this.focusTrap = createFocusTrap(_this.menuRef, trapConfig); // allow time for the HTMLElement to render
|
|
217
|
-
|
|
218
|
-
setTimeout(function () {
|
|
219
|
-
return _this.focusTrap.activate();
|
|
220
|
-
}, 1);
|
|
221
|
-
});
|
|
222
|
-
|
|
223
203
|
_defineProperty(_assertThisInitialized(_this), "close", function (options) {
|
|
224
204
|
var _this$unbindWindowKey, _this2;
|
|
225
205
|
|
|
226
|
-
var
|
|
206
|
+
var _this$props2 = _this.props,
|
|
207
|
+
onClose = _this$props2.onClose,
|
|
208
|
+
onMenuClose = _this$props2.onMenuClose;
|
|
227
209
|
|
|
228
210
|
if (!(options !== null && options !== void 0 && options.controlOverride) && _this.isOpenControlled) {
|
|
229
211
|
// Prevent popup closing if it's open state is already being controlled
|
|
@@ -234,14 +216,14 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
234
216
|
onClose();
|
|
235
217
|
}
|
|
236
218
|
|
|
219
|
+
if (onMenuClose) {
|
|
220
|
+
onMenuClose();
|
|
221
|
+
}
|
|
222
|
+
|
|
237
223
|
_this.setState({
|
|
238
224
|
isOpen: false
|
|
239
225
|
});
|
|
240
226
|
|
|
241
|
-
if (_this.focusTrap) {
|
|
242
|
-
_this.focusTrap.deactivate();
|
|
243
|
-
}
|
|
244
|
-
|
|
245
227
|
if (_this.targetRef != null) {
|
|
246
228
|
_this.targetRef.focus();
|
|
247
229
|
}
|
|
@@ -323,12 +305,12 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
323
305
|
});
|
|
324
306
|
|
|
325
307
|
_defineProperty(_assertThisInitialized(_this), "renderSelect", function () {
|
|
326
|
-
var _this$
|
|
327
|
-
footer = _this$
|
|
328
|
-
maxMenuWidth = _this$
|
|
329
|
-
minMenuWidth = _this$
|
|
330
|
-
target = _this$
|
|
331
|
-
props = _objectWithoutProperties(_this$
|
|
308
|
+
var _this$props3 = _this.props,
|
|
309
|
+
footer = _this$props3.footer,
|
|
310
|
+
maxMenuWidth = _this$props3.maxMenuWidth,
|
|
311
|
+
minMenuWidth = _this$props3.minMenuWidth,
|
|
312
|
+
target = _this$props3.target,
|
|
313
|
+
props = _objectWithoutProperties(_this$props3, _excluded);
|
|
332
314
|
|
|
333
315
|
var _this$state = _this.state,
|
|
334
316
|
isOpen = _this$state.isOpen,
|
|
@@ -359,6 +341,8 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
359
341
|
minWidth: minMenuWidth,
|
|
360
342
|
maxWidth: maxMenuWidth,
|
|
361
343
|
id: _this.popperWrapperId
|
|
344
|
+
}, /*#__PURE__*/React.createElement(FocusLock, {
|
|
345
|
+
returnFocus: true
|
|
362
346
|
}, /*#__PURE__*/React.createElement(Select, _extends({
|
|
363
347
|
backspaceRemovesValue: false,
|
|
364
348
|
controlShouldRenderValue: false,
|
|
@@ -372,7 +356,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
372
356
|
maxMenuHeight: _this.getMaxHeight(),
|
|
373
357
|
components: components,
|
|
374
358
|
onChange: _this.handleSelectChange
|
|
375
|
-
})), footer));
|
|
359
|
+
})), footer)));
|
|
376
360
|
});
|
|
377
361
|
return mergedPopperProps.strategy === 'fixed' ? popper : /*#__PURE__*/createPortal(popper, portalDestination);
|
|
378
362
|
});
|
package/dist/esm/Select.js
CHANGED
|
@@ -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
|
var packageName = "@atlaskit/select";
|
|
5
|
-
var packageVersion = "15.
|
|
5
|
+
var packageVersion = "15.5.0";
|
|
6
6
|
export var SelectWithoutAnalytics = createSelect(Select);
|
|
7
7
|
var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
8
8
|
export default withAnalyticsContext({
|
package/dist/esm/styles.js
CHANGED
|
@@ -29,12 +29,12 @@ export default function baseStyles(validationState, isCompact) {
|
|
|
29
29
|
control: function control(css, _ref2) {
|
|
30
30
|
var isFocused = _ref2.isFocused,
|
|
31
31
|
isDisabled = _ref2.isDisabled;
|
|
32
|
-
var borderColor = isFocused ? "var(--ds-border-focused, ".concat(B100, ")") : "var(--ds-border, ".concat(N20, ")");
|
|
33
|
-
var backgroundColor = isFocused ? "var(--ds-
|
|
34
|
-
var backgroundColorHover = isFocused ? "var(--ds-
|
|
32
|
+
var borderColor = isFocused ? "var(--ds-border-focused, ".concat(B100, ")") : "var(--ds-border-input, ".concat(N20, ")");
|
|
33
|
+
var backgroundColor = isFocused ? "var(--ds-background-input-pressed, ".concat(N0, ")") : "var(--ds-background-input, ".concat(N20, ")");
|
|
34
|
+
var backgroundColorHover = isFocused ? "var(--ds-background-input-pressed, ".concat(N0, ")") : "var(--ds-background-input-hovered, ".concat(N30, ")");
|
|
35
35
|
|
|
36
36
|
if (isDisabled) {
|
|
37
|
-
backgroundColor = "var(--ds-background-
|
|
37
|
+
backgroundColor = "var(--ds-background-disabled, ".concat(N20, ")");
|
|
38
38
|
borderColor = "var(--ds-background-disabled, ".concat(N20, ")");
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -164,7 +164,7 @@ export default function baseStyles(validationState, isCompact) {
|
|
|
164
164
|
} else if (isSelected) {
|
|
165
165
|
backgroundColor = "var(--ds-background-selected, ".concat(B50, ")");
|
|
166
166
|
} else if (isFocused) {
|
|
167
|
-
backgroundColor = "var(--ds-background-
|
|
167
|
+
backgroundColor = "var(--ds-background-neutral-subtle-hovered, ".concat(N20, ")");
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
if (!isDisabled && (isFocused || isSelected)) {
|
|
@@ -216,11 +216,21 @@ export default function baseStyles(validationState, isCompact) {
|
|
|
216
216
|
var isFocused = _ref7.isFocused;
|
|
217
217
|
return _objectSpread(_objectSpread({}, css), {}, {
|
|
218
218
|
borderRadius: '2px',
|
|
219
|
-
backgroundColor: isFocused ? "var(--ds-background-selected, ".concat(N40, ")") : "var(--ds-background-neutral
|
|
219
|
+
backgroundColor: isFocused ? "var(--ds-background-selected, ".concat(N40, ")") : "var(--ds-background-neutral, ".concat(N40, ")"),
|
|
220
220
|
boxShadow: isFocused ? "0 0 0 2px ".concat("var(--ds-surface, transparent)", ", 0 0 0 4px ", "var(--ds-border-focused, transparent)") : 'none',
|
|
221
221
|
maxWidth: '100%',
|
|
222
222
|
'@media screen and (-ms-high-contrast: active)': {
|
|
223
223
|
border: isFocused ? '1px solid transparent' : 'none'
|
|
224
|
+
},
|
|
225
|
+
pointerEvents: 'none',
|
|
226
|
+
color: isFocused ? "var(--ds-text-selected, hsl(0, 0%, 20%))" : "var(--ds-text, hsl(0, 0%, 20%))",
|
|
227
|
+
':hover': {
|
|
228
|
+
backgroundColor: "var(--ds-background-danger-hovered, ".concat(N40, ")"),
|
|
229
|
+
color: "var(--ds-text-danger, inherit)"
|
|
230
|
+
},
|
|
231
|
+
':active': {
|
|
232
|
+
backgroundColor: "var(--ds-background-danger-pressed, ".concat(N40, ")"),
|
|
233
|
+
color: "var(--ds-text-danger, inherit)"
|
|
224
234
|
}
|
|
225
235
|
});
|
|
226
236
|
},
|
|
@@ -228,24 +238,25 @@ export default function baseStyles(validationState, isCompact) {
|
|
|
228
238
|
var isFocused = _ref8.isFocused;
|
|
229
239
|
return _objectSpread(_objectSpread({}, css), {}, {
|
|
230
240
|
padding: '2px',
|
|
231
|
-
color:
|
|
241
|
+
color: 'inherit',
|
|
232
242
|
paddingRight: '2px'
|
|
233
243
|
});
|
|
234
244
|
},
|
|
235
245
|
multiValueRemove: function multiValueRemove(css, _ref9) {
|
|
236
246
|
var isFocused = _ref9.isFocused;
|
|
237
247
|
return _objectSpread(_objectSpread({}, css), {}, {
|
|
238
|
-
|
|
248
|
+
pointerEvents: 'auto',
|
|
249
|
+
backgroundColor: isFocused && "var(--ds-UNSAFE_util-transparent, ".concat(R75, ")"),
|
|
239
250
|
fill: isFocused ? "var(--ds-text-selected, #000)" : "var(--ds-text, #000)",
|
|
240
251
|
paddingLeft: '2px',
|
|
241
252
|
paddingRight: '2px',
|
|
242
253
|
borderRadius: '0px 2px 2px 0px',
|
|
243
254
|
':hover': {
|
|
244
|
-
backgroundColor: "var(--ds-
|
|
255
|
+
backgroundColor: "var(--ds-UNSAFE_util-transparent, ".concat(R75, ")"),
|
|
245
256
|
fill: "var(--ds-text-danger, #000)"
|
|
246
257
|
},
|
|
247
258
|
':active': {
|
|
248
|
-
backgroundColor: "var(--ds-
|
|
259
|
+
backgroundColor: "var(--ds-UNSAFE_util-transparent, ".concat(R75, ")"),
|
|
249
260
|
fill: "var(--ds-text-danger, #000)"
|
|
250
261
|
}
|
|
251
262
|
});
|
package/dist/esm/version.json
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
import { groupedCountries } from './data/countries';
|
|
3
|
+
import { SelectProps } from './types';
|
|
4
|
+
declare type Country = typeof groupedCountries[number]['options'][number];
|
|
5
|
+
declare const CountrySelect: (props: SelectProps<Country>) => JSX.Element;
|
|
3
6
|
export default CountrySelect;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { PureComponent, ReactNode } from 'react';
|
|
2
2
|
import Select from 'react-select';
|
|
3
|
-
import { FocusTrap } from 'focus-trap';
|
|
4
3
|
import { PopperProps } from 'react-popper';
|
|
5
4
|
import { OptionType, ActionMeta, ReactSelectProps, StylesConfig, ValueType } from '../types';
|
|
6
5
|
import { UnbindFn } from 'bind-event-listener';
|
|
@@ -67,7 +66,6 @@ interface State<Modifiers = string> {
|
|
|
67
66
|
mergedPopperProps: PopperPropsNoChildren<defaultModifiers | Modifiers>;
|
|
68
67
|
}
|
|
69
68
|
export default class PopupSelect<Option = OptionType, IsMulti extends boolean = false> extends PureComponent<PopupSelectProps<Option, IsMulti>, State> {
|
|
70
|
-
focusTrap: FocusTrap | null;
|
|
71
69
|
menuRef: HTMLElement | null;
|
|
72
70
|
selectRef: Select<Option, IsMulti> | null;
|
|
73
71
|
targetRef: HTMLElement | null;
|
|
@@ -112,7 +110,6 @@ export default class PopupSelect<Option = OptionType, IsMulti extends boolean =
|
|
|
112
110
|
open: (options?: {
|
|
113
111
|
controlOverride?: boolean | undefined;
|
|
114
112
|
} | undefined) => void;
|
|
115
|
-
initialiseFocusTrap: () => void;
|
|
116
113
|
/**
|
|
117
114
|
* Closes the popup
|
|
118
115
|
*
|
|
@@ -6,8 +6,11 @@ interface Country {
|
|
|
6
6
|
suggested?: boolean;
|
|
7
7
|
}
|
|
8
8
|
export declare const allCountries: Array<Country>;
|
|
9
|
-
export declare const groupedCountries:
|
|
10
|
-
label:
|
|
11
|
-
options:
|
|
12
|
-
}
|
|
9
|
+
export declare const groupedCountries: readonly [{
|
|
10
|
+
readonly label: "Suggested";
|
|
11
|
+
readonly options: Country[];
|
|
12
|
+
}, {
|
|
13
|
+
readonly label: "All Countries";
|
|
14
|
+
readonly options: Country[];
|
|
15
|
+
}];
|
|
13
16
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/select",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.5.0",
|
|
4
4
|
"description": "Select allows users to make a single selection or multiple selections from a list of options.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"@popperjs/core": "^2.9.1",
|
|
36
36
|
"@types/react-select": "^4.0.18",
|
|
37
37
|
"bind-event-listener": "^2.1.1",
|
|
38
|
-
"focus-trap": "^2.4.5",
|
|
39
38
|
"memoize-one": "^6.0.0",
|
|
40
39
|
"react-fast-compare": "^3.2.0",
|
|
40
|
+
"react-focus-lock": "^2.5.2",
|
|
41
41
|
"react-node-resolver": "^1.0.1",
|
|
42
42
|
"react-popper": "^2.2.3",
|
|
43
43
|
"react-select": "^4.3.1",
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"@atlaskit/form": "^8.5.0",
|
|
57
57
|
"@atlaskit/logo": "^13.8.0",
|
|
58
58
|
"@atlaskit/modal-dialog": "^12.2.0",
|
|
59
|
+
"@atlaskit/radio": "^5.3.11",
|
|
59
60
|
"@atlaskit/section-message": "^6.0.0",
|
|
60
61
|
"@atlaskit/ssr": "*",
|
|
61
62
|
"@atlaskit/tooltip": "^17.5.0",
|
|
@@ -64,6 +65,7 @@
|
|
|
64
65
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
65
66
|
"@emotion/styled": "^10.0.7",
|
|
66
67
|
"@testing-library/react": "^8.0.1",
|
|
68
|
+
"@testing-library/user-event": "10.4.0",
|
|
67
69
|
"ast-types": "^0.13.3",
|
|
68
70
|
"enzyme": "^3.10.0",
|
|
69
71
|
"jscodeshift": "^0.13.0",
|