@atlaskit/select 15.3.2 → 15.6.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 +29 -0
- package/dist/cjs/CountrySelect.js +18 -41
- package/dist/cjs/PopupSelect/PopupSelect.js +20 -34
- package/dist/cjs/Select.js +1 -1
- package/dist/cjs/createSelect.js +3 -2
- package/dist/cjs/index.js +14 -2
- package/dist/cjs/styles.js +36 -11
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/CountrySelect.js +11 -20
- package/dist/es2019/PopupSelect/PopupSelect.js +12 -27
- package/dist/es2019/Select.js +1 -1
- package/dist/es2019/createSelect.js +2 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/styles.js +36 -11
- package/dist/es2019/version.json +1 -1
- package/dist/esm/CountrySelect.js +18 -42
- package/dist/esm/PopupSelect/PopupSelect.js +19 -35
- package/dist/esm/Select.js +1 -1
- package/dist/esm/createSelect.js +3 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/styles.js +36 -11
- 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/dist/types/index.d.ts +2 -2
- package/dist/types/styles.d.ts +1 -1
- package/dist/types/types.d.ts +1 -0
- package/package.json +6 -4
- package/report.api.md +710 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @atlaskit/select
|
|
2
2
|
|
|
3
|
+
## 15.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`68cc8008851`](https://bitbucket.org/atlassian/atlassian-frontend/commits/68cc8008851) - [ux] Introduces appearance prop to component, with 'default', 'subtle' and 'none' variants
|
|
8
|
+
|
|
9
|
+
## 15.5.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`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)
|
|
14
|
+
- [`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).
|
|
15
|
+
|
|
16
|
+
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.
|
|
17
|
+
|
|
18
|
+
- [`6e6ff42cd4c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6e6ff42cd4c) - Replaces focus-trap with react-focus-lock in line with implementation in Jira Frontend.
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- [`1c4840e546a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1c4840e546a) - fix popup select alignment bug
|
|
23
|
+
- [`dec5021eefd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/dec5021eefd) - [ux] Trigger onMenuClose prop when popup select closes.
|
|
24
|
+
- [`fe575d49d66`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fe575d49d66) - Updated styles to use new input design tokens
|
|
25
|
+
|
|
26
|
+
## 15.4.0
|
|
27
|
+
|
|
28
|
+
### Minor Changes
|
|
29
|
+
|
|
30
|
+
- [`4609a8a733a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4609a8a733a) - Made SelectWithoutAnalytics component and InputActionMeta type available from @atlaskit/select
|
|
31
|
+
|
|
3
32
|
## 15.3.2
|
|
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
|
-
|
|
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,13 +116,12 @@ 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);
|
|
123
122
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "unbindWindowClick", null);
|
|
124
123
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "unbindWindowKeydown", null);
|
|
125
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "defaultStyles", (0, _reactSelect.mergeStyles)((0, _styles.default)(_this.props.validationState, _this.props.spacing === 'compact'), {
|
|
124
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "defaultStyles", (0, _reactSelect.mergeStyles)((0, _styles.default)(_this.props.validationState, _this.props.spacing === 'compact', 'default'), {
|
|
126
125
|
groupHeading: function groupHeading(provided) {
|
|
127
126
|
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
128
127
|
color: "var(--ds-text-subtlest, ".concat(_colors.N80, ")")
|
|
@@ -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.6.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/createSelect.js
CHANGED
|
@@ -41,7 +41,7 @@ var defaultComponents = _interopRequireWildcard(require("./components"));
|
|
|
41
41
|
|
|
42
42
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
43
43
|
|
|
44
|
-
var _excluded = ["styles", "validationState", "spacing", "isMulti"];
|
|
44
|
+
var _excluded = ["styles", "validationState", "spacing", "isMulti", "appearance"];
|
|
45
45
|
|
|
46
46
|
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); }
|
|
47
47
|
|
|
@@ -119,6 +119,7 @@ function createSelect(WrappedComponent) {
|
|
|
119
119
|
validationState = _this$props.validationState,
|
|
120
120
|
spacing = _this$props.spacing,
|
|
121
121
|
isMulti = _this$props.isMulti,
|
|
122
|
+
appearance = _this$props.appearance,
|
|
122
123
|
props = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
|
|
123
124
|
var isCompact = spacing === 'compact'; // props must be spread first to stop `components` being overridden
|
|
124
125
|
|
|
@@ -128,7 +129,7 @@ function createSelect(WrappedComponent) {
|
|
|
128
129
|
"aria-live": "assertive"
|
|
129
130
|
}, props, {
|
|
130
131
|
components: this.components,
|
|
131
|
-
styles: (0, _reactSelect.mergeStyles)((0, _styles.default)(validationState, isCompact), styles)
|
|
132
|
+
styles: (0, _reactSelect.mergeStyles)((0, _styles.default)(validationState, isCompact, this.props.appearance || 'default'), styles)
|
|
132
133
|
}));
|
|
133
134
|
}
|
|
134
135
|
}]);
|
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 =
|
|
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; }
|
package/dist/cjs/styles.js
CHANGED
|
@@ -21,7 +21,7 @@ var BORDER_WIDTH = 2;
|
|
|
21
21
|
var ICON_PADDING = 2;
|
|
22
22
|
var paddingExcludingBorder = (0, _constants.gridSize)() - BORDER_WIDTH;
|
|
23
23
|
|
|
24
|
-
function baseStyles(validationState, isCompact) {
|
|
24
|
+
function baseStyles(validationState, isCompact, appearance) {
|
|
25
25
|
return {
|
|
26
26
|
container: function container(css, _ref) {
|
|
27
27
|
var isDisabled = _ref.isDisabled;
|
|
@@ -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
|
|
|
@@ -69,6 +69,20 @@ function baseStyles(validationState, isCompact) {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
var transitionDuration = '200ms';
|
|
72
|
+
|
|
73
|
+
if (appearance === 'subtle') {
|
|
74
|
+
borderColor = isFocused ? "var(--ds-border-focused, ".concat(_colors.B100, ")") : 'transparent';
|
|
75
|
+
backgroundColor = isFocused ? "var(--ds-surface, ".concat(_colors.N0, ")") : 'transparent';
|
|
76
|
+
backgroundColorHover = isFocused ? "var(--ds-surface, ".concat(_colors.N0, ")") : "var(--ds-surface, ".concat(_colors.N30, ")");
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (appearance === 'none') {
|
|
80
|
+
borderColor = 'transparent';
|
|
81
|
+
backgroundColor = 'transparent';
|
|
82
|
+
backgroundColorHover = 'transparent';
|
|
83
|
+
borderColorHover = 'transparent';
|
|
84
|
+
}
|
|
85
|
+
|
|
72
86
|
return _objectSpread(_objectSpread({}, css), {}, {
|
|
73
87
|
// Turn pointer events off when disabled - this makes it so hover etc don't work.
|
|
74
88
|
pointerEvents: isDisabled ? 'none' : undefined,
|
|
@@ -176,7 +190,7 @@ function baseStyles(validationState, isCompact) {
|
|
|
176
190
|
} else if (isSelected) {
|
|
177
191
|
backgroundColor = "var(--ds-background-selected, ".concat(_colors.B50, ")");
|
|
178
192
|
} else if (isFocused) {
|
|
179
|
-
backgroundColor = "var(--ds-background-
|
|
193
|
+
backgroundColor = "var(--ds-background-neutral-subtle-hovered, ".concat(_colors.N20, ")");
|
|
180
194
|
}
|
|
181
195
|
|
|
182
196
|
if (!isDisabled && (isFocused || isSelected)) {
|
|
@@ -228,11 +242,21 @@ function baseStyles(validationState, isCompact) {
|
|
|
228
242
|
var isFocused = _ref7.isFocused;
|
|
229
243
|
return _objectSpread(_objectSpread({}, css), {}, {
|
|
230
244
|
borderRadius: '2px',
|
|
231
|
-
backgroundColor: isFocused ? "var(--ds-background-selected, ".concat(_colors.N40, ")") : "var(--ds-background-neutral
|
|
245
|
+
backgroundColor: isFocused ? "var(--ds-background-selected, ".concat(_colors.N40, ")") : "var(--ds-background-neutral, ".concat(_colors.N40, ")"),
|
|
232
246
|
boxShadow: isFocused ? "0 0 0 2px ".concat("var(--ds-surface, transparent)", ", 0 0 0 4px ", "var(--ds-border-focused, transparent)") : 'none',
|
|
233
247
|
maxWidth: '100%',
|
|
234
248
|
'@media screen and (-ms-high-contrast: active)': {
|
|
235
249
|
border: isFocused ? '1px solid transparent' : 'none'
|
|
250
|
+
},
|
|
251
|
+
pointerEvents: 'none',
|
|
252
|
+
color: isFocused ? "var(--ds-text-selected, hsl(0, 0%, 20%))" : "var(--ds-text, hsl(0, 0%, 20%))",
|
|
253
|
+
':hover': {
|
|
254
|
+
backgroundColor: "var(--ds-background-danger-hovered, ".concat(_colors.N40, ")"),
|
|
255
|
+
color: "var(--ds-text-danger, inherit)"
|
|
256
|
+
},
|
|
257
|
+
':active': {
|
|
258
|
+
backgroundColor: "var(--ds-background-danger-pressed, ".concat(_colors.N40, ")"),
|
|
259
|
+
color: "var(--ds-text-danger, inherit)"
|
|
236
260
|
}
|
|
237
261
|
});
|
|
238
262
|
},
|
|
@@ -240,24 +264,25 @@ function baseStyles(validationState, isCompact) {
|
|
|
240
264
|
var isFocused = _ref8.isFocused;
|
|
241
265
|
return _objectSpread(_objectSpread({}, css), {}, {
|
|
242
266
|
padding: '2px',
|
|
243
|
-
color:
|
|
267
|
+
color: 'inherit',
|
|
244
268
|
paddingRight: '2px'
|
|
245
269
|
});
|
|
246
270
|
},
|
|
247
271
|
multiValueRemove: function multiValueRemove(css, _ref9) {
|
|
248
272
|
var isFocused = _ref9.isFocused;
|
|
249
273
|
return _objectSpread(_objectSpread({}, css), {}, {
|
|
250
|
-
|
|
274
|
+
pointerEvents: 'auto',
|
|
275
|
+
backgroundColor: isFocused && "var(--ds-UNSAFE_util-transparent, ".concat(_colors.R75, ")"),
|
|
251
276
|
fill: isFocused ? "var(--ds-text-selected, #000)" : "var(--ds-text, #000)",
|
|
252
277
|
paddingLeft: '2px',
|
|
253
278
|
paddingRight: '2px',
|
|
254
279
|
borderRadius: '0px 2px 2px 0px',
|
|
255
280
|
':hover': {
|
|
256
|
-
backgroundColor: "var(--ds-
|
|
281
|
+
backgroundColor: "var(--ds-UNSAFE_util-transparent, ".concat(_colors.R75, ")"),
|
|
257
282
|
fill: "var(--ds-text-danger, #000)"
|
|
258
283
|
},
|
|
259
284
|
':active': {
|
|
260
|
-
backgroundColor: "var(--ds-
|
|
285
|
+
backgroundColor: "var(--ds-UNSAFE_util-transparent, ".concat(_colors.R75, ")"),
|
|
261
286
|
fill: "var(--ds-text-danger, #000)"
|
|
262
287
|
}
|
|
263
288
|
});
|
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);
|
|
@@ -61,7 +59,7 @@ export default class PopupSelect extends PureComponent {
|
|
|
61
59
|
|
|
62
60
|
_defineProperty(this, "unbindWindowKeydown", null);
|
|
63
61
|
|
|
64
|
-
_defineProperty(this, "defaultStyles", mergeStyles(baseStyles(this.props.validationState, this.props.spacing === 'compact'), {
|
|
62
|
+
_defineProperty(this, "defaultStyles", mergeStyles(baseStyles(this.props.validationState, this.props.spacing === 'compact', 'default'), {
|
|
65
63
|
groupHeading: provided => ({ ...provided,
|
|
66
64
|
color: `var(--ds-text-subtlest, ${N80})`
|
|
67
65
|
})
|
|
@@ -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.6.0";
|
|
6
6
|
export const SelectWithoutAnalytics = createSelect(Select);
|
|
7
7
|
const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
8
8
|
export default withAnalyticsContext({
|
|
@@ -64,6 +64,7 @@ export default function createSelect(WrappedComponent) {
|
|
|
64
64
|
validationState,
|
|
65
65
|
spacing,
|
|
66
66
|
isMulti,
|
|
67
|
+
appearance,
|
|
67
68
|
...props
|
|
68
69
|
} = this.props;
|
|
69
70
|
const isCompact = spacing === 'compact'; // props must be spread first to stop `components` being overridden
|
|
@@ -74,7 +75,7 @@ export default function createSelect(WrappedComponent) {
|
|
|
74
75
|
"aria-live": "assertive"
|
|
75
76
|
}, props, {
|
|
76
77
|
components: this.components,
|
|
77
|
-
styles: mergeStyles(baseStyles(validationState, isCompact), styles)
|
|
78
|
+
styles: mergeStyles(baseStyles(validationState, isCompact, this.props.appearance || 'default'), styles)
|
|
78
79
|
}));
|
|
79
80
|
}
|
|
80
81
|
|
package/dist/es2019/index.js
CHANGED
|
@@ -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';
|