@etsoo/materialui 1.5.14 → 1.5.15

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.
@@ -7,8 +7,8 @@ exports.SearchField = SearchField;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const react_1 = require("@etsoo/react");
9
9
  const react_2 = __importDefault(require("react"));
10
- const TextField_1 = __importDefault(require("@mui/material/TextField"));
11
10
  const MUGlobal_1 = require("./MUGlobal");
11
+ const TextField_1 = __importDefault(require("@mui/material/TextField"));
12
12
  /**
13
13
  * Search field
14
14
  * @param props Props
@@ -16,13 +16,14 @@ const MUGlobal_1 = require("./MUGlobal");
16
16
  */
17
17
  function SearchField(props) {
18
18
  // Destruct
19
- const { changeDelay, onChange, readOnly, slotProps = {}, size = MUGlobal_1.MUGlobal.searchFieldSize, variant = MUGlobal_1.MUGlobal.searchFieldVariant, minChars = 0, ...rest } = props;
19
+ const { changeDelay, InputLabelProps = {}, InputProps = {}, inputProps = {}, onChange, readOnly, size = MUGlobal_1.MUGlobal.searchFieldSize, variant = MUGlobal_1.MUGlobal.searchFieldVariant, minChars = 0, ...rest } = props;
20
20
  // Shrink
21
- const defaultProps = {
22
- input: { readOnly: readOnly },
23
- inputLabel: { shrink: MUGlobal_1.MUGlobal.searchFieldShrink },
24
- htmlInput: { "data-min-chars": minChars }
25
- };
21
+ InputLabelProps.shrink ??= MUGlobal_1.MUGlobal.searchFieldShrink;
22
+ // Read only
23
+ if (readOnly != null)
24
+ InputProps.readOnly = readOnly;
25
+ // Min characters
26
+ inputProps["data-min-chars"] = minChars;
26
27
  const isMounted = react_2.default.useRef(true);
27
28
  const delayed = onChange != null && changeDelay != null && changeDelay >= 1
28
29
  ? (0, react_1.useDelayedExecutor)(onChange, changeDelay)
@@ -51,5 +52,5 @@ function SearchField(props) {
51
52
  };
52
53
  }, []);
53
54
  // Layout
54
- return ((0, jsx_runtime_1.jsx)(TextField_1.default, { slotProps: Object.assign(slotProps, defaultProps), onChange: onChangeEx, size: size, variant: variant, ...rest }));
55
+ return ((0, jsx_runtime_1.jsx)(TextField_1.default, { InputLabelProps: InputLabelProps, InputProps: InputProps, inputProps: inputProps, onChange: onChangeEx, size: size, variant: variant, ...rest }));
55
56
  }
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useDelayedExecutor } from "@etsoo/react";
3
3
  import React from "react";
4
- import TextField from "@mui/material/TextField";
5
4
  import { MUGlobal } from "./MUGlobal";
5
+ import TextField from "@mui/material/TextField";
6
6
  /**
7
7
  * Search field
8
8
  * @param props Props
@@ -10,13 +10,14 @@ import { MUGlobal } from "./MUGlobal";
10
10
  */
11
11
  export function SearchField(props) {
12
12
  // Destruct
13
- const { changeDelay, onChange, readOnly, slotProps = {}, size = MUGlobal.searchFieldSize, variant = MUGlobal.searchFieldVariant, minChars = 0, ...rest } = props;
13
+ const { changeDelay, InputLabelProps = {}, InputProps = {}, inputProps = {}, onChange, readOnly, size = MUGlobal.searchFieldSize, variant = MUGlobal.searchFieldVariant, minChars = 0, ...rest } = props;
14
14
  // Shrink
15
- const defaultProps = {
16
- input: { readOnly: readOnly },
17
- inputLabel: { shrink: MUGlobal.searchFieldShrink },
18
- htmlInput: { "data-min-chars": minChars }
19
- };
15
+ InputLabelProps.shrink ??= MUGlobal.searchFieldShrink;
16
+ // Read only
17
+ if (readOnly != null)
18
+ InputProps.readOnly = readOnly;
19
+ // Min characters
20
+ inputProps["data-min-chars"] = minChars;
20
21
  const isMounted = React.useRef(true);
21
22
  const delayed = onChange != null && changeDelay != null && changeDelay >= 1
22
23
  ? useDelayedExecutor(onChange, changeDelay)
@@ -45,5 +46,5 @@ export function SearchField(props) {
45
46
  };
46
47
  }, []);
47
48
  // Layout
48
- return (_jsx(TextField, { slotProps: Object.assign(slotProps, defaultProps), onChange: onChangeEx, size: size, variant: variant, ...rest }));
49
+ return (_jsx(TextField, { InputLabelProps: InputLabelProps, InputProps: InputProps, inputProps: inputProps, onChange: onChangeEx, size: size, variant: variant, ...rest }));
49
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.5.14",
3
+ "version": "1.5.15",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -1,7 +1,7 @@
1
1
  import { useDelayedExecutor } from "@etsoo/react";
2
2
  import React from "react";
3
- import TextField, { TextFieldProps } from "@mui/material/TextField";
4
3
  import { MUGlobal } from "./MUGlobal";
4
+ import TextField, { TextFieldProps } from "@mui/material/TextField";
5
5
 
6
6
  /**
7
7
  * Search field props
@@ -32,9 +32,11 @@ export function SearchField(props: SearchFieldProps) {
32
32
  // Destruct
33
33
  const {
34
34
  changeDelay,
35
+ InputLabelProps = {},
36
+ InputProps = {},
37
+ inputProps = {},
35
38
  onChange,
36
39
  readOnly,
37
- slotProps = {},
38
40
  size = MUGlobal.searchFieldSize,
39
41
  variant = MUGlobal.searchFieldVariant,
40
42
  minChars = 0,
@@ -42,11 +44,13 @@ export function SearchField(props: SearchFieldProps) {
42
44
  } = props;
43
45
 
44
46
  // Shrink
45
- const defaultProps: typeof slotProps = {
46
- input: { readOnly: readOnly },
47
- inputLabel: { shrink: MUGlobal.searchFieldShrink },
48
- htmlInput: { "data-min-chars": minChars }
49
- };
47
+ InputLabelProps.shrink ??= MUGlobal.searchFieldShrink;
48
+
49
+ // Read only
50
+ if (readOnly != null) InputProps.readOnly = readOnly;
51
+
52
+ // Min characters
53
+ inputProps["data-min-chars"] = minChars;
50
54
 
51
55
  const isMounted = React.useRef(true);
52
56
  const delayed =
@@ -86,7 +90,9 @@ export function SearchField(props: SearchFieldProps) {
86
90
  // Layout
87
91
  return (
88
92
  <TextField
89
- slotProps={Object.assign(slotProps, defaultProps)}
93
+ InputLabelProps={InputLabelProps}
94
+ InputProps={InputProps}
95
+ inputProps={inputProps}
90
96
  onChange={onChangeEx}
91
97
  size={size}
92
98
  variant={variant}