@true-engineering/true-react-common-ui-kit 3.57.0 → 3.58.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@true-engineering/true-react-common-ui-kit",
3
- "version": "3.57.0",
3
+ "version": "3.58.0",
4
4
  "description": "True Engineering React UI Kit with theming support",
5
5
  "author": "True Engineering (https://trueengineering.ru)",
6
6
  "keywords": [
@@ -80,7 +80,11 @@ export interface IInputProps
80
80
  shouldFocusOnMount?: boolean;
81
81
  /** @default false */
82
82
  shouldAlwaysShowPlaceholder?: boolean;
83
- onChange: (value: string, event: FormEvent<HTMLInputElement>) => void;
83
+ onChange: (
84
+ value: string,
85
+ event: FormEvent<HTMLInputElement>,
86
+ eventType: 'change' | 'clear',
87
+ ) => void;
84
88
  onIconClick?: () => void;
85
89
  }
86
90
 
@@ -139,7 +143,7 @@ export const Input = forwardRef<HTMLInputElement, IInputProps>(
139
143
  const inputRef = useRef<HTMLInputElement>(null);
140
144
 
141
145
  const handleChange = (event: FormEvent<HTMLInputElement>) => {
142
- onChange(event.currentTarget.value, event);
146
+ onChange(event.currentTarget.value, event, 'change');
143
147
  };
144
148
 
145
149
  const handleFocus = (event: FocusEvent<HTMLInputElement>) => {
@@ -155,7 +159,7 @@ export const Input = forwardRef<HTMLInputElement, IInputProps>(
155
159
  // для SmartInput нужен event, иначе onChange не вызовется
156
160
  const handleOnInputClear = async (event: MouseEvent<HTMLDivElement>) => {
157
161
  // await не убирать (важно для порядка выполнения (сначала onChange, затем focus)
158
- await onChange('', event as any);
162
+ await onChange('', event as any, 'clear');
159
163
  const input = (ref as MutableRefObject<HTMLInputElement>) ?? inputRef;
160
164
  input.current?.focus();
161
165
  };