@etsoo/materialui 1.6.1 → 1.6.2

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.
@@ -73,6 +73,7 @@ export type AutocompleteExtendedProps<T extends object, D extends DataTypes.Keys
73
73
  /**
74
74
  * Value change handler
75
75
  * @param value New value
76
+ * @param input Input element
76
77
  */
77
- onValueChange?: (value: T | null) => void;
78
+ onValueChange?: (value: T | null, input?: HTMLInputElement | null) => void;
78
79
  };
@@ -56,7 +56,7 @@ function ComboBox(props) {
56
56
  if (localValue != null && localValue != stateValue) {
57
57
  setStateValue(localValue);
58
58
  if (onValueChange)
59
- onValueChange(localValue);
59
+ onValueChange(localValue, inputRef.current);
60
60
  }
61
61
  }, [localValue]);
62
62
  // Add readOnly
@@ -131,7 +131,7 @@ function ComboBox(props) {
131
131
  if (onChange != null)
132
132
  onChange(event, value, reason, details);
133
133
  if (onValueChange)
134
- onValueChange(value);
134
+ onValueChange(value, inputRef.current);
135
135
  }, openOnFocus: openOnFocus, sx: sx, renderInput: (params) => search ? ((0, jsx_runtime_1.jsx)(SearchField_1.SearchField, { ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, error: inputError, helperText: inputHelperText })) : ((0, jsx_runtime_1.jsx)(InputField_1.InputField, { ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, error: inputError, helperText: inputHelperText })), options: localOptions, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, getOptionKey: getOptionKey, ...rest }), onAdd && ((0, jsx_runtime_1.jsx)(IconButton_1.default, { size: "small", onClick: () => {
136
136
  onAdd(doLoadData);
137
137
  }, title: addLabel, children: (0, jsx_runtime_1.jsx)(Add_1.default, {}) }))] })] }));
@@ -113,7 +113,7 @@ function Tiplist(props) {
113
113
  if (id && options && onValueChange) {
114
114
  const option = options.find((o) => o[idField] === id);
115
115
  if (option)
116
- onValueChange(option);
116
+ onValueChange(option, inputRef.current);
117
117
  }
118
118
  // Indicates loading completed
119
119
  stateUpdate({
@@ -183,7 +183,7 @@ function Tiplist(props) {
183
183
  if (onChange != null)
184
184
  onChange(event, value, reason, details);
185
185
  if (onValueChange)
186
- onValueChange(value);
186
+ onValueChange(value, inputRef.current);
187
187
  // For clear case
188
188
  if (reason === "clear") {
189
189
  stateUpdate({ options: [], open: event.type === "click" });
@@ -73,6 +73,7 @@ export type AutocompleteExtendedProps<T extends object, D extends DataTypes.Keys
73
73
  /**
74
74
  * Value change handler
75
75
  * @param value New value
76
+ * @param input Input element
76
77
  */
77
- onValueChange?: (value: T | null) => void;
78
+ onValueChange?: (value: T | null, input?: HTMLInputElement | null) => void;
78
79
  };
@@ -50,7 +50,7 @@ export function ComboBox(props) {
50
50
  if (localValue != null && localValue != stateValue) {
51
51
  setStateValue(localValue);
52
52
  if (onValueChange)
53
- onValueChange(localValue);
53
+ onValueChange(localValue, inputRef.current);
54
54
  }
55
55
  }, [localValue]);
56
56
  // Add readOnly
@@ -125,7 +125,7 @@ export function ComboBox(props) {
125
125
  if (onChange != null)
126
126
  onChange(event, value, reason, details);
127
127
  if (onValueChange)
128
- onValueChange(value);
128
+ onValueChange(value, inputRef.current);
129
129
  }, openOnFocus: openOnFocus, sx: sx, renderInput: (params) => search ? (_jsx(SearchField, { ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, error: inputError, helperText: inputHelperText })) : (_jsx(InputField, { ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, error: inputError, helperText: inputHelperText })), options: localOptions, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, getOptionKey: getOptionKey, ...rest }), onAdd && (_jsx(IconButton, { size: "small", onClick: () => {
130
130
  onAdd(doLoadData);
131
131
  }, title: addLabel, children: _jsx(AddIcon, {}) }))] })] }));
@@ -107,7 +107,7 @@ export function Tiplist(props) {
107
107
  if (id && options && onValueChange) {
108
108
  const option = options.find((o) => o[idField] === id);
109
109
  if (option)
110
- onValueChange(option);
110
+ onValueChange(option, inputRef.current);
111
111
  }
112
112
  // Indicates loading completed
113
113
  stateUpdate({
@@ -177,7 +177,7 @@ export function Tiplist(props) {
177
177
  if (onChange != null)
178
178
  onChange(event, value, reason, details);
179
179
  if (onValueChange)
180
- onValueChange(value);
180
+ onValueChange(value, inputRef.current);
181
181
  // For clear case
182
182
  if (reason === "clear") {
183
183
  stateUpdate({ options: [], open: event.type === "click" });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -96,6 +96,7 @@ export type AutocompleteExtendedProps<
96
96
  /**
97
97
  * Value change handler
98
98
  * @param value New value
99
+ * @param input Input element
99
100
  */
100
- onValueChange?: (value: T | null) => void;
101
+ onValueChange?: (value: T | null, input?: HTMLInputElement | null) => void;
101
102
  };
package/src/ComboBox.tsx CHANGED
@@ -160,7 +160,7 @@ export function ComboBox<
160
160
  React.useEffect(() => {
161
161
  if (localValue != null && localValue != stateValue) {
162
162
  setStateValue(localValue);
163
- if (onValueChange) onValueChange(localValue);
163
+ if (onValueChange) onValueChange(localValue, inputRef.current);
164
164
  }
165
165
  }, [localValue]);
166
166
 
@@ -266,7 +266,7 @@ export function ComboBox<
266
266
  // Custom
267
267
  if (onChange != null) onChange(event, value, reason, details);
268
268
 
269
- if (onValueChange) onValueChange(value);
269
+ if (onValueChange) onValueChange(value, inputRef.current);
270
270
  }}
271
271
  openOnFocus={openOnFocus}
272
272
  sx={sx}
package/src/Tiplist.tsx CHANGED
@@ -220,7 +220,7 @@ export function Tiplist<
220
220
 
221
221
  if (id && options && onValueChange) {
222
222
  const option = options.find((o) => o[idField] === id);
223
- if (option) onValueChange(option);
223
+ if (option) onValueChange(option, inputRef.current);
224
224
  }
225
225
 
226
226
  // Indicates loading completed
@@ -318,7 +318,7 @@ export function Tiplist<
318
318
  // Custom
319
319
  if (onChange != null) onChange(event, value, reason, details);
320
320
 
321
- if (onValueChange) onValueChange(value);
321
+ if (onValueChange) onValueChange(value, inputRef.current);
322
322
 
323
323
  // For clear case
324
324
  if (reason === "clear") {