react-usespinner 1.0.8 → 1.0.10

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,6 +4,7 @@ interface Options {
4
4
  }
5
5
  interface SpinnerProps {
6
6
  children: React.ReactNode;
7
+ spinner: React.ReactNode;
7
8
  }
8
9
  declare const useSpinner: (globalOptions?: Options) => {
9
10
  start: (name: string, options?: Options) => void;
@@ -11,6 +12,6 @@ declare const useSpinner: (globalOptions?: Options) => {
11
12
  clear: () => void;
12
13
  busy: () => boolean;
13
14
  fetch: (...params: any) => Promise<unknown>;
14
- SpinnerContainer: ({ children }: SpinnerProps) => JSX.Element | null;
15
+ SpinnerContainer: ({ spinner, children }: SpinnerProps) => JSX.Element;
15
16
  };
16
17
  export default useSpinner;
@@ -83,10 +83,10 @@ var useSpinner = function (globalOptions) {
83
83
  };
84
84
  // JSX component used to wrap spinner of choice
85
85
  var SpinnerContainer = function (_a) {
86
- var children = _a.children;
86
+ var spinner = _a.spinner, children = _a.children;
87
87
  // If no active Actions then dont display anything
88
- if (actions && actions.length === 0) {
89
- return null;
88
+ if (actions && actions.length > 0) {
89
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: spinner });
90
90
  }
91
91
  return (0, jsx_runtime_1.jsx)("div", __assign({ className: "useSpinner" }, { children: children }));
92
92
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-usespinner",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "Track actions in progress to know if a spinner should be display. Actions expire within 10 seconds if not expired in code",
5
5
  "private": false,
6
6
  "license": "MIT",