@atlaskit/select 16.6.0 → 16.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/select
2
2
 
3
+ ## 16.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`31496cc7c8a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/31496cc7c8a) - [ux] Adds accessible name to the search input for popup select components via new `label` prop or `placeholder` prop if `label` is not provided.
8
+
3
9
  ## 16.6.0
4
10
 
5
11
  ### Minor Changes
@@ -29,7 +29,7 @@ var _components = require("./components");
29
29
  var _styles = _interopRequireDefault(require("../styles"));
30
30
  var _bindEventListener = require("bind-event-listener");
31
31
  var _memoizeOne = _interopRequireDefault(require("memoize-one"));
32
- var _excluded = ["footer", "maxMenuWidth", "minMenuWidth", "target", "testId"];
32
+ var _excluded = ["footer", "label", "maxMenuWidth", "minMenuWidth", "placeholder", "target", "testId"];
33
33
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
34
34
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
35
35
  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; }
@@ -322,8 +322,10 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
322
322
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderSelect", function () {
323
323
  var _this$props3 = _this.props,
324
324
  footer = _this$props3.footer,
325
+ label = _this$props3.label,
325
326
  maxMenuWidth = _this$props3.maxMenuWidth,
326
327
  minMenuWidth = _this$props3.minMenuWidth,
328
+ placeholder = _this$props3.placeholder,
327
329
  target = _this$props3.target,
328
330
  testId = _this$props3.testId,
329
331
  props = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
@@ -346,6 +348,13 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
346
348
  var selectComponents = (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.popup-select-render-perf_i0s6m') ? _this.getSelectComponents(mergedComponents, showSearchControl) : _objectSpread(_objectSpread({}, mergedComponents), {}, {
347
349
  Control: showSearchControl ? mergedComponents.Control : _components.DummyControl
348
350
  });
351
+ var getLabel = function getLabel() {
352
+ if (label) {
353
+ return label;
354
+ } else if (typeof placeholder === 'string') {
355
+ return placeholder;
356
+ }
357
+ };
349
358
  var popper = /*#__PURE__*/_react.default.createElement(_reactPopper.Popper, (0, _extends2.default)({}, mergedPopperProps, (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.popup-select-render-perf_i0s6m') ? undefined : {
350
359
  onFirstUpdate: function onFirstUpdate(state) {
351
360
  var _mergedPopperProps$on;
@@ -383,11 +392,13 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
383
392
  disabled: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.popup-select-render-perf_i0s6m') ? !readyToRenderSelect : !focusLockEnabled,
384
393
  returnFocus: true
385
394
  }, readyToRenderSelect && /*#__PURE__*/_react.default.createElement(_reactSelect.default, (0, _extends2.default)({
395
+ "aria-label": getLabel(),
386
396
  backspaceRemovesValue: false,
387
397
  controlShouldRenderValue: false,
388
398
  isClearable: false,
389
399
  tabSelectsValue: false,
390
400
  menuIsOpen: true,
401
+ placeholder: placeholder,
391
402
  ref: _this.getSelectRef
392
403
  }, props, {
393
404
  isSearchable: showSearchControl,
@@ -9,7 +9,7 @@ var _reactSelect = _interopRequireDefault(require("react-select"));
9
9
  var _analyticsNext = require("@atlaskit/analytics-next");
10
10
  var _createSelect = _interopRequireDefault(require("./createSelect"));
11
11
  var packageName = "@atlaskit/select";
12
- var packageVersion = "16.6.0";
12
+ var packageVersion = "16.7.0";
13
13
  var SelectWithoutAnalytics = (0, _createSelect.default)(_reactSelect.default);
14
14
  exports.SelectWithoutAnalytics = SelectWithoutAnalytics;
15
15
  var createAndFireEventOnAtlaskit = (0, _analyticsNext.createAndFireEvent)('atlaskit');
@@ -298,8 +298,10 @@ export default class PopupSelect extends PureComponent {
298
298
  _defineProperty(this, "renderSelect", () => {
299
299
  const {
300
300
  footer,
301
+ label,
301
302
  maxMenuWidth,
302
303
  minMenuWidth,
304
+ placeholder,
303
305
  target,
304
306
  testId,
305
307
  ...props
@@ -325,6 +327,13 @@ export default class PopupSelect extends PureComponent {
325
327
  ...mergedComponents,
326
328
  Control: showSearchControl ? mergedComponents.Control : DummyControl
327
329
  };
330
+ const getLabel = () => {
331
+ if (label) {
332
+ return label;
333
+ } else if (typeof placeholder === 'string') {
334
+ return placeholder;
335
+ }
336
+ };
328
337
  const popper = /*#__PURE__*/React.createElement(Popper, _extends({}, mergedPopperProps, getBooleanFF('platform.design-system-team.popup-select-render-perf_i0s6m') ? undefined : {
329
338
  onFirstUpdate: state => {
330
339
  var _mergedPopperProps$on;
@@ -363,11 +372,13 @@ export default class PopupSelect extends PureComponent {
363
372
  disabled: getBooleanFF('platform.design-system-team.popup-select-render-perf_i0s6m') ? !readyToRenderSelect : !focusLockEnabled,
364
373
  returnFocus: true
365
374
  }, readyToRenderSelect && /*#__PURE__*/React.createElement(Select, _extends({
375
+ "aria-label": getLabel(),
366
376
  backspaceRemovesValue: false,
367
377
  controlShouldRenderValue: false,
368
378
  isClearable: false,
369
379
  tabSelectsValue: false,
370
380
  menuIsOpen: true,
381
+ placeholder: placeholder,
371
382
  ref: this.getSelectRef
372
383
  }, props, {
373
384
  isSearchable: showSearchControl,
@@ -2,7 +2,7 @@ import Select from 'react-select';
2
2
  import { withAnalyticsEvents, withAnalyticsContext, createAndFireEvent } from '@atlaskit/analytics-next';
3
3
  import createSelect from './createSelect';
4
4
  const packageName = "@atlaskit/select";
5
- const packageVersion = "16.6.0";
5
+ const packageVersion = "16.7.0";
6
6
  export const SelectWithoutAnalytics = createSelect(Select);
7
7
  const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
8
8
  export default withAnalyticsContext({
@@ -7,7 +7,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
7
7
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
8
8
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
9
9
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
- var _excluded = ["footer", "maxMenuWidth", "minMenuWidth", "target", "testId"];
10
+ var _excluded = ["footer", "label", "maxMenuWidth", "minMenuWidth", "placeholder", "target", "testId"];
11
11
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
12
12
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
13
13
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
@@ -312,8 +312,10 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
312
312
  _defineProperty(_assertThisInitialized(_this), "renderSelect", function () {
313
313
  var _this$props3 = _this.props,
314
314
  footer = _this$props3.footer,
315
+ label = _this$props3.label,
315
316
  maxMenuWidth = _this$props3.maxMenuWidth,
316
317
  minMenuWidth = _this$props3.minMenuWidth,
318
+ placeholder = _this$props3.placeholder,
317
319
  target = _this$props3.target,
318
320
  testId = _this$props3.testId,
319
321
  props = _objectWithoutProperties(_this$props3, _excluded);
@@ -336,6 +338,13 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
336
338
  var selectComponents = getBooleanFF('platform.design-system-team.popup-select-render-perf_i0s6m') ? _this.getSelectComponents(mergedComponents, showSearchControl) : _objectSpread(_objectSpread({}, mergedComponents), {}, {
337
339
  Control: showSearchControl ? mergedComponents.Control : DummyControl
338
340
  });
341
+ var getLabel = function getLabel() {
342
+ if (label) {
343
+ return label;
344
+ } else if (typeof placeholder === 'string') {
345
+ return placeholder;
346
+ }
347
+ };
339
348
  var popper = /*#__PURE__*/React.createElement(Popper, _extends({}, mergedPopperProps, getBooleanFF('platform.design-system-team.popup-select-render-perf_i0s6m') ? undefined : {
340
349
  onFirstUpdate: function onFirstUpdate(state) {
341
350
  var _mergedPopperProps$on;
@@ -373,11 +382,13 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
373
382
  disabled: getBooleanFF('platform.design-system-team.popup-select-render-perf_i0s6m') ? !readyToRenderSelect : !focusLockEnabled,
374
383
  returnFocus: true
375
384
  }, readyToRenderSelect && /*#__PURE__*/React.createElement(Select, _extends({
385
+ "aria-label": getLabel(),
376
386
  backspaceRemovesValue: false,
377
387
  controlShouldRenderValue: false,
378
388
  isClearable: false,
379
389
  tabSelectsValue: false,
380
390
  menuIsOpen: true,
391
+ placeholder: placeholder,
381
392
  ref: _this.getSelectRef
382
393
  }, props, {
383
394
  isSearchable: showSearchControl,
@@ -2,7 +2,7 @@ import Select from 'react-select';
2
2
  import { withAnalyticsEvents, withAnalyticsContext, createAndFireEvent } from '@atlaskit/analytics-next';
3
3
  import createSelect from './createSelect';
4
4
  var packageName = "@atlaskit/select";
5
- var packageVersion = "16.6.0";
5
+ var packageVersion = "16.7.0";
6
6
  export var SelectWithoutAnalytics = createSelect(Select);
7
7
  var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
8
8
  export default withAnalyticsContext({
@@ -75,6 +75,8 @@ export interface PopupSelectProps<Option = OptionType, IsMulti extends boolean =
75
75
  validationState?: ValidationState;
76
76
  /** This prop indicates if the component is in an error state */
77
77
  isInvalid?: boolean;
78
+ /** This gives an accessible name to the input for users of assistive technologies */
79
+ label?: string;
78
80
  testId?: string;
79
81
  }
80
82
  interface State<Modifiers = string> {
@@ -175,7 +177,11 @@ export default class PopupSelect<Option = OptionType, IsMulti extends boolean =
175
177
  multiValue?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").MultiValueProps<Option, IsMulti, GroupBase<Option>>> | undefined;
176
178
  multiValueLabel?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").MultiValueProps<Option, IsMulti, GroupBase<Option>>> | undefined;
177
179
  multiValueRemove?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").MultiValueProps<Option, IsMulti, GroupBase<Option>>> | undefined;
178
- noOptionsMessage?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").NoticeProps<Option, IsMulti, GroupBase<Option>>> | undefined;
180
+ noOptionsMessage?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").NoticeProps<Option, IsMulti, GroupBase<Option>>> | undefined; /**
181
+ * TODO: This type should be cleaned up with `platform.design-system-team.popup-select-render-perf_i0s6m`.
182
+ * - If discarded, revert to `focusLockEnabled: boolean`
183
+ * - If kept, delete this type.
184
+ */
179
185
  option?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").OptionProps<Option, IsMulti, GroupBase<Option>>> | undefined;
180
186
  placeholder?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").PlaceholderProps<Option, IsMulti, GroupBase<Option>>> | undefined;
181
187
  singleValue?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").SingleValueProps<Option, IsMulti, GroupBase<Option>>> | undefined;
@@ -75,6 +75,8 @@ export interface PopupSelectProps<Option = OptionType, IsMulti extends boolean =
75
75
  validationState?: ValidationState;
76
76
  /** This prop indicates if the component is in an error state */
77
77
  isInvalid?: boolean;
78
+ /** This gives an accessible name to the input for users of assistive technologies */
79
+ label?: string;
78
80
  testId?: string;
79
81
  }
80
82
  interface State<Modifiers = string> {
@@ -175,7 +177,11 @@ export default class PopupSelect<Option = OptionType, IsMulti extends boolean =
175
177
  multiValue?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").MultiValueProps<Option, IsMulti, GroupBase<Option>>> | undefined;
176
178
  multiValueLabel?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").MultiValueProps<Option, IsMulti, GroupBase<Option>>> | undefined;
177
179
  multiValueRemove?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").MultiValueProps<Option, IsMulti, GroupBase<Option>>> | undefined;
178
- noOptionsMessage?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").NoticeProps<Option, IsMulti, GroupBase<Option>>> | undefined;
180
+ noOptionsMessage?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").NoticeProps<Option, IsMulti, GroupBase<Option>>> | undefined; /**
181
+ * TODO: This type should be cleaned up with `platform.design-system-team.popup-select-render-perf_i0s6m`.
182
+ * - If discarded, revert to `focusLockEnabled: boolean`
183
+ * - If kept, delete this type.
184
+ */
179
185
  option?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").OptionProps<Option, IsMulti, GroupBase<Option>>> | undefined;
180
186
  placeholder?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").PlaceholderProps<Option, IsMulti, GroupBase<Option>>> | undefined;
181
187
  singleValue?: import("react-select/dist/declarations/src/styles").StylesConfigFunction<import("react-select").SingleValueProps<Option, IsMulti, GroupBase<Option>>> | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/select",
3
- "version": "16.6.0",
3
+ "version": "16.7.0",
4
4
  "description": "Select allows users to make a single selection or multiple selections from a list of options.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
package/report.api.md CHANGED
@@ -1048,6 +1048,11 @@ export class PopupSelect<
1048
1048
  noOptionsMessage?:
1049
1049
  | StylesConfigFunction<NoticeProps<Option, IsMulti, GroupType<Option>>>
1050
1050
  | undefined;
1051
+ /**
1052
+ * TODO: This type should be cleaned up with `platform.design-system-team.popup-select-render-perf_i0s6m`.
1053
+ * - If discarded, revert to `focusLockEnabled: boolean`
1054
+ * - If kept, delete this type.
1055
+ */
1051
1056
  option?:
1052
1057
  | StylesConfigFunction<
1053
1058
  OptionProps_2<Option, IsMulti, GroupType<Option>>
@@ -1158,6 +1163,7 @@ export interface PopupSelectProps<
1158
1163
  // (undocumented)
1159
1164
  isOpen?: boolean;
1160
1165
  isSearchable?: boolean;
1166
+ label?: string;
1161
1167
  maxMenuWidth?: number | string;
1162
1168
  minMenuWidth?: number | string;
1163
1169
  popperProps?: PopperPropsNoChildren<Modifiers>;
@@ -500,7 +500,11 @@ export class PopupSelect<Option = OptionType, IsMulti extends boolean = false, M
500
500
  multiValue?: StylesConfigFunction<MultiValueProps<Option, IsMulti, GroupType<Option>>> | undefined;
501
501
  multiValueLabel?: StylesConfigFunction<MultiValueProps<Option, IsMulti, GroupType<Option>>> | undefined;
502
502
  multiValueRemove?: StylesConfigFunction<MultiValueProps<Option, IsMulti, GroupType<Option>>> | undefined;
503
- noOptionsMessage?: StylesConfigFunction<NoticeProps<Option, IsMulti, GroupType<Option>>> | undefined;
503
+ noOptionsMessage?: StylesConfigFunction<NoticeProps<Option, IsMulti, GroupType<Option>>> | undefined; /**
504
+ * TODO: This type should be cleaned up with `platform.design-system-team.popup-select-render-perf_i0s6m`.
505
+ * - If discarded, revert to `focusLockEnabled: boolean`
506
+ * - If kept, delete this type.
507
+ */
504
508
  option?: StylesConfigFunction<OptionProps_2<Option, IsMulti, GroupType<Option>>> | undefined;
505
509
  placeholder?: StylesConfigFunction<PlaceholderProps_2<Option, IsMulti, GroupType<Option>>> | undefined;
506
510
  singleValue?: StylesConfigFunction<SingleValueProps<Option, IsMulti, GroupType<Option>>> | undefined;
@@ -575,6 +579,7 @@ export interface PopupSelectProps<Option = OptionType, IsMulti extends boolean =
575
579
  // (undocumented)
576
580
  isOpen?: boolean;
577
581
  isSearchable?: boolean;
582
+ label?: string;
578
583
  maxMenuWidth?: number | string;
579
584
  minMenuWidth?: number | string;
580
585
  popperProps?: PopperPropsNoChildren<Modifiers>;