@atlaskit/select 17.6.0 → 17.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/PopupSelect/PopupSelect.js +7 -4
- package/dist/cjs/Select.js +1 -1
- package/dist/es2019/PopupSelect/PopupSelect.js +7 -6
- package/dist/es2019/Select.js +1 -1
- package/dist/esm/PopupSelect/PopupSelect.js +7 -4
- package/dist/esm/Select.js +1 -1
- package/dist/types/AsyncCreatableSelect.d.ts +1 -5
- package/dist/types/AsyncSelect.d.ts +1 -5
- package/dist/types/CreatableSelect.d.ts +1 -5
- package/dist/types/PopupSelect/PopupSelect.d.ts +5 -5
- package/dist/types/Select.d.ts +2 -10
- package/dist/types/createSelect.d.ts +1 -7
- package/dist/types/types.d.ts +13 -1
- package/dist/types-ts4.5/AsyncCreatableSelect.d.ts +1 -5
- package/dist/types-ts4.5/AsyncSelect.d.ts +1 -5
- package/dist/types-ts4.5/CreatableSelect.d.ts +1 -5
- package/dist/types-ts4.5/PopupSelect/PopupSelect.d.ts +5 -5
- package/dist/types-ts4.5/Select.d.ts +2 -10
- package/dist/types-ts4.5/createSelect.d.ts +1 -7
- package/dist/types-ts4.5/types.d.ts +13 -1
- package/package.json +11 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/select
|
|
2
2
|
|
|
3
|
+
## 17.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#85404](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/85404) [`54d6e7a58943`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/54d6e7a58943) - use `@atlaskit/select` component in `PopupSelect`.
|
|
8
|
+
This allows `PopupSelect` to receive all the improvements from `@atlaskit/select`.
|
|
9
|
+
|
|
10
|
+
## 17.6.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#94316](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/94316) [`35fd5ed8e1d7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/35fd5ed8e1d7) - Upgrading internal dependency `bind-event-listener` to `@^3.0.0`
|
|
15
|
+
|
|
3
16
|
## 17.6.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
|
@@ -23,6 +23,7 @@ var _reactUid = require("react-uid");
|
|
|
23
23
|
var _reactPopper = require("react-popper");
|
|
24
24
|
var _reactNodeResolver = _interopRequireDefault(require("react-node-resolver"));
|
|
25
25
|
var _shallowEqual = require("shallow-equal");
|
|
26
|
+
var _Select = _interopRequireDefault(require("../Select"));
|
|
26
27
|
var _colors = require("@atlaskit/theme/colors");
|
|
27
28
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
28
29
|
var _components = require("./components");
|
|
@@ -82,7 +83,6 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
82
83
|
}
|
|
83
84
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
84
85
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "menuRef", null);
|
|
85
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "selectRef", null);
|
|
86
86
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "targetRef", null);
|
|
87
87
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "unbindWindowClick", null);
|
|
88
88
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "unbindWindowKeydown", null);
|
|
@@ -187,7 +187,8 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
187
187
|
isOpen: true
|
|
188
188
|
});
|
|
189
189
|
if (_this.selectRef) {
|
|
190
|
-
_this
|
|
190
|
+
var _this$selectRef$selec;
|
|
191
|
+
(0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.use-default-select-in-popup-select_46rmj') ? (_this$selectRef$selec = _this.selectRef.select) === null || _this$selectRef$selec === void 0 ? void 0 : _this$selectRef$selec.openMenu('first') : _this.selectRef.openMenu('first');
|
|
191
192
|
}
|
|
192
193
|
if (typeof window === 'undefined') {
|
|
193
194
|
return;
|
|
@@ -277,6 +278,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
277
278
|
return count;
|
|
278
279
|
});
|
|
279
280
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getMaxHeight", function () {
|
|
281
|
+
var _this$selectRef$selec2;
|
|
280
282
|
var maxMenuHeight = _this.props.maxMenuHeight;
|
|
281
283
|
if (!_this.selectRef) {
|
|
282
284
|
return maxMenuHeight;
|
|
@@ -284,7 +286,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
284
286
|
|
|
285
287
|
// subtract the control height to maintain consistency
|
|
286
288
|
var showSearchControl = _this.showSearchControl();
|
|
287
|
-
var controlRef = _this.selectRef.controlRef;
|
|
289
|
+
var controlRef = (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.use-default-select-in-popup-select_46rmj') ? (_this$selectRef$selec2 = _this.selectRef.select) === null || _this$selectRef$selec2 === void 0 ? void 0 : _this$selectRef$selec2.controlRef : _this.selectRef.controlRef;
|
|
288
290
|
var offsetHeight = showSearchControl && controlRef ? controlRef.offsetHeight : 0;
|
|
289
291
|
var maxHeight = maxMenuHeight - offsetHeight;
|
|
290
292
|
return maxHeight;
|
|
@@ -328,6 +330,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
328
330
|
return placeholder;
|
|
329
331
|
}
|
|
330
332
|
};
|
|
333
|
+
var InternalSelect = (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.use-default-select-in-popup-select_46rmj') ? _Select.default : _reactSelect.default;
|
|
331
334
|
var popper = /*#__PURE__*/_react.default.createElement(_reactPopper.Popper, (0, _extends2.default)({}, mergedPopperProps, {
|
|
332
335
|
onFirstUpdate: function onFirstUpdate(state) {
|
|
333
336
|
var _mergedPopperProps$on;
|
|
@@ -350,7 +353,7 @@ var PopupSelect = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
350
353
|
}, /*#__PURE__*/_react.default.createElement(_reactFocusLock.default, {
|
|
351
354
|
disabled: !focusLockEnabled,
|
|
352
355
|
returnFocus: true
|
|
353
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
356
|
+
}, /*#__PURE__*/_react.default.createElement(InternalSelect, (0, _extends2.default)({
|
|
354
357
|
"aria-label": getLabel(),
|
|
355
358
|
backspaceRemovesValue: false,
|
|
356
359
|
controlShouldRenderValue: false,
|
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.
|
|
12
|
+
var packageVersion = "17.7.0";
|
|
13
13
|
var SelectWithoutAnalytics = exports.SelectWithoutAnalytics = (0, _createSelect.default)(_reactSelect.default);
|
|
14
14
|
var createAndFireEventOnAtlaskit = (0, _analyticsNext.createAndFireEvent)('atlaskit');
|
|
15
15
|
var Select = (0, _analyticsNext.withAnalyticsContext)({
|
|
@@ -8,6 +8,7 @@ import { uid } from 'react-uid';
|
|
|
8
8
|
import { Manager, Reference, Popper } from 'react-popper';
|
|
9
9
|
import NodeResolver from 'react-node-resolver';
|
|
10
10
|
import { shallowEqualObjects } from 'shallow-equal';
|
|
11
|
+
import DefaultSelect from '../Select';
|
|
11
12
|
import { N80 } from '@atlaskit/theme/colors';
|
|
12
13
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
13
14
|
import { MenuDialog, DummyControl, defaultComponents } from './components';
|
|
@@ -49,7 +50,6 @@ export default class PopupSelect extends PureComponent {
|
|
|
49
50
|
var _this$defaultOpenStat;
|
|
50
51
|
super(...args);
|
|
51
52
|
_defineProperty(this, "menuRef", null);
|
|
52
|
-
_defineProperty(this, "selectRef", null);
|
|
53
53
|
_defineProperty(this, "targetRef", null);
|
|
54
54
|
_defineProperty(this, "unbindWindowClick", null);
|
|
55
55
|
_defineProperty(this, "unbindWindowKeydown", null);
|
|
@@ -159,7 +159,8 @@ export default class PopupSelect extends PureComponent {
|
|
|
159
159
|
isOpen: true
|
|
160
160
|
});
|
|
161
161
|
if (this.selectRef) {
|
|
162
|
-
|
|
162
|
+
var _this$selectRef$selec;
|
|
163
|
+
getBooleanFF('platform.design-system-team.use-default-select-in-popup-select_46rmj') ? (_this$selectRef$selec = this.selectRef.select) === null || _this$selectRef$selec === void 0 ? void 0 : _this$selectRef$selec.openMenu('first') : this.selectRef.openMenu('first');
|
|
163
164
|
}
|
|
164
165
|
if (typeof window === 'undefined') {
|
|
165
166
|
return;
|
|
@@ -247,6 +248,7 @@ export default class PopupSelect extends PureComponent {
|
|
|
247
248
|
return count;
|
|
248
249
|
});
|
|
249
250
|
_defineProperty(this, "getMaxHeight", () => {
|
|
251
|
+
var _this$selectRef$selec2;
|
|
250
252
|
const {
|
|
251
253
|
maxMenuHeight
|
|
252
254
|
} = this.props;
|
|
@@ -256,9 +258,7 @@ export default class PopupSelect extends PureComponent {
|
|
|
256
258
|
|
|
257
259
|
// subtract the control height to maintain consistency
|
|
258
260
|
const showSearchControl = this.showSearchControl();
|
|
259
|
-
|
|
260
|
-
controlRef
|
|
261
|
-
} = this.selectRef;
|
|
261
|
+
let controlRef = getBooleanFF('platform.design-system-team.use-default-select-in-popup-select_46rmj') ? (_this$selectRef$selec2 = this.selectRef.select) === null || _this$selectRef$selec2 === void 0 ? void 0 : _this$selectRef$selec2.controlRef : this.selectRef.controlRef;
|
|
262
262
|
const offsetHeight = showSearchControl && controlRef ? controlRef.offsetHeight : 0;
|
|
263
263
|
const maxHeight = maxMenuHeight - offsetHeight;
|
|
264
264
|
return maxHeight;
|
|
@@ -306,6 +306,7 @@ export default class PopupSelect extends PureComponent {
|
|
|
306
306
|
return placeholder;
|
|
307
307
|
}
|
|
308
308
|
};
|
|
309
|
+
const InternalSelect = getBooleanFF('platform.design-system-team.use-default-select-in-popup-select_46rmj') ? DefaultSelect : Select;
|
|
309
310
|
const popper = /*#__PURE__*/React.createElement(Popper, _extends({}, mergedPopperProps, {
|
|
310
311
|
onFirstUpdate: state => {
|
|
311
312
|
var _mergedPopperProps$on;
|
|
@@ -328,7 +329,7 @@ export default class PopupSelect extends PureComponent {
|
|
|
328
329
|
}, /*#__PURE__*/React.createElement(FocusLock, {
|
|
329
330
|
disabled: !focusLockEnabled,
|
|
330
331
|
returnFocus: true
|
|
331
|
-
}, /*#__PURE__*/React.createElement(
|
|
332
|
+
}, /*#__PURE__*/React.createElement(InternalSelect, _extends({
|
|
332
333
|
"aria-label": getLabel(),
|
|
333
334
|
backspaceRemovesValue: false,
|
|
334
335
|
controlShouldRenderValue: false,
|
package/dist/es2019/Select.js
CHANGED
|
@@ -2,7 +2,7 @@ import ReactSelect 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.
|
|
5
|
+
const packageVersion = "17.7.0";
|
|
6
6
|
export const SelectWithoutAnalytics = createSelect(ReactSelect);
|
|
7
7
|
const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
8
8
|
const Select = withAnalyticsContext({
|
|
@@ -20,6 +20,7 @@ import { uid } from 'react-uid';
|
|
|
20
20
|
import { Manager, Reference, Popper } from 'react-popper';
|
|
21
21
|
import NodeResolver from 'react-node-resolver';
|
|
22
22
|
import { shallowEqualObjects } from 'shallow-equal';
|
|
23
|
+
import DefaultSelect from '../Select';
|
|
23
24
|
import { N80 } from '@atlaskit/theme/colors';
|
|
24
25
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
25
26
|
import { MenuDialog, DummyControl, defaultComponents } from './components';
|
|
@@ -72,7 +73,6 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
72
73
|
}
|
|
73
74
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
74
75
|
_defineProperty(_assertThisInitialized(_this), "menuRef", null);
|
|
75
|
-
_defineProperty(_assertThisInitialized(_this), "selectRef", null);
|
|
76
76
|
_defineProperty(_assertThisInitialized(_this), "targetRef", null);
|
|
77
77
|
_defineProperty(_assertThisInitialized(_this), "unbindWindowClick", null);
|
|
78
78
|
_defineProperty(_assertThisInitialized(_this), "unbindWindowKeydown", null);
|
|
@@ -177,7 +177,8 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
177
177
|
isOpen: true
|
|
178
178
|
});
|
|
179
179
|
if (_this.selectRef) {
|
|
180
|
-
_this
|
|
180
|
+
var _this$selectRef$selec;
|
|
181
|
+
getBooleanFF('platform.design-system-team.use-default-select-in-popup-select_46rmj') ? (_this$selectRef$selec = _this.selectRef.select) === null || _this$selectRef$selec === void 0 ? void 0 : _this$selectRef$selec.openMenu('first') : _this.selectRef.openMenu('first');
|
|
181
182
|
}
|
|
182
183
|
if (typeof window === 'undefined') {
|
|
183
184
|
return;
|
|
@@ -267,6 +268,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
267
268
|
return count;
|
|
268
269
|
});
|
|
269
270
|
_defineProperty(_assertThisInitialized(_this), "getMaxHeight", function () {
|
|
271
|
+
var _this$selectRef$selec2;
|
|
270
272
|
var maxMenuHeight = _this.props.maxMenuHeight;
|
|
271
273
|
if (!_this.selectRef) {
|
|
272
274
|
return maxMenuHeight;
|
|
@@ -274,7 +276,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
274
276
|
|
|
275
277
|
// subtract the control height to maintain consistency
|
|
276
278
|
var showSearchControl = _this.showSearchControl();
|
|
277
|
-
var controlRef = _this.selectRef.controlRef;
|
|
279
|
+
var controlRef = getBooleanFF('platform.design-system-team.use-default-select-in-popup-select_46rmj') ? (_this$selectRef$selec2 = _this.selectRef.select) === null || _this$selectRef$selec2 === void 0 ? void 0 : _this$selectRef$selec2.controlRef : _this.selectRef.controlRef;
|
|
278
280
|
var offsetHeight = showSearchControl && controlRef ? controlRef.offsetHeight : 0;
|
|
279
281
|
var maxHeight = maxMenuHeight - offsetHeight;
|
|
280
282
|
return maxHeight;
|
|
@@ -318,6 +320,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
318
320
|
return placeholder;
|
|
319
321
|
}
|
|
320
322
|
};
|
|
323
|
+
var InternalSelect = getBooleanFF('platform.design-system-team.use-default-select-in-popup-select_46rmj') ? DefaultSelect : Select;
|
|
321
324
|
var popper = /*#__PURE__*/React.createElement(Popper, _extends({}, mergedPopperProps, {
|
|
322
325
|
onFirstUpdate: function onFirstUpdate(state) {
|
|
323
326
|
var _mergedPopperProps$on;
|
|
@@ -340,7 +343,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
340
343
|
}, /*#__PURE__*/React.createElement(FocusLock, {
|
|
341
344
|
disabled: !focusLockEnabled,
|
|
342
345
|
returnFocus: true
|
|
343
|
-
}, /*#__PURE__*/React.createElement(
|
|
346
|
+
}, /*#__PURE__*/React.createElement(InternalSelect, _extends({
|
|
344
347
|
"aria-label": getLabel(),
|
|
345
348
|
backspaceRemovesValue: false,
|
|
346
349
|
controlShouldRenderValue: false,
|
package/dist/esm/Select.js
CHANGED
|
@@ -2,7 +2,7 @@ import ReactSelect 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.
|
|
5
|
+
var packageVersion = "17.7.0";
|
|
6
6
|
export var SelectWithoutAnalytics = createSelect(ReactSelect);
|
|
7
7
|
var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
8
8
|
var Select = withAnalyticsContext({
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
declare const _default: <Option extends unknown = import("./types").OptionType, IsMulti extends boolean = false>(props: (import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>) & {
|
|
3
|
-
ref?: import("react").Ref<
|
|
4
|
-
select: import("react-select/base").default<unknown, false, import("react-select").GroupBase<unknown>> | null;
|
|
5
|
-
blur: () => void;
|
|
6
|
-
focus: () => void;
|
|
7
|
-
}> | undefined;
|
|
3
|
+
ref?: import("react").Ref<import("./types").AtlaskitSelectRefType> | undefined;
|
|
8
4
|
}) => JSX.Element;
|
|
9
5
|
export default _default;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
declare const _default: <Option extends unknown = import("./types").OptionType, IsMulti extends boolean = false>(props: (import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>) & {
|
|
3
|
-
ref?: import("react").Ref<
|
|
4
|
-
select: import("react-select/base").default<unknown, false, import("react-select").GroupBase<unknown>> | null;
|
|
5
|
-
blur: () => void;
|
|
6
|
-
focus: () => void;
|
|
7
|
-
}> | undefined;
|
|
3
|
+
ref?: import("react").Ref<import("./types").AtlaskitSelectRefType> | undefined;
|
|
8
4
|
}) => JSX.Element;
|
|
9
5
|
export default _default;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
declare const _default: <Option extends unknown = import("./types").OptionType, IsMulti extends boolean = false>(props: (import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>) & {
|
|
3
|
-
ref?: import("react").Ref<
|
|
4
|
-
select: import("react-select/base").default<unknown, false, import("react-select").GroupBase<unknown>> | null;
|
|
5
|
-
blur: () => void;
|
|
6
|
-
focus: () => void;
|
|
7
|
-
}> | undefined;
|
|
3
|
+
ref?: import("react").Ref<import("./types").AtlaskitSelectRefType> | undefined;
|
|
8
4
|
}) => JSX.Element;
|
|
9
5
|
export default _default;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { KeyboardEventHandler, PureComponent, ReactNode } from 'react';
|
|
2
|
-
import BaseSelect from 'react-select/base';
|
|
3
2
|
import { PopperProps } from 'react-popper';
|
|
4
|
-
import { OptionType, ActionMeta, ReactSelectProps, StylesConfig, ValueType, ValidationState } from '../types';
|
|
3
|
+
import { OptionType, ActionMeta, ReactSelectProps, StylesConfig, ValueType, ValidationState, AtlaskitSelectRefType } from '../types';
|
|
5
4
|
import { UnbindFn } from 'bind-event-listener';
|
|
6
5
|
type defaultModifiers = 'offset' | 'preventOverflow';
|
|
7
6
|
type PopperPropsNoChildren<Modifiers> = Omit<PopperProps<Modifiers>, 'children'>;
|
|
@@ -68,13 +67,14 @@ export interface PopupSelectProps<Option = OptionType, IsMulti extends boolean =
|
|
|
68
67
|
isOpen?: boolean;
|
|
69
68
|
defaultIsOpen?: boolean;
|
|
70
69
|
/** Use this to set whether the component uses compact or standard spacing. */
|
|
71
|
-
spacing?:
|
|
70
|
+
spacing?: 'default' | 'compact';
|
|
72
71
|
/** @deprecated Use isInvalid instead. The state of validation if used in a form */
|
|
73
72
|
validationState?: ValidationState;
|
|
74
73
|
/** This prop indicates if the component is in an error state. */
|
|
75
74
|
isInvalid?: boolean;
|
|
76
75
|
/** This gives an accessible name to the input for people who use assistive technology. */
|
|
77
76
|
label?: string;
|
|
77
|
+
/** The `testId` prop appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests. It will be set on the menu element when defined: `{testId}--menu` */
|
|
78
78
|
testId?: string;
|
|
79
79
|
}
|
|
80
80
|
interface State<Modifiers = string> {
|
|
@@ -85,7 +85,7 @@ interface State<Modifiers = string> {
|
|
|
85
85
|
}
|
|
86
86
|
export default class PopupSelect<Option = OptionType, IsMulti extends boolean = false, Modifiers = ModifierList> extends PureComponent<PopupSelectProps<Option, IsMulti, Modifiers>, State> {
|
|
87
87
|
menuRef: HTMLElement | null;
|
|
88
|
-
selectRef:
|
|
88
|
+
selectRef: any;
|
|
89
89
|
targetRef: HTMLElement | null;
|
|
90
90
|
unbindWindowClick: UnbindFn | null;
|
|
91
91
|
unbindWindowKeydown: UnbindFn | null;
|
|
@@ -142,7 +142,7 @@ export default class PopupSelect<Option = OptionType, IsMulti extends boolean =
|
|
|
142
142
|
}) => void;
|
|
143
143
|
resolveTargetRef: (popperRef: React.Ref<HTMLElement>) => (ref: HTMLElement) => void;
|
|
144
144
|
resolveMenuRef: (popperRef: React.Ref<HTMLElement>) => (ref: HTMLElement) => void;
|
|
145
|
-
getSelectRef: (ref:
|
|
145
|
+
getSelectRef: (ref: AtlaskitSelectRefType) => void;
|
|
146
146
|
getItemCount: () => number;
|
|
147
147
|
getMaxHeight: () => number | undefined;
|
|
148
148
|
showSearchControl: () => boolean | undefined;
|
package/dist/types/Select.d.ts
CHANGED
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const SelectWithoutAnalytics: <Option extends unknown = import("./types").OptionType, IsMulti extends boolean = false>(props: (import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>) & {
|
|
3
|
-
ref?: import("react").Ref<
|
|
4
|
-
select: import("react-select/base").default<unknown, false, import("react-select").GroupBase<unknown>> | null;
|
|
5
|
-
blur: () => void;
|
|
6
|
-
focus: () => void;
|
|
7
|
-
}> | undefined;
|
|
3
|
+
ref?: import("react").Ref<import("./types").AtlaskitSelectRefType> | undefined;
|
|
8
4
|
}) => JSX.Element;
|
|
9
5
|
declare const Select: <Option extends unknown = import("./types").OptionType, IsMulti extends boolean = false>(props: (import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>) & {
|
|
10
|
-
ref?: import("react").Ref<
|
|
11
|
-
select: import("react-select/base").default<unknown, false, import("react-select").GroupBase<unknown>> | null;
|
|
12
|
-
blur: () => void;
|
|
13
|
-
focus: () => void;
|
|
14
|
-
}> | undefined;
|
|
6
|
+
ref?: import("react").Ref<import("./types").AtlaskitSelectRefType> | undefined;
|
|
15
7
|
}) => JSX.Element;
|
|
16
8
|
export default Select;
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { type ComponentType, type Ref } from 'react';
|
|
2
|
-
import
|
|
3
|
-
import { SelectProps, OptionType, AsyncSelectProps, CreatableSelectProps } from './types';
|
|
2
|
+
import { SelectProps, OptionType, AsyncSelectProps, CreatableSelectProps, AtlaskitSelectRefType } from './types';
|
|
4
3
|
type AtlaskitSelectProps<Option extends unknown, IsMulti extends boolean> = SelectProps<Option, IsMulti> | AsyncSelectProps<Option, IsMulti> | CreatableSelectProps<Option, IsMulti>;
|
|
5
|
-
type AtlaskitSelectRefType = {
|
|
6
|
-
select: BaseSelect | null;
|
|
7
|
-
blur: () => void;
|
|
8
|
-
focus: () => void;
|
|
9
|
-
};
|
|
10
4
|
export default function createSelect(WrappedComponent: ComponentType<any>): <Option extends unknown = OptionType, IsMulti extends boolean = false>(props: AtlaskitSelectProps<Option, IsMulti> & {
|
|
11
5
|
ref?: Ref<AtlaskitSelectRefType>;
|
|
12
6
|
}) => JSX.Element;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
3
3
|
import { SelectInstance, Props as ReactSelectProps, FormatOptionLabelMeta, OnChangeValue as RSValueType, ActionMeta as RSActionMeta, GroupBase as GroupType, Options as RSOptionsType, SelectComponentsConfig as RSSelectComponentsConfig, StylesConfig as RSStylesConfig, InputActionMeta, ClearIndicatorProps, DropdownIndicatorProps, IndicatorSeparatorProps, LoadingIndicatorProps, NoticeProps, ControlProps as RSControlProps, GroupProps as RSGroupProps, InputProps, MenuProps as RSMenuProps, MenuListProps as RSMenuListComponentProps, MultiValueProps, OptionProps as ReactSelectOptionProps, PlaceholderProps as RSPlaceholderProps, SingleValueProps, ValueContainerProps as RSValueContainerProps, MultiValueRemoveProps } from 'react-select';
|
|
4
|
+
import BaseSelect from 'react-select/base';
|
|
4
5
|
import { AsyncProps } from 'react-select/async';
|
|
5
6
|
import { CreatableProps } from 'react-select/creatable';
|
|
6
7
|
export type ValidationState = 'default' | 'error' | 'success';
|
|
@@ -28,7 +29,13 @@ interface CustomSelectProps extends WithAnalyticsEventsProps {
|
|
|
28
29
|
spacing?: 'compact' | 'default';
|
|
29
30
|
/** 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
31
|
appearance?: 'default' | 'subtle' | 'none';
|
|
31
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests.
|
|
34
|
+
|
|
35
|
+
**WARNING:** This prop is currently broken and a test ID will not be added to select.
|
|
36
|
+
Please refer to the [select testing page](https://atlassian.design/components/select/testing)
|
|
37
|
+
for guidance on alternatives to identifying select in tests.
|
|
38
|
+
*/
|
|
32
39
|
testId?: string;
|
|
33
40
|
/** This prop indicates if the component is in an error state */
|
|
34
41
|
isInvalid?: boolean;
|
|
@@ -52,6 +59,11 @@ export type MenuListComponentProps<Option, IsMulti extends boolean = false> = RS
|
|
|
52
59
|
export type PlaceholderProps<Option, IsMulti extends boolean = false> = RSPlaceholderProps<Option, IsMulti>;
|
|
53
60
|
export type ValueContainerProps<Option, IsMulti extends boolean = false> = RSValueContainerProps<Option, IsMulti>;
|
|
54
61
|
export type GroupedOptionsType<Option> = ReadonlyArray<GroupType<Option>>;
|
|
62
|
+
export type AtlaskitSelectRefType = {
|
|
63
|
+
select: BaseSelect | null;
|
|
64
|
+
blur: () => void;
|
|
65
|
+
focus: () => void;
|
|
66
|
+
};
|
|
55
67
|
export type { SelectInstance, FormatOptionLabelMeta, InputActionMeta, GroupType, InputProps, MultiValueProps, ReactSelectProps, SingleValueProps, ClearIndicatorProps, DropdownIndicatorProps, IndicatorSeparatorProps, LoadingIndicatorProps, NoticeProps, MultiValueRemoveProps, };
|
|
56
68
|
declare module 'react-select/dist/declarations/src/Select' {
|
|
57
69
|
interface Props<Option, IsMulti extends boolean, Group extends GroupType<Option>> {
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
declare const _default: <Option extends unknown = import("./types").OptionType, IsMulti extends boolean = false>(props: (import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>) & {
|
|
3
|
-
ref?: import("react").Ref<
|
|
4
|
-
select: import("react-select/base").default<unknown, false, import("react-select").GroupBase<unknown>> | null;
|
|
5
|
-
blur: () => void;
|
|
6
|
-
focus: () => void;
|
|
7
|
-
}> | undefined;
|
|
3
|
+
ref?: import("react").Ref<import("./types").AtlaskitSelectRefType> | undefined;
|
|
8
4
|
}) => JSX.Element;
|
|
9
5
|
export default _default;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
declare const _default: <Option extends unknown = import("./types").OptionType, IsMulti extends boolean = false>(props: (import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>) & {
|
|
3
|
-
ref?: import("react").Ref<
|
|
4
|
-
select: import("react-select/base").default<unknown, false, import("react-select").GroupBase<unknown>> | null;
|
|
5
|
-
blur: () => void;
|
|
6
|
-
focus: () => void;
|
|
7
|
-
}> | undefined;
|
|
3
|
+
ref?: import("react").Ref<import("./types").AtlaskitSelectRefType> | undefined;
|
|
8
4
|
}) => JSX.Element;
|
|
9
5
|
export default _default;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
declare const _default: <Option extends unknown = import("./types").OptionType, IsMulti extends boolean = false>(props: (import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>) & {
|
|
3
|
-
ref?: import("react").Ref<
|
|
4
|
-
select: import("react-select/base").default<unknown, false, import("react-select").GroupBase<unknown>> | null;
|
|
5
|
-
blur: () => void;
|
|
6
|
-
focus: () => void;
|
|
7
|
-
}> | undefined;
|
|
3
|
+
ref?: import("react").Ref<import("./types").AtlaskitSelectRefType> | undefined;
|
|
8
4
|
}) => JSX.Element;
|
|
9
5
|
export default _default;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { KeyboardEventHandler, PureComponent, ReactNode } from 'react';
|
|
2
|
-
import BaseSelect from 'react-select/base';
|
|
3
2
|
import { PopperProps } from 'react-popper';
|
|
4
|
-
import { OptionType, ActionMeta, ReactSelectProps, StylesConfig, ValueType, ValidationState } from '../types';
|
|
3
|
+
import { OptionType, ActionMeta, ReactSelectProps, StylesConfig, ValueType, ValidationState, AtlaskitSelectRefType } from '../types';
|
|
5
4
|
import { UnbindFn } from 'bind-event-listener';
|
|
6
5
|
type defaultModifiers = 'offset' | 'preventOverflow';
|
|
7
6
|
type PopperPropsNoChildren<Modifiers> = Omit<PopperProps<Modifiers>, 'children'>;
|
|
@@ -68,13 +67,14 @@ export interface PopupSelectProps<Option = OptionType, IsMulti extends boolean =
|
|
|
68
67
|
isOpen?: boolean;
|
|
69
68
|
defaultIsOpen?: boolean;
|
|
70
69
|
/** Use this to set whether the component uses compact or standard spacing. */
|
|
71
|
-
spacing?:
|
|
70
|
+
spacing?: 'default' | 'compact';
|
|
72
71
|
/** @deprecated Use isInvalid instead. The state of validation if used in a form */
|
|
73
72
|
validationState?: ValidationState;
|
|
74
73
|
/** This prop indicates if the component is in an error state. */
|
|
75
74
|
isInvalid?: boolean;
|
|
76
75
|
/** This gives an accessible name to the input for people who use assistive technology. */
|
|
77
76
|
label?: string;
|
|
77
|
+
/** The `testId` prop appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests. It will be set on the menu element when defined: `{testId}--menu` */
|
|
78
78
|
testId?: string;
|
|
79
79
|
}
|
|
80
80
|
interface State<Modifiers = string> {
|
|
@@ -85,7 +85,7 @@ interface State<Modifiers = string> {
|
|
|
85
85
|
}
|
|
86
86
|
export default class PopupSelect<Option = OptionType, IsMulti extends boolean = false, Modifiers = ModifierList> extends PureComponent<PopupSelectProps<Option, IsMulti, Modifiers>, State> {
|
|
87
87
|
menuRef: HTMLElement | null;
|
|
88
|
-
selectRef:
|
|
88
|
+
selectRef: any;
|
|
89
89
|
targetRef: HTMLElement | null;
|
|
90
90
|
unbindWindowClick: UnbindFn | null;
|
|
91
91
|
unbindWindowKeydown: UnbindFn | null;
|
|
@@ -142,7 +142,7 @@ export default class PopupSelect<Option = OptionType, IsMulti extends boolean =
|
|
|
142
142
|
}) => void;
|
|
143
143
|
resolveTargetRef: (popperRef: React.Ref<HTMLElement>) => (ref: HTMLElement) => void;
|
|
144
144
|
resolveMenuRef: (popperRef: React.Ref<HTMLElement>) => (ref: HTMLElement) => void;
|
|
145
|
-
getSelectRef: (ref:
|
|
145
|
+
getSelectRef: (ref: AtlaskitSelectRefType) => void;
|
|
146
146
|
getItemCount: () => number;
|
|
147
147
|
getMaxHeight: () => number | undefined;
|
|
148
148
|
showSearchControl: () => boolean | undefined;
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const SelectWithoutAnalytics: <Option extends unknown = import("./types").OptionType, IsMulti extends boolean = false>(props: (import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>) & {
|
|
3
|
-
ref?: import("react").Ref<
|
|
4
|
-
select: import("react-select/base").default<unknown, false, import("react-select").GroupBase<unknown>> | null;
|
|
5
|
-
blur: () => void;
|
|
6
|
-
focus: () => void;
|
|
7
|
-
}> | undefined;
|
|
3
|
+
ref?: import("react").Ref<import("./types").AtlaskitSelectRefType> | undefined;
|
|
8
4
|
}) => JSX.Element;
|
|
9
5
|
declare const Select: <Option extends unknown = import("./types").OptionType, IsMulti extends boolean = false>(props: (import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>) & {
|
|
10
|
-
ref?: import("react").Ref<
|
|
11
|
-
select: import("react-select/base").default<unknown, false, import("react-select").GroupBase<unknown>> | null;
|
|
12
|
-
blur: () => void;
|
|
13
|
-
focus: () => void;
|
|
14
|
-
}> | undefined;
|
|
6
|
+
ref?: import("react").Ref<import("./types").AtlaskitSelectRefType> | undefined;
|
|
15
7
|
}) => JSX.Element;
|
|
16
8
|
export default Select;
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { type ComponentType, type Ref } from 'react';
|
|
2
|
-
import
|
|
3
|
-
import { SelectProps, OptionType, AsyncSelectProps, CreatableSelectProps } from './types';
|
|
2
|
+
import { SelectProps, OptionType, AsyncSelectProps, CreatableSelectProps, AtlaskitSelectRefType } from './types';
|
|
4
3
|
type AtlaskitSelectProps<Option extends unknown, IsMulti extends boolean> = SelectProps<Option, IsMulti> | AsyncSelectProps<Option, IsMulti> | CreatableSelectProps<Option, IsMulti>;
|
|
5
|
-
type AtlaskitSelectRefType = {
|
|
6
|
-
select: BaseSelect | null;
|
|
7
|
-
blur: () => void;
|
|
8
|
-
focus: () => void;
|
|
9
|
-
};
|
|
10
4
|
export default function createSelect(WrappedComponent: ComponentType<any>): <Option extends unknown = OptionType, IsMulti extends boolean = false>(props: AtlaskitSelectProps<Option, IsMulti> & {
|
|
11
5
|
ref?: Ref<AtlaskitSelectRefType>;
|
|
12
6
|
}) => JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
3
3
|
import { SelectInstance, Props as ReactSelectProps, FormatOptionLabelMeta, OnChangeValue as RSValueType, ActionMeta as RSActionMeta, GroupBase as GroupType, Options as RSOptionsType, SelectComponentsConfig as RSSelectComponentsConfig, StylesConfig as RSStylesConfig, InputActionMeta, ClearIndicatorProps, DropdownIndicatorProps, IndicatorSeparatorProps, LoadingIndicatorProps, NoticeProps, ControlProps as RSControlProps, GroupProps as RSGroupProps, InputProps, MenuProps as RSMenuProps, MenuListProps as RSMenuListComponentProps, MultiValueProps, OptionProps as ReactSelectOptionProps, PlaceholderProps as RSPlaceholderProps, SingleValueProps, ValueContainerProps as RSValueContainerProps, MultiValueRemoveProps } from 'react-select';
|
|
4
|
+
import BaseSelect from 'react-select/base';
|
|
4
5
|
import { AsyncProps } from 'react-select/async';
|
|
5
6
|
import { CreatableProps } from 'react-select/creatable';
|
|
6
7
|
export type ValidationState = 'default' | 'error' | 'success';
|
|
@@ -28,7 +29,13 @@ interface CustomSelectProps extends WithAnalyticsEventsProps {
|
|
|
28
29
|
spacing?: 'compact' | 'default';
|
|
29
30
|
/** 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
31
|
appearance?: 'default' | 'subtle' | 'none';
|
|
31
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests.
|
|
34
|
+
|
|
35
|
+
**WARNING:** This prop is currently broken and a test ID will not be added to select.
|
|
36
|
+
Please refer to the [select testing page](https://atlassian.design/components/select/testing)
|
|
37
|
+
for guidance on alternatives to identifying select in tests.
|
|
38
|
+
*/
|
|
32
39
|
testId?: string;
|
|
33
40
|
/** This prop indicates if the component is in an error state */
|
|
34
41
|
isInvalid?: boolean;
|
|
@@ -52,6 +59,11 @@ export type MenuListComponentProps<Option, IsMulti extends boolean = false> = RS
|
|
|
52
59
|
export type PlaceholderProps<Option, IsMulti extends boolean = false> = RSPlaceholderProps<Option, IsMulti>;
|
|
53
60
|
export type ValueContainerProps<Option, IsMulti extends boolean = false> = RSValueContainerProps<Option, IsMulti>;
|
|
54
61
|
export type GroupedOptionsType<Option> = ReadonlyArray<GroupType<Option>>;
|
|
62
|
+
export type AtlaskitSelectRefType = {
|
|
63
|
+
select: BaseSelect | null;
|
|
64
|
+
blur: () => void;
|
|
65
|
+
focus: () => void;
|
|
66
|
+
};
|
|
55
67
|
export type { SelectInstance, FormatOptionLabelMeta, InputActionMeta, GroupType, InputProps, MultiValueProps, ReactSelectProps, SingleValueProps, ClearIndicatorProps, DropdownIndicatorProps, IndicatorSeparatorProps, LoadingIndicatorProps, NoticeProps, MultiValueRemoveProps, };
|
|
56
68
|
declare module 'react-select/dist/declarations/src/Select' {
|
|
57
69
|
interface Props<Option, IsMulti extends boolean, Group extends GroupType<Option>> {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/select",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.7.0",
|
|
4
4
|
"description": "Select allows users to make a single selection or multiple selections from a list of options.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -41,17 +41,17 @@
|
|
|
41
41
|
".": "./src/index.tsx"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@atlaskit/analytics-next": "^9.
|
|
44
|
+
"@atlaskit/analytics-next": "^9.3.0",
|
|
45
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.7.0",
|
|
49
|
-
"@atlaskit/tokens": "^1.
|
|
49
|
+
"@atlaskit/tokens": "^1.44.0",
|
|
50
50
|
"@atlaskit/visually-hidden": "^1.2.0",
|
|
51
51
|
"@babel/runtime": "^7.0.0",
|
|
52
52
|
"@emotion/react": "^11.7.1",
|
|
53
53
|
"@popperjs/core": "^2.9.1",
|
|
54
|
-
"bind-event-listener": "^
|
|
54
|
+
"bind-event-listener": "^3.0.0",
|
|
55
55
|
"react-focus-lock": "^2.9.5",
|
|
56
56
|
"react-node-resolver": "^1.0.1",
|
|
57
57
|
"react-popper": "^2.2.3",
|
|
@@ -66,7 +66,10 @@
|
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@af/accessibility-testing": "*",
|
|
68
68
|
"@af/integration-testing": "*",
|
|
69
|
-
"@atlaskit/
|
|
69
|
+
"@atlaskit/checkbox": "^13.1.0",
|
|
70
|
+
"@atlaskit/ds-lib": "^2.3.0",
|
|
71
|
+
"@atlaskit/modal-dialog": "^12.12.0",
|
|
72
|
+
"@atlaskit/radio": "^6.1.3",
|
|
70
73
|
"@atlaskit/ssr": "*",
|
|
71
74
|
"@atlaskit/visual-regression": "*",
|
|
72
75
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
@@ -105,6 +108,9 @@
|
|
|
105
108
|
},
|
|
106
109
|
"platform.design-system-team.popup-select-close_8h15h": {
|
|
107
110
|
"type": "boolean"
|
|
111
|
+
},
|
|
112
|
+
"platform.design-system-team.use-default-select-in-popup-select_46rmj": {
|
|
113
|
+
"type": "boolean"
|
|
108
114
|
}
|
|
109
115
|
},
|
|
110
116
|
"homepage": "https://atlassian.design/components/select/",
|