@atlaskit/select 17.1.1 → 17.1.3
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 +12 -0
- package/dist/cjs/PopupSelect/PopupSelect.js +13 -56
- package/dist/cjs/Select.js +1 -1
- package/dist/cjs/components/input-options.js +1 -1
- package/dist/cjs/styles.js +2 -2
- package/dist/es2019/PopupSelect/PopupSelect.js +42 -88
- package/dist/es2019/Select.js +1 -1
- package/dist/es2019/components/input-options.js +1 -1
- package/dist/es2019/styles.js +2 -2
- package/dist/esm/PopupSelect/PopupSelect.js +13 -56
- package/dist/esm/Select.js +1 -1
- package/dist/esm/components/input-options.js +1 -1
- package/dist/esm/styles.js +2 -2
- package/dist/types/PopupSelect/PopupSelect.d.ts +11 -106
- package/dist/types/extract-react-types/react-select-props.d.ts +7 -6
- package/dist/types/types.d.ts +1 -1
- package/dist/types-ts4.5/PopupSelect/PopupSelect.d.ts +11 -106
- package/dist/types-ts4.5/extract-react-types/react-select-props.d.ts +7 -6
- package/dist/types-ts4.5/types.d.ts +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/select
|
|
2
2
|
|
|
3
|
+
## 17.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#75946](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/75946) [`cc843d47d71e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/cc843d47d71e) - Reverted the feature flag which reduced re-renders in `<PopupSelect>` as it had other unintended side-effects.
|
|
8
|
+
|
|
9
|
+
## 17.1.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#74756](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/74756) [`8e66f751df96`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8e66f751df96) - Use feature flag to roll out border width update from 2px to 1px
|
|
14
|
+
|
|
3
15
|
## 17.1.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -28,7 +28,6 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
|
28
28
|
var _components = require("./components");
|
|
29
29
|
var _styles = _interopRequireDefault(require("../styles"));
|
|
30
30
|
var _bindEventListener = require("bind-event-listener");
|
|
31
|
-
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
32
31
|
var _excluded = ["footer", "label", "maxMenuWidth", "minMenuWidth", "placeholder", "target", "testId"];
|
|
33
32
|
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); }
|
|
34
33
|
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; }
|
|
@@ -73,7 +72,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
73
72
|
(0, _inherits2.default)(PopupSelect, _PureComponent);
|
|
74
73
|
var _super = _createSuper(PopupSelect);
|
|
75
74
|
function PopupSelect() {
|
|
76
|
-
var _this$defaultOpenStat
|
|
75
|
+
var _this$defaultOpenStat;
|
|
77
76
|
var _this;
|
|
78
77
|
(0, _classCallCheck2.default)(this, PopupSelect);
|
|
79
78
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -94,13 +93,9 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
94
93
|
}));
|
|
95
94
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isOpenControlled", _this.props.isOpen !== undefined);
|
|
96
95
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "defaultOpenState", _this.isOpenControlled ? _this.props.isOpen : _this.props.defaultIsOpen);
|
|
97
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state",
|
|
98
|
-
isOpen: (_this$defaultOpenStat = _this.defaultOpenState) !== null && _this$defaultOpenStat !== void 0 ? _this$defaultOpenStat : false,
|
|
99
|
-
mergedComponents: _components.defaultComponents,
|
|
100
|
-
mergedPopperProps: defaultPopperProps
|
|
101
|
-
} : {
|
|
96
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
|
|
102
97
|
focusLockEnabled: false,
|
|
103
|
-
isOpen: (_this$
|
|
98
|
+
isOpen: (_this$defaultOpenStat = _this.defaultOpenState) !== null && _this$defaultOpenStat !== void 0 ? _this$defaultOpenStat : false,
|
|
104
99
|
mergedComponents: _components.defaultComponents,
|
|
105
100
|
mergedPopperProps: defaultPopperProps
|
|
106
101
|
});
|
|
@@ -221,13 +216,9 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
221
216
|
_this.setState({
|
|
222
217
|
isOpen: false
|
|
223
218
|
});
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
}
|
|
227
|
-
_this.setState({
|
|
228
|
-
focusLockEnabled: false
|
|
229
|
-
});
|
|
230
|
-
}
|
|
219
|
+
_this.setState({
|
|
220
|
+
focusLockEnabled: false
|
|
221
|
+
});
|
|
231
222
|
if (_this.targetRef != null) {
|
|
232
223
|
_this.targetRef.focus();
|
|
233
224
|
}
|
|
@@ -267,20 +258,6 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
267
258
|
});
|
|
268
259
|
// Utils
|
|
269
260
|
// ==============================
|
|
270
|
-
// Get a memoized merge of the default styles and the prop's in styles
|
|
271
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getSelectStyles", (0, _memoizeOne.default)(function (defaultStyles, propStyles) {
|
|
272
|
-
return (0, _reactSelect.mergeStyles)(defaultStyles, propStyles || {});
|
|
273
|
-
}));
|
|
274
|
-
// Get a memoized override of our `<Select components={…}>` overrides.
|
|
275
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getSelectComponents", (0, _memoizeOne.default)(function (mergedComponents, showSearchControl) {
|
|
276
|
-
if (!showSearchControl) {
|
|
277
|
-
// When we have no search control, we use a dummy override to hide it visually.
|
|
278
|
-
return _objectSpread(_objectSpread({}, mergedComponents), {}, {
|
|
279
|
-
Control: _components.DummyControl
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
return mergedComponents;
|
|
283
|
-
}));
|
|
284
261
|
// account for groups when counting options
|
|
285
262
|
// this may need to be recursive, right now it just counts one level
|
|
286
263
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getItemCount", function () {
|
|
@@ -329,7 +306,6 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
329
306
|
target = _this$props3.target,
|
|
330
307
|
testId = _this$props3.testId,
|
|
331
308
|
props = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
|
|
332
|
-
// TODO: If `platform.design-system-team.popup-select-render-perf_i0s6m` is kept, `focusLockEnabled` should be fully removed as we're preferring `isReferenceHidden`
|
|
333
309
|
var _this$state = _this.state,
|
|
334
310
|
focusLockEnabled = _this$state.focusLockEnabled,
|
|
335
311
|
isOpen = _this$state.isOpen,
|
|
@@ -340,12 +316,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
340
316
|
if (!portalDestination || !isOpen) {
|
|
341
317
|
return null;
|
|
342
318
|
}
|
|
343
|
-
|
|
344
|
-
// Memoized merge of defaultStyles and props.styles
|
|
345
|
-
var selectStyles = (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.popup-select-render-perf_i0s6m') ? _this.getSelectStyles(_this.defaultStyles, props.styles) : (0, _reactSelect.mergeStyles)(_this.defaultStyles, props.styles || {});
|
|
346
|
-
|
|
347
|
-
// Memoized variance of the default select components
|
|
348
|
-
var selectComponents = (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.popup-select-render-perf_i0s6m') ? _this.getSelectComponents(mergedComponents, showSearchControl) : _objectSpread(_objectSpread({}, mergedComponents), {}, {
|
|
319
|
+
var selectComponents = _objectSpread(_objectSpread({}, mergedComponents), {}, {
|
|
349
320
|
Control: showSearchControl ? mergedComponents.Control : _components.DummyControl
|
|
350
321
|
});
|
|
351
322
|
var getLabel = function getLabel() {
|
|
@@ -355,7 +326,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
355
326
|
return placeholder;
|
|
356
327
|
}
|
|
357
328
|
};
|
|
358
|
-
var popper = /*#__PURE__*/_react.default.createElement(_reactPopper.Popper, (0, _extends2.default)({}, mergedPopperProps,
|
|
329
|
+
var popper = /*#__PURE__*/_react.default.createElement(_reactPopper.Popper, (0, _extends2.default)({}, mergedPopperProps, {
|
|
359
330
|
onFirstUpdate: function onFirstUpdate(state) {
|
|
360
331
|
var _mergedPopperProps$on;
|
|
361
332
|
_this.handleFirstPopperUpdate();
|
|
@@ -364,13 +335,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
364
335
|
}), function (_ref2) {
|
|
365
336
|
var placement = _ref2.placement,
|
|
366
337
|
ref = _ref2.ref,
|
|
367
|
-
style = _ref2.style
|
|
368
|
-
isReferenceHidden = _ref2.isReferenceHidden;
|
|
369
|
-
/**
|
|
370
|
-
* The reference is not available yet, so the Popper and Portal is either being rendered at `0,0` (scrolled to the top)
|
|
371
|
-
* or not at all. There's no reason to render the Select or lock scrolling at the top of the page yet.
|
|
372
|
-
*/
|
|
373
|
-
var readyToRenderSelect = (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.popup-select-render-perf_i0s6m') ? isReferenceHidden !== null : true;
|
|
338
|
+
style = _ref2.style;
|
|
374
339
|
return /*#__PURE__*/_react.default.createElement(_reactNodeResolver.default, {
|
|
375
340
|
innerRef: _this.resolveMenuRef(ref)
|
|
376
341
|
}, /*#__PURE__*/_react.default.createElement(_components.MenuDialog, {
|
|
@@ -380,18 +345,10 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
380
345
|
maxWidth: maxMenuWidth,
|
|
381
346
|
id: _this.popperWrapperId,
|
|
382
347
|
testId: testId
|
|
383
|
-
}, /*#__PURE__*/_react.default.createElement(_reactFocusLock.default
|
|
384
|
-
|
|
385
|
-
* NOTE: We intentionally want the FocusLock to be disabled until the refs are populated in Popper.
|
|
386
|
-
* Until then, the portal the Popper creates is at `0,0`, meaning the FocusLock forces the page to scroll to `0,0`.
|
|
387
|
-
* We do not want the user to scroll to the top of the page when they open their PopupSelect, so we disable it.
|
|
388
|
-
*
|
|
389
|
-
* WARNING: This causes additional renders, eg. ±5ms in our example, but unless
|
|
390
|
-
* FocusLock has a better way to avoid scrolling, this is necessary.
|
|
391
|
-
*/, {
|
|
392
|
-
disabled: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.popup-select-render-perf_i0s6m') ? !readyToRenderSelect : !focusLockEnabled,
|
|
348
|
+
}, /*#__PURE__*/_react.default.createElement(_reactFocusLock.default, {
|
|
349
|
+
disabled: !focusLockEnabled,
|
|
393
350
|
returnFocus: true
|
|
394
|
-
},
|
|
351
|
+
}, /*#__PURE__*/_react.default.createElement(_reactSelect.default, (0, _extends2.default)({
|
|
395
352
|
"aria-label": getLabel(),
|
|
396
353
|
backspaceRemovesValue: false,
|
|
397
354
|
controlShouldRenderValue: false,
|
|
@@ -407,7 +364,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
407
364
|
(_props$onMenuClose = props.onMenuClose) === null || _props$onMenuClose === void 0 || _props$onMenuClose.call(props);
|
|
408
365
|
},
|
|
409
366
|
isSearchable: showSearchControl,
|
|
410
|
-
styles:
|
|
367
|
+
styles: (0, _reactSelect.mergeStyles)(_this.defaultStyles, props.styles || {}),
|
|
411
368
|
maxMenuHeight: _this.getMaxHeight(),
|
|
412
369
|
components: selectComponents,
|
|
413
370
|
onChange: _this.handleSelectChange
|
package/dist/cjs/Select.js
CHANGED
|
@@ -9,7 +9,7 @@ var _reactSelect = _interopRequireDefault(require("react-select"));
|
|
|
9
9
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
10
10
|
var _createSelect = _interopRequireDefault(require("./createSelect"));
|
|
11
11
|
var packageName = "@atlaskit/select";
|
|
12
|
-
var packageVersion = "17.1.
|
|
12
|
+
var packageVersion = "17.1.3";
|
|
13
13
|
var SelectWithoutAnalytics = exports.SelectWithoutAnalytics = (0, _createSelect.default)(_reactSelect.default);
|
|
14
14
|
var createAndFireEventOnAtlaskit = (0, _analyticsNext.createAndFireEvent)('atlaskit');
|
|
15
15
|
var _default = exports.default = (0, _analyticsNext.withAnalyticsContext)({
|
|
@@ -137,7 +137,7 @@ var baseIconStyles = (0, _react.css)({
|
|
|
137
137
|
// into the `@atlaskit/icon` package's Checkbox and Radio SVGs later
|
|
138
138
|
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
139
139
|
'& svg rect, & svg circle:first-of-type': {
|
|
140
|
-
strokeWidth: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.border-
|
|
140
|
+
strokeWidth: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.update-input-border-wdith_5abwv') ? "var(--ds-border-width, 1px)" : "var(--ds-border-width-outline, 2px)",
|
|
141
141
|
strokeLinejoin: 'round'
|
|
142
142
|
}
|
|
143
143
|
});
|
package/dist/cjs/styles.js
CHANGED
|
@@ -75,9 +75,9 @@ function baseStyles(validationState) {
|
|
|
75
75
|
borderColor: borderColor,
|
|
76
76
|
borderStyle: 'solid',
|
|
77
77
|
borderRadius: "var(--ds-border-radius-100, 3px)",
|
|
78
|
-
borderWidth: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.border-
|
|
78
|
+
borderWidth: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.update-input-border-wdith_5abwv') ? "var(--ds-border-width, 1px)" : "var(--ds-border-width-outline, 2px)",
|
|
79
79
|
boxShadow: 'none'
|
|
80
|
-
}, (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.border-
|
|
80
|
+
}, (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.update-input-border-wdith_5abwv') && {
|
|
81
81
|
'&:focus-within': {
|
|
82
82
|
boxShadow: "inset 0 0 0 ".concat("var(--ds-border-width, 1px)", " ", borderColor)
|
|
83
83
|
}
|
|
@@ -13,7 +13,6 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
|
13
13
|
import { MenuDialog, DummyControl, defaultComponents } from './components';
|
|
14
14
|
import baseStyles from '../styles';
|
|
15
15
|
import { bind } from 'bind-event-listener';
|
|
16
|
-
import memoizeOne from 'memoize-one';
|
|
17
16
|
/** Are we rendering on the client or server? */
|
|
18
17
|
const canUseDOM = () => Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
19
18
|
|
|
@@ -45,7 +44,7 @@ const defaultPopperProps = {
|
|
|
45
44
|
const isEmpty = obj => Object.keys(obj).length === 0;
|
|
46
45
|
export default class PopupSelect extends PureComponent {
|
|
47
46
|
constructor(...args) {
|
|
48
|
-
var _this$defaultOpenStat
|
|
47
|
+
var _this$defaultOpenStat;
|
|
49
48
|
super(...args);
|
|
50
49
|
_defineProperty(this, "menuRef", null);
|
|
51
50
|
_defineProperty(this, "selectRef", null);
|
|
@@ -60,13 +59,9 @@ export default class PopupSelect extends PureComponent {
|
|
|
60
59
|
}));
|
|
61
60
|
_defineProperty(this, "isOpenControlled", this.props.isOpen !== undefined);
|
|
62
61
|
_defineProperty(this, "defaultOpenState", this.isOpenControlled ? this.props.isOpen : this.props.defaultIsOpen);
|
|
63
|
-
_defineProperty(this, "state",
|
|
64
|
-
isOpen: (_this$defaultOpenStat = this.defaultOpenState) !== null && _this$defaultOpenStat !== void 0 ? _this$defaultOpenStat : false,
|
|
65
|
-
mergedComponents: defaultComponents,
|
|
66
|
-
mergedPopperProps: defaultPopperProps
|
|
67
|
-
} : {
|
|
62
|
+
_defineProperty(this, "state", {
|
|
68
63
|
focusLockEnabled: false,
|
|
69
|
-
isOpen: (_this$
|
|
64
|
+
isOpen: (_this$defaultOpenStat = this.defaultOpenState) !== null && _this$defaultOpenStat !== void 0 ? _this$defaultOpenStat : false,
|
|
70
65
|
mergedComponents: defaultComponents,
|
|
71
66
|
mergedPopperProps: defaultPopperProps
|
|
72
67
|
});
|
|
@@ -195,13 +190,9 @@ export default class PopupSelect extends PureComponent {
|
|
|
195
190
|
this.setState({
|
|
196
191
|
isOpen: false
|
|
197
192
|
});
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}
|
|
201
|
-
this.setState({
|
|
202
|
-
focusLockEnabled: false
|
|
203
|
-
});
|
|
204
|
-
}
|
|
193
|
+
this.setState({
|
|
194
|
+
focusLockEnabled: false
|
|
195
|
+
});
|
|
205
196
|
if (this.targetRef != null) {
|
|
206
197
|
this.targetRef.focus();
|
|
207
198
|
}
|
|
@@ -237,21 +228,6 @@ export default class PopupSelect extends PureComponent {
|
|
|
237
228
|
});
|
|
238
229
|
// Utils
|
|
239
230
|
// ==============================
|
|
240
|
-
// Get a memoized merge of the default styles and the prop's in styles
|
|
241
|
-
_defineProperty(this, "getSelectStyles", memoizeOne((defaultStyles, propStyles) => {
|
|
242
|
-
return mergeStyles(defaultStyles, propStyles || {});
|
|
243
|
-
}));
|
|
244
|
-
// Get a memoized override of our `<Select components={…}>` overrides.
|
|
245
|
-
_defineProperty(this, "getSelectComponents", memoizeOne((mergedComponents, showSearchControl) => {
|
|
246
|
-
if (!showSearchControl) {
|
|
247
|
-
// When we have no search control, we use a dummy override to hide it visually.
|
|
248
|
-
return {
|
|
249
|
-
...mergedComponents,
|
|
250
|
-
Control: DummyControl
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
return mergedComponents;
|
|
254
|
-
}));
|
|
255
231
|
// account for groups when counting options
|
|
256
232
|
// this may need to be recursive, right now it just counts one level
|
|
257
233
|
_defineProperty(this, "getItemCount", () => {
|
|
@@ -306,7 +282,6 @@ export default class PopupSelect extends PureComponent {
|
|
|
306
282
|
testId,
|
|
307
283
|
...props
|
|
308
284
|
} = this.props;
|
|
309
|
-
// TODO: If `platform.design-system-team.popup-select-render-perf_i0s6m` is kept, `focusLockEnabled` should be fully removed as we're preferring `isReferenceHidden`
|
|
310
285
|
const {
|
|
311
286
|
focusLockEnabled,
|
|
312
287
|
isOpen,
|
|
@@ -318,12 +293,7 @@ export default class PopupSelect extends PureComponent {
|
|
|
318
293
|
if (!portalDestination || !isOpen) {
|
|
319
294
|
return null;
|
|
320
295
|
}
|
|
321
|
-
|
|
322
|
-
// Memoized merge of defaultStyles and props.styles
|
|
323
|
-
const selectStyles = getBooleanFF('platform.design-system-team.popup-select-render-perf_i0s6m') ? this.getSelectStyles(this.defaultStyles, props.styles) : mergeStyles(this.defaultStyles, props.styles || {});
|
|
324
|
-
|
|
325
|
-
// Memoized variance of the default select components
|
|
326
|
-
const selectComponents = getBooleanFF('platform.design-system-team.popup-select-render-perf_i0s6m') ? this.getSelectComponents(mergedComponents, showSearchControl) : {
|
|
296
|
+
const selectComponents = {
|
|
327
297
|
...mergedComponents,
|
|
328
298
|
Control: showSearchControl ? mergedComponents.Control : DummyControl
|
|
329
299
|
};
|
|
@@ -334,7 +304,7 @@ export default class PopupSelect extends PureComponent {
|
|
|
334
304
|
return placeholder;
|
|
335
305
|
}
|
|
336
306
|
};
|
|
337
|
-
const popper = /*#__PURE__*/React.createElement(Popper, _extends({}, mergedPopperProps,
|
|
307
|
+
const popper = /*#__PURE__*/React.createElement(Popper, _extends({}, mergedPopperProps, {
|
|
338
308
|
onFirstUpdate: state => {
|
|
339
309
|
var _mergedPopperProps$on;
|
|
340
310
|
this.handleFirstPopperUpdate();
|
|
@@ -343,56 +313,40 @@ export default class PopupSelect extends PureComponent {
|
|
|
343
313
|
}), ({
|
|
344
314
|
placement,
|
|
345
315
|
ref,
|
|
346
|
-
style
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
menuIsOpen: true,
|
|
381
|
-
placeholder: placeholder,
|
|
382
|
-
ref: this.getSelectRef
|
|
383
|
-
}, props, {
|
|
384
|
-
onMenuClose: () => {
|
|
385
|
-
var _props$onMenuClose;
|
|
386
|
-
getBooleanFF('platform.design-system-team.popup-select-close_8h15h') && this.close();
|
|
387
|
-
(_props$onMenuClose = props.onMenuClose) === null || _props$onMenuClose === void 0 ? void 0 : _props$onMenuClose.call(props);
|
|
388
|
-
},
|
|
389
|
-
isSearchable: showSearchControl,
|
|
390
|
-
styles: selectStyles,
|
|
391
|
-
maxMenuHeight: this.getMaxHeight(),
|
|
392
|
-
components: selectComponents,
|
|
393
|
-
onChange: this.handleSelectChange
|
|
394
|
-
})), footer)));
|
|
395
|
-
});
|
|
316
|
+
style
|
|
317
|
+
}) => /*#__PURE__*/React.createElement(NodeResolver, {
|
|
318
|
+
innerRef: this.resolveMenuRef(ref)
|
|
319
|
+
}, /*#__PURE__*/React.createElement(MenuDialog, {
|
|
320
|
+
style: style,
|
|
321
|
+
"data-placement": placement,
|
|
322
|
+
minWidth: minMenuWidth,
|
|
323
|
+
maxWidth: maxMenuWidth,
|
|
324
|
+
id: this.popperWrapperId,
|
|
325
|
+
testId: testId
|
|
326
|
+
}, /*#__PURE__*/React.createElement(FocusLock, {
|
|
327
|
+
disabled: !focusLockEnabled,
|
|
328
|
+
returnFocus: true
|
|
329
|
+
}, /*#__PURE__*/React.createElement(Select, _extends({
|
|
330
|
+
"aria-label": getLabel(),
|
|
331
|
+
backspaceRemovesValue: false,
|
|
332
|
+
controlShouldRenderValue: false,
|
|
333
|
+
isClearable: false,
|
|
334
|
+
tabSelectsValue: false,
|
|
335
|
+
menuIsOpen: true,
|
|
336
|
+
placeholder: placeholder,
|
|
337
|
+
ref: this.getSelectRef
|
|
338
|
+
}, props, {
|
|
339
|
+
onMenuClose: () => {
|
|
340
|
+
var _props$onMenuClose;
|
|
341
|
+
getBooleanFF('platform.design-system-team.popup-select-close_8h15h') && this.close();
|
|
342
|
+
(_props$onMenuClose = props.onMenuClose) === null || _props$onMenuClose === void 0 ? void 0 : _props$onMenuClose.call(props);
|
|
343
|
+
},
|
|
344
|
+
isSearchable: showSearchControl,
|
|
345
|
+
styles: mergeStyles(this.defaultStyles, props.styles || {}),
|
|
346
|
+
maxMenuHeight: this.getMaxHeight(),
|
|
347
|
+
components: selectComponents,
|
|
348
|
+
onChange: this.handleSelectChange
|
|
349
|
+
})), footer))));
|
|
396
350
|
return mergedPopperProps.strategy === 'fixed' ? popper : /*#__PURE__*/createPortal(popper, portalDestination);
|
|
397
351
|
});
|
|
398
352
|
}
|
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 = "17.1.
|
|
5
|
+
const packageVersion = "17.1.3";
|
|
6
6
|
export const SelectWithoutAnalytics = createSelect(Select);
|
|
7
7
|
const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
8
8
|
export default withAnalyticsContext({
|
|
@@ -126,7 +126,7 @@ const baseIconStyles = css({
|
|
|
126
126
|
// into the `@atlaskit/icon` package's Checkbox and Radio SVGs later
|
|
127
127
|
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
128
128
|
'& svg rect, & svg circle:first-of-type': {
|
|
129
|
-
strokeWidth: getBooleanFF('platform.design-system-team.border-
|
|
129
|
+
strokeWidth: getBooleanFF('platform.design-system-team.update-input-border-wdith_5abwv') ? "var(--ds-border-width, 1px)" : "var(--ds-border-width-outline, 2px)",
|
|
130
130
|
strokeLinejoin: 'round'
|
|
131
131
|
}
|
|
132
132
|
});
|
package/dist/es2019/styles.js
CHANGED
|
@@ -65,9 +65,9 @@ export default function baseStyles(validationState, isCompact = false, appearanc
|
|
|
65
65
|
borderColor,
|
|
66
66
|
borderStyle: 'solid',
|
|
67
67
|
borderRadius: "var(--ds-border-radius-100, 3px)",
|
|
68
|
-
borderWidth: getBooleanFF('platform.design-system-team.border-
|
|
68
|
+
borderWidth: getBooleanFF('platform.design-system-team.update-input-border-wdith_5abwv') ? "var(--ds-border-width, 1px)" : "var(--ds-border-width-outline, 2px)",
|
|
69
69
|
boxShadow: 'none',
|
|
70
|
-
...(getBooleanFF('platform.design-system-team.border-
|
|
70
|
+
...(getBooleanFF('platform.design-system-team.update-input-border-wdith_5abwv') && {
|
|
71
71
|
'&:focus-within': {
|
|
72
72
|
boxShadow: `inset 0 0 0 ${"var(--ds-border-width, 1px)"} ${borderColor}`
|
|
73
73
|
}
|
|
@@ -25,7 +25,6 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
|
25
25
|
import { MenuDialog, DummyControl, defaultComponents } from './components';
|
|
26
26
|
import baseStyles from '../styles';
|
|
27
27
|
import { bind } from 'bind-event-listener';
|
|
28
|
-
import memoizeOne from 'memoize-one';
|
|
29
28
|
/** Are we rendering on the client or server? */
|
|
30
29
|
var canUseDOM = function canUseDOM() {
|
|
31
30
|
return Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
@@ -63,7 +62,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
63
62
|
_inherits(PopupSelect, _PureComponent);
|
|
64
63
|
var _super = _createSuper(PopupSelect);
|
|
65
64
|
function PopupSelect() {
|
|
66
|
-
var _this$defaultOpenStat
|
|
65
|
+
var _this$defaultOpenStat;
|
|
67
66
|
var _this;
|
|
68
67
|
_classCallCheck(this, PopupSelect);
|
|
69
68
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -84,13 +83,9 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
84
83
|
}));
|
|
85
84
|
_defineProperty(_assertThisInitialized(_this), "isOpenControlled", _this.props.isOpen !== undefined);
|
|
86
85
|
_defineProperty(_assertThisInitialized(_this), "defaultOpenState", _this.isOpenControlled ? _this.props.isOpen : _this.props.defaultIsOpen);
|
|
87
|
-
_defineProperty(_assertThisInitialized(_this), "state",
|
|
88
|
-
isOpen: (_this$defaultOpenStat = _this.defaultOpenState) !== null && _this$defaultOpenStat !== void 0 ? _this$defaultOpenStat : false,
|
|
89
|
-
mergedComponents: defaultComponents,
|
|
90
|
-
mergedPopperProps: defaultPopperProps
|
|
91
|
-
} : {
|
|
86
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
92
87
|
focusLockEnabled: false,
|
|
93
|
-
isOpen: (_this$
|
|
88
|
+
isOpen: (_this$defaultOpenStat = _this.defaultOpenState) !== null && _this$defaultOpenStat !== void 0 ? _this$defaultOpenStat : false,
|
|
94
89
|
mergedComponents: defaultComponents,
|
|
95
90
|
mergedPopperProps: defaultPopperProps
|
|
96
91
|
});
|
|
@@ -211,13 +206,9 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
211
206
|
_this.setState({
|
|
212
207
|
isOpen: false
|
|
213
208
|
});
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}
|
|
217
|
-
_this.setState({
|
|
218
|
-
focusLockEnabled: false
|
|
219
|
-
});
|
|
220
|
-
}
|
|
209
|
+
_this.setState({
|
|
210
|
+
focusLockEnabled: false
|
|
211
|
+
});
|
|
221
212
|
if (_this.targetRef != null) {
|
|
222
213
|
_this.targetRef.focus();
|
|
223
214
|
}
|
|
@@ -257,20 +248,6 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
257
248
|
});
|
|
258
249
|
// Utils
|
|
259
250
|
// ==============================
|
|
260
|
-
// Get a memoized merge of the default styles and the prop's in styles
|
|
261
|
-
_defineProperty(_assertThisInitialized(_this), "getSelectStyles", memoizeOne(function (defaultStyles, propStyles) {
|
|
262
|
-
return mergeStyles(defaultStyles, propStyles || {});
|
|
263
|
-
}));
|
|
264
|
-
// Get a memoized override of our `<Select components={…}>` overrides.
|
|
265
|
-
_defineProperty(_assertThisInitialized(_this), "getSelectComponents", memoizeOne(function (mergedComponents, showSearchControl) {
|
|
266
|
-
if (!showSearchControl) {
|
|
267
|
-
// When we have no search control, we use a dummy override to hide it visually.
|
|
268
|
-
return _objectSpread(_objectSpread({}, mergedComponents), {}, {
|
|
269
|
-
Control: DummyControl
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
return mergedComponents;
|
|
273
|
-
}));
|
|
274
251
|
// account for groups when counting options
|
|
275
252
|
// this may need to be recursive, right now it just counts one level
|
|
276
253
|
_defineProperty(_assertThisInitialized(_this), "getItemCount", function () {
|
|
@@ -319,7 +296,6 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
319
296
|
target = _this$props3.target,
|
|
320
297
|
testId = _this$props3.testId,
|
|
321
298
|
props = _objectWithoutProperties(_this$props3, _excluded);
|
|
322
|
-
// TODO: If `platform.design-system-team.popup-select-render-perf_i0s6m` is kept, `focusLockEnabled` should be fully removed as we're preferring `isReferenceHidden`
|
|
323
299
|
var _this$state = _this.state,
|
|
324
300
|
focusLockEnabled = _this$state.focusLockEnabled,
|
|
325
301
|
isOpen = _this$state.isOpen,
|
|
@@ -330,12 +306,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
330
306
|
if (!portalDestination || !isOpen) {
|
|
331
307
|
return null;
|
|
332
308
|
}
|
|
333
|
-
|
|
334
|
-
// Memoized merge of defaultStyles and props.styles
|
|
335
|
-
var selectStyles = getBooleanFF('platform.design-system-team.popup-select-render-perf_i0s6m') ? _this.getSelectStyles(_this.defaultStyles, props.styles) : mergeStyles(_this.defaultStyles, props.styles || {});
|
|
336
|
-
|
|
337
|
-
// Memoized variance of the default select components
|
|
338
|
-
var selectComponents = getBooleanFF('platform.design-system-team.popup-select-render-perf_i0s6m') ? _this.getSelectComponents(mergedComponents, showSearchControl) : _objectSpread(_objectSpread({}, mergedComponents), {}, {
|
|
309
|
+
var selectComponents = _objectSpread(_objectSpread({}, mergedComponents), {}, {
|
|
339
310
|
Control: showSearchControl ? mergedComponents.Control : DummyControl
|
|
340
311
|
});
|
|
341
312
|
var getLabel = function getLabel() {
|
|
@@ -345,7 +316,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
345
316
|
return placeholder;
|
|
346
317
|
}
|
|
347
318
|
};
|
|
348
|
-
var popper = /*#__PURE__*/React.createElement(Popper, _extends({}, mergedPopperProps,
|
|
319
|
+
var popper = /*#__PURE__*/React.createElement(Popper, _extends({}, mergedPopperProps, {
|
|
349
320
|
onFirstUpdate: function onFirstUpdate(state) {
|
|
350
321
|
var _mergedPopperProps$on;
|
|
351
322
|
_this.handleFirstPopperUpdate();
|
|
@@ -354,13 +325,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
354
325
|
}), function (_ref2) {
|
|
355
326
|
var placement = _ref2.placement,
|
|
356
327
|
ref = _ref2.ref,
|
|
357
|
-
style = _ref2.style
|
|
358
|
-
isReferenceHidden = _ref2.isReferenceHidden;
|
|
359
|
-
/**
|
|
360
|
-
* The reference is not available yet, so the Popper and Portal is either being rendered at `0,0` (scrolled to the top)
|
|
361
|
-
* or not at all. There's no reason to render the Select or lock scrolling at the top of the page yet.
|
|
362
|
-
*/
|
|
363
|
-
var readyToRenderSelect = getBooleanFF('platform.design-system-team.popup-select-render-perf_i0s6m') ? isReferenceHidden !== null : true;
|
|
328
|
+
style = _ref2.style;
|
|
364
329
|
return /*#__PURE__*/React.createElement(NodeResolver, {
|
|
365
330
|
innerRef: _this.resolveMenuRef(ref)
|
|
366
331
|
}, /*#__PURE__*/React.createElement(MenuDialog, {
|
|
@@ -370,18 +335,10 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
370
335
|
maxWidth: maxMenuWidth,
|
|
371
336
|
id: _this.popperWrapperId,
|
|
372
337
|
testId: testId
|
|
373
|
-
}, /*#__PURE__*/React.createElement(FocusLock
|
|
374
|
-
|
|
375
|
-
* NOTE: We intentionally want the FocusLock to be disabled until the refs are populated in Popper.
|
|
376
|
-
* Until then, the portal the Popper creates is at `0,0`, meaning the FocusLock forces the page to scroll to `0,0`.
|
|
377
|
-
* We do not want the user to scroll to the top of the page when they open their PopupSelect, so we disable it.
|
|
378
|
-
*
|
|
379
|
-
* WARNING: This causes additional renders, eg. ±5ms in our example, but unless
|
|
380
|
-
* FocusLock has a better way to avoid scrolling, this is necessary.
|
|
381
|
-
*/, {
|
|
382
|
-
disabled: getBooleanFF('platform.design-system-team.popup-select-render-perf_i0s6m') ? !readyToRenderSelect : !focusLockEnabled,
|
|
338
|
+
}, /*#__PURE__*/React.createElement(FocusLock, {
|
|
339
|
+
disabled: !focusLockEnabled,
|
|
383
340
|
returnFocus: true
|
|
384
|
-
},
|
|
341
|
+
}, /*#__PURE__*/React.createElement(Select, _extends({
|
|
385
342
|
"aria-label": getLabel(),
|
|
386
343
|
backspaceRemovesValue: false,
|
|
387
344
|
controlShouldRenderValue: false,
|
|
@@ -397,7 +354,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
397
354
|
(_props$onMenuClose = props.onMenuClose) === null || _props$onMenuClose === void 0 || _props$onMenuClose.call(props);
|
|
398
355
|
},
|
|
399
356
|
isSearchable: showSearchControl,
|
|
400
|
-
styles:
|
|
357
|
+
styles: mergeStyles(_this.defaultStyles, props.styles || {}),
|
|
401
358
|
maxMenuHeight: _this.getMaxHeight(),
|
|
402
359
|
components: selectComponents,
|
|
403
360
|
onChange: _this.handleSelectChange
|
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 = "17.1.
|
|
5
|
+
var packageVersion = "17.1.3";
|
|
6
6
|
export var SelectWithoutAnalytics = createSelect(Select);
|
|
7
7
|
var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
8
8
|
export default withAnalyticsContext({
|
|
@@ -131,7 +131,7 @@ var baseIconStyles = css({
|
|
|
131
131
|
// into the `@atlaskit/icon` package's Checkbox and Radio SVGs later
|
|
132
132
|
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
133
133
|
'& svg rect, & svg circle:first-of-type': {
|
|
134
|
-
strokeWidth: getBooleanFF('platform.design-system-team.border-
|
|
134
|
+
strokeWidth: getBooleanFF('platform.design-system-team.update-input-border-wdith_5abwv') ? "var(--ds-border-width, 1px)" : "var(--ds-border-width-outline, 2px)",
|
|
135
135
|
strokeLinejoin: 'round'
|
|
136
136
|
}
|
|
137
137
|
});
|
package/dist/esm/styles.js
CHANGED
|
@@ -69,9 +69,9 @@ export default function baseStyles(validationState) {
|
|
|
69
69
|
borderColor: borderColor,
|
|
70
70
|
borderStyle: 'solid',
|
|
71
71
|
borderRadius: "var(--ds-border-radius-100, 3px)",
|
|
72
|
-
borderWidth: getBooleanFF('platform.design-system-team.border-
|
|
72
|
+
borderWidth: getBooleanFF('platform.design-system-team.update-input-border-wdith_5abwv') ? "var(--ds-border-width, 1px)" : "var(--ds-border-width-outline, 2px)",
|
|
73
73
|
boxShadow: 'none'
|
|
74
|
-
}, getBooleanFF('platform.design-system-team.border-
|
|
74
|
+
}, getBooleanFF('platform.design-system-team.update-input-border-wdith_5abwv') && {
|
|
75
75
|
'&:focus-within': {
|
|
76
76
|
boxShadow: "inset 0 0 0 ".concat("var(--ds-border-width, 1px)", " ", borderColor)
|
|
77
77
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React, { KeyboardEventHandler, PureComponent, ReactNode } from 'react';
|
|
2
|
-
import { GroupBase } from 'react-select';
|
|
3
2
|
import BaseSelect from 'react-select/base';
|
|
4
3
|
import { PopperProps } from 'react-popper';
|
|
5
|
-
import { defaultComponents } from './components';
|
|
6
4
|
import { OptionType, ActionMeta, ReactSelectProps, StylesConfig, ValueType, ValidationState } from '../types';
|
|
7
5
|
import { UnbindFn } from 'bind-event-listener';
|
|
8
6
|
type defaultModifiers = 'offset' | 'preventOverflow';
|
|
@@ -17,11 +15,11 @@ interface PopupSelectTriggerProps {
|
|
|
17
15
|
export type ModifierList = 'offset' | 'computeStyles' | 'preventOverflow' | 'handleFlipStyle' | 'flip' | 'popperOffsets' | 'arrow' | 'hide' | 'eventListeners' | 'applyStyles';
|
|
18
16
|
export interface PopupSelectProps<Option = OptionType, IsMulti extends boolean = false, Modifiers = ModifierList> extends ReactSelectProps<Option, IsMulti> {
|
|
19
17
|
/**
|
|
20
|
-
* Defines whether the menu should close when selected.
|
|
18
|
+
* Defines whether the menu should close when selected. The default is `true`.
|
|
21
19
|
*/
|
|
22
20
|
closeMenuOnSelect?: boolean;
|
|
23
21
|
/**
|
|
24
|
-
* The footer content shown at the bottom of the
|
|
22
|
+
* The footer content shown at the bottom of the popup, underneath the select options.
|
|
25
23
|
*/
|
|
26
24
|
footer?: ReactNode;
|
|
27
25
|
/**
|
|
@@ -33,21 +31,21 @@ export interface PopupSelectProps<Option = OptionType, IsMulti extends boolean =
|
|
|
33
31
|
*/
|
|
34
32
|
popperProps?: PopperPropsNoChildren<Modifiers>;
|
|
35
33
|
/**
|
|
36
|
-
* The maximum number of options the select can contain without rendering the search field.
|
|
34
|
+
* The maximum number of options the select can contain without rendering the search field. The default is `5`.
|
|
37
35
|
*/
|
|
38
36
|
searchThreshold?: number;
|
|
39
37
|
/**
|
|
40
|
-
* If false
|
|
41
|
-
* number of options exceeds the `searchThreshold`.
|
|
38
|
+
* If `false`, renders a select with no search field. If `true`, renders a search field in the select when the
|
|
39
|
+
* number of options exceeds the `searchThreshold`. The default is `true`.
|
|
42
40
|
*/
|
|
43
41
|
isSearchable?: boolean;
|
|
44
42
|
/**
|
|
45
|
-
* The maximum width for the popup menu. Can be a number, representing width in pixels,
|
|
43
|
+
* The maximum width for the popup menu. Can be a number, representing the width in pixels,
|
|
46
44
|
* or a string containing a CSS length datatype.
|
|
47
45
|
*/
|
|
48
46
|
maxMenuWidth?: number | string;
|
|
49
47
|
/**
|
|
50
|
-
* The maximum width for the popup menu. Can be a number, representing width in pixels,
|
|
48
|
+
* The maximum width for the popup menu. Can be a number, representing the width in pixels,
|
|
51
49
|
* or a string containing a CSS length datatype.
|
|
52
50
|
*/
|
|
53
51
|
minMenuWidth?: number | string;
|
|
@@ -69,23 +67,18 @@ export interface PopupSelectProps<Option = OptionType, IsMulti extends boolean =
|
|
|
69
67
|
}) => ReactNode;
|
|
70
68
|
isOpen?: boolean;
|
|
71
69
|
defaultIsOpen?: boolean;
|
|
72
|
-
/**
|
|
70
|
+
/** Use this to set whether the component uses compact or standard spacing. */
|
|
73
71
|
spacing?: string;
|
|
74
72
|
/** @deprecated Use isInvalid instead. The state of validation if used in a form */
|
|
75
73
|
validationState?: ValidationState;
|
|
76
|
-
/** This prop indicates if the component is in an error state */
|
|
74
|
+
/** This prop indicates if the component is in an error state. */
|
|
77
75
|
isInvalid?: boolean;
|
|
78
|
-
/** This gives an accessible name to the input for
|
|
76
|
+
/** This gives an accessible name to the input for people who use assistive technology. */
|
|
79
77
|
label?: string;
|
|
80
78
|
testId?: string;
|
|
81
79
|
}
|
|
82
80
|
interface State<Modifiers = string> {
|
|
83
|
-
|
|
84
|
-
* TODO: This type should be cleaned up with `platform.design-system-team.popup-select-render-perf_i0s6m`.
|
|
85
|
-
* - If discarded, revert to `focusLockEnabled: boolean`
|
|
86
|
-
* - If kept, delete this type.
|
|
87
|
-
*/
|
|
88
|
-
focusLockEnabled?: boolean;
|
|
81
|
+
focusLockEnabled: boolean;
|
|
89
82
|
isOpen: boolean;
|
|
90
83
|
mergedComponents: Object;
|
|
91
84
|
mergedPopperProps: PopperPropsNoChildren<defaultModifiers | Modifiers>;
|
|
@@ -100,15 +93,6 @@ export default class PopupSelect<Option = OptionType, IsMulti extends boolean =
|
|
|
100
93
|
isOpenControlled: boolean;
|
|
101
94
|
defaultOpenState: boolean | undefined;
|
|
102
95
|
state: {
|
|
103
|
-
isOpen: boolean;
|
|
104
|
-
mergedComponents: {
|
|
105
|
-
Control: React.FC<import("../types").ControlProps<OptionType, boolean>>;
|
|
106
|
-
DropdownIndicator: () => import("@emotion/react").jsx.JSX.Element;
|
|
107
|
-
Menu: ({ children, innerProps }: import("../types").MenuProps<OptionType, boolean>) => import("@emotion/react").jsx.JSX.Element;
|
|
108
|
-
};
|
|
109
|
-
mergedPopperProps: PopperPropsNoChildren<string>;
|
|
110
|
-
focusLockEnabled?: undefined;
|
|
111
|
-
} | {
|
|
112
96
|
focusLockEnabled: boolean;
|
|
113
97
|
isOpen: boolean;
|
|
114
98
|
mergedComponents: {
|
|
@@ -159,85 +143,6 @@ export default class PopupSelect<Option = OptionType, IsMulti extends boolean =
|
|
|
159
143
|
resolveTargetRef: (popperRef: React.Ref<HTMLElement>) => (ref: HTMLElement) => void;
|
|
160
144
|
resolveMenuRef: (popperRef: React.Ref<HTMLElement>) => (ref: HTMLElement) => void;
|
|
161
145
|
getSelectRef: (ref: BaseSelect<Option, IsMulti>) => void;
|
|
162
|
-
getSelectStyles: import("memoize-one").MemoizedFn<(defaultStyles: StylesConfig<Option, IsMulti>, propStyles: StylesConfig<Option, IsMulti> | undefined) => {
|
|
163
|
-
clearIndicator?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").ClearIndicatorProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
164
|
-
container?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").ContainerProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
165
|
-
control?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").ControlProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
166
|
-
dropdownIndicator?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").DropdownIndicatorProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
167
|
-
group?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").GroupProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
168
|
-
groupHeading?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").GroupHeadingProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
169
|
-
indicatorsContainer?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").IndicatorsContainerProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
170
|
-
indicatorSeparator?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").IndicatorSeparatorProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
171
|
-
input?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").InputProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
172
|
-
loadingIndicator?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").LoadingIndicatorProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
173
|
-
loadingMessage?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").NoticeProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
174
|
-
menu?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").MenuProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
175
|
-
menuList?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").MenuListProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
176
|
-
menuPortal?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select/dist/declarations/src/components/Menu").PortalStyleArgs> | undefined; /** @deprecated Use isInvalid instead. The state of validation if used in a form */
|
|
177
|
-
multiValue?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").MultiValueProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
178
|
-
multiValueLabel?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").MultiValueProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
179
|
-
multiValueRemove?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").MultiValueProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
180
|
-
noOptionsMessage?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").NoticeProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
181
|
-
option?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").OptionProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
182
|
-
placeholder?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").PlaceholderProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
183
|
-
singleValue?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").SingleValueProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
184
|
-
valueContainer?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").ValueContainerProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
185
|
-
}>;
|
|
186
|
-
getSelectComponents: import("memoize-one").MemoizedFn<(mergedComponents: typeof defaultComponents, showSearchControl: boolean | undefined) => Partial<{
|
|
187
|
-
ClearIndicator: <Option_1, IsMulti_1 extends boolean, Group extends GroupBase<Option_1>>(props: import("react-select").ClearIndicatorProps<Option_1, IsMulti_1, Group>) => import("@emotion/react").jsx.JSX.Element;
|
|
188
|
-
Control: <Option_1, IsMulti_1 extends boolean, Group_1 extends GroupBase<Option_1>>(props: import("react-select").ControlProps<Option_1, IsMulti_1, Group_1>) => import("@emotion/react").jsx.JSX.Element;
|
|
189
|
-
DropdownIndicator: <Option_2, IsMulti_2 extends boolean, Group_2 extends GroupBase<Option_2>>(props: import("react-select").DropdownIndicatorProps<Option_2, IsMulti_2, Group_2>) => import("@emotion/react").jsx.JSX.Element;
|
|
190
|
-
/**
|
|
191
|
-
Render props used to anchor the popup to your content.
|
|
192
|
-
|
|
193
|
-
Make this an interactive element, such as an @atlaskit/button component.
|
|
194
|
-
|
|
195
|
-
The provided render props in `options` are detailed below:
|
|
196
|
-
- `isOpen`: The current state of the popup.
|
|
197
|
-
Use this to change the appearance of your target based on the state of your component
|
|
198
|
-
- `ref`: Pass this ref to the element the Popup should be attached to
|
|
199
|
-
- `onKeyDown`: Pass this keydown handler to the element to allow keyboard users to access the element.
|
|
200
|
-
- `aria-haspopup`, `aria-expanded`, `aria-controls`: Spread these onto a target element to
|
|
201
|
-
ensure your experience is accessible
|
|
202
|
-
*/
|
|
203
|
-
DownChevron: (props: import("react-select/dist/declarations/src/components/indicators").DownChevronProps) => import("@emotion/react").jsx.JSX.Element;
|
|
204
|
-
CrossIcon: (props: import("react-select/dist/declarations/src/components/indicators").CrossIconProps) => import("@emotion/react").jsx.JSX.Element;
|
|
205
|
-
Group: <Option_3, IsMulti_3 extends boolean, Group_3 extends GroupBase<Option_3>>(props: import("react-select").GroupProps<Option_3, IsMulti_3, Group_3>) => import("@emotion/react").jsx.JSX.Element;
|
|
206
|
-
GroupHeading: <Option_4, IsMulti_4 extends boolean, Group_4 extends GroupBase<Option_4>>(props: import("react-select").GroupHeadingProps<Option_4, IsMulti_4, Group_4>) => import("@emotion/react").jsx.JSX.Element;
|
|
207
|
-
IndicatorsContainer: <Option_5, IsMulti_5 extends boolean, Group_5 extends GroupBase<Option_5>>(props: import("react-select").IndicatorsContainerProps<Option_5, IsMulti_5, Group_5>) => import("@emotion/react").jsx.JSX.Element;
|
|
208
|
-
IndicatorSeparator: <Option_6, IsMulti_6 extends boolean, Group_6 extends GroupBase<Option_6>>(props: import("react-select").IndicatorSeparatorProps<Option_6, IsMulti_6, Group_6>) => import("@emotion/react").jsx.JSX.Element;
|
|
209
|
-
Input: <Option_7, IsMulti_7 extends boolean, Group_7 extends GroupBase<Option_7>>(props: import("react-select").InputProps<Option_7, IsMulti_7, Group_7>) => import("@emotion/react").jsx.JSX.Element;
|
|
210
|
-
LoadingIndicator: {
|
|
211
|
-
<Option_8, IsMulti_8 extends boolean, Group_8 extends GroupBase<Option_8>>(props: import("react-select").LoadingIndicatorProps<Option_8, IsMulti_8, Group_8>): import("@emotion/react").jsx.JSX.Element;
|
|
212
|
-
defaultProps: {
|
|
213
|
-
size: number;
|
|
214
|
-
};
|
|
215
|
-
};
|
|
216
|
-
Menu: <Option_9, IsMulti_9 extends boolean, Group_9 extends GroupBase<Option_9>>(props: import("react-select").MenuProps<Option_9, IsMulti_9, Group_9>) => import("@emotion/react").jsx.JSX.Element;
|
|
217
|
-
MenuList: <Option_10, IsMulti_10 extends boolean, Group_10 extends GroupBase<Option_10>>(props: import("react-select").MenuListProps<Option_10, IsMulti_10, Group_10>) => import("@emotion/react").jsx.JSX.Element;
|
|
218
|
-
MenuPortal: typeof import("react-select/dist/declarations/src/components/Menu").MenuPortal;
|
|
219
|
-
LoadingMessage: {
|
|
220
|
-
<Option_11, IsMulti_11 extends boolean, Group_11 extends GroupBase<Option_11>>(props: import("react-select").NoticeProps<Option_11, IsMulti_11, Group_11>): import("@emotion/react").jsx.JSX.Element;
|
|
221
|
-
defaultProps: {
|
|
222
|
-
children: string;
|
|
223
|
-
};
|
|
224
|
-
};
|
|
225
|
-
NoOptionsMessage: {
|
|
226
|
-
<Option_12, IsMulti_12 extends boolean, Group_12 extends GroupBase<Option_12>>(props: import("react-select").NoticeProps<Option_12, IsMulti_12, Group_12>): import("@emotion/react").jsx.JSX.Element;
|
|
227
|
-
defaultProps: {
|
|
228
|
-
children: string;
|
|
229
|
-
};
|
|
230
|
-
};
|
|
231
|
-
MultiValue: <Option_13, IsMulti_13 extends boolean, Group_13 extends GroupBase<Option_13>>(props: import("react-select").MultiValueProps<Option_13, IsMulti_13, Group_13>) => import("@emotion/react").jsx.JSX.Element;
|
|
232
|
-
MultiValueContainer: <Option_14, IsMulti_14 extends boolean, Group_14 extends GroupBase<Option_14>>({ children, innerProps, }: import("react-select").MultiValueGenericProps<Option_14, IsMulti_14, Group_14>) => import("@emotion/react").jsx.JSX.Element;
|
|
233
|
-
MultiValueLabel: <Option_14_1, IsMulti_14_1 extends boolean, Group_14_1 extends GroupBase<Option_14_1>>({ children, innerProps, }: import("react-select").MultiValueGenericProps<Option_14_1, IsMulti_14_1, Group_14_1>) => import("@emotion/react").jsx.JSX.Element;
|
|
234
|
-
MultiValueRemove: typeof import("react-select/dist/declarations/src/components/MultiValue").MultiValueRemove;
|
|
235
|
-
Option: <Option_15, IsMulti_15 extends boolean, Group_15 extends GroupBase<Option_15>>(props: import("react-select").OptionProps<Option_15, IsMulti_15, Group_15>) => import("@emotion/react").jsx.JSX.Element;
|
|
236
|
-
Placeholder: <Option_16, IsMulti_16 extends boolean, Group_16 extends GroupBase<Option_16>>(props: import("react-select").PlaceholderProps<Option_16, IsMulti_16, Group_16>) => import("@emotion/react").jsx.JSX.Element;
|
|
237
|
-
SelectContainer: <Option_17, IsMulti_17 extends boolean, Group_17 extends GroupBase<Option_17>>(props: import("react-select").ContainerProps<Option_17, IsMulti_17, Group_17>) => import("@emotion/react").jsx.JSX.Element;
|
|
238
|
-
SingleValue: <Option_18, IsMulti_18 extends boolean, Group_18 extends GroupBase<Option_18>>(props: import("react-select").SingleValueProps<Option_18, IsMulti_18, Group_18>) => import("@emotion/react").jsx.JSX.Element;
|
|
239
|
-
ValueContainer: <Option_19, IsMulti_19 extends boolean, Group_19 extends GroupBase<Option_19>>(props: import("react-select").ValueContainerProps<Option_19, IsMulti_19, Group_19>) => import("@emotion/react").jsx.JSX.Element;
|
|
240
|
-
}>>;
|
|
241
146
|
getItemCount: () => number;
|
|
242
147
|
getMaxHeight: () => number | undefined;
|
|
243
148
|
showSearchControl: () => boolean | undefined;
|
|
@@ -59,17 +59,18 @@ interface NativeReactSelectProps<Option = unknown, IsMulti extends boolean = fal
|
|
|
59
59
|
getOptionValue?: GetOptionValue<Option>;
|
|
60
60
|
/** Hide the selected option from the menu. */
|
|
61
61
|
hideSelectedOptions?: boolean;
|
|
62
|
-
/** The
|
|
62
|
+
/** The ID to set on the SelectContainer component. */
|
|
63
63
|
id?: string;
|
|
64
64
|
/** The value of the search input. */
|
|
65
65
|
inputValue?: string;
|
|
66
|
-
/** The
|
|
66
|
+
/** The ID of the search input. */
|
|
67
67
|
inputId?: string;
|
|
68
|
-
/** Define an
|
|
68
|
+
/** Define an ID prefix for the select components. For example, `{your-id}-value`. */
|
|
69
69
|
instanceId?: number | string;
|
|
70
70
|
/** Sets whether the select value is clearable. */
|
|
71
71
|
isClearable?: boolean;
|
|
72
|
-
/** Sets whether the select is disabled.
|
|
72
|
+
/** Sets whether the select is disabled. People won't be able to interact with the select and it won't appear in the focus order.
|
|
73
|
+
* Wherever possible, prefer using validation and error messaging over disabled fields for a more accessible experience. */
|
|
73
74
|
isDisabled?: boolean;
|
|
74
75
|
/** Sets whether the select is in a state of loading (async). */
|
|
75
76
|
isLoading?: boolean;
|
|
@@ -125,9 +126,9 @@ interface NativeReactSelectProps<Option = unknown, IsMulti extends boolean = fal
|
|
|
125
126
|
onMenuOpen?: () => void;
|
|
126
127
|
/** Handle the menu closing. */
|
|
127
128
|
onMenuClose?: () => void;
|
|
128
|
-
/**
|
|
129
|
+
/** Sent when the user scrolls to the top of the menu. */
|
|
129
130
|
onMenuScrollToTop?: (event?: WheelEvent | TouchEvent) => void;
|
|
130
|
-
/**
|
|
131
|
+
/** Sent when the user scrolls to the bottom of the menu. */
|
|
131
132
|
onMenuScrollToBottom?: (event?: WheelEvent | TouchEvent) => void;
|
|
132
133
|
/** Allows control of whether the menu is opened when the select is focused. */
|
|
133
134
|
openMenuOnFocus?: boolean;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export interface OptionProps<Option = OptionType, IsMulti extends boolean = fals
|
|
|
26
26
|
interface CustomSelectProps extends WithAnalyticsEventsProps {
|
|
27
27
|
/** This prop affects the height of the select control. Compact is gridSize() * 4, default is gridSize * 5 */
|
|
28
28
|
spacing?: 'compact' | 'default';
|
|
29
|
-
/** This prop affects the backgroundColor and border of the Select field. 'subtle' makes these transparent while 'none'
|
|
29
|
+
/** This prop affects the backgroundColor and border of the Select field. 'subtle' makes these transparent while 'none' prevents all field styling. Take care when using the none appearance as this doesn't include accessible interactions. */
|
|
30
30
|
appearance?: 'default' | 'subtle' | 'none';
|
|
31
31
|
/** Prop for testing */
|
|
32
32
|
testId?: string;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React, { KeyboardEventHandler, PureComponent, ReactNode } from 'react';
|
|
2
|
-
import { GroupBase } from 'react-select';
|
|
3
2
|
import BaseSelect from 'react-select/base';
|
|
4
3
|
import { PopperProps } from 'react-popper';
|
|
5
|
-
import { defaultComponents } from './components';
|
|
6
4
|
import { OptionType, ActionMeta, ReactSelectProps, StylesConfig, ValueType, ValidationState } from '../types';
|
|
7
5
|
import { UnbindFn } from 'bind-event-listener';
|
|
8
6
|
type defaultModifiers = 'offset' | 'preventOverflow';
|
|
@@ -17,11 +15,11 @@ interface PopupSelectTriggerProps {
|
|
|
17
15
|
export type ModifierList = 'offset' | 'computeStyles' | 'preventOverflow' | 'handleFlipStyle' | 'flip' | 'popperOffsets' | 'arrow' | 'hide' | 'eventListeners' | 'applyStyles';
|
|
18
16
|
export interface PopupSelectProps<Option = OptionType, IsMulti extends boolean = false, Modifiers = ModifierList> extends ReactSelectProps<Option, IsMulti> {
|
|
19
17
|
/**
|
|
20
|
-
* Defines whether the menu should close when selected.
|
|
18
|
+
* Defines whether the menu should close when selected. The default is `true`.
|
|
21
19
|
*/
|
|
22
20
|
closeMenuOnSelect?: boolean;
|
|
23
21
|
/**
|
|
24
|
-
* The footer content shown at the bottom of the
|
|
22
|
+
* The footer content shown at the bottom of the popup, underneath the select options.
|
|
25
23
|
*/
|
|
26
24
|
footer?: ReactNode;
|
|
27
25
|
/**
|
|
@@ -33,21 +31,21 @@ export interface PopupSelectProps<Option = OptionType, IsMulti extends boolean =
|
|
|
33
31
|
*/
|
|
34
32
|
popperProps?: PopperPropsNoChildren<Modifiers>;
|
|
35
33
|
/**
|
|
36
|
-
* The maximum number of options the select can contain without rendering the search field.
|
|
34
|
+
* The maximum number of options the select can contain without rendering the search field. The default is `5`.
|
|
37
35
|
*/
|
|
38
36
|
searchThreshold?: number;
|
|
39
37
|
/**
|
|
40
|
-
* If false
|
|
41
|
-
* number of options exceeds the `searchThreshold`.
|
|
38
|
+
* If `false`, renders a select with no search field. If `true`, renders a search field in the select when the
|
|
39
|
+
* number of options exceeds the `searchThreshold`. The default is `true`.
|
|
42
40
|
*/
|
|
43
41
|
isSearchable?: boolean;
|
|
44
42
|
/**
|
|
45
|
-
* The maximum width for the popup menu. Can be a number, representing width in pixels,
|
|
43
|
+
* The maximum width for the popup menu. Can be a number, representing the width in pixels,
|
|
46
44
|
* or a string containing a CSS length datatype.
|
|
47
45
|
*/
|
|
48
46
|
maxMenuWidth?: number | string;
|
|
49
47
|
/**
|
|
50
|
-
* The maximum width for the popup menu. Can be a number, representing width in pixels,
|
|
48
|
+
* The maximum width for the popup menu. Can be a number, representing the width in pixels,
|
|
51
49
|
* or a string containing a CSS length datatype.
|
|
52
50
|
*/
|
|
53
51
|
minMenuWidth?: number | string;
|
|
@@ -69,23 +67,18 @@ export interface PopupSelectProps<Option = OptionType, IsMulti extends boolean =
|
|
|
69
67
|
}) => ReactNode;
|
|
70
68
|
isOpen?: boolean;
|
|
71
69
|
defaultIsOpen?: boolean;
|
|
72
|
-
/**
|
|
70
|
+
/** Use this to set whether the component uses compact or standard spacing. */
|
|
73
71
|
spacing?: string;
|
|
74
72
|
/** @deprecated Use isInvalid instead. The state of validation if used in a form */
|
|
75
73
|
validationState?: ValidationState;
|
|
76
|
-
/** This prop indicates if the component is in an error state */
|
|
74
|
+
/** This prop indicates if the component is in an error state. */
|
|
77
75
|
isInvalid?: boolean;
|
|
78
|
-
/** This gives an accessible name to the input for
|
|
76
|
+
/** This gives an accessible name to the input for people who use assistive technology. */
|
|
79
77
|
label?: string;
|
|
80
78
|
testId?: string;
|
|
81
79
|
}
|
|
82
80
|
interface State<Modifiers = string> {
|
|
83
|
-
|
|
84
|
-
* TODO: This type should be cleaned up with `platform.design-system-team.popup-select-render-perf_i0s6m`.
|
|
85
|
-
* - If discarded, revert to `focusLockEnabled: boolean`
|
|
86
|
-
* - If kept, delete this type.
|
|
87
|
-
*/
|
|
88
|
-
focusLockEnabled?: boolean;
|
|
81
|
+
focusLockEnabled: boolean;
|
|
89
82
|
isOpen: boolean;
|
|
90
83
|
mergedComponents: Object;
|
|
91
84
|
mergedPopperProps: PopperPropsNoChildren<defaultModifiers | Modifiers>;
|
|
@@ -100,15 +93,6 @@ export default class PopupSelect<Option = OptionType, IsMulti extends boolean =
|
|
|
100
93
|
isOpenControlled: boolean;
|
|
101
94
|
defaultOpenState: boolean | undefined;
|
|
102
95
|
state: {
|
|
103
|
-
isOpen: boolean;
|
|
104
|
-
mergedComponents: {
|
|
105
|
-
Control: React.FC<import("../types").ControlProps<OptionType, boolean>>;
|
|
106
|
-
DropdownIndicator: () => import("@emotion/react").jsx.JSX.Element;
|
|
107
|
-
Menu: ({ children, innerProps }: import("../types").MenuProps<OptionType, boolean>) => import("@emotion/react").jsx.JSX.Element;
|
|
108
|
-
};
|
|
109
|
-
mergedPopperProps: PopperPropsNoChildren<string>;
|
|
110
|
-
focusLockEnabled?: undefined;
|
|
111
|
-
} | {
|
|
112
96
|
focusLockEnabled: boolean;
|
|
113
97
|
isOpen: boolean;
|
|
114
98
|
mergedComponents: {
|
|
@@ -159,85 +143,6 @@ export default class PopupSelect<Option = OptionType, IsMulti extends boolean =
|
|
|
159
143
|
resolveTargetRef: (popperRef: React.Ref<HTMLElement>) => (ref: HTMLElement) => void;
|
|
160
144
|
resolveMenuRef: (popperRef: React.Ref<HTMLElement>) => (ref: HTMLElement) => void;
|
|
161
145
|
getSelectRef: (ref: BaseSelect<Option, IsMulti>) => void;
|
|
162
|
-
getSelectStyles: import("memoize-one").MemoizedFn<(defaultStyles: StylesConfig<Option, IsMulti>, propStyles: StylesConfig<Option, IsMulti> | undefined) => {
|
|
163
|
-
clearIndicator?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").ClearIndicatorProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
164
|
-
container?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").ContainerProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
165
|
-
control?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").ControlProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
166
|
-
dropdownIndicator?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").DropdownIndicatorProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
167
|
-
group?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").GroupProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
168
|
-
groupHeading?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").GroupHeadingProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
169
|
-
indicatorsContainer?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").IndicatorsContainerProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
170
|
-
indicatorSeparator?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").IndicatorSeparatorProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
171
|
-
input?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").InputProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
172
|
-
loadingIndicator?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").LoadingIndicatorProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
173
|
-
loadingMessage?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").NoticeProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
174
|
-
menu?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").MenuProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
175
|
-
menuList?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").MenuListProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
176
|
-
menuPortal?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select/dist/declarations/src/components/Menu").PortalStyleArgs> | undefined; /** @deprecated Use isInvalid instead. The state of validation if used in a form */
|
|
177
|
-
multiValue?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").MultiValueProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
178
|
-
multiValueLabel?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").MultiValueProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
179
|
-
multiValueRemove?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").MultiValueProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
180
|
-
noOptionsMessage?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").NoticeProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
181
|
-
option?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").OptionProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
182
|
-
placeholder?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").PlaceholderProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
183
|
-
singleValue?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").SingleValueProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
184
|
-
valueContainer?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").ValueContainerProps<Option, IsMulti, GroupBase<Option>>> | undefined;
|
|
185
|
-
}>;
|
|
186
|
-
getSelectComponents: import("memoize-one").MemoizedFn<(mergedComponents: typeof defaultComponents, showSearchControl: boolean | undefined) => Partial<{
|
|
187
|
-
ClearIndicator: <Option_1, IsMulti_1 extends boolean, Group extends GroupBase<Option_1>>(props: import("react-select").ClearIndicatorProps<Option_1, IsMulti_1, Group>) => import("@emotion/react").jsx.JSX.Element;
|
|
188
|
-
Control: <Option_1, IsMulti_1 extends boolean, Group_1 extends GroupBase<Option_1>>(props: import("react-select").ControlProps<Option_1, IsMulti_1, Group_1>) => import("@emotion/react").jsx.JSX.Element;
|
|
189
|
-
DropdownIndicator: <Option_2, IsMulti_2 extends boolean, Group_2 extends GroupBase<Option_2>>(props: import("react-select").DropdownIndicatorProps<Option_2, IsMulti_2, Group_2>) => import("@emotion/react").jsx.JSX.Element;
|
|
190
|
-
/**
|
|
191
|
-
Render props used to anchor the popup to your content.
|
|
192
|
-
|
|
193
|
-
Make this an interactive element, such as an @atlaskit/button component.
|
|
194
|
-
|
|
195
|
-
The provided render props in `options` are detailed below:
|
|
196
|
-
- `isOpen`: The current state of the popup.
|
|
197
|
-
Use this to change the appearance of your target based on the state of your component
|
|
198
|
-
- `ref`: Pass this ref to the element the Popup should be attached to
|
|
199
|
-
- `onKeyDown`: Pass this keydown handler to the element to allow keyboard users to access the element.
|
|
200
|
-
- `aria-haspopup`, `aria-expanded`, `aria-controls`: Spread these onto a target element to
|
|
201
|
-
ensure your experience is accessible
|
|
202
|
-
*/
|
|
203
|
-
DownChevron: (props: import("react-select/dist/declarations/src/components/indicators").DownChevronProps) => import("@emotion/react").jsx.JSX.Element;
|
|
204
|
-
CrossIcon: (props: import("react-select/dist/declarations/src/components/indicators").CrossIconProps) => import("@emotion/react").jsx.JSX.Element;
|
|
205
|
-
Group: <Option_3, IsMulti_3 extends boolean, Group_3 extends GroupBase<Option_3>>(props: import("react-select").GroupProps<Option_3, IsMulti_3, Group_3>) => import("@emotion/react").jsx.JSX.Element;
|
|
206
|
-
GroupHeading: <Option_4, IsMulti_4 extends boolean, Group_4 extends GroupBase<Option_4>>(props: import("react-select").GroupHeadingProps<Option_4, IsMulti_4, Group_4>) => import("@emotion/react").jsx.JSX.Element;
|
|
207
|
-
IndicatorsContainer: <Option_5, IsMulti_5 extends boolean, Group_5 extends GroupBase<Option_5>>(props: import("react-select").IndicatorsContainerProps<Option_5, IsMulti_5, Group_5>) => import("@emotion/react").jsx.JSX.Element;
|
|
208
|
-
IndicatorSeparator: <Option_6, IsMulti_6 extends boolean, Group_6 extends GroupBase<Option_6>>(props: import("react-select").IndicatorSeparatorProps<Option_6, IsMulti_6, Group_6>) => import("@emotion/react").jsx.JSX.Element;
|
|
209
|
-
Input: <Option_7, IsMulti_7 extends boolean, Group_7 extends GroupBase<Option_7>>(props: import("react-select").InputProps<Option_7, IsMulti_7, Group_7>) => import("@emotion/react").jsx.JSX.Element;
|
|
210
|
-
LoadingIndicator: {
|
|
211
|
-
<Option_8, IsMulti_8 extends boolean, Group_8 extends GroupBase<Option_8>>(props: import("react-select").LoadingIndicatorProps<Option_8, IsMulti_8, Group_8>): import("@emotion/react").jsx.JSX.Element;
|
|
212
|
-
defaultProps: {
|
|
213
|
-
size: number;
|
|
214
|
-
};
|
|
215
|
-
};
|
|
216
|
-
Menu: <Option_9, IsMulti_9 extends boolean, Group_9 extends GroupBase<Option_9>>(props: import("react-select").MenuProps<Option_9, IsMulti_9, Group_9>) => import("@emotion/react").jsx.JSX.Element;
|
|
217
|
-
MenuList: <Option_10, IsMulti_10 extends boolean, Group_10 extends GroupBase<Option_10>>(props: import("react-select").MenuListProps<Option_10, IsMulti_10, Group_10>) => import("@emotion/react").jsx.JSX.Element;
|
|
218
|
-
MenuPortal: typeof import("react-select/dist/declarations/src/components/Menu").MenuPortal;
|
|
219
|
-
LoadingMessage: {
|
|
220
|
-
<Option_11, IsMulti_11 extends boolean, Group_11 extends GroupBase<Option_11>>(props: import("react-select").NoticeProps<Option_11, IsMulti_11, Group_11>): import("@emotion/react").jsx.JSX.Element;
|
|
221
|
-
defaultProps: {
|
|
222
|
-
children: string;
|
|
223
|
-
};
|
|
224
|
-
};
|
|
225
|
-
NoOptionsMessage: {
|
|
226
|
-
<Option_12, IsMulti_12 extends boolean, Group_12 extends GroupBase<Option_12>>(props: import("react-select").NoticeProps<Option_12, IsMulti_12, Group_12>): import("@emotion/react").jsx.JSX.Element;
|
|
227
|
-
defaultProps: {
|
|
228
|
-
children: string;
|
|
229
|
-
};
|
|
230
|
-
};
|
|
231
|
-
MultiValue: <Option_13, IsMulti_13 extends boolean, Group_13 extends GroupBase<Option_13>>(props: import("react-select").MultiValueProps<Option_13, IsMulti_13, Group_13>) => import("@emotion/react").jsx.JSX.Element;
|
|
232
|
-
MultiValueContainer: <Option_14, IsMulti_14 extends boolean, Group_14 extends GroupBase<Option_14>>({ children, innerProps, }: import("react-select").MultiValueGenericProps<Option_14, IsMulti_14, Group_14>) => import("@emotion/react").jsx.JSX.Element;
|
|
233
|
-
MultiValueLabel: <Option_14_1, IsMulti_14_1 extends boolean, Group_14_1 extends GroupBase<Option_14_1>>({ children, innerProps, }: import("react-select").MultiValueGenericProps<Option_14_1, IsMulti_14_1, Group_14_1>) => import("@emotion/react").jsx.JSX.Element;
|
|
234
|
-
MultiValueRemove: typeof import("react-select/dist/declarations/src/components/MultiValue").MultiValueRemove;
|
|
235
|
-
Option: <Option_15, IsMulti_15 extends boolean, Group_15 extends GroupBase<Option_15>>(props: import("react-select").OptionProps<Option_15, IsMulti_15, Group_15>) => import("@emotion/react").jsx.JSX.Element;
|
|
236
|
-
Placeholder: <Option_16, IsMulti_16 extends boolean, Group_16 extends GroupBase<Option_16>>(props: import("react-select").PlaceholderProps<Option_16, IsMulti_16, Group_16>) => import("@emotion/react").jsx.JSX.Element;
|
|
237
|
-
SelectContainer: <Option_17, IsMulti_17 extends boolean, Group_17 extends GroupBase<Option_17>>(props: import("react-select").ContainerProps<Option_17, IsMulti_17, Group_17>) => import("@emotion/react").jsx.JSX.Element;
|
|
238
|
-
SingleValue: <Option_18, IsMulti_18 extends boolean, Group_18 extends GroupBase<Option_18>>(props: import("react-select").SingleValueProps<Option_18, IsMulti_18, Group_18>) => import("@emotion/react").jsx.JSX.Element;
|
|
239
|
-
ValueContainer: <Option_19, IsMulti_19 extends boolean, Group_19 extends GroupBase<Option_19>>(props: import("react-select").ValueContainerProps<Option_19, IsMulti_19, Group_19>) => import("@emotion/react").jsx.JSX.Element;
|
|
240
|
-
}>>;
|
|
241
146
|
getItemCount: () => number;
|
|
242
147
|
getMaxHeight: () => number | undefined;
|
|
243
148
|
showSearchControl: () => boolean | undefined;
|
|
@@ -59,17 +59,18 @@ interface NativeReactSelectProps<Option = unknown, IsMulti extends boolean = fal
|
|
|
59
59
|
getOptionValue?: GetOptionValue<Option>;
|
|
60
60
|
/** Hide the selected option from the menu. */
|
|
61
61
|
hideSelectedOptions?: boolean;
|
|
62
|
-
/** The
|
|
62
|
+
/** The ID to set on the SelectContainer component. */
|
|
63
63
|
id?: string;
|
|
64
64
|
/** The value of the search input. */
|
|
65
65
|
inputValue?: string;
|
|
66
|
-
/** The
|
|
66
|
+
/** The ID of the search input. */
|
|
67
67
|
inputId?: string;
|
|
68
|
-
/** Define an
|
|
68
|
+
/** Define an ID prefix for the select components. For example, `{your-id}-value`. */
|
|
69
69
|
instanceId?: number | string;
|
|
70
70
|
/** Sets whether the select value is clearable. */
|
|
71
71
|
isClearable?: boolean;
|
|
72
|
-
/** Sets whether the select is disabled.
|
|
72
|
+
/** Sets whether the select is disabled. People won't be able to interact with the select and it won't appear in the focus order.
|
|
73
|
+
* Wherever possible, prefer using validation and error messaging over disabled fields for a more accessible experience. */
|
|
73
74
|
isDisabled?: boolean;
|
|
74
75
|
/** Sets whether the select is in a state of loading (async). */
|
|
75
76
|
isLoading?: boolean;
|
|
@@ -125,9 +126,9 @@ interface NativeReactSelectProps<Option = unknown, IsMulti extends boolean = fal
|
|
|
125
126
|
onMenuOpen?: () => void;
|
|
126
127
|
/** Handle the menu closing. */
|
|
127
128
|
onMenuClose?: () => void;
|
|
128
|
-
/**
|
|
129
|
+
/** Sent when the user scrolls to the top of the menu. */
|
|
129
130
|
onMenuScrollToTop?: (event?: WheelEvent | TouchEvent) => void;
|
|
130
|
-
/**
|
|
131
|
+
/** Sent when the user scrolls to the bottom of the menu. */
|
|
131
132
|
onMenuScrollToBottom?: (event?: WheelEvent | TouchEvent) => void;
|
|
132
133
|
/** Allows control of whether the menu is opened when the select is focused. */
|
|
133
134
|
openMenuOnFocus?: boolean;
|
|
@@ -26,7 +26,7 @@ export interface OptionProps<Option = OptionType, IsMulti extends boolean = fals
|
|
|
26
26
|
interface CustomSelectProps extends WithAnalyticsEventsProps {
|
|
27
27
|
/** This prop affects the height of the select control. Compact is gridSize() * 4, default is gridSize * 5 */
|
|
28
28
|
spacing?: 'compact' | 'default';
|
|
29
|
-
/** This prop affects the backgroundColor and border of the Select field. 'subtle' makes these transparent while 'none'
|
|
29
|
+
/** This prop affects the backgroundColor and border of the Select field. 'subtle' makes these transparent while 'none' prevents all field styling. Take care when using the none appearance as this doesn't include accessible interactions. */
|
|
30
30
|
appearance?: 'default' | 'subtle' | 'none';
|
|
31
31
|
/** Prop for testing */
|
|
32
32
|
testId?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/select",
|
|
3
|
-
"version": "17.1.
|
|
3
|
+
"version": "17.1.3",
|
|
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/"
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@atlaskit/analytics-next": "^9.2.0",
|
|
45
|
-
"@atlaskit/icon": "^22.
|
|
45
|
+
"@atlaskit/icon": "^22.1.0",
|
|
46
46
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
47
47
|
"@atlaskit/spinner": "^16.0.0",
|
|
48
48
|
"@atlaskit/theme": "^12.6.0",
|
|
49
|
-
"@atlaskit/tokens": "^1.
|
|
49
|
+
"@atlaskit/tokens": "^1.38.0",
|
|
50
50
|
"@atlaskit/visually-hidden": "^1.2.0",
|
|
51
51
|
"@babel/runtime": "^7.0.0",
|
|
52
52
|
"@emotion/react": "^11.7.1",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"platform.design-system-team.border-checkbox_nyoiu": {
|
|
102
102
|
"type": "boolean"
|
|
103
103
|
},
|
|
104
|
-
"platform.design-system-team.
|
|
104
|
+
"platform.design-system-team.update-input-border-wdith_5abwv": {
|
|
105
105
|
"type": "boolean"
|
|
106
106
|
},
|
|
107
107
|
"platform.design-system-team.popup-select-close_8h15h": {
|