@atlaskit/react-select 0.0.2 → 1.0.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 +16 -0
- package/async-creatable/package.json +15 -0
- package/dist/cjs/async-creatable.js +1 -1
- package/dist/cjs/async.js +1 -1
- package/dist/cjs/components/index.js +1 -1
- package/dist/cjs/components/live-region.js +6 -7
- package/dist/cjs/creatable.js +1 -1
- package/dist/cjs/nonce-provider.js +1 -1
- package/dist/cjs/select.js +27 -25
- package/dist/cjs/state-manager.js +1 -1
- package/dist/cjs/utils.js +3 -3
- package/dist/es2019/components/live-region.js +4 -5
- package/dist/es2019/select.js +19 -17
- package/dist/esm/components/live-region.js +6 -7
- package/dist/esm/select.js +26 -24
- package/dist/esm/utils.js +3 -3
- package/dist/types/select.d.ts +67 -35
- package/dist/types-ts4.5/select.d.ts +67 -35
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
# @atlaskit/react-select
|
|
2
2
|
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#139777](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/139777)
|
|
8
|
+
[`79c93576c6fff`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/79c93576c6fff) -
|
|
9
|
+
Delete/deprecate props that are unused, used incorrectly, or bad for accessibility.
|
|
10
|
+
|
|
3
11
|
## 0.0.2
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
6
14
|
|
|
15
|
+
- [#135374](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/135374)
|
|
16
|
+
[`c7db6f8caf0cd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c7db6f8caf0cd) -
|
|
17
|
+
Export async creatable API
|
|
18
|
+
|
|
19
|
+
## 0.0.1
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
7
23
|
- [#132974](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/132974)
|
|
8
24
|
[`c515f82f96ef1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c515f82f96ef1) -
|
|
9
25
|
Initial fork of react-select
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/react-select/async-creatable",
|
|
3
|
+
"main": "../dist/cjs/async-creatable.js",
|
|
4
|
+
"module": "../dist/esm/async-creatable.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/async-creatable.js",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"types": "../dist/types/async-creatable.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.5 <5.4": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.5/async-creatable.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -13,7 +13,7 @@ var _useAsync = _interopRequireDefault(require("./use-async"));
|
|
|
13
13
|
var _useCreatable = _interopRequireDefault(require("./use-creatable"));
|
|
14
14
|
var _useStateManager = _interopRequireDefault(require("./use-state-manager"));
|
|
15
15
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
16
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
17
|
var AsyncCreatableSelect = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
18
18
|
var stateManagerProps = (0, _useAsync.default)(props);
|
|
19
19
|
var creatableProps = (0, _useStateManager.default)(stateManagerProps);
|
package/dist/cjs/async.js
CHANGED
|
@@ -18,7 +18,7 @@ var _select = _interopRequireDefault(require("./select"));
|
|
|
18
18
|
var _useAsync = _interopRequireDefault(require("./use-async"));
|
|
19
19
|
var _useStateManager = _interopRequireDefault(require("./use-state-manager"));
|
|
20
20
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
21
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
21
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
22
22
|
var AsyncSelect = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
23
23
|
var stateManagedProps = (0, _useAsync.default)(props);
|
|
24
24
|
var selectProps = (0, _useStateManager.default)(stateManagedProps);
|
|
@@ -18,7 +18,7 @@ var _option = _interopRequireDefault(require("./option"));
|
|
|
18
18
|
var _placeholder = _interopRequireDefault(require("./placeholder"));
|
|
19
19
|
var _singleValue = _interopRequireDefault(require("./single-value"));
|
|
20
20
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
21
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
21
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
22
22
|
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; }
|
|
23
23
|
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) { (0, _defineProperty2.default)(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; }
|
|
24
24
|
var components = exports.components = {
|
|
@@ -36,13 +36,12 @@ var LiveRegion = function LiveRegion(props) {
|
|
|
36
36
|
isMulti = selectProps.isMulti,
|
|
37
37
|
isOptionDisabled = selectProps.isOptionDisabled,
|
|
38
38
|
isSearchable = selectProps.isSearchable,
|
|
39
|
+
label = selectProps.label,
|
|
39
40
|
menuIsOpen = selectProps.menuIsOpen,
|
|
40
41
|
options = selectProps.options,
|
|
41
42
|
screenReaderStatus = selectProps.screenReaderStatus,
|
|
42
43
|
tabSelectsValue = selectProps.tabSelectsValue,
|
|
43
44
|
isLoading = selectProps.isLoading;
|
|
44
|
-
var ariaLabel = selectProps['aria-label'];
|
|
45
|
-
var ariaLive = selectProps['aria-live'];
|
|
46
45
|
|
|
47
46
|
// Update aria live message configuration when prop changes
|
|
48
47
|
var messages = (0, _react.useMemo)(function () {
|
|
@@ -65,7 +64,7 @@ var LiveRegion = function LiveRegion(props) {
|
|
|
65
64
|
|
|
66
65
|
// If there is just one item from the action then get its label
|
|
67
66
|
var selected = removedValue || option || asOption(value);
|
|
68
|
-
var
|
|
67
|
+
var _label = selected ? getOptionLabel(selected) : '';
|
|
69
68
|
|
|
70
69
|
// If there are multiple items from the action then return an array of labels
|
|
71
70
|
var multiSelected = selectedOptions || removedValues || undefined;
|
|
@@ -74,7 +73,7 @@ var LiveRegion = function LiveRegion(props) {
|
|
|
74
73
|
// multiSelected items are usually items that have already been selected
|
|
75
74
|
// or set by the user as a default value so we assume they are not disabled
|
|
76
75
|
isDisabled: selected && isOptionDisabled(selected, selectValue),
|
|
77
|
-
label:
|
|
76
|
+
label: _label,
|
|
78
77
|
labels: labels
|
|
79
78
|
}, ariaSelection);
|
|
80
79
|
message = messages.onChange(onChangeProps);
|
|
@@ -119,7 +118,7 @@ var LiveRegion = function LiveRegion(props) {
|
|
|
119
118
|
if (messages.guidance) {
|
|
120
119
|
var context = focusedValue ? 'value' : menuIsOpen ? 'menu' : 'input';
|
|
121
120
|
guidanceMsg = messages.guidance({
|
|
122
|
-
'aria-label':
|
|
121
|
+
'aria-label': label,
|
|
123
122
|
context: context,
|
|
124
123
|
isDisabled: focusedOption && isOptionDisabled(focusedOption, selectValue),
|
|
125
124
|
isMulti: isMulti,
|
|
@@ -129,7 +128,7 @@ var LiveRegion = function LiveRegion(props) {
|
|
|
129
128
|
});
|
|
130
129
|
}
|
|
131
130
|
return guidanceMsg;
|
|
132
|
-
}, [
|
|
131
|
+
}, [label, focusedOption, focusedValue, isMulti, isOptionDisabled, isSearchable, menuIsOpen, messages, selectValue, tabSelectsValue, isInitialFocus]);
|
|
133
132
|
var ScreenReaderText = (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)("span", {
|
|
134
133
|
id: "aria-selection"
|
|
135
134
|
}, ariaSelected), (0, _react2.jsx)("span", {
|
|
@@ -142,7 +141,7 @@ var LiveRegion = function LiveRegion(props) {
|
|
|
142
141
|
return (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_a11yText.default, {
|
|
143
142
|
id: id
|
|
144
143
|
}, isInitialFocus && ScreenReaderText), (0, _react2.jsx)(_a11yText.default, {
|
|
145
|
-
"aria-live":
|
|
144
|
+
"aria-live": "polite",
|
|
146
145
|
"aria-atomic": "false",
|
|
147
146
|
"aria-relevant": "additions text",
|
|
148
147
|
role: "log"
|
package/dist/cjs/creatable.js
CHANGED
|
@@ -18,7 +18,7 @@ var _select = _interopRequireDefault(require("./select"));
|
|
|
18
18
|
var _useCreatable = _interopRequireDefault(require("./use-creatable"));
|
|
19
19
|
var _useStateManager = _interopRequireDefault(require("./use-state-manager"));
|
|
20
20
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
21
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
21
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
22
22
|
var CreatableSelect = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
23
23
|
var creatableProps = (0, _useStateManager.default)(props);
|
|
24
24
|
var selectProps = (0, _useCreatable.default)(creatableProps);
|
|
@@ -10,7 +10,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
10
10
|
var _cache = _interopRequireDefault(require("@emotion/cache"));
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
12
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
13
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
13
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
14
|
var NonceProvider = function NonceProvider(_ref) {
|
|
15
15
|
var nonce = _ref.nonce,
|
|
16
16
|
children = _ref.children,
|
package/dist/cjs/select.js
CHANGED
|
@@ -27,13 +27,12 @@ var _styles = require("./styles");
|
|
|
27
27
|
var _theme = require("./theme");
|
|
28
28
|
var _utils = require("./utils");
|
|
29
29
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
30
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
30
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
31
31
|
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; }
|
|
32
32
|
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) { (0, _defineProperty2.default)(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; }
|
|
33
|
-
function _createSuper(
|
|
33
|
+
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
|
|
34
34
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
35
35
|
var defaultProps = exports.defaultProps = {
|
|
36
|
-
'aria-live': 'polite',
|
|
37
36
|
backspaceRemovesValue: true,
|
|
38
37
|
blurInputOnSelect: (0, _utils.isTouchCapable)(),
|
|
39
38
|
captureMenuScroll: !(0, _utils.isTouchCapable)(),
|
|
@@ -1143,12 +1142,12 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
1143
1142
|
key: "formatOptionLabel",
|
|
1144
1143
|
value: function formatOptionLabel(data, context) {
|
|
1145
1144
|
if (typeof this.props.formatOptionLabel === 'function') {
|
|
1146
|
-
var
|
|
1147
|
-
var
|
|
1145
|
+
var inputValue = this.props.inputValue;
|
|
1146
|
+
var selectValue = this.state.selectValue;
|
|
1148
1147
|
return this.props.formatOptionLabel(data, {
|
|
1149
1148
|
context: context,
|
|
1150
|
-
inputValue:
|
|
1151
|
-
selectValue:
|
|
1149
|
+
inputValue: inputValue,
|
|
1150
|
+
selectValue: selectValue
|
|
1152
1151
|
});
|
|
1153
1152
|
} else {
|
|
1154
1153
|
return this.getOptionLabel(data);
|
|
@@ -1221,14 +1220,18 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
1221
1220
|
// ==============================
|
|
1222
1221
|
function renderInput() {
|
|
1223
1222
|
var _this$props8 = this.props,
|
|
1224
|
-
|
|
1225
|
-
|
|
1223
|
+
descriptionId = _this$props8.descriptionId,
|
|
1224
|
+
form = _this$props8.form,
|
|
1226
1225
|
inputId = _this$props8.inputId,
|
|
1227
1226
|
inputValue = _this$props8.inputValue,
|
|
1228
|
-
|
|
1229
|
-
|
|
1227
|
+
isDisabled = _this$props8.isDisabled,
|
|
1228
|
+
isInvalid = _this$props8.isInvalid,
|
|
1229
|
+
isRequired = _this$props8.isRequired,
|
|
1230
|
+
isSearchable = _this$props8.isSearchable,
|
|
1231
|
+
label = _this$props8.label,
|
|
1232
|
+
labelId = _this$props8.labelId,
|
|
1230
1233
|
menuIsOpen = _this$props8.menuIsOpen,
|
|
1231
|
-
|
|
1234
|
+
tabIndex = _this$props8.tabIndex;
|
|
1232
1235
|
var _this$getComponents = this.getComponents(),
|
|
1233
1236
|
Input = _this$getComponents.Input;
|
|
1234
1237
|
var _this$state4 = this.state,
|
|
@@ -1242,12 +1245,11 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
1242
1245
|
'aria-autocomplete': 'list',
|
|
1243
1246
|
'aria-expanded': menuIsOpen,
|
|
1244
1247
|
'aria-haspopup': 'listbox',
|
|
1245
|
-
'aria-
|
|
1246
|
-
'aria-
|
|
1247
|
-
'aria-
|
|
1248
|
-
'aria-
|
|
1249
|
-
'aria-
|
|
1250
|
-
'aria-required': required,
|
|
1248
|
+
'aria-describedby': descriptionId,
|
|
1249
|
+
'aria-invalid': isInvalid,
|
|
1250
|
+
'aria-label': label,
|
|
1251
|
+
'aria-labelledby': labelId,
|
|
1252
|
+
'aria-required': isRequired,
|
|
1251
1253
|
role: 'combobox',
|
|
1252
1254
|
'aria-activedescendant': this.isAppleDevice ? undefined : this.state.focusedOptionId
|
|
1253
1255
|
}, menuIsOpen && {
|
|
@@ -1255,9 +1257,9 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
1255
1257
|
}), !isSearchable && {
|
|
1256
1258
|
'aria-readonly': true
|
|
1257
1259
|
}), this.hasValue() ? (ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === 'initial-input-focus' && {
|
|
1258
|
-
'aria-describedby': this.getElementId('live-region')
|
|
1260
|
+
'aria-describedby': descriptionId ? [descriptionId, this.getElementId('live-region')].join(' ') : this.getElementId('live-region')
|
|
1259
1261
|
} : {
|
|
1260
|
-
'aria-describedby': this.getElementId('placeholder')
|
|
1262
|
+
'aria-describedby': descriptionId ? [descriptionId, this.getElementId('placeholder')].join(' ') : this.getElementId('placeholder')
|
|
1261
1263
|
});
|
|
1262
1264
|
if (!isSearchable) {
|
|
1263
1265
|
// use a dummy input to maintain focus/blur functionality
|
|
@@ -1528,14 +1530,14 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
1528
1530
|
if (this.hasOptions()) {
|
|
1529
1531
|
menuUI = this.getCategorizedOptions().map(function (item) {
|
|
1530
1532
|
if (item.type === 'group') {
|
|
1531
|
-
var
|
|
1533
|
+
var data = item.data,
|
|
1532
1534
|
options = item.options,
|
|
1533
1535
|
groupIndex = item.index;
|
|
1534
1536
|
var groupId = "".concat(_this4.getElementId('group'), "-").concat(groupIndex);
|
|
1535
1537
|
var headingId = "".concat(groupId, "-heading");
|
|
1536
1538
|
return /*#__PURE__*/_react.default.createElement(Group, (0, _extends2.default)({}, commonProps, {
|
|
1537
1539
|
key: groupId,
|
|
1538
|
-
data:
|
|
1540
|
+
data: data,
|
|
1539
1541
|
options: options,
|
|
1540
1542
|
Heading: GroupHeading,
|
|
1541
1543
|
headingProps: {
|
|
@@ -1628,10 +1630,10 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
1628
1630
|
delimiter = _this$props13.delimiter,
|
|
1629
1631
|
isDisabled = _this$props13.isDisabled,
|
|
1630
1632
|
isMulti = _this$props13.isMulti,
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
+
isRequired = _this$props13.isRequired,
|
|
1634
|
+
name = _this$props13.name;
|
|
1633
1635
|
var selectValue = this.state.selectValue;
|
|
1634
|
-
if (
|
|
1636
|
+
if (isRequired && !this.hasValue() && !isDisabled) {
|
|
1635
1637
|
return /*#__PURE__*/_react.default.createElement(_internal.RequiredInput, {
|
|
1636
1638
|
name: name,
|
|
1637
1639
|
onFocus: this.onValueInputFocus
|
|
@@ -11,7 +11,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _select = _interopRequireDefault(require("./select"));
|
|
12
12
|
var _useStateManager = _interopRequireDefault(require("./use-state-manager"));
|
|
13
13
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
14
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
14
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
15
|
/**
|
|
16
16
|
* __StateManagedSelect__
|
|
17
17
|
*
|
package/dist/cjs/utils.js
CHANGED
|
@@ -142,9 +142,9 @@ var getStyleProps = exports.getStyleProps = function getStyleProps(props, name,
|
|
|
142
142
|
|
|
143
143
|
function handleInputChange(inputValue, actionMeta, onInputChange) {
|
|
144
144
|
if (onInputChange) {
|
|
145
|
-
var
|
|
146
|
-
if (typeof
|
|
147
|
-
return
|
|
145
|
+
var newValue = onInputChange(inputValue, actionMeta);
|
|
146
|
+
if (typeof newValue === 'string') {
|
|
147
|
+
return newValue;
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
return inputValue;
|
|
@@ -31,14 +31,13 @@ const LiveRegion = props => {
|
|
|
31
31
|
isMulti,
|
|
32
32
|
isOptionDisabled,
|
|
33
33
|
isSearchable,
|
|
34
|
+
label,
|
|
34
35
|
menuIsOpen,
|
|
35
36
|
options,
|
|
36
37
|
screenReaderStatus,
|
|
37
38
|
tabSelectsValue,
|
|
38
39
|
isLoading
|
|
39
40
|
} = selectProps;
|
|
40
|
-
const ariaLabel = selectProps['aria-label'];
|
|
41
|
-
const ariaLive = selectProps['aria-live'];
|
|
42
41
|
|
|
43
42
|
// Update aria live message configuration when prop changes
|
|
44
43
|
const messages = useMemo(() => ({
|
|
@@ -117,7 +116,7 @@ const LiveRegion = props => {
|
|
|
117
116
|
if (messages.guidance) {
|
|
118
117
|
const context = focusedValue ? 'value' : menuIsOpen ? 'menu' : 'input';
|
|
119
118
|
guidanceMsg = messages.guidance({
|
|
120
|
-
'aria-label':
|
|
119
|
+
'aria-label': label,
|
|
121
120
|
context,
|
|
122
121
|
isDisabled: focusedOption && isOptionDisabled(focusedOption, selectValue),
|
|
123
122
|
isMulti,
|
|
@@ -127,7 +126,7 @@ const LiveRegion = props => {
|
|
|
127
126
|
});
|
|
128
127
|
}
|
|
129
128
|
return guidanceMsg;
|
|
130
|
-
}, [
|
|
129
|
+
}, [label, focusedOption, focusedValue, isMulti, isOptionDisabled, isSearchable, menuIsOpen, messages, selectValue, tabSelectsValue, isInitialFocus]);
|
|
131
130
|
const ScreenReaderText = jsx(Fragment, null, jsx("span", {
|
|
132
131
|
id: "aria-selection"
|
|
133
132
|
}, ariaSelected), jsx("span", {
|
|
@@ -140,7 +139,7 @@ const LiveRegion = props => {
|
|
|
140
139
|
return jsx(Fragment, null, jsx(A11yText, {
|
|
141
140
|
id: id
|
|
142
141
|
}, isInitialFocus && ScreenReaderText), jsx(A11yText, {
|
|
143
|
-
"aria-live":
|
|
142
|
+
"aria-live": "polite",
|
|
144
143
|
"aria-atomic": "false",
|
|
145
144
|
"aria-relevant": "additions text",
|
|
146
145
|
role: "log"
|
package/dist/es2019/select.js
CHANGED
|
@@ -12,7 +12,6 @@ import { defaultStyles } from './styles';
|
|
|
12
12
|
import { defaultTheme } from './theme';
|
|
13
13
|
import { classNames, cleanValue, isDocumentElement, isMobileDevice, isTouchCapable, multiValueAsValue, noop, notNullish, scrollIntoView, singleValueAsValue, valueTernary } from './utils';
|
|
14
14
|
export const defaultProps = {
|
|
15
|
-
'aria-live': 'polite',
|
|
16
15
|
backspaceRemovesValue: true,
|
|
17
16
|
blurInputOnSelect: isTouchCapable(),
|
|
18
17
|
captureMenuScroll: !isTouchCapable(),
|
|
@@ -1226,14 +1225,18 @@ export default class Select extends Component {
|
|
|
1226
1225
|
// ==============================
|
|
1227
1226
|
renderInput() {
|
|
1228
1227
|
const {
|
|
1229
|
-
|
|
1230
|
-
|
|
1228
|
+
descriptionId,
|
|
1229
|
+
form,
|
|
1231
1230
|
inputId,
|
|
1232
1231
|
inputValue,
|
|
1233
|
-
|
|
1234
|
-
|
|
1232
|
+
isDisabled,
|
|
1233
|
+
isInvalid,
|
|
1234
|
+
isRequired,
|
|
1235
|
+
isSearchable,
|
|
1236
|
+
label,
|
|
1237
|
+
labelId,
|
|
1235
1238
|
menuIsOpen,
|
|
1236
|
-
|
|
1239
|
+
tabIndex
|
|
1237
1240
|
} = this.props;
|
|
1238
1241
|
const {
|
|
1239
1242
|
Input
|
|
@@ -1252,12 +1255,11 @@ export default class Select extends Component {
|
|
|
1252
1255
|
'aria-autocomplete': 'list',
|
|
1253
1256
|
'aria-expanded': menuIsOpen,
|
|
1254
1257
|
'aria-haspopup': 'listbox',
|
|
1255
|
-
'aria-
|
|
1256
|
-
'aria-
|
|
1257
|
-
'aria-
|
|
1258
|
-
'aria-
|
|
1259
|
-
'aria-
|
|
1260
|
-
'aria-required': required,
|
|
1258
|
+
'aria-describedby': descriptionId,
|
|
1259
|
+
'aria-invalid': isInvalid,
|
|
1260
|
+
'aria-label': label,
|
|
1261
|
+
'aria-labelledby': labelId,
|
|
1262
|
+
'aria-required': isRequired,
|
|
1261
1263
|
role: 'combobox',
|
|
1262
1264
|
'aria-activedescendant': this.isAppleDevice ? undefined : this.state.focusedOptionId,
|
|
1263
1265
|
...(menuIsOpen && {
|
|
@@ -1267,9 +1269,9 @@ export default class Select extends Component {
|
|
|
1267
1269
|
'aria-readonly': true
|
|
1268
1270
|
}),
|
|
1269
1271
|
...(this.hasValue() ? (ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === 'initial-input-focus' && {
|
|
1270
|
-
'aria-describedby': this.getElementId('live-region')
|
|
1272
|
+
'aria-describedby': descriptionId ? [descriptionId, this.getElementId('live-region')].join(' ') : this.getElementId('live-region')
|
|
1271
1273
|
} : {
|
|
1272
|
-
'aria-describedby': this.getElementId('placeholder')
|
|
1274
|
+
'aria-describedby': descriptionId ? [descriptionId, this.getElementId('placeholder')].join(' ') : this.getElementId('placeholder')
|
|
1273
1275
|
})
|
|
1274
1276
|
};
|
|
1275
1277
|
if (!isSearchable) {
|
|
@@ -1653,13 +1655,13 @@ export default class Select extends Component {
|
|
|
1653
1655
|
delimiter,
|
|
1654
1656
|
isDisabled,
|
|
1655
1657
|
isMulti,
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
+
isRequired,
|
|
1659
|
+
name
|
|
1658
1660
|
} = this.props;
|
|
1659
1661
|
const {
|
|
1660
1662
|
selectValue
|
|
1661
1663
|
} = this.state;
|
|
1662
|
-
if (
|
|
1664
|
+
if (isRequired && !this.hasValue() && !isDisabled) {
|
|
1663
1665
|
return /*#__PURE__*/React.createElement(RequiredInput, {
|
|
1664
1666
|
name: name,
|
|
1665
1667
|
onFocus: this.onValueInputFocus
|
|
@@ -31,13 +31,12 @@ var LiveRegion = function LiveRegion(props) {
|
|
|
31
31
|
isMulti = selectProps.isMulti,
|
|
32
32
|
isOptionDisabled = selectProps.isOptionDisabled,
|
|
33
33
|
isSearchable = selectProps.isSearchable,
|
|
34
|
+
label = selectProps.label,
|
|
34
35
|
menuIsOpen = selectProps.menuIsOpen,
|
|
35
36
|
options = selectProps.options,
|
|
36
37
|
screenReaderStatus = selectProps.screenReaderStatus,
|
|
37
38
|
tabSelectsValue = selectProps.tabSelectsValue,
|
|
38
39
|
isLoading = selectProps.isLoading;
|
|
39
|
-
var ariaLabel = selectProps['aria-label'];
|
|
40
|
-
var ariaLive = selectProps['aria-live'];
|
|
41
40
|
|
|
42
41
|
// Update aria live message configuration when prop changes
|
|
43
42
|
var messages = useMemo(function () {
|
|
@@ -60,7 +59,7 @@ var LiveRegion = function LiveRegion(props) {
|
|
|
60
59
|
|
|
61
60
|
// If there is just one item from the action then get its label
|
|
62
61
|
var selected = removedValue || option || asOption(value);
|
|
63
|
-
var
|
|
62
|
+
var _label = selected ? getOptionLabel(selected) : '';
|
|
64
63
|
|
|
65
64
|
// If there are multiple items from the action then return an array of labels
|
|
66
65
|
var multiSelected = selectedOptions || removedValues || undefined;
|
|
@@ -69,7 +68,7 @@ var LiveRegion = function LiveRegion(props) {
|
|
|
69
68
|
// multiSelected items are usually items that have already been selected
|
|
70
69
|
// or set by the user as a default value so we assume they are not disabled
|
|
71
70
|
isDisabled: selected && isOptionDisabled(selected, selectValue),
|
|
72
|
-
label:
|
|
71
|
+
label: _label,
|
|
73
72
|
labels: labels
|
|
74
73
|
}, ariaSelection);
|
|
75
74
|
message = messages.onChange(onChangeProps);
|
|
@@ -114,7 +113,7 @@ var LiveRegion = function LiveRegion(props) {
|
|
|
114
113
|
if (messages.guidance) {
|
|
115
114
|
var context = focusedValue ? 'value' : menuIsOpen ? 'menu' : 'input';
|
|
116
115
|
guidanceMsg = messages.guidance({
|
|
117
|
-
'aria-label':
|
|
116
|
+
'aria-label': label,
|
|
118
117
|
context: context,
|
|
119
118
|
isDisabled: focusedOption && isOptionDisabled(focusedOption, selectValue),
|
|
120
119
|
isMulti: isMulti,
|
|
@@ -124,7 +123,7 @@ var LiveRegion = function LiveRegion(props) {
|
|
|
124
123
|
});
|
|
125
124
|
}
|
|
126
125
|
return guidanceMsg;
|
|
127
|
-
}, [
|
|
126
|
+
}, [label, focusedOption, focusedValue, isMulti, isOptionDisabled, isSearchable, menuIsOpen, messages, selectValue, tabSelectsValue, isInitialFocus]);
|
|
128
127
|
var ScreenReaderText = jsx(Fragment, null, jsx("span", {
|
|
129
128
|
id: "aria-selection"
|
|
130
129
|
}, ariaSelected), jsx("span", {
|
|
@@ -137,7 +136,7 @@ var LiveRegion = function LiveRegion(props) {
|
|
|
137
136
|
return jsx(Fragment, null, jsx(A11yText, {
|
|
138
137
|
id: id
|
|
139
138
|
}, isInitialFocus && ScreenReaderText), jsx(A11yText, {
|
|
140
|
-
"aria-live":
|
|
139
|
+
"aria-live": "polite",
|
|
141
140
|
"aria-atomic": "false",
|
|
142
141
|
"aria-relevant": "additions text",
|
|
143
142
|
role: "log"
|
package/dist/esm/select.js
CHANGED
|
@@ -9,7 +9,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
9
9
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
10
10
|
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; }
|
|
11
11
|
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; }
|
|
12
|
-
function _createSuper(
|
|
12
|
+
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
|
|
13
13
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
14
14
|
import React, { Component } from 'react';
|
|
15
15
|
import { isAppleDevice } from './accessibility/helpers';
|
|
@@ -23,7 +23,6 @@ import { defaultStyles } from './styles';
|
|
|
23
23
|
import { defaultTheme } from './theme';
|
|
24
24
|
import { classNames, cleanValue, isDocumentElement, isMobileDevice, isTouchCapable, multiValueAsValue, noop, notNullish, scrollIntoView, singleValueAsValue, valueTernary } from './utils';
|
|
25
25
|
export var defaultProps = {
|
|
26
|
-
'aria-live': 'polite',
|
|
27
26
|
backspaceRemovesValue: true,
|
|
28
27
|
blurInputOnSelect: isTouchCapable(),
|
|
29
28
|
captureMenuScroll: !isTouchCapable(),
|
|
@@ -1133,12 +1132,12 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
1133
1132
|
key: "formatOptionLabel",
|
|
1134
1133
|
value: function formatOptionLabel(data, context) {
|
|
1135
1134
|
if (typeof this.props.formatOptionLabel === 'function') {
|
|
1136
|
-
var
|
|
1137
|
-
var
|
|
1135
|
+
var inputValue = this.props.inputValue;
|
|
1136
|
+
var selectValue = this.state.selectValue;
|
|
1138
1137
|
return this.props.formatOptionLabel(data, {
|
|
1139
1138
|
context: context,
|
|
1140
|
-
inputValue:
|
|
1141
|
-
selectValue:
|
|
1139
|
+
inputValue: inputValue,
|
|
1140
|
+
selectValue: selectValue
|
|
1142
1141
|
});
|
|
1143
1142
|
} else {
|
|
1144
1143
|
return this.getOptionLabel(data);
|
|
@@ -1211,14 +1210,18 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
1211
1210
|
// ==============================
|
|
1212
1211
|
function renderInput() {
|
|
1213
1212
|
var _this$props8 = this.props,
|
|
1214
|
-
|
|
1215
|
-
|
|
1213
|
+
descriptionId = _this$props8.descriptionId,
|
|
1214
|
+
form = _this$props8.form,
|
|
1216
1215
|
inputId = _this$props8.inputId,
|
|
1217
1216
|
inputValue = _this$props8.inputValue,
|
|
1218
|
-
|
|
1219
|
-
|
|
1217
|
+
isDisabled = _this$props8.isDisabled,
|
|
1218
|
+
isInvalid = _this$props8.isInvalid,
|
|
1219
|
+
isRequired = _this$props8.isRequired,
|
|
1220
|
+
isSearchable = _this$props8.isSearchable,
|
|
1221
|
+
label = _this$props8.label,
|
|
1222
|
+
labelId = _this$props8.labelId,
|
|
1220
1223
|
menuIsOpen = _this$props8.menuIsOpen,
|
|
1221
|
-
|
|
1224
|
+
tabIndex = _this$props8.tabIndex;
|
|
1222
1225
|
var _this$getComponents = this.getComponents(),
|
|
1223
1226
|
Input = _this$getComponents.Input;
|
|
1224
1227
|
var _this$state4 = this.state,
|
|
@@ -1232,12 +1235,11 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
1232
1235
|
'aria-autocomplete': 'list',
|
|
1233
1236
|
'aria-expanded': menuIsOpen,
|
|
1234
1237
|
'aria-haspopup': 'listbox',
|
|
1235
|
-
'aria-
|
|
1236
|
-
'aria-
|
|
1237
|
-
'aria-
|
|
1238
|
-
'aria-
|
|
1239
|
-
'aria-
|
|
1240
|
-
'aria-required': required,
|
|
1238
|
+
'aria-describedby': descriptionId,
|
|
1239
|
+
'aria-invalid': isInvalid,
|
|
1240
|
+
'aria-label': label,
|
|
1241
|
+
'aria-labelledby': labelId,
|
|
1242
|
+
'aria-required': isRequired,
|
|
1241
1243
|
role: 'combobox',
|
|
1242
1244
|
'aria-activedescendant': this.isAppleDevice ? undefined : this.state.focusedOptionId
|
|
1243
1245
|
}, menuIsOpen && {
|
|
@@ -1245,9 +1247,9 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
1245
1247
|
}), !isSearchable && {
|
|
1246
1248
|
'aria-readonly': true
|
|
1247
1249
|
}), this.hasValue() ? (ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === 'initial-input-focus' && {
|
|
1248
|
-
'aria-describedby': this.getElementId('live-region')
|
|
1250
|
+
'aria-describedby': descriptionId ? [descriptionId, this.getElementId('live-region')].join(' ') : this.getElementId('live-region')
|
|
1249
1251
|
} : {
|
|
1250
|
-
'aria-describedby': this.getElementId('placeholder')
|
|
1252
|
+
'aria-describedby': descriptionId ? [descriptionId, this.getElementId('placeholder')].join(' ') : this.getElementId('placeholder')
|
|
1251
1253
|
});
|
|
1252
1254
|
if (!isSearchable) {
|
|
1253
1255
|
// use a dummy input to maintain focus/blur functionality
|
|
@@ -1518,14 +1520,14 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
1518
1520
|
if (this.hasOptions()) {
|
|
1519
1521
|
menuUI = this.getCategorizedOptions().map(function (item) {
|
|
1520
1522
|
if (item.type === 'group') {
|
|
1521
|
-
var
|
|
1523
|
+
var data = item.data,
|
|
1522
1524
|
options = item.options,
|
|
1523
1525
|
groupIndex = item.index;
|
|
1524
1526
|
var groupId = "".concat(_this4.getElementId('group'), "-").concat(groupIndex);
|
|
1525
1527
|
var headingId = "".concat(groupId, "-heading");
|
|
1526
1528
|
return /*#__PURE__*/React.createElement(Group, _extends({}, commonProps, {
|
|
1527
1529
|
key: groupId,
|
|
1528
|
-
data:
|
|
1530
|
+
data: data,
|
|
1529
1531
|
options: options,
|
|
1530
1532
|
Heading: GroupHeading,
|
|
1531
1533
|
headingProps: {
|
|
@@ -1618,10 +1620,10 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
1618
1620
|
delimiter = _this$props13.delimiter,
|
|
1619
1621
|
isDisabled = _this$props13.isDisabled,
|
|
1620
1622
|
isMulti = _this$props13.isMulti,
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
+
isRequired = _this$props13.isRequired,
|
|
1624
|
+
name = _this$props13.name;
|
|
1623
1625
|
var selectValue = this.state.selectValue;
|
|
1624
|
-
if (
|
|
1626
|
+
if (isRequired && !this.hasValue() && !isDisabled) {
|
|
1625
1627
|
return /*#__PURE__*/React.createElement(RequiredInput, {
|
|
1626
1628
|
name: name,
|
|
1627
1629
|
onFocus: this.onValueInputFocus
|
package/dist/esm/utils.js
CHANGED
|
@@ -113,9 +113,9 @@ export var getStyleProps = function getStyleProps(props, name, classNamesState)
|
|
|
113
113
|
|
|
114
114
|
export function handleInputChange(inputValue, actionMeta, onInputChange) {
|
|
115
115
|
if (onInputChange) {
|
|
116
|
-
var
|
|
117
|
-
if (typeof
|
|
118
|
-
return
|
|
116
|
+
var newValue = onInputChange(inputValue, actionMeta);
|
|
117
|
+
if (typeof newValue === 'string') {
|
|
118
|
+
return newValue;
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
return inputValue;
|
package/dist/types/select.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { Component, type FocusEventHandler, type FormEventHandler, type KeyboardEventHandler, type MouseEventHandler, type ReactNode, type RefCallback, type TouchEventHandler } from 'react';
|
|
2
2
|
import { type AriaLiveMessages, type AriaSelection } from './accessibility';
|
|
3
3
|
import { type SelectComponentsConfig } from './components';
|
|
4
4
|
import { type FilterOptionOption } from './filters';
|
|
@@ -12,37 +12,20 @@ export interface FormatOptionLabelMeta<Option> {
|
|
|
12
12
|
selectValue: Options<Option>;
|
|
13
13
|
}
|
|
14
14
|
export interface SelectProps<Option, IsMulti extends boolean, Group extends GroupBase<Option>> {
|
|
15
|
-
/**
|
|
16
|
-
* HTML ID of an element containing an error message related to the input
|
|
17
|
-
*/
|
|
18
|
-
'aria-errormessage'?: AriaAttributes['aria-errormessage'];
|
|
19
|
-
/**
|
|
20
|
-
* Indicate if the value entered in the field is invalid
|
|
21
|
-
*/
|
|
22
|
-
'aria-invalid'?: AriaAttributes['aria-invalid'];
|
|
23
|
-
/**
|
|
24
|
-
* Aria label (for assistive tech)
|
|
25
|
-
*/
|
|
26
|
-
'aria-label'?: AriaAttributes['aria-label'];
|
|
27
|
-
/**
|
|
28
|
-
* HTML ID of an element that should be used as the label (for assistive tech)
|
|
29
|
-
*/
|
|
30
|
-
'aria-labelledby'?: AriaAttributes['aria-labelledby'];
|
|
31
|
-
'aria-describedby'?: AriaAttributes['aria-describedby'];
|
|
32
|
-
/**
|
|
33
|
-
* Used to set the priority with which screen reader should treat updates to live regions. The possible settings are: off, polite (default) or assertive
|
|
34
|
-
*/
|
|
35
|
-
'aria-live'?: AriaAttributes['aria-live'];
|
|
36
15
|
/**
|
|
37
16
|
* Customise the messages used by the aria-live component
|
|
17
|
+
*
|
|
18
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
|
|
38
19
|
*/
|
|
39
20
|
ariaLiveMessages?: AriaLiveMessages<Option, IsMulti, Group>;
|
|
40
21
|
/**
|
|
41
|
-
* Focus the control when it is mounted
|
|
22
|
+
* Focus the control when it is mounted. There are very few cases that this should be used, and using incorrectly may violate accessibility guidelines.
|
|
42
23
|
*/
|
|
43
24
|
autoFocus?: boolean;
|
|
44
25
|
/**
|
|
45
26
|
* Remove the currently focused option when the user presses backspace when Select isClearable or isMulti
|
|
27
|
+
*
|
|
28
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}. Will soon be handled automatically to support expected keyboard accessibility.
|
|
46
29
|
*/
|
|
47
30
|
backspaceRemovesValue: boolean;
|
|
48
31
|
/**
|
|
@@ -51,6 +34,8 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
51
34
|
blurInputOnSelect: boolean;
|
|
52
35
|
/**
|
|
53
36
|
* When the user reaches the top/bottom of the menu, prevent scroll on the scroll-parent
|
|
37
|
+
*
|
|
38
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
|
|
54
39
|
*/
|
|
55
40
|
captureMenuScroll: boolean;
|
|
56
41
|
/**
|
|
@@ -82,6 +67,8 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
82
67
|
*
|
|
83
68
|
* This is useful when you have a scrollable modal and want to portal the menu out,
|
|
84
69
|
* but want to avoid graphical issues.
|
|
70
|
+
*
|
|
71
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
|
|
85
72
|
*/
|
|
86
73
|
closeMenuOnScroll: boolean | ((event: Event) => boolean);
|
|
87
74
|
/**
|
|
@@ -96,14 +83,24 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
96
83
|
components: SelectComponentsConfig<Option, IsMulti, Group>;
|
|
97
84
|
/**
|
|
98
85
|
* Whether the value of the select, e.g. SingleValue, should be displayed in the control.
|
|
86
|
+
*
|
|
87
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
|
|
99
88
|
*/
|
|
100
89
|
controlShouldRenderValue: boolean;
|
|
101
90
|
/**
|
|
102
91
|
* Delimiter used to join multiple values into a single HTML Input value
|
|
92
|
+
*
|
|
93
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
|
|
103
94
|
*/
|
|
104
95
|
delimiter?: string;
|
|
105
96
|
/**
|
|
106
|
-
*
|
|
97
|
+
* This sets the aria-describedby attribute. It sets an accessible description for the select, for people who use assistive technology. Use '<HelperMessage>' from '@atlaskit/form' is preferred.
|
|
98
|
+
*/
|
|
99
|
+
descriptionId?: string;
|
|
100
|
+
/**
|
|
101
|
+
* Clear all values when the user presses escape AND the menu is closed.
|
|
102
|
+
*
|
|
103
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}. Will soon be handled automatically to support expected keyboard accessibility.
|
|
107
104
|
*/
|
|
108
105
|
escapeClearsValue: boolean;
|
|
109
106
|
/**
|
|
@@ -159,6 +156,10 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
159
156
|
* Is the select disabled
|
|
160
157
|
*/
|
|
161
158
|
isDisabled: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Is the select invalid
|
|
161
|
+
*/
|
|
162
|
+
isInvalid?: boolean;
|
|
162
163
|
/**
|
|
163
164
|
* Is the select in a state of loading (async)
|
|
164
165
|
*/
|
|
@@ -177,14 +178,28 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
177
178
|
* Support multiple selected options
|
|
178
179
|
*/
|
|
179
180
|
isMulti: IsMulti;
|
|
181
|
+
/**
|
|
182
|
+
* This prop indicates if the component is required.
|
|
183
|
+
*/
|
|
184
|
+
isRequired?: boolean;
|
|
180
185
|
/**
|
|
181
186
|
* Is the select direction right-to-left
|
|
187
|
+
*
|
|
188
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
|
|
182
189
|
*/
|
|
183
190
|
isRtl: boolean;
|
|
184
191
|
/**
|
|
185
192
|
* Whether to enable search functionality
|
|
186
193
|
*/
|
|
187
194
|
isSearchable: boolean;
|
|
195
|
+
/**
|
|
196
|
+
* This sets the aria-label attribute. It sets an accessible name for the select, for people who use assistive technology. Use of a visible label is highly recommended for greater accessibility support.
|
|
197
|
+
*/
|
|
198
|
+
label?: string;
|
|
199
|
+
/**
|
|
200
|
+
* This sets the aria-labelledby attribute. It sets an accessible name for the select, for people who use assistive technology. Use of a visible label is highly recommended for greater accessibility support.
|
|
201
|
+
*/
|
|
202
|
+
labelId?: string;
|
|
188
203
|
/**
|
|
189
204
|
* Async: Text to display when loading options
|
|
190
205
|
*/
|
|
@@ -220,6 +235,8 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
220
235
|
menuPortalTarget?: HTMLElement | null;
|
|
221
236
|
/**
|
|
222
237
|
* Whether to block scroll events when the menu is open
|
|
238
|
+
*
|
|
239
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
|
|
223
240
|
*/
|
|
224
241
|
menuShouldBlockScroll: boolean;
|
|
225
242
|
/**
|
|
@@ -274,10 +291,14 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
274
291
|
onMenuScrollToBottom?: (event: WheelEvent | TouchEvent) => void;
|
|
275
292
|
/**
|
|
276
293
|
* Allows control of whether the menu is opened when the Select is focused
|
|
294
|
+
*
|
|
295
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}. Will soon be removed to support expected accessibility interactions.
|
|
277
296
|
*/
|
|
278
297
|
openMenuOnFocus: boolean;
|
|
279
298
|
/**
|
|
280
299
|
* Allows control of whether the menu is opened when the Select is clicked
|
|
300
|
+
*
|
|
301
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}. Will soon be removed to support expected accessibility interactions.
|
|
281
302
|
*/
|
|
282
303
|
openMenuOnClick: boolean;
|
|
283
304
|
/**
|
|
@@ -294,6 +315,8 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
294
315
|
placeholder: ReactNode;
|
|
295
316
|
/**
|
|
296
317
|
* Status to relay to screen readers
|
|
318
|
+
*
|
|
319
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
|
|
297
320
|
*/
|
|
298
321
|
screenReaderStatus: (obj: {
|
|
299
322
|
count: number;
|
|
@@ -306,14 +329,19 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
306
329
|
styles: StylesConfig<Option, IsMulti, Group>;
|
|
307
330
|
/**
|
|
308
331
|
* Theme modifier method
|
|
332
|
+
*
|
|
333
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
|
|
309
334
|
*/
|
|
310
335
|
theme?: ThemeConfig;
|
|
311
336
|
/**
|
|
312
|
-
* Sets the tabIndex attribute on the input
|
|
337
|
+
* Sets the tabIndex attribute on the input for focus. Since focus is already managed, the only acceptable value to be used is '-1' in rare cases when removing this field from the document tab order is required.
|
|
338
|
+
*
|
|
313
339
|
*/
|
|
314
340
|
tabIndex: number;
|
|
315
341
|
/**
|
|
316
342
|
* Select the currently focused option when the user presses tab
|
|
343
|
+
*
|
|
344
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}. Will soon be handled automatically to support expected keyboard accessibility.
|
|
317
345
|
*/
|
|
318
346
|
tabSelectsValue: boolean;
|
|
319
347
|
/**
|
|
@@ -328,13 +356,8 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
328
356
|
* Sets the form attribute on the input
|
|
329
357
|
*/
|
|
330
358
|
form?: string;
|
|
331
|
-
/**
|
|
332
|
-
* Marks the value-holding input as required for form validation
|
|
333
|
-
*/
|
|
334
|
-
required?: boolean;
|
|
335
359
|
}
|
|
336
360
|
export declare const defaultProps: {
|
|
337
|
-
'aria-live': string;
|
|
338
361
|
backspaceRemovesValue: boolean;
|
|
339
362
|
blurInputOnSelect: boolean;
|
|
340
363
|
captureMenuScroll: boolean;
|
|
@@ -413,7 +436,6 @@ interface CategorizedGroup<Option, Group extends GroupBase<Option>> {
|
|
|
413
436
|
type CategorizedGroupOrOption<Option, Group extends GroupBase<Option>> = CategorizedGroup<Option, Group> | CategorizedOption<Option>;
|
|
414
437
|
export default class Select<Option = unknown, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>> extends Component<SelectProps<Option, IsMulti, Group>, State<Option, IsMulti, Group>> {
|
|
415
438
|
static defaultProps: {
|
|
416
|
-
'aria-live': string;
|
|
417
439
|
backspaceRemovesValue: boolean;
|
|
418
440
|
blurInputOnSelect: boolean;
|
|
419
441
|
captureMenuScroll: boolean;
|
|
@@ -544,9 +566,6 @@ export default class Select<Option = unknown, IsMulti extends boolean = false, G
|
|
|
544
566
|
IndicatorsContainer: <Option_6, IsMulti_6 extends boolean, Group_6 extends GroupBase<Option_6>>(props: import(".").IndicatorsContainerProps<Option_6, IsMulti_6, Group_6>) => import("@emotion/react").jsx.JSX.Element;
|
|
545
567
|
IndicatorSeparator: <Option_7, IsMulti_7 extends boolean, Group_7 extends GroupBase<Option_7>>(props: import(".").IndicatorSeparatorProps<Option_7, IsMulti_7, Group_7>) => import("@emotion/react").jsx.JSX.Element;
|
|
546
568
|
Input: <Option_8, IsMulti_8 extends boolean, Group_8 extends GroupBase<Option_8>>(props: import(".").InputProps<Option_8, IsMulti_8, Group_8>) => import("@emotion/react").jsx.JSX.Element;
|
|
547
|
-
/**
|
|
548
|
-
* Sets a className attribute on the outer component
|
|
549
|
-
*/
|
|
550
569
|
LoadingIndicator: <Option_9, IsMulti_9 extends boolean, Group_9 extends GroupBase<Option_9>>({ innerProps, isRtl, size, ...restProps }: import(".").LoadingIndicatorProps<Option_9, IsMulti_9, Group_9>) => import("@emotion/react").jsx.JSX.Element;
|
|
551
570
|
Menu: <Option_10, IsMulti_10 extends boolean, Group_10 extends GroupBase<Option_10>>(props: import("./components/menu").MenuProps<Option_10, IsMulti_10, Group_10>) => import("@emotion/react").jsx.JSX.Element;
|
|
552
571
|
MenuList: <Option_11, IsMulti_11 extends boolean, Group_11 extends GroupBase<Option_11>>(props: import("./components/menu").MenuListProps<Option_11, IsMulti_11, Group_11>) => import("@emotion/react").jsx.JSX.Element;
|
|
@@ -558,7 +577,20 @@ export default class Select<Option = unknown, IsMulti extends boolean = false, G
|
|
|
558
577
|
MultiValueLabel: <Option_16, IsMulti_16 extends boolean, Group_16 extends GroupBase<Option_16>>({ children, innerProps, }: import(".").MultiValueGenericProps<Option_16, IsMulti_16, Group_16>) => import("@emotion/react").jsx.JSX.Element;
|
|
559
578
|
MultiValueRemove: typeof import("./components/multi-value").MultiValueRemove;
|
|
560
579
|
Option: <Option_17, IsMulti_17 extends boolean, Group_17 extends GroupBase<Option_17>>(props: import(".").OptionProps<Option_17, IsMulti_17, Group_17>) => import("@emotion/react").jsx.JSX.Element;
|
|
561
|
-
Placeholder: <Option_18, IsMulti_18 extends boolean, Group_18 extends GroupBase<Option_18>>(props: import(".").PlaceholderProps<Option_18, IsMulti_18, Group_18>) => import("@emotion/react").jsx.JSX.Element;
|
|
580
|
+
Placeholder: <Option_18, IsMulti_18 extends boolean, Group_18 extends GroupBase<Option_18>>(props: import(".").PlaceholderProps<Option_18, IsMulti_18, Group_18>) => import("@emotion/react").jsx.JSX.Element; /**
|
|
581
|
+
* If `true`, close the select menu when the user scrolls the document/body.
|
|
582
|
+
*
|
|
583
|
+
* If a function, takes a standard javascript `ScrollEvent` you return a boolean:
|
|
584
|
+
*
|
|
585
|
+
* `true` => The menu closes
|
|
586
|
+
*
|
|
587
|
+
* `false` => The menu stays open
|
|
588
|
+
*
|
|
589
|
+
* This is useful when you have a scrollable modal and want to portal the menu out,
|
|
590
|
+
* but want to avoid graphical issues.
|
|
591
|
+
*
|
|
592
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
|
|
593
|
+
*/
|
|
562
594
|
SelectContainer: <Option_19, IsMulti_19 extends boolean, Group_19 extends GroupBase<Option_19>>(props: import(".").ContainerProps<Option_19, IsMulti_19, Group_19>) => import("@emotion/react").jsx.JSX.Element;
|
|
563
595
|
SingleValue: <Option_20, IsMulti_20 extends boolean, Group_20 extends GroupBase<Option_20>>(props: import(".").SingleValueProps<Option_20, IsMulti_20, Group_20>) => import("@emotion/react").jsx.JSX.Element;
|
|
564
596
|
ValueContainer: <Option_21, IsMulti_21 extends boolean, Group_21 extends GroupBase<Option_21>>(props: import(".").ValueContainerProps<Option_21, IsMulti_21, Group_21>) => import("@emotion/react").jsx.JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { Component, type FocusEventHandler, type FormEventHandler, type KeyboardEventHandler, type MouseEventHandler, type ReactNode, type RefCallback, type TouchEventHandler } from 'react';
|
|
2
2
|
import { type AriaLiveMessages, type AriaSelection } from './accessibility';
|
|
3
3
|
import { type SelectComponentsConfig } from './components';
|
|
4
4
|
import { type FilterOptionOption } from './filters';
|
|
@@ -12,37 +12,20 @@ export interface FormatOptionLabelMeta<Option> {
|
|
|
12
12
|
selectValue: Options<Option>;
|
|
13
13
|
}
|
|
14
14
|
export interface SelectProps<Option, IsMulti extends boolean, Group extends GroupBase<Option>> {
|
|
15
|
-
/**
|
|
16
|
-
* HTML ID of an element containing an error message related to the input
|
|
17
|
-
*/
|
|
18
|
-
'aria-errormessage'?: AriaAttributes['aria-errormessage'];
|
|
19
|
-
/**
|
|
20
|
-
* Indicate if the value entered in the field is invalid
|
|
21
|
-
*/
|
|
22
|
-
'aria-invalid'?: AriaAttributes['aria-invalid'];
|
|
23
|
-
/**
|
|
24
|
-
* Aria label (for assistive tech)
|
|
25
|
-
*/
|
|
26
|
-
'aria-label'?: AriaAttributes['aria-label'];
|
|
27
|
-
/**
|
|
28
|
-
* HTML ID of an element that should be used as the label (for assistive tech)
|
|
29
|
-
*/
|
|
30
|
-
'aria-labelledby'?: AriaAttributes['aria-labelledby'];
|
|
31
|
-
'aria-describedby'?: AriaAttributes['aria-describedby'];
|
|
32
|
-
/**
|
|
33
|
-
* Used to set the priority with which screen reader should treat updates to live regions. The possible settings are: off, polite (default) or assertive
|
|
34
|
-
*/
|
|
35
|
-
'aria-live'?: AriaAttributes['aria-live'];
|
|
36
15
|
/**
|
|
37
16
|
* Customise the messages used by the aria-live component
|
|
17
|
+
*
|
|
18
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
|
|
38
19
|
*/
|
|
39
20
|
ariaLiveMessages?: AriaLiveMessages<Option, IsMulti, Group>;
|
|
40
21
|
/**
|
|
41
|
-
* Focus the control when it is mounted
|
|
22
|
+
* Focus the control when it is mounted. There are very few cases that this should be used, and using incorrectly may violate accessibility guidelines.
|
|
42
23
|
*/
|
|
43
24
|
autoFocus?: boolean;
|
|
44
25
|
/**
|
|
45
26
|
* Remove the currently focused option when the user presses backspace when Select isClearable or isMulti
|
|
27
|
+
*
|
|
28
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}. Will soon be handled automatically to support expected keyboard accessibility.
|
|
46
29
|
*/
|
|
47
30
|
backspaceRemovesValue: boolean;
|
|
48
31
|
/**
|
|
@@ -51,6 +34,8 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
51
34
|
blurInputOnSelect: boolean;
|
|
52
35
|
/**
|
|
53
36
|
* When the user reaches the top/bottom of the menu, prevent scroll on the scroll-parent
|
|
37
|
+
*
|
|
38
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
|
|
54
39
|
*/
|
|
55
40
|
captureMenuScroll: boolean;
|
|
56
41
|
/**
|
|
@@ -82,6 +67,8 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
82
67
|
*
|
|
83
68
|
* This is useful when you have a scrollable modal and want to portal the menu out,
|
|
84
69
|
* but want to avoid graphical issues.
|
|
70
|
+
*
|
|
71
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
|
|
85
72
|
*/
|
|
86
73
|
closeMenuOnScroll: boolean | ((event: Event) => boolean);
|
|
87
74
|
/**
|
|
@@ -96,14 +83,24 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
96
83
|
components: SelectComponentsConfig<Option, IsMulti, Group>;
|
|
97
84
|
/**
|
|
98
85
|
* Whether the value of the select, e.g. SingleValue, should be displayed in the control.
|
|
86
|
+
*
|
|
87
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
|
|
99
88
|
*/
|
|
100
89
|
controlShouldRenderValue: boolean;
|
|
101
90
|
/**
|
|
102
91
|
* Delimiter used to join multiple values into a single HTML Input value
|
|
92
|
+
*
|
|
93
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
|
|
103
94
|
*/
|
|
104
95
|
delimiter?: string;
|
|
105
96
|
/**
|
|
106
|
-
*
|
|
97
|
+
* This sets the aria-describedby attribute. It sets an accessible description for the select, for people who use assistive technology. Use '<HelperMessage>' from '@atlaskit/form' is preferred.
|
|
98
|
+
*/
|
|
99
|
+
descriptionId?: string;
|
|
100
|
+
/**
|
|
101
|
+
* Clear all values when the user presses escape AND the menu is closed.
|
|
102
|
+
*
|
|
103
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}. Will soon be handled automatically to support expected keyboard accessibility.
|
|
107
104
|
*/
|
|
108
105
|
escapeClearsValue: boolean;
|
|
109
106
|
/**
|
|
@@ -159,6 +156,10 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
159
156
|
* Is the select disabled
|
|
160
157
|
*/
|
|
161
158
|
isDisabled: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Is the select invalid
|
|
161
|
+
*/
|
|
162
|
+
isInvalid?: boolean;
|
|
162
163
|
/**
|
|
163
164
|
* Is the select in a state of loading (async)
|
|
164
165
|
*/
|
|
@@ -177,14 +178,28 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
177
178
|
* Support multiple selected options
|
|
178
179
|
*/
|
|
179
180
|
isMulti: IsMulti;
|
|
181
|
+
/**
|
|
182
|
+
* This prop indicates if the component is required.
|
|
183
|
+
*/
|
|
184
|
+
isRequired?: boolean;
|
|
180
185
|
/**
|
|
181
186
|
* Is the select direction right-to-left
|
|
187
|
+
*
|
|
188
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
|
|
182
189
|
*/
|
|
183
190
|
isRtl: boolean;
|
|
184
191
|
/**
|
|
185
192
|
* Whether to enable search functionality
|
|
186
193
|
*/
|
|
187
194
|
isSearchable: boolean;
|
|
195
|
+
/**
|
|
196
|
+
* This sets the aria-label attribute. It sets an accessible name for the select, for people who use assistive technology. Use of a visible label is highly recommended for greater accessibility support.
|
|
197
|
+
*/
|
|
198
|
+
label?: string;
|
|
199
|
+
/**
|
|
200
|
+
* This sets the aria-labelledby attribute. It sets an accessible name for the select, for people who use assistive technology. Use of a visible label is highly recommended for greater accessibility support.
|
|
201
|
+
*/
|
|
202
|
+
labelId?: string;
|
|
188
203
|
/**
|
|
189
204
|
* Async: Text to display when loading options
|
|
190
205
|
*/
|
|
@@ -220,6 +235,8 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
220
235
|
menuPortalTarget?: HTMLElement | null;
|
|
221
236
|
/**
|
|
222
237
|
* Whether to block scroll events when the menu is open
|
|
238
|
+
*
|
|
239
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
|
|
223
240
|
*/
|
|
224
241
|
menuShouldBlockScroll: boolean;
|
|
225
242
|
/**
|
|
@@ -274,10 +291,14 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
274
291
|
onMenuScrollToBottom?: (event: WheelEvent | TouchEvent) => void;
|
|
275
292
|
/**
|
|
276
293
|
* Allows control of whether the menu is opened when the Select is focused
|
|
294
|
+
*
|
|
295
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}. Will soon be removed to support expected accessibility interactions.
|
|
277
296
|
*/
|
|
278
297
|
openMenuOnFocus: boolean;
|
|
279
298
|
/**
|
|
280
299
|
* Allows control of whether the menu is opened when the Select is clicked
|
|
300
|
+
*
|
|
301
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}. Will soon be removed to support expected accessibility interactions.
|
|
281
302
|
*/
|
|
282
303
|
openMenuOnClick: boolean;
|
|
283
304
|
/**
|
|
@@ -294,6 +315,8 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
294
315
|
placeholder: ReactNode;
|
|
295
316
|
/**
|
|
296
317
|
* Status to relay to screen readers
|
|
318
|
+
*
|
|
319
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
|
|
297
320
|
*/
|
|
298
321
|
screenReaderStatus: (obj: {
|
|
299
322
|
count: number;
|
|
@@ -306,14 +329,19 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
306
329
|
styles: StylesConfig<Option, IsMulti, Group>;
|
|
307
330
|
/**
|
|
308
331
|
* Theme modifier method
|
|
332
|
+
*
|
|
333
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
|
|
309
334
|
*/
|
|
310
335
|
theme?: ThemeConfig;
|
|
311
336
|
/**
|
|
312
|
-
* Sets the tabIndex attribute on the input
|
|
337
|
+
* Sets the tabIndex attribute on the input for focus. Since focus is already managed, the only acceptable value to be used is '-1' in rare cases when removing this field from the document tab order is required.
|
|
338
|
+
*
|
|
313
339
|
*/
|
|
314
340
|
tabIndex: number;
|
|
315
341
|
/**
|
|
316
342
|
* Select the currently focused option when the user presses tab
|
|
343
|
+
*
|
|
344
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}. Will soon be handled automatically to support expected keyboard accessibility.
|
|
317
345
|
*/
|
|
318
346
|
tabSelectsValue: boolean;
|
|
319
347
|
/**
|
|
@@ -328,13 +356,8 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
328
356
|
* Sets the form attribute on the input
|
|
329
357
|
*/
|
|
330
358
|
form?: string;
|
|
331
|
-
/**
|
|
332
|
-
* Marks the value-holding input as required for form validation
|
|
333
|
-
*/
|
|
334
|
-
required?: boolean;
|
|
335
359
|
}
|
|
336
360
|
export declare const defaultProps: {
|
|
337
|
-
'aria-live': string;
|
|
338
361
|
backspaceRemovesValue: boolean;
|
|
339
362
|
blurInputOnSelect: boolean;
|
|
340
363
|
captureMenuScroll: boolean;
|
|
@@ -413,7 +436,6 @@ interface CategorizedGroup<Option, Group extends GroupBase<Option>> {
|
|
|
413
436
|
type CategorizedGroupOrOption<Option, Group extends GroupBase<Option>> = CategorizedGroup<Option, Group> | CategorizedOption<Option>;
|
|
414
437
|
export default class Select<Option = unknown, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>> extends Component<SelectProps<Option, IsMulti, Group>, State<Option, IsMulti, Group>> {
|
|
415
438
|
static defaultProps: {
|
|
416
|
-
'aria-live': string;
|
|
417
439
|
backspaceRemovesValue: boolean;
|
|
418
440
|
blurInputOnSelect: boolean;
|
|
419
441
|
captureMenuScroll: boolean;
|
|
@@ -544,9 +566,6 @@ export default class Select<Option = unknown, IsMulti extends boolean = false, G
|
|
|
544
566
|
IndicatorsContainer: <Option_6, IsMulti_6 extends boolean, Group_6 extends GroupBase<Option_6>>(props: import(".").IndicatorsContainerProps<Option_6, IsMulti_6, Group_6>) => import("@emotion/react").jsx.JSX.Element;
|
|
545
567
|
IndicatorSeparator: <Option_7, IsMulti_7 extends boolean, Group_7 extends GroupBase<Option_7>>(props: import(".").IndicatorSeparatorProps<Option_7, IsMulti_7, Group_7>) => import("@emotion/react").jsx.JSX.Element;
|
|
546
568
|
Input: <Option_8, IsMulti_8 extends boolean, Group_8 extends GroupBase<Option_8>>(props: import(".").InputProps<Option_8, IsMulti_8, Group_8>) => import("@emotion/react").jsx.JSX.Element;
|
|
547
|
-
/**
|
|
548
|
-
* Sets a className attribute on the outer component
|
|
549
|
-
*/
|
|
550
569
|
LoadingIndicator: <Option_9, IsMulti_9 extends boolean, Group_9 extends GroupBase<Option_9>>({ innerProps, isRtl, size, ...restProps }: import(".").LoadingIndicatorProps<Option_9, IsMulti_9, Group_9>) => import("@emotion/react").jsx.JSX.Element;
|
|
551
570
|
Menu: <Option_10, IsMulti_10 extends boolean, Group_10 extends GroupBase<Option_10>>(props: import("./components/menu").MenuProps<Option_10, IsMulti_10, Group_10>) => import("@emotion/react").jsx.JSX.Element;
|
|
552
571
|
MenuList: <Option_11, IsMulti_11 extends boolean, Group_11 extends GroupBase<Option_11>>(props: import("./components/menu").MenuListProps<Option_11, IsMulti_11, Group_11>) => import("@emotion/react").jsx.JSX.Element;
|
|
@@ -558,7 +577,20 @@ export default class Select<Option = unknown, IsMulti extends boolean = false, G
|
|
|
558
577
|
MultiValueLabel: <Option_16, IsMulti_16 extends boolean, Group_16 extends GroupBase<Option_16>>({ children, innerProps, }: import(".").MultiValueGenericProps<Option_16, IsMulti_16, Group_16>) => import("@emotion/react").jsx.JSX.Element;
|
|
559
578
|
MultiValueRemove: typeof import("./components/multi-value").MultiValueRemove;
|
|
560
579
|
Option: <Option_17, IsMulti_17 extends boolean, Group_17 extends GroupBase<Option_17>>(props: import(".").OptionProps<Option_17, IsMulti_17, Group_17>) => import("@emotion/react").jsx.JSX.Element;
|
|
561
|
-
Placeholder: <Option_18, IsMulti_18 extends boolean, Group_18 extends GroupBase<Option_18>>(props: import(".").PlaceholderProps<Option_18, IsMulti_18, Group_18>) => import("@emotion/react").jsx.JSX.Element;
|
|
580
|
+
Placeholder: <Option_18, IsMulti_18 extends boolean, Group_18 extends GroupBase<Option_18>>(props: import(".").PlaceholderProps<Option_18, IsMulti_18, Group_18>) => import("@emotion/react").jsx.JSX.Element; /**
|
|
581
|
+
* If `true`, close the select menu when the user scrolls the document/body.
|
|
582
|
+
*
|
|
583
|
+
* If a function, takes a standard javascript `ScrollEvent` you return a boolean:
|
|
584
|
+
*
|
|
585
|
+
* `true` => The menu closes
|
|
586
|
+
*
|
|
587
|
+
* `false` => The menu stays open
|
|
588
|
+
*
|
|
589
|
+
* This is useful when you have a scrollable modal and want to portal the menu out,
|
|
590
|
+
* but want to avoid graphical issues.
|
|
591
|
+
*
|
|
592
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
|
|
593
|
+
*/
|
|
562
594
|
SelectContainer: <Option_19, IsMulti_19 extends boolean, Group_19 extends GroupBase<Option_19>>(props: import(".").ContainerProps<Option_19, IsMulti_19, Group_19>) => import("@emotion/react").jsx.JSX.Element;
|
|
563
595
|
SingleValue: <Option_20, IsMulti_20 extends boolean, Group_20 extends GroupBase<Option_20>>(props: import(".").SingleValueProps<Option_20, IsMulti_20, Group_20>) => import("@emotion/react").jsx.JSX.Element;
|
|
564
596
|
ValueContainer: <Option_21, IsMulti_21 extends boolean, Group_21 extends GroupBase<Option_21>>(props: import(".").ValueContainerProps<Option_21, IsMulti_21, Group_21>) => import("@emotion/react").jsx.JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/react-select",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "A forked version of react-select to only be used in atlaskit/select",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
".": "./src/index.tsx",
|
|
24
24
|
"./base": "./src/select.tsx",
|
|
25
25
|
"./async": "./src/async.tsx",
|
|
26
|
-
"./creatable": "./src/creatable.tsx"
|
|
26
|
+
"./creatable": "./src/creatable.tsx",
|
|
27
|
+
"./async-creatable": "./src/async-creatable.tsx"
|
|
27
28
|
},
|
|
28
29
|
"dependencies": {
|
|
29
30
|
"@atlaskit/ds-lib": "^2.5.0",
|