@etsoo/materialui 1.3.83 → 1.3.84
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/lib/TextFieldEx.d.ts +16 -0
- package/lib/TextFieldEx.js +5 -2
- package/package.json +2 -2
- package/src/TextFieldEx.tsx +13 -1
package/lib/TextFieldEx.d.ts
CHANGED
|
@@ -8,6 +8,10 @@ export type TextFieldExProps = TextFieldProps & {
|
|
|
8
8
|
* Change delay (ms) to avoid repeatly dispatch onChange
|
|
9
9
|
*/
|
|
10
10
|
changeDelay?: number;
|
|
11
|
+
/**
|
|
12
|
+
* Clear button label
|
|
13
|
+
*/
|
|
14
|
+
clearLabel?: string;
|
|
11
15
|
/**
|
|
12
16
|
* Click clear button callback
|
|
13
17
|
*/
|
|
@@ -50,6 +54,10 @@ export declare const TextFieldEx: React.ForwardRefExoticComponent<(Omit<import("
|
|
|
50
54
|
* Change delay (ms) to avoid repeatly dispatch onChange
|
|
51
55
|
*/
|
|
52
56
|
changeDelay?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Clear button label
|
|
59
|
+
*/
|
|
60
|
+
clearLabel?: string;
|
|
53
61
|
/**
|
|
54
62
|
* Click clear button callback
|
|
55
63
|
*/
|
|
@@ -81,6 +89,10 @@ export declare const TextFieldEx: React.ForwardRefExoticComponent<(Omit<import("
|
|
|
81
89
|
* Change delay (ms) to avoid repeatly dispatch onChange
|
|
82
90
|
*/
|
|
83
91
|
changeDelay?: number;
|
|
92
|
+
/**
|
|
93
|
+
* Clear button label
|
|
94
|
+
*/
|
|
95
|
+
clearLabel?: string;
|
|
84
96
|
/**
|
|
85
97
|
* Click clear button callback
|
|
86
98
|
*/
|
|
@@ -112,6 +124,10 @@ export declare const TextFieldEx: React.ForwardRefExoticComponent<(Omit<import("
|
|
|
112
124
|
* Change delay (ms) to avoid repeatly dispatch onChange
|
|
113
125
|
*/
|
|
114
126
|
changeDelay?: number;
|
|
127
|
+
/**
|
|
128
|
+
* Clear button label
|
|
129
|
+
*/
|
|
130
|
+
clearLabel?: string;
|
|
115
131
|
/**
|
|
116
132
|
* Click clear button callback
|
|
117
133
|
*/
|
package/lib/TextFieldEx.js
CHANGED
|
@@ -5,9 +5,12 @@ import { MUGlobal } from "./MUGlobal";
|
|
|
5
5
|
import { Clear, Visibility } from "@mui/icons-material";
|
|
6
6
|
import { Keyboard } from "@etsoo/shared";
|
|
7
7
|
import { ReactUtils, useCombinedRefs, useDelayedExecutor } from "@etsoo/react";
|
|
8
|
+
import { globalApp } from "./app/ReactApp";
|
|
8
9
|
export const TextFieldEx = React.forwardRef((props, ref) => {
|
|
10
|
+
// Labels
|
|
11
|
+
const { showIt, clearInput } = globalApp?.getLabels("showIt", "clearInput") ?? {};
|
|
9
12
|
// Destructure
|
|
10
|
-
const { changeDelay, error, fullWidth = true, helperText, InputLabelProps = {}, InputProps = {}, onChange, onClear, onKeyDown, onEnter, onVisibility, inputRef, readOnly, showClear, showPassword, type, variant = MUGlobal.textFieldVariant, ...rest } = props;
|
|
13
|
+
const { changeDelay, clearLabel = clearInput, error, fullWidth = true, helperText, InputLabelProps = {}, InputProps = {}, onChange, onClear, onKeyDown, onEnter, onVisibility, inputRef, readOnly, showClear, showPassword, type, variant = MUGlobal.textFieldVariant, ...rest } = props;
|
|
11
14
|
// Shrink
|
|
12
15
|
InputLabelProps.shrink ?? (InputLabelProps.shrink = MUGlobal.searchFieldShrink);
|
|
13
16
|
// State
|
|
@@ -76,7 +79,7 @@ export const TextFieldEx = React.forwardRef((props, ref) => {
|
|
|
76
79
|
};
|
|
77
80
|
// Show password and/or clear button
|
|
78
81
|
if (!empty && (showPassword || showClear)) {
|
|
79
|
-
InputProps.endAdornment = (_jsxs(InputAdornment, { position: "end", children: [showPassword && (_jsx(IconButton, { tabIndex: -1, onContextMenu: (event) => event.preventDefault(), onMouseDown: touchStart, onMouseUp: touchEnd, onTouchStart: touchStart, onTouchCancel: touchEnd, onTouchEnd: touchEnd, children: _jsx(Visibility, {}) })), showClear && (_jsx(IconButton, { onClick: clearClick, tabIndex: -1, children: _jsx(Clear, {}) }))] }));
|
|
82
|
+
InputProps.endAdornment = (_jsxs(InputAdornment, { position: "end", children: [showPassword && (_jsx(IconButton, { tabIndex: -1, onContextMenu: (event) => event.preventDefault(), onMouseDown: touchStart, onMouseUp: touchEnd, onTouchStart: touchStart, onTouchCancel: touchEnd, onTouchEnd: touchEnd, title: showIt, children: _jsx(Visibility, {}) })), showClear && (_jsx(IconButton, { onClick: clearClick, tabIndex: -1, title: clearLabel, children: _jsx(Clear, {}) }))] }));
|
|
80
83
|
}
|
|
81
84
|
// Extend key precess
|
|
82
85
|
const onKeyPressEx = onEnter == null
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/materialui",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.84",
|
|
4
4
|
"description": "TypeScript Material-UI Implementation",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@emotion/css": "^11.13.0",
|
|
51
51
|
"@emotion/react": "^11.13.0",
|
|
52
52
|
"@emotion/styled": "^11.13.0",
|
|
53
|
-
"@etsoo/appscript": "^1.5.
|
|
53
|
+
"@etsoo/appscript": "^1.5.7",
|
|
54
54
|
"@etsoo/notificationbase": "^1.1.47",
|
|
55
55
|
"@etsoo/react": "^1.7.62",
|
|
56
56
|
"@etsoo/shared": "^1.2.44",
|
package/src/TextFieldEx.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import { MUGlobal } from "./MUGlobal";
|
|
|
9
9
|
import { Clear, Visibility } from "@mui/icons-material";
|
|
10
10
|
import { Keyboard } from "@etsoo/shared";
|
|
11
11
|
import { ReactUtils, useCombinedRefs, useDelayedExecutor } from "@etsoo/react";
|
|
12
|
+
import { globalApp } from "./app/ReactApp";
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Extended text field props
|
|
@@ -19,6 +20,11 @@ export type TextFieldExProps = TextFieldProps & {
|
|
|
19
20
|
*/
|
|
20
21
|
changeDelay?: number;
|
|
21
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Clear button label
|
|
25
|
+
*/
|
|
26
|
+
clearLabel?: string;
|
|
27
|
+
|
|
22
28
|
/**
|
|
23
29
|
* Click clear button callback
|
|
24
30
|
*/
|
|
@@ -67,9 +73,14 @@ export const TextFieldEx = React.forwardRef<
|
|
|
67
73
|
TextFieldExMethods,
|
|
68
74
|
TextFieldExProps
|
|
69
75
|
>((props, ref) => {
|
|
76
|
+
// Labels
|
|
77
|
+
const { showIt, clearInput } =
|
|
78
|
+
globalApp?.getLabels("showIt", "clearInput") ?? {};
|
|
79
|
+
|
|
70
80
|
// Destructure
|
|
71
81
|
const {
|
|
72
82
|
changeDelay,
|
|
83
|
+
clearLabel = clearInput,
|
|
73
84
|
error,
|
|
74
85
|
fullWidth = true,
|
|
75
86
|
helperText,
|
|
@@ -176,12 +187,13 @@ export const TextFieldEx = React.forwardRef<
|
|
|
176
187
|
onTouchStart={touchStart}
|
|
177
188
|
onTouchCancel={touchEnd}
|
|
178
189
|
onTouchEnd={touchEnd}
|
|
190
|
+
title={showIt}
|
|
179
191
|
>
|
|
180
192
|
<Visibility />
|
|
181
193
|
</IconButton>
|
|
182
194
|
)}
|
|
183
195
|
{showClear && (
|
|
184
|
-
<IconButton onClick={clearClick} tabIndex={-1}>
|
|
196
|
+
<IconButton onClick={clearClick} tabIndex={-1} title={clearLabel}>
|
|
185
197
|
<Clear />
|
|
186
198
|
</IconButton>
|
|
187
199
|
)}
|