@etsoo/materialui 1.5.84 → 1.5.86

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.
Files changed (46) hide show
  1. package/lib/cjs/CountdownButton.d.ts +1 -2
  2. package/lib/cjs/CountdownButton.js +4 -4
  3. package/lib/cjs/EmailInput.d.ts +2 -2
  4. package/lib/cjs/EmailInput.js +2 -5
  5. package/lib/cjs/InputField.d.ts +1 -52
  6. package/lib/cjs/InputField.js +5 -5
  7. package/lib/cjs/InputTipField.d.ts +40 -20
  8. package/lib/cjs/InputTipField.js +13 -2
  9. package/lib/cjs/IntInputField.d.ts +1 -1
  10. package/lib/cjs/IntInputField.js +9 -12
  11. package/lib/cjs/MobileInput.d.ts +2 -2
  12. package/lib/cjs/MobileInput.js +2 -5
  13. package/lib/cjs/MoneyInputField.d.ts +1 -2
  14. package/lib/cjs/MoneyInputField.js +4 -8
  15. package/lib/cjs/PhoneInput.d.ts +2 -2
  16. package/lib/cjs/PhoneInput.js +2 -5
  17. package/lib/cjs/TextFieldEx.d.ts +5 -106
  18. package/lib/cjs/TextFieldEx.js +27 -18
  19. package/lib/mjs/CountdownButton.d.ts +1 -2
  20. package/lib/mjs/CountdownButton.js +3 -3
  21. package/lib/mjs/EmailInput.d.ts +2 -2
  22. package/lib/mjs/EmailInput.js +2 -2
  23. package/lib/mjs/InputField.d.ts +1 -52
  24. package/lib/mjs/InputField.js +4 -4
  25. package/lib/mjs/InputTipField.d.ts +40 -20
  26. package/lib/mjs/InputTipField.js +13 -2
  27. package/lib/mjs/IntInputField.d.ts +1 -1
  28. package/lib/mjs/IntInputField.js +8 -11
  29. package/lib/mjs/MobileInput.d.ts +2 -2
  30. package/lib/mjs/MobileInput.js +2 -2
  31. package/lib/mjs/MoneyInputField.d.ts +1 -2
  32. package/lib/mjs/MoneyInputField.js +3 -4
  33. package/lib/mjs/PhoneInput.d.ts +2 -2
  34. package/lib/mjs/PhoneInput.js +2 -2
  35. package/lib/mjs/TextFieldEx.d.ts +5 -106
  36. package/lib/mjs/TextFieldEx.js +26 -17
  37. package/package.json +8 -8
  38. package/src/CountdownButton.tsx +2 -6
  39. package/src/EmailInput.tsx +3 -3
  40. package/src/InputField.tsx +69 -74
  41. package/src/InputTipField.tsx +49 -14
  42. package/src/IntInputField.tsx +14 -22
  43. package/src/MobileInput.tsx +3 -3
  44. package/src/MoneyInputField.tsx +3 -7
  45. package/src/PhoneInput.tsx +3 -3
  46. package/src/TextFieldEx.tsx +33 -20
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.TextFieldEx = void 0;
6
+ exports.TextFieldEx = TextFieldEx;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const react_1 = __importDefault(require("react"));
9
9
  const MUGlobal_1 = require("./MUGlobal");
@@ -15,13 +15,15 @@ const ReactApp_1 = require("./app/ReactApp");
15
15
  const TextField_1 = __importDefault(require("@mui/material/TextField"));
16
16
  const InputAdornment_1 = __importDefault(require("@mui/material/InputAdornment"));
17
17
  const IconButton_1 = __importDefault(require("@mui/material/IconButton"));
18
- exports.TextFieldEx = react_1.default.forwardRef((props, ref) => {
18
+ function TextFieldEx(props) {
19
19
  // Global app
20
20
  const app = (0, ReactApp_1.useAppContext)();
21
21
  // Labels
22
22
  const { showIt, clearInput } = app?.getLabels("showIt", "clearInput") ?? {};
23
23
  // Destructure
24
- const { changeDelay, clearLabel = clearInput, error, fullWidth = true, helperText, InputLabelProps = {}, InputProps = {}, onChange, onClear, onKeyDown, onEnter, onVisibility, inputRef, readOnly, showClear, showPassword, type, variant = MUGlobal_1.MUGlobal.textFieldVariant, ...rest } = props;
24
+ const { changeDelay, clearLabel = clearInput, error, fullWidth = true, helperText, InputLabelProps = {}, InputProps = {}, slotProps, onChange, onClear, onKeyDown, onEnter, onVisibility, inputRef, readOnly, showClear, showPassword, type, variant = MUGlobal_1.MUGlobal.textFieldVariant, mRef, ...rest } = props;
25
+ // Slot props
26
+ const { input, inputLabel, ...restSlotProps } = slotProps ?? {};
25
27
  // Shrink
26
28
  InputLabelProps.shrink ??= MUGlobal_1.MUGlobal.searchFieldShrink;
27
29
  // State
@@ -38,18 +40,18 @@ exports.TextFieldEx = react_1.default.forwardRef((props, ref) => {
38
40
  helperTextEx = errorText;
39
41
  }
40
42
  let typeEx = showPassword ? "password" : type;
41
- let input;
43
+ let inputEle;
42
44
  const localRef = (ref) => {
43
- input = ref;
44
- if (input.value !== "") {
45
+ inputEle = ref;
46
+ if (inputEle.value !== "") {
45
47
  updateEmpty(false);
46
48
  }
47
49
  };
48
50
  const doClear = () => {
49
- if (input == null)
51
+ if (inputEle == null)
50
52
  return;
51
- react_2.ReactUtils.triggerChange(input, "", false);
52
- input.focus();
53
+ react_2.ReactUtils.triggerChange(inputEle, "", false);
54
+ inputEle.focus();
53
55
  };
54
56
  const clearClick = () => {
55
57
  if (onClear) {
@@ -68,23 +70,23 @@ exports.TextFieldEx = react_1.default.forwardRef((props, ref) => {
68
70
  };
69
71
  const touchStart = async (e) => {
70
72
  // Show the password
71
- if (input) {
73
+ if (inputEle) {
72
74
  if (onVisibility) {
73
- const result = await onVisibility(input);
75
+ const result = await onVisibility(inputEle);
74
76
  if (result === false)
75
77
  return;
76
78
  }
77
- input.blur();
78
- input.type = "text";
79
+ inputEle.blur();
80
+ inputEle.type = "text";
79
81
  }
80
82
  preventDefault(e);
81
83
  };
82
84
  const touchEnd = (e) => {
83
85
  // Show the password
84
- if (input) {
86
+ if (inputEle) {
85
87
  if (onVisibility)
86
88
  return;
87
- input.type = "password";
89
+ inputEle.type = "password";
88
90
  }
89
91
  preventDefault(e);
90
92
  };
@@ -105,7 +107,7 @@ exports.TextFieldEx = react_1.default.forwardRef((props, ref) => {
105
107
  onKeyDown(e);
106
108
  }
107
109
  };
108
- react_1.default.useImperativeHandle(ref, () => ({
110
+ react_1.default.useImperativeHandle(mRef, () => ({
109
111
  /**
110
112
  * Set error
111
113
  * @param error Error
@@ -146,5 +148,12 @@ exports.TextFieldEx = react_1.default.forwardRef((props, ref) => {
146
148
  };
147
149
  }, []);
148
150
  // Textfield
149
- return ((0, jsx_runtime_1.jsx)(TextField_1.default, { error: errorEx, fullWidth: fullWidth, helperText: helperTextEx, inputRef: (0, react_2.useCombinedRefs)(inputRef, localRef), InputProps: InputProps, InputLabelProps: InputLabelProps, onChange: onChangeEx, onKeyDown: onKeyPressEx, type: typeEx, variant: variant, ...rest }));
150
- });
151
+ return ((0, jsx_runtime_1.jsx)(TextField_1.default, { error: errorEx, fullWidth: fullWidth, helperText: helperTextEx, inputRef: (0, react_2.useCombinedRefs)(inputRef, localRef), onChange: onChangeEx, onKeyDown: onKeyPressEx, slotProps: {
152
+ input: { readOnly, ...input, ...InputProps },
153
+ inputLabel: {
154
+ shrink: MUGlobal_1.MUGlobal.inputFieldShrink,
155
+ ...inputLabel
156
+ },
157
+ ...restSlotProps
158
+ }, type: typeEx, variant: variant, ...rest }));
159
+ }
@@ -1,5 +1,4 @@
1
1
  import { ButtonProps } from "@mui/material/Button";
2
- import React from "react";
3
2
  /**
4
3
  * Countdown button action
5
4
  */
@@ -24,4 +23,4 @@ export type CountdownButtonProps = Omit<ButtonProps, "endIcon" | "disabled"> & {
24
23
  * @param props Props
25
24
  * @returns Button
26
25
  */
27
- export declare const CountdownButton: React.ForwardRefExoticComponent<Omit<CountdownButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
26
+ export declare function CountdownButton(props: CountdownButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -7,7 +7,7 @@ import React from "react";
7
7
  * @param props Props
8
8
  * @returns Button
9
9
  */
10
- export const CountdownButton = React.forwardRef((props, ref) => {
10
+ export function CountdownButton(props) {
11
11
  // Destructure
12
12
  const { initState = 0, onAction, onClick, ...rest } = props;
13
13
  // State
@@ -82,5 +82,5 @@ export const CountdownButton = React.forwardRef((props, ref) => {
82
82
  React.useEffect(() => {
83
83
  setState(initState);
84
84
  }, [initState]);
85
- return (_jsx(Button, { disabled: disabled, endIcon: endIcon, onClick: localClick, ref: ref, ...rest }));
86
- });
85
+ return (_jsx(Button, { disabled: disabled, endIcon: endIcon, onClick: localClick, ...rest }));
86
+ }
@@ -1,8 +1,8 @@
1
- import { TextFieldProps } from "@mui/material/TextField";
1
+ import { InputFieldProps } from "./InputField";
2
2
  /**
3
3
  * Email input props
4
4
  */
5
- export type EmailInputProps = Omit<TextFieldProps, "type"> & {};
5
+ export type EmailInputProps = Omit<InputFieldProps, "type"> & {};
6
6
  /**
7
7
  * Email input
8
8
  * @param props Props
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import TextField from "@mui/material/TextField";
3
2
  import { useAppContext } from "./app/ReactApp";
4
3
  import { MUGlobal } from "./MUGlobal";
4
+ import { InputField } from "./InputField";
5
5
  /**
6
6
  * Email input
7
7
  * @param props Props
@@ -14,7 +14,7 @@ export function EmailInput(props) {
14
14
  // Slot props
15
15
  const { htmlInput, inputLabel, ...restSlotProps } = slotProps ?? {};
16
16
  // Layout
17
- return (_jsx(TextField, { type: "email", autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, autoComplete: autoComplete, fullWidth: fullWidth, label: label, name: name, slotProps: {
17
+ return (_jsx(InputField, { type: "email", autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, autoComplete: autoComplete, fullWidth: fullWidth, label: label, name: name, slotProps: {
18
18
  htmlInput: { inputMode: "email", maxLength: 128, ...htmlInput },
19
19
  inputLabel: { shrink: MUGlobal.inputFieldShrink, ...inputLabel },
20
20
  ...restSlotProps
@@ -26,55 +26,4 @@ export type InputFieldProps = TextFieldProps & {
26
26
  * @param props Props
27
27
  * @returns Component
28
28
  */
29
- export declare const InputField: React.ForwardRefExoticComponent<(Omit<import("@mui/material").StandardTextFieldProps & {
30
- /**
31
- * Change delay (ms) to avoid repeatly dispatch onChange
32
- */
33
- changeDelay?: number;
34
- /**
35
- * Change delay handler, without it onChange will be applied
36
- */
37
- onChangeDelay?: React.ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement>;
38
- /**
39
- * Is the field read only?
40
- */
41
- readOnly?: boolean;
42
- /**
43
- * Minimum characters to trigger the change event
44
- */
45
- minChars?: number;
46
- }, "ref"> | Omit<import("@mui/material").OutlinedTextFieldProps & {
47
- /**
48
- * Change delay (ms) to avoid repeatly dispatch onChange
49
- */
50
- changeDelay?: number;
51
- /**
52
- * Change delay handler, without it onChange will be applied
53
- */
54
- onChangeDelay?: React.ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement>;
55
- /**
56
- * Is the field read only?
57
- */
58
- readOnly?: boolean;
59
- /**
60
- * Minimum characters to trigger the change event
61
- */
62
- minChars?: number;
63
- }, "ref"> | Omit<import("@mui/material").FilledTextFieldProps & {
64
- /**
65
- * Change delay (ms) to avoid repeatly dispatch onChange
66
- */
67
- changeDelay?: number;
68
- /**
69
- * Change delay handler, without it onChange will be applied
70
- */
71
- onChangeDelay?: React.ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement>;
72
- /**
73
- * Is the field read only?
74
- */
75
- readOnly?: boolean;
76
- /**
77
- * Minimum characters to trigger the change event
78
- */
79
- minChars?: number;
80
- }, "ref">) & React.RefAttributes<HTMLDivElement>>;
29
+ export declare function InputField(props: InputFieldProps): import("react/jsx-runtime").JSX.Element;
@@ -8,9 +8,9 @@ import TextField from "@mui/material/TextField";
8
8
  * @param props Props
9
9
  * @returns Component
10
10
  */
11
- export const InputField = React.forwardRef((props, ref) => {
11
+ export function InputField(props) {
12
12
  // Destruct
13
- const { InputProps = {}, inputProps = {}, changeDelay, slotProps, onChange, onChangeDelay, readOnly, size = MUGlobal.inputFieldSize, variant = MUGlobal.inputFieldVariant, minChars = 0, ...rest } = props;
13
+ const { InputProps = {}, inputProps = {}, slotProps, changeDelay, onChange, onChangeDelay, readOnly, size = MUGlobal.inputFieldSize, variant = MUGlobal.inputFieldVariant, minChars = 0, ...rest } = props;
14
14
  // Slot props
15
15
  const { htmlInput, input, inputLabel, ...restSlotProps } = slotProps ?? {};
16
16
  const isMounted = React.useRef(true);
@@ -43,7 +43,7 @@ export const InputField = React.forwardRef((props, ref) => {
43
43
  };
44
44
  }, []);
45
45
  // Layout
46
- return (_jsx(TextField, { ref: ref, slotProps: {
46
+ return (_jsx(TextField, { slotProps: {
47
47
  htmlInput: {
48
48
  ["data-min-chars"]: minChars,
49
49
  ...htmlInput,
@@ -56,4 +56,4 @@ export const InputField = React.forwardRef((props, ref) => {
56
56
  },
57
57
  ...restSlotProps
58
58
  }, onChange: onChangeEx, size: size, variant: variant, ...rest }));
59
- });
59
+ }
@@ -1,38 +1,58 @@
1
1
  import { DataTypes } from "@etsoo/shared";
2
2
  import { TypographyProps } from "@mui/material/Typography";
3
3
  import React from "react";
4
- import { InputFieldProps } from "./InputField";
4
+ import { InputField } from "./InputField";
5
+ import { EmailInput } from "./EmailInput";
6
+ import { MobileInput } from "./MobileInput";
7
+ import { PhoneInput } from "./PhoneInput";
5
8
  type ItemType = DataTypes.IdLabelItem<string | number>;
9
+ declare const componentMap: {
10
+ input: typeof InputField;
11
+ email: typeof EmailInput;
12
+ phone: typeof PhoneInput;
13
+ mobile: typeof MobileInput;
14
+ };
15
+ type ComponentMap = typeof componentMap;
16
+ type ComponentKey = keyof ComponentMap;
6
17
  /**
7
18
  * InputField with tips properties
8
19
  */
9
- export type InputTipFieldProps<T extends ItemType = ItemType> = InputFieldProps & {
10
- /**
11
- * Load data
12
- * @param value Duplicate test value
13
- */
14
- loadData(value: string): Promise<[T[]?, string?]>;
15
- /**
16
- * Label props
17
- */
18
- labelProps?: Omit<TypographyProps, "onClick">;
20
+ export type InputTipFieldProps<T extends ItemType = ItemType, K extends ComponentKey = "input"> = Omit<React.ComponentProps<ComponentMap[K]>, "component"> & {
19
21
  /**
20
- * Custom item label
21
- * @param item List item data
22
- * @returns Result
22
+ * Component key
23
23
  */
24
- itemLabel?: (item: T) => React.ReactNode;
24
+ component?: K;
25
25
  /**
26
- * Custom render item
27
- * @param item List item data
28
- * @returns Result
26
+ * Component properties
29
27
  */
30
- renderItem?: (item: T) => React.ReactNode;
28
+ componentProps: {
29
+ /**
30
+ * Load data
31
+ * @param value Duplicate test value
32
+ */
33
+ loadData(value: string): Promise<[T[]?, string?]>;
34
+ /**
35
+ * Label props
36
+ */
37
+ labelProps?: Omit<TypographyProps, "onClick">;
38
+ /**
39
+ * Custom item label
40
+ * @param item List item data
41
+ * @returns Result
42
+ */
43
+ itemLabel?: (item: T) => React.ReactNode;
44
+ /**
45
+ * Custom render item
46
+ * @param item List item data
47
+ * @returns Result
48
+ */
49
+ renderItem?: (item: T) => React.ReactNode;
50
+ };
31
51
  };
32
52
  /**
33
53
  * InputField with tips
34
54
  * @param props Props
35
55
  * @returns Component
36
56
  */
37
- export declare function InputTipField<T extends ItemType = ItemType>(props: InputTipFieldProps<T>): import("react/jsx-runtime").JSX.Element;
57
+ export declare function InputTipField<T extends ItemType = ItemType, K extends ComponentKey = "input">(props: InputTipFieldProps<T, K>): import("react/jsx-runtime").JSX.Element;
38
58
  export {};
@@ -7,6 +7,15 @@ import ListItem from "@mui/material/ListItem";
7
7
  import Popover from "@mui/material/Popover";
8
8
  import List from "@mui/material/List";
9
9
  import InputAdornment from "@mui/material/InputAdornment";
10
+ import { EmailInput } from "./EmailInput";
11
+ import { MobileInput } from "./MobileInput";
12
+ import { PhoneInput } from "./PhoneInput";
13
+ const componentMap = {
14
+ input: InputField,
15
+ email: EmailInput,
16
+ phone: PhoneInput,
17
+ mobile: MobileInput
18
+ };
10
19
  /**
11
20
  * InputField with tips
12
21
  * @param props Props
@@ -20,11 +29,13 @@ export function InputTipField(props) {
20
29
  const [anchorEl, setAnchorEl] = React.useState();
21
30
  const [data, setData] = React.useState();
22
31
  // Destruct
32
+ const { component = "input", componentProps, changeDelay = 480, onChangeDelay, fullWidth = true, slotProps = {}, ...rest } = props;
23
33
  const { labelProps = {
24
34
  title: app?.get("clickForDetails"),
25
35
  sx: { color: (theme) => theme.palette.error.main, cursor: "pointer" }
26
- }, changeDelay = 480, onChangeDelay, loadData, itemLabel = (item) => item.label, renderItem = (item) => _jsx(ListItem, { children: itemLabel(item) }, item.id), slotProps = {}, ...rest } = props;
36
+ }, loadData, itemLabel = (item) => item.label, renderItem = (item) => _jsx(ListItem, { children: itemLabel(item) }, item.id) } = componentProps;
27
37
  const { input, ...slotRests } = slotProps;
38
+ const Component = componentMap[component];
28
39
  const load = (value) => {
29
40
  if (value.length < 2) {
30
41
  setTitle(undefined);
@@ -38,7 +49,7 @@ export function InputTipField(props) {
38
49
  return (_jsxs(React.Fragment, { children: [_jsx(Popover, { open: anchorEl != null, anchorEl: anchorEl, onClose: () => setAnchorEl(undefined), anchorOrigin: {
39
50
  vertical: "bottom",
40
51
  horizontal: "left"
41
- }, children: data && _jsx(List, { children: data.map((item) => renderItem(item)) }) }), _jsx(InputField, { changeDelay: changeDelay, onChangeDelay: (event) => {
52
+ }, children: data && _jsx(List, { children: data.map((item) => renderItem(item)) }) }), _jsx(Component, { changeDelay: changeDelay, fullWidth: fullWidth, onChangeDelay: (event) => {
42
53
  load(event.target.value);
43
54
  if (onChangeDelay)
44
55
  onChangeDelay(event);
@@ -52,4 +52,4 @@ export type IntInputFieldProps = Omit<InputFieldProps, "type" | "inputProps" | "
52
52
  /**
53
53
  * Integer input field (controlled)
54
54
  */
55
- export declare const IntInputField: React.ForwardRefExoticComponent<Omit<IntInputFieldProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
55
+ export declare function IntInputField(props: IntInputFieldProps): import("react/jsx-runtime").JSX.Element;
@@ -10,7 +10,7 @@ import IconButton from "@mui/material/IconButton";
10
10
  /**
11
11
  * Integer input field (controlled)
12
12
  */
13
- export const IntInputField = React.forwardRef((props, ref) => {
13
+ export function IntInputField(props) {
14
14
  // Destruct
15
15
  const { min = 0, step = 1, max = 9999999, inputStyle = { textAlign: "right" }, boxProps, buttons, endSymbol, symbol, value, changeDelay = 600, onChangeDelay, onChange, onFocus = (event) => event.currentTarget.select(), onValueChange, required, ...rest } = props;
16
16
  // State
@@ -37,15 +37,12 @@ export const IntInputField = React.forwardRef((props, ref) => {
37
37
  setValue(value, undefined, true);
38
38
  }, [value]);
39
39
  // Layout
40
- const layout = (_jsx(InputField, { ref: ref, type: "number", value: localValue == null ? (required ? min : "") : localValue, inputProps: {
41
- min,
42
- step,
43
- max,
44
- style: inputStyle,
45
- inputMode: "numeric"
46
- }, InputProps: {
47
- startAdornment: symbol ? (_jsx(React.Fragment, { children: _jsx(InputAdornment, { position: "start", children: symbol }) })) : undefined,
48
- endAdornment: endSymbol ? (_jsx(InputAdornment, { position: "end", children: endSymbol })) : undefined
40
+ const layout = (_jsx(InputField, { type: "number", value: localValue == null ? (required ? min : "") : localValue, slotProps: {
41
+ input: {
42
+ startAdornment: symbol ? (_jsx(React.Fragment, { children: _jsx(InputAdornment, { position: "start", children: symbol }) })) : undefined,
43
+ endAdornment: endSymbol ? (_jsx(InputAdornment, { position: "end", children: endSymbol })) : undefined
44
+ },
45
+ htmlInput: { min, step, max, style: inputStyle, inputMode: "numeric" }
49
46
  }, sx: buttons
50
47
  ? {
51
48
  "& input[type=number]::-webkit-inner-spin-button": {
@@ -109,4 +106,4 @@ export const IntInputField = React.forwardRef((props, ref) => {
109
106
  }, children: _jsx(AddIcon, { color: localValue == null ? undefined : "primary" }) })] }));
110
107
  else
111
108
  return layout;
112
- });
109
+ }
@@ -1,8 +1,8 @@
1
- import { TextFieldProps } from "@mui/material/TextField";
1
+ import { InputFieldProps } from "./InputField";
2
2
  /**
3
3
  * Mobile input props
4
4
  */
5
- export type MobileInputProps = Omit<TextFieldProps, "type"> & {};
5
+ export type MobileInputProps = Omit<InputFieldProps, "type"> & {};
6
6
  /**
7
7
  * Mobile input
8
8
  * @param props Props
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import TextField from "@mui/material/TextField";
3
2
  import { useAppContext } from "./app/ReactApp";
4
3
  import { MUGlobal } from "./MUGlobal";
4
+ import { InputField } from "./InputField";
5
5
  /**
6
6
  * Mobile input
7
7
  * @param props Props
@@ -14,7 +14,7 @@ export function MobileInput(props) {
14
14
  // Slot props
15
15
  const { htmlInput, inputLabel, ...restSlotProps } = slotProps ?? {};
16
16
  // Layout
17
- return (_jsx(TextField, { type: "tel", autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, autoComplete: autoComplete, fullWidth: fullWidth, label: label, name: name, slotProps: {
17
+ return (_jsx(InputField, { type: "tel", autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, autoComplete: autoComplete, fullWidth: fullWidth, label: label, name: name, slotProps: {
18
18
  htmlInput: { inputMode: "tel", maxLength: 18, ...htmlInput },
19
19
  inputLabel: { shrink: MUGlobal.inputFieldShrink, ...inputLabel },
20
20
  ...restSlotProps
@@ -1,4 +1,3 @@
1
- import React from "react";
2
1
  import { IntInputFieldProps } from "./IntInputField";
3
2
  /**
4
3
  * Money input field props
@@ -7,4 +6,4 @@ export type MoneyInputFieldProps = IntInputFieldProps & {};
7
6
  /**
8
7
  * Money input field (controlled)
9
8
  */
10
- export declare const MoneyInputField: React.ForwardRefExoticComponent<Omit<MoneyInputFieldProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
9
+ export declare function MoneyInputField(props: MoneyInputFieldProps): import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import React from "react";
3
2
  import { IntInputField } from "./IntInputField";
4
3
  /**
5
4
  * Money input field (controlled)
6
5
  */
7
- export const MoneyInputField = React.forwardRef((props, ref) => {
6
+ export function MoneyInputField(props) {
8
7
  // Destruct
9
8
  const { step = 0.01, ...rest } = props;
10
9
  // Layout
11
- return _jsx(IntInputField, { ref: ref, step: step, ...rest });
12
- });
10
+ return _jsx(IntInputField, { step: step, ...rest });
11
+ }
@@ -1,8 +1,8 @@
1
- import { TextFieldProps } from "@mui/material/TextField";
1
+ import { InputFieldProps } from "./InputField";
2
2
  /**
3
3
  * Phone input props
4
4
  */
5
- export type PhoneInputProps = Omit<TextFieldProps, "type"> & {};
5
+ export type PhoneInputProps = Omit<InputFieldProps, "type"> & {};
6
6
  /**
7
7
  * Phone input
8
8
  * @param props Props
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import TextField from "@mui/material/TextField";
3
2
  import { useAppContext } from "./app/ReactApp";
4
3
  import { MUGlobal } from "./MUGlobal";
4
+ import { InputField } from "./InputField";
5
5
  /**
6
6
  * Phone input
7
7
  * @param props Props
@@ -14,7 +14,7 @@ export function PhoneInput(props) {
14
14
  // Slot props
15
15
  const { htmlInput, inputLabel, ...restSlotProps } = slotProps ?? {};
16
16
  // Layout
17
- return (_jsx(TextField, { type: "tel", autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, autoComplete: autoComplete, fullWidth: fullWidth, label: label, name: name, slotProps: {
17
+ return (_jsx(InputField, { type: "tel", autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, autoComplete: autoComplete, fullWidth: fullWidth, label: label, name: name, slotProps: {
18
18
  htmlInput: { inputMode: "tel", maxLength: 18, ...htmlInput },
19
19
  inputLabel: { shrink: MUGlobal.inputFieldShrink, ...inputLabel },
20
20
  ...restSlotProps
@@ -38,6 +38,10 @@ export type TextFieldExProps = TextFieldProps & {
38
38
  * Show password button
39
39
  */
40
40
  showPassword?: boolean;
41
+ /**
42
+ * Methods
43
+ */
44
+ mRef?: React.Ref<TextFieldExMethods>;
41
45
  };
42
46
  /**
43
47
  * Extended text field methods
@@ -49,109 +53,4 @@ export interface TextFieldExMethods {
49
53
  */
50
54
  setError(error: React.ReactNode): void;
51
55
  }
52
- export declare const TextFieldEx: React.ForwardRefExoticComponent<(Omit<import("@mui/material").StandardTextFieldProps & {
53
- /**
54
- * Change delay (ms) to avoid repeatly dispatch onChange
55
- */
56
- changeDelay?: number;
57
- /**
58
- * Clear button label
59
- */
60
- clearLabel?: string;
61
- /**
62
- * Click clear button callback
63
- */
64
- onClear?: (doClear: () => void) => void;
65
- /**
66
- * On enter click
67
- */
68
- onEnter?: React.KeyboardEventHandler<HTMLDivElement>;
69
- /**
70
- * On visibility
71
- * @param input HTML input
72
- * @returns Result
73
- */
74
- onVisibility?: (input: HTMLInputElement) => void | boolean | Promise<boolean>;
75
- /**
76
- * Is the field read only?
77
- */
78
- readOnly?: boolean;
79
- /**
80
- * Show clear button
81
- */
82
- showClear?: boolean;
83
- /**
84
- * Show password button
85
- */
86
- showPassword?: boolean;
87
- }, "ref"> | Omit<import("@mui/material").OutlinedTextFieldProps & {
88
- /**
89
- * Change delay (ms) to avoid repeatly dispatch onChange
90
- */
91
- changeDelay?: number;
92
- /**
93
- * Clear button label
94
- */
95
- clearLabel?: string;
96
- /**
97
- * Click clear button callback
98
- */
99
- onClear?: (doClear: () => void) => void;
100
- /**
101
- * On enter click
102
- */
103
- onEnter?: React.KeyboardEventHandler<HTMLDivElement>;
104
- /**
105
- * On visibility
106
- * @param input HTML input
107
- * @returns Result
108
- */
109
- onVisibility?: (input: HTMLInputElement) => void | boolean | Promise<boolean>;
110
- /**
111
- * Is the field read only?
112
- */
113
- readOnly?: boolean;
114
- /**
115
- * Show clear button
116
- */
117
- showClear?: boolean;
118
- /**
119
- * Show password button
120
- */
121
- showPassword?: boolean;
122
- }, "ref"> | Omit<import("@mui/material").FilledTextFieldProps & {
123
- /**
124
- * Change delay (ms) to avoid repeatly dispatch onChange
125
- */
126
- changeDelay?: number;
127
- /**
128
- * Clear button label
129
- */
130
- clearLabel?: string;
131
- /**
132
- * Click clear button callback
133
- */
134
- onClear?: (doClear: () => void) => void;
135
- /**
136
- * On enter click
137
- */
138
- onEnter?: React.KeyboardEventHandler<HTMLDivElement>;
139
- /**
140
- * On visibility
141
- * @param input HTML input
142
- * @returns Result
143
- */
144
- onVisibility?: (input: HTMLInputElement) => void | boolean | Promise<boolean>;
145
- /**
146
- * Is the field read only?
147
- */
148
- readOnly?: boolean;
149
- /**
150
- * Show clear button
151
- */
152
- showClear?: boolean;
153
- /**
154
- * Show password button
155
- */
156
- showPassword?: boolean;
157
- }, "ref">) & React.RefAttributes<TextFieldExMethods>>;
56
+ export declare function TextFieldEx(props: TextFieldExProps): import("react/jsx-runtime").JSX.Element;