ab-ui-library 1.37.6 → 1.37.8

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.
@@ -104,6 +104,7 @@ var Select = function Select(props) {
104
104
  setFieldValue = props.setFieldValue,
105
105
  setSelectedItem = props.setSelectedItem,
106
106
  onInputChange = props.onInputChange,
107
+ onInputFormatting = props.onInputFormatting,
107
108
  outerHelperText = props.outerHelperText,
108
109
  innerHelperText = props.innerHelperText,
109
110
  isRequiredField = props.isRequiredField,
@@ -123,8 +124,6 @@ var Select = function Select(props) {
123
124
  labelAddons = props.labelAddons,
124
125
  tooltipAddons = props.tooltipAddons,
125
126
  renderOptions = props.renderOptions,
126
- _props$inputType = props.inputType,
127
- inputType = _props$inputType === void 0 ? 'text' : _props$inputType,
128
127
  isAllowed = props.isAllowed;
129
128
  var scrollRef = useRef(null);
130
129
  var inputRef = useRef(null);
@@ -156,11 +155,19 @@ var Select = function Select(props) {
156
155
  selectedOption = _useState8[0],
157
156
  setSelectedOption = _useState8[1];
158
157
  var isWithSearch = isSearchable || isDynamicSearchEnabled || isCreateOnOutsideClick;
158
+ var getFormatedValue = function getFormatedValue(value) {
159
+ if (onInputFormatting && value) {
160
+ return onInputFormatting(value);
161
+ }
162
+ return value;
163
+ };
159
164
  var setCurrentSelectedLabel = useCallback(function () {
160
165
  var selectedItem = options.find(function (item) {
161
166
  return item.value === currentSelection;
162
167
  });
163
- setSelectedOption(selectedItem);
168
+ setSelectedOption(_objectSpread(_objectSpread({}, selectedItem), {}, {
169
+ label: getFormatedValue(selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.label)
170
+ }));
164
171
  }, [currentSelection, options]);
165
172
  var leftIconProps = selectedOption !== null && selectedOption !== void 0 && (_selectedOption$optio = selectedOption.optionLeftIcon) !== null && _selectedOption$optio !== void 0 && _selectedOption$optio.Component ? {
166
173
  Component: selectedOption === null || selectedOption === void 0 || (_selectedOption$optio2 = selectedOption.optionLeftIcon) === null || _selectedOption$optio2 === void 0 ? void 0 : _selectedOption$optio2.Component
@@ -245,7 +252,7 @@ var Select = function Select(props) {
245
252
  };
246
253
  var onSearch = function onSearch(e) {
247
254
  setSelectedOption(null);
248
- setSearchValue(e.target.value);
255
+ setSearchValue(getFormatedValue(e.target.value));
249
256
  };
250
257
  var _useGetHasBottomSpace = useGetHasBottomSpace({
251
258
  element: dropdownRef,
@@ -284,7 +291,6 @@ var Select = function Select(props) {
284
291
  placeholder: placeHolder,
285
292
  value: searchValue || (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) || '',
286
293
  isValid: isValid,
287
- type: inputType,
288
294
  disabled: disabled,
289
295
  helperText: outerHelperText,
290
296
  ref: inputRef,
@@ -123,6 +123,7 @@ export interface TSingleSelectPropTypes extends IFormCompProps, TSelectBaseProps
123
123
  selectedItem?: TItemValue;
124
124
  setSelectedItem?: (items: TItemValue | undefined) => void;
125
125
  onInputChange?: (event: FormEvent<HTMLInputElement>) => void;
126
+ onInputFormatting?: (value: string) => string;
126
127
  isSearchable?: boolean;
127
128
  isDynamicSearchable?: boolean;
128
129
  outerHelperText?: string;
@@ -130,7 +131,6 @@ export interface TSingleSelectPropTypes extends IFormCompProps, TSelectBaseProps
130
131
  labelAddons?: JSX.Element;
131
132
  tooltipAddons?: TTooltipProps;
132
133
  isCreateOnOutsideClick?: boolean;
133
- inputType?: 'text' | 'number' | 'time' | 'password' | 'email' | 'file' | 'tel' | 'date' | 'numeric';
134
134
  isAllowed?: (values: {
135
135
  formattedValue: string;
136
136
  value: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ab-ui-library",
3
- "version": "1.37.6",
3
+ "version": "1.37.8",
4
4
  "description": "UI library for AM",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",