@atlaskit/select 15.6.2 → 15.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 +18 -0
- package/dist/cjs/CountrySelect.js +8 -8
- package/dist/cjs/PopupSelect/PopupSelect.js +28 -24
- package/dist/cjs/PopupSelect/components.js +8 -8
- package/dist/cjs/Select.js +1 -1
- package/dist/cjs/components/index.js +14 -3
- package/dist/cjs/components/indicators.js +5 -5
- package/dist/cjs/components/input-options.js +44 -37
- package/dist/cjs/createSelect.js +4 -2
- package/dist/cjs/styles.js +4 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/CountrySelect.js +1 -1
- package/dist/es2019/PopupSelect/PopupSelect.js +21 -18
- package/dist/es2019/PopupSelect/components.js +1 -1
- package/dist/es2019/Select.js +1 -1
- package/dist/es2019/components/index.js +22 -7
- package/dist/es2019/components/indicators.js +1 -1
- package/dist/es2019/components/input-options.js +46 -39
- package/dist/es2019/createSelect.js +3 -1
- package/dist/es2019/styles.js +2 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/CountrySelect.js +1 -1
- package/dist/esm/PopupSelect/PopupSelect.js +28 -24
- package/dist/esm/PopupSelect/components.js +1 -1
- package/dist/esm/Select.js +1 -1
- package/dist/esm/components/index.js +14 -3
- package/dist/esm/components/indicators.js +1 -1
- package/dist/esm/components/input-options.js +40 -33
- package/dist/esm/createSelect.js +4 -2
- package/dist/esm/styles.js +4 -2
- package/dist/esm/version.json +1 -1
- package/dist/types/AsyncCreatableSelect.d.ts +1 -0
- package/dist/types/AsyncSelect.d.ts +1 -0
- package/dist/types/CountrySelect.d.ts +3 -2
- package/dist/types/CreatableSelect.d.ts +1 -0
- package/dist/types/PopupSelect/PopupSelect.d.ts +16 -6
- package/dist/types/PopupSelect/components.d.ts +3 -2
- package/dist/types/Select.d.ts +2 -0
- package/dist/types/components/index.d.ts +3 -2
- package/dist/types/createSelect.d.ts +1 -0
- package/dist/types/styles.d.ts +1 -1
- package/dist/types/types.d.ts +1 -0
- package/package.json +10 -10
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
|
|
4
4
|
/** @jsx jsx */
|
|
5
|
-
import { jsx } from '@emotion/
|
|
5
|
+
import { jsx } from '@emotion/react';
|
|
6
6
|
import { Component } from 'react';
|
|
7
7
|
import RadioIcon from '@atlaskit/icon/glyph/radio';
|
|
8
8
|
import CheckboxIcon from '@atlaskit/icon/glyph/checkbox';
|
|
@@ -156,12 +156,12 @@ const getBorderColor = ({
|
|
|
156
156
|
} else if (isFocused && isSelected) {
|
|
157
157
|
return `var(--ds-background-selected-bold-hovered, ${B400})`;
|
|
158
158
|
} else if (isFocused) {
|
|
159
|
-
return `var(--ds-border, ${N100})`;
|
|
159
|
+
return `var(--ds-border-input, ${N100})`;
|
|
160
160
|
} else if (isSelected) {
|
|
161
161
|
return `var(--ds-background-selected-bold, ${B400})`;
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
return `var(--ds-border, ${N100})`;
|
|
164
|
+
return `var(--ds-border-input, ${N100})`;
|
|
165
165
|
};
|
|
166
166
|
|
|
167
167
|
class ControlOption extends Component {
|
|
@@ -204,43 +204,50 @@ class ControlOption extends Component {
|
|
|
204
204
|
getStyles,
|
|
205
205
|
...rest
|
|
206
206
|
});
|
|
207
|
-
return
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
207
|
+
return (
|
|
208
|
+
/**
|
|
209
|
+
* TODO Fix this type error
|
|
210
|
+
* @see https://product-fabric.atlassian.net/browse/DSP-6063
|
|
211
|
+
*/
|
|
212
|
+
// @ts-ignore
|
|
213
|
+
jsx("div", _extends({
|
|
214
|
+
css: styles,
|
|
215
|
+
className: classes,
|
|
216
|
+
ref: innerRef
|
|
217
|
+
}, props), jsx("div", {
|
|
218
|
+
css: {
|
|
219
|
+
alignItems: 'center',
|
|
220
|
+
display: 'flex ',
|
|
221
|
+
flexShrink: 0,
|
|
222
|
+
paddingRight: '4px',
|
|
223
|
+
// Here we are adding a border to the Checkbox and Radio SVG icons
|
|
224
|
+
// This is an a11y fix for Select only for now but it may be rolled
|
|
225
|
+
// into the `@atlaskit/icon` package's Checkbox and Radio SVGs later
|
|
226
|
+
'& svg rect, & svg circle:first-of-type': {
|
|
227
|
+
stroke: getBorderColor({ ...this.props,
|
|
228
|
+
...this.state
|
|
229
|
+
}),
|
|
230
|
+
strokeWidth: '2px',
|
|
231
|
+
strokeLinejoin: 'round'
|
|
232
|
+
}
|
|
226
233
|
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
})
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}
|
|
243
|
-
|
|
234
|
+
}, !!Icon ? jsx(Icon, {
|
|
235
|
+
label: "",
|
|
236
|
+
primaryColor: getPrimaryColor({ ...this.props,
|
|
237
|
+
...this.state
|
|
238
|
+
}),
|
|
239
|
+
secondaryColor: getSecondaryColor({ ...this.props,
|
|
240
|
+
...this.state
|
|
241
|
+
})
|
|
242
|
+
}) : null), jsx("div", {
|
|
243
|
+
css: {
|
|
244
|
+
textOverflow: 'ellipsis',
|
|
245
|
+
overflowX: 'hidden',
|
|
246
|
+
flexGrow: 1,
|
|
247
|
+
whiteSpace: 'nowrap'
|
|
248
|
+
}
|
|
249
|
+
}, children))
|
|
250
|
+
);
|
|
244
251
|
}
|
|
245
252
|
|
|
246
253
|
}
|
|
@@ -62,6 +62,7 @@ export default function createSelect(WrappedComponent) {
|
|
|
62
62
|
const {
|
|
63
63
|
styles,
|
|
64
64
|
validationState,
|
|
65
|
+
isInvalid,
|
|
65
66
|
spacing,
|
|
66
67
|
isMulti,
|
|
67
68
|
appearance,
|
|
@@ -75,12 +76,13 @@ export default function createSelect(WrappedComponent) {
|
|
|
75
76
|
"aria-live": "assertive"
|
|
76
77
|
}, props, {
|
|
77
78
|
components: this.components,
|
|
78
|
-
styles: mergeStyles(baseStyles(validationState, isCompact, this.props.appearance || 'default'), styles)
|
|
79
|
+
styles: mergeStyles(baseStyles(validationState || (isInvalid ? 'error' : 'default'), isCompact, this.props.appearance || 'default'), styles)
|
|
79
80
|
}));
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
}, _defineProperty(_class, "defaultProps", {
|
|
83
84
|
validationState: 'default',
|
|
85
|
+
isInvalid: false,
|
|
84
86
|
spacing: 'default',
|
|
85
87
|
onClickPreventDefault: true,
|
|
86
88
|
tabSelectsValue: false,
|
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, appearance) {
|
|
6
|
+
export default function baseStyles(validationState, isCompact = false, appearance) {
|
|
7
7
|
return {
|
|
8
8
|
container: (css, {
|
|
9
9
|
isDisabled
|
|
@@ -38,7 +38,7 @@ export default function baseStyles(validationState, isCompact, appearance) {
|
|
|
38
38
|
borderColor = `var(--ds-border-success, ${G400})`;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
let borderColorHover = isFocused ? `var(--ds-border-focused, ${B100})` : `var(--ds-border, ${N30})`;
|
|
41
|
+
let borderColorHover = isFocused ? `var(--ds-border-focused, ${B100})` : `var(--ds-border-input, ${N30})`;
|
|
42
42
|
|
|
43
43
|
if (validationState === 'error') {
|
|
44
44
|
borderColorHover = `var(--ds-border-danger, ${R400})`;
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
|
-
import { jsx, css } from '@emotion/
|
|
4
|
+
import { jsx, css } from '@emotion/react';
|
|
5
5
|
import { groupedCountries } from './data/countries';
|
|
6
6
|
import Select from './Select';
|
|
7
7
|
// custom option renderer
|
|
@@ -41,22 +41,23 @@ var canUseDOM = function canUseDOM() {
|
|
|
41
41
|
// ==============================
|
|
42
42
|
// Class
|
|
43
43
|
// ==============================
|
|
44
|
+
var modifiers = [{
|
|
45
|
+
name: 'offset',
|
|
46
|
+
options: {
|
|
47
|
+
offset: [0, 8]
|
|
48
|
+
}
|
|
49
|
+
}, {
|
|
50
|
+
name: 'preventOverflow',
|
|
51
|
+
enabled: true,
|
|
52
|
+
options: {
|
|
53
|
+
padding: 5,
|
|
54
|
+
boundary: 'clippingParents',
|
|
55
|
+
altAxis: true,
|
|
56
|
+
altBoundary: true
|
|
57
|
+
}
|
|
58
|
+
}];
|
|
44
59
|
var defaultPopperProps = {
|
|
45
|
-
modifiers:
|
|
46
|
-
name: 'offset',
|
|
47
|
-
options: {
|
|
48
|
-
offset: [0, 8]
|
|
49
|
-
}
|
|
50
|
-
}, {
|
|
51
|
-
name: 'preventOverflow',
|
|
52
|
-
enabled: true,
|
|
53
|
-
options: {
|
|
54
|
-
padding: 5,
|
|
55
|
-
boundary: 'clippingParents',
|
|
56
|
-
altAxis: true,
|
|
57
|
-
altBoundary: true
|
|
58
|
-
}
|
|
59
|
-
}],
|
|
60
|
+
modifiers: modifiers,
|
|
60
61
|
placement: 'bottom-start'
|
|
61
62
|
};
|
|
62
63
|
|
|
@@ -92,7 +93,7 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
92
93
|
|
|
93
94
|
_defineProperty(_assertThisInitialized(_this), "unbindWindowKeydown", null);
|
|
94
95
|
|
|
95
|
-
_defineProperty(_assertThisInitialized(_this), "defaultStyles", mergeStyles(baseStyles(_this.props.validationState, _this.props.spacing === 'compact', 'default'), {
|
|
96
|
+
_defineProperty(_assertThisInitialized(_this), "defaultStyles", mergeStyles(baseStyles(_this.props.validationState || (_this.props.isInvalid ? 'error' : 'default'), _this.props.spacing === 'compact', 'default'), {
|
|
96
97
|
groupHeading: function groupHeading(provided) {
|
|
97
98
|
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
98
99
|
color: "var(--ds-text-subtlest, ".concat(N80, ")")
|
|
@@ -300,17 +301,19 @@ var PopupSelect = /*#__PURE__*/function (_PureComponent) {
|
|
|
300
301
|
});
|
|
301
302
|
|
|
302
303
|
_defineProperty(_assertThisInitialized(_this), "showSearchControl", function () {
|
|
303
|
-
var
|
|
304
|
-
|
|
304
|
+
var _this$props3 = _this.props,
|
|
305
|
+
searchThreshold = _this$props3.searchThreshold,
|
|
306
|
+
isSearchable = _this$props3.isSearchable;
|
|
307
|
+
return isSearchable && _this.getItemCount() > searchThreshold;
|
|
305
308
|
});
|
|
306
309
|
|
|
307
310
|
_defineProperty(_assertThisInitialized(_this), "renderSelect", function () {
|
|
308
|
-
var _this$
|
|
309
|
-
footer = _this$
|
|
310
|
-
maxMenuWidth = _this$
|
|
311
|
-
minMenuWidth = _this$
|
|
312
|
-
target = _this$
|
|
313
|
-
props = _objectWithoutProperties(_this$
|
|
311
|
+
var _this$props4 = _this.props,
|
|
312
|
+
footer = _this$props4.footer,
|
|
313
|
+
maxMenuWidth = _this$props4.maxMenuWidth,
|
|
314
|
+
minMenuWidth = _this$props4.minMenuWidth,
|
|
315
|
+
target = _this$props4.target,
|
|
316
|
+
props = _objectWithoutProperties(_this$props4, _excluded);
|
|
314
317
|
|
|
315
318
|
var _this$state = _this.state,
|
|
316
319
|
isOpen = _this$state.isOpen,
|
|
@@ -466,6 +469,7 @@ _defineProperty(PopupSelect, "defaultProps", {
|
|
|
466
469
|
maxMenuWidth: 440,
|
|
467
470
|
minMenuWidth: 220,
|
|
468
471
|
popperProps: {},
|
|
472
|
+
isSearchable: true,
|
|
469
473
|
searchThreshold: 5,
|
|
470
474
|
styles: {},
|
|
471
475
|
options: []
|
|
@@ -5,7 +5,7 @@ var _excluded = ["innerRef", "innerProps"],
|
|
|
5
5
|
|
|
6
6
|
/** @jsx jsx */
|
|
7
7
|
import { components } from 'react-select';
|
|
8
|
-
import { jsx } from '@emotion/
|
|
8
|
+
import { jsx } from '@emotion/react';
|
|
9
9
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
10
10
|
import SearchIcon from '@atlaskit/icon/glyph/editor/search';
|
|
11
11
|
import { layers } from '@atlaskit/theme/constants';
|
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.7.0";
|
|
6
6
|
export var SelectWithoutAnalytics = createSelect(Select);
|
|
7
7
|
var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
8
8
|
export default withAnalyticsContext({
|
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
|
|
3
|
+
var _templateObject, _templateObject2;
|
|
4
|
+
|
|
5
|
+
/** @jsx jsx */
|
|
6
|
+
import { jsx, css } from '@emotion/react';
|
|
2
7
|
import { components } from 'react-select';
|
|
3
8
|
import SelectClearIcon from '@atlaskit/icon/glyph/select-clear';
|
|
4
9
|
export { ClearIndicator, DropdownIndicator, LoadingIndicator } from './indicators';
|
|
10
|
+
var disabledProps = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: none;\n"])));
|
|
11
|
+
var enabledProps = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: inherit;\n"])));
|
|
5
12
|
export var MultiValueRemove = function MultiValueRemove(props) {
|
|
6
|
-
|
|
13
|
+
var isDisabled = props.selectProps.isDisabled;
|
|
14
|
+
return jsx(components.MultiValueRemove, props, jsx("div", {
|
|
15
|
+
css: isDisabled ? disabledProps : enabledProps,
|
|
16
|
+
"data-testid": isDisabled ? 'hide-clear-icon' : 'show-clear-icon'
|
|
17
|
+
}, jsx(SelectClearIcon, {
|
|
7
18
|
label: "Clear",
|
|
8
19
|
size: "small",
|
|
9
20
|
primaryColor: "transparent",
|
|
10
21
|
secondaryColor: "inherit"
|
|
11
|
-
}));
|
|
22
|
+
})));
|
|
12
23
|
};
|
|
13
24
|
export var IndicatorSeparator = null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
|
-
import { jsx } from '@emotion/
|
|
4
|
+
import { jsx } from '@emotion/react';
|
|
5
5
|
import { components } from 'react-select';
|
|
6
6
|
import Spinner from '@atlaskit/spinner';
|
|
7
7
|
import SelectClearIcon from '@atlaskit/icon/glyph/select-clear';
|
|
@@ -22,7 +22,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
22
22
|
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; }
|
|
23
23
|
|
|
24
24
|
/** @jsx jsx */
|
|
25
|
-
import { jsx } from '@emotion/
|
|
25
|
+
import { jsx } from '@emotion/react';
|
|
26
26
|
import { Component } from 'react';
|
|
27
27
|
import RadioIcon from '@atlaskit/icon/glyph/radio';
|
|
28
28
|
import CheckboxIcon from '@atlaskit/icon/glyph/checkbox';
|
|
@@ -174,12 +174,12 @@ var getBorderColor = function getBorderColor(_ref3) {
|
|
|
174
174
|
} else if (isFocused && isSelected) {
|
|
175
175
|
return "var(--ds-background-selected-bold-hovered, ".concat(B400, ")");
|
|
176
176
|
} else if (isFocused) {
|
|
177
|
-
return "var(--ds-border, ".concat(N100, ")");
|
|
177
|
+
return "var(--ds-border-input, ".concat(N100, ")");
|
|
178
178
|
} else if (isSelected) {
|
|
179
179
|
return "var(--ds-background-selected-bold, ".concat(B400, ")");
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
return "var(--ds-border, ".concat(N100, ")");
|
|
182
|
+
return "var(--ds-border-input, ".concat(N100, ")");
|
|
183
183
|
};
|
|
184
184
|
|
|
185
185
|
var ControlOption = /*#__PURE__*/function (_Component) {
|
|
@@ -248,37 +248,44 @@ var ControlOption = /*#__PURE__*/function (_Component) {
|
|
|
248
248
|
styles = _getPrimitiveStyles2[0],
|
|
249
249
|
classes = _getPrimitiveStyles2[1];
|
|
250
250
|
|
|
251
|
-
return
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
251
|
+
return (
|
|
252
|
+
/**
|
|
253
|
+
* TODO Fix this type error
|
|
254
|
+
* @see https://product-fabric.atlassian.net/browse/DSP-6063
|
|
255
|
+
*/
|
|
256
|
+
// @ts-ignore
|
|
257
|
+
jsx("div", _extends({
|
|
258
|
+
css: styles,
|
|
259
|
+
className: classes,
|
|
260
|
+
ref: innerRef
|
|
261
|
+
}, props), jsx("div", {
|
|
262
|
+
css: {
|
|
263
|
+
alignItems: 'center',
|
|
264
|
+
display: 'flex ',
|
|
265
|
+
flexShrink: 0,
|
|
266
|
+
paddingRight: '4px',
|
|
267
|
+
// Here we are adding a border to the Checkbox and Radio SVG icons
|
|
268
|
+
// This is an a11y fix for Select only for now but it may be rolled
|
|
269
|
+
// into the `@atlaskit/icon` package's Checkbox and Radio SVGs later
|
|
270
|
+
'& svg rect, & svg circle:first-of-type': {
|
|
271
|
+
stroke: getBorderColor(_objectSpread(_objectSpread({}, this.props), this.state)),
|
|
272
|
+
strokeWidth: '2px',
|
|
273
|
+
strokeLinejoin: 'round'
|
|
274
|
+
}
|
|
268
275
|
}
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
|
|
276
|
+
}, !!Icon ? jsx(Icon, {
|
|
277
|
+
label: "",
|
|
278
|
+
primaryColor: getPrimaryColor(_objectSpread(_objectSpread({}, this.props), this.state)),
|
|
279
|
+
secondaryColor: getSecondaryColor(_objectSpread(_objectSpread({}, this.props), this.state))
|
|
280
|
+
}) : null), jsx("div", {
|
|
281
|
+
css: {
|
|
282
|
+
textOverflow: 'ellipsis',
|
|
283
|
+
overflowX: 'hidden',
|
|
284
|
+
flexGrow: 1,
|
|
285
|
+
whiteSpace: 'nowrap'
|
|
286
|
+
}
|
|
287
|
+
}, children))
|
|
288
|
+
);
|
|
282
289
|
}
|
|
283
290
|
}]);
|
|
284
291
|
|
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", "appearance"];
|
|
11
|
+
var _excluded = ["styles", "validationState", "isInvalid", "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
|
|
|
@@ -92,6 +92,7 @@ export default function createSelect(WrappedComponent) {
|
|
|
92
92
|
var _this$props = this.props,
|
|
93
93
|
styles = _this$props.styles,
|
|
94
94
|
validationState = _this$props.validationState,
|
|
95
|
+
isInvalid = _this$props.isInvalid,
|
|
95
96
|
spacing = _this$props.spacing,
|
|
96
97
|
isMulti = _this$props.isMulti,
|
|
97
98
|
appearance = _this$props.appearance,
|
|
@@ -105,7 +106,7 @@ export default function createSelect(WrappedComponent) {
|
|
|
105
106
|
"aria-live": "assertive"
|
|
106
107
|
}, props, {
|
|
107
108
|
components: this.components,
|
|
108
|
-
styles: mergeStyles(baseStyles(validationState, isCompact, this.props.appearance || 'default'), styles)
|
|
109
|
+
styles: mergeStyles(baseStyles(validationState || (isInvalid ? 'error' : 'default'), isCompact, this.props.appearance || 'default'), styles)
|
|
109
110
|
}));
|
|
110
111
|
}
|
|
111
112
|
}]);
|
|
@@ -113,6 +114,7 @@ export default function createSelect(WrappedComponent) {
|
|
|
113
114
|
return AtlaskitSelect;
|
|
114
115
|
}(Component), _defineProperty(_class, "defaultProps", {
|
|
115
116
|
validationState: 'default',
|
|
117
|
+
isInvalid: false,
|
|
116
118
|
spacing: 'default',
|
|
117
119
|
onClickPreventDefault: true,
|
|
118
120
|
tabSelectsValue: false,
|
package/dist/esm/styles.js
CHANGED
|
@@ -9,7 +9,9 @@ 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
|
|
12
|
+
export default function baseStyles(validationState) {
|
|
13
|
+
var isCompact = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
14
|
+
var appearance = arguments.length > 2 ? arguments[2] : undefined;
|
|
13
15
|
return {
|
|
14
16
|
container: function container(css, _ref) {
|
|
15
17
|
var isDisabled = _ref.isDisabled;
|
|
@@ -46,7 +48,7 @@ export default function baseStyles(validationState, isCompact, appearance) {
|
|
|
46
48
|
borderColor = "var(--ds-border-success, ".concat(G400, ")");
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
var borderColorHover = isFocused ? "var(--ds-border-focused, ".concat(B100, ")") : "var(--ds-border, ".concat(N30, ")");
|
|
51
|
+
var borderColorHover = isFocused ? "var(--ds-border-focused, ".concat(B100, ")") : "var(--ds-border-input, ".concat(N30, ")");
|
|
50
52
|
|
|
51
53
|
if (validationState === 'error') {
|
|
52
54
|
borderColorHover = "var(--ds-border-danger, ".concat(R400, ")");
|
package/dist/esm/version.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
2
3
|
import { groupedCountries } from './data/countries';
|
|
3
4
|
import { SelectProps } from './types';
|
|
4
5
|
declare type Country = typeof groupedCountries[number]['options'][number];
|
|
5
|
-
declare const CountrySelect: (props: SelectProps<Country>) => JSX.Element;
|
|
6
|
+
declare const CountrySelect: (props: SelectProps<Country>) => jsx.JSX.Element;
|
|
6
7
|
export default CountrySelect;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { PureComponent, ReactNode } from 'react';
|
|
2
2
|
import Select from 'react-select';
|
|
3
3
|
import { PopperProps } from 'react-popper';
|
|
4
|
-
import { OptionType, ActionMeta, ReactSelectProps, StylesConfig, ValueType } from '../types';
|
|
4
|
+
import { OptionType, ActionMeta, ReactSelectProps, StylesConfig, ValueType, ValidationState } from '../types';
|
|
5
5
|
import { UnbindFn } from 'bind-event-listener';
|
|
6
6
|
declare type defaultModifiers = 'offset' | 'preventOverflow';
|
|
7
7
|
declare type PopperPropsNoChildren<Modifiers> = Omit<PopperProps<Modifiers>, 'children'>;
|
|
@@ -11,7 +11,8 @@ interface PopupSelectTriggerProps {
|
|
|
11
11
|
'aria-expanded': boolean;
|
|
12
12
|
'aria-controls'?: string;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
declare type ModifierList = 'offset' | 'computeStyles' | 'preventOverflow' | 'handleFlipStyle' | 'flip' | 'popperOffsets' | 'arrow' | 'hide' | string;
|
|
15
|
+
export interface PopupSelectProps<Option = OptionType, IsMulti extends boolean = false, Modifiers = ModifierList> extends ReactSelectProps<Option, IsMulti> {
|
|
15
16
|
/**
|
|
16
17
|
* Defines whether the menu should close when selected. Defaults to "true"
|
|
17
18
|
*/
|
|
@@ -29,9 +30,14 @@ export interface PopupSelectProps<Option = OptionType, IsMulti extends boolean =
|
|
|
29
30
|
*/
|
|
30
31
|
popperProps?: PopperPropsNoChildren<Modifiers>;
|
|
31
32
|
/**
|
|
32
|
-
* The maximum number of options the
|
|
33
|
+
* The maximum number of options the select can contain without rendering the search field. Defaults to 5.
|
|
33
34
|
*/
|
|
34
35
|
searchThreshold?: number;
|
|
36
|
+
/**
|
|
37
|
+
* If false, renders a select with no search field. If true, renders a search field in the select when the
|
|
38
|
+
* number of options exceeds the `searchThreshold`. Defaults to true.
|
|
39
|
+
*/
|
|
40
|
+
isSearchable?: boolean;
|
|
35
41
|
/**
|
|
36
42
|
* The maximum width for the popup menu. Can be a number, representing width in pixels,
|
|
37
43
|
* or a string containing a CSS length datatype.
|
|
@@ -59,6 +65,9 @@ export interface PopupSelectProps<Option = OptionType, IsMulti extends boolean =
|
|
|
59
65
|
}) => ReactNode;
|
|
60
66
|
isOpen?: boolean;
|
|
61
67
|
defaultIsOpen?: boolean;
|
|
68
|
+
spacing?: string;
|
|
69
|
+
validationState?: ValidationState;
|
|
70
|
+
isInvalid?: boolean;
|
|
62
71
|
}
|
|
63
72
|
interface State<Modifiers = string> {
|
|
64
73
|
isOpen: boolean;
|
|
@@ -78,8 +87,8 @@ export default class PopupSelect<Option = OptionType, IsMulti extends boolean =
|
|
|
78
87
|
isOpen: boolean;
|
|
79
88
|
mergedComponents: {
|
|
80
89
|
Control: React.FC<import("../types").ControlProps<OptionType, boolean>>;
|
|
81
|
-
DropdownIndicator: () => JSX.Element;
|
|
82
|
-
Menu: ({ children, innerProps, ...props }: import("../types").MenuProps<OptionType, boolean>) => JSX.Element;
|
|
90
|
+
DropdownIndicator: () => import("@emotion/react").jsx.JSX.Element;
|
|
91
|
+
Menu: ({ children, innerProps, ...props }: import("../types").MenuProps<OptionType, boolean>) => import("@emotion/react").jsx.JSX.Element;
|
|
83
92
|
};
|
|
84
93
|
mergedPopperProps: PopperPropsNoChildren<string>;
|
|
85
94
|
};
|
|
@@ -91,6 +100,7 @@ export default class PopupSelect<Option = OptionType, IsMulti extends boolean =
|
|
|
91
100
|
maxMenuWidth: number;
|
|
92
101
|
minMenuWidth: number;
|
|
93
102
|
popperProps: {};
|
|
103
|
+
isSearchable: boolean;
|
|
94
104
|
searchThreshold: number;
|
|
95
105
|
styles: {};
|
|
96
106
|
options: never[];
|
|
@@ -123,7 +133,7 @@ export default class PopupSelect<Option = OptionType, IsMulti extends boolean =
|
|
|
123
133
|
getSelectRef: (ref: Select<Option, IsMulti>) => void;
|
|
124
134
|
getItemCount: () => number;
|
|
125
135
|
getMaxHeight: () => number | undefined;
|
|
126
|
-
showSearchControl: () => boolean;
|
|
136
|
+
showSearchControl: () => boolean | undefined;
|
|
127
137
|
renderSelect: () => JSX.Element | null;
|
|
128
138
|
render(): JSX.Element;
|
|
129
139
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { FC, ReactNode, CSSProperties } from 'react';
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
3
4
|
import { ControlProps, MenuProps, OptionType } from '../types';
|
|
4
5
|
interface MenuDialogProps {
|
|
5
6
|
maxWidth?: number | string;
|
|
@@ -12,7 +13,7 @@ export declare const MenuDialog: FC<MenuDialogProps>;
|
|
|
12
13
|
export declare const DummyControl: FC<ControlProps<OptionType, boolean>>;
|
|
13
14
|
export declare const defaultComponents: {
|
|
14
15
|
Control: FC<ControlProps<OptionType, boolean>>;
|
|
15
|
-
DropdownIndicator: () => JSX.Element;
|
|
16
|
-
Menu: ({ children, innerProps, ...props }: MenuProps<OptionType, boolean>) => JSX.Element;
|
|
16
|
+
DropdownIndicator: () => jsx.JSX.Element;
|
|
17
|
+
Menu: ({ children, innerProps, ...props }: MenuProps<OptionType, boolean>) => jsx.JSX.Element;
|
|
17
18
|
};
|
|
18
19
|
export {};
|
package/dist/types/Select.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export declare const SelectWithoutAnalytics: {
|
|
|
34
34
|
};
|
|
35
35
|
defaultProps: {
|
|
36
36
|
validationState: string;
|
|
37
|
+
isInvalid: boolean;
|
|
37
38
|
spacing: string;
|
|
38
39
|
onClickPreventDefault: boolean;
|
|
39
40
|
tabSelectsValue: boolean;
|
|
@@ -76,6 +77,7 @@ declare const _default: {
|
|
|
76
77
|
};
|
|
77
78
|
defaultProps: {
|
|
78
79
|
validationState: string;
|
|
80
|
+
isInvalid: boolean;
|
|
79
81
|
spacing: string;
|
|
80
82
|
onClickPreventDefault: boolean;
|
|
81
83
|
tabSelectsValue: boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
2
3
|
export { ClearIndicator, DropdownIndicator, LoadingIndicator, } from './indicators';
|
|
3
|
-
export declare const MultiValueRemove: (props: any) => JSX.Element;
|
|
4
|
+
export declare const MultiValueRemove: (props: any) => jsx.JSX.Element;
|
|
4
5
|
export declare const IndicatorSeparator: null;
|
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, appearance: 'default' | 'subtle' | 'none'): StylesConfig<Option, IsMulti>;
|
|
2
|
+
export default function baseStyles<Option, IsMulti extends boolean>(validationState: ValidationState, isCompact: boolean | undefined, appearance: 'default' | 'subtle' | 'none'): StylesConfig<Option, IsMulti>;
|