@etsoo/materialui 1.5.81 → 1.5.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.
@@ -6,16 +6,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.EmailInput = EmailInput;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const TextField_1 = __importDefault(require("@mui/material/TextField"));
9
+ const ReactApp_1 = require("./app/ReactApp");
10
+ const MUGlobal_1 = require("./MUGlobal");
9
11
  /**
10
12
  * Email input
11
13
  * @param props Props
12
14
  */
13
15
  function EmailInput(props) {
16
+ // Global app
17
+ const app = (0, ReactApp_1.useAppContext)();
14
18
  // Destruct
15
- const { slotProps, autoCapitalize = "none", autoCorrect = "off", autoComplete = "email", fullWidth = true, name = "email", ...rest } = props;
19
+ const { autoCapitalize = "none", autoCorrect = "off", autoComplete = "email", fullWidth = true, label = app?.get("email"), name = "email", slotProps, ...rest } = props;
20
+ // Slot props
21
+ const { htmlInput, inputLabel, ...restSlotProps } = slotProps ?? {};
16
22
  // Layout
17
- return ((0, jsx_runtime_1.jsx)(TextField_1.default, { type: "email", autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, autoComplete: autoComplete, fullWidth: fullWidth, name: name, slotProps: {
18
- htmlInput: { inputMode: "email", maxLength: 128 },
19
- ...slotProps
23
+ return ((0, jsx_runtime_1.jsx)(TextField_1.default, { type: "email", autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, autoComplete: autoComplete, fullWidth: fullWidth, label: label, name: name, slotProps: {
24
+ htmlInput: { inputMode: "email", maxLength: 128, ...htmlInput },
25
+ inputLabel: { shrink: MUGlobal_1.MUGlobal.inputFieldShrink, ...inputLabel },
26
+ ...restSlotProps
20
27
  }, ...rest }));
21
28
  }
@@ -16,14 +16,9 @@ const TextField_1 = __importDefault(require("@mui/material/TextField"));
16
16
  */
17
17
  exports.InputField = react_2.default.forwardRef((props, ref) => {
18
18
  // Destruct
19
- const { changeDelay, InputLabelProps = {}, InputProps = {}, inputProps = {}, onChange, onChangeDelay, readOnly, size = MUGlobal_1.MUGlobal.inputFieldSize, variant = MUGlobal_1.MUGlobal.inputFieldVariant, minChars = 0, ...rest } = props;
20
- // Shrink
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;
19
+ const { InputProps = {}, inputProps = {}, changeDelay, slotProps, onChange, onChangeDelay, readOnly, size = MUGlobal_1.MUGlobal.inputFieldSize, variant = MUGlobal_1.MUGlobal.inputFieldVariant, minChars = 0, ...rest } = props;
20
+ // Slot props
21
+ const { htmlInput, input, inputLabel, ...restSlotProps } = slotProps ?? {};
27
22
  const isMounted = react_2.default.useRef(true);
28
23
  const createDelayed = () => {
29
24
  if (changeDelay != null && changeDelay >= 1) {
@@ -54,5 +49,17 @@ exports.InputField = react_2.default.forwardRef((props, ref) => {
54
49
  };
55
50
  }, []);
56
51
  // Layout
57
- return ((0, jsx_runtime_1.jsx)(TextField_1.default, { ref: ref, InputLabelProps: InputLabelProps, InputProps: InputProps, inputProps: inputProps, onChange: onChangeEx, size: size, variant: variant, ...rest }));
52
+ return ((0, jsx_runtime_1.jsx)(TextField_1.default, { ref: ref, slotProps: {
53
+ htmlInput: {
54
+ ["data-min-chars"]: minChars,
55
+ ...htmlInput,
56
+ ...inputProps
57
+ },
58
+ input: { readOnly, ...input, ...InputProps },
59
+ inputLabel: {
60
+ shrink: MUGlobal_1.MUGlobal.inputFieldShrink,
61
+ ...inputLabel
62
+ },
63
+ ...restSlotProps
64
+ }, onChange: onChangeEx, size: size, variant: variant, ...rest }));
58
65
  });
@@ -6,16 +6,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.MobileInput = MobileInput;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const TextField_1 = __importDefault(require("@mui/material/TextField"));
9
+ const ReactApp_1 = require("./app/ReactApp");
10
+ const MUGlobal_1 = require("./MUGlobal");
9
11
  /**
10
12
  * Mobile input
11
13
  * @param props Props
12
14
  */
13
15
  function MobileInput(props) {
16
+ // Global app
17
+ const app = (0, ReactApp_1.useAppContext)();
14
18
  // Destruct
15
- const { slotProps, autoCapitalize = "none", autoCorrect = "off", autoComplete = "mobile", fullWidth = true, name = "mobile", ...rest } = props;
19
+ const { slotProps, autoCapitalize = "none", autoCorrect = "off", autoComplete = "mobile", fullWidth = true, label = app?.get("mobile"), name = "mobile", ...rest } = props;
20
+ // Slot props
21
+ const { htmlInput, inputLabel, ...restSlotProps } = slotProps ?? {};
16
22
  // Layout
17
- return ((0, jsx_runtime_1.jsx)(TextField_1.default, { type: "tel", autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, autoComplete: autoComplete, fullWidth: fullWidth, name: name, slotProps: {
18
- htmlInput: { inputMode: "tel", maxLength: 18 },
19
- ...slotProps
23
+ return ((0, jsx_runtime_1.jsx)(TextField_1.default, { type: "tel", autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, autoComplete: autoComplete, fullWidth: fullWidth, label: label, name: name, slotProps: {
24
+ htmlInput: { inputMode: "tel", maxLength: 18, ...htmlInput },
25
+ inputLabel: { shrink: MUGlobal_1.MUGlobal.inputFieldShrink, ...inputLabel },
26
+ ...restSlotProps
20
27
  }, ...rest }));
21
28
  }
@@ -6,16 +6,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.PhoInput = PhoInput;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const TextField_1 = __importDefault(require("@mui/material/TextField"));
9
+ const ReactApp_1 = require("./app/ReactApp");
10
+ const MUGlobal_1 = require("./MUGlobal");
9
11
  /**
10
12
  * Phone input
11
13
  * @param props Props
12
14
  */
13
15
  function PhoInput(props) {
16
+ // Global app
17
+ const app = (0, ReactApp_1.useAppContext)();
14
18
  // Destruct
15
- const { slotProps, autoCapitalize = "none", autoCorrect = "off", autoComplete = "phone", fullWidth = true, name = "phone", ...rest } = props;
19
+ const { slotProps, autoCapitalize = "none", autoCorrect = "off", autoComplete = "phone", fullWidth = true, label = app?.get("phone"), name = "phone", ...rest } = props;
20
+ // Slot props
21
+ const { htmlInput, inputLabel, ...restSlotProps } = slotProps ?? {};
16
22
  // Layout
17
- return ((0, jsx_runtime_1.jsx)(TextField_1.default, { type: "tel", autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, autoComplete: autoComplete, fullWidth: fullWidth, name: name, slotProps: {
18
- htmlInput: { inputMode: "tel", maxLength: 18 },
19
- ...slotProps
23
+ return ((0, jsx_runtime_1.jsx)(TextField_1.default, { type: "tel", autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, autoComplete: autoComplete, fullWidth: fullWidth, label: label, name: name, slotProps: {
24
+ htmlInput: { inputMode: "tel", maxLength: 18, ...htmlInput },
25
+ inputLabel: { shrink: MUGlobal_1.MUGlobal.inputFieldShrink, ...inputLabel },
26
+ ...restSlotProps
20
27
  }, ...rest }));
21
28
  }
@@ -1,15 +1,22 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import TextField from "@mui/material/TextField";
3
+ import { useAppContext } from "./app/ReactApp";
4
+ import { MUGlobal } from "./MUGlobal";
3
5
  /**
4
6
  * Email input
5
7
  * @param props Props
6
8
  */
7
9
  export function EmailInput(props) {
10
+ // Global app
11
+ const app = useAppContext();
8
12
  // Destruct
9
- const { slotProps, autoCapitalize = "none", autoCorrect = "off", autoComplete = "email", fullWidth = true, name = "email", ...rest } = props;
13
+ const { autoCapitalize = "none", autoCorrect = "off", autoComplete = "email", fullWidth = true, label = app?.get("email"), name = "email", slotProps, ...rest } = props;
14
+ // Slot props
15
+ const { htmlInput, inputLabel, ...restSlotProps } = slotProps ?? {};
10
16
  // Layout
11
- return (_jsx(TextField, { type: "email", autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, autoComplete: autoComplete, fullWidth: fullWidth, name: name, slotProps: {
12
- htmlInput: { inputMode: "email", maxLength: 128 },
13
- ...slotProps
17
+ return (_jsx(TextField, { type: "email", autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, autoComplete: autoComplete, fullWidth: fullWidth, label: label, name: name, slotProps: {
18
+ htmlInput: { inputMode: "email", maxLength: 128, ...htmlInput },
19
+ inputLabel: { shrink: MUGlobal.inputFieldShrink, ...inputLabel },
20
+ ...restSlotProps
14
21
  }, ...rest }));
15
22
  }
@@ -10,14 +10,9 @@ import TextField from "@mui/material/TextField";
10
10
  */
11
11
  export const InputField = React.forwardRef((props, ref) => {
12
12
  // Destruct
13
- const { changeDelay, InputLabelProps = {}, InputProps = {}, inputProps = {}, onChange, onChangeDelay, readOnly, size = MUGlobal.inputFieldSize, variant = MUGlobal.inputFieldVariant, minChars = 0, ...rest } = props;
14
- // Shrink
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;
13
+ const { InputProps = {}, inputProps = {}, changeDelay, slotProps, onChange, onChangeDelay, readOnly, size = MUGlobal.inputFieldSize, variant = MUGlobal.inputFieldVariant, minChars = 0, ...rest } = props;
14
+ // Slot props
15
+ const { htmlInput, input, inputLabel, ...restSlotProps } = slotProps ?? {};
21
16
  const isMounted = React.useRef(true);
22
17
  const createDelayed = () => {
23
18
  if (changeDelay != null && changeDelay >= 1) {
@@ -48,5 +43,17 @@ export const InputField = React.forwardRef((props, ref) => {
48
43
  };
49
44
  }, []);
50
45
  // Layout
51
- return (_jsx(TextField, { ref: ref, InputLabelProps: InputLabelProps, InputProps: InputProps, inputProps: inputProps, onChange: onChangeEx, size: size, variant: variant, ...rest }));
46
+ return (_jsx(TextField, { ref: ref, slotProps: {
47
+ htmlInput: {
48
+ ["data-min-chars"]: minChars,
49
+ ...htmlInput,
50
+ ...inputProps
51
+ },
52
+ input: { readOnly, ...input, ...InputProps },
53
+ inputLabel: {
54
+ shrink: MUGlobal.inputFieldShrink,
55
+ ...inputLabel
56
+ },
57
+ ...restSlotProps
58
+ }, onChange: onChangeEx, size: size, variant: variant, ...rest }));
52
59
  });
@@ -1,15 +1,22 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import TextField from "@mui/material/TextField";
3
+ import { useAppContext } from "./app/ReactApp";
4
+ import { MUGlobal } from "./MUGlobal";
3
5
  /**
4
6
  * Mobile input
5
7
  * @param props Props
6
8
  */
7
9
  export function MobileInput(props) {
10
+ // Global app
11
+ const app = useAppContext();
8
12
  // Destruct
9
- const { slotProps, autoCapitalize = "none", autoCorrect = "off", autoComplete = "mobile", fullWidth = true, name = "mobile", ...rest } = props;
13
+ const { slotProps, autoCapitalize = "none", autoCorrect = "off", autoComplete = "mobile", fullWidth = true, label = app?.get("mobile"), name = "mobile", ...rest } = props;
14
+ // Slot props
15
+ const { htmlInput, inputLabel, ...restSlotProps } = slotProps ?? {};
10
16
  // Layout
11
- return (_jsx(TextField, { type: "tel", autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, autoComplete: autoComplete, fullWidth: fullWidth, name: name, slotProps: {
12
- htmlInput: { inputMode: "tel", maxLength: 18 },
13
- ...slotProps
17
+ return (_jsx(TextField, { type: "tel", autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, autoComplete: autoComplete, fullWidth: fullWidth, label: label, name: name, slotProps: {
18
+ htmlInput: { inputMode: "tel", maxLength: 18, ...htmlInput },
19
+ inputLabel: { shrink: MUGlobal.inputFieldShrink, ...inputLabel },
20
+ ...restSlotProps
14
21
  }, ...rest }));
15
22
  }
@@ -1,15 +1,22 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import TextField from "@mui/material/TextField";
3
+ import { useAppContext } from "./app/ReactApp";
4
+ import { MUGlobal } from "./MUGlobal";
3
5
  /**
4
6
  * Phone input
5
7
  * @param props Props
6
8
  */
7
9
  export function PhoInput(props) {
10
+ // Global app
11
+ const app = useAppContext();
8
12
  // Destruct
9
- const { slotProps, autoCapitalize = "none", autoCorrect = "off", autoComplete = "phone", fullWidth = true, name = "phone", ...rest } = props;
13
+ const { slotProps, autoCapitalize = "none", autoCorrect = "off", autoComplete = "phone", fullWidth = true, label = app?.get("phone"), name = "phone", ...rest } = props;
14
+ // Slot props
15
+ const { htmlInput, inputLabel, ...restSlotProps } = slotProps ?? {};
10
16
  // Layout
11
- return (_jsx(TextField, { type: "tel", autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, autoComplete: autoComplete, fullWidth: fullWidth, name: name, slotProps: {
12
- htmlInput: { inputMode: "tel", maxLength: 18 },
13
- ...slotProps
17
+ return (_jsx(TextField, { type: "tel", autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, autoComplete: autoComplete, fullWidth: fullWidth, label: label, name: name, slotProps: {
18
+ htmlInput: { inputMode: "tel", maxLength: 18, ...htmlInput },
19
+ inputLabel: { shrink: MUGlobal.inputFieldShrink, ...inputLabel },
20
+ ...restSlotProps
14
21
  }, ...rest }));
15
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.5.81",
3
+ "version": "1.5.83",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -46,7 +46,7 @@
46
46
  "@etsoo/shared": "^1.2.79",
47
47
  "@mui/icons-material": "^7.3.5",
48
48
  "@mui/material": "^7.3.5",
49
- "@mui/x-data-grid": "^8.16.0",
49
+ "@mui/x-data-grid": "^8.17.0",
50
50
  "chart.js": "^4.5.1",
51
51
  "chartjs-plugin-datalabels": "^2.2.0",
52
52
  "dompurify": "^3.3.0",
@@ -1,4 +1,6 @@
1
1
  import TextField, { TextFieldProps } from "@mui/material/TextField";
2
+ import { useAppContext } from "./app/ReactApp";
3
+ import { MUGlobal } from "./MUGlobal";
2
4
 
3
5
  /**
4
6
  * Email input props
@@ -10,17 +12,24 @@ export type EmailInputProps = Omit<TextFieldProps, "type"> & {};
10
12
  * @param props Props
11
13
  */
12
14
  export function EmailInput(props: EmailInputProps) {
15
+ // Global app
16
+ const app = useAppContext();
17
+
13
18
  // Destruct
14
19
  const {
15
- slotProps,
16
20
  autoCapitalize = "none",
17
21
  autoCorrect = "off",
18
22
  autoComplete = "email",
19
23
  fullWidth = true,
24
+ label = app?.get("email"),
20
25
  name = "email",
26
+ slotProps,
21
27
  ...rest
22
28
  } = props;
23
29
 
30
+ // Slot props
31
+ const { htmlInput, inputLabel, ...restSlotProps } = slotProps ?? {};
32
+
24
33
  // Layout
25
34
  return (
26
35
  <TextField
@@ -29,10 +38,12 @@ export function EmailInput(props: EmailInputProps) {
29
38
  autoCorrect={autoCorrect}
30
39
  autoComplete={autoComplete}
31
40
  fullWidth={fullWidth}
41
+ label={label}
32
42
  name={name}
33
43
  slotProps={{
34
- htmlInput: { inputMode: "email", maxLength: 128 },
35
- ...slotProps
44
+ htmlInput: { inputMode: "email", maxLength: 128, ...htmlInput },
45
+ inputLabel: { shrink: MUGlobal.inputFieldShrink, ...inputLabel },
46
+ ...restSlotProps
36
47
  }}
37
48
  {...rest}
38
49
  />
@@ -39,10 +39,10 @@ export const InputField = React.forwardRef<HTMLDivElement, InputFieldProps>(
39
39
  (props, ref) => {
40
40
  // Destruct
41
41
  const {
42
- changeDelay,
43
- InputLabelProps = {},
44
42
  InputProps = {},
45
43
  inputProps = {},
44
+ changeDelay,
45
+ slotProps,
46
46
  onChange,
47
47
  onChangeDelay,
48
48
  readOnly,
@@ -52,14 +52,8 @@ export const InputField = React.forwardRef<HTMLDivElement, InputFieldProps>(
52
52
  ...rest
53
53
  } = props;
54
54
 
55
- // Shrink
56
- InputLabelProps.shrink ??= MUGlobal.searchFieldShrink;
57
-
58
- // Read only
59
- if (readOnly != null) InputProps.readOnly = readOnly;
60
-
61
- // Min characters
62
- inputProps["data-min-chars"] = minChars;
55
+ // Slot props
56
+ const { htmlInput, input, inputLabel, ...restSlotProps } = slotProps ?? {};
63
57
 
64
58
  const isMounted = React.useRef(true);
65
59
  const createDelayed = () => {
@@ -100,9 +94,19 @@ export const InputField = React.forwardRef<HTMLDivElement, InputFieldProps>(
100
94
  return (
101
95
  <TextField
102
96
  ref={ref}
103
- InputLabelProps={InputLabelProps}
104
- InputProps={InputProps}
105
- inputProps={inputProps}
97
+ slotProps={{
98
+ htmlInput: {
99
+ ["data-min-chars"]: minChars,
100
+ ...htmlInput,
101
+ ...inputProps
102
+ },
103
+ input: { readOnly, ...input, ...InputProps },
104
+ inputLabel: {
105
+ shrink: MUGlobal.inputFieldShrink,
106
+ ...inputLabel
107
+ },
108
+ ...restSlotProps
109
+ }}
106
110
  onChange={onChangeEx}
107
111
  size={size}
108
112
  variant={variant}
@@ -1,4 +1,6 @@
1
1
  import TextField, { TextFieldProps } from "@mui/material/TextField";
2
+ import { useAppContext } from "./app/ReactApp";
3
+ import { MUGlobal } from "./MUGlobal";
2
4
 
3
5
  /**
4
6
  * Mobile input props
@@ -10,6 +12,9 @@ export type MobileInputProps = Omit<TextFieldProps, "type"> & {};
10
12
  * @param props Props
11
13
  */
12
14
  export function MobileInput(props: MobileInputProps) {
15
+ // Global app
16
+ const app = useAppContext();
17
+
13
18
  // Destruct
14
19
  const {
15
20
  slotProps,
@@ -17,10 +22,14 @@ export function MobileInput(props: MobileInputProps) {
17
22
  autoCorrect = "off",
18
23
  autoComplete = "mobile",
19
24
  fullWidth = true,
25
+ label = app?.get("mobile"),
20
26
  name = "mobile",
21
27
  ...rest
22
28
  } = props;
23
29
 
30
+ // Slot props
31
+ const { htmlInput, inputLabel, ...restSlotProps } = slotProps ?? {};
32
+
24
33
  // Layout
25
34
  return (
26
35
  <TextField
@@ -29,10 +38,12 @@ export function MobileInput(props: MobileInputProps) {
29
38
  autoCorrect={autoCorrect}
30
39
  autoComplete={autoComplete}
31
40
  fullWidth={fullWidth}
41
+ label={label}
32
42
  name={name}
33
43
  slotProps={{
34
- htmlInput: { inputMode: "tel", maxLength: 18 },
35
- ...slotProps
44
+ htmlInput: { inputMode: "tel", maxLength: 18, ...htmlInput },
45
+ inputLabel: { shrink: MUGlobal.inputFieldShrink, ...inputLabel },
46
+ ...restSlotProps
36
47
  }}
37
48
  {...rest}
38
49
  />
@@ -1,4 +1,6 @@
1
1
  import TextField, { TextFieldProps } from "@mui/material/TextField";
2
+ import { useAppContext } from "./app/ReactApp";
3
+ import { MUGlobal } from "./MUGlobal";
2
4
 
3
5
  /**
4
6
  * Phone input props
@@ -10,6 +12,9 @@ export type PhoneInputProps = Omit<TextFieldProps, "type"> & {};
10
12
  * @param props Props
11
13
  */
12
14
  export function PhoInput(props: PhoneInputProps) {
15
+ // Global app
16
+ const app = useAppContext();
17
+
13
18
  // Destruct
14
19
  const {
15
20
  slotProps,
@@ -17,10 +22,14 @@ export function PhoInput(props: PhoneInputProps) {
17
22
  autoCorrect = "off",
18
23
  autoComplete = "phone",
19
24
  fullWidth = true,
25
+ label = app?.get("phone"),
20
26
  name = "phone",
21
27
  ...rest
22
28
  } = props;
23
29
 
30
+ // Slot props
31
+ const { htmlInput, inputLabel, ...restSlotProps } = slotProps ?? {};
32
+
24
33
  // Layout
25
34
  return (
26
35
  <TextField
@@ -29,10 +38,12 @@ export function PhoInput(props: PhoneInputProps) {
29
38
  autoCorrect={autoCorrect}
30
39
  autoComplete={autoComplete}
31
40
  fullWidth={fullWidth}
41
+ label={label}
32
42
  name={name}
33
43
  slotProps={{
34
- htmlInput: { inputMode: "tel", maxLength: 18 },
35
- ...slotProps
44
+ htmlInput: { inputMode: "tel", maxLength: 18, ...htmlInput },
45
+ inputLabel: { shrink: MUGlobal.inputFieldShrink, ...inputLabel },
46
+ ...restSlotProps
36
47
  }}
37
48
  {...rest}
38
49
  />