@atlaskit/select 15.3.0 → 15.3.1
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 +7 -0
- package/dist/cjs/PopupSelect/PopupSelect.js +31 -8
- package/dist/cjs/Select.js +1 -1
- package/dist/cjs/styles.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/PopupSelect/PopupSelect.js +29 -5
- package/dist/es2019/Select.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/PopupSelect/PopupSelect.js +32 -8
- package/dist/esm/Select.js +1 -1
- package/dist/esm/styles.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/PopupSelect/PopupSelect.d.ts +41 -0
- package/dist/types/PopupSelect/components.d.ts +2 -2
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/select
|
|
2
2
|
|
|
3
|
+
## 15.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`8f6f225ac11`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8f6f225ac11) - Updated prop types for Popup Select
|
|
8
|
+
- [`e4b612d1c48`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e4b612d1c48) - Internal migration to bind-event-listener for safer DOM Event cleanup
|
|
9
|
+
|
|
3
10
|
## 15.3.0
|
|
4
11
|
|
|
5
12
|
### Minor Changes
|
|
@@ -49,6 +49,8 @@ var _components = require("./components");
|
|
|
49
49
|
|
|
50
50
|
var _styles = _interopRequireDefault(require("../styles"));
|
|
51
51
|
|
|
52
|
+
var _bindEventListener = require("bind-event-listener");
|
|
53
|
+
|
|
52
54
|
var _excluded = ["footer", "maxMenuWidth", "minMenuWidth", "target"];
|
|
53
55
|
|
|
54
56
|
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); }
|
|
@@ -118,6 +120,8 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
118
120
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "menuRef", null);
|
|
119
121
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "selectRef", null);
|
|
120
122
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "targetRef", null);
|
|
123
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "unbindWindowClick", null);
|
|
124
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "unbindWindowKeydown", null);
|
|
121
125
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "defaultStyles", (0, _reactSelect.mergeStyles)((0, _styles.default)(_this.props.validationState, _this.props.spacing === 'compact'), {
|
|
122
126
|
groupHeading: function groupHeading(provided) {
|
|
123
127
|
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
@@ -209,7 +213,13 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
209
213
|
return;
|
|
210
214
|
}
|
|
211
215
|
|
|
212
|
-
|
|
216
|
+
_this.unbindWindowKeydown = (0, _bindEventListener.bind)(window, {
|
|
217
|
+
type: 'keydown',
|
|
218
|
+
listener: _this.handleKeyDown,
|
|
219
|
+
options: {
|
|
220
|
+
capture: true
|
|
221
|
+
}
|
|
222
|
+
});
|
|
213
223
|
});
|
|
214
224
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "initialiseFocusTrap", function () {
|
|
215
225
|
if (!_this.menuRef) {
|
|
@@ -229,6 +239,8 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
229
239
|
}, 1);
|
|
230
240
|
});
|
|
231
241
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "close", function (options) {
|
|
242
|
+
var _this$unbindWindowKey, _this2;
|
|
243
|
+
|
|
232
244
|
var onClose = _this.props.onClose;
|
|
233
245
|
|
|
234
246
|
if (!(options !== null && options !== void 0 && options.controlOverride) && _this.isOpenControlled) {
|
|
@@ -256,7 +268,8 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
256
268
|
return;
|
|
257
269
|
}
|
|
258
270
|
|
|
259
|
-
|
|
271
|
+
(_this$unbindWindowKey = (_this2 = _this).unbindWindowKeydown) === null || _this$unbindWindowKey === void 0 ? void 0 : _this$unbindWindowKey.call(_this2);
|
|
272
|
+
_this.unbindWindowKeydown = null;
|
|
260
273
|
});
|
|
261
274
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "resolveTargetRef", function (popperRef) {
|
|
262
275
|
return function (ref) {
|
|
@@ -384,17 +397,27 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
384
397
|
return;
|
|
385
398
|
}
|
|
386
399
|
|
|
387
|
-
|
|
400
|
+
this.unbindWindowClick = (0, _bindEventListener.bind)(window, {
|
|
401
|
+
type: 'click',
|
|
402
|
+
listener: this.handleClick,
|
|
403
|
+
options: {
|
|
404
|
+
capture: true
|
|
405
|
+
}
|
|
406
|
+
});
|
|
388
407
|
}
|
|
389
408
|
}, {
|
|
390
409
|
key: "componentWillUnmount",
|
|
391
410
|
value: function componentWillUnmount() {
|
|
411
|
+
var _this$unbindWindowCli, _this$unbindWindowKey2;
|
|
412
|
+
|
|
392
413
|
if (typeof window === 'undefined') {
|
|
393
414
|
return;
|
|
394
415
|
}
|
|
395
416
|
|
|
396
|
-
|
|
397
|
-
|
|
417
|
+
(_this$unbindWindowCli = this.unbindWindowClick) === null || _this$unbindWindowCli === void 0 ? void 0 : _this$unbindWindowCli.call(this);
|
|
418
|
+
this.unbindWindowClick = null;
|
|
419
|
+
(_this$unbindWindowKey2 = this.unbindWindowKeydown) === null || _this$unbindWindowKey2 === void 0 ? void 0 : _this$unbindWindowKey2.call(this);
|
|
420
|
+
this.unbindWindowKeydown = null;
|
|
398
421
|
}
|
|
399
422
|
}, {
|
|
400
423
|
key: "componentDidUpdate",
|
|
@@ -418,7 +441,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
418
441
|
}, {
|
|
419
442
|
key: "render",
|
|
420
443
|
value: function render() {
|
|
421
|
-
var
|
|
444
|
+
var _this3 = this;
|
|
422
445
|
|
|
423
446
|
var target = this.props.target;
|
|
424
447
|
var isOpen = this.state.isOpen;
|
|
@@ -426,10 +449,10 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
426
449
|
var ref = _ref3.ref;
|
|
427
450
|
return target && target({
|
|
428
451
|
isOpen: isOpen,
|
|
429
|
-
ref:
|
|
452
|
+
ref: _this3.resolveTargetRef(ref),
|
|
430
453
|
'aria-haspopup': 'true',
|
|
431
454
|
'aria-expanded': isOpen,
|
|
432
|
-
'aria-controls': isOpen ?
|
|
455
|
+
'aria-controls': isOpen ? _this3.popperWrapperId : undefined
|
|
433
456
|
});
|
|
434
457
|
}), this.renderSelect());
|
|
435
458
|
}
|
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.3.
|
|
17
|
+
var packageVersion = "15.3.1";
|
|
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
|
@@ -229,7 +229,7 @@ function baseStyles(validationState, isCompact) {
|
|
|
229
229
|
return _objectSpread(_objectSpread({}, css), {}, {
|
|
230
230
|
borderRadius: '2px',
|
|
231
231
|
backgroundColor: isFocused ? "var(--ds-background-selected, ".concat(_colors.N40, ")") : "var(--ds-background-neutral-subtle-hovered, ".concat(_colors.N40, ")"),
|
|
232
|
-
boxShadow: isFocused ? "0 0 0 2px ".concat("var(--ds-surface, transparent)", ", 0 0 0 4px "
|
|
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'
|
package/dist/cjs/version.json
CHANGED
|
@@ -11,6 +11,7 @@ import shallowEqualObjects from 'shallow-equal/objects';
|
|
|
11
11
|
import { N80 } from '@atlaskit/theme/colors';
|
|
12
12
|
import { MenuDialog, DummyControl, defaultComponents } from './components';
|
|
13
13
|
import baseStyles from '../styles';
|
|
14
|
+
import { bind } from 'bind-event-listener';
|
|
14
15
|
|
|
15
16
|
/** Are we rendering on the client or server? */
|
|
16
17
|
const canUseDOM = () => Boolean(typeof window !== 'undefined' && window.document && window.document.createElement); // ==============================
|
|
@@ -56,6 +57,10 @@ export default class PopupSelect extends PureComponent {
|
|
|
56
57
|
|
|
57
58
|
_defineProperty(this, "targetRef", null);
|
|
58
59
|
|
|
60
|
+
_defineProperty(this, "unbindWindowClick", null);
|
|
61
|
+
|
|
62
|
+
_defineProperty(this, "unbindWindowKeydown", null);
|
|
63
|
+
|
|
59
64
|
_defineProperty(this, "defaultStyles", mergeStyles(baseStyles(this.props.validationState, this.props.spacing === 'compact'), {
|
|
60
65
|
groupHeading: provided => ({ ...provided,
|
|
61
66
|
color: `var(--ds-text-subtlest, ${N80})`
|
|
@@ -157,7 +162,13 @@ export default class PopupSelect extends PureComponent {
|
|
|
157
162
|
return;
|
|
158
163
|
}
|
|
159
164
|
|
|
160
|
-
|
|
165
|
+
this.unbindWindowKeydown = bind(window, {
|
|
166
|
+
type: 'keydown',
|
|
167
|
+
listener: this.handleKeyDown,
|
|
168
|
+
options: {
|
|
169
|
+
capture: true
|
|
170
|
+
}
|
|
171
|
+
});
|
|
161
172
|
});
|
|
162
173
|
|
|
163
174
|
_defineProperty(this, "initialiseFocusTrap", () => {
|
|
@@ -177,6 +188,8 @@ export default class PopupSelect extends PureComponent {
|
|
|
177
188
|
});
|
|
178
189
|
|
|
179
190
|
_defineProperty(this, "close", options => {
|
|
191
|
+
var _this$unbindWindowKey;
|
|
192
|
+
|
|
180
193
|
const {
|
|
181
194
|
onClose
|
|
182
195
|
} = this.props;
|
|
@@ -206,7 +219,8 @@ export default class PopupSelect extends PureComponent {
|
|
|
206
219
|
return;
|
|
207
220
|
}
|
|
208
221
|
|
|
209
|
-
|
|
222
|
+
(_this$unbindWindowKey = this.unbindWindowKeydown) === null || _this$unbindWindowKey === void 0 ? void 0 : _this$unbindWindowKey.call(this);
|
|
223
|
+
this.unbindWindowKeydown = null;
|
|
210
224
|
});
|
|
211
225
|
|
|
212
226
|
_defineProperty(this, "resolveTargetRef", popperRef => ref => {
|
|
@@ -367,16 +381,26 @@ export default class PopupSelect extends PureComponent {
|
|
|
367
381
|
return;
|
|
368
382
|
}
|
|
369
383
|
|
|
370
|
-
|
|
384
|
+
this.unbindWindowClick = bind(window, {
|
|
385
|
+
type: 'click',
|
|
386
|
+
listener: this.handleClick,
|
|
387
|
+
options: {
|
|
388
|
+
capture: true
|
|
389
|
+
}
|
|
390
|
+
});
|
|
371
391
|
}
|
|
372
392
|
|
|
373
393
|
componentWillUnmount() {
|
|
394
|
+
var _this$unbindWindowCli, _this$unbindWindowKey2;
|
|
395
|
+
|
|
374
396
|
if (typeof window === 'undefined') {
|
|
375
397
|
return;
|
|
376
398
|
}
|
|
377
399
|
|
|
378
|
-
|
|
379
|
-
|
|
400
|
+
(_this$unbindWindowCli = this.unbindWindowClick) === null || _this$unbindWindowCli === void 0 ? void 0 : _this$unbindWindowCli.call(this);
|
|
401
|
+
this.unbindWindowClick = null;
|
|
402
|
+
(_this$unbindWindowKey2 = this.unbindWindowKeydown) === null || _this$unbindWindowKey2 === void 0 ? void 0 : _this$unbindWindowKey2.call(this);
|
|
403
|
+
this.unbindWindowKeydown = null;
|
|
380
404
|
}
|
|
381
405
|
|
|
382
406
|
componentDidUpdate(prevProps) {
|
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.3.
|
|
5
|
+
const packageVersion = "15.3.1";
|
|
6
6
|
export const SelectWithoutAnalytics = createSelect(Select);
|
|
7
7
|
const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
8
8
|
export default withAnalyticsContext({
|
package/dist/es2019/version.json
CHANGED
|
@@ -28,6 +28,7 @@ import shallowEqualObjects from 'shallow-equal/objects';
|
|
|
28
28
|
import { N80 } from '@atlaskit/theme/colors';
|
|
29
29
|
import { MenuDialog, DummyControl, defaultComponents } from './components';
|
|
30
30
|
import baseStyles from '../styles';
|
|
31
|
+
import { bind } from 'bind-event-listener';
|
|
31
32
|
|
|
32
33
|
/** Are we rendering on the client or server? */
|
|
33
34
|
var canUseDOM = function canUseDOM() {
|
|
@@ -89,6 +90,10 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
89
90
|
|
|
90
91
|
_defineProperty(_assertThisInitialized(_this), "targetRef", null);
|
|
91
92
|
|
|
93
|
+
_defineProperty(_assertThisInitialized(_this), "unbindWindowClick", null);
|
|
94
|
+
|
|
95
|
+
_defineProperty(_assertThisInitialized(_this), "unbindWindowKeydown", null);
|
|
96
|
+
|
|
92
97
|
_defineProperty(_assertThisInitialized(_this), "defaultStyles", mergeStyles(baseStyles(_this.props.validationState, _this.props.spacing === 'compact'), {
|
|
93
98
|
groupHeading: function groupHeading(provided) {
|
|
94
99
|
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
@@ -188,7 +193,13 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
188
193
|
return;
|
|
189
194
|
}
|
|
190
195
|
|
|
191
|
-
|
|
196
|
+
_this.unbindWindowKeydown = bind(window, {
|
|
197
|
+
type: 'keydown',
|
|
198
|
+
listener: _this.handleKeyDown,
|
|
199
|
+
options: {
|
|
200
|
+
capture: true
|
|
201
|
+
}
|
|
202
|
+
});
|
|
192
203
|
});
|
|
193
204
|
|
|
194
205
|
_defineProperty(_assertThisInitialized(_this), "initialiseFocusTrap", function () {
|
|
@@ -210,6 +221,8 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
210
221
|
});
|
|
211
222
|
|
|
212
223
|
_defineProperty(_assertThisInitialized(_this), "close", function (options) {
|
|
224
|
+
var _this$unbindWindowKey, _this2;
|
|
225
|
+
|
|
213
226
|
var onClose = _this.props.onClose;
|
|
214
227
|
|
|
215
228
|
if (!(options !== null && options !== void 0 && options.controlOverride) && _this.isOpenControlled) {
|
|
@@ -237,7 +250,8 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
237
250
|
return;
|
|
238
251
|
}
|
|
239
252
|
|
|
240
|
-
|
|
253
|
+
(_this$unbindWindowKey = (_this2 = _this).unbindWindowKeydown) === null || _this$unbindWindowKey === void 0 ? void 0 : _this$unbindWindowKey.call(_this2);
|
|
254
|
+
_this.unbindWindowKeydown = null;
|
|
241
255
|
});
|
|
242
256
|
|
|
243
257
|
_defineProperty(_assertThisInitialized(_this), "resolveTargetRef", function (popperRef) {
|
|
@@ -373,17 +387,27 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
373
387
|
return;
|
|
374
388
|
}
|
|
375
389
|
|
|
376
|
-
|
|
390
|
+
this.unbindWindowClick = bind(window, {
|
|
391
|
+
type: 'click',
|
|
392
|
+
listener: this.handleClick,
|
|
393
|
+
options: {
|
|
394
|
+
capture: true
|
|
395
|
+
}
|
|
396
|
+
});
|
|
377
397
|
}
|
|
378
398
|
}, {
|
|
379
399
|
key: "componentWillUnmount",
|
|
380
400
|
value: function componentWillUnmount() {
|
|
401
|
+
var _this$unbindWindowCli, _this$unbindWindowKey2;
|
|
402
|
+
|
|
381
403
|
if (typeof window === 'undefined') {
|
|
382
404
|
return;
|
|
383
405
|
}
|
|
384
406
|
|
|
385
|
-
|
|
386
|
-
|
|
407
|
+
(_this$unbindWindowCli = this.unbindWindowClick) === null || _this$unbindWindowCli === void 0 ? void 0 : _this$unbindWindowCli.call(this);
|
|
408
|
+
this.unbindWindowClick = null;
|
|
409
|
+
(_this$unbindWindowKey2 = this.unbindWindowKeydown) === null || _this$unbindWindowKey2 === void 0 ? void 0 : _this$unbindWindowKey2.call(this);
|
|
410
|
+
this.unbindWindowKeydown = null;
|
|
387
411
|
}
|
|
388
412
|
}, {
|
|
389
413
|
key: "componentDidUpdate",
|
|
@@ -407,7 +431,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
407
431
|
}, {
|
|
408
432
|
key: "render",
|
|
409
433
|
value: function render() {
|
|
410
|
-
var
|
|
434
|
+
var _this3 = this;
|
|
411
435
|
|
|
412
436
|
var target = this.props.target;
|
|
413
437
|
var isOpen = this.state.isOpen;
|
|
@@ -415,10 +439,10 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
415
439
|
var ref = _ref3.ref;
|
|
416
440
|
return target && target({
|
|
417
441
|
isOpen: isOpen,
|
|
418
|
-
ref:
|
|
442
|
+
ref: _this3.resolveTargetRef(ref),
|
|
419
443
|
'aria-haspopup': 'true',
|
|
420
444
|
'aria-expanded': isOpen,
|
|
421
|
-
'aria-controls': isOpen ?
|
|
445
|
+
'aria-controls': isOpen ? _this3.popperWrapperId : undefined
|
|
422
446
|
});
|
|
423
447
|
}), this.renderSelect());
|
|
424
448
|
}
|
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.3.
|
|
5
|
+
var packageVersion = "15.3.1";
|
|
6
6
|
export var SelectWithoutAnalytics = createSelect(Select);
|
|
7
7
|
var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
8
8
|
export default withAnalyticsContext({
|
package/dist/esm/styles.js
CHANGED
|
@@ -217,7 +217,7 @@ export default function baseStyles(validationState, isCompact) {
|
|
|
217
217
|
return _objectSpread(_objectSpread({}, css), {}, {
|
|
218
218
|
borderRadius: '2px',
|
|
219
219
|
backgroundColor: isFocused ? "var(--ds-background-selected, ".concat(N40, ")") : "var(--ds-background-neutral-subtle-hovered, ".concat(N40, ")"),
|
|
220
|
-
boxShadow: isFocused ? "0 0 0 2px ".concat("var(--ds-surface, transparent)", ", 0 0 0 4px "
|
|
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'
|
package/dist/esm/version.json
CHANGED
|
@@ -3,6 +3,7 @@ import Select from 'react-select';
|
|
|
3
3
|
import { FocusTrap } from 'focus-trap';
|
|
4
4
|
import { PopperProps } from 'react-popper';
|
|
5
5
|
import { OptionType, ActionMeta, ReactSelectProps, StylesConfig, ValueType } from '../types';
|
|
6
|
+
import { UnbindFn } from 'bind-event-listener';
|
|
6
7
|
declare type defaultModifiers = 'offset' | 'preventOverflow';
|
|
7
8
|
declare type PopperPropsNoChildren<Modifiers> = Omit<PopperProps<Modifiers>, 'children'>;
|
|
8
9
|
interface PopupSelectTriggerProps {
|
|
@@ -12,10 +13,48 @@ interface PopupSelectTriggerProps {
|
|
|
12
13
|
'aria-controls'?: string;
|
|
13
14
|
}
|
|
14
15
|
export interface PopupSelectProps<Option = OptionType, IsMulti extends boolean = false, Modifiers = string> extends ReactSelectProps<Option, IsMulti> {
|
|
16
|
+
/**
|
|
17
|
+
* Defines whether the menu should close when selected. Defaults to "true"
|
|
18
|
+
*/
|
|
15
19
|
closeMenuOnSelect?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* The footer content shown at the bottom of the Popup, underneath the Select options
|
|
22
|
+
*/
|
|
16
23
|
footer?: ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
The props passed down to React Popper.
|
|
26
|
+
|
|
27
|
+
Use these to override the default positioning strategy, behaviour and placement used by this library.
|
|
28
|
+
For more information, see the [React Popper documentation](https://popper.js.org/react-popper/v2/render-props).
|
|
29
|
+
|
|
30
|
+
*/
|
|
17
31
|
popperProps?: PopperPropsNoChildren<Modifiers>;
|
|
32
|
+
/**
|
|
33
|
+
* The maximum number of options the Select can contain without rendering the search field.
|
|
34
|
+
*/
|
|
18
35
|
searchThreshold?: number;
|
|
36
|
+
/**
|
|
37
|
+
* The maximum width for the popup menu. Can be a number, representing width in pixels,
|
|
38
|
+
* or a string containing a CSS length datatype.
|
|
39
|
+
*/
|
|
40
|
+
maxMenuWidth?: number | string;
|
|
41
|
+
/**
|
|
42
|
+
* The maximum width for the popup menu. Can be a number, representing width in pixels,
|
|
43
|
+
* or a string containing a CSS length datatype.
|
|
44
|
+
*/
|
|
45
|
+
minMenuWidth?: number | string;
|
|
46
|
+
/**
|
|
47
|
+
Render props used to anchor the popup to your content.
|
|
48
|
+
|
|
49
|
+
Make this an interactive element, such as an @atlaskit/button component.
|
|
50
|
+
|
|
51
|
+
The provided render props in `options` are detailed below:
|
|
52
|
+
- `isOpen`: The current state of the popup.
|
|
53
|
+
Use this to change the appearance of your target based on the state of your component
|
|
54
|
+
- `ref`: Pass this ref to the element the Popup should be attached to
|
|
55
|
+
- `aria-haspopup`, `aria-expanded`, `aria-controls`: Spread these onto a target element to
|
|
56
|
+
ensure your experience is accessible
|
|
57
|
+
*/
|
|
19
58
|
target?: (options: PopupSelectTriggerProps & {
|
|
20
59
|
isOpen: boolean;
|
|
21
60
|
}) => ReactNode;
|
|
@@ -32,6 +71,8 @@ export default class PopupSelect<Option = OptionType, IsMulti extends boolean =
|
|
|
32
71
|
menuRef: HTMLElement | null;
|
|
33
72
|
selectRef: Select<Option, IsMulti> | null;
|
|
34
73
|
targetRef: HTMLElement | null;
|
|
74
|
+
unbindWindowClick: UnbindFn | null;
|
|
75
|
+
unbindWindowKeydown: UnbindFn | null;
|
|
35
76
|
defaultStyles: StylesConfig<Option, IsMulti>;
|
|
36
77
|
isOpenControlled: boolean;
|
|
37
78
|
defaultOpenState: boolean | undefined;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { FC, ReactNode, CSSProperties } from 'react';
|
|
3
3
|
import { ControlProps, MenuProps, OptionType } from '../types';
|
|
4
4
|
interface MenuDialogProps {
|
|
5
|
-
maxWidth
|
|
6
|
-
minWidth
|
|
5
|
+
maxWidth?: number | string;
|
|
6
|
+
minWidth?: number | string;
|
|
7
7
|
style: CSSProperties;
|
|
8
8
|
children: ReactNode;
|
|
9
9
|
id: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/select",
|
|
3
|
-
"version": "15.3.
|
|
3
|
+
"version": "15.3.1",
|
|
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/"
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"deprecatedAutoEntryPoints": true,
|
|
20
20
|
"releaseModel": "scheduled",
|
|
21
21
|
"website": {
|
|
22
|
-
"name": "Select"
|
|
22
|
+
"name": "Select",
|
|
23
|
+
"category": "Components"
|
|
23
24
|
}
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
@@ -33,6 +34,7 @@
|
|
|
33
34
|
"@emotion/core": "^10.0.9",
|
|
34
35
|
"@popperjs/core": "^2.9.1",
|
|
35
36
|
"@types/react-select": "^4.0.18",
|
|
37
|
+
"bind-event-listener": "^2.1.0",
|
|
36
38
|
"focus-trap": "^2.4.5",
|
|
37
39
|
"memoize-one": "^6.0.0",
|
|
38
40
|
"react-fast-compare": "^3.2.0",
|
|
@@ -72,6 +74,7 @@
|
|
|
72
74
|
},
|
|
73
75
|
"techstack": {
|
|
74
76
|
"@repo/internal": {
|
|
77
|
+
"dom-events": "use-bind-event-listener",
|
|
75
78
|
"theming": "tokens",
|
|
76
79
|
"deprecation": "no-deprecated-imports",
|
|
77
80
|
"styling": [
|