infinity-forge 8.6.6 → 8.6.7
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.
- package/dist/ui/components/count-up/index.d.ts +7 -0
- package/dist/ui/components/count-up/index.js +33 -0
- package/dist/ui/components/count-up/index.js.map +1 -0
- package/dist/ui/components/index.d.ts +2 -1
- package/dist/ui/components/index.js +1 -0
- package/dist/ui/components/index.js.map +1 -1
- package/dist/ui/hooks/index.d.ts +1 -0
- package/dist/ui/hooks/index.js +1 -0
- package/dist/ui/hooks/index.js.map +1 -1
- package/dist/ui/hooks/use-is-visible/index.d.ts +4 -0
- package/dist/ui/hooks/use-is-visible/index.js +32 -0
- package/dist/ui/hooks/use-is-visible/index.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CountUp = CountUp;
|
|
4
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
var ui_1 = require("../../../ui/index.js");
|
|
6
|
+
var react_1 = require("react");
|
|
7
|
+
function CountUp(_a) {
|
|
8
|
+
var target = _a.target, afterCount = _a.afterCount, beforeCount = _a.beforeCount, className = _a.className, _b = _a.duration, duration = _b === void 0 ? 2000 : _b;
|
|
9
|
+
var _c = (0, react_1.useState)(0), count = _c[0], setCount = _c[1];
|
|
10
|
+
var countRef = (0, react_1.useRef)(null);
|
|
11
|
+
var countIsVisible = (0, ui_1.useIsVisible)({ ref: countRef, showOneTime: true });
|
|
12
|
+
(0, react_1.useEffect)(function () {
|
|
13
|
+
if (!countIsVisible)
|
|
14
|
+
return;
|
|
15
|
+
var start = 0;
|
|
16
|
+
var increment = target / (duration / 16); // Aproximadamente 60 FPS
|
|
17
|
+
var timer = setInterval(function () {
|
|
18
|
+
start += increment;
|
|
19
|
+
if (start >= target) {
|
|
20
|
+
setCount(target);
|
|
21
|
+
clearInterval(timer);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
setCount(Math.ceil(start));
|
|
25
|
+
}
|
|
26
|
+
}, 16); // A cada ~16ms, para manter 60 FPS
|
|
27
|
+
return function () {
|
|
28
|
+
clearInterval(timer);
|
|
29
|
+
};
|
|
30
|
+
}, [target, duration, countIsVisible]);
|
|
31
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: className, ref: countRef, children: [beforeCount && (0, jsx_runtime_1.jsx)("span", { dangerouslySetInnerHTML: { __html: beforeCount } }), count, " ", afterCount && (0, jsx_runtime_1.jsx)("span", { dangerouslySetInnerHTML: { __html: afterCount } })] }));
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ui/components/count-up/index.tsx"],"names":[],"mappings":";;AAGA,0BA2CC;;AA9CD,2BAAmC;AACnC,+BAA0D;AAE1D,SAAgB,OAAO,CAAC,EAYvB;QAXC,MAAM,YAAA,EACN,UAAU,gBAAA,EACV,WAAW,iBAAA,EACX,SAAS,eAAA,EACT,gBAAe,EAAf,QAAQ,mBAAG,IAAI,KAAA;IAQT,IAAA,KAAoB,IAAA,gBAAQ,EAAC,CAAC,CAAC,EAA9B,KAAK,QAAA,EAAE,QAAQ,QAAe,CAAA;IACrC,IAAM,QAAQ,GAAG,IAAA,cAAM,EAAwB,IAAI,CAAC,CAAA;IACpD,IAAM,cAAc,GAAG,IAAA,iBAAY,EAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAA;IAEzE,IAAA,iBAAS,EAAC;QACR,IAAI,CAAC,cAAc;YAAE,OAAM;QAC3B,IAAI,KAAK,GAAG,CAAC,CAAA;QACb,IAAM,SAAS,GAAG,MAAM,GAAG,CAAC,QAAQ,GAAG,EAAE,CAAC,CAAA,CAAC,yBAAyB;QAEpE,IAAM,KAAK,GAAG,WAAW,CAAC;YACxB,KAAK,IAAI,SAAS,CAAA;YAClB,IAAI,KAAK,IAAI,MAAM,EAAE,CAAC;gBACpB,QAAQ,CAAC,MAAM,CAAC,CAAA;gBAChB,aAAa,CAAC,KAAK,CAAC,CAAA;YACtB,CAAC;iBAAM,CAAC;gBACN,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;YAC5B,CAAC;QACH,CAAC,EAAE,EAAE,CAAC,CAAA,CAAC,mCAAmC;QAE1C,OAAO;YACL,aAAa,CAAC,KAAK,CAAC,CAAA;QACtB,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAA;IAEtC,OAAO,CACL,iCAAK,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,aACrC,WAAW,IAAI,iCAAM,uBAAuB,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,GAAI,EACzE,KAAK,OAAG,UAAU,IAAI,iCAAM,uBAAuB,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,GAAI,IAC5E,CACP,CAAA;AACH,CAAC"}
|
|
@@ -7,6 +7,7 @@ export * from './charts/index.js';
|
|
|
7
7
|
export * from './overlay/index.js';
|
|
8
8
|
export * from './button/index.js';
|
|
9
9
|
export * from './tooltip/index.js';
|
|
10
|
+
export * from './count-up/index.js';
|
|
10
11
|
export * from './warning/index.js';
|
|
11
12
|
export * from './spacing/index.js';
|
|
12
13
|
export * from './sidebar/index.js';
|
|
@@ -19,7 +20,7 @@ export * from './animation/index.js';
|
|
|
19
20
|
export * from './next-image/index.js';
|
|
20
21
|
export * from './breadcrumb/index.js';
|
|
21
22
|
export * from './pagination/index.js';
|
|
22
|
-
export * from
|
|
23
|
+
export * from './zoom-hover/index.js';
|
|
23
24
|
export * from './menu-mobile/index.js';
|
|
24
25
|
export * from './pop-confirm/index.js';
|
|
25
26
|
export * from './loader-circle/index.js';
|
|
@@ -23,6 +23,7 @@ __exportStar(require("./charts/index.js"), exports);
|
|
|
23
23
|
__exportStar(require("./overlay/index.js"), exports);
|
|
24
24
|
__exportStar(require("./button/index.js"), exports);
|
|
25
25
|
__exportStar(require("./tooltip/index.js"), exports);
|
|
26
|
+
__exportStar(require("./count-up/index.js"), exports);
|
|
26
27
|
__exportStar(require("./warning/index.js"), exports);
|
|
27
28
|
__exportStar(require("./spacing/index.js"), exports);
|
|
28
29
|
__exportStar(require("./sidebar/index.js"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAqB;AACrB,yCAAsB;AACtB,yCAAsB;AACtB,0CAAuB;AACvB,0CAAuB;AACvB,2CAAwB;AACxB,4CAAyB;AACzB,2CAAwB;AACxB,4CAAyB;AACzB,4CAAyB;AACzB,4CAAyB;AACzB,4CAAyB;AACzB,6CAA0B;AAC1B,6CAA0B;AAC1B,8CAA2B;AAC3B,8CAA2B;AAC3B,8CAA2B;AAC3B,8CAA2B;AAC3B,+CAA4B;AAC5B,+CAA4B;AAC5B,+CAA4B;AAC5B,+CAA4B;AAC5B,gDAA6B;AAC7B,gDAA6B;AAC7B,kDAA+B;AAC/B,mDAAgC;AAChC,mDAAgC;AAChC,mDAAgC;AAChC,0DAAuC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAqB;AACrB,yCAAsB;AACtB,yCAAsB;AACtB,0CAAuB;AACvB,0CAAuB;AACvB,2CAAwB;AACxB,4CAAyB;AACzB,2CAAwB;AACxB,4CAAyB;AACzB,6CAA0B;AAC1B,4CAAyB;AACzB,4CAAyB;AACzB,4CAAyB;AACzB,6CAA0B;AAC1B,6CAA0B;AAC1B,8CAA2B;AAC3B,8CAA2B;AAC3B,8CAA2B;AAC3B,8CAA2B;AAC3B,+CAA4B;AAC5B,+CAA4B;AAC5B,+CAA4B;AAC5B,+CAA4B;AAC5B,gDAA6B;AAC7B,gDAA6B;AAC7B,kDAA+B;AAC/B,mDAAgC;AAChC,mDAAgC;AAChC,mDAAgC;AAChC,0DAAuC"}
|
package/dist/ui/hooks/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './use-scroll.js';
|
|
|
5
5
|
export * from './permitions/index.js';
|
|
6
6
|
export * from './use-window.js';
|
|
7
7
|
export * from './use-swagger/index.js';
|
|
8
|
+
export * from './use-is-visible/index.js';
|
|
8
9
|
export * from './use-element-id.js';
|
|
9
10
|
export * from './use-mount-transition/index.js';
|
|
10
11
|
export * from './use-component-is-mounted.js';
|
package/dist/ui/hooks/index.js
CHANGED
|
@@ -21,6 +21,7 @@ __exportStar(require("./use-scroll.js"), exports);
|
|
|
21
21
|
__exportStar(require("./permitions/index.js"), exports);
|
|
22
22
|
__exportStar(require("./use-window.js"), exports);
|
|
23
23
|
__exportStar(require("./use-swagger/index.js"), exports);
|
|
24
|
+
__exportStar(require("./use-is-visible/index.js"), exports);
|
|
24
25
|
__exportStar(require("./use-element-id.js"), exports);
|
|
25
26
|
__exportStar(require("./use-mount-transition/index.js"), exports);
|
|
26
27
|
__exportStar(require("./use-component-is-mounted.js"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/hooks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA2B;AAC3B,8CAA2B;AAC3B,+CAA4B;AAC5B,+CAA4B;AAC5B,+CAA4B;AAC5B,+CAA4B;AAC5B,gDAA6B;AAC7B,mDAAgC;AAChC,yDAAsC;AACtC,6DAA0C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/hooks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA2B;AAC3B,8CAA2B;AAC3B,+CAA4B;AAC5B,+CAA4B;AAC5B,+CAA4B;AAC5B,+CAA4B;AAC5B,gDAA6B;AAC7B,mDAAgC;AAChC,mDAAgC;AAChC,yDAAsC;AACtC,6DAA0C"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useIsVisible = useIsVisible;
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
function useIsVisible(_a) {
|
|
6
|
+
var ref = _a.ref, showOneTime = _a.showOneTime;
|
|
7
|
+
var _b = (0, react_1.useState)(false), isIntersecting = _b[0], setIntersecting = _b[1];
|
|
8
|
+
(0, react_1.useEffect)(function () {
|
|
9
|
+
var observer = new IntersectionObserver(function (_a) {
|
|
10
|
+
var entry = _a[0];
|
|
11
|
+
if (showOneTime) {
|
|
12
|
+
// Se o showOneTime for verdadeiro e o estado já estiver como visível, não o altere mais
|
|
13
|
+
if (entry.isIntersecting) {
|
|
14
|
+
setIntersecting(true);
|
|
15
|
+
observer.disconnect(); // Desconecta após a primeira interseção
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
// Para comportamento normal, sem showOneTime
|
|
20
|
+
setIntersecting(entry.isIntersecting);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
if (ref.current) {
|
|
24
|
+
observer.observe(ref.current);
|
|
25
|
+
}
|
|
26
|
+
return function () {
|
|
27
|
+
observer.disconnect();
|
|
28
|
+
};
|
|
29
|
+
}, [ref, showOneTime]);
|
|
30
|
+
return isIntersecting;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ui/hooks/use-is-visible/index.tsx"],"names":[],"mappings":";;AAEA,oCA2BC;AA7BD,+BAA2C;AAE3C,SAAgB,YAAY,CAAC,EAAkF;QAAhF,GAAG,SAAA,EAAE,WAAW,iBAAA;IACvC,IAAA,KAAoC,IAAA,gBAAQ,EAAC,KAAK,CAAC,EAAlD,cAAc,QAAA,EAAE,eAAe,QAAmB,CAAA;IAEzD,IAAA,iBAAS,EAAC;QACR,IAAM,QAAQ,GAAG,IAAI,oBAAoB,CAAC,UAAC,EAAO;gBAAN,KAAK,QAAA;YAC/C,IAAI,WAAW,EAAE,CAAC;gBAChB,wFAAwF;gBACxF,IAAI,KAAK,CAAC,cAAc,EAAE,CAAC;oBACzB,eAAe,CAAC,IAAI,CAAC,CAAA;oBACrB,QAAQ,CAAC,UAAU,EAAE,CAAA,CAAC,wCAAwC;gBAChE,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,6CAA6C;gBAC7C,eAAe,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;YACvC,CAAC;QACH,CAAC,CAAC,CAAA;QAEF,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;YAChB,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QAC/B,CAAC;QAED,OAAO;YACL,QAAQ,CAAC,UAAU,EAAE,CAAA;QACvB,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC,CAAA;IAEtB,OAAO,cAAc,CAAA;AACvB,CAAC"}
|