@etsoo/materialui 1.3.82 → 1.3.83

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.
@@ -9,9 +9,9 @@ export type TextFieldExProps = TextFieldProps & {
9
9
  */
10
10
  changeDelay?: number;
11
11
  /**
12
- * Click clear button callback, return false to prevent the clear action
12
+ * Click clear button callback
13
13
  */
14
- onClear?: () => boolean | void;
14
+ onClear?: (doClear: () => void) => void;
15
15
  /**
16
16
  * On enter click
17
17
  */
@@ -51,9 +51,9 @@ export declare const TextFieldEx: React.ForwardRefExoticComponent<(Omit<import("
51
51
  */
52
52
  changeDelay?: number;
53
53
  /**
54
- * Click clear button callback, return false to prevent the clear action
54
+ * Click clear button callback
55
55
  */
56
- onClear?: () => boolean | void;
56
+ onClear?: (doClear: () => void) => void;
57
57
  /**
58
58
  * On enter click
59
59
  */
@@ -82,9 +82,9 @@ export declare const TextFieldEx: React.ForwardRefExoticComponent<(Omit<import("
82
82
  */
83
83
  changeDelay?: number;
84
84
  /**
85
- * Click clear button callback, return false to prevent the clear action
85
+ * Click clear button callback
86
86
  */
87
- onClear?: () => boolean | void;
87
+ onClear?: (doClear: () => void) => void;
88
88
  /**
89
89
  * On enter click
90
90
  */
@@ -113,9 +113,9 @@ export declare const TextFieldEx: React.ForwardRefExoticComponent<(Omit<import("
113
113
  */
114
114
  changeDelay?: number;
115
115
  /**
116
- * Click clear button callback, return false to prevent the clear action
116
+ * Click clear button callback
117
117
  */
118
- onClear?: () => boolean | void;
118
+ onClear?: (doClear: () => void) => void;
119
119
  /**
120
120
  * On enter click
121
121
  */
@@ -31,16 +31,20 @@ export const TextFieldEx = React.forwardRef((props, ref) => {
31
31
  updateEmpty(false);
32
32
  }
33
33
  };
34
- const clearClick = () => {
34
+ const doClear = () => {
35
35
  if (input == null)
36
36
  return;
37
- if (onClear) {
38
- if (onClear() === false)
39
- return;
40
- }
41
37
  ReactUtils.triggerChange(input, "", false);
42
38
  input.focus();
43
39
  };
40
+ const clearClick = () => {
41
+ if (onClear) {
42
+ onClear(doClear);
43
+ }
44
+ else {
45
+ doClear();
46
+ }
47
+ };
44
48
  const preventDefault = (e) => {
45
49
  // Prevent long press
46
50
  if (e.isPropagationStopped())
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.3.82",
3
+ "version": "1.3.83",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -20,9 +20,9 @@ export type TextFieldExProps = TextFieldProps & {
20
20
  changeDelay?: number;
21
21
 
22
22
  /**
23
- * Click clear button callback, return false to prevent the clear action
23
+ * Click clear button callback
24
24
  */
25
- onClear?: () => boolean | void;
25
+ onClear?: (doClear: () => void) => void;
26
26
 
27
27
  /**
28
28
  * On enter click
@@ -118,15 +118,18 @@ export const TextFieldEx = React.forwardRef<
118
118
  }
119
119
  };
120
120
 
121
- const clearClick = () => {
121
+ const doClear = () => {
122
122
  if (input == null) return;
123
+ ReactUtils.triggerChange(input, "", false);
124
+ input.focus();
125
+ };
123
126
 
127
+ const clearClick = () => {
124
128
  if (onClear) {
125
- if (onClear() === false) return;
129
+ onClear(doClear);
130
+ } else {
131
+ doClear();
126
132
  }
127
-
128
- ReactUtils.triggerChange(input, "", false);
129
- input.focus();
130
133
  };
131
134
 
132
135
  const preventDefault = (e: React.TouchEvent | React.MouseEvent) => {