@capsitech/react-utilities 0.1.2 → 0.1.4

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.
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from "react";
3
+ const isSuspenseComponent = (component) => typeof component === "object" &&
4
+ component &&
5
+ component.hasOwnProperty("$$typeof") &&
6
+ component.hasOwnProperty("_payload") &&
7
+ component.hasOwnProperty("_init");
8
+ export const SuspenseRoute = ({ children: Component, label = "Loading components...", fallback: FallbackComponent, }) => {
9
+ if (isSuspenseComponent(Component)) {
10
+ if (!FallbackComponent)
11
+ FallbackComponent = SuspenseRouteFallback;
12
+ return _jsx(React.Suspense, { fallback: _jsx(FallbackComponent, { label: label }), children: _jsx(Component, {}) });
13
+ }
14
+ return (_jsx(Component, {}));
15
+ };
16
+ const SuspenseRouteFallback = ({ label = "Loading components..." }) => {
17
+ return _jsx("div", { style: {
18
+ position: 'fixed',
19
+ top: 0,
20
+ left: 0,
21
+ width: '100%',
22
+ height: '100%',
23
+ backgroundColor: 'rgba(0, 0, 0, 0.3)',
24
+ zIndex: 9999,
25
+ display: 'flex',
26
+ justifyContent: 'center',
27
+ alignItems: 'center'
28
+ }, children: label });
29
+ };
@@ -0,0 +1 @@
1
+ export * from './SuspenseRoute';
@@ -0,0 +1 @@
1
+ export * from './SuspenseRoute';
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { matchPath, Route } from "react-router-dom";
3
- import { SuspenseRoute } from "./SuspenseRoute";
3
+ import { SuspenseRoute } from "../Components/SuspenseRoute";
4
4
  export var FeatureStatus;
5
5
  (function (FeatureStatus) {
6
6
  FeatureStatus[FeatureStatus["placeholder"] = 0] = "placeholder";
@@ -9,7 +9,6 @@ export * from './LoadScripts';
9
9
  export * from './MTDFraudPrevention';
10
10
  export * from './Nationalities';
11
11
  export * from './RouteUtils';
12
- export * from './SuspenseRoute';
13
12
  export * from './TimeZones';
14
13
  export * from './Types';
15
14
  export * from './Utils';
@@ -9,7 +9,6 @@ export * from './LoadScripts';
9
9
  export * from './MTDFraudPrevention';
10
10
  export * from './Nationalities';
11
11
  export * from './RouteUtils';
12
- export * from './SuspenseRoute';
13
12
  export * from './TimeZones';
14
13
  export * from './Types';
15
14
  export * from './Utils';
package/lib/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- export * from "./Hooks";
2
- export * from "./Utilities";
1
+ export * from './Components';
2
+ export * from './Hooks';
3
+ export * from './Utilities';
package/lib/index.js CHANGED
@@ -1,2 +1,3 @@
1
- export * from "./Hooks";
2
- export * from "./Utilities";
1
+ export * from './Components';
2
+ export * from './Hooks';
3
+ export * from './Utilities';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capsitech/react-utilities",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "A set of javascript utility methods",
5
5
  "main": "lib/index.js",
6
6
  "jsnext:main": "lib/index.js",
@@ -40,25 +40,26 @@
40
40
  "lodash": "^4.17.21"
41
41
  },
42
42
  "peerDependencies": {
43
- "axios": "^1.7.7",
43
+ "axios": "^1.9.0",
44
44
  "file-saver": "^2.0.5",
45
45
  "react": ">=18",
46
46
  "react-dom": ">=18"
47
47
  },
48
48
  "devDependencies": {
49
- "@storybook/addon-actions": "^8.4.2",
50
- "@storybook/addon-essentials": "^8.4.2",
51
- "@storybook/addon-links": "^8.4.2",
52
- "@storybook/addon-storysource": "^8.4.2",
53
- "@storybook/addon-webpack5-compiler-babel": "3.0.3",
54
- "@storybook/react": "^8.4.2",
55
- "@storybook/react-webpack5": "^8.4.2",
49
+ "@storybook/addon-actions": "^8.6.14",
50
+ "@storybook/addon-essentials": "^8.6.14",
51
+ "@storybook/addon-links": "^8.6.14",
52
+ "@storybook/addon-storysource": "^8.6.14",
53
+ "@storybook/addon-webpack5-compiler-babel": "^3.0.6",
54
+ "@storybook/react": "^8.6.14",
55
+ "@storybook/react-webpack5": "^8.6.14",
56
+ "@storybook/test": "^8.6.14",
56
57
  "@types/file-saver": "^2.0.7",
57
58
  "@types/lodash": "4.17.13",
58
59
  "@types/react": "^18.3.12",
59
60
  "@typescript-eslint/eslint-plugin": "^8.13.0",
60
61
  "@typescript-eslint/parser": "^8.13.0",
61
- "axios": "^1.7.7",
62
+ "axios": "^1.9.0",
62
63
  "copyfiles": "2.4.1",
63
64
  "cross-env": "^7.0.3",
64
65
  "eslint": "^9.14.0",
@@ -73,7 +74,7 @@
73
74
  "react-router-dom": "6.3.0",
74
75
  "react-scripts": "5.0.1",
75
76
  "rimraf": "6.0.1",
76
- "storybook": "8.4.2",
77
+ "storybook": "^8.6.14",
77
78
  "typescript": "^4.9.5"
78
79
  },
79
80
  "browserslist": {
@@ -89,4 +90,4 @@
89
90
  ]
90
91
  },
91
92
  "packageManager": "yarn@4.5.1"
92
- }
93
+ }
@@ -1,10 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import React from "react";
3
- const isSuspenseComponent = (component) => typeof component === "object" &&
4
- component &&
5
- component.hasOwnProperty("$$typeof") &&
6
- component.hasOwnProperty("_payload") &&
7
- component.hasOwnProperty("_init");
8
- export const SuspenseRoute = ({ children: Component, label = "Loading components...", fallback: FallbackComponent, }) => {
9
- return isSuspenseComponent(Component) ? (_jsx(React.Suspense, { fallback: _jsx(FallbackComponent, { label: label }), children: _jsx(Component, {}) })) : (_jsx(Component, {}));
10
- };