@atlaskit/select 15.3.2 → 15.6.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 +29 -0
- package/dist/cjs/CountrySelect.js +18 -41
- package/dist/cjs/PopupSelect/PopupSelect.js +20 -34
- package/dist/cjs/Select.js +1 -1
- package/dist/cjs/createSelect.js +3 -2
- package/dist/cjs/index.js +14 -2
- package/dist/cjs/styles.js +36 -11
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/CountrySelect.js +11 -20
- package/dist/es2019/PopupSelect/PopupSelect.js +12 -27
- package/dist/es2019/Select.js +1 -1
- package/dist/es2019/createSelect.js +2 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/styles.js +36 -11
- package/dist/es2019/version.json +1 -1
- package/dist/esm/CountrySelect.js +18 -42
- package/dist/esm/PopupSelect/PopupSelect.js +19 -35
- package/dist/esm/Select.js +1 -1
- package/dist/esm/createSelect.js +3 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/styles.js +36 -11
- package/dist/esm/version.json +1 -1
- package/dist/types/CountrySelect.d.ts +4 -1
- package/dist/types/PopupSelect/PopupSelect.d.ts +0 -3
- package/dist/types/data/countries.d.ts +7 -4
- package/dist/types/index.d.ts +2 -2
- package/dist/types/styles.d.ts +1 -1
- package/dist/types/types.d.ts +1 -0
- package/package.json +6 -4
- package/report.api.md +710 -0
package/dist/es2019/styles.js
CHANGED
|
@@ -3,7 +3,7 @@ import { B100, B400, B50, G400, N0, N20, N200, N30, N300, N40, N500, N70, N800,
|
|
|
3
3
|
const BORDER_WIDTH = 2;
|
|
4
4
|
const ICON_PADDING = 2;
|
|
5
5
|
const paddingExcludingBorder = gridSize() - BORDER_WIDTH;
|
|
6
|
-
export default function baseStyles(validationState, isCompact) {
|
|
6
|
+
export default function baseStyles(validationState, isCompact, appearance) {
|
|
7
7
|
return {
|
|
8
8
|
container: (css, {
|
|
9
9
|
isDisabled
|
|
@@ -21,12 +21,12 @@ export default function baseStyles(validationState, isCompact) {
|
|
|
21
21
|
isFocused,
|
|
22
22
|
isDisabled
|
|
23
23
|
}) => {
|
|
24
|
-
let borderColor = isFocused ? `var(--ds-border-focused, ${B100})` : `var(--ds-border, ${N20})`;
|
|
25
|
-
let backgroundColor = isFocused ? `var(--ds-
|
|
26
|
-
let backgroundColorHover = isFocused ? `var(--ds-
|
|
24
|
+
let borderColor = isFocused ? `var(--ds-border-focused, ${B100})` : `var(--ds-border-input, ${N20})`;
|
|
25
|
+
let backgroundColor = isFocused ? `var(--ds-background-input-pressed, ${N0})` : `var(--ds-background-input, ${N20})`;
|
|
26
|
+
let backgroundColorHover = isFocused ? `var(--ds-background-input-pressed, ${N0})` : `var(--ds-background-input-hovered, ${N30})`;
|
|
27
27
|
|
|
28
28
|
if (isDisabled) {
|
|
29
|
-
backgroundColor = `var(--ds-background-
|
|
29
|
+
backgroundColor = `var(--ds-background-disabled, ${N20})`;
|
|
30
30
|
borderColor = `var(--ds-background-disabled, ${N20})`;
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -49,6 +49,20 @@ export default function baseStyles(validationState, isCompact) {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
const transitionDuration = '200ms';
|
|
52
|
+
|
|
53
|
+
if (appearance === 'subtle') {
|
|
54
|
+
borderColor = isFocused ? `var(--ds-border-focused, ${B100})` : 'transparent';
|
|
55
|
+
backgroundColor = isFocused ? `var(--ds-surface, ${N0})` : 'transparent';
|
|
56
|
+
backgroundColorHover = isFocused ? `var(--ds-surface, ${N0})` : `var(--ds-surface, ${N30})`;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (appearance === 'none') {
|
|
60
|
+
borderColor = 'transparent';
|
|
61
|
+
backgroundColor = 'transparent';
|
|
62
|
+
backgroundColorHover = 'transparent';
|
|
63
|
+
borderColorHover = 'transparent';
|
|
64
|
+
}
|
|
65
|
+
|
|
52
66
|
return { ...css,
|
|
53
67
|
// Turn pointer events off when disabled - this makes it so hover etc don't work.
|
|
54
68
|
pointerEvents: isDisabled ? 'none' : undefined,
|
|
@@ -151,7 +165,7 @@ export default function baseStyles(validationState, isCompact) {
|
|
|
151
165
|
} else if (isSelected) {
|
|
152
166
|
backgroundColor = `var(--ds-background-selected, ${B50})`;
|
|
153
167
|
} else if (isFocused) {
|
|
154
|
-
backgroundColor = `var(--ds-background-
|
|
168
|
+
backgroundColor = `var(--ds-background-neutral-subtle-hovered, ${N20})`;
|
|
155
169
|
}
|
|
156
170
|
|
|
157
171
|
if (!isDisabled && (isFocused || isSelected)) {
|
|
@@ -197,35 +211,46 @@ export default function baseStyles(validationState, isCompact) {
|
|
|
197
211
|
isFocused
|
|
198
212
|
}) => ({ ...css,
|
|
199
213
|
borderRadius: '2px',
|
|
200
|
-
backgroundColor: isFocused ? `var(--ds-background-selected, ${N40})` : `var(--ds-background-neutral
|
|
214
|
+
backgroundColor: isFocused ? `var(--ds-background-selected, ${N40})` : `var(--ds-background-neutral, ${N40})`,
|
|
201
215
|
boxShadow: isFocused ? `0 0 0 2px ${"var(--ds-surface, transparent)"}, 0 0 0 4px ${"var(--ds-border-focused, transparent)"}` : 'none',
|
|
202
216
|
maxWidth: '100%',
|
|
203
217
|
'@media screen and (-ms-high-contrast: active)': {
|
|
204
218
|
border: isFocused ? '1px solid transparent' : 'none'
|
|
219
|
+
},
|
|
220
|
+
pointerEvents: 'none',
|
|
221
|
+
color: isFocused ? "var(--ds-text-selected, hsl(0, 0%, 20%))" : "var(--ds-text, hsl(0, 0%, 20%))",
|
|
222
|
+
':hover': {
|
|
223
|
+
backgroundColor: `var(--ds-background-danger-hovered, ${N40})`,
|
|
224
|
+
color: "var(--ds-text-danger, inherit)"
|
|
225
|
+
},
|
|
226
|
+
':active': {
|
|
227
|
+
backgroundColor: `var(--ds-background-danger-pressed, ${N40})`,
|
|
228
|
+
color: "var(--ds-text-danger, inherit)"
|
|
205
229
|
}
|
|
206
230
|
}),
|
|
207
231
|
multiValueLabel: (css, {
|
|
208
232
|
isFocused
|
|
209
233
|
}) => ({ ...css,
|
|
210
234
|
padding: '2px',
|
|
211
|
-
color:
|
|
235
|
+
color: 'inherit',
|
|
212
236
|
paddingRight: '2px'
|
|
213
237
|
}),
|
|
214
238
|
multiValueRemove: (css, {
|
|
215
239
|
// @ts-ignore: missing in @types/react-select
|
|
216
240
|
isFocused
|
|
217
241
|
}) => ({ ...css,
|
|
218
|
-
|
|
242
|
+
pointerEvents: 'auto',
|
|
243
|
+
backgroundColor: isFocused && `var(--ds-UNSAFE_util-transparent, ${R75})`,
|
|
219
244
|
fill: isFocused ? "var(--ds-text-selected, #000)" : "var(--ds-text, #000)",
|
|
220
245
|
paddingLeft: '2px',
|
|
221
246
|
paddingRight: '2px',
|
|
222
247
|
borderRadius: '0px 2px 2px 0px',
|
|
223
248
|
':hover': {
|
|
224
|
-
backgroundColor: `var(--ds-
|
|
249
|
+
backgroundColor: `var(--ds-UNSAFE_util-transparent, ${R75})`,
|
|
225
250
|
fill: "var(--ds-text-danger, #000)"
|
|
226
251
|
},
|
|
227
252
|
':active': {
|
|
228
|
-
backgroundColor: `var(--ds-
|
|
253
|
+
backgroundColor: `var(--ds-UNSAFE_util-transparent, ${R75})`,
|
|
229
254
|
fill: "var(--ds-text-danger, #000)"
|
|
230
255
|
}
|
|
231
256
|
})
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,38 +1,27 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
|
|
4
|
-
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; }
|
|
5
|
-
|
|
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; }
|
|
7
2
|
|
|
8
3
|
/** @jsx jsx */
|
|
9
|
-
import { jsx } from '@emotion/core';
|
|
4
|
+
import { jsx, css } from '@emotion/core';
|
|
10
5
|
import { groupedCountries } from './data/countries';
|
|
11
6
|
import Select from './Select';
|
|
12
|
-
|
|
13
7
|
// custom option renderer
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return {
|
|
24
|
-
fontSize: '18px',
|
|
25
|
-
marginRight: '8px'
|
|
26
|
-
};
|
|
27
|
-
};
|
|
8
|
+
var labelStyles = css({
|
|
9
|
+
alignItems: 'center',
|
|
10
|
+
display: 'flex',
|
|
11
|
+
lineHeight: 1.2
|
|
12
|
+
});
|
|
13
|
+
var flagStyles = css({
|
|
14
|
+
fontSize: '18px',
|
|
15
|
+
marginRight: '8px'
|
|
16
|
+
});
|
|
28
17
|
|
|
29
18
|
var Opt = function Opt(_ref) {
|
|
30
19
|
var children = _ref.children,
|
|
31
20
|
icon = _ref.icon;
|
|
32
21
|
return jsx("div", {
|
|
33
|
-
css:
|
|
22
|
+
css: labelStyles
|
|
34
23
|
}, jsx("span", {
|
|
35
|
-
css:
|
|
24
|
+
css: flagStyles
|
|
36
25
|
}, icon), children);
|
|
37
26
|
}; // return the country name; used for searching
|
|
38
27
|
|
|
@@ -64,7 +53,11 @@ var optionLabel = function optionLabel(_ref3) {
|
|
|
64
53
|
name = _ref3.name;
|
|
65
54
|
return jsx(Opt, {
|
|
66
55
|
icon: icon
|
|
67
|
-
},
|
|
56
|
+
}, getOptionLabel({
|
|
57
|
+
abbr: abbr,
|
|
58
|
+
code: code,
|
|
59
|
+
name: name
|
|
60
|
+
}));
|
|
68
61
|
}; // switch formatters based on render context (menu | value)
|
|
69
62
|
|
|
70
63
|
|
|
@@ -81,24 +74,7 @@ var CountrySelect = function CountrySelect(props) {
|
|
|
81
74
|
getOptionLabel: getOptionLabel,
|
|
82
75
|
getOptionValue: getOptionValue,
|
|
83
76
|
isMulti: false,
|
|
84
|
-
options: groupedCountries
|
|
85
|
-
styles: {
|
|
86
|
-
container: function container(css) {
|
|
87
|
-
return _objectSpread(_objectSpread({}, css), {}, {
|
|
88
|
-
width: 105
|
|
89
|
-
});
|
|
90
|
-
},
|
|
91
|
-
dropdownIndicator: function dropdownIndicator(css) {
|
|
92
|
-
return _objectSpread(_objectSpread({}, css), {}, {
|
|
93
|
-
paddingLeft: 0
|
|
94
|
-
});
|
|
95
|
-
},
|
|
96
|
-
menu: function menu(css) {
|
|
97
|
-
return _objectSpread(_objectSpread({}, css), {}, {
|
|
98
|
-
width: 300
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
}
|
|
77
|
+
options: groupedCountries
|
|
102
78
|
}, props));
|
|
103
79
|
};
|
|
104
80
|
|
|
@@ -19,9 +19,9 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
19
19
|
|
|
20
20
|
import React, { PureComponent } from 'react';
|
|
21
21
|
import { createPortal } from 'react-dom';
|
|
22
|
+
import FocusLock from 'react-focus-lock';
|
|
22
23
|
import Select, { mergeStyles } from 'react-select';
|
|
23
24
|
import { uid } from 'react-uid';
|
|
24
|
-
import createFocusTrap from 'focus-trap';
|
|
25
25
|
import { Manager, Reference, Popper } from 'react-popper';
|
|
26
26
|
import NodeResolver from 'react-node-resolver';
|
|
27
27
|
import shallowEqualObjects from 'shallow-equal/objects';
|
|
@@ -82,8 +82,6 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
82
82
|
|
|
83
83
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
84
84
|
|
|
85
|
-
_defineProperty(_assertThisInitialized(_this), "focusTrap", null);
|
|
86
|
-
|
|
87
85
|
_defineProperty(_assertThisInitialized(_this), "menuRef", null);
|
|
88
86
|
|
|
89
87
|
_defineProperty(_assertThisInitialized(_this), "selectRef", null);
|
|
@@ -94,7 +92,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
94
92
|
|
|
95
93
|
_defineProperty(_assertThisInitialized(_this), "unbindWindowKeydown", null);
|
|
96
94
|
|
|
97
|
-
_defineProperty(_assertThisInitialized(_this), "defaultStyles", mergeStyles(baseStyles(_this.props.validationState, _this.props.spacing === 'compact'), {
|
|
95
|
+
_defineProperty(_assertThisInitialized(_this), "defaultStyles", mergeStyles(baseStyles(_this.props.validationState, _this.props.spacing === 'compact', 'default'), {
|
|
98
96
|
groupHeading: function groupHeading(provided) {
|
|
99
97
|
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
100
98
|
color: "var(--ds-text-subtlest, ".concat(N80, ")")
|
|
@@ -182,7 +180,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
182
180
|
|
|
183
181
|
_this.setState({
|
|
184
182
|
isOpen: true
|
|
185
|
-
}
|
|
183
|
+
});
|
|
186
184
|
|
|
187
185
|
if (_this.selectRef) {
|
|
188
186
|
_this.selectRef.select.openMenu('first'); // HACK
|
|
@@ -202,28 +200,12 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
202
200
|
});
|
|
203
201
|
});
|
|
204
202
|
|
|
205
|
-
_defineProperty(_assertThisInitialized(_this), "initialiseFocusTrap", function () {
|
|
206
|
-
if (!_this.menuRef) {
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
var trapConfig = {
|
|
211
|
-
clickOutsideDeactivates: true,
|
|
212
|
-
escapeDeactivates: true,
|
|
213
|
-
fallbackFocus: _this.menuRef,
|
|
214
|
-
returnFocusOnDeactivate: true
|
|
215
|
-
};
|
|
216
|
-
_this.focusTrap = createFocusTrap(_this.menuRef, trapConfig); // allow time for the HTMLElement to render
|
|
217
|
-
|
|
218
|
-
setTimeout(function () {
|
|
219
|
-
return _this.focusTrap.activate();
|
|
220
|
-
}, 1);
|
|
221
|
-
});
|
|
222
|
-
|
|
223
203
|
_defineProperty(_assertThisInitialized(_this), "close", function (options) {
|
|
224
204
|
var _this$unbindWindowKey, _this2;
|
|
225
205
|
|
|
226
|
-
var
|
|
206
|
+
var _this$props2 = _this.props,
|
|
207
|
+
onClose = _this$props2.onClose,
|
|
208
|
+
onMenuClose = _this$props2.onMenuClose;
|
|
227
209
|
|
|
228
210
|
if (!(options !== null && options !== void 0 && options.controlOverride) && _this.isOpenControlled) {
|
|
229
211
|
// Prevent popup closing if it's open state is already being controlled
|
|
@@ -234,14 +216,14 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
234
216
|
onClose();
|
|
235
217
|
}
|
|
236
218
|
|
|
219
|
+
if (onMenuClose) {
|
|
220
|
+
onMenuClose();
|
|
221
|
+
}
|
|
222
|
+
|
|
237
223
|
_this.setState({
|
|
238
224
|
isOpen: false
|
|
239
225
|
});
|
|
240
226
|
|
|
241
|
-
if (_this.focusTrap) {
|
|
242
|
-
_this.focusTrap.deactivate();
|
|
243
|
-
}
|
|
244
|
-
|
|
245
227
|
if (_this.targetRef != null) {
|
|
246
228
|
_this.targetRef.focus();
|
|
247
229
|
}
|
|
@@ -323,12 +305,12 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
323
305
|
});
|
|
324
306
|
|
|
325
307
|
_defineProperty(_assertThisInitialized(_this), "renderSelect", function () {
|
|
326
|
-
var _this$
|
|
327
|
-
footer = _this$
|
|
328
|
-
maxMenuWidth = _this$
|
|
329
|
-
minMenuWidth = _this$
|
|
330
|
-
target = _this$
|
|
331
|
-
props = _objectWithoutProperties(_this$
|
|
308
|
+
var _this$props3 = _this.props,
|
|
309
|
+
footer = _this$props3.footer,
|
|
310
|
+
maxMenuWidth = _this$props3.maxMenuWidth,
|
|
311
|
+
minMenuWidth = _this$props3.minMenuWidth,
|
|
312
|
+
target = _this$props3.target,
|
|
313
|
+
props = _objectWithoutProperties(_this$props3, _excluded);
|
|
332
314
|
|
|
333
315
|
var _this$state = _this.state,
|
|
334
316
|
isOpen = _this$state.isOpen,
|
|
@@ -359,6 +341,8 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
359
341
|
minWidth: minMenuWidth,
|
|
360
342
|
maxWidth: maxMenuWidth,
|
|
361
343
|
id: _this.popperWrapperId
|
|
344
|
+
}, /*#__PURE__*/React.createElement(FocusLock, {
|
|
345
|
+
returnFocus: true
|
|
362
346
|
}, /*#__PURE__*/React.createElement(Select, _extends({
|
|
363
347
|
backspaceRemovesValue: false,
|
|
364
348
|
controlShouldRenderValue: false,
|
|
@@ -372,7 +356,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
372
356
|
maxMenuHeight: _this.getMaxHeight(),
|
|
373
357
|
components: components,
|
|
374
358
|
onChange: _this.handleSelectChange
|
|
375
|
-
})), footer));
|
|
359
|
+
})), footer)));
|
|
376
360
|
});
|
|
377
361
|
return mergedPopperProps.strategy === 'fixed' ? popper : /*#__PURE__*/createPortal(popper, portalDestination);
|
|
378
362
|
});
|
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 = "15.
|
|
5
|
+
var packageVersion = "15.6.0";
|
|
6
6
|
export var SelectWithoutAnalytics = createSelect(Select);
|
|
7
7
|
var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
8
8
|
export default withAnalyticsContext({
|
package/dist/esm/createSelect.js
CHANGED
|
@@ -8,7 +8,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
8
8
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
9
9
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
10
10
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
11
|
-
var _excluded = ["styles", "validationState", "spacing", "isMulti"];
|
|
11
|
+
var _excluded = ["styles", "validationState", "spacing", "isMulti", "appearance"];
|
|
12
12
|
|
|
13
13
|
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; }
|
|
14
14
|
|
|
@@ -94,6 +94,7 @@ export default function createSelect(WrappedComponent) {
|
|
|
94
94
|
validationState = _this$props.validationState,
|
|
95
95
|
spacing = _this$props.spacing,
|
|
96
96
|
isMulti = _this$props.isMulti,
|
|
97
|
+
appearance = _this$props.appearance,
|
|
97
98
|
props = _objectWithoutProperties(_this$props, _excluded);
|
|
98
99
|
|
|
99
100
|
var isCompact = spacing === 'compact'; // props must be spread first to stop `components` being overridden
|
|
@@ -104,7 +105,7 @@ export default function createSelect(WrappedComponent) {
|
|
|
104
105
|
"aria-live": "assertive"
|
|
105
106
|
}, props, {
|
|
106
107
|
components: this.components,
|
|
107
|
-
styles: mergeStyles(baseStyles(validationState, isCompact), styles)
|
|
108
|
+
styles: mergeStyles(baseStyles(validationState, isCompact, this.props.appearance || 'default'), styles)
|
|
108
109
|
}));
|
|
109
110
|
}
|
|
110
111
|
}]);
|
package/dist/esm/index.js
CHANGED
|
@@ -2,7 +2,7 @@ export { components, createFilter, mergeStyles } from 'react-select';
|
|
|
2
2
|
export { makeAsyncSelect } from 'react-select/async';
|
|
3
3
|
export { makeCreatableSelect } from 'react-select/creatable';
|
|
4
4
|
export { CheckboxOption, RadioOption } from './components/input-options';
|
|
5
|
-
export { default } from './Select';
|
|
5
|
+
export { default, SelectWithoutAnalytics } from './Select';
|
|
6
6
|
export { default as AsyncSelect } from './AsyncSelect';
|
|
7
7
|
export { default as CheckboxSelect } from './CheckboxSelect';
|
|
8
8
|
export { default as CountrySelect } from './CountrySelect';
|
package/dist/esm/styles.js
CHANGED
|
@@ -9,7 +9,7 @@ import { B100, B400, B50, G400, N0, N20, N200, N30, N300, N40, N500, N70, N800,
|
|
|
9
9
|
var BORDER_WIDTH = 2;
|
|
10
10
|
var ICON_PADDING = 2;
|
|
11
11
|
var paddingExcludingBorder = gridSize() - BORDER_WIDTH;
|
|
12
|
-
export default function baseStyles(validationState, isCompact) {
|
|
12
|
+
export default function baseStyles(validationState, isCompact, appearance) {
|
|
13
13
|
return {
|
|
14
14
|
container: function container(css, _ref) {
|
|
15
15
|
var isDisabled = _ref.isDisabled;
|
|
@@ -29,12 +29,12 @@ export default function baseStyles(validationState, isCompact) {
|
|
|
29
29
|
control: function control(css, _ref2) {
|
|
30
30
|
var isFocused = _ref2.isFocused,
|
|
31
31
|
isDisabled = _ref2.isDisabled;
|
|
32
|
-
var borderColor = isFocused ? "var(--ds-border-focused, ".concat(B100, ")") : "var(--ds-border, ".concat(N20, ")");
|
|
33
|
-
var backgroundColor = isFocused ? "var(--ds-
|
|
34
|
-
var backgroundColorHover = isFocused ? "var(--ds-
|
|
32
|
+
var borderColor = isFocused ? "var(--ds-border-focused, ".concat(B100, ")") : "var(--ds-border-input, ".concat(N20, ")");
|
|
33
|
+
var backgroundColor = isFocused ? "var(--ds-background-input-pressed, ".concat(N0, ")") : "var(--ds-background-input, ".concat(N20, ")");
|
|
34
|
+
var backgroundColorHover = isFocused ? "var(--ds-background-input-pressed, ".concat(N0, ")") : "var(--ds-background-input-hovered, ".concat(N30, ")");
|
|
35
35
|
|
|
36
36
|
if (isDisabled) {
|
|
37
|
-
backgroundColor = "var(--ds-background-
|
|
37
|
+
backgroundColor = "var(--ds-background-disabled, ".concat(N20, ")");
|
|
38
38
|
borderColor = "var(--ds-background-disabled, ".concat(N20, ")");
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -57,6 +57,20 @@ export default function baseStyles(validationState, isCompact) {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
var transitionDuration = '200ms';
|
|
60
|
+
|
|
61
|
+
if (appearance === 'subtle') {
|
|
62
|
+
borderColor = isFocused ? "var(--ds-border-focused, ".concat(B100, ")") : 'transparent';
|
|
63
|
+
backgroundColor = isFocused ? "var(--ds-surface, ".concat(N0, ")") : 'transparent';
|
|
64
|
+
backgroundColorHover = isFocused ? "var(--ds-surface, ".concat(N0, ")") : "var(--ds-surface, ".concat(N30, ")");
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (appearance === 'none') {
|
|
68
|
+
borderColor = 'transparent';
|
|
69
|
+
backgroundColor = 'transparent';
|
|
70
|
+
backgroundColorHover = 'transparent';
|
|
71
|
+
borderColorHover = 'transparent';
|
|
72
|
+
}
|
|
73
|
+
|
|
60
74
|
return _objectSpread(_objectSpread({}, css), {}, {
|
|
61
75
|
// Turn pointer events off when disabled - this makes it so hover etc don't work.
|
|
62
76
|
pointerEvents: isDisabled ? 'none' : undefined,
|
|
@@ -164,7 +178,7 @@ export default function baseStyles(validationState, isCompact) {
|
|
|
164
178
|
} else if (isSelected) {
|
|
165
179
|
backgroundColor = "var(--ds-background-selected, ".concat(B50, ")");
|
|
166
180
|
} else if (isFocused) {
|
|
167
|
-
backgroundColor = "var(--ds-background-
|
|
181
|
+
backgroundColor = "var(--ds-background-neutral-subtle-hovered, ".concat(N20, ")");
|
|
168
182
|
}
|
|
169
183
|
|
|
170
184
|
if (!isDisabled && (isFocused || isSelected)) {
|
|
@@ -216,11 +230,21 @@ export default function baseStyles(validationState, isCompact) {
|
|
|
216
230
|
var isFocused = _ref7.isFocused;
|
|
217
231
|
return _objectSpread(_objectSpread({}, css), {}, {
|
|
218
232
|
borderRadius: '2px',
|
|
219
|
-
backgroundColor: isFocused ? "var(--ds-background-selected, ".concat(N40, ")") : "var(--ds-background-neutral
|
|
233
|
+
backgroundColor: isFocused ? "var(--ds-background-selected, ".concat(N40, ")") : "var(--ds-background-neutral, ".concat(N40, ")"),
|
|
220
234
|
boxShadow: isFocused ? "0 0 0 2px ".concat("var(--ds-surface, transparent)", ", 0 0 0 4px ", "var(--ds-border-focused, transparent)") : 'none',
|
|
221
235
|
maxWidth: '100%',
|
|
222
236
|
'@media screen and (-ms-high-contrast: active)': {
|
|
223
237
|
border: isFocused ? '1px solid transparent' : 'none'
|
|
238
|
+
},
|
|
239
|
+
pointerEvents: 'none',
|
|
240
|
+
color: isFocused ? "var(--ds-text-selected, hsl(0, 0%, 20%))" : "var(--ds-text, hsl(0, 0%, 20%))",
|
|
241
|
+
':hover': {
|
|
242
|
+
backgroundColor: "var(--ds-background-danger-hovered, ".concat(N40, ")"),
|
|
243
|
+
color: "var(--ds-text-danger, inherit)"
|
|
244
|
+
},
|
|
245
|
+
':active': {
|
|
246
|
+
backgroundColor: "var(--ds-background-danger-pressed, ".concat(N40, ")"),
|
|
247
|
+
color: "var(--ds-text-danger, inherit)"
|
|
224
248
|
}
|
|
225
249
|
});
|
|
226
250
|
},
|
|
@@ -228,24 +252,25 @@ export default function baseStyles(validationState, isCompact) {
|
|
|
228
252
|
var isFocused = _ref8.isFocused;
|
|
229
253
|
return _objectSpread(_objectSpread({}, css), {}, {
|
|
230
254
|
padding: '2px',
|
|
231
|
-
color:
|
|
255
|
+
color: 'inherit',
|
|
232
256
|
paddingRight: '2px'
|
|
233
257
|
});
|
|
234
258
|
},
|
|
235
259
|
multiValueRemove: function multiValueRemove(css, _ref9) {
|
|
236
260
|
var isFocused = _ref9.isFocused;
|
|
237
261
|
return _objectSpread(_objectSpread({}, css), {}, {
|
|
238
|
-
|
|
262
|
+
pointerEvents: 'auto',
|
|
263
|
+
backgroundColor: isFocused && "var(--ds-UNSAFE_util-transparent, ".concat(R75, ")"),
|
|
239
264
|
fill: isFocused ? "var(--ds-text-selected, #000)" : "var(--ds-text, #000)",
|
|
240
265
|
paddingLeft: '2px',
|
|
241
266
|
paddingRight: '2px',
|
|
242
267
|
borderRadius: '0px 2px 2px 0px',
|
|
243
268
|
':hover': {
|
|
244
|
-
backgroundColor: "var(--ds-
|
|
269
|
+
backgroundColor: "var(--ds-UNSAFE_util-transparent, ".concat(R75, ")"),
|
|
245
270
|
fill: "var(--ds-text-danger, #000)"
|
|
246
271
|
},
|
|
247
272
|
':active': {
|
|
248
|
-
backgroundColor: "var(--ds-
|
|
273
|
+
backgroundColor: "var(--ds-UNSAFE_util-transparent, ".concat(R75, ")"),
|
|
249
274
|
fill: "var(--ds-text-danger, #000)"
|
|
250
275
|
}
|
|
251
276
|
});
|
package/dist/esm/version.json
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
import { groupedCountries } from './data/countries';
|
|
3
|
+
import { SelectProps } from './types';
|
|
4
|
+
declare type Country = typeof groupedCountries[number]['options'][number];
|
|
5
|
+
declare const CountrySelect: (props: SelectProps<Country>) => JSX.Element;
|
|
3
6
|
export default CountrySelect;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { PureComponent, ReactNode } from 'react';
|
|
2
2
|
import Select from 'react-select';
|
|
3
|
-
import { FocusTrap } from 'focus-trap';
|
|
4
3
|
import { PopperProps } from 'react-popper';
|
|
5
4
|
import { OptionType, ActionMeta, ReactSelectProps, StylesConfig, ValueType } from '../types';
|
|
6
5
|
import { UnbindFn } from 'bind-event-listener';
|
|
@@ -67,7 +66,6 @@ interface State<Modifiers = string> {
|
|
|
67
66
|
mergedPopperProps: PopperPropsNoChildren<defaultModifiers | Modifiers>;
|
|
68
67
|
}
|
|
69
68
|
export default class PopupSelect<Option = OptionType, IsMulti extends boolean = false> extends PureComponent<PopupSelectProps<Option, IsMulti>, State> {
|
|
70
|
-
focusTrap: FocusTrap | null;
|
|
71
69
|
menuRef: HTMLElement | null;
|
|
72
70
|
selectRef: Select<Option, IsMulti> | null;
|
|
73
71
|
targetRef: HTMLElement | null;
|
|
@@ -112,7 +110,6 @@ export default class PopupSelect<Option = OptionType, IsMulti extends boolean =
|
|
|
112
110
|
open: (options?: {
|
|
113
111
|
controlOverride?: boolean | undefined;
|
|
114
112
|
} | undefined) => void;
|
|
115
|
-
initialiseFocusTrap: () => void;
|
|
116
113
|
/**
|
|
117
114
|
* Closes the popup
|
|
118
115
|
*
|
|
@@ -6,8 +6,11 @@ interface Country {
|
|
|
6
6
|
suggested?: boolean;
|
|
7
7
|
}
|
|
8
8
|
export declare const allCountries: Array<Country>;
|
|
9
|
-
export declare const groupedCountries:
|
|
10
|
-
label:
|
|
11
|
-
options:
|
|
12
|
-
}
|
|
9
|
+
export declare const groupedCountries: readonly [{
|
|
10
|
+
readonly label: "Suggested";
|
|
11
|
+
readonly options: Country[];
|
|
12
|
+
}, {
|
|
13
|
+
readonly label: "All Countries";
|
|
14
|
+
readonly options: Country[];
|
|
15
|
+
}];
|
|
13
16
|
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { components, createFilter, mergeStyles } from 'react-select';
|
|
|
2
2
|
export { makeAsyncSelect } from 'react-select/async';
|
|
3
3
|
export { makeCreatableSelect } from 'react-select/creatable';
|
|
4
4
|
export { CheckboxOption, RadioOption } from './components/input-options';
|
|
5
|
-
export { default } from './Select';
|
|
5
|
+
export { default, SelectWithoutAnalytics } from './Select';
|
|
6
6
|
export { default as AsyncSelect } from './AsyncSelect';
|
|
7
7
|
export { default as CheckboxSelect } from './CheckboxSelect';
|
|
8
8
|
export { default as CountrySelect } from './CountrySelect';
|
|
@@ -11,4 +11,4 @@ export { default as CreatableSelect } from './CreatableSelect';
|
|
|
11
11
|
export { default as AsyncCreatableSelect } from './AsyncCreatableSelect';
|
|
12
12
|
export { default as PopupSelect } from './PopupSelect';
|
|
13
13
|
export type { PopupSelectProps } from './PopupSelect';
|
|
14
|
-
export type { ActionMeta, ControlProps, FormatOptionLabelMeta, IndicatorComponentType, IndicatorProps, InputProps, MenuProps, MenuListComponentProps, OptionProps, OptionsType, OptionType, SelectComponentsConfig, SelectProps, StylesConfig, ValueContainerProps, ValueType, GroupedOptionsType, GroupType, } from './types';
|
|
14
|
+
export type { ActionMeta, ControlProps, FormatOptionLabelMeta, IndicatorComponentType, IndicatorProps, InputActionMeta, InputProps, MenuProps, MenuListComponentProps, OptionProps, OptionsType, OptionType, SelectComponentsConfig, SelectProps, StylesConfig, ValueContainerProps, ValueType, GroupedOptionsType, GroupType, } from './types';
|
package/dist/types/styles.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { StylesConfig, ValidationState } from './types';
|
|
2
|
-
export default function baseStyles<Option, IsMulti extends boolean>(validationState: ValidationState, isCompact: boolean): StylesConfig<Option, IsMulti>;
|
|
2
|
+
export default function baseStyles<Option, IsMulti extends boolean>(validationState: ValidationState, isCompact: boolean, appearance: 'default' | 'subtle' | 'none'): StylesConfig<Option, IsMulti>;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export interface OptionProps<Option = OptionType, IsMulti extends boolean = fals
|
|
|
25
25
|
export interface SelectProps<OptionType, IsMulti extends boolean = false> extends ReactSelectProps<OptionType, IsMulti>, WithAnalyticsEventsProps {
|
|
26
26
|
spacing?: 'compact' | 'default';
|
|
27
27
|
validationState?: ValidationState;
|
|
28
|
+
appearance?: 'default' | 'subtle' | 'none';
|
|
28
29
|
}
|
|
29
30
|
export declare type ActionMeta<Option = OptionType> = RSActionMeta<Option>;
|
|
30
31
|
export declare type InputActionMeta = RSInputActionMeta;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/select",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.6.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/"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"module:es2019": "dist/es2019/index.js",
|
|
14
14
|
"types": "dist/types/index.d.ts",
|
|
15
15
|
"sideEffects": false,
|
|
16
|
-
"atlaskit:src": "src/index.
|
|
16
|
+
"atlaskit:src": "src/index.tsx",
|
|
17
17
|
"atlassian": {
|
|
18
18
|
"team": "Design System Team",
|
|
19
19
|
"deprecatedAutoEntryPoints": true,
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"@popperjs/core": "^2.9.1",
|
|
36
36
|
"@types/react-select": "^4.0.18",
|
|
37
37
|
"bind-event-listener": "^2.1.1",
|
|
38
|
-
"focus-trap": "^2.4.5",
|
|
39
38
|
"memoize-one": "^6.0.0",
|
|
40
39
|
"react-fast-compare": "^3.2.0",
|
|
40
|
+
"react-focus-lock": "^2.5.2",
|
|
41
41
|
"react-node-resolver": "^1.0.1",
|
|
42
42
|
"react-popper": "^2.2.3",
|
|
43
43
|
"react-select": "^4.3.1",
|
|
@@ -54,8 +54,9 @@
|
|
|
54
54
|
"@atlaskit/docs": "*",
|
|
55
55
|
"@atlaskit/drawer": "^7.1.0",
|
|
56
56
|
"@atlaskit/form": "^8.5.0",
|
|
57
|
-
"@atlaskit/logo": "^13.
|
|
57
|
+
"@atlaskit/logo": "^13.8.0",
|
|
58
58
|
"@atlaskit/modal-dialog": "^12.2.0",
|
|
59
|
+
"@atlaskit/radio": "^5.3.11",
|
|
59
60
|
"@atlaskit/section-message": "^6.0.0",
|
|
60
61
|
"@atlaskit/ssr": "*",
|
|
61
62
|
"@atlaskit/tooltip": "^17.5.0",
|
|
@@ -64,6 +65,7 @@
|
|
|
64
65
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
65
66
|
"@emotion/styled": "^10.0.7",
|
|
66
67
|
"@testing-library/react": "^8.0.1",
|
|
68
|
+
"@testing-library/user-event": "10.4.0",
|
|
67
69
|
"ast-types": "^0.13.3",
|
|
68
70
|
"enzyme": "^3.10.0",
|
|
69
71
|
"jscodeshift": "^0.13.0",
|