@commercetools-uikit/selectable-search-input 19.26.0 → 20.1.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-selectable-search-input.cjs.dev.js +14 -69
- package/dist/commercetools-uikit-selectable-search-input.cjs.prod.js +10 -12
- package/dist/commercetools-uikit-selectable-search-input.esm.js +14 -68
- package/dist/declarations/src/selectable-search-input.d.ts +1 -1
- package/package.json +16 -17
|
@@ -14,7 +14,6 @@ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
|
14
14
|
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
15
15
|
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
16
16
|
var _styled = require('@emotion/styled/base');
|
|
17
|
-
require('prop-types');
|
|
18
17
|
var _Object$fromEntries = require('@babel/runtime-corejs3/core-js-stable/object/from-entries');
|
|
19
18
|
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
20
19
|
var _Object$entries = require('@babel/runtime-corejs3/core-js-stable/object/entries');
|
|
@@ -207,7 +206,6 @@ const SingleValue = _ref => {
|
|
|
207
206
|
}))
|
|
208
207
|
}));
|
|
209
208
|
};
|
|
210
|
-
SingleValue.propTypes = {};
|
|
211
209
|
const SelectableSelect = props => {
|
|
212
210
|
const intl = reactIntl.useIntl();
|
|
213
211
|
const dropdownStyles = createSelectableSelectStyles({
|
|
@@ -252,10 +250,9 @@ const SelectableSelect = props => {
|
|
|
252
250
|
})
|
|
253
251
|
});
|
|
254
252
|
};
|
|
255
|
-
SelectableSelect.propTypes = {};
|
|
256
253
|
var SelectableSelect$1 = SelectableSelect;
|
|
257
254
|
|
|
258
|
-
const _excluded = ["horizontalConstraint", "isClearable", "menuHorizontalConstraint", "showSubmitButton", "menuPortalZIndex"];
|
|
255
|
+
const _excluded = ["horizontalConstraint", "isClearable", "menuHorizontalConstraint", "showSubmitButton", "menuPortalZIndex", "onChange"];
|
|
259
256
|
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
260
257
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context4, _context5; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(t), !0)).call(_context4, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context5 = ownKeys(Object(t))).call(_context5, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
261
258
|
const Container = /*#__PURE__*/_styled__default["default"]("div", {
|
|
@@ -289,6 +286,7 @@ const SelectableSearchInput = _ref3 => {
|
|
|
289
286
|
showSubmitButton = _ref3$showSubmitButto === void 0 ? true : _ref3$showSubmitButto,
|
|
290
287
|
_ref3$menuPortalZInde = _ref3.menuPortalZIndex,
|
|
291
288
|
menuPortalZIndex = _ref3$menuPortalZInde === void 0 ? 1 : _ref3$menuPortalZInde,
|
|
289
|
+
onChange = _ref3.onChange,
|
|
292
290
|
props = _objectWithoutProperties(_ref3, _excluded);
|
|
293
291
|
const _useToggleState = hooks.useToggleState(false),
|
|
294
292
|
_useToggleState2 = _slicedToArray(_useToggleState, 2),
|
|
@@ -309,7 +307,8 @@ const SelectableSearchInput = _ref3 => {
|
|
|
309
307
|
isClearable,
|
|
310
308
|
menuHorizontalConstraint,
|
|
311
309
|
showSubmitButton,
|
|
312
|
-
menuPortalZIndex
|
|
310
|
+
menuPortalZIndex,
|
|
311
|
+
onChange
|
|
313
312
|
}, props);
|
|
314
313
|
const legacyDataProps = utils.filterDataAttributes(props);
|
|
315
314
|
const transformedSelectDataProps = transformDataProps(props.selectDataProps);
|
|
@@ -362,8 +361,8 @@ const SelectableSearchInput = _ref3 => {
|
|
|
362
361
|
};
|
|
363
362
|
const handleTextInputChange = event => {
|
|
364
363
|
setSearchValue(event.target.value);
|
|
365
|
-
if (
|
|
366
|
-
|
|
364
|
+
if (onChange) {
|
|
365
|
+
onChange({
|
|
367
366
|
target: {
|
|
368
367
|
id: SelectableSearchInput.getTextInputId(selectablSearchInputId),
|
|
369
368
|
name: getTextInputName(props.name),
|
|
@@ -425,8 +424,8 @@ const SelectableSearchInput = _ref3 => {
|
|
|
425
424
|
}, [onBlur, selectablSearchInputId, name]);
|
|
426
425
|
const handleDropdownChange = react$1.useCallback(nextSelectedOptions => {
|
|
427
426
|
setSearchOption(nextSelectedOptions.value);
|
|
428
|
-
if (
|
|
429
|
-
|
|
427
|
+
if (onChange) {
|
|
428
|
+
onChange({
|
|
430
429
|
target: {
|
|
431
430
|
id: SelectableSearchInput.getDropdownId(selectablSearchInputId),
|
|
432
431
|
name: getDropdownName(name),
|
|
@@ -435,7 +434,7 @@ const SelectableSearchInput = _ref3 => {
|
|
|
435
434
|
});
|
|
436
435
|
}
|
|
437
436
|
textInputRef.current?.focus();
|
|
438
|
-
}, [
|
|
437
|
+
}, [onChange, selectablSearchInputId, name]);
|
|
439
438
|
return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
|
|
440
439
|
max: horizontalConstraint,
|
|
441
440
|
children: jsxRuntime.jsxs(Container, {
|
|
@@ -512,7 +511,6 @@ const SelectableSearchInput = _ref3 => {
|
|
|
512
511
|
})
|
|
513
512
|
});
|
|
514
513
|
};
|
|
515
|
-
SelectableSearchInput.propTypes = {};
|
|
516
514
|
SelectableSearchInput.displayName = 'SelectableSearchInput';
|
|
517
515
|
SelectableSearchInput.isEmpty = formValue => {
|
|
518
516
|
var _context3;
|
|
@@ -523,7 +521,7 @@ SelectableSearchInput.getDropdownId = getDropdownName;
|
|
|
523
521
|
var SelectableSearchInput$1 = SelectableSearchInput;
|
|
524
522
|
|
|
525
523
|
// NOTE: This string will be replaced on build time with the package version.
|
|
526
|
-
var version = "
|
|
524
|
+
var version = "20.1.0";
|
|
527
525
|
|
|
528
526
|
exports["default"] = SelectableSearchInput$1;
|
|
529
527
|
exports.version = version;
|