@atlaskit/select 16.1.0 → 16.1.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.
Files changed (66) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/AsyncCreatableSelect.js +0 -5
  3. package/dist/cjs/AsyncSelect.js +0 -5
  4. package/dist/cjs/CheckboxSelect.js +1 -15
  5. package/dist/cjs/CountrySelect.js +20 -29
  6. package/dist/cjs/CreatableSelect.js +0 -5
  7. package/dist/cjs/PopupSelect/PopupSelect.js +36 -113
  8. package/dist/cjs/PopupSelect/components.js +15 -31
  9. package/dist/cjs/PopupSelect/index.js +0 -2
  10. package/dist/cjs/RadioSelect.js +1 -13
  11. package/dist/cjs/Select.js +1 -8
  12. package/dist/cjs/components/index.js +0 -10
  13. package/dist/cjs/components/indicators.js +1 -13
  14. package/dist/cjs/components/input-options.js +43 -84
  15. package/dist/cjs/createSelect.js +12 -42
  16. package/dist/cjs/data/countries.js +3 -2
  17. package/dist/cjs/entry-points/async-creatable-select.js +0 -2
  18. package/dist/cjs/entry-points/async-select.js +0 -2
  19. package/dist/cjs/entry-points/creatable-select.js +0 -2
  20. package/dist/cjs/entry-points/select.js +0 -4
  21. package/dist/cjs/extract-react-types/ert.js +0 -1
  22. package/dist/cjs/extract-react-types/react-popper-props.js +1 -1
  23. package/dist/cjs/extract-react-types/react-select-async.js +1 -1
  24. package/dist/cjs/extract-react-types/react-select-creatable.js +1 -1
  25. package/dist/cjs/extract-react-types/react-select-props.js +1 -1
  26. package/dist/cjs/index.js +0 -16
  27. package/dist/cjs/styles.js +4 -29
  28. package/dist/cjs/version.json +1 -1
  29. package/dist/es2019/CheckboxSelect.js +2 -3
  30. package/dist/es2019/CountrySelect.js +14 -18
  31. package/dist/es2019/PopupSelect/PopupSelect.js +29 -85
  32. package/dist/es2019/PopupSelect/components.js +6 -6
  33. package/dist/es2019/RadioSelect.js +2 -3
  34. package/dist/es2019/Select.js +1 -1
  35. package/dist/es2019/components/indicators.js +0 -1
  36. package/dist/es2019/components/input-options.js +23 -29
  37. package/dist/es2019/createSelect.js +6 -14
  38. package/dist/es2019/data/countries.js +3 -1
  39. package/dist/es2019/extract-react-types/react-popper-props.js +1 -0
  40. package/dist/es2019/extract-react-types/react-select-async.js +1 -0
  41. package/dist/es2019/extract-react-types/react-select-creatable.js +1 -0
  42. package/dist/es2019/extract-react-types/react-select-props.js +1 -0
  43. package/dist/es2019/index.js +1 -0
  44. package/dist/es2019/styles.js +33 -34
  45. package/dist/es2019/version.json +1 -1
  46. package/dist/esm/CheckboxSelect.js +1 -8
  47. package/dist/esm/CountrySelect.js +20 -24
  48. package/dist/esm/PopupSelect/PopupSelect.js +36 -114
  49. package/dist/esm/PopupSelect/components.js +16 -18
  50. package/dist/esm/RadioSelect.js +1 -7
  51. package/dist/esm/Select.js +1 -1
  52. package/dist/esm/components/index.js +0 -2
  53. package/dist/esm/components/indicators.js +0 -1
  54. package/dist/esm/components/input-options.js +43 -72
  55. package/dist/esm/createSelect.js +12 -30
  56. package/dist/esm/data/countries.js +3 -1
  57. package/dist/esm/extract-react-types/react-popper-props.js +1 -0
  58. package/dist/esm/extract-react-types/react-select-async.js +1 -0
  59. package/dist/esm/extract-react-types/react-select-creatable.js +1 -0
  60. package/dist/esm/extract-react-types/react-select-props.js +1 -0
  61. package/dist/esm/index.js +1 -0
  62. package/dist/esm/styles.js +4 -24
  63. package/dist/esm/version.json +1 -1
  64. package/dist/types/index.d.ts +1 -1
  65. package/package.json +1 -1
  66. package/report.api.md +14 -0
@@ -12,16 +12,17 @@ import { N80 } from '@atlaskit/theme/colors';
12
12
  import { MenuDialog, DummyControl, defaultComponents } from './components';
13
13
  import baseStyles from '../styles';
14
14
  import { bind } from 'bind-event-listener';
15
-
16
15
  /** Are we rendering on the client or server? */
17
- const canUseDOM = () => Boolean(typeof window !== 'undefined' && window.document && window.document.createElement); // ==============================
16
+ const canUseDOM = () => Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
17
+
18
+ // ==============================
18
19
  // Types
19
20
  // ==============================
20
21
 
21
-
22
22
  // ==============================
23
23
  // Class
24
24
  // ==============================
25
+
25
26
  const modifiers = [{
26
27
  name: 'offset',
27
28
  options: {
@@ -41,102 +42,82 @@ const defaultPopperProps = {
41
42
  modifiers,
42
43
  placement: 'bottom-start'
43
44
  };
44
-
45
45
  const isEmpty = obj => Object.keys(obj).length === 0;
46
-
47
46
  export default class PopupSelect extends PureComponent {
48
47
  constructor(...args) {
49
48
  var _this$defaultOpenStat;
50
-
51
49
  super(...args);
52
-
53
50
  _defineProperty(this, "menuRef", null);
54
-
55
51
  _defineProperty(this, "selectRef", null);
56
-
57
52
  _defineProperty(this, "targetRef", null);
58
-
59
53
  _defineProperty(this, "unbindWindowClick", null);
60
-
61
54
  _defineProperty(this, "unbindWindowKeydown", null);
62
-
63
55
  _defineProperty(this, "defaultStyles", mergeStyles(baseStyles(this.props.validationState || (this.props.isInvalid ? 'error' : 'default'), this.props.spacing === 'compact', 'default'), {
64
- groupHeading: provided => ({ ...provided,
56
+ groupHeading: provided => ({
57
+ ...provided,
65
58
  color: `var(--ds-text-subtlest, ${N80})`
66
59
  })
67
60
  }));
68
-
69
61
  _defineProperty(this, "isOpenControlled", this.props.isOpen !== undefined);
70
-
71
62
  _defineProperty(this, "defaultOpenState", this.isOpenControlled ? this.props.isOpen : this.props.defaultIsOpen);
72
-
73
63
  _defineProperty(this, "state", {
74
64
  focusLockEnabled: false,
75
65
  isOpen: (_this$defaultOpenStat = this.defaultOpenState) !== null && _this$defaultOpenStat !== void 0 ? _this$defaultOpenStat : false,
76
66
  mergedComponents: defaultComponents,
77
67
  mergedPopperProps: defaultPopperProps
78
68
  });
79
-
80
69
  _defineProperty(this, "popperWrapperId", `${uid({
81
70
  options: this.props.options
82
71
  })}-popup-select`);
83
-
84
72
  _defineProperty(this, "handleKeyDown", event => {
85
73
  switch (event.key) {
86
74
  case 'Escape':
87
75
  case 'Esc':
88
76
  this.close();
89
77
  break;
90
-
91
78
  default:
92
79
  }
93
-
94
80
  if (this.props.onKeyDown) {
95
81
  /* @ts-ignore - updating type of event React.KeyboardEvent effects the unbindWindowsKeyDown listener. Check if this can be fixed once the component gets refactor to functional */
96
82
  this.props.onKeyDown(event);
97
83
  }
98
84
  });
99
-
100
85
  _defineProperty(this, "handleClick", ({
101
86
  target
102
87
  }) => {
103
88
  const {
104
89
  isOpen
105
- } = this.state; // appease flow
106
-
90
+ } = this.state;
91
+ // appease flow
107
92
  if (!(target instanceof Element)) {
108
93
  return;
109
- } // NOTE: Why not use the <Blanket /> component to close?
94
+ }
95
+
96
+ // NOTE: Why not use the <Blanket /> component to close?
110
97
  // We don't want to interupt the user's flow. Taking this approach allows
111
98
  // user to click "through" to other elements and close the popout.
112
-
113
-
114
99
  if (isOpen && this.menuRef && !this.menuRef.contains(target)) {
115
100
  this.close();
116
- } // open on target click -- we can't trust consumers to spread the onClick
117
- // property to the target
118
-
101
+ }
119
102
 
103
+ // open on target click -- we can't trust consumers to spread the onClick
104
+ // property to the target
120
105
  if (!isOpen && this.targetRef && this.targetRef.contains(target)) {
121
106
  this.open();
122
107
  }
123
108
  });
124
-
125
109
  _defineProperty(this, "handleSelectChange", (value, actionMeta) => {
126
110
  const {
127
111
  closeMenuOnSelect,
128
112
  onChange
129
113
  } = this.props;
130
-
131
114
  if (closeMenuOnSelect && actionMeta.action !== 'clear') {
132
115
  this.close();
133
116
  }
134
-
135
117
  if (onChange) {
136
118
  onChange(value, actionMeta);
137
119
  }
138
120
  });
139
-
140
121
  _defineProperty(this, "handleFirstPopperUpdate", () => {
141
122
  // When the popup opens it's focused into. Since the popup is inside a portal, it's position is
142
123
  // initially set to 0,0 - this causes the window scroll position to jump to the top. To prevent
@@ -145,33 +126,26 @@ export default class PopupSelect extends PureComponent {
145
126
  focusLockEnabled: true
146
127
  });
147
128
  });
148
-
149
129
  _defineProperty(this, "open", options => {
150
130
  const {
151
131
  onOpen
152
132
  } = this.props;
153
-
154
133
  if (!(options !== null && options !== void 0 && options.controlOverride) && this.isOpenControlled) {
155
134
  // Prevent popup opening if it's open state is already being controlled
156
135
  return;
157
136
  }
158
-
159
137
  if (onOpen) {
160
138
  onOpen();
161
139
  }
162
-
163
140
  this.setState({
164
141
  isOpen: true
165
142
  });
166
-
167
143
  if (this.selectRef) {
168
144
  this.selectRef.openMenu('first');
169
145
  }
170
-
171
146
  if (typeof window === 'undefined') {
172
147
  return;
173
148
  }
174
-
175
149
  this.unbindWindowKeydown = bind(window, {
176
150
  type: 'keydown',
177
151
  listener: this.handleKeyDown,
@@ -180,47 +154,37 @@ export default class PopupSelect extends PureComponent {
180
154
  }
181
155
  });
182
156
  });
183
-
184
157
  _defineProperty(this, "close", options => {
185
158
  var _this$unbindWindowKey;
186
-
187
159
  const {
188
160
  onClose
189
161
  } = this.props;
190
-
191
162
  if (!(options !== null && options !== void 0 && options.controlOverride) && this.isOpenControlled) {
192
163
  // Prevent popup closing if it's open state is already being controlled
193
164
  return;
194
165
  }
195
-
196
166
  if (onClose) {
197
167
  onClose();
198
168
  }
199
-
200
169
  this.setState({
201
170
  isOpen: false
202
171
  });
203
172
  this.setState({
204
173
  focusLockEnabled: false
205
174
  });
206
-
207
175
  if (this.targetRef != null) {
208
176
  this.targetRef.focus();
209
177
  }
210
-
211
178
  if (typeof window === 'undefined') {
212
179
  return;
213
180
  }
214
-
215
181
  (_this$unbindWindowKey = this.unbindWindowKeydown) === null || _this$unbindWindowKey === void 0 ? void 0 : _this$unbindWindowKey.call(this);
216
182
  this.unbindWindowKeydown = null;
217
183
  });
218
-
219
184
  _defineProperty(this, "resolveTargetRef", popperRef => ref => {
220
185
  // avoid thrashing fn calls
221
186
  if (!this.targetRef && popperRef && ref) {
222
187
  this.targetRef = ref;
223
-
224
188
  if (typeof popperRef === 'function') {
225
189
  popperRef(ref);
226
190
  } else {
@@ -228,21 +192,17 @@ export default class PopupSelect extends PureComponent {
228
192
  }
229
193
  }
230
194
  });
231
-
232
195
  _defineProperty(this, "resolveMenuRef", popperRef => ref => {
233
196
  this.menuRef = ref;
234
-
235
197
  if (typeof popperRef === 'function') {
236
198
  popperRef(ref);
237
199
  } else {
238
200
  popperRef.current = ref;
239
201
  }
240
202
  });
241
-
242
203
  _defineProperty(this, "getSelectRef", ref => {
243
204
  this.selectRef = ref;
244
205
  });
245
-
246
206
  _defineProperty(this, "getItemCount", () => {
247
207
  const {
248
208
  options
@@ -257,17 +217,15 @@ export default class PopupSelect extends PureComponent {
257
217
  });
258
218
  return count;
259
219
  });
260
-
261
220
  _defineProperty(this, "getMaxHeight", () => {
262
221
  const {
263
222
  maxMenuHeight
264
223
  } = this.props;
265
-
266
224
  if (!this.selectRef) {
267
225
  return maxMenuHeight;
268
- } // subtract the control height to maintain consistency
269
-
226
+ }
270
227
 
228
+ // subtract the control height to maintain consistency
271
229
  const showSearchControl = this.showSearchControl();
272
230
  const {
273
231
  controlRef
@@ -276,7 +234,6 @@ export default class PopupSelect extends PureComponent {
276
234
  const maxHeight = maxMenuHeight - offsetHeight;
277
235
  return maxHeight;
278
236
  });
279
-
280
237
  _defineProperty(this, "showSearchControl", () => {
281
238
  const {
282
239
  searchThreshold,
@@ -284,7 +241,6 @@ export default class PopupSelect extends PureComponent {
284
241
  } = this.props;
285
242
  return isSearchable && this.getItemCount() > searchThreshold;
286
243
  });
287
-
288
244
  _defineProperty(this, "renderSelect", () => {
289
245
  const {
290
246
  footer,
@@ -301,18 +257,16 @@ export default class PopupSelect extends PureComponent {
301
257
  } = this.state;
302
258
  const showSearchControl = this.showSearchControl();
303
259
  const portalDestination = canUseDOM() ? document.body : null;
304
- const components = { ...mergedComponents,
260
+ const components = {
261
+ ...mergedComponents,
305
262
  Control: showSearchControl ? mergedComponents.Control : DummyControl
306
263
  };
307
-
308
264
  if (!portalDestination || !isOpen) {
309
265
  return null;
310
266
  }
311
-
312
267
  const popper = /*#__PURE__*/React.createElement(Popper, _extends({}, mergedPopperProps, {
313
268
  onFirstUpdate: state => {
314
269
  var _mergedPopperProps$on;
315
-
316
270
  this.handleFirstPopperUpdate();
317
271
  (_mergedPopperProps$on = mergedPopperProps.onFirstUpdate) === null || _mergedPopperProps$on === void 0 ? void 0 : _mergedPopperProps$on.call(mergedPopperProps, state);
318
272
  }
@@ -350,39 +304,35 @@ export default class PopupSelect extends PureComponent {
350
304
  return mergedPopperProps.strategy === 'fixed' ? popper : /*#__PURE__*/createPortal(popper, portalDestination);
351
305
  });
352
306
  }
353
-
354
307
  static getDerivedStateFromProps(props, state) {
355
- const newState = {}; // Merge consumer and default popper props
308
+ const newState = {};
356
309
 
357
- const mergedPopperProps = { ...defaultPopperProps,
310
+ // Merge consumer and default popper props
311
+ const mergedPopperProps = {
312
+ ...defaultPopperProps,
358
313
  ...props.popperProps
359
314
  };
360
-
361
315
  if (!shallowEqualObjects(mergedPopperProps, state.mergedPopperProps)) {
362
316
  newState.mergedPopperProps = mergedPopperProps;
363
- } // Merge consumer and default components
364
-
317
+ }
365
318
 
366
- const mergedComponents = { ...defaultComponents,
319
+ // Merge consumer and default components
320
+ const mergedComponents = {
321
+ ...defaultComponents,
367
322
  ...props.components
368
323
  };
369
-
370
324
  if (!shallowEqualObjects(mergedComponents, state.mergedComponents)) {
371
325
  newState.mergedComponents = mergedComponents;
372
326
  }
373
-
374
327
  if (!isEmpty(newState)) {
375
328
  return newState;
376
329
  }
377
-
378
330
  return null;
379
331
  }
380
-
381
332
  componentDidMount() {
382
333
  if (typeof window === 'undefined') {
383
334
  return;
384
335
  }
385
-
386
336
  this.unbindWindowClick = bind(window, {
387
337
  type: 'click',
388
338
  listener: this.handleClick,
@@ -391,25 +341,20 @@ export default class PopupSelect extends PureComponent {
391
341
  }
392
342
  });
393
343
  }
394
-
395
344
  componentWillUnmount() {
396
345
  var _this$unbindWindowCli, _this$unbindWindowKey2;
397
-
398
346
  if (typeof window === 'undefined') {
399
347
  return;
400
348
  }
401
-
402
349
  (_this$unbindWindowCli = this.unbindWindowClick) === null || _this$unbindWindowCli === void 0 ? void 0 : _this$unbindWindowCli.call(this);
403
350
  this.unbindWindowClick = null;
404
351
  (_this$unbindWindowKey2 = this.unbindWindowKeydown) === null || _this$unbindWindowKey2 === void 0 ? void 0 : _this$unbindWindowKey2.call(this);
405
352
  this.unbindWindowKeydown = null;
406
353
  }
407
-
408
354
  componentDidUpdate(prevProps) {
409
355
  const {
410
356
  isOpen
411
357
  } = this.props;
412
-
413
358
  if (prevProps.isOpen !== isOpen) {
414
359
  if (isOpen === true) {
415
360
  this.open({
@@ -421,9 +366,10 @@ export default class PopupSelect extends PureComponent {
421
366
  });
422
367
  }
423
368
  }
424
- } // Event Handlers
425
- // ==============================
369
+ }
426
370
 
371
+ // Event Handlers
372
+ // ==============================
427
373
 
428
374
  render() {
429
375
  const {
@@ -442,9 +388,7 @@ export default class PopupSelect extends PureComponent {
442
388
  'aria-controls': isOpen ? this.popperWrapperId : undefined
443
389
  })), this.renderSelect());
444
390
  }
445
-
446
391
  }
447
-
448
392
  _defineProperty(PopupSelect, "defaultProps", {
449
393
  closeMenuOnSelect: true,
450
394
  components: {},
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
-
3
2
  /** @jsx jsx */
3
+
4
4
  import { components } from 'react-select';
5
5
  import { jsx } from '@emotion/react';
6
6
  import VisuallyHidden from '@atlaskit/visually-hidden';
@@ -24,7 +24,9 @@ export const MenuDialog = ({
24
24
  },
25
25
  style: style,
26
26
  id: id
27
- }, children); // ==============================
27
+ }, children);
28
+
29
+ // ==============================
28
30
  // Custom Components
29
31
  // ==============================
30
32
 
@@ -37,7 +39,6 @@ const DropdownIndicator = () => jsx("div", {
37
39
  }, jsx(SearchIcon, {
38
40
  label: "open"
39
41
  }));
40
-
41
42
  const Control = ({
42
43
  innerRef,
43
44
  innerProps,
@@ -50,16 +51,15 @@ const Control = ({
50
51
  }, jsx(components.Control, _extends({}, props, {
51
52
  innerProps: innerProps
52
53
  })));
54
+ export const DummyControl = props => jsx(VisuallyHidden, null, jsx(components.Control, props));
53
55
 
54
- export const DummyControl = props => jsx(VisuallyHidden, null, jsx(components.Control, props)); // NOTE `props` intentionally omitted from `Fragment`
56
+ // NOTE `props` intentionally omitted from `Fragment`
55
57
  // eslint-disable-next-line
56
-
57
58
  const Menu = ({
58
59
  children,
59
60
  innerProps,
60
61
  ...props
61
62
  }) => jsx("div", innerProps, children);
62
-
63
63
  export const defaultComponents = {
64
64
  Control,
65
65
  DropdownIndicator,
@@ -2,15 +2,14 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
3
  import Select from './Select';
4
4
  import { RadioOption } from './components/input-options';
5
-
6
5
  const RadioSelect = ({
7
6
  components,
8
7
  ...props
9
8
  }) => /*#__PURE__*/React.createElement(Select, _extends({}, props, {
10
9
  isMulti: false,
11
- components: { ...components,
10
+ components: {
11
+ ...components,
12
12
  Option: RadioOption
13
13
  }
14
14
  }));
15
-
16
15
  export default RadioSelect;
@@ -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.1.0";
5
+ const packageVersion = "16.1.2";
6
6
  export const SelectWithoutAnalytics = createSelect(Select);
7
7
  const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
8
8
  export default withAnalyticsContext({
@@ -1,5 +1,4 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
-
3
2
  /** @jsx jsx */
4
3
  import { jsx, css } from '@emotion/react';
5
4
  import { components } from 'react-select';
@@ -1,6 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
-
4
3
  /** @jsx jsx */
5
4
  import { jsx } from '@emotion/react';
6
5
  import { Component } from 'react';
@@ -9,7 +8,6 @@ import CheckboxIcon from '@atlaskit/icon/glyph/checkbox';
9
8
  import { themed } from '@atlaskit/theme/components';
10
9
  import { gridSize } from '@atlaskit/theme/constants';
11
10
  import { B100, B200, B300, B400, B75, DN200, DN10, DN30, N20A, N0, N100, N20, N30, N70 } from '@atlaskit/theme/colors';
12
-
13
11
  const getPrimitiveStyles = props => {
14
12
  const {
15
13
  cx,
@@ -35,7 +33,8 @@ const getPrimitiveStyles = props => {
35
33
  borderLeft: isFocused ? '2px solid transparent' : ''
36
34
  }
37
35
  };
38
- const augmentedStyles = { ...getStyles('option', props),
36
+ const augmentedStyles = {
37
+ ...getStyles('option', props),
39
38
  ...styles
40
39
  };
41
40
  const bemClasses = {
@@ -43,12 +42,13 @@ const getPrimitiveStyles = props => {
43
42
  'option--is-disabled': isDisabled,
44
43
  'option--is-focused': isFocused,
45
44
  'option--is-selected': isSelected
46
- }; // maintain react-select API
45
+ };
47
46
 
47
+ // maintain react-select API
48
48
  return [augmentedStyles, cx(bemClasses, className)];
49
- }; // maintains function shape
50
-
49
+ };
51
50
 
51
+ // maintains function shape
52
52
  const backgroundColor = themed({
53
53
  light: `var(--ds-background-neutral, ${N0})`,
54
54
  dark: `var(--ds-background-neutral, ${DN10})`
@@ -56,7 +56,9 @@ const backgroundColor = themed({
56
56
  const transparent = themed({
57
57
  light: 'transparent',
58
58
  dark: 'transparent'
59
- }); // state of the parent option
59
+ });
60
+
61
+ // state of the parent option
60
62
 
61
63
  // the primary color represents the outer or background element
62
64
  const getPrimaryColor = ({
@@ -67,7 +69,6 @@ const getPrimaryColor = ({
67
69
  ...rest
68
70
  }) => {
69
71
  let color = backgroundColor;
70
-
71
72
  if (isDisabled && isSelected) {
72
73
  color = themed({
73
74
  light: `var(--ds-background-disabled, ${B75})`,
@@ -104,11 +105,10 @@ const getPrimaryColor = ({
104
105
  dark: `var(--ds-background-selected-bold, ${B100})`
105
106
  });
106
107
  }
107
-
108
108
  return color(rest);
109
- }; // the secondary color represents the radio dot or checkmark
110
-
109
+ };
111
110
 
111
+ // the secondary color represents the radio dot or checkmark
112
112
  const getSecondaryColor = ({
113
113
  isActive,
114
114
  isDisabled,
@@ -119,7 +119,6 @@ const getSecondaryColor = ({
119
119
  light: `var(--ds-surface, ${N0})`,
120
120
  dark: `var(--ds-surface, ${DN10})`
121
121
  });
122
-
123
122
  if (isDisabled && isSelected) {
124
123
  color = themed({
125
124
  light: `var(--ds-text-disabled, ${N70})`,
@@ -133,11 +132,10 @@ const getSecondaryColor = ({
133
132
  } else if (!isSelected) {
134
133
  color = transparent;
135
134
  }
136
-
137
135
  return color(rest);
138
- }; // the border color surrounds the checkbox/radio
139
-
136
+ };
140
137
 
138
+ // the border color surrounds the checkbox/radio
141
139
  const getBorderColor = ({
142
140
  isActive,
143
141
  isDisabled,
@@ -160,31 +158,24 @@ const getBorderColor = ({
160
158
  } else if (isSelected) {
161
159
  return `var(--ds-background-selected-bold, ${B400})`;
162
160
  }
163
-
164
161
  return `var(--ds-border-input, ${N100})`;
165
162
  };
166
-
167
163
  class ControlOption extends Component {
168
164
  constructor(...args) {
169
165
  super(...args);
170
-
171
166
  _defineProperty(this, "state", {
172
167
  isActive: false
173
168
  });
174
-
175
169
  _defineProperty(this, "onMouseDown", () => this.setState({
176
170
  isActive: true
177
171
  }));
178
-
179
172
  _defineProperty(this, "onMouseUp", () => this.setState({
180
173
  isActive: false
181
174
  }));
182
-
183
175
  _defineProperty(this, "onMouseLeave", () => this.setState({
184
176
  isActive: false
185
177
  }));
186
178
  }
187
-
188
179
  render() {
189
180
  const {
190
181
  getStyles,
@@ -193,9 +184,11 @@ class ControlOption extends Component {
193
184
  innerProps,
194
185
  innerRef,
195
186
  ...rest
196
- } = this.props; // prop assignment
187
+ } = this.props;
197
188
 
198
- const props = { ...innerProps,
189
+ // prop assignment
190
+ const props = {
191
+ ...innerProps,
199
192
  onMouseDown: this.onMouseDown,
200
193
  onMouseUp: this.onMouseUp,
201
194
  onMouseLeave: this.onMouseLeave
@@ -224,7 +217,8 @@ class ControlOption extends Component {
224
217
  // This is an a11y fix for Select only for now but it may be rolled
225
218
  // into the `@atlaskit/icon` package's Checkbox and Radio SVGs later
226
219
  '& svg rect, & svg circle:first-of-type': {
227
- stroke: getBorderColor({ ...this.props,
220
+ stroke: getBorderColor({
221
+ ...this.props,
228
222
  ...this.state
229
223
  }),
230
224
  strokeWidth: '2px',
@@ -233,10 +227,12 @@ class ControlOption extends Component {
233
227
  }
234
228
  }, !!Icon ? jsx(Icon, {
235
229
  label: "",
236
- primaryColor: getPrimaryColor({ ...this.props,
230
+ primaryColor: getPrimaryColor({
231
+ ...this.props,
237
232
  ...this.state
238
233
  }),
239
- secondaryColor: getSecondaryColor({ ...this.props,
234
+ secondaryColor: getSecondaryColor({
235
+ ...this.props,
240
236
  ...this.state
241
237
  })
242
238
  }) : null), jsx("div", {
@@ -249,9 +245,7 @@ class ControlOption extends Component {
249
245
  }, children))
250
246
  );
251
247
  }
252
-
253
248
  }
254
-
255
249
  export const CheckboxOption = props => jsx(ControlOption, _extends({
256
250
  Icon: CheckboxIcon
257
251
  }, props));