@atlaskit/select 17.5.0 → 17.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/cjs/Select.js +1 -1
- package/dist/cjs/createSelect.js +79 -113
- package/dist/es2019/Select.js +1 -1
- package/dist/es2019/createSelect.js +71 -88
- package/dist/esm/Select.js +1 -1
- package/dist/esm/createSelect.js +80 -114
- package/dist/types/AsyncCreatableSelect.d.ts +6 -43
- package/dist/types/AsyncSelect.d.ts +6 -43
- package/dist/types/CreatableSelect.d.ts +6 -43
- package/dist/types/Select.d.ts +12 -86
- package/dist/types/components/indicators.d.ts +5 -4
- package/dist/types/createSelect.d.ts +10 -46
- package/dist/types/utils/grouped-options-announcement.d.ts +1 -1
- package/dist/types-ts4.5/AsyncCreatableSelect.d.ts +6 -43
- package/dist/types-ts4.5/AsyncSelect.d.ts +6 -43
- package/dist/types-ts4.5/CreatableSelect.d.ts +6 -43
- package/dist/types-ts4.5/Select.d.ts +12 -86
- package/dist/types-ts4.5/components/indicators.d.ts +5 -4
- package/dist/types-ts4.5/createSelect.d.ts +10 -46
- package/dist/types-ts4.5/utils/grouped-options-announcement.d.ts +1 -1
- package/package.json +1 -3
package/dist/esm/createSelect.js
CHANGED
|
@@ -1,128 +1,94 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
6
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
8
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
|
-
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["appearance", "ariaLiveMessages", "components", "isInvalid", "onClickPreventDefault", "spacing", "styles", "tabSelectsValue", "validationState"];
|
|
11
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
|
-
|
|
14
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
15
|
-
import React, { Component } from 'react';
|
|
7
|
+
import React, { useRef, useEffect, useMemo, forwardRef, useImperativeHandle } from 'react';
|
|
16
8
|
import { mergeStyles } from 'react-select';
|
|
17
|
-
import memoizeOne from 'memoize-one';
|
|
18
|
-
import isEqual from 'react-fast-compare';
|
|
19
9
|
import { Input } from './components/input-aria-describedby';
|
|
20
10
|
import { ClearIndicator, DropdownIndicator, LoadingIndicator, MultiValueRemove, IndicatorSeparator } from './components';
|
|
21
11
|
import baseStyles from './styles';
|
|
22
12
|
import { onFocus, isOptionsGrouped } from './utils/grouped-options-announcement';
|
|
23
13
|
export default function createSelect(WrappedComponent) {
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
}, {
|
|
64
|
-
key: "blur",
|
|
65
|
-
value: function blur() {
|
|
66
|
-
if (this.select) {
|
|
67
|
-
this.select.blur();
|
|
14
|
+
var AtlaskitSelect = /*#__PURE__*/forwardRef(function AtlaskitSelect(props, forwardedRef) {
|
|
15
|
+
var appearance = props.appearance,
|
|
16
|
+
ariaLiveMessages = props.ariaLiveMessages,
|
|
17
|
+
componentsProp = props.components,
|
|
18
|
+
isInvalid = props.isInvalid,
|
|
19
|
+
_props$onClickPrevent = props.onClickPreventDefault,
|
|
20
|
+
onClickPreventDefault = _props$onClickPrevent === void 0 ? true : _props$onClickPrevent,
|
|
21
|
+
_props$spacing = props.spacing,
|
|
22
|
+
spacing = _props$spacing === void 0 ? 'default' : _props$spacing,
|
|
23
|
+
_props$styles = props.styles,
|
|
24
|
+
styles = _props$styles === void 0 ? {} : _props$styles,
|
|
25
|
+
_props$tabSelectsValu = props.tabSelectsValue,
|
|
26
|
+
tabSelectsValue = _props$tabSelectsValu === void 0 ? false : _props$tabSelectsValu,
|
|
27
|
+
_props$validationStat = props.validationState,
|
|
28
|
+
validationState = _props$validationStat === void 0 ? 'default' : _props$validationStat,
|
|
29
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
30
|
+
var internalSelectRef = useRef(null);
|
|
31
|
+
var components = useMemo(function () {
|
|
32
|
+
return _objectSpread({
|
|
33
|
+
ClearIndicator: ClearIndicator,
|
|
34
|
+
DropdownIndicator: DropdownIndicator,
|
|
35
|
+
LoadingIndicator: LoadingIndicator,
|
|
36
|
+
MultiValueRemove: MultiValueRemove,
|
|
37
|
+
IndicatorSeparator: IndicatorSeparator,
|
|
38
|
+
Input: Input
|
|
39
|
+
}, componentsProp);
|
|
40
|
+
}, [componentsProp]);
|
|
41
|
+
var descriptionId = props['aria-describedby'];
|
|
42
|
+
var isSearchable = props.isSearchable;
|
|
43
|
+
useEffect(function () {
|
|
44
|
+
if (!isSearchable && descriptionId) {
|
|
45
|
+
var _internalSelectRef$cu;
|
|
46
|
+
// when isSearchable is false, react-select will create its own dummy input instead of using ours,
|
|
47
|
+
// so we need to manually add the additional aria-describedby using ref.
|
|
48
|
+
var input = (_internalSelectRef$cu = internalSelectRef.current) === null || _internalSelectRef$cu === void 0 ? void 0 : _internalSelectRef$cu.inputRef;
|
|
49
|
+
var ariaDescribedby = input === null || input === void 0 ? void 0 : input.getAttribute('aria-describedby');
|
|
50
|
+
if (!(ariaDescribedby !== null && ariaDescribedby !== void 0 && ariaDescribedby.includes(descriptionId))) {
|
|
51
|
+
input === null || input === void 0 || input.setAttribute('aria-describedby', "".concat(ariaDescribedby, " ").concat(descriptionId));
|
|
68
52
|
}
|
|
69
53
|
}
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
value: function componentDidMount() {
|
|
73
|
-
var descriptionId = this.props['aria-describedby'];
|
|
74
|
-
if (!this.props.isSearchable && descriptionId) {
|
|
75
|
-
var _this$select;
|
|
76
|
-
// when isSearchable is false, react-select will create its own dummy input instead of using ours,
|
|
77
|
-
// so we need to manually add the additional aria-describedby using ref.
|
|
78
|
-
var input = (_this$select = this.select) === null || _this$select === void 0 ? void 0 : _this$select.inputRef;
|
|
79
|
-
var ariaDescribedby = input === null || input === void 0 ? void 0 : input.getAttribute('aria-describedby');
|
|
80
|
-
if (!(ariaDescribedby !== null && ariaDescribedby !== void 0 && ariaDescribedby.includes(descriptionId))) {
|
|
81
|
-
input === null || input === void 0 || input.setAttribute('aria-describedby', "".concat(ariaDescribedby, " ").concat(descriptionId));
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}, {
|
|
86
|
-
key: "render",
|
|
87
|
-
value: function render() {
|
|
88
|
-
var _this$props = this.props,
|
|
89
|
-
styles = _this$props.styles,
|
|
90
|
-
validationState = _this$props.validationState,
|
|
91
|
-
isInvalid = _this$props.isInvalid,
|
|
92
|
-
spacing = _this$props.spacing,
|
|
93
|
-
isMulti = _this$props.isMulti,
|
|
94
|
-
appearance = _this$props.appearance,
|
|
95
|
-
ariaLiveMessages = _this$props.ariaLiveMessages,
|
|
96
|
-
props = _objectWithoutProperties(_this$props, _excluded);
|
|
97
|
-
var isCompact = spacing === 'compact';
|
|
54
|
+
}, [descriptionId, isSearchable]);
|
|
55
|
+
var isCompact = spacing === 'compact';
|
|
98
56
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
57
|
+
/**
|
|
58
|
+
* The following `useImperativeHandle` hook exists for the sake of backwards compatibility.
|
|
59
|
+
* This component used to be a class component which set the value of the `ref` prop to object with the properties and value as below.
|
|
60
|
+
* This has lead to slightly odd usage of refs with this component, e.g. `myRef.current.select.select.controlRef` instead of just `myRef.current.select.controlRef`
|
|
61
|
+
* In the next major release, this should removed and the ref should be passed directly to the wrapped component (given users have updated usage)
|
|
62
|
+
* More info https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/pull-requests/88021/overview
|
|
63
|
+
*/
|
|
64
|
+
useImperativeHandle(forwardedRef, function () {
|
|
65
|
+
return {
|
|
66
|
+
select: internalSelectRef.current,
|
|
67
|
+
focus: function focus() {
|
|
68
|
+
var _internalSelectRef$cu2;
|
|
69
|
+
return (_internalSelectRef$cu2 = internalSelectRef.current) === null || _internalSelectRef$cu2 === void 0 ? void 0 : _internalSelectRef$cu2.focus();
|
|
70
|
+
},
|
|
71
|
+
blur: function blur() {
|
|
72
|
+
var _internalSelectRef$cu3;
|
|
73
|
+
return (_internalSelectRef$cu3 = internalSelectRef.current) === null || _internalSelectRef$cu3 === void 0 ? void 0 : _internalSelectRef$cu3.blur();
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}, []);
|
|
77
|
+
return /*#__PURE__*/React.createElement(WrappedComponent, _extends({
|
|
78
|
+
ref: internalSelectRef,
|
|
79
|
+
"aria-live": "assertive",
|
|
80
|
+
ariaLiveMessages: isOptionsGrouped(props.options) ? _objectSpread({
|
|
81
|
+
onFocus: onFocus
|
|
82
|
+
}, ariaLiveMessages) : _objectSpread({}, ariaLiveMessages),
|
|
83
|
+
tabSelectsValue: tabSelectsValue,
|
|
84
|
+
onClickPreventDefault: onClickPreventDefault
|
|
85
|
+
}, restProps, {
|
|
86
|
+
components: components,
|
|
87
|
+
styles: mergeStyles(baseStyles(
|
|
88
|
+
// This will cover both props for invalid state while giving priority to isInvalid. When cleaning up validationState, we can just keep the inner condition.
|
|
89
|
+
typeof isInvalid !== 'undefined' ? isInvalid ? 'error' : 'default' : validationState, isCompact, appearance || 'default'), styles)
|
|
90
|
+
}));
|
|
91
|
+
});
|
|
92
|
+
AtlaskitSelect.displayName = 'AtlaskitSelect';
|
|
93
|
+
return AtlaskitSelect;
|
|
128
94
|
}
|
|
@@ -1,46 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare const _default: {
|
|
3
|
-
|
|
4
|
-
components: Partial<import("react-select/dist/declarations/src/components").SelectComponents<Option, IsMulti, import("react-select").GroupBase<Option>>>;
|
|
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<{
|
|
5
4
|
select: import("react-select/base").default<unknown, false, import("react-select").GroupBase<unknown>> | null;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
onSelectRef: (ref: import("react-select/base").default<unknown, false, import("react-select").GroupBase<unknown>>) => void;
|
|
11
|
-
componentDidMount(): void;
|
|
12
|
-
render(): JSX.Element;
|
|
13
|
-
context: any;
|
|
14
|
-
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
15
|
-
forceUpdate(callback?: (() => void) | undefined): void;
|
|
16
|
-
readonly props: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>> & Readonly<{
|
|
17
|
-
children?: import("react").ReactNode;
|
|
18
|
-
}>;
|
|
19
|
-
state: Readonly<{}>;
|
|
20
|
-
refs: {
|
|
21
|
-
[key: string]: import("react").ReactInstance;
|
|
22
|
-
};
|
|
23
|
-
shouldComponentUpdate?(nextProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
24
|
-
componentWillUnmount?(): void;
|
|
25
|
-
componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
|
|
26
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, prevState: Readonly<{}>): any;
|
|
27
|
-
componentDidUpdate?(prevProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
28
|
-
componentWillMount?(): void;
|
|
29
|
-
UNSAFE_componentWillMount?(): void;
|
|
30
|
-
componentWillReceiveProps?(nextProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, nextContext: any): void;
|
|
31
|
-
componentWillUpdate?(nextProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, nextState: Readonly<{}>, nextContext: any): void;
|
|
32
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, nextState: Readonly<{}>, nextContext: any): void;
|
|
33
|
-
};
|
|
34
|
-
defaultProps: {
|
|
35
|
-
validationState: string;
|
|
36
|
-
spacing: string;
|
|
37
|
-
onClickPreventDefault: boolean;
|
|
38
|
-
tabSelectsValue: boolean;
|
|
39
|
-
components: {
|
|
40
|
-
Input: typeof import("./components/input-aria-describedby").Input;
|
|
41
|
-
};
|
|
42
|
-
styles: {};
|
|
43
|
-
};
|
|
44
|
-
contextType?: import("react").Context<any> | undefined;
|
|
45
|
-
};
|
|
5
|
+
blur: () => void;
|
|
6
|
+
focus: () => void;
|
|
7
|
+
}> | undefined;
|
|
8
|
+
}) => JSX.Element;
|
|
46
9
|
export default _default;
|
|
@@ -1,46 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare const _default: {
|
|
3
|
-
|
|
4
|
-
components: Partial<import("react-select/dist/declarations/src/components").SelectComponents<Option, IsMulti, import("react-select").GroupBase<Option>>>;
|
|
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<{
|
|
5
4
|
select: import("react-select/base").default<unknown, false, import("react-select").GroupBase<unknown>> | null;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
onSelectRef: (ref: import("react-select/base").default<unknown, false, import("react-select").GroupBase<unknown>>) => void;
|
|
11
|
-
componentDidMount(): void;
|
|
12
|
-
render(): JSX.Element;
|
|
13
|
-
context: any;
|
|
14
|
-
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
15
|
-
forceUpdate(callback?: (() => void) | undefined): void;
|
|
16
|
-
readonly props: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>> & Readonly<{
|
|
17
|
-
children?: import("react").ReactNode;
|
|
18
|
-
}>;
|
|
19
|
-
state: Readonly<{}>;
|
|
20
|
-
refs: {
|
|
21
|
-
[key: string]: import("react").ReactInstance;
|
|
22
|
-
};
|
|
23
|
-
shouldComponentUpdate?(nextProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
24
|
-
componentWillUnmount?(): void;
|
|
25
|
-
componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
|
|
26
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, prevState: Readonly<{}>): any;
|
|
27
|
-
componentDidUpdate?(prevProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
28
|
-
componentWillMount?(): void;
|
|
29
|
-
UNSAFE_componentWillMount?(): void;
|
|
30
|
-
componentWillReceiveProps?(nextProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, nextContext: any): void;
|
|
31
|
-
componentWillUpdate?(nextProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, nextState: Readonly<{}>, nextContext: any): void;
|
|
32
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, nextState: Readonly<{}>, nextContext: any): void;
|
|
33
|
-
};
|
|
34
|
-
defaultProps: {
|
|
35
|
-
validationState: string;
|
|
36
|
-
spacing: string;
|
|
37
|
-
onClickPreventDefault: boolean;
|
|
38
|
-
tabSelectsValue: boolean;
|
|
39
|
-
components: {
|
|
40
|
-
Input: typeof import("./components/input-aria-describedby").Input;
|
|
41
|
-
};
|
|
42
|
-
styles: {};
|
|
43
|
-
};
|
|
44
|
-
contextType?: import("react").Context<any> | undefined;
|
|
45
|
-
};
|
|
5
|
+
blur: () => void;
|
|
6
|
+
focus: () => void;
|
|
7
|
+
}> | undefined;
|
|
8
|
+
}) => JSX.Element;
|
|
46
9
|
export default _default;
|
|
@@ -1,46 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare const _default: {
|
|
3
|
-
|
|
4
|
-
components: Partial<import("react-select/dist/declarations/src/components").SelectComponents<Option, IsMulti, import("react-select").GroupBase<Option>>>;
|
|
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<{
|
|
5
4
|
select: import("react-select/base").default<unknown, false, import("react-select").GroupBase<unknown>> | null;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
onSelectRef: (ref: import("react-select/base").default<unknown, false, import("react-select").GroupBase<unknown>>) => void;
|
|
11
|
-
componentDidMount(): void;
|
|
12
|
-
render(): JSX.Element;
|
|
13
|
-
context: any;
|
|
14
|
-
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
15
|
-
forceUpdate(callback?: (() => void) | undefined): void;
|
|
16
|
-
readonly props: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>> & Readonly<{
|
|
17
|
-
children?: import("react").ReactNode;
|
|
18
|
-
}>;
|
|
19
|
-
state: Readonly<{}>;
|
|
20
|
-
refs: {
|
|
21
|
-
[key: string]: import("react").ReactInstance;
|
|
22
|
-
};
|
|
23
|
-
shouldComponentUpdate?(nextProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
24
|
-
componentWillUnmount?(): void;
|
|
25
|
-
componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
|
|
26
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, prevState: Readonly<{}>): any;
|
|
27
|
-
componentDidUpdate?(prevProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
28
|
-
componentWillMount?(): void;
|
|
29
|
-
UNSAFE_componentWillMount?(): void;
|
|
30
|
-
componentWillReceiveProps?(nextProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, nextContext: any): void;
|
|
31
|
-
componentWillUpdate?(nextProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, nextState: Readonly<{}>, nextContext: any): void;
|
|
32
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, nextState: Readonly<{}>, nextContext: any): void;
|
|
33
|
-
};
|
|
34
|
-
defaultProps: {
|
|
35
|
-
validationState: string;
|
|
36
|
-
spacing: string;
|
|
37
|
-
onClickPreventDefault: boolean;
|
|
38
|
-
tabSelectsValue: boolean;
|
|
39
|
-
components: {
|
|
40
|
-
Input: typeof import("./components/input-aria-describedby").Input;
|
|
41
|
-
};
|
|
42
|
-
styles: {};
|
|
43
|
-
};
|
|
44
|
-
contextType?: import("react").Context<any> | undefined;
|
|
45
|
-
};
|
|
5
|
+
blur: () => void;
|
|
6
|
+
focus: () => void;
|
|
7
|
+
}> | undefined;
|
|
8
|
+
}) => JSX.Element;
|
|
46
9
|
export default _default;
|
package/dist/types/Select.d.ts
CHANGED
|
@@ -1,90 +1,16 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const SelectWithoutAnalytics: {
|
|
3
|
-
|
|
4
|
-
components: Partial<import("react-select/dist/declarations/src/components").SelectComponents<Option, IsMulti, import("react-select").GroupBase<Option>>>;
|
|
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<{
|
|
5
4
|
select: import("react-select/base").default<unknown, false, import("react-select").GroupBase<unknown>> | null;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
render(): JSX.Element;
|
|
13
|
-
context: any;
|
|
14
|
-
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
15
|
-
forceUpdate(callback?: (() => void) | undefined): void;
|
|
16
|
-
readonly props: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>> & Readonly<{
|
|
17
|
-
children?: import("react").ReactNode;
|
|
18
|
-
}>;
|
|
19
|
-
state: Readonly<{}>;
|
|
20
|
-
refs: {
|
|
21
|
-
[key: string]: import("react").ReactInstance;
|
|
22
|
-
};
|
|
23
|
-
shouldComponentUpdate?(nextProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
24
|
-
componentWillUnmount?(): void;
|
|
25
|
-
componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
|
|
26
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, prevState: Readonly<{}>): any;
|
|
27
|
-
componentDidUpdate?(prevProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
28
|
-
componentWillMount?(): void;
|
|
29
|
-
UNSAFE_componentWillMount?(): void;
|
|
30
|
-
componentWillReceiveProps?(nextProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, nextContext: any): void;
|
|
31
|
-
componentWillUpdate?(nextProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, nextState: Readonly<{}>, nextContext: any): void;
|
|
32
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, nextState: Readonly<{}>, nextContext: any): void;
|
|
33
|
-
};
|
|
34
|
-
defaultProps: {
|
|
35
|
-
validationState: string;
|
|
36
|
-
spacing: string;
|
|
37
|
-
onClickPreventDefault: boolean;
|
|
38
|
-
tabSelectsValue: boolean;
|
|
39
|
-
components: {
|
|
40
|
-
Input: typeof import("./components/input-aria-describedby").Input;
|
|
41
|
-
};
|
|
42
|
-
styles: {};
|
|
43
|
-
};
|
|
44
|
-
contextType?: import("react").Context<any> | undefined;
|
|
45
|
-
};
|
|
46
|
-
declare const Select: {
|
|
47
|
-
new <Option = import("./types").OptionType, IsMulti extends boolean = false>(props: import("./types").SelectProps<Option, IsMulti>): {
|
|
48
|
-
components: Partial<import("react-select/dist/declarations/src/components").SelectComponents<Option, IsMulti, import("react-select").GroupBase<Option>>>;
|
|
5
|
+
blur: () => void;
|
|
6
|
+
focus: () => void;
|
|
7
|
+
}> | undefined;
|
|
8
|
+
}) => JSX.Element;
|
|
9
|
+
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<{
|
|
49
11
|
select: import("react-select/base").default<unknown, false, import("react-select").GroupBase<unknown>> | null;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
onSelectRef: (ref: import("react-select/base").default<unknown, false, import("react-select").GroupBase<unknown>>) => void;
|
|
55
|
-
componentDidMount(): void;
|
|
56
|
-
render(): JSX.Element;
|
|
57
|
-
context: any;
|
|
58
|
-
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
59
|
-
forceUpdate(callback?: (() => void) | undefined): void;
|
|
60
|
-
readonly props: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>> & Readonly<{
|
|
61
|
-
children?: import("react").ReactNode;
|
|
62
|
-
}>;
|
|
63
|
-
state: Readonly<{}>;
|
|
64
|
-
refs: {
|
|
65
|
-
[key: string]: import("react").ReactInstance;
|
|
66
|
-
};
|
|
67
|
-
shouldComponentUpdate?(nextProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
68
|
-
componentWillUnmount?(): void;
|
|
69
|
-
componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
|
|
70
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, prevState: Readonly<{}>): any;
|
|
71
|
-
componentDidUpdate?(prevProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
72
|
-
componentWillMount?(): void;
|
|
73
|
-
UNSAFE_componentWillMount?(): void;
|
|
74
|
-
componentWillReceiveProps?(nextProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, nextContext: any): void;
|
|
75
|
-
componentWillUpdate?(nextProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, nextState: Readonly<{}>, nextContext: any): void;
|
|
76
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<import("./types").SelectProps<Option, IsMulti> | import("./types").AsyncSelectProps<Option, IsMulti> | import("./types").CreatableSelectProps<Option, IsMulti>>, nextState: Readonly<{}>, nextContext: any): void;
|
|
77
|
-
};
|
|
78
|
-
defaultProps: {
|
|
79
|
-
validationState: string;
|
|
80
|
-
spacing: string;
|
|
81
|
-
onClickPreventDefault: boolean;
|
|
82
|
-
tabSelectsValue: boolean;
|
|
83
|
-
components: {
|
|
84
|
-
Input: typeof import("./components/input-aria-describedby").Input;
|
|
85
|
-
};
|
|
86
|
-
styles: {};
|
|
87
|
-
};
|
|
88
|
-
contextType?: import("react").Context<any> | undefined;
|
|
89
|
-
};
|
|
12
|
+
blur: () => void;
|
|
13
|
+
focus: () => void;
|
|
14
|
+
}> | undefined;
|
|
15
|
+
}) => JSX.Element;
|
|
90
16
|
export default Select;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
2
3
|
import { ClearIndicatorProps, DropdownIndicatorProps, LoadingIndicatorProps } from '../types';
|
|
3
|
-
export declare const ClearIndicator:
|
|
4
|
-
export declare const DropdownIndicator:
|
|
5
|
-
export declare const LoadingIndicator:
|
|
4
|
+
export declare const ClearIndicator: <Option extends unknown, IsMulti extends boolean = false>(props: ClearIndicatorProps<Option, IsMulti>) => jsx.JSX.Element;
|
|
5
|
+
export declare const DropdownIndicator: <Option extends unknown, IsMulti extends boolean = false>(props: DropdownIndicatorProps<Option, IsMulti>) => jsx.JSX.Element;
|
|
6
|
+
export declare const LoadingIndicator: <Option extends unknown, IsMulti extends boolean = false>(props: LoadingIndicatorProps<Option, IsMulti>) => jsx.JSX.Element;
|
|
@@ -1,49 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { type GroupBase } from 'react-select';
|
|
1
|
+
import { type ComponentType, type Ref } from 'react';
|
|
3
2
|
import BaseSelect from 'react-select/base';
|
|
4
|
-
import { Input } from './components/input-aria-describedby';
|
|
5
3
|
import { SelectProps, OptionType, AsyncSelectProps, CreatableSelectProps } from './types';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
cacheComponents: (components: Partial<import("react-select/dist/declarations/src/components").SelectComponents<Option, IsMulti, GroupBase<Option>>>) => void;
|
|
12
|
-
focus(): void;
|
|
13
|
-
blur(): void;
|
|
14
|
-
onSelectRef: (ref: BaseSelect) => void;
|
|
15
|
-
componentDidMount(): void;
|
|
16
|
-
render(): JSX.Element;
|
|
17
|
-
context: any;
|
|
18
|
-
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<SelectProps<Option, IsMulti> | AsyncSelectProps<Option, IsMulti> | CreatableSelectProps<Option, IsMulti>>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
19
|
-
forceUpdate(callback?: (() => void) | undefined): void;
|
|
20
|
-
readonly props: Readonly<SelectProps<Option, IsMulti> | AsyncSelectProps<Option, IsMulti> | CreatableSelectProps<Option, IsMulti>> & Readonly<{
|
|
21
|
-
children?: React.ReactNode;
|
|
22
|
-
}>;
|
|
23
|
-
state: Readonly<{}>;
|
|
24
|
-
refs: {
|
|
25
|
-
[key: string]: React.ReactInstance;
|
|
26
|
-
};
|
|
27
|
-
shouldComponentUpdate?(nextProps: Readonly<SelectProps<Option, IsMulti> | AsyncSelectProps<Option, IsMulti> | CreatableSelectProps<Option, IsMulti>>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
28
|
-
componentWillUnmount?(): void;
|
|
29
|
-
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
30
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<SelectProps<Option, IsMulti> | AsyncSelectProps<Option, IsMulti> | CreatableSelectProps<Option, IsMulti>>, prevState: Readonly<{}>): any;
|
|
31
|
-
componentDidUpdate?(prevProps: Readonly<SelectProps<Option, IsMulti> | AsyncSelectProps<Option, IsMulti> | CreatableSelectProps<Option, IsMulti>>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
32
|
-
componentWillMount?(): void;
|
|
33
|
-
UNSAFE_componentWillMount?(): void;
|
|
34
|
-
componentWillReceiveProps?(nextProps: Readonly<SelectProps<Option, IsMulti> | AsyncSelectProps<Option, IsMulti> | CreatableSelectProps<Option, IsMulti>>, nextContext: any): void;
|
|
35
|
-
componentWillUpdate?(nextProps: Readonly<SelectProps<Option, IsMulti> | AsyncSelectProps<Option, IsMulti> | CreatableSelectProps<Option, IsMulti>>, nextState: Readonly<{}>, nextContext: any): void;
|
|
36
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<SelectProps<Option, IsMulti> | AsyncSelectProps<Option, IsMulti> | CreatableSelectProps<Option, IsMulti>>, nextState: Readonly<{}>, nextContext: any): void;
|
|
37
|
-
};
|
|
38
|
-
defaultProps: {
|
|
39
|
-
validationState: string;
|
|
40
|
-
spacing: string;
|
|
41
|
-
onClickPreventDefault: boolean;
|
|
42
|
-
tabSelectsValue: boolean;
|
|
43
|
-
components: {
|
|
44
|
-
Input: typeof Input;
|
|
45
|
-
};
|
|
46
|
-
styles: {};
|
|
47
|
-
};
|
|
48
|
-
contextType?: React.Context<any> | undefined;
|
|
4
|
+
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;
|
|
49
9
|
};
|
|
10
|
+
export default function createSelect(WrappedComponent: ComponentType<any>): <Option extends unknown = OptionType, IsMulti extends boolean = false>(props: AtlaskitSelectProps<Option, IsMulti> & {
|
|
11
|
+
ref?: Ref<AtlaskitSelectRefType>;
|
|
12
|
+
}) => JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { AriaOnFocusProps, GroupBase, OptionsOrGroups } from 'react-select';
|
|
2
2
|
import { GroupType, OptionType } from '../types';
|
|
3
3
|
export declare function onFocus(props: AriaOnFocusProps<OptionType, GroupBase<OptionType>>): string;
|
|
4
|
-
export declare const isOptionsGrouped: (arr: OptionsOrGroups<OptionType, GroupType<OptionType>>) => boolean;
|
|
4
|
+
export declare const isOptionsGrouped: (arr: OptionsOrGroups<OptionType, GroupType<OptionType>> | undefined) => boolean | undefined;
|