@onepercentio/one-ui 0.7.3 → 0.7.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.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PropsWithChildren } from "react";
|
|
1
|
+
import React, { PropsWithChildren } from "react";
|
|
2
2
|
/**
|
|
3
3
|
* Use this component when you would like to freeze some child when this child can assume undefined in the next 'frame'
|
|
4
4
|
**/
|
|
5
|
-
export default function Freeze({ children }: PropsWithChildren<{}>): any
|
|
5
|
+
export default function Freeze({ children }: PropsWithChildren<{}>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
6
|
+
const useFreeze_1 = __importDefault(require("../../hooks/useFreeze"));
|
|
4
7
|
/**
|
|
5
8
|
* Use this component when you would like to freeze some child when this child can assume undefined in the next 'frame'
|
|
6
9
|
**/
|
|
7
10
|
function Freeze({ children }) {
|
|
8
|
-
|
|
9
|
-
currChildOrPrev.current = children || currChildOrPrev.current;
|
|
10
|
-
return currChildOrPrev.current || null;
|
|
11
|
+
return (0, useFreeze_1.default)(children);
|
|
11
12
|
}
|
|
12
13
|
exports.default = Freeze;
|
|
13
14
|
//# sourceMappingURL=Freeze.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Freeze.js","sourceRoot":"","sources":["../../../src/components/Freeze/Freeze.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Freeze.js","sourceRoot":"","sources":["../../../src/components/Freeze/Freeze.tsx"],"names":[],"mappings":";;;;;AACA,sEAA8C;AAE9C;;IAEI;AACJ,SAAwB,MAAM,CAAC,EAAE,QAAQ,EAAyB;IAChE,OAAO,IAAA,mBAAS,EAAC,QAAQ,CAAiB,CAAC;AAC7C,CAAC;AAFD,yBAEC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const react_1 = require("react");
|
|
4
|
+
/**
|
|
5
|
+
* This hook pipes a data and when it is set to a falsy value ("", undefined, null, 0),
|
|
6
|
+
* it returns the previous valid value
|
|
7
|
+
*/
|
|
8
|
+
function useFreeze(something) {
|
|
9
|
+
const currChildOrPrev = (0, react_1.useRef)();
|
|
10
|
+
currChildOrPrev.current = something || currChildOrPrev.current;
|
|
11
|
+
return currChildOrPrev.current || null;
|
|
12
|
+
}
|
|
13
|
+
exports.default = useFreeze;
|
|
14
|
+
//# sourceMappingURL=useFreeze.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFreeze.js","sourceRoot":"","sources":["../../src/hooks/useFreeze.ts"],"names":[],"mappings":";;AAAA,iCAA+B;AAE/B;;;GAGG;AACH,SAAwB,SAAS,CAAI,SAAY;IAC7C,MAAM,eAAe,GAAG,IAAA,cAAM,GAAK,CAAC;IACpC,eAAe,CAAC,OAAO,GAAG,SAAS,IAAI,eAAe,CAAC,OAAO,CAAC;IAC/D,OAAO,eAAe,CAAC,OAAO,IAAI,IAAI,CAAC;AAC3C,CAAC;AAJD,4BAIC"}
|