@etsoo/materialui 1.5.55 → 1.5.56

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.
@@ -4,9 +4,33 @@ import { DataTypes, DomUtils, IActionResult, Utils } from "@etsoo/shared";
4
4
  import React, { act } from "react";
5
5
  import { createRoot } from "react-dom/client";
6
6
 
7
- // Without it will popup error:
8
- // The current testing environment is not configured to support act
9
- (globalThis as any).IS_REACT_ACT_ENVIRONMENT = true;
7
+ if (typeof localStorage === "undefined") {
8
+ const mockLocalStorage = (() => {
9
+ let store = {} as Storage;
10
+
11
+ return {
12
+ getItem(key: string) {
13
+ return store[key];
14
+ },
15
+
16
+ setItem(key: string, value: string) {
17
+ store[key] = value;
18
+ },
19
+
20
+ removeItem(key: string) {
21
+ delete store[key];
22
+ },
23
+
24
+ clear() {
25
+ store = {} as Storage;
26
+ }
27
+ };
28
+ })();
29
+
30
+ Object.defineProperty(globalThis, "localStorage", {
31
+ value: mockLocalStorage
32
+ });
33
+ }
10
34
 
11
35
  // Detected country or region
12
36
  const { detectedCountry } = DomUtils;
@@ -96,7 +96,7 @@ function ButtonPopupCheckbox(props) {
96
96
  setItems(data);
97
97
  }
98
98
  });
99
- }, []);
99
+ }, [loadData]);
100
100
  react_1.default.useEffect(() => {
101
101
  // Set selected ids
102
102
  setSelectedIds(value);
@@ -92,7 +92,7 @@ function ButtonPopupRadio(props) {
92
92
  setItems(data);
93
93
  }
94
94
  });
95
- }, []);
95
+ }, [loadData]);
96
96
  react_1.default.useEffect(() => {
97
97
  setCurrentValue(value);
98
98
  }, [value]);
@@ -90,7 +90,7 @@ export function ButtonPopupCheckbox(props) {
90
90
  setItems(data);
91
91
  }
92
92
  });
93
- }, []);
93
+ }, [loadData]);
94
94
  React.useEffect(() => {
95
95
  // Set selected ids
96
96
  setSelectedIds(value);
@@ -86,7 +86,7 @@ export function ButtonPopupRadio(props) {
86
86
  setItems(data);
87
87
  }
88
88
  });
89
- }, []);
89
+ }, [loadData]);
90
90
  React.useEffect(() => {
91
91
  setCurrentValue(value);
92
92
  }, [value]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.5.55",
3
+ "version": "1.5.56",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -302,7 +302,7 @@ export function ButtonPopupCheckbox<D extends DnDItemType>(
302
302
  setItems(data);
303
303
  }
304
304
  });
305
- }, []);
305
+ }, [loadData]);
306
306
 
307
307
  React.useEffect(() => {
308
308
  // Set selected ids
@@ -276,7 +276,7 @@ export function ButtonPopupRadio<D extends DnDItemType>(
276
276
  setItems(data);
277
277
  }
278
278
  });
279
- }, []);
279
+ }, [loadData]);
280
280
 
281
281
  React.useEffect(() => {
282
282
  setCurrentValue(value);