@atlaskit/react-select 1.0.0 → 1.0.2

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/react-select
2
2
 
3
+ ## 1.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 1.0.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#140869](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/140869)
14
+ [`f08b672eb884b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f08b672eb884b) -
15
+ Add back removed props as deprecated for easier migration
16
+
3
17
  ## 1.0.0
4
18
 
5
19
  ### Major Changes
@@ -42,6 +42,8 @@ var LiveRegion = function LiveRegion(props) {
42
42
  screenReaderStatus = selectProps.screenReaderStatus,
43
43
  tabSelectsValue = selectProps.tabSelectsValue,
44
44
  isLoading = selectProps.isLoading;
45
+ var ariaLabel = selectProps['aria-label'] || label;
46
+ var ariaLive = selectProps['aria-live'];
45
47
 
46
48
  // Update aria live message configuration when prop changes
47
49
  var messages = (0, _react.useMemo)(function () {
@@ -118,7 +120,7 @@ var LiveRegion = function LiveRegion(props) {
118
120
  if (messages.guidance) {
119
121
  var context = focusedValue ? 'value' : menuIsOpen ? 'menu' : 'input';
120
122
  guidanceMsg = messages.guidance({
121
- 'aria-label': label,
123
+ 'aria-label': ariaLabel,
122
124
  context: context,
123
125
  isDisabled: focusedOption && isOptionDisabled(focusedOption, selectValue),
124
126
  isMulti: isMulti,
@@ -128,7 +130,7 @@ var LiveRegion = function LiveRegion(props) {
128
130
  });
129
131
  }
130
132
  return guidanceMsg;
131
- }, [label, focusedOption, focusedValue, isMulti, isOptionDisabled, isSearchable, menuIsOpen, messages, selectValue, tabSelectsValue, isInitialFocus]);
133
+ }, [ariaLabel, focusedOption, focusedValue, isMulti, isOptionDisabled, isSearchable, menuIsOpen, messages, selectValue, tabSelectsValue, isInitialFocus]);
132
134
  var ScreenReaderText = (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)("span", {
133
135
  id: "aria-selection"
134
136
  }, ariaSelected), (0, _react2.jsx)("span", {
@@ -141,7 +143,7 @@ var LiveRegion = function LiveRegion(props) {
141
143
  return (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_a11yText.default, {
142
144
  id: id
143
145
  }, isInitialFocus && ScreenReaderText), (0, _react2.jsx)(_a11yText.default, {
144
- "aria-live": "polite",
146
+ "aria-live": ariaLive,
145
147
  "aria-atomic": "false",
146
148
  "aria-relevant": "additions text",
147
149
  role: "log"
@@ -33,6 +33,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
33
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',
36
37
  backspaceRemovesValue: true,
37
38
  blurInputOnSelect: (0, _utils.isTouchCapable)(),
38
39
  captureMenuScroll: !(0, _utils.isTouchCapable)(),
@@ -1231,6 +1232,7 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
1231
1232
  label = _this$props8.label,
1232
1233
  labelId = _this$props8.labelId,
1233
1234
  menuIsOpen = _this$props8.menuIsOpen,
1235
+ required = _this$props8.required,
1234
1236
  tabIndex = _this$props8.tabIndex;
1235
1237
  var _this$getComponents = this.getComponents(),
1236
1238
  Input = _this$getComponents.Input;
@@ -1239,17 +1241,19 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
1239
1241
  ariaSelection = _this$state4.ariaSelection;
1240
1242
  var commonProps = this.commonProps;
1241
1243
  var id = inputId || this.getElementId('input');
1244
+ var description = this.props['aria-describedby'] || descriptionId || null;
1242
1245
 
1243
1246
  // aria attributes makes the JSX "noisy", separated for clarity
1244
1247
  var ariaAttributes = _objectSpread(_objectSpread(_objectSpread({
1245
1248
  'aria-autocomplete': 'list',
1249
+ 'aria-errormessage': this.props['aria-errormessage'],
1246
1250
  'aria-expanded': menuIsOpen,
1247
1251
  'aria-haspopup': 'listbox',
1248
- 'aria-describedby': descriptionId,
1249
- 'aria-invalid': isInvalid,
1250
- 'aria-label': label,
1251
- 'aria-labelledby': labelId,
1252
- 'aria-required': isRequired,
1252
+ 'aria-describedby': description,
1253
+ 'aria-invalid': this.props['aria-invalid'] || isInvalid,
1254
+ 'aria-label': this.props['aria-label'] || label,
1255
+ 'aria-labelledby': this.props['aria-labelledby'] || labelId,
1256
+ 'aria-required': required || isRequired,
1253
1257
  role: 'combobox',
1254
1258
  'aria-activedescendant': this.isAppleDevice ? undefined : this.state.focusedOptionId
1255
1259
  }, menuIsOpen && {
@@ -1257,9 +1261,9 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
1257
1261
  }), !isSearchable && {
1258
1262
  'aria-readonly': true
1259
1263
  }), this.hasValue() ? (ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === 'initial-input-focus' && {
1260
- 'aria-describedby': descriptionId ? [descriptionId, this.getElementId('live-region')].join(' ') : this.getElementId('live-region')
1264
+ 'aria-describedby': description ? [description, this.getElementId('live-region')].join(' ') : this.getElementId('live-region')
1261
1265
  } : {
1262
- 'aria-describedby': descriptionId ? [descriptionId, this.getElementId('placeholder')].join(' ') : this.getElementId('placeholder')
1266
+ 'aria-describedby': description ? [description, this.getElementId('placeholder')].join(' ') : this.getElementId('placeholder')
1263
1267
  });
1264
1268
  if (!isSearchable) {
1265
1269
  // use a dummy input to maintain focus/blur functionality
@@ -1631,9 +1635,11 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
1631
1635
  isDisabled = _this$props13.isDisabled,
1632
1636
  isMulti = _this$props13.isMulti,
1633
1637
  isRequired = _this$props13.isRequired,
1638
+ required = _this$props13.required,
1634
1639
  name = _this$props13.name;
1635
1640
  var selectValue = this.state.selectValue;
1636
- if (isRequired && !this.hasValue() && !isDisabled) {
1641
+ var req = required || isRequired || null;
1642
+ if (req && !this.hasValue() && !isDisabled) {
1637
1643
  return /*#__PURE__*/_react.default.createElement(_internal.RequiredInput, {
1638
1644
  name: name,
1639
1645
  onFocus: this.onValueInputFocus
@@ -38,6 +38,8 @@ const LiveRegion = props => {
38
38
  tabSelectsValue,
39
39
  isLoading
40
40
  } = selectProps;
41
+ const ariaLabel = selectProps['aria-label'] || label;
42
+ const ariaLive = selectProps['aria-live'];
41
43
 
42
44
  // Update aria live message configuration when prop changes
43
45
  const messages = useMemo(() => ({
@@ -116,7 +118,7 @@ const LiveRegion = props => {
116
118
  if (messages.guidance) {
117
119
  const context = focusedValue ? 'value' : menuIsOpen ? 'menu' : 'input';
118
120
  guidanceMsg = messages.guidance({
119
- 'aria-label': label,
121
+ 'aria-label': ariaLabel,
120
122
  context,
121
123
  isDisabled: focusedOption && isOptionDisabled(focusedOption, selectValue),
122
124
  isMulti,
@@ -126,7 +128,7 @@ const LiveRegion = props => {
126
128
  });
127
129
  }
128
130
  return guidanceMsg;
129
- }, [label, focusedOption, focusedValue, isMulti, isOptionDisabled, isSearchable, menuIsOpen, messages, selectValue, tabSelectsValue, isInitialFocus]);
131
+ }, [ariaLabel, focusedOption, focusedValue, isMulti, isOptionDisabled, isSearchable, menuIsOpen, messages, selectValue, tabSelectsValue, isInitialFocus]);
130
132
  const ScreenReaderText = jsx(Fragment, null, jsx("span", {
131
133
  id: "aria-selection"
132
134
  }, ariaSelected), jsx("span", {
@@ -139,7 +141,7 @@ const LiveRegion = props => {
139
141
  return jsx(Fragment, null, jsx(A11yText, {
140
142
  id: id
141
143
  }, isInitialFocus && ScreenReaderText), jsx(A11yText, {
142
- "aria-live": "polite",
144
+ "aria-live": ariaLive,
143
145
  "aria-atomic": "false",
144
146
  "aria-relevant": "additions text",
145
147
  role: "log"
@@ -12,6 +12,7 @@ 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',
15
16
  backspaceRemovesValue: true,
16
17
  blurInputOnSelect: isTouchCapable(),
17
18
  captureMenuScroll: !isTouchCapable(),
@@ -1236,6 +1237,7 @@ export default class Select extends Component {
1236
1237
  label,
1237
1238
  labelId,
1238
1239
  menuIsOpen,
1240
+ required,
1239
1241
  tabIndex
1240
1242
  } = this.props;
1241
1243
  const {
@@ -1249,17 +1251,19 @@ export default class Select extends Component {
1249
1251
  commonProps
1250
1252
  } = this;
1251
1253
  const id = inputId || this.getElementId('input');
1254
+ const description = this.props['aria-describedby'] || descriptionId || null;
1252
1255
 
1253
1256
  // aria attributes makes the JSX "noisy", separated for clarity
1254
1257
  const ariaAttributes = {
1255
1258
  'aria-autocomplete': 'list',
1259
+ 'aria-errormessage': this.props['aria-errormessage'],
1256
1260
  'aria-expanded': menuIsOpen,
1257
1261
  'aria-haspopup': 'listbox',
1258
- 'aria-describedby': descriptionId,
1259
- 'aria-invalid': isInvalid,
1260
- 'aria-label': label,
1261
- 'aria-labelledby': labelId,
1262
- 'aria-required': isRequired,
1262
+ 'aria-describedby': description,
1263
+ 'aria-invalid': this.props['aria-invalid'] || isInvalid,
1264
+ 'aria-label': this.props['aria-label'] || label,
1265
+ 'aria-labelledby': this.props['aria-labelledby'] || labelId,
1266
+ 'aria-required': required || isRequired,
1263
1267
  role: 'combobox',
1264
1268
  'aria-activedescendant': this.isAppleDevice ? undefined : this.state.focusedOptionId,
1265
1269
  ...(menuIsOpen && {
@@ -1269,9 +1273,9 @@ export default class Select extends Component {
1269
1273
  'aria-readonly': true
1270
1274
  }),
1271
1275
  ...(this.hasValue() ? (ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === 'initial-input-focus' && {
1272
- 'aria-describedby': descriptionId ? [descriptionId, this.getElementId('live-region')].join(' ') : this.getElementId('live-region')
1276
+ 'aria-describedby': description ? [description, this.getElementId('live-region')].join(' ') : this.getElementId('live-region')
1273
1277
  } : {
1274
- 'aria-describedby': descriptionId ? [descriptionId, this.getElementId('placeholder')].join(' ') : this.getElementId('placeholder')
1278
+ 'aria-describedby': description ? [description, this.getElementId('placeholder')].join(' ') : this.getElementId('placeholder')
1275
1279
  })
1276
1280
  };
1277
1281
  if (!isSearchable) {
@@ -1656,12 +1660,14 @@ export default class Select extends Component {
1656
1660
  isDisabled,
1657
1661
  isMulti,
1658
1662
  isRequired,
1663
+ required,
1659
1664
  name
1660
1665
  } = this.props;
1661
1666
  const {
1662
1667
  selectValue
1663
1668
  } = this.state;
1664
- if (isRequired && !this.hasValue() && !isDisabled) {
1669
+ const req = required || isRequired || null;
1670
+ if (req && !this.hasValue() && !isDisabled) {
1665
1671
  return /*#__PURE__*/React.createElement(RequiredInput, {
1666
1672
  name: name,
1667
1673
  onFocus: this.onValueInputFocus
@@ -37,6 +37,8 @@ var LiveRegion = function LiveRegion(props) {
37
37
  screenReaderStatus = selectProps.screenReaderStatus,
38
38
  tabSelectsValue = selectProps.tabSelectsValue,
39
39
  isLoading = selectProps.isLoading;
40
+ var ariaLabel = selectProps['aria-label'] || label;
41
+ var ariaLive = selectProps['aria-live'];
40
42
 
41
43
  // Update aria live message configuration when prop changes
42
44
  var messages = useMemo(function () {
@@ -113,7 +115,7 @@ var LiveRegion = function LiveRegion(props) {
113
115
  if (messages.guidance) {
114
116
  var context = focusedValue ? 'value' : menuIsOpen ? 'menu' : 'input';
115
117
  guidanceMsg = messages.guidance({
116
- 'aria-label': label,
118
+ 'aria-label': ariaLabel,
117
119
  context: context,
118
120
  isDisabled: focusedOption && isOptionDisabled(focusedOption, selectValue),
119
121
  isMulti: isMulti,
@@ -123,7 +125,7 @@ var LiveRegion = function LiveRegion(props) {
123
125
  });
124
126
  }
125
127
  return guidanceMsg;
126
- }, [label, focusedOption, focusedValue, isMulti, isOptionDisabled, isSearchable, menuIsOpen, messages, selectValue, tabSelectsValue, isInitialFocus]);
128
+ }, [ariaLabel, focusedOption, focusedValue, isMulti, isOptionDisabled, isSearchable, menuIsOpen, messages, selectValue, tabSelectsValue, isInitialFocus]);
127
129
  var ScreenReaderText = jsx(Fragment, null, jsx("span", {
128
130
  id: "aria-selection"
129
131
  }, ariaSelected), jsx("span", {
@@ -136,7 +138,7 @@ var LiveRegion = function LiveRegion(props) {
136
138
  return jsx(Fragment, null, jsx(A11yText, {
137
139
  id: id
138
140
  }, isInitialFocus && ScreenReaderText), jsx(A11yText, {
139
- "aria-live": "polite",
141
+ "aria-live": ariaLive,
140
142
  "aria-atomic": "false",
141
143
  "aria-relevant": "additions text",
142
144
  role: "log"
@@ -23,6 +23,7 @@ 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',
26
27
  backspaceRemovesValue: true,
27
28
  blurInputOnSelect: isTouchCapable(),
28
29
  captureMenuScroll: !isTouchCapable(),
@@ -1221,6 +1222,7 @@ var Select = /*#__PURE__*/function (_Component) {
1221
1222
  label = _this$props8.label,
1222
1223
  labelId = _this$props8.labelId,
1223
1224
  menuIsOpen = _this$props8.menuIsOpen,
1225
+ required = _this$props8.required,
1224
1226
  tabIndex = _this$props8.tabIndex;
1225
1227
  var _this$getComponents = this.getComponents(),
1226
1228
  Input = _this$getComponents.Input;
@@ -1229,17 +1231,19 @@ var Select = /*#__PURE__*/function (_Component) {
1229
1231
  ariaSelection = _this$state4.ariaSelection;
1230
1232
  var commonProps = this.commonProps;
1231
1233
  var id = inputId || this.getElementId('input');
1234
+ var description = this.props['aria-describedby'] || descriptionId || null;
1232
1235
 
1233
1236
  // aria attributes makes the JSX "noisy", separated for clarity
1234
1237
  var ariaAttributes = _objectSpread(_objectSpread(_objectSpread({
1235
1238
  'aria-autocomplete': 'list',
1239
+ 'aria-errormessage': this.props['aria-errormessage'],
1236
1240
  'aria-expanded': menuIsOpen,
1237
1241
  'aria-haspopup': 'listbox',
1238
- 'aria-describedby': descriptionId,
1239
- 'aria-invalid': isInvalid,
1240
- 'aria-label': label,
1241
- 'aria-labelledby': labelId,
1242
- 'aria-required': isRequired,
1242
+ 'aria-describedby': description,
1243
+ 'aria-invalid': this.props['aria-invalid'] || isInvalid,
1244
+ 'aria-label': this.props['aria-label'] || label,
1245
+ 'aria-labelledby': this.props['aria-labelledby'] || labelId,
1246
+ 'aria-required': required || isRequired,
1243
1247
  role: 'combobox',
1244
1248
  'aria-activedescendant': this.isAppleDevice ? undefined : this.state.focusedOptionId
1245
1249
  }, menuIsOpen && {
@@ -1247,9 +1251,9 @@ var Select = /*#__PURE__*/function (_Component) {
1247
1251
  }), !isSearchable && {
1248
1252
  'aria-readonly': true
1249
1253
  }), this.hasValue() ? (ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === 'initial-input-focus' && {
1250
- 'aria-describedby': descriptionId ? [descriptionId, this.getElementId('live-region')].join(' ') : this.getElementId('live-region')
1254
+ 'aria-describedby': description ? [description, this.getElementId('live-region')].join(' ') : this.getElementId('live-region')
1251
1255
  } : {
1252
- 'aria-describedby': descriptionId ? [descriptionId, this.getElementId('placeholder')].join(' ') : this.getElementId('placeholder')
1256
+ 'aria-describedby': description ? [description, this.getElementId('placeholder')].join(' ') : this.getElementId('placeholder')
1253
1257
  });
1254
1258
  if (!isSearchable) {
1255
1259
  // use a dummy input to maintain focus/blur functionality
@@ -1621,9 +1625,11 @@ var Select = /*#__PURE__*/function (_Component) {
1621
1625
  isDisabled = _this$props13.isDisabled,
1622
1626
  isMulti = _this$props13.isMulti,
1623
1627
  isRequired = _this$props13.isRequired,
1628
+ required = _this$props13.required,
1624
1629
  name = _this$props13.name;
1625
1630
  var selectValue = this.state.selectValue;
1626
- if (isRequired && !this.hasValue() && !isDisabled) {
1631
+ var req = required || isRequired || null;
1632
+ if (req && !this.hasValue() && !isDisabled) {
1627
1633
  return /*#__PURE__*/React.createElement(RequiredInput, {
1628
1634
  name: name,
1629
1635
  onFocus: this.onValueInputFocus
@@ -1,4 +1,4 @@
1
- import React, { Component, type FocusEventHandler, type FormEventHandler, type KeyboardEventHandler, type MouseEventHandler, type ReactNode, type RefCallback, type TouchEventHandler } from 'react';
1
+ import React, { type AriaAttributes, 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,6 +12,48 @@ 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
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
19
+ * aria-errormessage is not supported widely by assistive technologies. Do not use!
20
+ */
21
+ 'aria-errormessage'?: AriaAttributes['aria-errormessage'];
22
+ /**
23
+ * Indicate if the value entered in the field is invalid
24
+ *
25
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
26
+ * Use `isInvalid` instead.
27
+ */
28
+ 'aria-invalid'?: AriaAttributes['aria-invalid'];
29
+ /**
30
+ * Aria label (for assistive tech)
31
+ *
32
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
33
+ * Use `label` instead.
34
+ */
35
+ 'aria-label'?: AriaAttributes['aria-label'];
36
+ /**
37
+ * HTML ID of an element that should be used as the label (for assistive tech)
38
+ *
39
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
40
+ * Use `labelId` instead.
41
+ */
42
+ 'aria-labelledby'?: AriaAttributes['aria-labelledby'];
43
+ /**
44
+ * HTML ID of an element that should be used as a description (for assistive tech)
45
+ *
46
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
47
+ * Use `descriptionId` instead.
48
+ */
49
+ 'aria-describedby'?: AriaAttributes['aria-describedby'];
50
+ /**
51
+ * Used to set the priority with which screen reader should treat updates to live regions. The possible settings are: off, polite (default) or assertive
52
+ *
53
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
54
+ * Will be removed in future versions.
55
+ */
56
+ 'aria-live'?: AriaAttributes['aria-live'];
15
57
  /**
16
58
  * Customise the messages used by the aria-live component
17
59
  *
@@ -356,8 +398,16 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
356
398
  * Sets the form attribute on the input
357
399
  */
358
400
  form?: string;
401
+ /**
402
+ * Marks the value-holding input as required for form validation
403
+ *
404
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
405
+ * Use `isRequired` instead.
406
+ */
407
+ required?: boolean;
359
408
  }
360
409
  export declare const defaultProps: {
410
+ 'aria-live': string;
361
411
  backspaceRemovesValue: boolean;
362
412
  blurInputOnSelect: boolean;
363
413
  captureMenuScroll: boolean;
@@ -436,6 +486,7 @@ interface CategorizedGroup<Option, Group extends GroupBase<Option>> {
436
486
  type CategorizedGroupOrOption<Option, Group extends GroupBase<Option>> = CategorizedGroup<Option, Group> | CategorizedOption<Option>;
437
487
  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>> {
438
488
  static defaultProps: {
489
+ 'aria-live': string;
439
490
  backspaceRemovesValue: boolean;
440
491
  blurInputOnSelect: boolean;
441
492
  captureMenuScroll: boolean;
@@ -577,20 +628,7 @@ export default class Select<Option = unknown, IsMulti extends boolean = false, G
577
628
  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;
578
629
  MultiValueRemove: typeof import("./components/multi-value").MultiValueRemove;
579
630
  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;
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
- */
631
+ 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;
594
632
  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;
595
633
  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;
596
634
  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, { Component, type FocusEventHandler, type FormEventHandler, type KeyboardEventHandler, type MouseEventHandler, type ReactNode, type RefCallback, type TouchEventHandler } from 'react';
1
+ import React, { type AriaAttributes, 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,6 +12,48 @@ 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
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
19
+ * aria-errormessage is not supported widely by assistive technologies. Do not use!
20
+ */
21
+ 'aria-errormessage'?: AriaAttributes['aria-errormessage'];
22
+ /**
23
+ * Indicate if the value entered in the field is invalid
24
+ *
25
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
26
+ * Use `isInvalid` instead.
27
+ */
28
+ 'aria-invalid'?: AriaAttributes['aria-invalid'];
29
+ /**
30
+ * Aria label (for assistive tech)
31
+ *
32
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
33
+ * Use `label` instead.
34
+ */
35
+ 'aria-label'?: AriaAttributes['aria-label'];
36
+ /**
37
+ * HTML ID of an element that should be used as the label (for assistive tech)
38
+ *
39
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
40
+ * Use `labelId` instead.
41
+ */
42
+ 'aria-labelledby'?: AriaAttributes['aria-labelledby'];
43
+ /**
44
+ * HTML ID of an element that should be used as a description (for assistive tech)
45
+ *
46
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
47
+ * Use `descriptionId` instead.
48
+ */
49
+ 'aria-describedby'?: AriaAttributes['aria-describedby'];
50
+ /**
51
+ * Used to set the priority with which screen reader should treat updates to live regions. The possible settings are: off, polite (default) or assertive
52
+ *
53
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
54
+ * Will be removed in future versions.
55
+ */
56
+ 'aria-live'?: AriaAttributes['aria-live'];
15
57
  /**
16
58
  * Customise the messages used by the aria-live component
17
59
  *
@@ -356,8 +398,16 @@ export interface SelectProps<Option, IsMulti extends boolean, Group extends Grou
356
398
  * Sets the form attribute on the input
357
399
  */
358
400
  form?: string;
401
+ /**
402
+ * Marks the value-holding input as required for form validation
403
+ *
404
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-14529 Internal documentation for deprecation (no external access)}
405
+ * Use `isRequired` instead.
406
+ */
407
+ required?: boolean;
359
408
  }
360
409
  export declare const defaultProps: {
410
+ 'aria-live': string;
361
411
  backspaceRemovesValue: boolean;
362
412
  blurInputOnSelect: boolean;
363
413
  captureMenuScroll: boolean;
@@ -436,6 +486,7 @@ interface CategorizedGroup<Option, Group extends GroupBase<Option>> {
436
486
  type CategorizedGroupOrOption<Option, Group extends GroupBase<Option>> = CategorizedGroup<Option, Group> | CategorizedOption<Option>;
437
487
  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>> {
438
488
  static defaultProps: {
489
+ 'aria-live': string;
439
490
  backspaceRemovesValue: boolean;
440
491
  blurInputOnSelect: boolean;
441
492
  captureMenuScroll: boolean;
@@ -577,20 +628,7 @@ export default class Select<Option = unknown, IsMulti extends boolean = false, G
577
628
  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;
578
629
  MultiValueRemove: typeof import("./components/multi-value").MultiValueRemove;
579
630
  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;
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
- */
631
+ 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;
594
632
  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;
595
633
  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;
596
634
  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": "1.0.0",
3
+ "version": "1.0.2",
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",
@@ -27,17 +27,17 @@
27
27
  "./async-creatable": "./src/async-creatable.tsx"
28
28
  },
29
29
  "dependencies": {
30
- "@atlaskit/ds-lib": "^2.5.0",
30
+ "@atlaskit/ds-lib": "^3.0.0",
31
31
  "@babel/runtime": "^7.0.0",
32
32
  "@emotion/cache": "^11.10.0",
33
33
  "@emotion/react": "^11.7.1",
34
34
  "@floating-ui/dom": "^1.0.1",
35
35
  "memoize-one": "^6.0.0",
36
- "react-dom": "^16.8.0",
37
36
  "use-isomorphic-layout-effect": "^1.1.2"
38
37
  },
39
38
  "peerDependencies": {
40
- "react": "^16.8.0"
39
+ "react": "^16.8.0 || ^17.0.0 || ^18.2.0",
40
+ "react-dom": "^16.8.0 || ^17.0.0 || ^18.2.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@af/integration-testing": "*",