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