@rpcbase/ui 0.5.0 → 0.7.0

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.
@@ -1 +1 @@
1
- {"fullyTracked":true,"platform":"linux","arch":"x64","nodeVersion":"v18.19.0","command":"node ../../scripts/prflow/apply-prerelease-versions.js $BRANCH_NAME","extraArgs":[],"clean":true,"files":{"/home/runner/work/rpcbase/rpcbase/pkg/ui/package.json":"196c030bb35a111fe63385f1450d242da1868720f3e192758a4b16e442a8e12b","/home/runner/work/rpcbase/rpcbase/pkg/ui/yarn.lock":"38df2378ed26e20124d8c38a945af1b4a058656aab3b3b1f71a9d8a629cc0d81","/home/runner/work/rpcbase/rpcbase/yarn.lock":"6418e6930bf35b3c31e73c88c6bf21b0f4033a3a8a4e6470477cdf77088e96f1"},"output":[],"dependencies":{},"env":{"BRANCH_NAME":"master"}}
1
+ {"fullyTracked":true,"platform":"linux","arch":"x64","nodeVersion":"v18.19.0","command":"node ../../scripts/prflow/apply-prerelease-versions.js $BRANCH_NAME","extraArgs":[],"clean":true,"files":{"/home/runner/work/rpcbase/rpcbase/pkg/ui/package.json":"9eaaeadb3f7008bb2dad293d9071866af326adec4456490775797d957824b99e","/home/runner/work/rpcbase/rpcbase/pkg/ui/yarn.lock":"38df2378ed26e20124d8c38a945af1b4a058656aab3b3b1f71a9d8a629cc0d81","/home/runner/work/rpcbase/rpcbase/yarn.lock":"6418e6930bf35b3c31e73c88c6bf21b0f4033a3a8a4e6470477cdf77088e96f1"},"output":[],"dependencies":{},"env":{"BRANCH_NAME":"master"}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/ui",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "license": "SSPL-1.0",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -32,7 +32,7 @@
32
32
  }
33
33
  },
34
34
  "release": {
35
- "command": "npm publish --access public --tag $NPM_RELEASE_CHANNEL | tee publish-output.txt",
35
+ "command": "npm publish --tag $NPM_RELEASE_CHANNEL | tee publish-output.txt",
36
36
  "dependencies": [
37
37
  "apply-version"
38
38
  ],
@@ -0,0 +1,40 @@
1
+ /* @flow */
2
+ import React, {Suspense, useEffect, useState} from "react"
3
+
4
+ import ActivityIndicator from "../ActivityIndicator"
5
+
6
+
7
+ const DELAY_BEFORE_LOADER = 200
8
+
9
+ const withSuspense = (loadFn, opts = {hideLoader: false}) => {
10
+ const Component = React.lazy(loadFn)
11
+
12
+ const Loader = () => {
13
+ const [showLoader, setShowLoader] = useState(false)
14
+
15
+ useEffect(() => {
16
+ setTimeout(() => {
17
+ setShowLoader(true)
18
+ }, DELAY_BEFORE_LOADER)
19
+ }, [])
20
+
21
+ if (!showLoader || opts.hideLoader) return null
22
+
23
+ return (
24
+ <div className="d-flex flex-column h-100 justify-content-center align-items-center">
25
+ <div className="mb-2">Loading...</div>
26
+ <ActivityIndicator />
27
+ </div>
28
+ )
29
+ }
30
+
31
+ const Wrapper = React.forwardRef((props, ref) => (
32
+ <Suspense fallback={<Loader />}>
33
+ <Component ref={ref} {...props} />
34
+ </Suspense>
35
+ ))
36
+
37
+ return Wrapper
38
+ }
39
+
40
+ export default withSuspense