@etsoo/materialui 1.1.35 → 1.1.37

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.
package/lib/ComboBox.js CHANGED
@@ -60,9 +60,10 @@ export function ComboBox(props) {
60
60
  // null for controlled
61
61
  const [stateValue, setStateValue] = React.useState(null);
62
62
  React.useEffect(() => {
63
- if (localValue != null)
63
+ if (localValue != null && localValue != stateValue) {
64
64
  setStateValue(localValue);
65
- }, [JSON.stringify(localValue) != JSON.stringify(stateValue)]);
65
+ }
66
+ }, [localValue]);
66
67
  // Add readOnly
67
68
  const addReadOnly = (params) => {
68
69
  if (readOnly != null) {
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ import { ListType1 } from "@etsoo/shared";
3
+ import { OptionGroupProps } from "./OptionGroup";
4
+ /**
5
+ * OptionBool props
6
+ */
7
+ export type OptionBoolProps = Omit<OptionGroupProps<ListType1, "id", "label">, "options" | "row" | "multiple">;
8
+ /**
9
+ * OptionBool (yes/no)
10
+ * @param props Props
11
+ * @returns Component
12
+ */
13
+ export declare function OptionBool(props: OptionBoolProps): JSX.Element;
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import { globalApp } from "./app/ReactApp";
3
+ import { OptionGroup } from "./OptionGroup";
4
+ /**
5
+ * OptionBool (yes/no)
6
+ * @param props Props
7
+ * @returns Component
8
+ */
9
+ export function OptionBool(props) {
10
+ // Options
11
+ const options = globalApp.getBools();
12
+ // Layout
13
+ return (React.createElement(OptionGroup, { options: options, row: true, multiple: false, ...props }));
14
+ }
@@ -1,5 +1,5 @@
1
1
  import { DataTypes, Utils } from "@etsoo/shared";
2
- import { Box, Checkbox, FormControl, FormControlLabel, FormGroup, FormHelperText, InputLabel, Radio, RadioGroup, useTheme } from "@mui/material";
2
+ import { Box, Checkbox, FormControl, FormControlLabel, FormGroup, FormHelperText, InputLabel, Radio, RadioGroup } from "@mui/material";
3
3
  import NotchedOutline from "@mui/material/OutlinedInput";
4
4
  import React from "react";
5
5
  /**
@@ -11,8 +11,6 @@ export function OptionGroup(props) {
11
11
  var _a;
12
12
  // Destruct
13
13
  const { getOptionLabel, defaultValue, idField = "id", label, labelField = "label", multiple = false, mRef, name, onValueChange, options, readOnly, row, itemSize, itemHeight = row ? 56 : 42, helperText, variant, required, fullWidth, ...rest } = props;
14
- // Theme
15
- const theme = useTheme();
16
14
  // Outlined
17
15
  const outlined = variant === "outlined";
18
16
  // Get option value
@@ -1,10 +1,10 @@
1
1
  /// <reference types="react" />
2
- import { ListType1 } from '@etsoo/shared';
3
- import { SelectExProps } from './SelectEx';
2
+ import { ListType1 } from "@etsoo/shared";
3
+ import { SelectExProps } from "./SelectEx";
4
4
  /**
5
5
  * SelectBool props
6
6
  */
7
- export type SelectBoolProps = Omit<SelectExProps<ListType1>, 'options' | 'loadData'>;
7
+ export type SelectBoolProps = Omit<SelectExProps<ListType1>, "options" | "loadData">;
8
8
  /**
9
9
  * SelectBool (yes/no)
10
10
  * @param props Props
package/lib/SelectBool.js CHANGED
@@ -1,7 +1,7 @@
1
- import { Utils } from '@etsoo/shared';
2
- import React from 'react';
3
- import { globalApp } from './app/ReactApp';
4
- import { SelectEx } from './SelectEx';
1
+ import { Utils } from "@etsoo/shared";
2
+ import React from "react";
3
+ import { globalApp } from "./app/ReactApp";
4
+ import { SelectEx } from "./SelectEx";
5
5
  /**
6
6
  * SelectBool (yes/no)
7
7
  * @param props Props
@@ -11,10 +11,7 @@ export function SelectBool(props) {
11
11
  // Destruct
12
12
  const { search = true, autoAddBlankItem = search, ...rest } = props;
13
13
  // Options
14
- const options = [
15
- { id: 'false', label: globalApp.get('no') },
16
- { id: 'true', label: globalApp.get('yes') }
17
- ];
14
+ const options = globalApp.getBools();
18
15
  if (autoAddBlankItem)
19
16
  Utils.addBlankItem(options);
20
17
  // Layout
package/lib/index.d.ts CHANGED
@@ -61,6 +61,7 @@ export * from "./MoneyInputField";
61
61
  export * from "./MoreFab";
62
62
  export * from "./MUGlobal";
63
63
  export * from "./NotifierMU";
64
+ export * from "./OptionBool";
64
65
  export * from "./OptionGroup";
65
66
  export * from "./PList";
66
67
  export * from "./ProgressCount";
package/lib/index.js CHANGED
@@ -61,6 +61,7 @@ export * from "./MoneyInputField";
61
61
  export * from "./MoreFab";
62
62
  export * from "./MUGlobal";
63
63
  export * from "./NotifierMU";
64
+ export * from "./OptionBool";
64
65
  export * from "./OptionGroup";
65
66
  export * from "./PList";
66
67
  export * from "./ProgressCount";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.1.35",
3
+ "version": "1.1.37",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -47,20 +47,20 @@
47
47
  "dependencies": {
48
48
  "@dnd-kit/core": "^6.0.7",
49
49
  "@dnd-kit/sortable": "^7.0.2",
50
- "@emotion/css": "^11.10.5",
51
- "@emotion/react": "^11.10.5",
52
- "@emotion/styled": "^11.10.5",
53
- "@etsoo/appscript": "^1.3.64",
50
+ "@emotion/css": "^11.10.6",
51
+ "@emotion/react": "^11.10.6",
52
+ "@emotion/styled": "^11.10.6",
53
+ "@etsoo/appscript": "^1.3.66",
54
54
  "@etsoo/notificationbase": "^1.1.23",
55
- "@etsoo/react": "^1.6.47",
55
+ "@etsoo/react": "^1.6.48",
56
56
  "@etsoo/shared": "^1.1.88",
57
- "@mui/icons-material": "^5.11.0",
58
- "@mui/material": "^5.11.8",
57
+ "@mui/icons-material": "^5.11.9",
58
+ "@mui/material": "^5.11.9",
59
59
  "@types/pica": "^9.0.1",
60
60
  "@types/pulltorefreshjs": "^0.1.5",
61
61
  "@types/react": "^18.0.28",
62
62
  "@types/react-avatar-editor": "^13.0.0",
63
- "@types/react-dom": "^18.0.10",
63
+ "@types/react-dom": "^18.0.11",
64
64
  "@types/react-input-mask": "^3.0.2",
65
65
  "@types/react-window": "^1.8.5",
66
66
  "pica": "^9.0.1",
@@ -82,12 +82,12 @@
82
82
  "@babel/preset-typescript": "^7.18.6",
83
83
  "@babel/runtime-corejs3": "^7.20.13",
84
84
  "@testing-library/jest-dom": "^5.16.5",
85
- "@testing-library/react": "^13.4.0",
85
+ "@testing-library/react": "^14.0.0",
86
86
  "@types/jest": "^29.4.0",
87
- "@typescript-eslint/eslint-plugin": "^5.51.0",
88
- "@typescript-eslint/parser": "^5.51.0",
89
- "jest": "^29.4.2",
90
- "jest-environment-jsdom": "^29.4.2",
87
+ "@typescript-eslint/eslint-plugin": "^5.52.0",
88
+ "@typescript-eslint/parser": "^5.52.0",
89
+ "jest": "^29.4.3",
90
+ "jest-environment-jsdom": "^29.4.3",
91
91
  "typescript": "^4.9.5"
92
92
  }
93
93
  }
package/src/ComboBox.tsx CHANGED
@@ -173,8 +173,10 @@ export function ComboBox<
173
173
  const [stateValue, setStateValue] = React.useState<T | T[] | null>(null);
174
174
 
175
175
  React.useEffect(() => {
176
- if (localValue != null) setStateValue(localValue);
177
- }, [JSON.stringify(localValue) != JSON.stringify(stateValue)]);
176
+ if (localValue != null && localValue != stateValue) {
177
+ setStateValue(localValue);
178
+ }
179
+ }, [localValue]);
178
180
 
179
181
  // Add readOnly
180
182
  const addReadOnly = (params: AutocompleteRenderInputParams) => {
@@ -0,0 +1,27 @@
1
+ import { ListType1 } from "@etsoo/shared";
2
+ import React from "react";
3
+ import { globalApp } from "./app/ReactApp";
4
+ import { OptionGroup, OptionGroupProps } from "./OptionGroup";
5
+
6
+ /**
7
+ * OptionBool props
8
+ */
9
+ export type OptionBoolProps = Omit<
10
+ OptionGroupProps<ListType1, "id", "label">,
11
+ "options" | "row" | "multiple"
12
+ >;
13
+
14
+ /**
15
+ * OptionBool (yes/no)
16
+ * @param props Props
17
+ * @returns Component
18
+ */
19
+ export function OptionBool(props: OptionBoolProps) {
20
+ // Options
21
+ const options = globalApp.getBools();
22
+
23
+ // Layout
24
+ return (
25
+ <OptionGroup<ListType1> options={options} row multiple={false} {...props} />
26
+ );
27
+ }
@@ -15,8 +15,7 @@ import {
15
15
  FormHelperText,
16
16
  InputLabel,
17
17
  Radio,
18
- RadioGroup,
19
- useTheme
18
+ RadioGroup
20
19
  } from "@mui/material";
21
20
  import NotchedOutline from "@mui/material/OutlinedInput";
22
21
  import React from "react";
@@ -149,9 +148,6 @@ export function OptionGroup<
149
148
  ...rest
150
149
  } = props;
151
150
 
152
- // Theme
153
- const theme = useTheme();
154
-
155
151
  // Outlined
156
152
  const outlined = variant === "outlined";
157
153
 
@@ -1,14 +1,14 @@
1
- import { ListType1, Utils } from '@etsoo/shared';
2
- import React from 'react';
3
- import { globalApp } from './app/ReactApp';
4
- import { SelectEx, SelectExProps } from './SelectEx';
1
+ import { ListType1, Utils } from "@etsoo/shared";
2
+ import React from "react";
3
+ import { globalApp } from "./app/ReactApp";
4
+ import { SelectEx, SelectExProps } from "./SelectEx";
5
5
 
6
6
  /**
7
7
  * SelectBool props
8
8
  */
9
9
  export type SelectBoolProps = Omit<
10
- SelectExProps<ListType1>,
11
- 'options' | 'loadData'
10
+ SelectExProps<ListType1>,
11
+ "options" | "loadData"
12
12
  >;
13
13
 
14
14
  /**
@@ -17,17 +17,14 @@ export type SelectBoolProps = Omit<
17
17
  * @returns Component
18
18
  */
19
19
  export function SelectBool(props: SelectBoolProps) {
20
- // Destruct
21
- const { search = true, autoAddBlankItem = search, ...rest } = props;
20
+ // Destruct
21
+ const { search = true, autoAddBlankItem = search, ...rest } = props;
22
22
 
23
- // Options
24
- const options: ListType1[] = [
25
- { id: 'false', label: globalApp.get('no')! },
26
- { id: 'true', label: globalApp.get('yes')! }
27
- ];
23
+ // Options
24
+ const options = globalApp.getBools();
28
25
 
29
- if (autoAddBlankItem) Utils.addBlankItem(options);
26
+ if (autoAddBlankItem) Utils.addBlankItem(options);
30
27
 
31
- // Layout
32
- return <SelectEx<ListType1> options={options} search={search} {...rest} />;
28
+ // Layout
29
+ return <SelectEx<ListType1> options={options} search={search} {...rest} />;
33
30
  }
package/src/index.ts CHANGED
@@ -64,6 +64,7 @@ export * from "./MoneyInputField";
64
64
  export * from "./MoreFab";
65
65
  export * from "./MUGlobal";
66
66
  export * from "./NotifierMU";
67
+ export * from "./OptionBool";
67
68
  export * from "./OptionGroup";
68
69
  export * from "./PList";
69
70
  export * from "./ProgressCount";