@joza/joza-ui-kit 0.1.6 → 0.1.8
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/joza-ui-kit.cjs +60 -0
- package/dist/joza-ui-kit.cjs.map +1 -0
- package/dist/joza-ui-kit.es.js +5 -1367
- package/dist/joza-ui-kit.es.js.map +1 -1
- package/dist/joza-ui-kit.umd.js +12 -1375
- package/dist/joza-ui-kit.umd.js.map +1 -1
- package/package.json +5 -4
- package/dist/joza-ui-kit.cjs.js +0 -1422
- package/dist/joza-ui-kit.cjs.js.map +0 -1
- package/dist/joza-ui-kit.es.css +0 -2177
- package/dist/joza-ui-kit.umd.css +0 -2177
- /package/dist/{joza-ui-kit.cjs.css → style.css} +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
|
|
6
|
+
var styles$1 = {"animatedStat":"animated-stat-module_animatedStat__Hyy77","animatedStat__number":"animated-stat-module_animatedStat__number__xa33x","animatedStat__unit":"animated-stat-module_animatedStat__unit__N6MDD","animatedStat__label":"animated-stat-module_animatedStat__label__VpNaZ"};
|
|
7
|
+
|
|
8
|
+
const AnimatedStat = ({ label, unit, value }) => {
|
|
9
|
+
const useCountUp = (end, duration = 2000, startCounting = false) => {
|
|
10
|
+
const [count, setCount] = react.useState(0);
|
|
11
|
+
react.useEffect(() => {
|
|
12
|
+
if (!startCounting)
|
|
13
|
+
return;
|
|
14
|
+
let startTime;
|
|
15
|
+
let animationFrame;
|
|
16
|
+
const animate = (currentTime) => {
|
|
17
|
+
if (!startTime)
|
|
18
|
+
startTime = currentTime;
|
|
19
|
+
const progress = Math.min((currentTime - startTime) / duration, 1);
|
|
20
|
+
// Easing function for smooth animation
|
|
21
|
+
const easeOutQuart = 1 - Math.pow(1 - progress, 4);
|
|
22
|
+
setCount(Math.floor(easeOutQuart * end));
|
|
23
|
+
if (progress < 1) {
|
|
24
|
+
animationFrame = requestAnimationFrame(animate);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
animationFrame = requestAnimationFrame(animate);
|
|
28
|
+
return () => cancelAnimationFrame(animationFrame);
|
|
29
|
+
}, [end, duration, startCounting]);
|
|
30
|
+
return count;
|
|
31
|
+
};
|
|
32
|
+
react.useEffect(() => {
|
|
33
|
+
const observer = new IntersectionObserver(([entry]) => {
|
|
34
|
+
if (entry.isIntersecting) {
|
|
35
|
+
setIsVisible(true);
|
|
36
|
+
}
|
|
37
|
+
}, { threshold: 0.3 });
|
|
38
|
+
if (divRef.current) {
|
|
39
|
+
observer.observe(divRef.current);
|
|
40
|
+
}
|
|
41
|
+
return () => observer.disconnect();
|
|
42
|
+
}, []);
|
|
43
|
+
const [isVisible, setIsVisible] = react.useState(false);
|
|
44
|
+
const stat = useCountUp(value, 2000, isVisible);
|
|
45
|
+
const divRef = react.useRef(null);
|
|
46
|
+
return (jsxRuntime.jsx("div", { children: jsxRuntime.jsxs("div", { className: styles$1.animatedStat, ref: divRef, children: [jsxRuntime.jsxs("div", { className: styles$1.animatedStat, children: [jsxRuntime.jsx("span", { className: styles$1.animatedStat__number, children: stat }), jsxRuntime.jsx("span", { className: styles$1.animatedStat__unit, children: unit })] }), jsxRuntime.jsx("p", { className: styles$1.animatedStat__label, children: label })] }) }));
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
var styles = {"button2":"button2-module_button2__TJ0uA","button2__primary":"button2-module_button2__primary__b8-p4","button2__lg":"button2-module_button2__lg__KYxhn","button2__icon":"button2-module_button2__icon__k7LVe","button2__icon__picture":"button2-module_button2__icon__picture__MCRsw","button2__ghost":"button2-module_button2__ghost__yfm4E","button2__full":"button2-module_button2__full__S71L2"};
|
|
50
|
+
|
|
51
|
+
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
52
|
+
|
|
53
|
+
const Button2 = ({ label, size = "", style = "", disabled = false, icon: Icon, children = null, onClick = () => { } }) => {
|
|
54
|
+
return (jsxRuntime.jsx("div", { children: jsxRuntime.jsxs("button", { disabled: disabled, onClick: onClick, className: clsx(styles.button2, size === "lg" && styles.button2__lg, size === "full" && styles.button2__full, style === "" && styles.button2__primary, style === "ghost" && styles.button2__ghost), children: [!children &&
|
|
55
|
+
jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [label, Icon && jsxRuntime.jsx(Icon, { className: clsx(styles.button2__icon, styles.button2__icon__picture) })] }), children && jsxRuntime.jsx(jsxRuntime.Fragment, { children: children })] }) }));
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
exports.AnimatedStat = AnimatedStat;
|
|
59
|
+
exports.Button2 = Button2;
|
|
60
|
+
//# sourceMappingURL=joza-ui-kit.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"joza-ui-kit.cjs","sources":["../src/component/basic/animated-stat/animated-stat.tsx","../node_modules/clsx/dist/clsx.mjs","../src/component/basic/button2/button2.tsx"],"sourcesContent":["import styles from './animated-stat.module.scss';\nimport {useEffect, useRef, useState} from \"react\";\n\nexport interface AnimatedStatProps {\n label: string;\n unit: string;\n value: number;\n}\n\nconst AnimatedStat = ({label, unit, value} : AnimatedStatProps) => {\n\n const useCountUp = (end: number, duration: number = 2000, startCounting: boolean = false) => {\n const [count, setCount] = useState(0);\n\n useEffect(() => {\n if (!startCounting) return;\n\n let startTime: number;\n let animationFrame: number;\n\n const animate = (currentTime: number) => {\n if (!startTime) startTime = currentTime;\n const progress = Math.min((currentTime - startTime) / duration, 1);\n\n // Easing function for smooth animation\n const easeOutQuart = 1 - Math.pow(1 - progress, 4);\n setCount(Math.floor(easeOutQuart * end));\n\n if (progress < 1) {\n animationFrame = requestAnimationFrame(animate);\n }\n };\n\n animationFrame = requestAnimationFrame(animate);\n return () => cancelAnimationFrame(animationFrame);\n }, [end, duration, startCounting]);\n\n return count;\n };\n\n useEffect(() => {\n const observer = new IntersectionObserver(\n ([entry]) => {\n if (entry.isIntersecting) {\n setIsVisible(true);\n }\n },\n { threshold: 0.3 }\n );\n\n if (divRef.current) {\n observer.observe(divRef.current);\n }\n\n return () => observer.disconnect();\n }, []);\n\n const [isVisible, setIsVisible] = useState(false);\n const stat = useCountUp(value, 2000, isVisible);\n const divRef = useRef<HTMLDivElement>(null)\n\n return (\n <div>\n <div className={styles.animatedStat} ref={divRef}>\n <div className={styles.animatedStat}>\n <span className={styles.animatedStat__number}>{stat}</span>\n <span className={styles.animatedStat__unit}>{unit}</span>\n </div>\n <p className={styles.animatedStat__label}>{label}</p>\n </div>\n </div>)\n}\n\nexport default AnimatedStat;\n","function r(e){var t,f,n=\"\";if(\"string\"==typeof e||\"number\"==typeof e)n+=e;else if(\"object\"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=\" \"),n+=f)}else for(f in e)e[f]&&(n&&(n+=\" \"),n+=f);return n}export function clsx(){for(var e,t,f=0,n=\"\",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=\" \"),n+=t);return n}export default clsx;","import {LucideIcon} from \"lucide-react\";\nimport styles from './button2.module.scss';\nimport clsx from 'clsx';\nimport {ReactNode} from \"react\";\n\nexport interface Button2Props {\n label?: string;\n icon?: LucideIcon;\n size?: \"\" | \"lg\" | \"full\";\n style?: \"\" | \"ghost\";\n disabled?: boolean;\n onClick?: () => void;\n children?: ReactNode;\n}\n\nconst Button2 = ({label, size = \"\", style = \"\", disabled = false, icon :Icon, children = null, onClick = () => {}} : Button2Props) => {\n return (\n <div>\n <button disabled={disabled} onClick={onClick} className={\n clsx(\n styles.button2,\n size === \"lg\" && styles.button2__lg,\n size === \"full\" && styles.button2__full,\n style === \"\" && styles.button2__primary,\n style === \"ghost\" && styles.button2__ghost)}>\n {!children &&\n <>\n {label}\n {Icon && <Icon className={clsx(styles.button2__icon, styles.button2__icon__picture)}/>}\n </>}\n {children && <>{children}</>}\n </button>\n </div>)\n}\n\nexport default Button2;\n"],"names":["useState","useEffect","useRef","_jsx","_jsxs","styles","_Fragment"],"mappings":";;;;;;;AASA,MAAM,YAAY,GAAG,CAAC,EAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAqB,KAAI;IAE9D,MAAM,UAAU,GAAG,CAAC,GAAW,EAAE,QAAA,GAAmB,IAAI,EAAE,aAAA,GAAyB,KAAK,KAAI;QACxF,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAGA,cAAQ,CAAC,CAAC,CAAC;QAErCC,eAAS,CAAC,MAAK;AACX,YAAA,IAAI,CAAC,aAAa;gBAAE;AAEpB,YAAA,IAAI,SAAiB;AACrB,YAAA,IAAI,cAAsB;AAE1B,YAAA,MAAM,OAAO,GAAG,CAAC,WAAmB,KAAI;AACpC,gBAAA,IAAI,CAAC,SAAS;oBAAE,SAAS,GAAG,WAAW;AACvC,gBAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,GAAG,SAAS,IAAI,QAAQ,EAAE,CAAC,CAAC;;AAGlE,gBAAA,MAAM,YAAY,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,EAAE,CAAC,CAAC;gBAClD,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,GAAG,CAAC,CAAC;AAExC,gBAAA,IAAI,QAAQ,GAAG,CAAC,EAAE;AACd,oBAAA,cAAc,GAAG,qBAAqB,CAAC,OAAO,CAAC;gBACnD;AACJ,YAAA,CAAC;AAED,YAAA,cAAc,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