@commercetools-uikit/selectable-search-input 16.1.0 → 16.1.1
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-selectable-search-input.cjs.dev.js +14 -36
- package/dist/commercetools-uikit-selectable-search-input.cjs.prod.js +8 -28
- package/dist/commercetools-uikit-selectable-search-input.esm.js +15 -37
- package/dist/declarations/src/selectable-search-input.styles.d.ts +27 -29
- package/dist/declarations/src/selectable-select.d.ts +0 -2
- package/package.json +9 -9
|
@@ -121,14 +121,11 @@ const createSelectableSelectStyles = _ref => {
|
|
|
121
121
|
isDisabled = _ref.isDisabled,
|
|
122
122
|
isReadOnly = _ref.isReadOnly,
|
|
123
123
|
menuPortalZIndex = _ref.menuPortalZIndex,
|
|
124
|
-
|
|
125
|
-
dropdownHasFocus = _ref.dropdownHasFocus,
|
|
126
|
-
textInputHasFocus = _ref.textInputHasFocus;
|
|
124
|
+
dropdownHasFocus = _ref.dropdownHasFocus;
|
|
127
125
|
const selectStyles = selectUtils.createSelectStyles({
|
|
128
126
|
hasWarning,
|
|
129
127
|
hasError,
|
|
130
128
|
menuPortalZIndex,
|
|
131
|
-
isNewTheme,
|
|
132
129
|
isDisabled,
|
|
133
130
|
isReadOnly
|
|
134
131
|
});
|
|
@@ -144,9 +141,6 @@ const createSelectableSelectStyles = _ref => {
|
|
|
144
141
|
if (isReadOnly) return "".concat(designSystem.designTokens.borderColorForInputWhenReadonly, " !important");
|
|
145
142
|
if (hasError) return designSystem.designTokens.borderColorForInputWhenError;
|
|
146
143
|
if (hasWarning) return designSystem.designTokens.borderColorForInputWhenWarning;
|
|
147
|
-
if (textInputHasFocus && !isNewTheme) {
|
|
148
|
-
return designSystem.designTokens.borderColorForInputWhenFocused;
|
|
149
|
-
}
|
|
150
144
|
if (dropdownHasFocus) {
|
|
151
145
|
return designSystem.designTokens.borderColorForInputWhenFocused;
|
|
152
146
|
}
|
|
@@ -200,17 +194,13 @@ const SingleValue = _ref => {
|
|
|
200
194
|
SingleValue.propTypes = {};
|
|
201
195
|
const SelectableSelect = props => {
|
|
202
196
|
const intl = reactIntl.useIntl();
|
|
203
|
-
const _useTheme = designSystem.useTheme(),
|
|
204
|
-
isNewTheme = _useTheme.isNewTheme;
|
|
205
197
|
const dropdownStyles = createSelectableSelectStyles({
|
|
206
198
|
hasWarning: props.hasWarning,
|
|
207
199
|
hasError: props.hasError,
|
|
208
200
|
isDisabled: props.isDisabled,
|
|
209
201
|
isReadOnly: props.isReadOnly,
|
|
210
202
|
menuPortalZIndex: props.menuPortalZIndex,
|
|
211
|
-
|
|
212
|
-
dropdownHasFocus: props.dropdownHasFocus,
|
|
213
|
-
textInputHasFocus: props.textInputHasFocus
|
|
203
|
+
dropdownHasFocus: props.dropdownHasFocus
|
|
214
204
|
});
|
|
215
205
|
const onChange = props.onChange,
|
|
216
206
|
name = props.name,
|
|
@@ -288,20 +278,14 @@ const SelectableSearchInput = props => {
|
|
|
288
278
|
var _context;
|
|
289
279
|
const _useToggleState = hooks.useToggleState(false),
|
|
290
280
|
_useToggleState2 = _slicedToArray(_useToggleState, 2),
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
const _useToggleState3 = hooks.useToggleState(false),
|
|
294
|
-
_useToggleState4 = _slicedToArray(_useToggleState3, 2),
|
|
295
|
-
dropdownHasFocus = _useToggleState4[0],
|
|
296
|
-
toggleDropdownHasFocus = _useToggleState4[1];
|
|
281
|
+
dropdownHasFocus = _useToggleState2[0],
|
|
282
|
+
toggleDropdownHasFocus = _useToggleState2[1];
|
|
297
283
|
const _useState = react$1.useState(props.value.text || ''),
|
|
298
284
|
_useState2 = _slicedToArray(_useState, 2),
|
|
299
285
|
searchValue = _useState2[0],
|
|
300
286
|
setSearchValue = _useState2[1];
|
|
301
287
|
const containerRef = react$1.useRef(null);
|
|
302
288
|
const textInputRef = react$1.useRef(null);
|
|
303
|
-
const _useTheme = designSystem.useTheme(),
|
|
304
|
-
isNewTheme = _useTheme.isNewTheme;
|
|
305
289
|
const optionsWithoutGroups = _flatMapInstanceProperty__default["default"](_context = props.options).call(_context, option => {
|
|
306
290
|
if (isOptionObject(option)) {
|
|
307
291
|
return option.options;
|
|
@@ -328,8 +312,7 @@ const SelectableSearchInput = props => {
|
|
|
328
312
|
}
|
|
329
313
|
});
|
|
330
314
|
}
|
|
331
|
-
|
|
332
|
-
}, [toggleTextInputHasFocus, onFocus, selectablSearchInputId, name]);
|
|
315
|
+
}, [onFocus, selectablSearchInputId, name]);
|
|
333
316
|
const handleTextInputBlur = react$1.useCallback(() => {
|
|
334
317
|
if (onBlur) {
|
|
335
318
|
onBlur({
|
|
@@ -339,8 +322,7 @@ const SelectableSearchInput = props => {
|
|
|
339
322
|
}
|
|
340
323
|
});
|
|
341
324
|
}
|
|
342
|
-
|
|
343
|
-
}, [toggleTextInputHasFocus, onBlur, selectablSearchInputId, name]);
|
|
325
|
+
}, [onBlur, selectablSearchInputId, name]);
|
|
344
326
|
const handleClear = () => {
|
|
345
327
|
setSearchValue('');
|
|
346
328
|
if (props.onReset) {
|
|
@@ -423,16 +405,14 @@ const SelectableSearchInput = props => {
|
|
|
423
405
|
children: jsxRuntime.jsx(SelectableSelect$1, _objectSpread(_objectSpread({}, props), {}, {
|
|
424
406
|
id: SelectableSearchInput.getDropdownId(selectablSearchInputId),
|
|
425
407
|
name: getDropdownName(props.name),
|
|
426
|
-
textInputHasFocus: textInputHasFocus,
|
|
427
408
|
dropdownHasFocus: dropdownHasFocus,
|
|
428
409
|
handleDropdownFocus: handleDropdownFocus,
|
|
429
410
|
handleDropdownBlur: handleDropdownBlur,
|
|
430
|
-
isNewTheme: isNewTheme,
|
|
431
411
|
textInputRef: textInputRef,
|
|
432
412
|
selectedOption: selectedOption
|
|
433
413
|
}))
|
|
434
414
|
}), jsxRuntime.jsxs("div", {
|
|
435
|
-
css: [getSelectableSearchInputContainerStyles(props), dropdownHasFocus &&
|
|
415
|
+
css: [getSelectableSearchInputContainerStyles(props), dropdownHasFocus && !props.isReadOnly && /*#__PURE__*/react.css("border-left-color:", designSystem.designTokens.borderColorForInputWhenFocused, ";&:hover{border-left-color:", designSystem.designTokens.borderColorForInputWhenFocused, ";}" + ("" ), "" ), "" , "" ],
|
|
436
416
|
children: [jsxRuntime.jsx("input", _objectSpread(_objectSpread({
|
|
437
417
|
ref: textInputRef,
|
|
438
418
|
id: SelectableSearchInput.getTextInputId(selectablSearchInputId),
|
|
@@ -489,7 +469,7 @@ SelectableSearchInput.getDropdownId = getDropdownName;
|
|
|
489
469
|
var SelectableSearchInput$1 = SelectableSearchInput;
|
|
490
470
|
|
|
491
471
|
// NOTE: This string will be replaced on build time with the package version.
|
|
492
|
-
var version = "16.1.
|
|
472
|
+
var version = "16.1.1";
|
|
493
473
|
|
|
494
474
|
exports["default"] = SelectableSearchInput$1;
|
|
495
475
|
exports.version = version;
|