@etsoo/materialui 1.3.15 → 1.3.16

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.
@@ -50,6 +50,6 @@ export type IntInputFieldProps = Omit<InputFieldProps, "type" | "inputProps" | "
50
50
  boxProps?: BoxProps;
51
51
  };
52
52
  /**
53
- * Integer input field
53
+ * Integer input field (controlled)
54
54
  */
55
55
  export declare const IntInputField: React.ForwardRefExoticComponent<Omit<IntInputFieldProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
@@ -5,7 +5,7 @@ import React from "react";
5
5
  import { NumberUtils } from "@etsoo/shared";
6
6
  import { InputField } from "./InputField";
7
7
  /**
8
- * Integer input field
8
+ * Integer input field (controlled)
9
9
  */
10
10
  export const IntInputField = React.forwardRef((props, ref) => {
11
11
  // Destruct
@@ -5,6 +5,6 @@ import { IntInputFieldProps } from "./IntInputField";
5
5
  */
6
6
  export type MoneyInputFieldProps = IntInputFieldProps & {};
7
7
  /**
8
- * Money input field
8
+ * Money input field (controlled)
9
9
  */
10
10
  export declare const MoneyInputField: React.ForwardRefExoticComponent<Omit<MoneyInputFieldProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { IntInputField } from "./IntInputField";
3
3
  /**
4
- * Money input field
4
+ * Money input field (controlled)
5
5
  */
6
6
  export const MoneyInputField = React.forwardRef((props, ref) => {
7
7
  // Destruct
@@ -0,0 +1,29 @@
1
+ import React from "react";
2
+ import { InputFieldProps } from "./InputField";
3
+ /**
4
+ * Number input field properties
5
+ */
6
+ export type NumberInputFieldProps = Omit<InputFieldProps, "type" | "inputProps"> & {
7
+ /**
8
+ * Input field style
9
+ */
10
+ inputStyle?: React.CSSProperties;
11
+ /**
12
+ * Minimum value
13
+ */
14
+ min?: number;
15
+ /**
16
+ * Maximum value
17
+ */
18
+ max?: number;
19
+ /**
20
+ * Step value
21
+ */
22
+ step?: number;
23
+ };
24
+ /**
25
+ * Number input field, for controlled only components, please see IntInputField and MoneyInputField
26
+ * @param props Props
27
+ * @returns Component
28
+ */
29
+ export declare function NumberInputField(props: NumberInputFieldProps): React.JSX.Element;
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import { InputField } from "./InputField";
3
+ /**
4
+ * Number input field, for controlled only components, please see IntInputField and MoneyInputField
5
+ * @param props Props
6
+ * @returns Component
7
+ */
8
+ export function NumberInputField(props) {
9
+ const { inputStyle = { textAlign: "right" }, min = 0, step = 1, max = 9999999, ...rest } = props;
10
+ return (React.createElement(InputField, { inputProps: {
11
+ min,
12
+ step,
13
+ max,
14
+ style: inputStyle,
15
+ inputMode: "numeric"
16
+ }, ...rest }));
17
+ }
package/lib/index.d.ts CHANGED
@@ -79,6 +79,7 @@ export * from "./MUGlobal";
79
79
  export * from "./MUUtils";
80
80
  export * from "./NotifierMU";
81
81
  export * from "./NotifierPopupProps";
82
+ export * from "./NumberInputField";
82
83
  export * from "./OptionBool";
83
84
  export * from "./OptionGroup";
84
85
  export * from "./PercentCircularProgress";
package/lib/index.js CHANGED
@@ -79,6 +79,7 @@ export * from "./MUGlobal";
79
79
  export * from "./MUUtils";
80
80
  export * from "./NotifierMU";
81
81
  export * from "./NotifierPopupProps";
82
+ export * from "./NumberInputField";
82
83
  export * from "./OptionBool";
83
84
  export * from "./OptionGroup";
84
85
  export * from "./PercentCircularProgress";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.3.15",
3
+ "version": "1.3.16",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -52,7 +52,7 @@
52
52
  "@emotion/styled": "^11.11.0",
53
53
  "@etsoo/appscript": "^1.4.53",
54
54
  "@etsoo/notificationbase": "^1.1.28",
55
- "@etsoo/react": "^1.7.9",
55
+ "@etsoo/react": "^1.7.10",
56
56
  "@etsoo/shared": "^1.2.12",
57
57
  "@mui/icons-material": "^5.14.9",
58
58
  "@mui/material": "^5.14.9",
@@ -71,7 +71,7 @@ export type IntInputFieldProps = Omit<
71
71
  };
72
72
 
73
73
  /**
74
- * Integer input field
74
+ * Integer input field (controlled)
75
75
  */
76
76
  export const IntInputField = React.forwardRef<
77
77
  HTMLDivElement,
@@ -7,7 +7,7 @@ import { IntInputField, IntInputFieldProps } from "./IntInputField";
7
7
  export type MoneyInputFieldProps = IntInputFieldProps & {};
8
8
 
9
9
  /**
10
- * Money input field
10
+ * Money input field (controlled)
11
11
  */
12
12
  export const MoneyInputField = React.forwardRef<
13
13
  HTMLDivElement,
@@ -0,0 +1,58 @@
1
+ import React from "react";
2
+ import { InputField, InputFieldProps } from "./InputField";
3
+
4
+ /**
5
+ * Number input field properties
6
+ */
7
+ export type NumberInputFieldProps = Omit<
8
+ InputFieldProps,
9
+ "type" | "inputProps"
10
+ > & {
11
+ /**
12
+ * Input field style
13
+ */
14
+ inputStyle?: React.CSSProperties;
15
+
16
+ /**
17
+ * Minimum value
18
+ */
19
+ min?: number;
20
+
21
+ /**
22
+ * Maximum value
23
+ */
24
+ max?: number;
25
+
26
+ /**
27
+ * Step value
28
+ */
29
+ step?: number;
30
+ };
31
+
32
+ /**
33
+ * Number input field, for controlled only components, please see IntInputField and MoneyInputField
34
+ * @param props Props
35
+ * @returns Component
36
+ */
37
+ export function NumberInputField(props: NumberInputFieldProps) {
38
+ const {
39
+ inputStyle = { textAlign: "right" },
40
+ min = 0,
41
+ step = 1,
42
+ max = 9999999,
43
+ ...rest
44
+ } = props;
45
+
46
+ return (
47
+ <InputField
48
+ inputProps={{
49
+ min,
50
+ step,
51
+ max,
52
+ style: inputStyle,
53
+ inputMode: "numeric"
54
+ }}
55
+ {...rest}
56
+ />
57
+ );
58
+ }
package/src/index.ts CHANGED
@@ -83,6 +83,7 @@ export * from "./MUGlobal";
83
83
  export * from "./MUUtils";
84
84
  export * from "./NotifierMU";
85
85
  export * from "./NotifierPopupProps";
86
+ export * from "./NumberInputField";
86
87
  export * from "./OptionBool";
87
88
  export * from "./OptionGroup";
88
89
  export * from "./PercentCircularProgress";