ab-ui-library 1.49.5 → 1.49.7

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.
@@ -126,7 +126,8 @@ var Select = function Select(props) {
126
126
  labelAddons = props.labelAddons,
127
127
  tooltipAddons = props.tooltipAddons,
128
128
  renderOptions = props.renderOptions,
129
- isAllowed = props.isAllowed;
129
+ isAllowed = props.isAllowed,
130
+ defaultValue = props.defaultValue;
130
131
  var scrollRef = useRef(null);
131
132
  var inputRef = useRef(null);
132
133
  var containerRef = useRef(null);
@@ -228,6 +229,11 @@ var Select = function Select(props) {
228
229
  }
229
230
  closeDropdown();
230
231
  };
232
+ var isInOptions = function isInOptions(value) {
233
+ return options.some(function (item) {
234
+ return "".concat(item.value) === value;
235
+ });
236
+ };
231
237
  var onItemDeselect = function onItemDeselect() {
232
238
  return onItemSelect(null);
233
239
  };
@@ -292,6 +298,16 @@ var Select = function Select(props) {
292
298
  }
293
299
  }, selectRightIconProps);
294
300
  }, [selectRightIconProps]);
301
+ useEffect(function () {
302
+ if (defaultValue && isCreateOnOutsideClick && !isInOptions(defaultValue)) {
303
+ setSelectedOption({
304
+ label: defaultValue,
305
+ value: defaultValue
306
+ });
307
+ setSearchValue(defaultValue);
308
+ onItemSelect(defaultValue);
309
+ }
310
+ }, [defaultValue, isCreateOnOutsideClick]);
295
311
  return /*#__PURE__*/React.createElement("div", {
296
312
  "data-id": "".concat(dataId, "-content"),
297
313
  className: classNames("select select--".concat(size), className, {
@@ -139,6 +139,7 @@ export interface TSingleSelectPropTypes extends IFormCompProps, TSelectBaseProps
139
139
  floatValue: number | undefined;
140
140
  }) => boolean;
141
141
  renderOptions?: (props: IRenderOptionItemProps) => JSX.Element;
142
+ defaultValue?: string;
142
143
  }
143
144
  export type TSelectFooterPropTypes = {
144
145
  checkboxInfo?: TCheckboxInfo;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ab-ui-library",
3
- "version": "1.49.5",
3
+ "version": "1.49.7",
4
4
  "description": "UI library for AM",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",