@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.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/AsyncCreatableSelect.js +0 -5
- package/dist/cjs/AsyncSelect.js +0 -5
- package/dist/cjs/CheckboxSelect.js +1 -15
- package/dist/cjs/CountrySelect.js +20 -29
- package/dist/cjs/CreatableSelect.js +0 -5
- package/dist/cjs/PopupSelect/PopupSelect.js +36 -113
- package/dist/cjs/PopupSelect/components.js +15 -31
- package/dist/cjs/PopupSelect/index.js +0 -2
- package/dist/cjs/RadioSelect.js +1 -13
- package/dist/cjs/Select.js +1 -8
- package/dist/cjs/components/index.js +0 -10
- package/dist/cjs/components/indicators.js +1 -13
- package/dist/cjs/components/input-options.js +43 -84
- package/dist/cjs/createSelect.js +12 -42
- package/dist/cjs/data/countries.js +3 -2
- package/dist/cjs/entry-points/async-creatable-select.js +0 -2
- package/dist/cjs/entry-points/async-select.js +0 -2
- package/dist/cjs/entry-points/creatable-select.js +0 -2
- package/dist/cjs/entry-points/select.js +0 -4
- package/dist/cjs/extract-react-types/ert.js +0 -1
- package/dist/cjs/extract-react-types/react-popper-props.js +1 -1
- package/dist/cjs/extract-react-types/react-select-async.js +1 -1
- package/dist/cjs/extract-react-types/react-select-creatable.js +1 -1
- package/dist/cjs/extract-react-types/react-select-props.js +1 -1
- package/dist/cjs/index.js +0 -16
- package/dist/cjs/styles.js +4 -29
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/CheckboxSelect.js +2 -3
- package/dist/es2019/CountrySelect.js +14 -18
- package/dist/es2019/PopupSelect/PopupSelect.js +29 -85
- package/dist/es2019/PopupSelect/components.js +6 -6
- package/dist/es2019/RadioSelect.js +2 -3
- package/dist/es2019/Select.js +1 -1
- package/dist/es2019/components/indicators.js +0 -1
- package/dist/es2019/components/input-options.js +23 -29
- package/dist/es2019/createSelect.js +6 -14
- package/dist/es2019/data/countries.js +3 -1
- package/dist/es2019/extract-react-types/react-popper-props.js +1 -0
- package/dist/es2019/extract-react-types/react-select-async.js +1 -0
- package/dist/es2019/extract-react-types/react-select-creatable.js +1 -0
- package/dist/es2019/extract-react-types/react-select-props.js +1 -0
- package/dist/es2019/index.js +1 -0
- package/dist/es2019/styles.js +33 -34
- package/dist/es2019/version.json +1 -1
- package/dist/esm/CheckboxSelect.js +1 -8
- package/dist/esm/CountrySelect.js +20 -24
- package/dist/esm/PopupSelect/PopupSelect.js +36 -114
- package/dist/esm/PopupSelect/components.js +16 -18
- package/dist/esm/RadioSelect.js +1 -7
- package/dist/esm/Select.js +1 -1
- package/dist/esm/components/index.js +0 -2
- package/dist/esm/components/indicators.js +0 -1
- package/dist/esm/components/input-options.js +43 -72
- package/dist/esm/createSelect.js +12 -30
- package/dist/esm/data/countries.js +3 -1
- package/dist/esm/extract-react-types/react-popper-props.js +1 -0
- package/dist/esm/extract-react-types/react-select-async.js +1 -0
- package/dist/esm/extract-react-types/react-select-creatable.js +1 -0
- package/dist/esm/extract-react-types/react-select-props.js +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/styles.js +4 -24
- package/dist/esm/version.json +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/report.api.md +14 -0
|
@@ -8,15 +8,10 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
8
8
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
10
|
var _excluded = ["footer", "maxMenuWidth", "minMenuWidth", "target"];
|
|
11
|
-
|
|
12
11
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
|
-
|
|
14
12
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
15
|
-
|
|
16
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); }; }
|
|
17
|
-
|
|
18
14
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
19
|
-
|
|
20
15
|
import React, { PureComponent } from 'react';
|
|
21
16
|
import { createPortal } from 'react-dom';
|
|
22
17
|
import FocusLock from 'react-focus-lock';
|
|
@@ -29,18 +24,19 @@ import { N80 } from '@atlaskit/theme/colors';
|
|
|
29
24
|
import { MenuDialog, DummyControl, defaultComponents } from './components';
|
|
30
25
|
import baseStyles from '../styles';
|
|
31
26
|
import { bind } from 'bind-event-listener';
|
|
32
|
-
|
|
33
27
|
/** Are we rendering on the client or server? */
|
|
34
28
|
var canUseDOM = function canUseDOM() {
|
|
35
29
|
return Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
36
|
-
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// ==============================
|
|
37
33
|
// Types
|
|
38
34
|
// ==============================
|
|
39
35
|
|
|
40
|
-
|
|
41
36
|
// ==============================
|
|
42
37
|
// Class
|
|
43
38
|
// ==============================
|
|
39
|
+
|
|
44
40
|
var modifiers = [{
|
|
45
41
|
name: 'offset',
|
|
46
42
|
options: {
|
|
@@ -60,39 +56,25 @@ var defaultPopperProps = {
|
|
|
60
56
|
modifiers: modifiers,
|
|
61
57
|
placement: 'bottom-start'
|
|
62
58
|
};
|
|
63
|
-
|
|
64
59
|
var isEmpty = function isEmpty(obj) {
|
|
65
60
|
return Object.keys(obj).length === 0;
|
|
66
61
|
};
|
|
67
|
-
|
|
68
62
|
var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
69
63
|
_inherits(PopupSelect, _PureComponent);
|
|
70
|
-
|
|
71
64
|
var _super = _createSuper(PopupSelect);
|
|
72
|
-
|
|
73
65
|
function PopupSelect() {
|
|
74
66
|
var _this$defaultOpenStat;
|
|
75
|
-
|
|
76
67
|
var _this;
|
|
77
|
-
|
|
78
68
|
_classCallCheck(this, PopupSelect);
|
|
79
|
-
|
|
80
69
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
81
70
|
args[_key] = arguments[_key];
|
|
82
71
|
}
|
|
83
|
-
|
|
84
72
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
85
|
-
|
|
86
73
|
_defineProperty(_assertThisInitialized(_this), "menuRef", null);
|
|
87
|
-
|
|
88
74
|
_defineProperty(_assertThisInitialized(_this), "selectRef", null);
|
|
89
|
-
|
|
90
75
|
_defineProperty(_assertThisInitialized(_this), "targetRef", null);
|
|
91
|
-
|
|
92
76
|
_defineProperty(_assertThisInitialized(_this), "unbindWindowClick", null);
|
|
93
|
-
|
|
94
77
|
_defineProperty(_assertThisInitialized(_this), "unbindWindowKeydown", null);
|
|
95
|
-
|
|
96
78
|
_defineProperty(_assertThisInitialized(_this), "defaultStyles", mergeStyles(baseStyles(_this.props.validationState || (_this.props.isInvalid ? 'error' : 'default'), _this.props.spacing === 'compact', 'default'), {
|
|
97
79
|
groupHeading: function groupHeading(provided) {
|
|
98
80
|
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
@@ -100,75 +82,62 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
100
82
|
});
|
|
101
83
|
}
|
|
102
84
|
}));
|
|
103
|
-
|
|
104
85
|
_defineProperty(_assertThisInitialized(_this), "isOpenControlled", _this.props.isOpen !== undefined);
|
|
105
|
-
|
|
106
86
|
_defineProperty(_assertThisInitialized(_this), "defaultOpenState", _this.isOpenControlled ? _this.props.isOpen : _this.props.defaultIsOpen);
|
|
107
|
-
|
|
108
87
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
109
88
|
focusLockEnabled: false,
|
|
110
89
|
isOpen: (_this$defaultOpenStat = _this.defaultOpenState) !== null && _this$defaultOpenStat !== void 0 ? _this$defaultOpenStat : false,
|
|
111
90
|
mergedComponents: defaultComponents,
|
|
112
91
|
mergedPopperProps: defaultPopperProps
|
|
113
92
|
});
|
|
114
|
-
|
|
115
93
|
_defineProperty(_assertThisInitialized(_this), "popperWrapperId", "".concat(uid({
|
|
116
94
|
options: _this.props.options
|
|
117
95
|
}), "-popup-select"));
|
|
118
|
-
|
|
119
96
|
_defineProperty(_assertThisInitialized(_this), "handleKeyDown", function (event) {
|
|
120
97
|
switch (event.key) {
|
|
121
98
|
case 'Escape':
|
|
122
99
|
case 'Esc':
|
|
123
100
|
_this.close();
|
|
124
|
-
|
|
125
101
|
break;
|
|
126
|
-
|
|
127
102
|
default:
|
|
128
103
|
}
|
|
129
|
-
|
|
130
104
|
if (_this.props.onKeyDown) {
|
|
131
105
|
/* @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 */
|
|
132
106
|
_this.props.onKeyDown(event);
|
|
133
107
|
}
|
|
134
108
|
});
|
|
135
|
-
|
|
136
109
|
_defineProperty(_assertThisInitialized(_this), "handleClick", function (_ref) {
|
|
137
110
|
var target = _ref.target;
|
|
138
|
-
var isOpen = _this.state.isOpen;
|
|
139
|
-
|
|
111
|
+
var isOpen = _this.state.isOpen;
|
|
112
|
+
// appease flow
|
|
140
113
|
if (!(target instanceof Element)) {
|
|
141
114
|
return;
|
|
142
|
-
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// NOTE: Why not use the <Blanket /> component to close?
|
|
143
118
|
// We don't want to interupt the user's flow. Taking this approach allows
|
|
144
119
|
// user to click "through" to other elements and close the popout.
|
|
145
|
-
|
|
146
|
-
|
|
147
120
|
if (isOpen && _this.menuRef && !_this.menuRef.contains(target)) {
|
|
148
121
|
_this.close();
|
|
149
|
-
}
|
|
150
|
-
// property to the target
|
|
151
|
-
|
|
122
|
+
}
|
|
152
123
|
|
|
124
|
+
// open on target click -- we can't trust consumers to spread the onClick
|
|
125
|
+
// property to the target
|
|
153
126
|
if (!isOpen && _this.targetRef && _this.targetRef.contains(target)) {
|
|
154
127
|
_this.open();
|
|
155
128
|
}
|
|
156
129
|
});
|
|
157
|
-
|
|
158
130
|
_defineProperty(_assertThisInitialized(_this), "handleSelectChange", function (value, actionMeta) {
|
|
159
131
|
var _this$props = _this.props,
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
132
|
+
closeMenuOnSelect = _this$props.closeMenuOnSelect,
|
|
133
|
+
onChange = _this$props.onChange;
|
|
163
134
|
if (closeMenuOnSelect && actionMeta.action !== 'clear') {
|
|
164
135
|
_this.close();
|
|
165
136
|
}
|
|
166
|
-
|
|
167
137
|
if (onChange) {
|
|
168
138
|
onChange(value, actionMeta);
|
|
169
139
|
}
|
|
170
140
|
});
|
|
171
|
-
|
|
172
141
|
_defineProperty(_assertThisInitialized(_this), "handleFirstPopperUpdate", function () {
|
|
173
142
|
// When the popup opens it's focused into. Since the popup is inside a portal, it's position is
|
|
174
143
|
// initially set to 0,0 - this causes the window scroll position to jump to the top. To prevent
|
|
@@ -177,31 +146,24 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
177
146
|
focusLockEnabled: true
|
|
178
147
|
});
|
|
179
148
|
});
|
|
180
|
-
|
|
181
149
|
_defineProperty(_assertThisInitialized(_this), "open", function (options) {
|
|
182
150
|
var onOpen = _this.props.onOpen;
|
|
183
|
-
|
|
184
151
|
if (!(options !== null && options !== void 0 && options.controlOverride) && _this.isOpenControlled) {
|
|
185
152
|
// Prevent popup opening if it's open state is already being controlled
|
|
186
153
|
return;
|
|
187
154
|
}
|
|
188
|
-
|
|
189
155
|
if (onOpen) {
|
|
190
156
|
onOpen();
|
|
191
157
|
}
|
|
192
|
-
|
|
193
158
|
_this.setState({
|
|
194
159
|
isOpen: true
|
|
195
160
|
});
|
|
196
|
-
|
|
197
161
|
if (_this.selectRef) {
|
|
198
162
|
_this.selectRef.openMenu('first');
|
|
199
163
|
}
|
|
200
|
-
|
|
201
164
|
if (typeof window === 'undefined') {
|
|
202
165
|
return;
|
|
203
166
|
}
|
|
204
|
-
|
|
205
167
|
_this.unbindWindowKeydown = bind(window, {
|
|
206
168
|
type: 'keydown',
|
|
207
169
|
listener: _this.handleKeyDown,
|
|
@@ -210,47 +172,36 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
210
172
|
}
|
|
211
173
|
});
|
|
212
174
|
});
|
|
213
|
-
|
|
214
175
|
_defineProperty(_assertThisInitialized(_this), "close", function (options) {
|
|
215
176
|
var _this$unbindWindowKey, _this2;
|
|
216
|
-
|
|
217
177
|
var onClose = _this.props.onClose;
|
|
218
|
-
|
|
219
178
|
if (!(options !== null && options !== void 0 && options.controlOverride) && _this.isOpenControlled) {
|
|
220
179
|
// Prevent popup closing if it's open state is already being controlled
|
|
221
180
|
return;
|
|
222
181
|
}
|
|
223
|
-
|
|
224
182
|
if (onClose) {
|
|
225
183
|
onClose();
|
|
226
184
|
}
|
|
227
|
-
|
|
228
185
|
_this.setState({
|
|
229
186
|
isOpen: false
|
|
230
187
|
});
|
|
231
|
-
|
|
232
188
|
_this.setState({
|
|
233
189
|
focusLockEnabled: false
|
|
234
190
|
});
|
|
235
|
-
|
|
236
191
|
if (_this.targetRef != null) {
|
|
237
192
|
_this.targetRef.focus();
|
|
238
193
|
}
|
|
239
|
-
|
|
240
194
|
if (typeof window === 'undefined') {
|
|
241
195
|
return;
|
|
242
196
|
}
|
|
243
|
-
|
|
244
197
|
(_this$unbindWindowKey = (_this2 = _this).unbindWindowKeydown) === null || _this$unbindWindowKey === void 0 ? void 0 : _this$unbindWindowKey.call(_this2);
|
|
245
198
|
_this.unbindWindowKeydown = null;
|
|
246
199
|
});
|
|
247
|
-
|
|
248
200
|
_defineProperty(_assertThisInitialized(_this), "resolveTargetRef", function (popperRef) {
|
|
249
201
|
return function (ref) {
|
|
250
202
|
// avoid thrashing fn calls
|
|
251
203
|
if (!_this.targetRef && popperRef && ref) {
|
|
252
204
|
_this.targetRef = ref;
|
|
253
|
-
|
|
254
205
|
if (typeof popperRef === 'function') {
|
|
255
206
|
popperRef(ref);
|
|
256
207
|
} else {
|
|
@@ -259,11 +210,9 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
259
210
|
}
|
|
260
211
|
};
|
|
261
212
|
});
|
|
262
|
-
|
|
263
213
|
_defineProperty(_assertThisInitialized(_this), "resolveMenuRef", function (popperRef) {
|
|
264
214
|
return function (ref) {
|
|
265
215
|
_this.menuRef = ref;
|
|
266
|
-
|
|
267
216
|
if (typeof popperRef === 'function') {
|
|
268
217
|
popperRef(ref);
|
|
269
218
|
} else {
|
|
@@ -271,11 +220,9 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
271
220
|
}
|
|
272
221
|
};
|
|
273
222
|
});
|
|
274
|
-
|
|
275
223
|
_defineProperty(_assertThisInitialized(_this), "getSelectRef", function (ref) {
|
|
276
224
|
_this.selectRef = ref;
|
|
277
225
|
});
|
|
278
|
-
|
|
279
226
|
_defineProperty(_assertThisInitialized(_this), "getItemCount", function () {
|
|
280
227
|
var options = _this.props.options;
|
|
281
228
|
var count = 0;
|
|
@@ -290,68 +237,55 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
290
237
|
});
|
|
291
238
|
return count;
|
|
292
239
|
});
|
|
293
|
-
|
|
294
240
|
_defineProperty(_assertThisInitialized(_this), "getMaxHeight", function () {
|
|
295
241
|
var maxMenuHeight = _this.props.maxMenuHeight;
|
|
296
|
-
|
|
297
242
|
if (!_this.selectRef) {
|
|
298
243
|
return maxMenuHeight;
|
|
299
|
-
}
|
|
300
|
-
|
|
244
|
+
}
|
|
301
245
|
|
|
246
|
+
// subtract the control height to maintain consistency
|
|
302
247
|
var showSearchControl = _this.showSearchControl();
|
|
303
|
-
|
|
304
248
|
var controlRef = _this.selectRef.controlRef;
|
|
305
249
|
var offsetHeight = showSearchControl && controlRef ? controlRef.offsetHeight : 0;
|
|
306
250
|
var maxHeight = maxMenuHeight - offsetHeight;
|
|
307
251
|
return maxHeight;
|
|
308
252
|
});
|
|
309
|
-
|
|
310
253
|
_defineProperty(_assertThisInitialized(_this), "showSearchControl", function () {
|
|
311
254
|
var _this$props2 = _this.props,
|
|
312
|
-
|
|
313
|
-
|
|
255
|
+
searchThreshold = _this$props2.searchThreshold,
|
|
256
|
+
isSearchable = _this$props2.isSearchable;
|
|
314
257
|
return isSearchable && _this.getItemCount() > searchThreshold;
|
|
315
258
|
});
|
|
316
|
-
|
|
317
259
|
_defineProperty(_assertThisInitialized(_this), "renderSelect", function () {
|
|
318
260
|
var _this$props3 = _this.props,
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
261
|
+
footer = _this$props3.footer,
|
|
262
|
+
maxMenuWidth = _this$props3.maxMenuWidth,
|
|
263
|
+
minMenuWidth = _this$props3.minMenuWidth,
|
|
264
|
+
target = _this$props3.target,
|
|
265
|
+
props = _objectWithoutProperties(_this$props3, _excluded);
|
|
325
266
|
var _this$state = _this.state,
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
267
|
+
focusLockEnabled = _this$state.focusLockEnabled,
|
|
268
|
+
isOpen = _this$state.isOpen,
|
|
269
|
+
mergedComponents = _this$state.mergedComponents,
|
|
270
|
+
mergedPopperProps = _this$state.mergedPopperProps;
|
|
331
271
|
var showSearchControl = _this.showSearchControl();
|
|
332
|
-
|
|
333
272
|
var portalDestination = canUseDOM() ? document.body : null;
|
|
334
|
-
|
|
335
273
|
var components = _objectSpread(_objectSpread({}, mergedComponents), {}, {
|
|
336
274
|
Control: showSearchControl ? mergedComponents.Control : DummyControl
|
|
337
275
|
});
|
|
338
|
-
|
|
339
276
|
if (!portalDestination || !isOpen) {
|
|
340
277
|
return null;
|
|
341
278
|
}
|
|
342
|
-
|
|
343
279
|
var popper = /*#__PURE__*/React.createElement(Popper, _extends({}, mergedPopperProps, {
|
|
344
280
|
onFirstUpdate: function onFirstUpdate(state) {
|
|
345
281
|
var _mergedPopperProps$on;
|
|
346
|
-
|
|
347
282
|
_this.handleFirstPopperUpdate();
|
|
348
|
-
|
|
349
283
|
(_mergedPopperProps$on = mergedPopperProps.onFirstUpdate) === null || _mergedPopperProps$on === void 0 ? void 0 : _mergedPopperProps$on.call(mergedPopperProps, state);
|
|
350
284
|
}
|
|
351
285
|
}), function (_ref2) {
|
|
352
286
|
var placement = _ref2.placement,
|
|
353
|
-
|
|
354
|
-
|
|
287
|
+
ref = _ref2.ref,
|
|
288
|
+
style = _ref2.style;
|
|
355
289
|
return /*#__PURE__*/React.createElement(NodeResolver, {
|
|
356
290
|
innerRef: _this.resolveMenuRef(ref)
|
|
357
291
|
}, /*#__PURE__*/React.createElement(MenuDialog, {
|
|
@@ -380,17 +314,14 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
380
314
|
});
|
|
381
315
|
return mergedPopperProps.strategy === 'fixed' ? popper : /*#__PURE__*/createPortal(popper, portalDestination);
|
|
382
316
|
});
|
|
383
|
-
|
|
384
317
|
return _this;
|
|
385
318
|
}
|
|
386
|
-
|
|
387
319
|
_createClass(PopupSelect, [{
|
|
388
320
|
key: "componentDidMount",
|
|
389
321
|
value: function componentDidMount() {
|
|
390
322
|
if (typeof window === 'undefined') {
|
|
391
323
|
return;
|
|
392
324
|
}
|
|
393
|
-
|
|
394
325
|
this.unbindWindowClick = bind(window, {
|
|
395
326
|
type: 'click',
|
|
396
327
|
listener: this.handleClick,
|
|
@@ -403,11 +334,9 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
403
334
|
key: "componentWillUnmount",
|
|
404
335
|
value: function componentWillUnmount() {
|
|
405
336
|
var _this$unbindWindowCli, _this$unbindWindowKey2;
|
|
406
|
-
|
|
407
337
|
if (typeof window === 'undefined') {
|
|
408
338
|
return;
|
|
409
339
|
}
|
|
410
|
-
|
|
411
340
|
(_this$unbindWindowCli = this.unbindWindowClick) === null || _this$unbindWindowCli === void 0 ? void 0 : _this$unbindWindowCli.call(this);
|
|
412
341
|
this.unbindWindowClick = null;
|
|
413
342
|
(_this$unbindWindowKey2 = this.unbindWindowKeydown) === null || _this$unbindWindowKey2 === void 0 ? void 0 : _this$unbindWindowKey2.call(this);
|
|
@@ -417,7 +346,6 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
417
346
|
key: "componentDidUpdate",
|
|
418
347
|
value: function componentDidUpdate(prevProps) {
|
|
419
348
|
var isOpen = this.props.isOpen;
|
|
420
|
-
|
|
421
349
|
if (prevProps.isOpen !== isOpen) {
|
|
422
350
|
if (isOpen === true) {
|
|
423
351
|
this.open({
|
|
@@ -429,14 +357,14 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
429
357
|
});
|
|
430
358
|
}
|
|
431
359
|
}
|
|
432
|
-
}
|
|
433
|
-
// ==============================
|
|
360
|
+
}
|
|
434
361
|
|
|
362
|
+
// Event Handlers
|
|
363
|
+
// ==============================
|
|
435
364
|
}, {
|
|
436
365
|
key: "render",
|
|
437
366
|
value: function render() {
|
|
438
367
|
var _this3 = this;
|
|
439
|
-
|
|
440
368
|
var target = this.props.target;
|
|
441
369
|
var isOpen = this.state.isOpen;
|
|
442
370
|
return /*#__PURE__*/React.createElement(Manager, null, /*#__PURE__*/React.createElement(Reference, null, function (_ref3) {
|
|
@@ -453,32 +381,27 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
453
381
|
}], [{
|
|
454
382
|
key: "getDerivedStateFromProps",
|
|
455
383
|
value: function getDerivedStateFromProps(props, state) {
|
|
456
|
-
var newState = {};
|
|
384
|
+
var newState = {};
|
|
457
385
|
|
|
386
|
+
// Merge consumer and default popper props
|
|
458
387
|
var mergedPopperProps = _objectSpread(_objectSpread({}, defaultPopperProps), props.popperProps);
|
|
459
|
-
|
|
460
388
|
if (!shallowEqualObjects(mergedPopperProps, state.mergedPopperProps)) {
|
|
461
389
|
newState.mergedPopperProps = mergedPopperProps;
|
|
462
|
-
}
|
|
463
|
-
|
|
390
|
+
}
|
|
464
391
|
|
|
392
|
+
// Merge consumer and default components
|
|
465
393
|
var mergedComponents = _objectSpread(_objectSpread({}, defaultComponents), props.components);
|
|
466
|
-
|
|
467
394
|
if (!shallowEqualObjects(mergedComponents, state.mergedComponents)) {
|
|
468
395
|
newState.mergedComponents = mergedComponents;
|
|
469
396
|
}
|
|
470
|
-
|
|
471
397
|
if (!isEmpty(newState)) {
|
|
472
398
|
return newState;
|
|
473
399
|
}
|
|
474
|
-
|
|
475
400
|
return null;
|
|
476
401
|
}
|
|
477
402
|
}]);
|
|
478
|
-
|
|
479
403
|
return PopupSelect;
|
|
480
404
|
}(PureComponent);
|
|
481
|
-
|
|
482
405
|
_defineProperty(PopupSelect, "defaultProps", {
|
|
483
406
|
closeMenuOnSelect: true,
|
|
484
407
|
components: {},
|
|
@@ -491,5 +414,4 @@ _defineProperty(PopupSelect, "defaultProps", {
|
|
|
491
414
|
styles: {},
|
|
492
415
|
options: []
|
|
493
416
|
});
|
|
494
|
-
|
|
495
417
|
export { PopupSelect as default };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["innerRef", "innerProps"],
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
_excluded2 = ["children", "innerProps"];
|
|
6
5
|
/** @jsx jsx */
|
|
6
|
+
|
|
7
7
|
import { components } from 'react-select';
|
|
8
8
|
import { jsx } from '@emotion/react';
|
|
9
9
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
@@ -12,10 +12,10 @@ import { layers } from '@atlaskit/theme/constants';
|
|
|
12
12
|
import { N40A } from '@atlaskit/theme/colors';
|
|
13
13
|
export var MenuDialog = function MenuDialog(_ref) {
|
|
14
14
|
var maxWidth = _ref.maxWidth,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
minWidth = _ref.minWidth,
|
|
16
|
+
children = _ref.children,
|
|
17
|
+
id = _ref.id,
|
|
18
|
+
style = _ref.style;
|
|
19
19
|
return jsx("div", {
|
|
20
20
|
css: {
|
|
21
21
|
backgroundColor: "var(--ds-surface-overlay, white)",
|
|
@@ -28,7 +28,9 @@ export var MenuDialog = function MenuDialog(_ref) {
|
|
|
28
28
|
style: style,
|
|
29
29
|
id: id
|
|
30
30
|
}, children);
|
|
31
|
-
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// ==============================
|
|
32
34
|
// Custom Components
|
|
33
35
|
// ==============================
|
|
34
36
|
|
|
@@ -43,12 +45,10 @@ var DropdownIndicator = function DropdownIndicator() {
|
|
|
43
45
|
label: "open"
|
|
44
46
|
}));
|
|
45
47
|
};
|
|
46
|
-
|
|
47
48
|
var Control = function Control(_ref2) {
|
|
48
49
|
var innerRef = _ref2.innerRef,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
innerProps = _ref2.innerProps,
|
|
51
|
+
props = _objectWithoutProperties(_ref2, _excluded);
|
|
52
52
|
return jsx("div", {
|
|
53
53
|
ref: innerRef,
|
|
54
54
|
css: {
|
|
@@ -58,20 +58,18 @@ var Control = function Control(_ref2) {
|
|
|
58
58
|
innerProps: innerProps
|
|
59
59
|
})));
|
|
60
60
|
};
|
|
61
|
-
|
|
62
61
|
export var DummyControl = function DummyControl(props) {
|
|
63
62
|
return jsx(VisuallyHidden, null, jsx(components.Control, props));
|
|
64
|
-
};
|
|
65
|
-
// eslint-disable-next-line
|
|
63
|
+
};
|
|
66
64
|
|
|
65
|
+
// NOTE `props` intentionally omitted from `Fragment`
|
|
66
|
+
// eslint-disable-next-line
|
|
67
67
|
var Menu = function Menu(_ref3) {
|
|
68
68
|
var children = _ref3.children,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
innerProps = _ref3.innerProps,
|
|
70
|
+
props = _objectWithoutProperties(_ref3, _excluded2);
|
|
72
71
|
return jsx("div", innerProps, children);
|
|
73
72
|
};
|
|
74
|
-
|
|
75
73
|
export var defaultComponents = {
|
|
76
74
|
Control: Control,
|
|
77
75
|
DropdownIndicator: DropdownIndicator,
|
package/dist/esm/RadioSelect.js
CHANGED
|
@@ -2,19 +2,14 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
4
|
var _excluded = ["components"];
|
|
5
|
-
|
|
6
5
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
|
-
|
|
8
6
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
9
|
-
|
|
10
7
|
import React from 'react';
|
|
11
8
|
import Select from './Select';
|
|
12
9
|
import { RadioOption } from './components/input-options';
|
|
13
|
-
|
|
14
10
|
var RadioSelect = function RadioSelect(_ref) {
|
|
15
11
|
var components = _ref.components,
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
18
13
|
return /*#__PURE__*/React.createElement(Select, _extends({}, props, {
|
|
19
14
|
isMulti: false,
|
|
20
15
|
components: _objectSpread(_objectSpread({}, components), {}, {
|
|
@@ -22,5 +17,4 @@ var RadioSelect = function RadioSelect(_ref) {
|
|
|
22
17
|
})
|
|
23
18
|
}));
|
|
24
19
|
};
|
|
25
|
-
|
|
26
20
|
export default RadioSelect;
|
package/dist/esm/Select.js
CHANGED
|
@@ -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.1.
|
|
5
|
+
var packageVersion = "16.1.2";
|
|
6
6
|
export var SelectWithoutAnalytics = createSelect(Select);
|
|
7
7
|
var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
8
8
|
export default withAnalyticsContext({
|