@commercetools-uikit/select-utils 15.15.0 → 16.0.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/dist/commercetools-uikit-select-utils.cjs.d.ts +1 -0
- package/dist/commercetools-uikit-select-utils.cjs.d.ts.map +1 -0
- package/dist/commercetools-uikit-select-utils.cjs.dev.js +290 -340
- package/dist/commercetools-uikit-select-utils.cjs.prod.js +289 -337
- package/dist/commercetools-uikit-select-utils.esm.js +290 -340
- package/package.json +10 -10
|
@@ -50,20 +50,20 @@ var messages$1 = reactIntl.defineMessages({
|
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
const _excluded = ["ref", "onMouseDown"];
|
|
54
54
|
|
|
55
55
|
function ownKeys$6(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
56
56
|
|
|
57
57
|
function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$6(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$6(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
const ClearIndicator = props => {
|
|
60
|
+
const intl = reactIntl.useIntl();
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
const getStyles = props.getStyles,
|
|
63
|
+
_props$innerProps = props.innerProps,
|
|
64
|
+
ref = _props$innerProps.ref,
|
|
65
|
+
onMouseDown = _props$innerProps.onMouseDown,
|
|
66
|
+
restInnerProps = _objectWithoutProperties(_props$innerProps, _excluded);
|
|
67
67
|
|
|
68
68
|
return jsxRuntime.jsx("button", _objectSpread$6(_objectSpread$6({}, restInnerProps), {}, {
|
|
69
69
|
ref: ref,
|
|
@@ -88,13 +88,13 @@ function ownKeys$5(object, enumerableOnly) { var keys = _Object$keys__default["d
|
|
|
88
88
|
|
|
89
89
|
function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$5(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$5(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
90
90
|
// see https://github.com/JedWatson/react-select/blob/44e9fb29b230e49a754a2f0d6f30c2250aa45009/src/components/MultiValue.js
|
|
91
|
-
|
|
91
|
+
const removeProps = ['onClick', 'onTouchEnd', 'onMouseDown'];
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
const TagRemove = props => {
|
|
94
|
+
const isDisabled = Boolean(props.selectProps.isDisabled || props.selectProps.isReadOnly); // when the select input is disabled,
|
|
95
95
|
// we don't want to spread the removeProp event handlers
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
const innerProps = isDisabled ? omit__default["default"](props.innerProps, removeProps) : props.innerProps;
|
|
98
98
|
return jsxRuntime.jsx(AccessibleButton__default["default"], _objectSpread$5(_objectSpread$5({
|
|
99
99
|
label: "Remove"
|
|
100
100
|
}, innerProps), {}, {
|
|
@@ -112,14 +112,12 @@ function ownKeys$4(object, enumerableOnly) { var keys = _Object$keys__default["d
|
|
|
112
112
|
|
|
113
113
|
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$4(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$4(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}));
|
|
122
|
-
};
|
|
115
|
+
const DropdownIndicator = props => jsxRuntime.jsx(reactSelect.components.DropdownIndicator, _objectSpread$4(_objectSpread$4({}, props), {}, {
|
|
116
|
+
children: jsxRuntime.jsx(icons.CaretDownIcon, {
|
|
117
|
+
color: props.isDisabled ? 'neutral60' : undefined,
|
|
118
|
+
size: "small"
|
|
119
|
+
})
|
|
120
|
+
}));
|
|
123
121
|
|
|
124
122
|
DropdownIndicator.displayName = 'DropdownIndicator';
|
|
125
123
|
var DropdownIndicator$1 = DropdownIndicator;
|
|
@@ -128,7 +126,7 @@ function ownKeys$3(object, enumerableOnly) { var keys = _Object$keys__default["d
|
|
|
128
126
|
|
|
129
127
|
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$3(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$3(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
130
128
|
|
|
131
|
-
|
|
129
|
+
const SearchIconDropdownIndicator = props => {
|
|
132
130
|
return jsxRuntime.jsx(reactSelect.components.DropdownIndicator, _objectSpread$3(_objectSpread$3({}, props), {}, {
|
|
133
131
|
children: jsxRuntime.jsx(icons.SearchIcon, {
|
|
134
132
|
color: 'neutral60',
|
|
@@ -144,14 +142,14 @@ function ownKeys$2(object, enumerableOnly) { var keys = _Object$keys__default["d
|
|
|
144
142
|
|
|
145
143
|
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$2(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$2(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
146
144
|
|
|
147
|
-
|
|
145
|
+
const getDefaultComponent = type => {
|
|
148
146
|
if (type === 'singleValue') return reactSelect.components.SingleValue;
|
|
149
147
|
if (type === 'placeholder') return reactSelect.components.Placeholder;
|
|
150
148
|
return null;
|
|
151
149
|
};
|
|
152
150
|
|
|
153
|
-
|
|
154
|
-
|
|
151
|
+
const WrapperWithIcon = props => {
|
|
152
|
+
const DefaultComponent = getDefaultComponent(props.type);
|
|
155
153
|
|
|
156
154
|
if (!DefaultComponent) {
|
|
157
155
|
return null;
|
|
@@ -172,21 +170,17 @@ var WrapperWithIcon = function WrapperWithIcon(props) {
|
|
|
172
170
|
|
|
173
171
|
WrapperWithIcon.displayName = 'WrapperWithIcon';
|
|
174
172
|
var WrapperWithIcon$1 = WrapperWithIcon;
|
|
175
|
-
|
|
176
|
-
SingleValue:
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
return jsxRuntime.jsx(WrapperWithIcon, _objectSpread$2(_objectSpread$2({}, props), {}, {
|
|
183
|
-
type: "placeholder"
|
|
184
|
-
}));
|
|
185
|
-
}
|
|
173
|
+
const customComponents = {
|
|
174
|
+
SingleValue: props => jsxRuntime.jsx(WrapperWithIcon, _objectSpread$2(_objectSpread$2({}, props), {}, {
|
|
175
|
+
type: "singleValue"
|
|
176
|
+
})),
|
|
177
|
+
Placeholder: props => jsxRuntime.jsx(WrapperWithIcon, _objectSpread$2(_objectSpread$2({}, props), {}, {
|
|
178
|
+
type: "placeholder"
|
|
179
|
+
}))
|
|
186
180
|
};
|
|
187
181
|
|
|
188
|
-
|
|
189
|
-
|
|
182
|
+
const NO_VALUE_FALLBACK = '- - - -';
|
|
183
|
+
const SELECT_DROPDOWN_OPTION_TYPES = {
|
|
190
184
|
SINGLE_PROPERTY: 'single-property',
|
|
191
185
|
DOUBLE_PROPERTY: 'double-property',
|
|
192
186
|
MULTIPLE_PROPERTIES: 'multiple-properties'
|
|
@@ -195,9 +189,9 @@ var SELECT_DROPDOWN_OPTION_TYPES = {
|
|
|
195
189
|
function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
196
190
|
|
|
197
191
|
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$1(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$1(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
192
|
+
const MultiplePropertiesSelectInputOption = props => {
|
|
193
|
+
const data = props.data;
|
|
194
|
+
const noValueFallback = props.noValueFallback || NO_VALUE_FALLBACK;
|
|
201
195
|
return jsxRuntime.jsx(reactSelect.components.Option, _objectSpread$1(_objectSpread$1({}, props), {}, {
|
|
202
196
|
children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
203
197
|
scale: "xs",
|
|
@@ -213,9 +207,9 @@ var MultiplePropertiesSelectInputOption = function MultiplePropertiesSelectInput
|
|
|
213
207
|
}));
|
|
214
208
|
};
|
|
215
209
|
MultiplePropertiesSelectInputOption.displayName = 'MultiplePropertiesSelectInputOption';
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
210
|
+
const DoublePropertySelectInputOption = props => {
|
|
211
|
+
const data = props.data;
|
|
212
|
+
const noValueFallback = props.noValueFallback || NO_VALUE_FALLBACK;
|
|
219
213
|
return jsxRuntime.jsx(reactSelect.components.Option, _objectSpread$1(_objectSpread$1({}, props), {}, {
|
|
220
214
|
children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
221
215
|
scale: "xs",
|
|
@@ -229,10 +223,10 @@ var DoublePropertySelectInputOption = function DoublePropertySelectInputOption(p
|
|
|
229
223
|
}));
|
|
230
224
|
};
|
|
231
225
|
DoublePropertySelectInputOption.displayName = 'DoublePropertySelectInputOption';
|
|
232
|
-
|
|
226
|
+
const CustomSelectInputOption = props => {
|
|
233
227
|
var _props$optionInnerPro;
|
|
234
228
|
|
|
235
|
-
|
|
229
|
+
const noValueFallback = props.noValueFallback || NO_VALUE_FALLBACK;
|
|
236
230
|
|
|
237
231
|
switch (props.optionType) {
|
|
238
232
|
case SELECT_DROPDOWN_OPTION_TYPES.MULTIPLE_PROPERTIES:
|
|
@@ -287,7 +281,7 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["def
|
|
|
287
281
|
|
|
288
282
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context9, _context10; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context9 = ownKeys(Object(source), !0)).call(_context9, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context10 = ownKeys(Object(source))).call(_context10, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
289
283
|
|
|
290
|
-
|
|
284
|
+
const getControlBorderColor = (props, defaultColor) => {
|
|
291
285
|
if (props.isDisabled) {
|
|
292
286
|
return designSystem.designTokens.borderColorForInputWhenDisabled;
|
|
293
287
|
}
|
|
@@ -307,332 +301,290 @@ var getControlBorderColor = function getControlBorderColor(props, defaultColor)
|
|
|
307
301
|
return defaultColor;
|
|
308
302
|
};
|
|
309
303
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
});
|
|
366
|
-
};
|
|
304
|
+
const controlStyles = props => (base, state) => {
|
|
305
|
+
var _context;
|
|
306
|
+
|
|
307
|
+
return _objectSpread(_objectSpread({}, base), {}, {
|
|
308
|
+
fontSize: designSystem.designTokens.fontSizeForInput,
|
|
309
|
+
backgroundColor: (() => {
|
|
310
|
+
if (props.isDisabled) return designSystem.designTokens.backgroundColorForInputWhenDisabled;
|
|
311
|
+
if (props.isReadOnly) return designSystem.designTokens.backgroundColorForInputWhenReadonly;
|
|
312
|
+
return designSystem.designTokens.backgroundColorForInput;
|
|
313
|
+
})(),
|
|
314
|
+
borderColor: (() => {
|
|
315
|
+
if (props.isDisabled) return designSystem.designTokens.borderColorForInputWhenDisabled;
|
|
316
|
+
if (props.isReadOnly) return designSystem.designTokens.borderColorForSelectInputWhenReadonly;
|
|
317
|
+
if (state.isFocused) return designSystem.designTokens.borderColorForInputWhenFocused;
|
|
318
|
+
if (props.hasError) return designSystem.designTokens.borderColorForInputWhenError;
|
|
319
|
+
if (props.hasWarning) return designSystem.designTokens.borderColorForInputWhenWarning;
|
|
320
|
+
return designSystem.designTokens.borderColorForInput;
|
|
321
|
+
})(),
|
|
322
|
+
borderWidth: (() => {
|
|
323
|
+
if (props.hasWarning || props.hasError) return designSystem.designTokens.borderWidthForSelectInput;
|
|
324
|
+
return designSystem.designTokens.borderWidth1;
|
|
325
|
+
})(),
|
|
326
|
+
borderRadius: designSystem.designTokens.borderRadiusForInput,
|
|
327
|
+
minHeight: designSystem.designTokens.heightForInput,
|
|
328
|
+
cursor: (() => {
|
|
329
|
+
if (props.isDisabled) return 'not-allowed';
|
|
330
|
+
if (props.isReadOnly) return 'default';
|
|
331
|
+
return 'pointer';
|
|
332
|
+
})(),
|
|
333
|
+
padding: "0 ".concat(designSystem.designTokens.paddingForInput),
|
|
334
|
+
transition: _concatInstanceProperty__default["default"](_context = "border-color ".concat(designSystem.designTokens.transitionStandard, ",\n box-shadow ")).call(_context, designSystem.designTokens.transitionStandard),
|
|
335
|
+
outline: 0,
|
|
336
|
+
boxShadow: 'none',
|
|
337
|
+
'&:focus-within': {
|
|
338
|
+
boxShadow: (() => {
|
|
339
|
+
var _context2;
|
|
340
|
+
|
|
341
|
+
if (!props.isDisabled && !props.isReadOnly) return _concatInstanceProperty__default["default"](_context2 = "".concat(designSystem.designTokens.boxShadowForSelectInputWhenFocused, " ")).call(_context2, designSystem.designTokens.borderColorForInputWhenFocused);
|
|
342
|
+
return null;
|
|
343
|
+
})(),
|
|
344
|
+
borderColor: (() => {
|
|
345
|
+
if (!props.isDisabled && !props.isReadOnly) return designSystem.designTokens.borderColorForInputWhenFocused;
|
|
346
|
+
return null;
|
|
347
|
+
})()
|
|
348
|
+
},
|
|
349
|
+
'&:hover': {
|
|
350
|
+
borderColor: getControlBorderColor(props, designSystem.designTokens.borderColorForInputWhenHovered),
|
|
351
|
+
backgroundColor: (() => {
|
|
352
|
+
if (!props.isDisabled && !props.isReadOnly) return designSystem.designTokens.backgroundColorForInputWhenHovered;
|
|
353
|
+
return null;
|
|
354
|
+
})()
|
|
355
|
+
},
|
|
356
|
+
pointerEvents: 'auto',
|
|
357
|
+
color: props.isDisabled || props.isReadOnly ? designSystem.designTokens.fontColorForInputWhenDisabled : base.fontColorForInput
|
|
358
|
+
});
|
|
367
359
|
};
|
|
368
360
|
|
|
369
|
-
|
|
370
|
-
return
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
});
|
|
385
|
-
};
|
|
361
|
+
const menuStyles = props => base => {
|
|
362
|
+
return _objectSpread(_objectSpread({}, base), {}, {
|
|
363
|
+
border: "1px solid ".concat(designSystem.designTokens.borderColorForSelectInputMenu),
|
|
364
|
+
borderRadius: designSystem.designTokens.borderRadiusForInput,
|
|
365
|
+
backgroundColor: designSystem.designTokens.backgroundColorForInput,
|
|
366
|
+
boxShadow: designSystem.designTokens.shadowForSelectInputMenu,
|
|
367
|
+
fontSize: designSystem.designTokens.fontSizeForInput,
|
|
368
|
+
fontFamily: 'inherit',
|
|
369
|
+
margin: "".concat(designSystem.designTokens.spacing10, " 0 0 0"),
|
|
370
|
+
borderColor: (() => {
|
|
371
|
+
if (props.hasError) return designSystem.designTokens.borderColorForSelectInputMenuWhenError;
|
|
372
|
+
if (props.hasWarning) return designSystem.designTokens.borderColorForSelectInputMenuWhenWarning;
|
|
373
|
+
return base.borderColorForInput;
|
|
374
|
+
})()
|
|
375
|
+
});
|
|
386
376
|
};
|
|
387
377
|
|
|
388
|
-
|
|
389
|
-
return
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
});
|
|
396
|
-
};
|
|
378
|
+
const indicatorSeparatorStyles = () => base => {
|
|
379
|
+
return _objectSpread(_objectSpread({}, base), {}, {
|
|
380
|
+
display: 'none',
|
|
381
|
+
margin: '0',
|
|
382
|
+
padding: '0',
|
|
383
|
+
marginLeft: designSystem.designTokens.spacing10
|
|
384
|
+
});
|
|
397
385
|
};
|
|
398
386
|
|
|
399
|
-
|
|
400
|
-
return
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
});
|
|
413
|
-
};
|
|
387
|
+
const dropdownIndicatorStyles = props => base => {
|
|
388
|
+
return _objectSpread(_objectSpread({}, base), {}, {
|
|
389
|
+
color: designSystem.designTokens.fontColorForInput,
|
|
390
|
+
margin: '0',
|
|
391
|
+
padding: '0',
|
|
392
|
+
marginLeft: designSystem.designTokens.marginForSelectInputIcon,
|
|
393
|
+
fill: (() => {
|
|
394
|
+
if (props.isDisabled || props.isReadOnly) return designSystem.designTokens.fontColorForInputWhenDisabled;
|
|
395
|
+
if (props.hasError) return designSystem.designTokens.fontColorForSelectInputIconWhenError;
|
|
396
|
+
if (props.hasWarning) return designSystem.designTokens.fontColorForSelectInputIconWhenWarning;
|
|
397
|
+
return designSystem.designTokens.fontColorForSelectInputIcon;
|
|
398
|
+
})()
|
|
399
|
+
});
|
|
414
400
|
};
|
|
415
401
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
marginLeft: designSystem.designTokens.marginForSelectInputIcon
|
|
422
|
-
});
|
|
423
|
-
};
|
|
424
|
-
};
|
|
402
|
+
const clearIndicatorStyles = () => base => _objectSpread(_objectSpread({}, base), {}, {
|
|
403
|
+
display: 'flex',
|
|
404
|
+
padding: 0,
|
|
405
|
+
marginLeft: designSystem.designTokens.marginForSelectInputIcon
|
|
406
|
+
});
|
|
425
407
|
|
|
426
|
-
|
|
427
|
-
return
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
});
|
|
433
|
-
};
|
|
408
|
+
const menuListStyles = () => base => {
|
|
409
|
+
return _objectSpread(_objectSpread({}, base), {}, {
|
|
410
|
+
padding: designSystem.designTokens.paddingForSelectInputMenu,
|
|
411
|
+
borderRadius: designSystem.designTokens.borderRadiusForInput,
|
|
412
|
+
backgroundColor: designSystem.designTokens.backgroundColorForInput
|
|
413
|
+
});
|
|
434
414
|
};
|
|
435
415
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
416
|
+
const optionStyles = () => (base, state) => {
|
|
417
|
+
var _context3, _context4;
|
|
418
|
+
|
|
419
|
+
return _objectSpread(_objectSpread({}, base), {}, {
|
|
420
|
+
transition: _concatInstanceProperty__default["default"](_context3 = _concatInstanceProperty__default["default"](_context4 = "border-color ".concat(designSystem.designTokens.transitionStandard, ",\n background-color ")).call(_context4, designSystem.designTokens.transitionStandard, ",\n color ")).call(_context3, designSystem.designTokens.transitionStandard),
|
|
421
|
+
paddingLeft: designSystem.designTokens.paddingLeftForSelectInputOptions,
|
|
422
|
+
paddingRight: designSystem.designTokens.paddingRightForSelectInputOptions,
|
|
423
|
+
paddingTop: designSystem.designTokens.paddingTopForSelectInputOptions,
|
|
424
|
+
paddingBottom: designSystem.designTokens.paddingBottomForSelectInputOptions,
|
|
425
|
+
lineHeight: designSystem.designTokens.lineHeightForSelectInputOptions,
|
|
426
|
+
color: (() => {
|
|
427
|
+
if (!state.isDisabled) return designSystem.designTokens.fontColorForInput;
|
|
428
|
+
if (state.isSelected) return designSystem.designTokens.fontColorForInput;
|
|
429
|
+
return base.color;
|
|
430
|
+
})(),
|
|
431
|
+
backgroundColor: (() => {
|
|
432
|
+
if (state.isSelected) return designSystem.designTokens.backgroundColorForInputWhenSelected;
|
|
433
|
+
if (state.isFocused) return designSystem.designTokens.backgroundColorForSelectInputOptionWhenHovered;
|
|
434
|
+
return base.backgroundColor;
|
|
435
|
+
})(),
|
|
436
|
+
'&:active': {
|
|
437
|
+
color: (() => {
|
|
448
438
|
if (!state.isDisabled) return designSystem.designTokens.fontColorForInput;
|
|
449
|
-
if (state.isSelected) return designSystem.designTokens.fontColorForInput;
|
|
450
439
|
return base.color;
|
|
451
|
-
}(),
|
|
452
|
-
backgroundColor:
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
return base.backgroundColor;
|
|
456
|
-
}(),
|
|
457
|
-
'&:active': {
|
|
458
|
-
color: function () {
|
|
459
|
-
if (!state.isDisabled) return designSystem.designTokens.fontColorForInput;
|
|
460
|
-
return base.color;
|
|
461
|
-
}(),
|
|
462
|
-
backgroundColor: designSystem.designTokens.backgroundColorForInputWhenActive
|
|
463
|
-
}
|
|
464
|
-
});
|
|
465
|
-
};
|
|
466
|
-
};
|
|
467
|
-
|
|
468
|
-
var placeholderStyles = function placeholderStyles(props) {
|
|
469
|
-
return function (base) {
|
|
470
|
-
return _objectSpread(_objectSpread({}, base), {}, {
|
|
471
|
-
color: function () {
|
|
472
|
-
return designSystem.designTokens.placeholderFontColorForInput;
|
|
473
|
-
}(),
|
|
474
|
-
width: '100%',
|
|
475
|
-
overflow: 'hidden',
|
|
476
|
-
whiteSpace: 'nowrap',
|
|
477
|
-
textOverflow: 'ellipsis',
|
|
478
|
-
fill: props.isDisabled || props.isReadOnly ? designSystem.designTokens.fontColorForInputWhenDisabled : base.fontColorForInput
|
|
479
|
-
});
|
|
480
|
-
};
|
|
440
|
+
})(),
|
|
441
|
+
backgroundColor: designSystem.designTokens.backgroundColorForInputWhenActive
|
|
442
|
+
}
|
|
443
|
+
});
|
|
481
444
|
};
|
|
482
445
|
|
|
483
|
-
|
|
484
|
-
return
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
});
|
|
495
|
-
};
|
|
446
|
+
const placeholderStyles = props => base => {
|
|
447
|
+
return _objectSpread(_objectSpread({}, base), {}, {
|
|
448
|
+
color: (() => {
|
|
449
|
+
return designSystem.designTokens.placeholderFontColorForInput;
|
|
450
|
+
})(),
|
|
451
|
+
width: '100%',
|
|
452
|
+
overflow: 'hidden',
|
|
453
|
+
whiteSpace: 'nowrap',
|
|
454
|
+
textOverflow: 'ellipsis',
|
|
455
|
+
fill: props.isDisabled || props.isReadOnly ? designSystem.designTokens.fontColorForInputWhenDisabled : base.fontColorForInput
|
|
456
|
+
});
|
|
496
457
|
};
|
|
497
458
|
|
|
498
|
-
|
|
499
|
-
return
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
if (props.hasError) return designSystem.designTokens.fontColorForSelectInputWhenError;
|
|
511
|
-
if (props.hasWarning) return designSystem.designTokens.fontColorForSelectInputWhenWarning;
|
|
512
|
-
return designSystem.designTokens.fontColorForInput;
|
|
513
|
-
}()
|
|
514
|
-
});
|
|
515
|
-
};
|
|
459
|
+
const valueContainerStyles = props => base => {
|
|
460
|
+
return _objectSpread(_objectSpread({}, base), {}, {
|
|
461
|
+
padding: '0',
|
|
462
|
+
backgroundColor: 'none',
|
|
463
|
+
overflow: 'hidden',
|
|
464
|
+
// Display property should be grid when isMulti and has no value so the Placeholder component is positioned correctly with the Input
|
|
465
|
+
// Display property should be Flex when there is an iconLeft, also when the input has some values when isMulti.
|
|
466
|
+
// See PR from react select for more insight https://github.com/JedWatson/react-select/pull/4833
|
|
467
|
+
display: props.iconLeft && !props.isMulti || props.isMulti && props.hasValue && props.controlShouldRenderValue ? 'flex' : 'grid',
|
|
468
|
+
fill: props.isDisabled || props.isReadOnly ? designSystem.designTokens.fontColorForInputWhenDisabled : designSystem.designTokens.fontColorForSelectInputIcon
|
|
469
|
+
});
|
|
516
470
|
};
|
|
517
471
|
|
|
518
|
-
|
|
519
|
-
return
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
borderTop: props.showOptionGroupDivider ? "1px solid ".concat(designSystem.designTokens.borderColorForGroupHeadingSelectInputOptions) : base.borderTop
|
|
472
|
+
const singleValueStyles = props => base => {
|
|
473
|
+
return _objectSpread(_objectSpread({}, base), {}, {
|
|
474
|
+
color: (() => {
|
|
475
|
+
if (props.isDisabled) {
|
|
476
|
+
return designSystem.designTokens.fontColorForInputWhenDisabled;
|
|
524
477
|
}
|
|
525
|
-
});
|
|
526
|
-
};
|
|
527
|
-
};
|
|
528
478
|
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
var _context5;
|
|
532
|
-
|
|
533
|
-
return _objectSpread(_objectSpread({}, base), {}, {
|
|
534
|
-
color: designSystem.designTokens.fontColorForInputWhenReadonly,
|
|
535
|
-
fontSize: designSystem.designTokens.fontSizeSmall,
|
|
536
|
-
textTransform: 'none',
|
|
537
|
-
fontWeight: 'bold',
|
|
538
|
-
padding: _concatInstanceProperty__default["default"](_context5 = "".concat(designSystem.designTokens.spacing20, " ")).call(_context5, designSystem.designTokens.paddingForGroupHeadingSelectInputOptions),
|
|
539
|
-
'&:empty': {
|
|
540
|
-
padding: 0
|
|
479
|
+
if (props.isReadOnly) {
|
|
480
|
+
return designSystem.designTokens.fontColorForInputWhenReadonly;
|
|
541
481
|
}
|
|
542
|
-
});
|
|
543
|
-
};
|
|
544
|
-
};
|
|
545
482
|
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
borderRadius: designSystem.designTokens.borderRadiusForInput,
|
|
552
|
-
borderColor: state.isFocused ? designSystem.designTokens.borderColorForInputWhenFocused : base.borderColor,
|
|
553
|
-
boxShadow: state.isFocused ? 'none' : base.boxShadow
|
|
554
|
-
});
|
|
555
|
-
};
|
|
483
|
+
if (props.hasError) return designSystem.designTokens.fontColorForSelectInputWhenError;
|
|
484
|
+
if (props.hasWarning) return designSystem.designTokens.fontColorForSelectInputWhenWarning;
|
|
485
|
+
return designSystem.designTokens.fontColorForInput;
|
|
486
|
+
})()
|
|
487
|
+
});
|
|
556
488
|
};
|
|
557
489
|
|
|
558
|
-
|
|
559
|
-
return
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
};
|
|
490
|
+
const groupStyles = props => base => {
|
|
491
|
+
return _objectSpread(_objectSpread({}, base), {}, {
|
|
492
|
+
padding: 0,
|
|
493
|
+
'&:not(:first-of-type)': {
|
|
494
|
+
borderTop: props.showOptionGroupDivider ? "1px solid ".concat(designSystem.designTokens.borderColorForGroupHeadingSelectInputOptions) : base.borderTop
|
|
495
|
+
}
|
|
496
|
+
});
|
|
566
497
|
};
|
|
567
498
|
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
499
|
+
const groupHeadingStyles = () => base => {
|
|
500
|
+
var _context5;
|
|
501
|
+
|
|
502
|
+
return _objectSpread(_objectSpread({}, base), {}, {
|
|
503
|
+
color: designSystem.designTokens.fontColorForInputWhenReadonly,
|
|
504
|
+
fontSize: designSystem.designTokens.fontSizeSmall,
|
|
505
|
+
textTransform: 'none',
|
|
506
|
+
fontWeight: 'bold',
|
|
507
|
+
padding: _concatInstanceProperty__default["default"](_context5 = "".concat(designSystem.designTokens.spacing20, " ")).call(_context5, designSystem.designTokens.paddingForGroupHeadingSelectInputOptions),
|
|
508
|
+
'&:empty': {
|
|
509
|
+
padding: 0
|
|
510
|
+
}
|
|
511
|
+
});
|
|
574
512
|
};
|
|
575
513
|
|
|
576
|
-
|
|
577
|
-
return
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
border: designSystem.designTokens.borderForSelectInputTag
|
|
585
|
-
});
|
|
586
|
-
};
|
|
514
|
+
const containerStyles = () => (base, state) => {
|
|
515
|
+
return _objectSpread(_objectSpread({}, base), {}, {
|
|
516
|
+
fontFamily: 'inherit',
|
|
517
|
+
minHeight: designSystem.designTokens.sizeHeightInput,
|
|
518
|
+
borderRadius: designSystem.designTokens.borderRadiusForInput,
|
|
519
|
+
borderColor: state.isFocused ? designSystem.designTokens.borderColorForInputWhenFocused : base.borderColor,
|
|
520
|
+
boxShadow: state.isFocused ? 'none' : base.boxShadow
|
|
521
|
+
});
|
|
587
522
|
};
|
|
588
523
|
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
524
|
+
const indicatorsContainerStyles = () => () => ({
|
|
525
|
+
background: 'none',
|
|
526
|
+
display: 'flex',
|
|
527
|
+
alignItems: 'center'
|
|
528
|
+
});
|
|
592
529
|
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
530
|
+
const menuPortalStyles = props => base => _objectSpread(_objectSpread({}, base), {}, {
|
|
531
|
+
zIndex: props.menuPortalZIndex
|
|
532
|
+
});
|
|
533
|
+
|
|
534
|
+
const multiValueStyles = () => base => {
|
|
535
|
+
return _objectSpread(_objectSpread({}, base), {}, {
|
|
536
|
+
display: 'flex',
|
|
537
|
+
alignItems: designSystem.designTokens.alignItemsForSelectInputTag,
|
|
538
|
+
height: designSystem.designTokens.heightForSelectInputTag,
|
|
539
|
+
backgroundColor: designSystem.designTokens.backgroundColorForTag,
|
|
540
|
+
padding: '0',
|
|
541
|
+
border: designSystem.designTokens.borderForSelectInputTag
|
|
542
|
+
});
|
|
543
|
+
};
|
|
544
|
+
|
|
545
|
+
const multiValueLabelStyles = props => base => {
|
|
546
|
+
var _context6, _context7;
|
|
547
|
+
|
|
548
|
+
return _objectSpread(_objectSpread({}, base), {}, {
|
|
549
|
+
fontSize: designSystem.designTokens.fontSizeForSelectInputTag,
|
|
550
|
+
color: (() => {
|
|
551
|
+
if (props.isDisabled) return designSystem.designTokens.fontColorForInputWhenDisabled;
|
|
552
|
+
if (props.isReadOnly) return designSystem.designTokens.fontColorForInputWhenReadonly;
|
|
553
|
+
return base.color;
|
|
554
|
+
})(),
|
|
555
|
+
padding: _concatInstanceProperty__default["default"](_context6 = "".concat(designSystem.designTokens.spacing10, " ")).call(_context6, designSystem.designTokens.spacing20),
|
|
556
|
+
borderRadius: _concatInstanceProperty__default["default"](_context7 = "".concat(designSystem.designTokens.borderRadiusForTag, " 0 0 ")).call(_context7, designSystem.designTokens.borderRadiusForTag),
|
|
557
|
+
border: props.isNewTheme ? 'none' : "1px ".concat(designSystem.designTokens.borderColorForTag, " solid"),
|
|
558
|
+
borderWidth: '1px 0 1px 1px',
|
|
559
|
+
'&:last-child': {
|
|
560
|
+
borderRadius: designSystem.designTokens.borderRadiusForTag,
|
|
561
|
+
borderWidth: designSystem.designTokens.borderWidth1
|
|
562
|
+
}
|
|
563
|
+
});
|
|
610
564
|
};
|
|
611
565
|
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
566
|
+
const multiValueRemoveStyles = props => (base, state) => {
|
|
567
|
+
var _context8;
|
|
568
|
+
|
|
569
|
+
return _objectSpread(_objectSpread({}, base), {}, {
|
|
570
|
+
borderColor: designSystem.designTokens.borderColorForTag,
|
|
571
|
+
padding: "0 ".concat(designSystem.designTokens.spacing10),
|
|
572
|
+
borderRadius: _concatInstanceProperty__default["default"](_context8 = "0 ".concat(designSystem.designTokens.borderRadiusForTag, " ")).call(_context8, designSystem.designTokens.borderRadiusForTag, " 0"),
|
|
573
|
+
borderStyle: !props.isNewTheme ? 'solid' : 'none',
|
|
574
|
+
borderWidth: !props.isNewTheme ? designSystem.designTokens.borderWidth1 : '0',
|
|
575
|
+
pointerEvents: state.isDisabled || props.isReadOnly ? 'none' : base.pointerEvents,
|
|
576
|
+
backgroundColor: designSystem.designTokens.backgroundColorForTag,
|
|
577
|
+
'svg *': {
|
|
578
|
+
fill: props.isReadOnly ? designSystem.designTokens.fontColorForInputWhenReadonly : ''
|
|
579
|
+
},
|
|
580
|
+
'&:hover, &:focus': {
|
|
581
|
+
borderColor: designSystem.designTokens.borderColorForTagWarning,
|
|
623
582
|
backgroundColor: designSystem.designTokens.backgroundColorForTag,
|
|
624
583
|
'svg *': {
|
|
625
|
-
fill:
|
|
626
|
-
},
|
|
627
|
-
'&:hover, &:focus': {
|
|
628
|
-
borderColor: designSystem.designTokens.borderColorForTagWarning,
|
|
629
|
-
backgroundColor: designSystem.designTokens.backgroundColorForTag,
|
|
630
|
-
'svg *': {
|
|
631
|
-
fill: designSystem.designTokens.fontColorForClearInputIconWhenHovered
|
|
632
|
-
}
|
|
584
|
+
fill: designSystem.designTokens.fontColorForClearInputIconWhenHovered
|
|
633
585
|
}
|
|
634
|
-
}
|
|
635
|
-
};
|
|
586
|
+
}
|
|
587
|
+
});
|
|
636
588
|
};
|
|
637
589
|
|
|
638
590
|
function createSelectStyles(props) {
|
|
@@ -658,13 +610,13 @@ function createSelectStyles(props) {
|
|
|
658
610
|
};
|
|
659
611
|
}
|
|
660
612
|
|
|
661
|
-
|
|
613
|
+
const warnIfMenuPortalPropsAreMissing = props => {
|
|
662
614
|
if (typeof props.menuPortalZIndex !== 'undefined' && props.menuPortalZIndex !== 1 // 1 is the value passed in default props
|
|
663
615
|
) ;
|
|
664
616
|
};
|
|
665
617
|
|
|
666
618
|
// NOTE: This string will be replaced on build time with the package version.
|
|
667
|
-
var version = "
|
|
619
|
+
var version = "16.0.0";
|
|
668
620
|
|
|
669
621
|
exports.ClearIndicator = ClearIndicator$1;
|
|
670
622
|
exports.CustomSelectInputOption = CustomSelectInputOption;
|