@atlaskit/react-select 2.0.7 → 2.2.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 +21 -0
- package/dist/cjs/components/internal/notify-open-layer-observer.js +21 -0
- package/dist/cjs/select.js +22 -9
- package/dist/es2019/components/internal/notify-open-layer-observer.js +16 -0
- package/dist/es2019/select.js +22 -9
- package/dist/esm/components/internal/notify-open-layer-observer.js +15 -0
- package/dist/esm/select.js +22 -9
- package/dist/types/components/internal/notify-open-layer-observer.d.ts +11 -0
- package/dist/types/select.d.ts +8 -4
- package/dist/types-ts4.5/components/internal/notify-open-layer-observer.d.ts +11 -0
- package/dist/types-ts4.5/select.d.ts +8 -4
- package/package.json +8 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/react-select
|
|
2
2
|
|
|
3
|
+
## 2.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#137501](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/137501)
|
|
8
|
+
[`fb85ce5c05391`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/fb85ce5c05391) -
|
|
9
|
+
Testing unsafe experimental options, to be removed at a later time.
|
|
10
|
+
|
|
11
|
+
## 2.1.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#135853](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/135853)
|
|
16
|
+
[`37d9e41733fc5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/37d9e41733fc5) -
|
|
17
|
+
Select components now sync with the experimental open layer observer, using the
|
|
18
|
+
useNotifyOpenLayerObserver hook.
|
|
19
|
+
|
|
20
|
+
This is used to close any open select menus when page layout slots are resized.
|
|
21
|
+
|
|
22
|
+
These changes are behind feature flags.
|
|
23
|
+
|
|
3
24
|
## 2.0.7
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NotifyOpenLayerObserver = NotifyOpenLayerObserver;
|
|
7
|
+
var _openLayerObserver = require("@atlaskit/layering/experimental/open-layer-observer");
|
|
8
|
+
/**
|
|
9
|
+
* Functional component wrapper around `useNotifyOpenLayerObserver`.
|
|
10
|
+
*
|
|
11
|
+
* This is needed as Select is a class component, which cannot use hooks directly.
|
|
12
|
+
*/
|
|
13
|
+
function NotifyOpenLayerObserver(_ref) {
|
|
14
|
+
var isOpen = _ref.isOpen,
|
|
15
|
+
onClose = _ref.onClose;
|
|
16
|
+
(0, _openLayerObserver.useNotifyOpenLayerObserver)({
|
|
17
|
+
isOpen: isOpen,
|
|
18
|
+
onClose: onClose
|
|
19
|
+
});
|
|
20
|
+
return null;
|
|
21
|
+
}
|
package/dist/cjs/select.js
CHANGED
|
@@ -21,6 +21,7 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
|
21
21
|
var _builtins = require("./builtins");
|
|
22
22
|
var _components = require("./components");
|
|
23
23
|
var _internal = require("./components/internal");
|
|
24
|
+
var _notifyOpenLayerObserver = require("./components/internal/notify-open-layer-observer");
|
|
24
25
|
var _liveRegion = _interopRequireDefault(require("./components/live-region"));
|
|
25
26
|
var _menu = require("./components/menu");
|
|
26
27
|
var _filters = require("./filters");
|
|
@@ -79,7 +80,8 @@ var defaultProps = exports.defaultProps = {
|
|
|
79
80
|
},
|
|
80
81
|
styles: {},
|
|
81
82
|
tabIndex: 0,
|
|
82
|
-
tabSelectsValue: true
|
|
83
|
+
tabSelectsValue: true,
|
|
84
|
+
UNSAFE_is_experimental_generic: false
|
|
83
85
|
};
|
|
84
86
|
function toCategorizedOption(props, option, selectValue, index) {
|
|
85
87
|
var isDisabled = _isOptionDisabled(props, option, selectValue);
|
|
@@ -826,6 +828,12 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
826
828
|
}
|
|
827
829
|
event.preventDefault();
|
|
828
830
|
});
|
|
831
|
+
(0, _defineProperty2.default)(_this, "handleOpenLayerObserverCloseSignal", function () {
|
|
832
|
+
if (!(0, _platformFeatureFlags.fg)('platform_dst_layer_observer_select')) {
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
_this.onMenuClose();
|
|
836
|
+
});
|
|
829
837
|
_this.state.instancePrefix = 'react-select-' + (_this.props.instanceId || ++instanceId);
|
|
830
838
|
_this.state.selectValue = (0, _utils.cleanValue)(_props.value);
|
|
831
839
|
// Set focusedOption if menuIsOpen is set on init (e.g. defaultMenuIsOpen)
|
|
@@ -1262,14 +1270,14 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
1262
1270
|
'aria-errormessage': this.props['aria-errormessage'],
|
|
1263
1271
|
'aria-expanded': menuIsOpen,
|
|
1264
1272
|
// TODO: aria-haspopup is implied as listbox with role="combobox" and was deprecated for aria 1.2, we still might need to keep it for back compat
|
|
1265
|
-
'aria-haspopup': 'listbox',
|
|
1273
|
+
'aria-haspopup': this.props['UNSAFE_is_experimental_generic'] ? 'dialog' : 'listbox',
|
|
1266
1274
|
'aria-describedby': this.props['aria-describedby'] || descriptionId,
|
|
1267
1275
|
'aria-invalid': this.props['aria-invalid'] || isInvalid,
|
|
1268
1276
|
'aria-label': this.props['aria-label'] || label,
|
|
1269
1277
|
'aria-labelledby': this.props['aria-labelledby'] || labelId,
|
|
1270
1278
|
'aria-required': required || isRequired,
|
|
1271
1279
|
role: 'combobox',
|
|
1272
|
-
'aria-activedescendant': this.state.focusedOptionId || this.state.focusedValueId || undefined
|
|
1280
|
+
'aria-activedescendant': this.props['UNSAFE_is_experimental_generic'] ? undefined : this.state.focusedOptionId || this.state.focusedValueId || undefined
|
|
1273
1281
|
}, menuIsOpen && {
|
|
1274
1282
|
'aria-controls': this.getElementId('listbox')
|
|
1275
1283
|
}), !isSearchable && {
|
|
@@ -1536,8 +1544,8 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
1536
1544
|
onClick: onSelect,
|
|
1537
1545
|
onMouseMove: onHover,
|
|
1538
1546
|
onMouseOver: onHover,
|
|
1539
|
-
role: 'option',
|
|
1540
|
-
'aria-selected': isSelected,
|
|
1547
|
+
role: _this4.props['UNSAFE_is_experimental_generic'] ? 'listitem' : 'option',
|
|
1548
|
+
'aria-selected': _this4.props['UNSAFE_is_experimental_generic'] ? undefined : isSelected,
|
|
1541
1549
|
// We don't want aria-disabled if it's false. It's just noisy.
|
|
1542
1550
|
'aria-disabled': !isDisabled && (0, _platformFeatureFlags.fg)('design_system_select-a11y-improvement') ? undefined : isDisabled,
|
|
1543
1551
|
'aria-describedby': (0, _platformFeatureFlags.fg)('design_system_select-a11y-improvement') ? headingId : undefined
|
|
@@ -1662,8 +1670,8 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
1662
1670
|
scrollTargetRef(instance);
|
|
1663
1671
|
},
|
|
1664
1672
|
innerProps: _objectSpread(_objectSpread({
|
|
1665
|
-
role: 'listbox',
|
|
1666
|
-
'aria-multiselectable': (_this4.isVoiceOver || !commonProps.isMulti) && (0, _platformFeatureFlags.fg)('design_system_select-a11y-improvement') ? undefined : commonProps.isMulti,
|
|
1673
|
+
role: _this4.props['UNSAFE_is_experimental_generic'] ? 'dialog' : 'listbox',
|
|
1674
|
+
'aria-multiselectable': (_this4.isVoiceOver || !commonProps.isMulti) && (0, _platformFeatureFlags.fg)('design_system_select-a11y-improvement') || _this4.props['UNSAFE_is_experimental_generic'] ? undefined : commonProps.isMulti,
|
|
1667
1675
|
id: _this4.getElementId('listbox')
|
|
1668
1676
|
}, testId && {
|
|
1669
1677
|
'data-testid': "".concat(testId, "-select--listbox")
|
|
@@ -1671,7 +1679,9 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
1671
1679
|
isLoading: isLoading,
|
|
1672
1680
|
maxHeight: maxHeight,
|
|
1673
1681
|
focusedOption: focusedOption
|
|
1674
|
-
}),
|
|
1682
|
+
}), _this4.props['UNSAFE_is_experimental_generic'] ? /*#__PURE__*/_react.default.createElement("div", {
|
|
1683
|
+
role: "list"
|
|
1684
|
+
}, menuUI) : menuUI);
|
|
1675
1685
|
}));
|
|
1676
1686
|
});
|
|
1677
1687
|
|
|
@@ -1831,7 +1841,10 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
1831
1841
|
innerProps: _objectSpread({}, testId && {
|
|
1832
1842
|
'data-testid': "".concat(testId, "-select--indicators-container")
|
|
1833
1843
|
})
|
|
1834
|
-
}), this.renderClearIndicator(), this.renderLoadingIndicator(), this.renderDropdownIndicator())), this.renderMenu(), this.renderFormField()
|
|
1844
|
+
}), this.renderClearIndicator(), this.renderLoadingIndicator(), this.renderDropdownIndicator())), this.renderMenu(), this.renderFormField(), /*#__PURE__*/_react.default.createElement(_notifyOpenLayerObserver.NotifyOpenLayerObserver, {
|
|
1845
|
+
isOpen: (0, _platformFeatureFlags.fg)('platform_dst_layer_observer_select') && this.props.menuIsOpen,
|
|
1846
|
+
onClose: this.handleOpenLayerObserverCloseSignal
|
|
1847
|
+
}));
|
|
1835
1848
|
}
|
|
1836
1849
|
}], [{
|
|
1837
1850
|
key: "getDerivedStateFromProps",
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useNotifyOpenLayerObserver } from '@atlaskit/layering/experimental/open-layer-observer';
|
|
2
|
+
/**
|
|
3
|
+
* Functional component wrapper around `useNotifyOpenLayerObserver`.
|
|
4
|
+
*
|
|
5
|
+
* This is needed as Select is a class component, which cannot use hooks directly.
|
|
6
|
+
*/
|
|
7
|
+
export function NotifyOpenLayerObserver({
|
|
8
|
+
isOpen,
|
|
9
|
+
onClose
|
|
10
|
+
}) {
|
|
11
|
+
useNotifyOpenLayerObserver({
|
|
12
|
+
isOpen,
|
|
13
|
+
onClose
|
|
14
|
+
});
|
|
15
|
+
return null;
|
|
16
|
+
}
|
package/dist/es2019/select.js
CHANGED
|
@@ -7,6 +7,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
7
7
|
import { formatGroupLabel as formatGroupLabelBuiltin, getOptionLabel as getOptionLabelBuiltin, getOptionValue as getOptionValueBuiltin, isOptionDisabled as isOptionDisabledBuiltin } from './builtins';
|
|
8
8
|
import { defaultComponents } from './components';
|
|
9
9
|
import { DummyInput, RequiredInput, ScrollManager } from './components/internal';
|
|
10
|
+
import { NotifyOpenLayerObserver } from './components/internal/notify-open-layer-observer';
|
|
10
11
|
import LiveRegion from './components/live-region';
|
|
11
12
|
import { MenuPlacer } from './components/menu';
|
|
12
13
|
import { createFilter } from './filters';
|
|
@@ -54,7 +55,8 @@ export const defaultProps = {
|
|
|
54
55
|
}) => `${count} result${count !== 1 ? 's' : ''} available`,
|
|
55
56
|
styles: {},
|
|
56
57
|
tabIndex: 0,
|
|
57
|
-
tabSelectsValue: true
|
|
58
|
+
tabSelectsValue: true,
|
|
59
|
+
UNSAFE_is_experimental_generic: false
|
|
58
60
|
};
|
|
59
61
|
function toCategorizedOption(props, option, selectValue, index) {
|
|
60
62
|
const isDisabled = isOptionDisabled(props, option, selectValue);
|
|
@@ -802,6 +804,12 @@ export default class Select extends Component {
|
|
|
802
804
|
}
|
|
803
805
|
event.preventDefault();
|
|
804
806
|
});
|
|
807
|
+
_defineProperty(this, "handleOpenLayerObserverCloseSignal", () => {
|
|
808
|
+
if (!fg('platform_dst_layer_observer_select')) {
|
|
809
|
+
return;
|
|
810
|
+
}
|
|
811
|
+
this.onMenuClose();
|
|
812
|
+
});
|
|
805
813
|
this.state.instancePrefix = 'react-select-' + (this.props.instanceId || ++instanceId);
|
|
806
814
|
this.state.selectValue = cleanValue(_props.value);
|
|
807
815
|
// Set focusedOption if menuIsOpen is set on init (e.g. defaultMenuIsOpen)
|
|
@@ -1272,14 +1280,14 @@ export default class Select extends Component {
|
|
|
1272
1280
|
'aria-errormessage': this.props['aria-errormessage'],
|
|
1273
1281
|
'aria-expanded': menuIsOpen,
|
|
1274
1282
|
// TODO: aria-haspopup is implied as listbox with role="combobox" and was deprecated for aria 1.2, we still might need to keep it for back compat
|
|
1275
|
-
'aria-haspopup': 'listbox',
|
|
1283
|
+
'aria-haspopup': this.props['UNSAFE_is_experimental_generic'] ? 'dialog' : 'listbox',
|
|
1276
1284
|
'aria-describedby': this.props['aria-describedby'] || descriptionId,
|
|
1277
1285
|
'aria-invalid': this.props['aria-invalid'] || isInvalid,
|
|
1278
1286
|
'aria-label': this.props['aria-label'] || label,
|
|
1279
1287
|
'aria-labelledby': this.props['aria-labelledby'] || labelId,
|
|
1280
1288
|
'aria-required': required || isRequired,
|
|
1281
1289
|
role: 'combobox',
|
|
1282
|
-
'aria-activedescendant': this.state.focusedOptionId || this.state.focusedValueId || undefined,
|
|
1290
|
+
'aria-activedescendant': this.props['UNSAFE_is_experimental_generic'] ? undefined : this.state.focusedOptionId || this.state.focusedValueId || undefined,
|
|
1283
1291
|
...(menuIsOpen && {
|
|
1284
1292
|
'aria-controls': this.getElementId('listbox')
|
|
1285
1293
|
}),
|
|
@@ -1565,8 +1573,8 @@ export default class Select extends Component {
|
|
|
1565
1573
|
onClick: onSelect,
|
|
1566
1574
|
onMouseMove: onHover,
|
|
1567
1575
|
onMouseOver: onHover,
|
|
1568
|
-
role: 'option',
|
|
1569
|
-
'aria-selected': isSelected,
|
|
1576
|
+
role: this.props['UNSAFE_is_experimental_generic'] ? 'listitem' : 'option',
|
|
1577
|
+
'aria-selected': this.props['UNSAFE_is_experimental_generic'] ? undefined : isSelected,
|
|
1570
1578
|
// We don't want aria-disabled if it's false. It's just noisy.
|
|
1571
1579
|
'aria-disabled': !isDisabled && fg('design_system_select-a11y-improvement') ? undefined : isDisabled,
|
|
1572
1580
|
'aria-describedby': fg('design_system_select-a11y-improvement') ? headingId : undefined,
|
|
@@ -1696,8 +1704,8 @@ export default class Select extends Component {
|
|
|
1696
1704
|
scrollTargetRef(instance);
|
|
1697
1705
|
},
|
|
1698
1706
|
innerProps: {
|
|
1699
|
-
role: 'listbox',
|
|
1700
|
-
'aria-multiselectable': (this.isVoiceOver || !commonProps.isMulti) && fg('design_system_select-a11y-improvement') ? undefined : commonProps.isMulti,
|
|
1707
|
+
role: this.props['UNSAFE_is_experimental_generic'] ? 'dialog' : 'listbox',
|
|
1708
|
+
'aria-multiselectable': (this.isVoiceOver || !commonProps.isMulti) && fg('design_system_select-a11y-improvement') || this.props['UNSAFE_is_experimental_generic'] ? undefined : commonProps.isMulti,
|
|
1701
1709
|
id: this.getElementId('listbox'),
|
|
1702
1710
|
...(testId && {
|
|
1703
1711
|
'data-testid': `${testId}-select--listbox`
|
|
@@ -1708,7 +1716,9 @@ export default class Select extends Component {
|
|
|
1708
1716
|
isLoading: isLoading,
|
|
1709
1717
|
maxHeight: maxHeight,
|
|
1710
1718
|
focusedOption: focusedOption
|
|
1711
|
-
}),
|
|
1719
|
+
}), this.props['UNSAFE_is_experimental_generic'] ? /*#__PURE__*/React.createElement("div", {
|
|
1720
|
+
role: "list"
|
|
1721
|
+
}, menuUI) : menuUI))));
|
|
1712
1722
|
|
|
1713
1723
|
// positioning behaviour is almost identical for portalled and fixed,
|
|
1714
1724
|
// so we use the same component. the actual portalling logic is forked
|
|
@@ -1867,7 +1877,10 @@ export default class Select extends Component {
|
|
|
1867
1877
|
'data-testid': `${testId}-select--indicators-container`
|
|
1868
1878
|
})
|
|
1869
1879
|
}
|
|
1870
|
-
}), this.renderClearIndicator(), this.renderLoadingIndicator(), this.renderDropdownIndicator())), this.renderMenu(), this.renderFormField()
|
|
1880
|
+
}), this.renderClearIndicator(), this.renderLoadingIndicator(), this.renderDropdownIndicator())), this.renderMenu(), this.renderFormField(), /*#__PURE__*/React.createElement(NotifyOpenLayerObserver, {
|
|
1881
|
+
isOpen: fg('platform_dst_layer_observer_select') && this.props.menuIsOpen,
|
|
1882
|
+
onClose: this.handleOpenLayerObserverCloseSignal
|
|
1883
|
+
}));
|
|
1871
1884
|
}
|
|
1872
1885
|
}
|
|
1873
1886
|
_defineProperty(Select, "defaultProps", defaultProps);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useNotifyOpenLayerObserver } from '@atlaskit/layering/experimental/open-layer-observer';
|
|
2
|
+
/**
|
|
3
|
+
* Functional component wrapper around `useNotifyOpenLayerObserver`.
|
|
4
|
+
*
|
|
5
|
+
* This is needed as Select is a class component, which cannot use hooks directly.
|
|
6
|
+
*/
|
|
7
|
+
export function NotifyOpenLayerObserver(_ref) {
|
|
8
|
+
var isOpen = _ref.isOpen,
|
|
9
|
+
onClose = _ref.onClose;
|
|
10
|
+
useNotifyOpenLayerObserver({
|
|
11
|
+
isOpen: isOpen,
|
|
12
|
+
onClose: onClose
|
|
13
|
+
});
|
|
14
|
+
return null;
|
|
15
|
+
}
|
package/dist/esm/select.js
CHANGED
|
@@ -18,6 +18,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
18
18
|
import { formatGroupLabel as formatGroupLabelBuiltin, getOptionLabel as getOptionLabelBuiltin, getOptionValue as getOptionValueBuiltin, isOptionDisabled as isOptionDisabledBuiltin } from './builtins';
|
|
19
19
|
import { defaultComponents } from './components';
|
|
20
20
|
import { DummyInput, RequiredInput, ScrollManager } from './components/internal';
|
|
21
|
+
import { NotifyOpenLayerObserver } from './components/internal/notify-open-layer-observer';
|
|
21
22
|
import LiveRegion from './components/live-region';
|
|
22
23
|
import { MenuPlacer } from './components/menu';
|
|
23
24
|
import { createFilter } from './filters';
|
|
@@ -70,7 +71,8 @@ export var defaultProps = {
|
|
|
70
71
|
},
|
|
71
72
|
styles: {},
|
|
72
73
|
tabIndex: 0,
|
|
73
|
-
tabSelectsValue: true
|
|
74
|
+
tabSelectsValue: true,
|
|
75
|
+
UNSAFE_is_experimental_generic: false
|
|
74
76
|
};
|
|
75
77
|
function toCategorizedOption(props, option, selectValue, index) {
|
|
76
78
|
var isDisabled = _isOptionDisabled(props, option, selectValue);
|
|
@@ -817,6 +819,12 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
817
819
|
}
|
|
818
820
|
event.preventDefault();
|
|
819
821
|
});
|
|
822
|
+
_defineProperty(_this, "handleOpenLayerObserverCloseSignal", function () {
|
|
823
|
+
if (!fg('platform_dst_layer_observer_select')) {
|
|
824
|
+
return;
|
|
825
|
+
}
|
|
826
|
+
_this.onMenuClose();
|
|
827
|
+
});
|
|
820
828
|
_this.state.instancePrefix = 'react-select-' + (_this.props.instanceId || ++instanceId);
|
|
821
829
|
_this.state.selectValue = cleanValue(_props.value);
|
|
822
830
|
// Set focusedOption if menuIsOpen is set on init (e.g. defaultMenuIsOpen)
|
|
@@ -1253,14 +1261,14 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
1253
1261
|
'aria-errormessage': this.props['aria-errormessage'],
|
|
1254
1262
|
'aria-expanded': menuIsOpen,
|
|
1255
1263
|
// TODO: aria-haspopup is implied as listbox with role="combobox" and was deprecated for aria 1.2, we still might need to keep it for back compat
|
|
1256
|
-
'aria-haspopup': 'listbox',
|
|
1264
|
+
'aria-haspopup': this.props['UNSAFE_is_experimental_generic'] ? 'dialog' : 'listbox',
|
|
1257
1265
|
'aria-describedby': this.props['aria-describedby'] || descriptionId,
|
|
1258
1266
|
'aria-invalid': this.props['aria-invalid'] || isInvalid,
|
|
1259
1267
|
'aria-label': this.props['aria-label'] || label,
|
|
1260
1268
|
'aria-labelledby': this.props['aria-labelledby'] || labelId,
|
|
1261
1269
|
'aria-required': required || isRequired,
|
|
1262
1270
|
role: 'combobox',
|
|
1263
|
-
'aria-activedescendant': this.state.focusedOptionId || this.state.focusedValueId || undefined
|
|
1271
|
+
'aria-activedescendant': this.props['UNSAFE_is_experimental_generic'] ? undefined : this.state.focusedOptionId || this.state.focusedValueId || undefined
|
|
1264
1272
|
}, menuIsOpen && {
|
|
1265
1273
|
'aria-controls': this.getElementId('listbox')
|
|
1266
1274
|
}), !isSearchable && {
|
|
@@ -1527,8 +1535,8 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
1527
1535
|
onClick: onSelect,
|
|
1528
1536
|
onMouseMove: onHover,
|
|
1529
1537
|
onMouseOver: onHover,
|
|
1530
|
-
role: 'option',
|
|
1531
|
-
'aria-selected': isSelected,
|
|
1538
|
+
role: _this4.props['UNSAFE_is_experimental_generic'] ? 'listitem' : 'option',
|
|
1539
|
+
'aria-selected': _this4.props['UNSAFE_is_experimental_generic'] ? undefined : isSelected,
|
|
1532
1540
|
// We don't want aria-disabled if it's false. It's just noisy.
|
|
1533
1541
|
'aria-disabled': !isDisabled && fg('design_system_select-a11y-improvement') ? undefined : isDisabled,
|
|
1534
1542
|
'aria-describedby': fg('design_system_select-a11y-improvement') ? headingId : undefined
|
|
@@ -1653,8 +1661,8 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
1653
1661
|
scrollTargetRef(instance);
|
|
1654
1662
|
},
|
|
1655
1663
|
innerProps: _objectSpread(_objectSpread({
|
|
1656
|
-
role: 'listbox',
|
|
1657
|
-
'aria-multiselectable': (_this4.isVoiceOver || !commonProps.isMulti) && fg('design_system_select-a11y-improvement') ? undefined : commonProps.isMulti,
|
|
1664
|
+
role: _this4.props['UNSAFE_is_experimental_generic'] ? 'dialog' : 'listbox',
|
|
1665
|
+
'aria-multiselectable': (_this4.isVoiceOver || !commonProps.isMulti) && fg('design_system_select-a11y-improvement') || _this4.props['UNSAFE_is_experimental_generic'] ? undefined : commonProps.isMulti,
|
|
1658
1666
|
id: _this4.getElementId('listbox')
|
|
1659
1667
|
}, testId && {
|
|
1660
1668
|
'data-testid': "".concat(testId, "-select--listbox")
|
|
@@ -1662,7 +1670,9 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
1662
1670
|
isLoading: isLoading,
|
|
1663
1671
|
maxHeight: maxHeight,
|
|
1664
1672
|
focusedOption: focusedOption
|
|
1665
|
-
}),
|
|
1673
|
+
}), _this4.props['UNSAFE_is_experimental_generic'] ? /*#__PURE__*/React.createElement("div", {
|
|
1674
|
+
role: "list"
|
|
1675
|
+
}, menuUI) : menuUI);
|
|
1666
1676
|
}));
|
|
1667
1677
|
});
|
|
1668
1678
|
|
|
@@ -1822,7 +1832,10 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
1822
1832
|
innerProps: _objectSpread({}, testId && {
|
|
1823
1833
|
'data-testid': "".concat(testId, "-select--indicators-container")
|
|
1824
1834
|
})
|
|
1825
|
-
}), this.renderClearIndicator(), this.renderLoadingIndicator(), this.renderDropdownIndicator())), this.renderMenu(), this.renderFormField()
|
|
1835
|
+
}), this.renderClearIndicator(), this.renderLoadingIndicator(), this.renderDropdownIndicator())), this.renderMenu(), this.renderFormField(), /*#__PURE__*/React.createElement(NotifyOpenLayerObserver, {
|
|
1836
|
+
isOpen: fg('platform_dst_layer_observer_select') && this.props.menuIsOpen,
|
|
1837
|
+
onClose: this.handleOpenLayerObserverCloseSignal
|
|
1838
|
+
}));
|
|
1826
1839
|
}
|
|
1827
1840
|
}], [{
|
|
1828
1841
|
key: "getDerivedStateFromProps",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type NotifyOpenLayerObserverProps = {
|
|
2
|
+
isOpen: boolean;
|
|
3
|
+
onClose: () => void;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Functional component wrapper around `useNotifyOpenLayerObserver`.
|
|
7
|
+
*
|
|
8
|
+
* This is needed as Select is a class component, which cannot use hooks directly.
|
|
9
|
+
*/
|
|
10
|
+
export declare function NotifyOpenLayerObserver({ isOpen, onClose }: NotifyOpenLayerObserverProps): null;
|
|
11
|
+
export {};
|
package/dist/types/select.d.ts
CHANGED
|
@@ -155,7 +155,7 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
155
155
|
/**
|
|
156
156
|
* Formats group labels in the menu as React components
|
|
157
157
|
*
|
|
158
|
-
* An example can be found in the [Replacing builtins](/advanced#replacing-builtins) documentation.
|
|
158
|
+
* An example can be found in the [Replacing builtins](https://react-select.com/advanced#replacing-builtins) documentation.
|
|
159
159
|
*/
|
|
160
160
|
formatGroupLabel: (group: Group) => ReactNode;
|
|
161
161
|
/**
|
|
@@ -212,7 +212,7 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
212
212
|
/**
|
|
213
213
|
* Override the built-in logic to detect whether an option is disabled
|
|
214
214
|
*
|
|
215
|
-
* An example can be found in the [Replacing builtins](/advanced#replacing-builtins) documentation.
|
|
215
|
+
* An example can be found in the [Replacing builtins](https://react-select.com/advanced#replacing-builtins) documentation.
|
|
216
216
|
*/
|
|
217
217
|
isOptionDisabled: (option: Option, selectValue: Options<Option>) => boolean;
|
|
218
218
|
/**
|
|
@@ -275,7 +275,7 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
275
275
|
/**
|
|
276
276
|
* Whether the menu should use a portal, and where it should attach
|
|
277
277
|
*
|
|
278
|
-
* An example can be found in the [Portaling](/advanced#portaling) documentation
|
|
278
|
+
* An example can be found in the [Portaling](https://react-select.com/advanced#portaling) documentation
|
|
279
279
|
*/
|
|
280
280
|
menuPortalTarget?: HTMLElement | null;
|
|
281
281
|
/**
|
|
@@ -369,7 +369,7 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
369
369
|
/**
|
|
370
370
|
* Style modifier methods
|
|
371
371
|
*
|
|
372
|
-
* A basic example can be found at the bottom of the [Replacing builtins](/advanced#replacing-builtins) documentation.
|
|
372
|
+
* A basic example can be found at the bottom of the [Replacing builtins](https://react-select.com/advanced#replacing-builtins) documentation.
|
|
373
373
|
*/
|
|
374
374
|
styles: StylesConfig<Option, IsMulti, Group>;
|
|
375
375
|
/**
|
|
@@ -424,6 +424,7 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
424
424
|
spacing?: 'compact' | 'default';
|
|
425
425
|
appearance: 'default' | 'subtle' | 'none';
|
|
426
426
|
[key: string]: any;
|
|
427
|
+
UNSAFE_is_experimental_generic?: boolean;
|
|
427
428
|
}
|
|
428
429
|
export declare const defaultProps: {
|
|
429
430
|
'aria-live': string | undefined;
|
|
@@ -466,6 +467,7 @@ export declare const defaultProps: {
|
|
|
466
467
|
styles: {};
|
|
467
468
|
tabIndex: number;
|
|
468
469
|
tabSelectsValue: boolean;
|
|
470
|
+
UNSAFE_is_experimental_generic: boolean;
|
|
469
471
|
};
|
|
470
472
|
interface State<Option, IsMulti extends boolean, Group extends GroupBase<Option>> {
|
|
471
473
|
ariaSelection: AriaSelection<Option, IsMulti> | null;
|
|
@@ -545,6 +547,7 @@ export default class Select<Option = unknown, IsMulti extends boolean = false, G
|
|
|
545
547
|
styles: {};
|
|
546
548
|
tabIndex: number;
|
|
547
549
|
tabSelectsValue: boolean;
|
|
550
|
+
UNSAFE_is_experimental_generic: boolean;
|
|
548
551
|
};
|
|
549
552
|
state: State<Option, IsMulti, Group>;
|
|
550
553
|
blockOptionHover: boolean;
|
|
@@ -694,6 +697,7 @@ export default class Select<Option = unknown, IsMulti extends boolean = false, G
|
|
|
694
697
|
renderFormField(): React.JSX.Element | undefined;
|
|
695
698
|
renderLiveRegion(): React.JSX.Element;
|
|
696
699
|
renderMultiselectMessage(): React.JSX.Element;
|
|
700
|
+
handleOpenLayerObserverCloseSignal: () => void;
|
|
697
701
|
render(): React.JSX.Element;
|
|
698
702
|
}
|
|
699
703
|
export type PublicBaseSelectProps<Option, IsMulti extends boolean, Group extends GroupBase<Option>> = JSX.LibraryManagedAttributes<typeof Select, SelectProps<Option, IsMulti, Group>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type NotifyOpenLayerObserverProps = {
|
|
2
|
+
isOpen: boolean;
|
|
3
|
+
onClose: () => void;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Functional component wrapper around `useNotifyOpenLayerObserver`.
|
|
7
|
+
*
|
|
8
|
+
* This is needed as Select is a class component, which cannot use hooks directly.
|
|
9
|
+
*/
|
|
10
|
+
export declare function NotifyOpenLayerObserver({ isOpen, onClose }: NotifyOpenLayerObserverProps): null;
|
|
11
|
+
export {};
|
|
@@ -155,7 +155,7 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
155
155
|
/**
|
|
156
156
|
* Formats group labels in the menu as React components
|
|
157
157
|
*
|
|
158
|
-
* An example can be found in the [Replacing builtins](/advanced#replacing-builtins) documentation.
|
|
158
|
+
* An example can be found in the [Replacing builtins](https://react-select.com/advanced#replacing-builtins) documentation.
|
|
159
159
|
*/
|
|
160
160
|
formatGroupLabel: (group: Group) => ReactNode;
|
|
161
161
|
/**
|
|
@@ -212,7 +212,7 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
212
212
|
/**
|
|
213
213
|
* Override the built-in logic to detect whether an option is disabled
|
|
214
214
|
*
|
|
215
|
-
* An example can be found in the [Replacing builtins](/advanced#replacing-builtins) documentation.
|
|
215
|
+
* An example can be found in the [Replacing builtins](https://react-select.com/advanced#replacing-builtins) documentation.
|
|
216
216
|
*/
|
|
217
217
|
isOptionDisabled: (option: Option, selectValue: Options<Option>) => boolean;
|
|
218
218
|
/**
|
|
@@ -275,7 +275,7 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
275
275
|
/**
|
|
276
276
|
* Whether the menu should use a portal, and where it should attach
|
|
277
277
|
*
|
|
278
|
-
* An example can be found in the [Portaling](/advanced#portaling) documentation
|
|
278
|
+
* An example can be found in the [Portaling](https://react-select.com/advanced#portaling) documentation
|
|
279
279
|
*/
|
|
280
280
|
menuPortalTarget?: HTMLElement | null;
|
|
281
281
|
/**
|
|
@@ -369,7 +369,7 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
369
369
|
/**
|
|
370
370
|
* Style modifier methods
|
|
371
371
|
*
|
|
372
|
-
* A basic example can be found at the bottom of the [Replacing builtins](/advanced#replacing-builtins) documentation.
|
|
372
|
+
* A basic example can be found at the bottom of the [Replacing builtins](https://react-select.com/advanced#replacing-builtins) documentation.
|
|
373
373
|
*/
|
|
374
374
|
styles: StylesConfig<Option, IsMulti, Group>;
|
|
375
375
|
/**
|
|
@@ -424,6 +424,7 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
|
|
|
424
424
|
spacing?: 'compact' | 'default';
|
|
425
425
|
appearance: 'default' | 'subtle' | 'none';
|
|
426
426
|
[key: string]: any;
|
|
427
|
+
UNSAFE_is_experimental_generic?: boolean;
|
|
427
428
|
}
|
|
428
429
|
export declare const defaultProps: {
|
|
429
430
|
'aria-live': string | undefined;
|
|
@@ -466,6 +467,7 @@ export declare const defaultProps: {
|
|
|
466
467
|
styles: {};
|
|
467
468
|
tabIndex: number;
|
|
468
469
|
tabSelectsValue: boolean;
|
|
470
|
+
UNSAFE_is_experimental_generic: boolean;
|
|
469
471
|
};
|
|
470
472
|
interface State<Option, IsMulti extends boolean, Group extends GroupBase<Option>> {
|
|
471
473
|
ariaSelection: AriaSelection<Option, IsMulti> | null;
|
|
@@ -545,6 +547,7 @@ export default class Select<Option = unknown, IsMulti extends boolean = false, G
|
|
|
545
547
|
styles: {};
|
|
546
548
|
tabIndex: number;
|
|
547
549
|
tabSelectsValue: boolean;
|
|
550
|
+
UNSAFE_is_experimental_generic: boolean;
|
|
548
551
|
};
|
|
549
552
|
state: State<Option, IsMulti, Group>;
|
|
550
553
|
blockOptionHover: boolean;
|
|
@@ -694,6 +697,7 @@ export default class Select<Option = unknown, IsMulti extends boolean = false, G
|
|
|
694
697
|
renderFormField(): React.JSX.Element | undefined;
|
|
695
698
|
renderLiveRegion(): React.JSX.Element;
|
|
696
699
|
renderMultiselectMessage(): React.JSX.Element;
|
|
700
|
+
handleOpenLayerObserverCloseSignal: () => void;
|
|
697
701
|
render(): React.JSX.Element;
|
|
698
702
|
}
|
|
699
703
|
export type PublicBaseSelectProps<Option, IsMulti extends boolean, Group extends GroupBase<Option>> = JSX.LibraryManagedAttributes<typeof Select, SelectProps<Option, IsMulti, Group>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/react-select",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.2.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",
|
|
@@ -30,11 +30,12 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@atlaskit/ds-lib": "^4.0.0",
|
|
33
|
-
"@atlaskit/icon": "^25.
|
|
33
|
+
"@atlaskit/icon": "^25.5.0",
|
|
34
|
+
"@atlaskit/layering": "^2.1.0",
|
|
34
35
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
35
|
-
"@atlaskit/primitives": "^14.
|
|
36
|
+
"@atlaskit/primitives": "^14.4.0",
|
|
36
37
|
"@atlaskit/spinner": "^18.0.0",
|
|
37
|
-
"@atlaskit/tokens": "^4.
|
|
38
|
+
"@atlaskit/tokens": "^4.7.0",
|
|
38
39
|
"@babel/runtime": "^7.0.0",
|
|
39
40
|
"@emotion/react": "^11.7.1",
|
|
40
41
|
"@floating-ui/dom": "^1.0.1",
|
|
@@ -69,6 +70,9 @@
|
|
|
69
70
|
},
|
|
70
71
|
"platform-visual-refresh-icons-legacy-facade": {
|
|
71
72
|
"type": "boolean"
|
|
73
|
+
},
|
|
74
|
+
"platform_dst_layer_observer_select": {
|
|
75
|
+
"type": "boolean"
|
|
72
76
|
}
|
|
73
77
|
},
|
|
74
78
|
"techstack": {
|