@etsoo/materialui 1.5.52 → 1.5.53

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.
@@ -3,7 +3,16 @@ import { OptionGroupProps } from "./OptionGroup";
3
3
  /**
4
4
  * OptionBool props
5
5
  */
6
- export type OptionBoolProps = Omit<OptionGroupProps<ListType1, "id", "label">, "options" | "row" | "multiple">;
6
+ export type OptionBoolProps = Omit<OptionGroupProps<ListType1, "id", "label">, "options" | "row" | "multiple" | "defaultValue" | "onValueChange"> & {
7
+ /**
8
+ * Default value
9
+ */
10
+ defaultValue?: boolean;
11
+ /**
12
+ * On value change handler
13
+ */
14
+ onValueChange?: (value?: boolean) => void;
15
+ };
7
16
  /**
8
17
  * OptionBool (yes/no)
9
18
  * @param props Props
@@ -4,16 +4,24 @@ exports.OptionBool = OptionBool;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const ReactApp_1 = require("./app/ReactApp");
6
6
  const OptionGroup_1 = require("./OptionGroup");
7
+ const MUGlobal_1 = require("./MUGlobal");
7
8
  /**
8
9
  * OptionBool (yes/no)
9
10
  * @param props Props
10
11
  * @returns Component
11
12
  */
12
13
  function OptionBool(props) {
14
+ // Destruct
15
+ const { defaultValue = false, onValueChange, variant = MUGlobal_1.MUGlobal.inputFieldVariant, ...rest } = props;
13
16
  // Global app
14
17
  const app = (0, ReactApp_1.useAppContext)();
15
18
  // Options
16
19
  const options = app?.getBools() ?? [];
17
20
  // Layout
18
- return ((0, jsx_runtime_1.jsx)(OptionGroup_1.OptionGroup, { options: options, row: true, multiple: false, ...props }));
21
+ return ((0, jsx_runtime_1.jsx)(OptionGroup_1.OptionGroup, { options: options, row: true, multiple: false, variant: variant, defaultValue: defaultValue.toString(), onValueChange: (value) => {
22
+ if (onValueChange) {
23
+ const v = value == "true" ? true : value == "false" ? false : undefined;
24
+ onValueChange(v);
25
+ }
26
+ }, ...rest }));
19
27
  }
@@ -3,7 +3,16 @@ import { OptionGroupProps } from "./OptionGroup";
3
3
  /**
4
4
  * OptionBool props
5
5
  */
6
- export type OptionBoolProps = Omit<OptionGroupProps<ListType1, "id", "label">, "options" | "row" | "multiple">;
6
+ export type OptionBoolProps = Omit<OptionGroupProps<ListType1, "id", "label">, "options" | "row" | "multiple" | "defaultValue" | "onValueChange"> & {
7
+ /**
8
+ * Default value
9
+ */
10
+ defaultValue?: boolean;
11
+ /**
12
+ * On value change handler
13
+ */
14
+ onValueChange?: (value?: boolean) => void;
15
+ };
7
16
  /**
8
17
  * OptionBool (yes/no)
9
18
  * @param props Props
@@ -1,16 +1,24 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useAppContext } from "./app/ReactApp";
3
3
  import { OptionGroup } from "./OptionGroup";
4
+ import { MUGlobal } from "./MUGlobal";
4
5
  /**
5
6
  * OptionBool (yes/no)
6
7
  * @param props Props
7
8
  * @returns Component
8
9
  */
9
10
  export function OptionBool(props) {
11
+ // Destruct
12
+ const { defaultValue = false, onValueChange, variant = MUGlobal.inputFieldVariant, ...rest } = props;
10
13
  // Global app
11
14
  const app = useAppContext();
12
15
  // Options
13
16
  const options = app?.getBools() ?? [];
14
17
  // Layout
15
- return (_jsx(OptionGroup, { options: options, row: true, multiple: false, ...props }));
18
+ return (_jsx(OptionGroup, { options: options, row: true, multiple: false, variant: variant, defaultValue: defaultValue.toString(), onValueChange: (value) => {
19
+ if (onValueChange) {
20
+ const v = value == "true" ? true : value == "false" ? false : undefined;
21
+ onValueChange(v);
22
+ }
23
+ }, ...rest }));
16
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.5.52",
3
+ "version": "1.5.53",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -44,9 +44,9 @@
44
44
  "@etsoo/notificationbase": "^1.1.62",
45
45
  "@etsoo/react": "^1.8.45",
46
46
  "@etsoo/shared": "^1.2.74",
47
- "@mui/icons-material": "^7.1.0",
48
- "@mui/material": "^7.1.0",
49
- "@mui/x-data-grid": "^8.4.0",
47
+ "@mui/icons-material": "^7.1.1",
48
+ "@mui/material": "^7.1.1",
49
+ "@mui/x-data-grid": "^8.5.1",
50
50
  "chart.js": "^4.4.9",
51
51
  "chartjs-plugin-datalabels": "^2.2.0",
52
52
  "dompurify": "^3.2.6",
@@ -67,23 +67,23 @@
67
67
  },
68
68
  "devDependencies": {
69
69
  "@babel/cli": "^7.27.2",
70
- "@babel/core": "^7.27.1",
71
- "@babel/plugin-transform-runtime": "^7.27.1",
70
+ "@babel/core": "^7.27.4",
71
+ "@babel/plugin-transform-runtime": "^7.27.4",
72
72
  "@babel/preset-env": "^7.27.2",
73
73
  "@babel/preset-react": "^7.27.1",
74
74
  "@babel/preset-typescript": "^7.27.1",
75
- "@babel/runtime-corejs3": "^7.27.1",
75
+ "@babel/runtime-corejs3": "^7.27.6",
76
76
  "@testing-library/react": "^16.3.0",
77
77
  "@types/pica": "^9.0.5",
78
78
  "@types/pulltorefreshjs": "^0.1.7",
79
- "@types/react": "^18.3.22",
79
+ "@types/react": "^18.3.23",
80
80
  "@types/react-avatar-editor": "^13.0.4",
81
81
  "@types/react-dom": "^18.3.7",
82
82
  "@types/react-input-mask": "^3.0.6",
83
83
  "@types/react-window": "^1.8.8",
84
- "@vitejs/plugin-react": "^4.5.0",
84
+ "@vitejs/plugin-react": "^4.5.1",
85
85
  "jsdom": "^26.1.0",
86
86
  "typescript": "^5.8.3",
87
- "vitest": "^3.1.4"
87
+ "vitest": "^3.2.2"
88
88
  }
89
89
  }
@@ -1,14 +1,25 @@
1
1
  import { ListType1 } from "@etsoo/shared";
2
2
  import { useAppContext } from "./app/ReactApp";
3
3
  import { OptionGroup, OptionGroupProps } from "./OptionGroup";
4
+ import { MUGlobal } from "./MUGlobal";
4
5
 
5
6
  /**
6
7
  * OptionBool props
7
8
  */
8
9
  export type OptionBoolProps = Omit<
9
10
  OptionGroupProps<ListType1, "id", "label">,
10
- "options" | "row" | "multiple"
11
- >;
11
+ "options" | "row" | "multiple" | "defaultValue" | "onValueChange"
12
+ > & {
13
+ /**
14
+ * Default value
15
+ */
16
+ defaultValue?: boolean;
17
+
18
+ /**
19
+ * On value change handler
20
+ */
21
+ onValueChange?: (value?: boolean) => void;
22
+ };
12
23
 
13
24
  /**
14
25
  * OptionBool (yes/no)
@@ -16,6 +27,14 @@ export type OptionBoolProps = Omit<
16
27
  * @returns Component
17
28
  */
18
29
  export function OptionBool(props: OptionBoolProps) {
30
+ // Destruct
31
+ const {
32
+ defaultValue = false,
33
+ onValueChange,
34
+ variant = MUGlobal.inputFieldVariant,
35
+ ...rest
36
+ } = props;
37
+
19
38
  // Global app
20
39
  const app = useAppContext();
21
40
 
@@ -24,6 +43,20 @@ export function OptionBool(props: OptionBoolProps) {
24
43
 
25
44
  // Layout
26
45
  return (
27
- <OptionGroup<ListType1> options={options} row multiple={false} {...props} />
46
+ <OptionGroup
47
+ options={options}
48
+ row
49
+ multiple={false}
50
+ variant={variant}
51
+ defaultValue={defaultValue.toString()}
52
+ onValueChange={(value) => {
53
+ if (onValueChange) {
54
+ const v =
55
+ value == "true" ? true : value == "false" ? false : undefined;
56
+ onValueChange(v);
57
+ }
58
+ }}
59
+ {...rest}
60
+ />
28
61
  );
29
62
  }