@capsitech/react-utilities 0.1.2 → 0.1.3

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,92 +1,92 @@
1
- {
2
- "name": "@capsitech/react-utilities",
3
- "version": "0.1.2",
4
- "description": "A set of javascript utility methods",
5
- "main": "lib/index.js",
6
- "jsnext:main": "lib/index.js",
7
- "types": "lib/index.d.ts",
8
- "module": "lib/index.js",
9
- "files": [
10
- "lib",
11
- "README.md",
12
- "package.json"
13
- ],
14
- "keywords": [
15
- "react",
16
- "utility",
17
- "utils",
18
- "utilities"
19
- ],
20
- "author": {
21
- "name": "Mukesh Jangid",
22
- "email": "mukesh@capsitech.com"
23
- },
24
- "homepage": "https://github.com/capsitech/Capsitech.ReactUtilities#readme",
25
- "license": "UNLICENSED",
26
- "repository": {
27
- "url": "git+https://github.com/capsitech/Capsitech.ReactUtilities.git"
28
- },
29
- "publishConfig": {
30
- "access": "public"
31
- },
32
- "scripts": {
33
- "clean": "rimraf lib",
34
- "build": "yarn clean && tsc --project ./tsconfig.json --module es2015 --outDir ./lib -d",
35
- "build:publish": "yarn && npm version patch && yarn build && npm publish",
36
- "start": "storybook dev -p 6006"
37
- },
38
- "dependencies": {
39
- "dayjs": "^1.11.13",
40
- "lodash": "^4.17.21"
41
- },
42
- "peerDependencies": {
43
- "axios": "^1.7.7",
44
- "file-saver": "^2.0.5",
45
- "react": ">=18",
46
- "react-dom": ">=18"
47
- },
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",
56
- "@types/file-saver": "^2.0.7",
57
- "@types/lodash": "4.17.13",
58
- "@types/react": "^18.3.12",
59
- "@typescript-eslint/eslint-plugin": "^8.13.0",
60
- "@typescript-eslint/parser": "^8.13.0",
61
- "axios": "^1.7.7",
62
- "copyfiles": "2.4.1",
63
- "cross-env": "^7.0.3",
64
- "eslint": "^9.14.0",
65
- "eslint-config-standard": "^17.1.0",
66
- "eslint-config-standard-with-typescript": "^43.0.1",
67
- "eslint-import-resolver-typescript": "^3.6.3",
68
- "eslint-plugin-react": "^7.37.2",
69
- "eslint-plugin-simple-import-sort": "^12.1.1",
70
- "file-saver": "^2.0.5",
71
- "react": "^18.3.1",
72
- "react-dom": "^18.3.1",
73
- "react-router-dom": "6.3.0",
74
- "react-scripts": "5.0.1",
75
- "rimraf": "6.0.1",
76
- "storybook": "8.4.2",
77
- "typescript": "^4.9.5"
78
- },
79
- "browserslist": {
80
- "production": [
81
- ">0.2%",
82
- "not dead",
83
- "not op_mini all"
84
- ],
85
- "development": [
86
- "last 1 chrome version",
87
- "last 1 firefox version",
88
- "last 1 safari version"
89
- ]
90
- },
91
- "packageManager": "yarn@4.5.1"
92
- }
1
+ {
2
+ "name": "@capsitech/react-utilities",
3
+ "version": "0.1.3",
4
+ "description": "A set of javascript utility methods",
5
+ "main": "lib/index.js",
6
+ "jsnext:main": "lib/index.js",
7
+ "types": "lib/index.d.ts",
8
+ "module": "lib/index.js",
9
+ "files": [
10
+ "lib",
11
+ "README.md",
12
+ "package.json"
13
+ ],
14
+ "keywords": [
15
+ "react",
16
+ "utility",
17
+ "utils",
18
+ "utilities"
19
+ ],
20
+ "author": {
21
+ "name": "Mukesh Jangid",
22
+ "email": "mukesh@capsitech.com"
23
+ },
24
+ "homepage": "https://github.com/capsitech/Capsitech.ReactUtilities#readme",
25
+ "license": "UNLICENSED",
26
+ "repository": {
27
+ "url": "git+https://github.com/capsitech/Capsitech.ReactUtilities.git"
28
+ },
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
32
+ "scripts": {
33
+ "clean": "rimraf lib",
34
+ "build": "yarn clean && tsc --project ./tsconfig.json --module es2015 --outDir ./lib -d",
35
+ "build:publish": "yarn && npm version patch && yarn build && npm publish",
36
+ "start": "storybook dev -p 6006"
37
+ },
38
+ "dependencies": {
39
+ "dayjs": "^1.11.13",
40
+ "lodash": "^4.17.21"
41
+ },
42
+ "peerDependencies": {
43
+ "axios": "^1.7.7",
44
+ "file-saver": "^2.0.5",
45
+ "react": ">=18",
46
+ "react-dom": ">=18"
47
+ },
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",
56
+ "@types/file-saver": "^2.0.7",
57
+ "@types/lodash": "4.17.13",
58
+ "@types/react": "^18.3.12",
59
+ "@typescript-eslint/eslint-plugin": "^8.13.0",
60
+ "@typescript-eslint/parser": "^8.13.0",
61
+ "axios": "^1.7.7",
62
+ "copyfiles": "2.4.1",
63
+ "cross-env": "^7.0.3",
64
+ "eslint": "^9.14.0",
65
+ "eslint-config-standard": "^17.1.0",
66
+ "eslint-config-standard-with-typescript": "^43.0.1",
67
+ "eslint-import-resolver-typescript": "^3.6.3",
68
+ "eslint-plugin-react": "^7.37.2",
69
+ "eslint-plugin-simple-import-sort": "^12.1.1",
70
+ "file-saver": "^2.0.5",
71
+ "react": "^18.3.1",
72
+ "react-dom": "^18.3.1",
73
+ "react-router-dom": "6.3.0",
74
+ "react-scripts": "5.0.1",
75
+ "rimraf": "6.0.1",
76
+ "storybook": "8.4.2",
77
+ "typescript": "^4.9.5"
78
+ },
79
+ "browserslist": {
80
+ "production": [
81
+ ">0.2%",
82
+ "not dead",
83
+ "not op_mini all"
84
+ ],
85
+ "development": [
86
+ "last 1 chrome version",
87
+ "last 1 firefox version",
88
+ "last 1 safari version"
89
+ ]
90
+ },
91
+ "packageManager": "yarn@4.5.1"
92
+ }
@@ -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
- };