@etsoo/materialui 1.6.44 → 1.6.45

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.
@@ -16,6 +16,10 @@ export type InputFieldProps = TextFieldProps & {
16
16
  * Is the field read only?
17
17
  */
18
18
  readOnly?: boolean;
19
+ /**
20
+ * Search case
21
+ */
22
+ search?: boolean;
19
23
  };
20
24
  /**
21
25
  * Input field
@@ -16,7 +16,7 @@ const TextField_1 = __importDefault(require("@mui/material/TextField"));
16
16
  */
17
17
  function InputField(props) {
18
18
  // Destruct
19
- const { slotProps, onChange, onChangeDelay, changeDelay = onChangeDelay ? [480] : undefined, readOnly, size = MUGlobal_1.MUGlobal.inputFieldSize, variant = MUGlobal_1.MUGlobal.inputFieldVariant, ...rest } = props;
19
+ const { slotProps, onChange, onChangeDelay, changeDelay = onChangeDelay ? [480] : undefined, readOnly, search = false, size = search ? MUGlobal_1.MUGlobal.searchFieldSize : MUGlobal_1.MUGlobal.inputFieldSize, variant = search ? MUGlobal_1.MUGlobal.searchFieldVariant : MUGlobal_1.MUGlobal.inputFieldVariant, ...rest } = props;
20
20
  // Slot props
21
21
  const { htmlInput, input, inputLabel, ...restSlotProps } = slotProps ?? {};
22
22
  const isMounted = react_2.default.useRef(true);
@@ -54,7 +54,9 @@ function InputField(props) {
54
54
  },
55
55
  input: { readOnly, ...input },
56
56
  inputLabel: {
57
- shrink: MUGlobal_1.MUGlobal.inputFieldShrink,
57
+ shrink: search
58
+ ? MUGlobal_1.MUGlobal.searchFieldShrink
59
+ : MUGlobal_1.MUGlobal.inputFieldShrink,
58
60
  ...inputLabel
59
61
  },
60
62
  ...restSlotProps
@@ -29,10 +29,6 @@ export type NumberInputFieldProps = Omit<InputFieldProps, "type" | "inputProps">
29
29
  * Maximum value
30
30
  */
31
31
  max?: number;
32
- /**
33
- * Is search field?
34
- */
35
- search?: boolean;
36
32
  /**
37
33
  * Step value
38
34
  */
@@ -9,7 +9,6 @@ const react_1 = __importDefault(require("react"));
9
9
  const InputField_1 = require("./InputField");
10
10
  const shared_1 = require("@etsoo/shared");
11
11
  const InputAdornment_1 = __importDefault(require("@mui/material/InputAdornment"));
12
- const MUGlobal_1 = require("./MUGlobal");
13
12
  /**
14
13
  * Number input field, for controlled only components, please see IntInputField and MoneyInputField
15
14
  * @param props Props
@@ -18,13 +17,12 @@ const MUGlobal_1 = require("./MUGlobal");
18
17
  function NumberInputField(props) {
19
18
  const { currency, inputStyle, min = 0, step = 1, symbol = currency
20
19
  ? `${currency} ${shared_1.NumberUtils.getCurrencySymbol(currency)}`
21
- : undefined, endSymbol, max = 9999999, search = false, slotProps = {}, ...rest } = props;
22
- return ((0, jsx_runtime_1.jsx)(InputField_1.InputField, { type: "number", size: search ? MUGlobal_1.MUGlobal.searchFieldSize : undefined, slotProps: Object.assign(slotProps, {
20
+ : undefined, endSymbol, max = 9999999, slotProps = {}, ...rest } = props;
21
+ return ((0, jsx_runtime_1.jsx)(InputField_1.InputField, { type: "number", slotProps: Object.assign(slotProps, {
23
22
  input: {
24
23
  startAdornment: symbol ? ((0, jsx_runtime_1.jsx)(react_1.default.Fragment, { children: (0, jsx_runtime_1.jsx)(InputAdornment_1.default, { position: "start", children: symbol }) })) : undefined,
25
24
  endAdornment: endSymbol ? ((0, jsx_runtime_1.jsx)(InputAdornment_1.default, { position: "end", children: endSymbol })) : undefined
26
25
  },
27
- inputLabel: { shrink: search ? MUGlobal_1.MUGlobal.searchFieldShrink : undefined },
28
26
  htmlInput: {
29
27
  min,
30
28
  step,
@@ -32,5 +30,5 @@ function NumberInputField(props) {
32
30
  style: inputStyle,
33
31
  inputMode: "numeric"
34
32
  }
35
- }), variant: search ? MUGlobal_1.MUGlobal.searchFieldVariant : undefined, ...rest }));
33
+ }), ...rest }));
36
34
  }
@@ -16,6 +16,10 @@ export type InputFieldProps = TextFieldProps & {
16
16
  * Is the field read only?
17
17
  */
18
18
  readOnly?: boolean;
19
+ /**
20
+ * Search case
21
+ */
22
+ search?: boolean;
19
23
  };
20
24
  /**
21
25
  * Input field
@@ -10,7 +10,7 @@ import TextField from "@mui/material/TextField";
10
10
  */
11
11
  export function InputField(props) {
12
12
  // Destruct
13
- const { slotProps, onChange, onChangeDelay, changeDelay = onChangeDelay ? [480] : undefined, readOnly, size = MUGlobal.inputFieldSize, variant = MUGlobal.inputFieldVariant, ...rest } = props;
13
+ const { slotProps, onChange, onChangeDelay, changeDelay = onChangeDelay ? [480] : undefined, readOnly, search = false, size = search ? MUGlobal.searchFieldSize : MUGlobal.inputFieldSize, variant = search ? MUGlobal.searchFieldVariant : MUGlobal.inputFieldVariant, ...rest } = props;
14
14
  // Slot props
15
15
  const { htmlInput, input, inputLabel, ...restSlotProps } = slotProps ?? {};
16
16
  const isMounted = React.useRef(true);
@@ -48,7 +48,9 @@ export function InputField(props) {
48
48
  },
49
49
  input: { readOnly, ...input },
50
50
  inputLabel: {
51
- shrink: MUGlobal.inputFieldShrink,
51
+ shrink: search
52
+ ? MUGlobal.searchFieldShrink
53
+ : MUGlobal.inputFieldShrink,
52
54
  ...inputLabel
53
55
  },
54
56
  ...restSlotProps
@@ -29,10 +29,6 @@ export type NumberInputFieldProps = Omit<InputFieldProps, "type" | "inputProps">
29
29
  * Maximum value
30
30
  */
31
31
  max?: number;
32
- /**
33
- * Is search field?
34
- */
35
- search?: boolean;
36
32
  /**
37
33
  * Step value
38
34
  */
@@ -3,7 +3,6 @@ import React from "react";
3
3
  import { InputField } from "./InputField";
4
4
  import { NumberUtils } from "@etsoo/shared";
5
5
  import InputAdornment from "@mui/material/InputAdornment";
6
- import { MUGlobal } from "./MUGlobal";
7
6
  /**
8
7
  * Number input field, for controlled only components, please see IntInputField and MoneyInputField
9
8
  * @param props Props
@@ -12,13 +11,12 @@ import { MUGlobal } from "./MUGlobal";
12
11
  export function NumberInputField(props) {
13
12
  const { currency, inputStyle, min = 0, step = 1, symbol = currency
14
13
  ? `${currency} ${NumberUtils.getCurrencySymbol(currency)}`
15
- : undefined, endSymbol, max = 9999999, search = false, slotProps = {}, ...rest } = props;
16
- return (_jsx(InputField, { type: "number", size: search ? MUGlobal.searchFieldSize : undefined, slotProps: Object.assign(slotProps, {
14
+ : undefined, endSymbol, max = 9999999, slotProps = {}, ...rest } = props;
15
+ return (_jsx(InputField, { type: "number", slotProps: Object.assign(slotProps, {
17
16
  input: {
18
17
  startAdornment: symbol ? (_jsx(React.Fragment, { children: _jsx(InputAdornment, { position: "start", children: symbol }) })) : undefined,
19
18
  endAdornment: endSymbol ? (_jsx(InputAdornment, { position: "end", children: endSymbol })) : undefined
20
19
  },
21
- inputLabel: { shrink: search ? MUGlobal.searchFieldShrink : undefined },
22
20
  htmlInput: {
23
21
  min,
24
22
  step,
@@ -26,5 +24,5 @@ export function NumberInputField(props) {
26
24
  style: inputStyle,
27
25
  inputMode: "numeric"
28
26
  }
29
- }), variant: search ? MUGlobal.searchFieldVariant : undefined, ...rest }));
27
+ }), ...rest }));
30
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.6.44",
3
+ "version": "1.6.45",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -23,6 +23,11 @@ export type InputFieldProps = TextFieldProps & {
23
23
  * Is the field read only?
24
24
  */
25
25
  readOnly?: boolean;
26
+
27
+ /**
28
+ * Search case
29
+ */
30
+ search?: boolean;
26
31
  };
27
32
 
28
33
  /**
@@ -38,8 +43,9 @@ export function InputField(props: InputFieldProps) {
38
43
  onChangeDelay,
39
44
  changeDelay = onChangeDelay ? [480] : undefined,
40
45
  readOnly,
41
- size = MUGlobal.inputFieldSize,
42
- variant = MUGlobal.inputFieldVariant,
46
+ search = false,
47
+ size = search ? MUGlobal.searchFieldSize : MUGlobal.inputFieldSize,
48
+ variant = search ? MUGlobal.searchFieldVariant : MUGlobal.inputFieldVariant,
43
49
  ...rest
44
50
  } = props;
45
51
 
@@ -90,7 +96,9 @@ export function InputField(props: InputFieldProps) {
90
96
  },
91
97
  input: { readOnly, ...input },
92
98
  inputLabel: {
93
- shrink: MUGlobal.inputFieldShrink,
99
+ shrink: search
100
+ ? MUGlobal.searchFieldShrink
101
+ : MUGlobal.inputFieldShrink,
94
102
  ...inputLabel
95
103
  },
96
104
  ...restSlotProps
@@ -42,11 +42,6 @@ export type NumberInputFieldProps = Omit<
42
42
  */
43
43
  max?: number;
44
44
 
45
- /**
46
- * Is search field?
47
- */
48
- search?: boolean;
49
-
50
45
  /**
51
46
  * Step value
52
47
  */
@@ -69,7 +64,6 @@ export function NumberInputField(props: NumberInputFieldProps) {
69
64
  : undefined,
70
65
  endSymbol,
71
66
  max = 9999999,
72
- search = false,
73
67
  slotProps = {},
74
68
  ...rest
75
69
  } = props;
@@ -77,7 +71,6 @@ export function NumberInputField(props: NumberInputFieldProps) {
77
71
  return (
78
72
  <InputField
79
73
  type="number"
80
- size={search ? MUGlobal.searchFieldSize : undefined}
81
74
  slotProps={Object.assign(slotProps, {
82
75
  input: {
83
76
  startAdornment: symbol ? (
@@ -89,7 +82,6 @@ export function NumberInputField(props: NumberInputFieldProps) {
89
82
  <InputAdornment position="end">{endSymbol}</InputAdornment>
90
83
  ) : undefined
91
84
  },
92
- inputLabel: { shrink: search ? MUGlobal.searchFieldShrink : undefined },
93
85
  htmlInput: {
94
86
  min,
95
87
  step,
@@ -98,7 +90,6 @@ export function NumberInputField(props: NumberInputFieldProps) {
98
90
  inputMode: "numeric"
99
91
  }
100
92
  })}
101
- variant={search ? MUGlobal.searchFieldVariant : undefined}
102
93
  {...rest}
103
94
  />
104
95
  );