1mpacto-react-ui 2.0.18 → 2.0.20
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/components/Chart/PieChart.cjs +1 -0
- package/dist/components/Chart/PieChart.mjs +172 -0
- package/dist/hooks/useDebounce.cjs +1 -0
- package/dist/hooks/useDebounce.mjs +27 -0
- package/dist/hooks/usePacked.cjs +1 -0
- package/dist/hooks/usePacked.mjs +56 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +94 -88
- package/dist/package.json.cjs +1 -1
- package/dist/package.json.d.ts +1 -1
- package/dist/package.json.mjs +1 -1
- package/dist/src/components/Chart/PieChart.d.ts +1 -1
- package/dist/src/components/Chart/PieChart.stories.d.ts +2 -15
- package/dist/src/components/index.d.ts +4 -3
- package/dist/src/hooks/index.d.ts +4 -2
- package/dist/src/hooks/useDebounce.d.ts +61 -0
- package/dist/src/hooks/usePacked.d.ts +84 -0
- package/dist/src/interfaces/components/Chart/index.d.ts +25 -8
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const C=require("react/jsx-runtime"),j=require("chart.js"),h=require("react"),E=require("react-chartjs-2"),w=require("../../utils/common.cjs"),T=require("../PortalComponent/PortalComponent.cjs");j.Chart.register(j.ArcElement,j.Tooltip);const I=(t,l,n)=>{const r=l>0?t/l*100:0;switch(n){case"decimal":return w.formatNumber(t,"decimal");case"currency":return w.formatNumber(t,"currency");case"percentage":default:return`${Math.round(r)}%`}},O=()=>{const t=Math.floor(Math.random()*360),l=60+Math.floor(Math.random()*30),n=45+Math.floor(Math.random()*20);return((o,a,c)=>{a/=100,c/=100;const s=a*Math.min(c,1-c),d=u=>{const i=(u+o/30)%12,e=c-s*Math.max(Math.min(i-3,9-i,1),-1);return Math.round(255*e).toString(16).padStart(2,"0")};return`#${d(0)}${d(8)}${d(4)}`})(t,l,n)},A=(t,l)=>Array.isArray(t)?t[l]||O():typeof t=="string"?t:O(),B=t=>{const l=t.labels??[],n=t.datasets[0];return n?(n.data??[]).map((o,a)=>({label:l[a]??"",value:o,backgroundColor:A(n.backgroundColor,a)})):[]},R=(t,l)=>{if(!l)return{labels:t.map(e=>e.label),values:t.map(e=>e.value),colors:t.map(e=>e.backgroundColor||O()),mergedMap:{}};const{mode:n,value:r,otherLabel:o="Other",otherBackgroundColor:a="#B0BEC5"}=l,c=t.reduce((e,p)=>e+p.value,0),s=[],d=[];let u=0;t.forEach(e=>{(n==="percentage"?e.value/c*100<r:e.value<r)?(u+=e.value,d.push(e)):s.push({label:e.label,value:e.value,color:e.backgroundColor||O()})});const i={};return u>0&&(s.push({label:o,value:u,color:a}),i[s.length-1]=d),{labels:s.map(e=>e.label),values:s.map(e=>e.value),colors:s.map(e=>e.color),mergedMap:i}},F=(t,l,n)=>({chart:r,tooltip:o})=>{var g,f,b,m,v,x,y,M,S,k;const a={};if(o.opacity===0){t(P=>({...P,style:{...P.style,opacity:0,pointerEvents:"none"}}));return}if(!o.dataPoints||o.dataPoints.length===0)return;a.opacity="1",a.position="absolute",a.pointerEvents="none";const c=r.canvas.getBoundingClientRect();a.left=c.left+window.pageXOffset+o.caretX+"px",a.top=c.top+window.pageYOffset+o.caretY+"px";const s=o.dataPoints[0].dataIndex,d=((f=(g=o.dataPoints)==null?void 0:g[0])==null?void 0:f.label)??"",u=((m=(b=o.dataPoints)==null?void 0:b[0])==null?void 0:m.raw)??0,i=((y=(x=(v=o.dataPoints)==null?void 0:v[0])==null?void 0:x.dataset.backgroundColor)==null?void 0:y[s])??"",e=((k=(S=(M=o.dataPoints)==null?void 0:M[0])==null?void 0:S.dataset.data)==null?void 0:k.reduce((P,q)=>P+q,0))||1,p=e>0?u/e*100:0;t({label:d,value:u,percentage:p,formattedValue:I(u,e,l),backgroundColor:typeof i=="string"?i:"#000",mergedItems:n[s]??[],style:a,dataPoints:o.dataPoints})},V=(t,l)=>({id:"pieLabelPlugin",afterDraw(n){const{ctx:r}=n,o=n.getDatasetMeta(0),a=n.data.datasets[0].data.reduce((c,s)=>c+s,0);o.data.forEach((c,s)=>{var f;const u=n.data.datasets[0].data[s]??0;if((a>0?u/a*100:0)<l)return;const{x:e,y:p}=c.tooltipPosition(!1),g=(f=n.data.labels)==null?void 0:f[s];r.save(),r.textAlign="center",r.textBaseline="middle",r.fillStyle="#FFFFFF",r.font="bold 10px Inter, sans-serif",r.fillText(g,e||0,(p||0)-6),r.fillText(I(u,a,t),e||0,(p||0)+8),r.restore()})}}),$={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{enabled:!0}},elements:{arc:{hoverOffset:8,borderWidth:0}}},D=({data:t,height:l,classNameContainer:n,id:r,options:o,CustomTooltip:a,threshold:c,valueFormat:s,hideLabelBelowPercentage:d=5})=>{const[u,i]=h.useState({style:{opacity:0,position:"absolute",left:0,top:0},label:"",value:0,percentage:0,formattedValue:"",backgroundColor:"",mergedItems:[],dataPoints:[]}),e=h.useMemo(()=>B(t),[t]),{labels:p,values:g,colors:f,mergedMap:b}=h.useMemo(()=>R(e,c),[e,c]),m=h.useMemo(()=>({labels:p,datasets:[{...t.datasets[0],data:g,backgroundColor:f,hoverOffset:8,borderWidth:0}]}),[p,g,f,t.datasets]),v=h.useMemo(()=>{const x={plugins:{tooltip:{enabled:!a,external:a?({chart:y,tooltip:M})=>F(i,s,b)({chart:y,tooltip:M}):void 0}}};return w.mergeObjects($,x,o??{})},[o,a,s,b]);return C.jsxs("div",{id:r,className:n,style:{height:l||"300px"},children:[a&&C.jsx(T.default,{selector:"body",children:C.jsx(a,{...u})}),C.jsx(E.Pie,{data:m,options:v,plugins:[V(s,d)]})]})};exports.default=D;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { jsxs as A, jsx as O } from "react/jsx-runtime";
|
|
2
|
+
import { Chart as B, ArcElement as T, Tooltip as F } from "chart.js";
|
|
3
|
+
import h from "react";
|
|
4
|
+
import { Pie as R } from "react-chartjs-2";
|
|
5
|
+
import { mergeObjects as V, formatNumber as I } from "../../utils/common.mjs";
|
|
6
|
+
import $ from "../PortalComponent/PortalComponent.mjs";
|
|
7
|
+
B.register(T, F);
|
|
8
|
+
const E = (t, l, n) => {
|
|
9
|
+
const r = l > 0 ? t / l * 100 : 0;
|
|
10
|
+
switch (n) {
|
|
11
|
+
case "decimal":
|
|
12
|
+
return I(t, "decimal");
|
|
13
|
+
case "currency":
|
|
14
|
+
return I(t, "currency");
|
|
15
|
+
case "percentage":
|
|
16
|
+
default:
|
|
17
|
+
return `${Math.round(r)}%`;
|
|
18
|
+
}
|
|
19
|
+
}, P = () => {
|
|
20
|
+
const t = Math.floor(Math.random() * 360), l = 60 + Math.floor(Math.random() * 30), n = 45 + Math.floor(Math.random() * 20);
|
|
21
|
+
return ((o, a, c) => {
|
|
22
|
+
a /= 100, c /= 100;
|
|
23
|
+
const s = a * Math.min(c, 1 - c), u = (d) => {
|
|
24
|
+
const i = (d + o / 30) % 12, e = c - s * Math.max(Math.min(i - 3, 9 - i, 1), -1);
|
|
25
|
+
return Math.round(255 * e).toString(16).padStart(2, "0");
|
|
26
|
+
};
|
|
27
|
+
return `#${u(0)}${u(8)}${u(4)}`;
|
|
28
|
+
})(t, l, n);
|
|
29
|
+
}, j = (t, l) => Array.isArray(t) ? t[l] || P() : typeof t == "string" ? t : P(), D = (t) => {
|
|
30
|
+
const l = t.labels ?? [], n = t.datasets[0];
|
|
31
|
+
return n ? (n.data ?? []).map((o, a) => ({
|
|
32
|
+
label: l[a] ?? "",
|
|
33
|
+
value: o,
|
|
34
|
+
backgroundColor: j(n.backgroundColor, a)
|
|
35
|
+
})) : [];
|
|
36
|
+
}, L = (t, l) => {
|
|
37
|
+
if (!l)
|
|
38
|
+
return {
|
|
39
|
+
labels: t.map((e) => e.label),
|
|
40
|
+
values: t.map((e) => e.value),
|
|
41
|
+
colors: t.map((e) => e.backgroundColor || P()),
|
|
42
|
+
mergedMap: {}
|
|
43
|
+
};
|
|
44
|
+
const { mode: n, value: r, otherLabel: o = "Other", otherBackgroundColor: a = "#B0BEC5" } = l, c = t.reduce((e, p) => e + p.value, 0), s = [], u = [];
|
|
45
|
+
let d = 0;
|
|
46
|
+
t.forEach((e) => {
|
|
47
|
+
(n === "percentage" ? e.value / c * 100 < r : e.value < r) ? (d += e.value, u.push(e)) : s.push({
|
|
48
|
+
label: e.label,
|
|
49
|
+
value: e.value,
|
|
50
|
+
color: e.backgroundColor || P()
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
const i = {};
|
|
54
|
+
return d > 0 && (s.push({ label: o, value: d, color: a }), i[s.length - 1] = u), {
|
|
55
|
+
labels: s.map((e) => e.label),
|
|
56
|
+
values: s.map((e) => e.value),
|
|
57
|
+
colors: s.map((e) => e.color),
|
|
58
|
+
mergedMap: i
|
|
59
|
+
};
|
|
60
|
+
}, G = (t, l, n) => ({ chart: r, tooltip: o }) => {
|
|
61
|
+
var m, f, g, b, v, C, y, x, w, k;
|
|
62
|
+
const a = {};
|
|
63
|
+
if (o.opacity === 0) {
|
|
64
|
+
t((M) => ({ ...M, style: { ...M.style, opacity: 0, pointerEvents: "none" } }));
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (!o.dataPoints || o.dataPoints.length === 0) return;
|
|
68
|
+
a.opacity = "1", a.position = "absolute", a.pointerEvents = "none";
|
|
69
|
+
const c = r.canvas.getBoundingClientRect();
|
|
70
|
+
a.left = c.left + window.pageXOffset + o.caretX + "px", a.top = c.top + window.pageYOffset + o.caretY + "px";
|
|
71
|
+
const s = o.dataPoints[0].dataIndex, u = ((f = (m = o.dataPoints) == null ? void 0 : m[0]) == null ? void 0 : f.label) ?? "", d = ((b = (g = o.dataPoints) == null ? void 0 : g[0]) == null ? void 0 : b.raw) ?? 0, i = ((y = (C = (v = o.dataPoints) == null ? void 0 : v[0]) == null ? void 0 : C.dataset.backgroundColor) == null ? void 0 : y[s]) ?? "", e = ((k = (w = (x = o.dataPoints) == null ? void 0 : x[0]) == null ? void 0 : w.dataset.data) == null ? void 0 : k.reduce((M, S) => M + S, 0)) || 1, p = e > 0 ? d / e * 100 : 0;
|
|
72
|
+
t({
|
|
73
|
+
label: u,
|
|
74
|
+
value: d,
|
|
75
|
+
percentage: p,
|
|
76
|
+
formattedValue: E(d, e, l),
|
|
77
|
+
backgroundColor: typeof i == "string" ? i : "#000",
|
|
78
|
+
mergedItems: n[s] ?? [],
|
|
79
|
+
style: a,
|
|
80
|
+
dataPoints: o.dataPoints
|
|
81
|
+
});
|
|
82
|
+
}, H = (t, l) => ({
|
|
83
|
+
id: "pieLabelPlugin",
|
|
84
|
+
afterDraw(n) {
|
|
85
|
+
const { ctx: r } = n, o = n.getDatasetMeta(0), a = n.data.datasets[0].data.reduce((c, s) => c + s, 0);
|
|
86
|
+
o.data.forEach((c, s) => {
|
|
87
|
+
var f;
|
|
88
|
+
const d = n.data.datasets[0].data[s] ?? 0;
|
|
89
|
+
if ((a > 0 ? d / a * 100 : 0) < l) return;
|
|
90
|
+
const { x: e, y: p } = c.tooltipPosition(!1), m = (f = n.data.labels) == null ? void 0 : f[s];
|
|
91
|
+
r.save(), r.textAlign = "center", r.textBaseline = "middle", r.fillStyle = "#FFFFFF", r.font = "bold 10px Inter, sans-serif", r.fillText(m, e || 0, (p || 0) - 6), r.fillText(E(d, a, t), e || 0, (p || 0) + 8), r.restore();
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}), N = {
|
|
95
|
+
responsive: !0,
|
|
96
|
+
maintainAspectRatio: !1,
|
|
97
|
+
plugins: {
|
|
98
|
+
legend: {
|
|
99
|
+
display: !1
|
|
100
|
+
},
|
|
101
|
+
tooltip: {
|
|
102
|
+
enabled: !0
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
elements: {
|
|
106
|
+
arc: {
|
|
107
|
+
hoverOffset: 8,
|
|
108
|
+
borderWidth: 0
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}, K = ({
|
|
112
|
+
data: t,
|
|
113
|
+
height: l,
|
|
114
|
+
classNameContainer: n,
|
|
115
|
+
id: r,
|
|
116
|
+
options: o,
|
|
117
|
+
CustomTooltip: a,
|
|
118
|
+
threshold: c,
|
|
119
|
+
valueFormat: s,
|
|
120
|
+
hideLabelBelowPercentage: u = 5
|
|
121
|
+
}) => {
|
|
122
|
+
const [d, i] = h.useState({
|
|
123
|
+
style: { opacity: 0, position: "absolute", left: 0, top: 0 },
|
|
124
|
+
label: "",
|
|
125
|
+
value: 0,
|
|
126
|
+
percentage: 0,
|
|
127
|
+
formattedValue: "",
|
|
128
|
+
backgroundColor: "",
|
|
129
|
+
mergedItems: [],
|
|
130
|
+
dataPoints: []
|
|
131
|
+
}), e = h.useMemo(() => D(t), [t]), {
|
|
132
|
+
labels: p,
|
|
133
|
+
values: m,
|
|
134
|
+
colors: f,
|
|
135
|
+
mergedMap: g
|
|
136
|
+
} = h.useMemo(() => L(e, c), [e, c]), b = h.useMemo(
|
|
137
|
+
() => ({
|
|
138
|
+
labels: p,
|
|
139
|
+
datasets: [
|
|
140
|
+
{
|
|
141
|
+
...t.datasets[0],
|
|
142
|
+
data: m,
|
|
143
|
+
backgroundColor: f,
|
|
144
|
+
hoverOffset: 8,
|
|
145
|
+
borderWidth: 0
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
}),
|
|
149
|
+
[p, m, f, t.datasets]
|
|
150
|
+
), v = h.useMemo(() => V(N, {
|
|
151
|
+
plugins: {
|
|
152
|
+
tooltip: {
|
|
153
|
+
enabled: !a,
|
|
154
|
+
external: a ? ({ chart: y, tooltip: x }) => G(i, s, g)({ chart: y, tooltip: x }) : void 0
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}, o ?? {}), [o, a, s, g]);
|
|
158
|
+
return /* @__PURE__ */ A("div", { id: r, className: n, style: { height: l || "300px" }, children: [
|
|
159
|
+
a && /* @__PURE__ */ O($, { selector: "body", children: /* @__PURE__ */ O(a, { ...d }) }),
|
|
160
|
+
/* @__PURE__ */ O(
|
|
161
|
+
R,
|
|
162
|
+
{
|
|
163
|
+
data: b,
|
|
164
|
+
options: v,
|
|
165
|
+
plugins: [H(s, u)]
|
|
166
|
+
}
|
|
167
|
+
)
|
|
168
|
+
] });
|
|
169
|
+
};
|
|
170
|
+
export {
|
|
171
|
+
K as default
|
|
172
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react"),s=(a,r,t,l)=>{t.current!==null&&(clearTimeout(t.current),t.current=null),l.current!==null&&(clearTimeout(l.current),l.current=null),r.current!==null&&(a.current(...r.current),r.current=null)},b=(a,r)=>{const t=(r==null?void 0:r.wait)??0,l=r==null?void 0:r.maxWait,u=n.useRef(null),e=n.useRef(null),i=n.useRef(a),c=n.useRef(null);i.current=a;const f=n.useCallback(()=>{u.current!==null&&(clearTimeout(u.current),u.current=null),e.current!==null&&(clearTimeout(e.current),e.current=null),c.current=null},[]),o=n.useCallback(()=>{s(i,c,u,e)},[]),m=n.useCallback(()=>u.current!==null,[]),T=n.useCallback((...d)=>{c.current=d,u.current!==null&&clearTimeout(u.current),u.current=setTimeout(()=>{u.current=null,e.current!==null&&(clearTimeout(e.current),e.current=null),c.current!==null&&(i.current(...c.current),c.current=null)},t),l!==void 0&&e.current===null&&(e.current=setTimeout(()=>{e.current=null,s(i,c,u,e)},l))},[t,l]);return n.useEffect(()=>()=>{u.current!==null&&clearTimeout(u.current),e.current!==null&&clearTimeout(e.current)},[]),{debouncedFn:T,cancel:f,flush:o,pending:m}};exports.default=b;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import n from "react";
|
|
2
|
+
const i = (a, e, t, l) => {
|
|
3
|
+
t.current !== null && (clearTimeout(t.current), t.current = null), l.current !== null && (clearTimeout(l.current), l.current = null), e.current !== null && (a.current(...e.current), e.current = null);
|
|
4
|
+
}, C = (a, e) => {
|
|
5
|
+
const t = (e == null ? void 0 : e.wait) ?? 0, l = e == null ? void 0 : e.maxWait, u = n.useRef(null), r = n.useRef(null), f = n.useRef(a), c = n.useRef(null);
|
|
6
|
+
f.current = a;
|
|
7
|
+
const s = n.useCallback(() => {
|
|
8
|
+
u.current !== null && (clearTimeout(u.current), u.current = null), r.current !== null && (clearTimeout(r.current), r.current = null), c.current = null;
|
|
9
|
+
}, []), m = n.useCallback(() => {
|
|
10
|
+
i(f, c, u, r);
|
|
11
|
+
}, []), T = n.useCallback(() => u.current !== null, []), o = n.useCallback(
|
|
12
|
+
(...b) => {
|
|
13
|
+
c.current = b, u.current !== null && clearTimeout(u.current), u.current = setTimeout(() => {
|
|
14
|
+
u.current = null, r.current !== null && (clearTimeout(r.current), r.current = null), c.current !== null && (f.current(...c.current), c.current = null);
|
|
15
|
+
}, t), l !== void 0 && r.current === null && (r.current = setTimeout(() => {
|
|
16
|
+
r.current = null, i(f, c, u, r);
|
|
17
|
+
}, l));
|
|
18
|
+
},
|
|
19
|
+
[t, l]
|
|
20
|
+
);
|
|
21
|
+
return n.useEffect(() => () => {
|
|
22
|
+
u.current !== null && clearTimeout(u.current), r.current !== null && clearTimeout(r.current);
|
|
23
|
+
}, []), { debouncedFn: o, cancel: s, flush: m, pending: T };
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
C as default
|
|
27
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("react"),S=require("./useDebounce.cjs"),X=(e,R=[])=>{const a=d.useRef(null),[z,M]=d.useState(0),c=d.useCallback(()=>{if(!a.current||e.columns<1)return;const n=a.current,p=Array.from(n.children);n.style.position="relative",n.style.width="100%",e.animationEnabled?n.style.transition="height 0.4s ease":n.style.transition="";const y=n.clientWidth;let g="mobile",x=-1;for(const[m,t]of Object.entries(e.breakpoints??{}))y>=t&&t>x&&(x=t,g=m);const o=Math.max(0,(y-(e.columns-1)*e.gapX)/e.columns);if(o<=0)return;const h=Array(e.columns).fill(0),H=e.orientation==="top-bottom";p.forEach(m=>{const t=m,E=parseInt(t.dataset[`${g}Cols`]||t.dataset.cols||"1",10),r=Math.min(isNaN(E)?1:E,e.columns);t.style.position="absolute",t.style.boxSizing="border-box",e.animationEnabled?t.style.transition="all 0.4s ease":t.style.transition="",t.style.width=`${r*o+(r-1)*e.gapX}px`;let u;if(t.dataset.rows){const s=parseInt(t.dataset.rows,10),i=isNaN(s)?1:s;u=i*o+(i-1)*e.gapY}else t.style.height="auto",u=t.offsetHeight;let f=0,l=1/0;for(let s=0;s<=e.columns-r;s++){const i=Math.max(...h.slice(s,s+r));i<l&&(l=i,f=s)}t.style.height=`${u}px`,t.style.left=t.style.right=t.style.top=t.style.bottom="auto";const $=f*(o+e.gapX);e.direction==="rtl"?t.style.right=`${$}px`:t.style.left=`${$}px`,H?t.style.top=`${l}px`:t.style.bottom=`${l}px`;for(let s=f;s<f+r;s++)h[s]=l+u+e.gapY});const w=Math.max(...h),v=w>0?w-e.gapY:0;n.style.height=`${v}px`,M(v)},[e.columns,e.gapX,e.gapY,e.animationEnabled,e.breakpoints,e.orientation,e.direction]),{debouncedFn:b}=S.default(c,{wait:e.debounceResize??150});return d.useLayoutEffect(()=>{const n=new ResizeObserver(b);return a.current&&n.observe(a.current),window.addEventListener("resize",b),c(),()=>{a.current&&n.unobserve(a.current),window.removeEventListener("resize",b)}},[c,...R]),{containerRef:a,containerHeight:z,recalculate:c}};exports.default=X;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import m from "react";
|
|
2
|
+
import k from "./useDebounce.mjs";
|
|
3
|
+
const N = (e, p = []) => {
|
|
4
|
+
const a = m.useRef(null), [R, z] = m.useState(0), c = m.useCallback(() => {
|
|
5
|
+
if (!a.current || e.columns < 1) return;
|
|
6
|
+
const s = a.current, H = Array.from(s.children);
|
|
7
|
+
s.style.position = "relative", s.style.width = "100%", e.animationEnabled ? s.style.transition = "height 0.4s ease" : s.style.transition = "";
|
|
8
|
+
const b = s.clientWidth;
|
|
9
|
+
let g = "mobile", x = -1;
|
|
10
|
+
for (const [y, t] of Object.entries(e.breakpoints ?? {}))
|
|
11
|
+
b >= t && t > x && (x = t, g = y);
|
|
12
|
+
const o = Math.max(0, (b - (e.columns - 1) * e.gapX) / e.columns);
|
|
13
|
+
if (o <= 0) return;
|
|
14
|
+
const h = Array(e.columns).fill(0), X = e.orientation === "top-bottom";
|
|
15
|
+
H.forEach((y) => {
|
|
16
|
+
const t = y, E = parseInt(t.dataset[`${g}Cols`] || t.dataset.cols || "1", 10), r = Math.min(isNaN(E) ? 1 : E, e.columns);
|
|
17
|
+
t.style.position = "absolute", t.style.boxSizing = "border-box", e.animationEnabled ? t.style.transition = "all 0.4s ease" : t.style.transition = "", t.style.width = `${r * o + (r - 1) * e.gapX}px`;
|
|
18
|
+
let u;
|
|
19
|
+
if (t.dataset.rows) {
|
|
20
|
+
const n = parseInt(t.dataset.rows, 10), i = isNaN(n) ? 1 : n;
|
|
21
|
+
u = i * o + (i - 1) * e.gapY;
|
|
22
|
+
} else
|
|
23
|
+
t.style.height = "auto", u = t.offsetHeight;
|
|
24
|
+
let f = 0, l = 1 / 0;
|
|
25
|
+
for (let n = 0; n <= e.columns - r; n++) {
|
|
26
|
+
const i = Math.max(...h.slice(n, n + r));
|
|
27
|
+
i < l && (l = i, f = n);
|
|
28
|
+
}
|
|
29
|
+
t.style.height = `${u}px`, t.style.left = t.style.right = t.style.top = t.style.bottom = "auto";
|
|
30
|
+
const $ = f * (o + e.gapX);
|
|
31
|
+
e.direction === "rtl" ? t.style.right = `${$}px` : t.style.left = `${$}px`, X ? t.style.top = `${l}px` : t.style.bottom = `${l}px`;
|
|
32
|
+
for (let n = f; n < f + r; n++) h[n] = l + u + e.gapY;
|
|
33
|
+
});
|
|
34
|
+
const w = Math.max(...h), v = w > 0 ? w - e.gapY : 0;
|
|
35
|
+
s.style.height = `${v}px`, z(v);
|
|
36
|
+
}, [
|
|
37
|
+
e.columns,
|
|
38
|
+
e.gapX,
|
|
39
|
+
e.gapY,
|
|
40
|
+
e.animationEnabled,
|
|
41
|
+
e.breakpoints,
|
|
42
|
+
e.orientation,
|
|
43
|
+
e.direction
|
|
44
|
+
]), { debouncedFn: d } = k(c, {
|
|
45
|
+
wait: e.debounceResize ?? 150
|
|
46
|
+
});
|
|
47
|
+
return m.useLayoutEffect(() => {
|
|
48
|
+
const s = new ResizeObserver(d);
|
|
49
|
+
return a.current && s.observe(a.current), window.addEventListener("resize", d), c(), () => {
|
|
50
|
+
a.current && s.unobserve(a.current), window.removeEventListener("resize", d);
|
|
51
|
+
};
|
|
52
|
+
}, [c, ...p]), { containerRef: a, containerHeight: R, recalculate: c };
|
|
53
|
+
};
|
|
54
|
+
export {
|
|
55
|
+
N as default
|
|
56
|
+
};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./utils/common.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./utils/common.cjs"),c=require("./utils/formatBigNumber.cjs"),d=require("./utils/cookies.cjs"),m=require("./components/Alert/index.cjs"),t=require("./utils/yup.cjs"),l=require("./config/bigNumber/index.cjs"),n=require("./utils/axiosBigNumber.cjs"),b=require("./config/tailwind/colors.cjs"),g=require("./config/tailwind/screen.cjs"),p=require("./config/tailwind/nativeScreen.cjs"),q=require("./components/TPublish/TPublish.cjs"),T=require("./components/Button/Button.cjs"),C=require("./components/Popover/Popover.cjs"),y=require("./components/Calendar/Calendar.cjs"),B=require("./components/Calendar/CalendarRange.cjs"),h=require("./components/DatePicker/DatePicker.cjs"),D=require("./components/DatePicker/DateRangePicker.cjs"),N=require("./components/DatePicker/FilterDate.cjs"),O=require("./components/Input/InputFloatingInner.cjs"),P=require("./components/Input/InputReguler.cjs"),S=require("./components/Pagination/Pagination.cjs"),I=require("./components/Tabs/Tabs.cjs"),x=require("./components/Tabs/TabPanel.cjs"),M=require("./components/Table/Table.cjs"),R=require("./components/Virtualization/TableVirtualization.cjs"),v=require("./components/Virtualization/ListVirtualization.cjs"),A=require("./components/SelectDropdownContainer/SelectDropdownContainer.cjs"),F=require("./components/Switch/Switch.cjs"),L=require("./components/ButtonIcon/ButtonIcon.cjs"),E=require("./components/Badges/Badges.cjs"),k=require("./components/Chips/Chips.cjs"),u=require("./components/RadioCheckbox/RadioCheckbox.cjs"),j=require("./components/RadioCheckbox/RadioCheckboxLabel.cjs"),w=require("./components/Breadcrumbs/Breadcrumbs.cjs"),V=require("./components/Sidebar/Sidebar.cjs"),z=require("./components/Collapse/Collapse.cjs"),K=require("./components/Modal/ModalDialog.cjs"),U=require("./components/Timeline/Timeline.cjs"),G=require("./components/FilterContainer/FilterContainer.cjs"),_=require("./components/NumberFormat/NumberFormat.cjs"),H=require("./components/PortalComponent/PortalComponent.cjs"),J=require("./components/Upload/UploadFile.cjs"),Q=require("./components/TruncateComponent/TruncateComponent.cjs"),W=require("./components/Upload/UploadImage.cjs"),Y=require("./components/Textarea/Textarea.cjs"),Z=require("./components/Chart/DoughnutChart.cjs"),$=require("./components/DatePicker/MonthYearPicker.cjs"),X=require("./components/RadioCheckbox/CheckboxTable.cjs"),ee=require("./components/Input/InputNative.cjs"),re=require("./components/Upload/UploadMultipleFile.cjs"),te=require("./components/ErrorMessage/ErrorMessage.cjs"),ae=require("./components/Textarea/TextareaFloatingInner.cjs"),oe=require("./components/Step/Step.cjs"),ne=require("./components/Chart/LineChart.cjs"),ue=require("./components/Tooltip/Tooltip.cjs"),ie=require("./components/ButtonPopover/ButtonPopover.cjs"),se=require("./components/Chart/GradientLineChart.cjs"),ce=require("./components/Chart/GradientBarChart.cjs"),le=require("./components/Chart/PieChart.cjs"),fe=require("./components/Step/StepIndicator.cjs"),de=require("./components/TextEditor/TextEditor.cjs"),me=require("./components/Collapse/CollapseV2.cjs"),be=require("./components/Table/TableSubMobile.cjs"),ge=require("./components/TimeRange/TimeRange.cjs"),pe=require("./components/Textarea/TextareaInnerLabel.cjs"),qe=require("./components/Input/InputInnerLabel.cjs"),Te=require("./components/Text/Text.cjs"),Ce=require("./hooks/useElementOrWindowMediaQuery.cjs"),ye=require("./hooks/useCountdown.cjs"),Be=require("./hooks/useAsyncDebounce.cjs"),he=require("./hooks/useCombinedResizeObserver.cjs"),De=require("./hooks/useStateRef.cjs"),Ne=require("./hooks/useMasonry.cjs"),Oe=require("./hooks/useOtpInput.cjs"),Pe=require("./hooks/usePacked.cjs"),Se=require("./hooks/useDebounce.cjs"),Ie=require("bignumber.js"),i=require("./config/tailwind/typography.cjs"),xe=require("@tanstack/react-table"),Me=require("react-select"),Re=require("react-number-format"),ve=require("./components/Table/Table.config.cjs"),Ae=require("react-toastify"),f=require("./hooks/useDeepCompareEffect.cjs"),Fe=require("./hooks/useMergeRefs.cjs"),Le=require("./hooks/useEventListener.cjs");function Ee(r){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const a in r)if(a!=="default"){const s=Object.getOwnPropertyDescriptor(r,a);Object.defineProperty(o,a,s.get?s:{enumerable:!0,get:()=>r[a]})}}return o.default=r,Object.freeze(o)}const ke=Ee(xe);exports.deepCompareEquals=e.deepCompareEquals;exports.deepMerge=e.deepMerge;exports.deleteKeysImmutable=e.deleteKeysImmutable;exports.deleteKeysMutable=e.deleteKeysMutable;exports.encryptRSAOAEP=e.encryptRSAOAEP;exports.extractElementStringToOriginalValue=e.extractElementStringToOriginalValue;exports.formatDate=e.formatDate;exports.formatDateRange=e.formatDateRange;exports.formatNumber=e.formatNumber;exports.groupByKey=e.groupByKey;exports.isAccurateBigNumber=e.isAccurateBigNumber;exports.isAccurateNumber=e.isAccurateNumber;exports.isObject=e.isObject;exports.parseBigDecimal=e.parseBigDecimal;exports.parseDecimal=e.parseDecimal;exports.parseFileName=e.parseFileName;exports.removeKeyObjectEmptyValue=e.removeKeyObjectEmptyValue;exports.setDigit=e.setDigit;exports.transformArrayMapping=e.transformArrayMapping;exports.transformArrayMappingObjectFC=e.transformArrayMappingObjectFC;exports.transformArrayOfObjectToArray=e.transformArrayOfObjectToArray;exports.transformArrayOfObjectToString=e.transformArrayOfObjectToString;exports.transformBigNumber=e.transformBigNumber;exports.transformBigNumberOpt=e.transformBigNumberOpt;exports.transformDataHistory=e.transformDataHistory;exports.transformLatLong=e.transformLatLong;exports.transformNumber=e.transformNumber;exports.transformSecondTime=e.transformSecondTime;exports.transfromIsNan=e.transfromIsNan;exports.formatBigNumber=c.formatBigNumber;exports.removeTrailingZeros=c.removeTrailingZeros;exports.cookieStorage=d.default;exports.openAlert=m.openAlert;exports.betweenBig=t.betweenBig;exports.lessThanBig=t.lessThanBig;exports.maxBig=t.maxBig;exports.minBig=t.minBig;exports.moreThanBig=t.moreThanBig;exports.BigNumber=l.BigNumber;exports.defaultConfig=l.defaultConfig;exports.convertBigNumbersToStrings=n.convertBigNumbersToStrings;exports.convertNumbersToBigNumbers=n.convertNumbersToBigNumbers;exports.convertTextToJsonBigNumbers=n.convertTextToJsonBigNumbers;exports.ConfigColors=b.default;exports.configScreens=g.default;exports.configNativeScreens=p.default;exports.TPublish=q.default;exports.Button=T.default;exports.Popover=C.default;exports.Calendar=y.default;exports.CalendarRange=B.default;exports.DatePicker=h.default;exports.DateRangePicker=D.default;exports.FilterDate=N.default;exports.InputFloatingInner=O.default;exports.InputReguler=P.default;exports.Pagination=S.default;exports.Tabs=I.default;exports.TabPanel=x.default;exports.Table=M.default;exports.TableVirtualization=R.default;exports.ListVirtualization=v.default;exports.SelectDropdownContainer=A.default;exports.Switch=F.default;exports.ButtonIcon=L.default;exports.Badges=E.default;exports.Chips=k.default;exports.DefaultCheckedChecboxIcon=u.DefaultCheckedChecboxIcon;exports.DefaultRadioChecboxIcon=u.DefaultRadioChecboxIcon;exports.RadioCheckbox=u.default;exports.RadioCheckboxLabel=j.default;exports.Breadcrumbs=w.default;exports.Sidebar=V.default;exports.Collapse=z.default;exports.ModalDialog=K.default;exports.Timeline=U.default;exports.FilterContainer=G.default;exports.NumberFormat=_.default;exports.PortalComponent=H.default;exports.UploadFile=J.default;exports.TruncateComponent=Q.default;exports.UploadImage=W.default;exports.Textarea=Y.default;exports.DoughnutChart=Z.default;exports.MonthYearPicker=$.default;exports.CheckboxTable=X.default;exports.InputNative=ee.default;exports.UploadMultipleFile=re.default;exports.ErrorMessage=te.default;exports.TextareaFloatingInner=ae.default;exports.Step=oe.default;exports.LineChart=ne.default;exports.Tooltip=ue.default;exports.ButtonPopover=ie.default;exports.GradientLineChart=se.default;exports.GradientBarChart=ce.default;exports.PieChart=le.default;exports.StepIndicator=fe.default;exports.TextEditor=de.default;exports.CollapseV2=me.default;exports.TableSubComponent=be.default;exports.TimeRange=ge.default;exports.TextareaInnerLabel=pe.default;exports.InputInnerLabel=qe.default;exports.Text=Te.default;exports.useElementOrWindowMediaQuery=Ce.default;exports.useCountdown=ye.default;exports.useAsyncDebounce=Be.default;exports.useCombinedResizeObserver=he.default;exports.useStateRef=De.default;exports.useMasonry=Ne.default;exports.useOtpInput=Oe.useOtpInput;exports.usePacked=Pe.default;exports.useDebounce=Se.default;exports.TypeBigNumber=Ie;exports.configTypography=i.default;exports.configTypographyLabaBisnis=i.configTypographyLabaBisnis;exports.configTypographyPayhere=i.configTypographyPayhere;exports.utilTable=ke;Object.defineProperty(exports,"SelectDropdownContainerComponents",{enumerable:!0,get:()=>Me.components});Object.defineProperty(exports,"PatternFormat",{enumerable:!0,get:()=>Re.PatternFormat});exports.ConfigTable=ve.ConfigTable;Object.defineProperty(exports,"AlertContainer",{enumerable:!0,get:()=>Ae.ToastContainer});exports.useDeepCompareEffect=f.useDeepCompareEffect;exports.useDeepCompareMemoize=f.useDeepCompareMemoize;exports.useMergeRefs=Fe.useMergeRefs;exports.useEventListener=Le.useEventListener;
|
package/dist/index.mjs
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { deepCompareEquals as
|
|
1
|
+
import { deepCompareEquals as a, deepMerge as t, deleteKeysImmutable as f, deleteKeysMutable as m, encryptRSAOAEP as s, extractElementStringToOriginalValue as p, formatDate as l, formatDateRange as u, formatNumber as n, groupByKey as d, isAccurateBigNumber as i, isAccurateNumber as x, isObject as g, parseBigDecimal as c, parseDecimal as b, parseFileName as C, removeKeyObjectEmptyValue as T, setDigit as y, transformArrayMapping as B, transformArrayMappingObjectFC as h, transformArrayOfObjectToArray as D, transformArrayOfObjectToString as N, transformBigNumber as I, transformBigNumberOpt as S, transformDataHistory as P, transformLatLong as O, transformNumber as A, transformSecondTime as M, transfromIsNan as R } from "./utils/common.mjs";
|
|
2
2
|
import { formatBigNumber as F, removeTrailingZeros as L } from "./utils/formatBigNumber.mjs";
|
|
3
|
-
import { default as
|
|
3
|
+
import { default as E } from "./utils/cookies.mjs";
|
|
4
4
|
import { openAlert as j } from "./components/Alert/index.mjs";
|
|
5
5
|
import { betweenBig as z, lessThanBig as K, maxBig as U, minBig as G, moreThanBig as q } from "./utils/yup.mjs";
|
|
6
6
|
import { BigNumber as J, defaultConfig as Q } from "./config/bigNumber/index.mjs";
|
|
7
7
|
import { convertBigNumbersToStrings as Y, convertNumbersToBigNumbers as Z, convertTextToJsonBigNumbers as X } from "./utils/axiosBigNumber.mjs";
|
|
8
8
|
import { default as $ } from "./config/tailwind/colors.mjs";
|
|
9
9
|
import { default as re } from "./config/tailwind/screen.mjs";
|
|
10
|
-
import { default as
|
|
10
|
+
import { default as ae } from "./config/tailwind/nativeScreen.mjs";
|
|
11
11
|
import { default as fe } from "./components/TPublish/TPublish.mjs";
|
|
12
12
|
import { default as se } from "./components/Button/Button.mjs";
|
|
13
13
|
import { default as le } from "./components/Popover/Popover.mjs";
|
|
14
14
|
import { default as ne } from "./components/Calendar/Calendar.mjs";
|
|
15
|
-
import { default as
|
|
15
|
+
import { default as ie } from "./components/Calendar/CalendarRange.mjs";
|
|
16
16
|
import { default as ge } from "./components/DatePicker/DatePicker.mjs";
|
|
17
17
|
import { default as be } from "./components/DatePicker/DateRangePicker.mjs";
|
|
18
|
-
import { default as
|
|
18
|
+
import { default as Te } from "./components/DatePicker/FilterDate.mjs";
|
|
19
19
|
import { default as Be } from "./components/Input/InputFloatingInner.mjs";
|
|
20
20
|
import { default as De } from "./components/Input/InputReguler.mjs";
|
|
21
21
|
import { default as Ie } from "./components/Pagination/Pagination.mjs";
|
|
22
|
-
import { default as
|
|
23
|
-
import { default as
|
|
22
|
+
import { default as Pe } from "./components/Tabs/Tabs.mjs";
|
|
23
|
+
import { default as Ae } from "./components/Tabs/TabPanel.mjs";
|
|
24
24
|
import { default as Re } from "./components/Table/Table.mjs";
|
|
25
25
|
import { default as Fe } from "./components/Virtualization/TableVirtualization.mjs";
|
|
26
|
-
import { default as
|
|
26
|
+
import { default as ke } from "./components/Virtualization/ListVirtualization.mjs";
|
|
27
27
|
import { default as we } from "./components/SelectDropdownContainer/SelectDropdownContainer.mjs";
|
|
28
28
|
import { default as Ve } from "./components/Switch/Switch.mjs";
|
|
29
29
|
import { default as Ke } from "./components/ButtonIcon/ButtonIcon.mjs";
|
|
@@ -33,56 +33,59 @@ import { DefaultCheckedChecboxIcon as Qe, DefaultRadioChecboxIcon as We, default
|
|
|
33
33
|
import { default as Xe } from "./components/RadioCheckbox/RadioCheckboxLabel.mjs";
|
|
34
34
|
import { default as $e } from "./components/Breadcrumbs/Breadcrumbs.mjs";
|
|
35
35
|
import { default as rr } from "./components/Sidebar/Sidebar.mjs";
|
|
36
|
-
import { default as
|
|
36
|
+
import { default as ar } from "./components/Collapse/Collapse.mjs";
|
|
37
37
|
import { default as fr } from "./components/Modal/ModalDialog.mjs";
|
|
38
38
|
import { default as sr } from "./components/Timeline/Timeline.mjs";
|
|
39
39
|
import { default as lr } from "./components/FilterContainer/FilterContainer.mjs";
|
|
40
40
|
import { default as nr } from "./components/NumberFormat/NumberFormat.mjs";
|
|
41
|
-
import { default as
|
|
41
|
+
import { default as ir } from "./components/PortalComponent/PortalComponent.mjs";
|
|
42
42
|
import { default as gr } from "./components/Upload/UploadFile.mjs";
|
|
43
43
|
import { default as br } from "./components/TruncateComponent/TruncateComponent.mjs";
|
|
44
|
-
import { default as
|
|
44
|
+
import { default as Tr } from "./components/Upload/UploadImage.mjs";
|
|
45
45
|
import { default as Br } from "./components/Textarea/Textarea.mjs";
|
|
46
46
|
import { default as Dr } from "./components/Chart/DoughnutChart.mjs";
|
|
47
47
|
import { default as Ir } from "./components/DatePicker/MonthYearPicker.mjs";
|
|
48
|
-
import { default as
|
|
49
|
-
import { default as
|
|
48
|
+
import { default as Pr } from "./components/RadioCheckbox/CheckboxTable.mjs";
|
|
49
|
+
import { default as Ar } from "./components/Input/InputNative.mjs";
|
|
50
50
|
import { default as Rr } from "./components/Upload/UploadMultipleFile.mjs";
|
|
51
51
|
import { default as Fr } from "./components/ErrorMessage/ErrorMessage.mjs";
|
|
52
|
-
import { default as
|
|
52
|
+
import { default as kr } from "./components/Textarea/TextareaFloatingInner.mjs";
|
|
53
53
|
import { default as wr } from "./components/Step/Step.mjs";
|
|
54
54
|
import { default as Vr } from "./components/Chart/LineChart.mjs";
|
|
55
55
|
import { default as Kr } from "./components/Tooltip/Tooltip.mjs";
|
|
56
56
|
import { default as Gr } from "./components/ButtonPopover/ButtonPopover.mjs";
|
|
57
57
|
import { default as Hr } from "./components/Chart/GradientLineChart.mjs";
|
|
58
58
|
import { default as Qr } from "./components/Chart/GradientBarChart.mjs";
|
|
59
|
-
import { default as Yr } from "./components/
|
|
60
|
-
import { default as Xr } from "./components/
|
|
61
|
-
import { default as $r } from "./components/
|
|
62
|
-
import { default as ro } from "./components/
|
|
63
|
-
import { default as
|
|
64
|
-
import { default as fo } from "./components/
|
|
65
|
-
import { default as so } from "./components/
|
|
66
|
-
import { default as lo } from "./components/
|
|
67
|
-
import { default as no } from "./
|
|
68
|
-
import { default as xo } from "./hooks/
|
|
69
|
-
import { default as co } from "./hooks/
|
|
70
|
-
import { default as
|
|
71
|
-
import { default as yo } from "./hooks/
|
|
72
|
-
import { default as ho } from "./hooks/
|
|
73
|
-
import {
|
|
74
|
-
import {
|
|
75
|
-
import { default as
|
|
59
|
+
import { default as Yr } from "./components/Chart/PieChart.mjs";
|
|
60
|
+
import { default as Xr } from "./components/Step/StepIndicator.mjs";
|
|
61
|
+
import { default as $r } from "./components/TextEditor/TextEditor.mjs";
|
|
62
|
+
import { default as ro } from "./components/Collapse/CollapseV2.mjs";
|
|
63
|
+
import { default as ao } from "./components/Table/TableSubMobile.mjs";
|
|
64
|
+
import { default as fo } from "./components/TimeRange/TimeRange.mjs";
|
|
65
|
+
import { default as so } from "./components/Textarea/TextareaInnerLabel.mjs";
|
|
66
|
+
import { default as lo } from "./components/Input/InputInnerLabel.mjs";
|
|
67
|
+
import { default as no } from "./components/Text/Text.mjs";
|
|
68
|
+
import { default as xo } from "./hooks/useElementOrWindowMediaQuery.mjs";
|
|
69
|
+
import { default as co } from "./hooks/useCountdown.mjs";
|
|
70
|
+
import { default as Co } from "./hooks/useAsyncDebounce.mjs";
|
|
71
|
+
import { default as yo } from "./hooks/useCombinedResizeObserver.mjs";
|
|
72
|
+
import { default as ho } from "./hooks/useStateRef.mjs";
|
|
73
|
+
import { default as No } from "./hooks/useMasonry.mjs";
|
|
74
|
+
import { useOtpInput as So } from "./hooks/useOtpInput.mjs";
|
|
75
|
+
import { default as Oo } from "./hooks/usePacked.mjs";
|
|
76
|
+
import { default as Mo } from "./hooks/useDebounce.mjs";
|
|
77
|
+
import { default as vo } from "bignumber.js";
|
|
78
|
+
import { default as Lo, configTypographyLabaBisnis as ko, configTypographyPayhere as Eo } from "./config/tailwind/typography.mjs";
|
|
76
79
|
import * as e from "@tanstack/react-table";
|
|
77
|
-
import { components as
|
|
78
|
-
import { PatternFormat as
|
|
79
|
-
import { ConfigTable as
|
|
80
|
-
import { ToastContainer as
|
|
81
|
-
import { useDeepCompareEffect as
|
|
82
|
-
import { useMergeRefs as
|
|
83
|
-
import { useEventListener as
|
|
80
|
+
import { components as jo } from "react-select";
|
|
81
|
+
import { PatternFormat as zo } from "react-number-format";
|
|
82
|
+
import { ConfigTable as Uo } from "./components/Table/Table.config.mjs";
|
|
83
|
+
import { ToastContainer as qo } from "react-toastify";
|
|
84
|
+
import { useDeepCompareEffect as Jo, useDeepCompareMemoize as Qo } from "./hooks/useDeepCompareEffect.mjs";
|
|
85
|
+
import { useMergeRefs as Yo } from "./hooks/useMergeRefs.mjs";
|
|
86
|
+
import { useEventListener as Xo } from "./hooks/useEventListener.mjs";
|
|
84
87
|
export {
|
|
85
|
-
|
|
88
|
+
qo as AlertContainer,
|
|
86
89
|
Ge as Badges,
|
|
87
90
|
J as BigNumber,
|
|
88
91
|
$e as Breadcrumbs,
|
|
@@ -90,13 +93,13 @@ export {
|
|
|
90
93
|
Ke as ButtonIcon,
|
|
91
94
|
Gr as ButtonPopover,
|
|
92
95
|
ne as Calendar,
|
|
93
|
-
|
|
94
|
-
|
|
96
|
+
ie as CalendarRange,
|
|
97
|
+
Pr as CheckboxTable,
|
|
95
98
|
He as Chips,
|
|
96
|
-
|
|
97
|
-
|
|
99
|
+
ar as Collapse,
|
|
100
|
+
ro as CollapseV2,
|
|
98
101
|
$ as ConfigColors,
|
|
99
|
-
|
|
102
|
+
Uo as ConfigTable,
|
|
100
103
|
ge as DatePicker,
|
|
101
104
|
be as DateRangePicker,
|
|
102
105
|
Qe as DefaultCheckedChecboxIcon,
|
|
@@ -104,61 +107,62 @@ export {
|
|
|
104
107
|
Dr as DoughnutChart,
|
|
105
108
|
Fr as ErrorMessage,
|
|
106
109
|
lr as FilterContainer,
|
|
107
|
-
|
|
110
|
+
Te as FilterDate,
|
|
108
111
|
Qr as GradientBarChart,
|
|
109
112
|
Hr as GradientLineChart,
|
|
110
113
|
Be as InputFloatingInner,
|
|
111
|
-
|
|
112
|
-
|
|
114
|
+
lo as InputInnerLabel,
|
|
115
|
+
Ar as InputNative,
|
|
113
116
|
De as InputReguler,
|
|
114
117
|
Vr as LineChart,
|
|
115
|
-
|
|
118
|
+
ke as ListVirtualization,
|
|
116
119
|
fr as ModalDialog,
|
|
117
120
|
Ir as MonthYearPicker,
|
|
118
121
|
nr as NumberFormat,
|
|
119
122
|
Ie as Pagination,
|
|
120
|
-
|
|
123
|
+
zo as PatternFormat,
|
|
124
|
+
Yr as PieChart,
|
|
121
125
|
le as Popover,
|
|
122
|
-
|
|
126
|
+
ir as PortalComponent,
|
|
123
127
|
Ye as RadioCheckbox,
|
|
124
128
|
Xe as RadioCheckboxLabel,
|
|
125
129
|
we as SelectDropdownContainer,
|
|
126
|
-
|
|
130
|
+
jo as SelectDropdownContainerComponents,
|
|
127
131
|
rr as Sidebar,
|
|
128
132
|
wr as Step,
|
|
129
|
-
|
|
133
|
+
Xr as StepIndicator,
|
|
130
134
|
Ve as Switch,
|
|
131
135
|
fe as TPublish,
|
|
132
|
-
|
|
136
|
+
Ae as TabPanel,
|
|
133
137
|
Re as Table,
|
|
134
|
-
|
|
138
|
+
ao as TableSubComponent,
|
|
135
139
|
Fe as TableVirtualization,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
140
|
+
Pe as Tabs,
|
|
141
|
+
no as Text,
|
|
142
|
+
$r as TextEditor,
|
|
139
143
|
Br as Textarea,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
144
|
+
kr as TextareaFloatingInner,
|
|
145
|
+
so as TextareaInnerLabel,
|
|
146
|
+
fo as TimeRange,
|
|
143
147
|
sr as Timeline,
|
|
144
148
|
Kr as Tooltip,
|
|
145
149
|
br as TruncateComponent,
|
|
146
|
-
|
|
150
|
+
vo as TypeBigNumber,
|
|
147
151
|
gr as UploadFile,
|
|
148
|
-
|
|
152
|
+
Tr as UploadImage,
|
|
149
153
|
Rr as UploadMultipleFile,
|
|
150
154
|
z as betweenBig,
|
|
151
|
-
|
|
155
|
+
ae as configNativeScreens,
|
|
152
156
|
re as configScreens,
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
157
|
+
Lo as configTypography,
|
|
158
|
+
ko as configTypographyLabaBisnis,
|
|
159
|
+
Eo as configTypographyPayhere,
|
|
156
160
|
Y as convertBigNumbersToStrings,
|
|
157
161
|
Z as convertNumbersToBigNumbers,
|
|
158
162
|
X as convertTextToJsonBigNumbers,
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
163
|
+
E as cookieStorage,
|
|
164
|
+
a as deepCompareEquals,
|
|
165
|
+
t as deepMerge,
|
|
162
166
|
Q as defaultConfig,
|
|
163
167
|
f as deleteKeysImmutable,
|
|
164
168
|
m as deleteKeysMutable,
|
|
@@ -168,8 +172,8 @@ export {
|
|
|
168
172
|
l as formatDate,
|
|
169
173
|
u as formatDateRange,
|
|
170
174
|
n as formatNumber,
|
|
171
|
-
|
|
172
|
-
|
|
175
|
+
d as groupByKey,
|
|
176
|
+
i as isAccurateBigNumber,
|
|
173
177
|
x as isAccurateNumber,
|
|
174
178
|
g as isObject,
|
|
175
179
|
K as lessThanBig,
|
|
@@ -179,8 +183,8 @@ export {
|
|
|
179
183
|
j as openAlert,
|
|
180
184
|
c as parseBigDecimal,
|
|
181
185
|
b as parseDecimal,
|
|
182
|
-
|
|
183
|
-
|
|
186
|
+
C as parseFileName,
|
|
187
|
+
T as removeKeyObjectEmptyValue,
|
|
184
188
|
L as removeTrailingZeros,
|
|
185
189
|
y as setDigit,
|
|
186
190
|
B as transformArrayMapping,
|
|
@@ -189,21 +193,23 @@ export {
|
|
|
189
193
|
N as transformArrayOfObjectToString,
|
|
190
194
|
I as transformBigNumber,
|
|
191
195
|
S as transformBigNumberOpt,
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
+
P as transformDataHistory,
|
|
197
|
+
O as transformLatLong,
|
|
198
|
+
A as transformNumber,
|
|
199
|
+
M as transformSecondTime,
|
|
196
200
|
R as transfromIsNan,
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
201
|
+
Co as useAsyncDebounce,
|
|
202
|
+
yo as useCombinedResizeObserver,
|
|
203
|
+
co as useCountdown,
|
|
204
|
+
Mo as useDebounce,
|
|
205
|
+
Jo as useDeepCompareEffect,
|
|
206
|
+
Qo as useDeepCompareMemoize,
|
|
207
|
+
xo as useElementOrWindowMediaQuery,
|
|
208
|
+
Xo as useEventListener,
|
|
209
|
+
No as useMasonry,
|
|
210
|
+
Yo as useMergeRefs,
|
|
211
|
+
So as useOtpInput,
|
|
212
|
+
Oo as usePacked,
|
|
213
|
+
ho as useStateRef,
|
|
208
214
|
e as utilTable
|
|
209
215
|
};
|
package/dist/package.json.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="2.0.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="2.0.20",o={version:e};exports.default=o;exports.version=e;
|
package/dist/package.json.d.ts
CHANGED
package/dist/package.json.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { IPieChart } from '../../interfaces/components/Chart';
|
|
2
|
-
declare const PieChart: ({ data, height, classNameContainer, id, options, CustomTooltip, threshold,
|
|
2
|
+
declare const PieChart: ({ data, height, classNameContainer, id, options, CustomTooltip, threshold, valueFormat, hideLabelBelowPercentage, }: IPieChart) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default PieChart;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StoryObj } from '@storybook/react-vite';
|
|
2
2
|
declare const meta: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: ({ data, height, classNameContainer, id, options, CustomTooltip, threshold,
|
|
4
|
+
component: ({ data, height, classNameContainer, id, options, CustomTooltip, threshold, valueFormat, hideLabelBelowPercentage, }: import('..').IPieChart) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
parameters: {};
|
|
6
6
|
tags: string[];
|
|
7
7
|
argTypes: {
|
|
@@ -55,19 +55,6 @@ declare const meta: {
|
|
|
55
55
|
};
|
|
56
56
|
};
|
|
57
57
|
};
|
|
58
|
-
colors: {
|
|
59
|
-
control: "object";
|
|
60
|
-
description: string;
|
|
61
|
-
table: {
|
|
62
|
-
category: string;
|
|
63
|
-
type: {
|
|
64
|
-
summary: string;
|
|
65
|
-
};
|
|
66
|
-
defaultValue: {
|
|
67
|
-
summary: string;
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
58
|
options: {
|
|
72
59
|
control: "object";
|
|
73
60
|
description: string;
|
|
@@ -140,7 +127,7 @@ declare const meta: {
|
|
|
140
127
|
};
|
|
141
128
|
};
|
|
142
129
|
args: {};
|
|
143
|
-
render: (args: import('
|
|
130
|
+
render: (args: import('..').IPieChart) => import("react/jsx-runtime").JSX.Element;
|
|
144
131
|
};
|
|
145
132
|
export default meta;
|
|
146
133
|
type Story = StoryObj<typeof meta>;
|
|
@@ -58,7 +58,7 @@ import { ITableVirtualization } from '../interfaces/components/Virtualization/Ta
|
|
|
58
58
|
import { default as DoughnutChart } from './Chart/DoughnutChart';
|
|
59
59
|
import { default as MonthYearPicker } from './DatePicker/MonthYearPicker';
|
|
60
60
|
import { default as CheckboxTable } from './RadioCheckbox/CheckboxTable';
|
|
61
|
-
import { IDataInnerLabelDoughnutChart, IDataDoughnutChart, IDataLineChart, TGradientLineChartCustomTooltip, IGradientLineChart, IGradientLineChartDataSet, IGradientLineChartData, TGradientBarChartCustomTooltip, IGradientBarChart, IGradientBarChartDataSet, IGradientBarChartData, IDataGradientBarChartCustomTooltip, IDataGradientLineChartCustomTooltip } from '../interfaces/components/Chart';
|
|
61
|
+
import { IDataInnerLabelDoughnutChart, IDataDoughnutChart, IDataLineChart, TGradientLineChartCustomTooltip, IGradientLineChart, IGradientLineChartDataSet, IGradientLineChartData, TGradientBarChartCustomTooltip, IGradientBarChart, IGradientBarChartDataSet, IGradientBarChartData, IDataGradientBarChartCustomTooltip, IDataGradientLineChartCustomTooltip, IPieChart, IPieChartDataSet, IPieChartData, TPieChartCustomTooltip, IDataPieChartCustomTooltip, IPieChartThreshold } from '../interfaces/components/Chart';
|
|
62
62
|
import { default as InputNative } from './Input/InputNative';
|
|
63
63
|
import { default as UploadMultipleFile } from './Upload/UploadMultipleFile';
|
|
64
64
|
import { IUploadMultipleFileValue } from '../interfaces/components/UploadFile';
|
|
@@ -72,6 +72,7 @@ import { default as ButtonPopover } from './ButtonPopover/ButtonPopover';
|
|
|
72
72
|
import { IRefButtonPopover } from '../interfaces/components/ButtonPopover';
|
|
73
73
|
import { default as GradientLineChart } from './Chart/GradientLineChart';
|
|
74
74
|
import { default as GradientBarChart } from './Chart/GradientBarChart';
|
|
75
|
+
import { default as PieChart } from './Chart/PieChart';
|
|
75
76
|
import { default as StepIndicator } from './Step/StepIndicator';
|
|
76
77
|
import { default as TextEditor } from './TextEditor/TextEditor';
|
|
77
78
|
import { ITextEditorProps } from '../interfaces/components/TextEditor';
|
|
@@ -84,5 +85,5 @@ import { default as Text } from './Text/Text';
|
|
|
84
85
|
import * as utilTable from '@tanstack/react-table';
|
|
85
86
|
import type * as SelectDropdownContainerType from 'react-select';
|
|
86
87
|
import type * as FilterContainerType from '../interfaces/components/FilterContainer';
|
|
87
|
-
export { TPublish, Button, Popover, Calendar, CalendarRange, DatePicker, DateRangePicker, FilterDate, InputFloatingInner, InputReguler, Pagination, Tabs, TabPanel, Table, TableVirtualization, ListVirtualization, SelectDropdownContainer, utilTable, Switch, ButtonIcon, Badges, Chips, RadioCheckbox, RadioCheckboxLabel, Breadcrumbs, Sidebar, Collapse, ModalDialog, SelectDropdownContainerComponents, Timeline, FilterContainer, NumberFormat, PatternFormat, DefaultCheckedChecboxIcon, DefaultRadioChecboxIcon, ConfigTable, PortalComponent, AlertContainer, UploadFile, TruncateComponent, UploadImage, Textarea, DoughnutChart, MonthYearPicker, CheckboxTable, InputNative, UploadMultipleFile, ErrorMessage, TextareaFloatingInner, Step, LineChart, Tooltip, ButtonPopover, GradientLineChart, GradientBarChart, StepIndicator, TextEditor, CollapseV2, TableSubComponent, TimeRange, TextareaInnerLabel, InputInnerLabel, Text, };
|
|
88
|
-
export type { ITableColumnDef, IRefPopover, IRefTableVirtualization, IRefListVirtualization, IRefSelectDropdownContainer, IChildrenSelectDropdownContainer, ISidebarModule, SelectDropdownContainerType, FilterContainerType, IInputReguler, IInputFloatingInner, ITableConfig, TButtonVariants, TButtonSize, ITabsList, TTypeEventTabs, ITextarea, IListVirtualization, ITableVirtualization, IRefSidebar, IChildrenIconCompany, ICloneElementSidebar, IDataDoughnutChart, IDataInnerLabelDoughnutChart, ISelectDropdownContainer, IDatePicker, IPopover, IInputNative, IUploadMultipleFileValue, IDataStepList, IDataLineChart, IChips, IRefButtonPopover, TGradientLineChartCustomTooltip, IGradientLineChart, IGradientLineChartDataSet, IGradientLineChartData, TGradientBarChartCustomTooltip, IGradientBarChart, IGradientBarChartDataSet, IGradientBarChartData, IFilterDateButtonList, TKeyFilterDateButtonListType, IDataGradientBarChartCustomTooltip, IDataGradientLineChartCustomTooltip, ITextEditorProps, ICollapse, ITableColumnBreakpoint, TTableRenderSubComponent, TTableHandlerRowClick, TKeyLocale, ITimeRangeListTime, ITimeRange, TTimeRangeValue, IButton, TButtonIconVariants, TButtonIconSize, IButtonIcon, ISidebar, };
|
|
88
|
+
export { TPublish, Button, Popover, Calendar, CalendarRange, DatePicker, DateRangePicker, FilterDate, InputFloatingInner, InputReguler, Pagination, Tabs, TabPanel, Table, TableVirtualization, ListVirtualization, SelectDropdownContainer, utilTable, Switch, ButtonIcon, Badges, Chips, RadioCheckbox, RadioCheckboxLabel, Breadcrumbs, Sidebar, Collapse, ModalDialog, SelectDropdownContainerComponents, Timeline, FilterContainer, NumberFormat, PatternFormat, DefaultCheckedChecboxIcon, DefaultRadioChecboxIcon, ConfigTable, PortalComponent, AlertContainer, UploadFile, TruncateComponent, UploadImage, Textarea, DoughnutChart, MonthYearPicker, CheckboxTable, InputNative, UploadMultipleFile, ErrorMessage, TextareaFloatingInner, Step, LineChart, Tooltip, ButtonPopover, GradientLineChart, GradientBarChart, PieChart, StepIndicator, TextEditor, CollapseV2, TableSubComponent, TimeRange, TextareaInnerLabel, InputInnerLabel, Text, };
|
|
89
|
+
export type { ITableColumnDef, IRefPopover, IRefTableVirtualization, IRefListVirtualization, IRefSelectDropdownContainer, IChildrenSelectDropdownContainer, ISidebarModule, SelectDropdownContainerType, FilterContainerType, IInputReguler, IInputFloatingInner, ITableConfig, TButtonVariants, TButtonSize, ITabsList, TTypeEventTabs, ITextarea, IListVirtualization, ITableVirtualization, IRefSidebar, IChildrenIconCompany, ICloneElementSidebar, IDataDoughnutChart, IDataInnerLabelDoughnutChart, ISelectDropdownContainer, IDatePicker, IPopover, IInputNative, IUploadMultipleFileValue, IDataStepList, IDataLineChart, IChips, IRefButtonPopover, TGradientLineChartCustomTooltip, IGradientLineChart, IGradientLineChartDataSet, IGradientLineChartData, TGradientBarChartCustomTooltip, IGradientBarChart, IGradientBarChartDataSet, IGradientBarChartData, IFilterDateButtonList, TKeyFilterDateButtonListType, IDataGradientBarChartCustomTooltip, IDataGradientLineChartCustomTooltip, IPieChart, IPieChartDataSet, IPieChartData, TPieChartCustomTooltip, IDataPieChartCustomTooltip, IPieChartThreshold, ITextEditorProps, ICollapse, ITableColumnBreakpoint, TTableRenderSubComponent, TTableHandlerRowClick, TKeyLocale, ITimeRangeListTime, ITimeRange, TTimeRangeValue, IButton, TButtonIconVariants, TButtonIconSize, IButtonIcon, ISidebar, };
|
|
@@ -8,5 +8,7 @@ import { useDeepCompareEffect, useDeepCompareMemoize } from './useDeepCompareEff
|
|
|
8
8
|
import { useEventListener } from './useEventListener';
|
|
9
9
|
import { default as useMasonry, IMasonryLayout } from './useMasonry';
|
|
10
10
|
import { default as useOtpInput, IUseOtpInput, IUseOtpInputReturn } from './useOtpInput';
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
import { default as usePacked, IUsePackedOptions, IUsePackedReturn, TUsePacked } from './usePacked';
|
|
12
|
+
import { default as useDebounce, IUseDebounceOptions, IUseDebounceReturn, TUseDebounce } from './useDebounce';
|
|
13
|
+
export { useElementOrWindowMediaQuery, useCountdown, useAsyncDebounce, useCombinedResizeObserver, useStateRef, useDeepCompareEffect, useDeepCompareMemoize, useMergeRefs, useEventListener, useMasonry, useOtpInput, usePacked, useDebounce, };
|
|
14
|
+
export type { IUseOtpInput, IUseOtpInputReturn, IMasonryLayout, IUseCountdownReturn, IUseCountdown, IUsePackedOptions, IUsePackedReturn, TUsePacked, IUseDebounceOptions, IUseDebounceReturn, TUseDebounce, };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* [ID] : Interface untuk opsi konfigurasi hook useDebounce.
|
|
3
|
+
* [EN] : Interface for useDebounce hook configuration options.
|
|
4
|
+
*/
|
|
5
|
+
export interface IUseDebounceOptions {
|
|
6
|
+
/**
|
|
7
|
+
* [ID] : Waktu tunggu debounce dalam milidetik (default: 0).
|
|
8
|
+
* [EN] : Debounce wait time in milliseconds (default: 0).
|
|
9
|
+
*/
|
|
10
|
+
wait?: number;
|
|
11
|
+
/**
|
|
12
|
+
* [ID] : Waktu maksimum sebelum fungsi wajib dipanggil, meskipun input terus-menerus (ms).
|
|
13
|
+
* [EN] : Maximum time before function must fire, even under continuous input (ms).
|
|
14
|
+
*/
|
|
15
|
+
maxWait?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* [ID] : Interface untuk return value hook useDebounce.
|
|
19
|
+
* [EN] : Interface for useDebounce hook return value.
|
|
20
|
+
* @template TArgs - [ID] : Tipe tuple argumen fungsi. [EN] : Function argument tuple type.
|
|
21
|
+
*/
|
|
22
|
+
export interface IUseDebounceReturn<TArgs extends unknown[]> {
|
|
23
|
+
/**
|
|
24
|
+
* [ID] : Fungsi yang sudah di-debounce.
|
|
25
|
+
* [EN] : Debounced function.
|
|
26
|
+
*/
|
|
27
|
+
debouncedFn: (...args: TArgs) => void;
|
|
28
|
+
/**
|
|
29
|
+
* [ID] : Fungsi untuk membatalkan debounce yang tertunda.
|
|
30
|
+
* [EN] : Function to cancel pending debounce.
|
|
31
|
+
*/
|
|
32
|
+
cancel: () => void;
|
|
33
|
+
/**
|
|
34
|
+
* [ID] : Eksekusi langsung panggilan tertunda tanpa menunggu timeout.
|
|
35
|
+
* [EN] : Immediately execute pending call without waiting for timeout.
|
|
36
|
+
*/
|
|
37
|
+
flush: () => void;
|
|
38
|
+
/**
|
|
39
|
+
* [ID] : Cek apakah ada panggilan tertunda.
|
|
40
|
+
* [EN] : Check whether a call is pending.
|
|
41
|
+
*/
|
|
42
|
+
pending: () => boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* [ID] : Type fungsi hook useDebounce.
|
|
46
|
+
* [EN] : useDebounce hook function type.
|
|
47
|
+
* @template TArgs - [ID] : Tipe tuple argumen fungsi. [EN] : Function argument tuple type.
|
|
48
|
+
* @param fn - [ID] : Fungsi sinkron yang akan di-debounce. [EN] : Synchronous function to be debounced.
|
|
49
|
+
* @param options - [ID] : Opsi konfigurasi (opsional). [EN] : Configuration options (optional).
|
|
50
|
+
* @returns [ID] : Objek berisi fungsi debounced, cancel, flush, dan pending.
|
|
51
|
+
* [EN] : Object containing debounced function, cancel, flush, and pending.
|
|
52
|
+
*/
|
|
53
|
+
export type TUseDebounce = <TArgs extends unknown[]>(fn: (...args: TArgs) => void, options?: IUseDebounceOptions) => IUseDebounceReturn<TArgs>;
|
|
54
|
+
/**
|
|
55
|
+
* [ID] : Hook untuk melakukan debounce pada fungsi sinkron menggunakan setTimeout.
|
|
56
|
+
* Tahan terhadap spam input berkelanjutan, dengan dukungan maxWait dan flush.
|
|
57
|
+
* [EN] : Hook to debounce a synchronous function using setTimeout.
|
|
58
|
+
* Resilient against continuous input spam, with maxWait and flush support.
|
|
59
|
+
*/
|
|
60
|
+
declare const useDebounce: TUseDebounce;
|
|
61
|
+
export default useDebounce;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* [ID] : Interface untuk opsi konfigurasi hook usePacked.
|
|
4
|
+
* [EN] : Interface for usePacked hook configuration options.
|
|
5
|
+
*/
|
|
6
|
+
export interface IUsePackedOptions {
|
|
7
|
+
/**
|
|
8
|
+
* [ID] : Jumlah kolom layout.
|
|
9
|
+
* [EN] : Layout column count.
|
|
10
|
+
*/
|
|
11
|
+
columns: number;
|
|
12
|
+
/**
|
|
13
|
+
* [ID] : Jarak horizontal antar item.
|
|
14
|
+
* [EN] : Horizontal gap between items.
|
|
15
|
+
*/
|
|
16
|
+
gapX: number;
|
|
17
|
+
/**
|
|
18
|
+
* [ID] : Jarak vertikal antar item.
|
|
19
|
+
* [EN] : Vertical gap between items.
|
|
20
|
+
*/
|
|
21
|
+
gapY: number;
|
|
22
|
+
/**
|
|
23
|
+
* [ID] : Aktifkan animasi transisi (opsional).
|
|
24
|
+
* [EN] : Enable transition animation (optional).
|
|
25
|
+
*/
|
|
26
|
+
animationEnabled?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* [ID] : Map nama breakpoint ke lebar minimum (opsional).
|
|
29
|
+
* [EN] : Map of breakpoint name to minimum width (optional).
|
|
30
|
+
*/
|
|
31
|
+
breakpoints?: Record<string, number>;
|
|
32
|
+
/**
|
|
33
|
+
* [ID] : Orientasi penempatan item (opsional).
|
|
34
|
+
* [EN] : Item placement orientation (optional).
|
|
35
|
+
*/
|
|
36
|
+
orientation?: 'top-bottom' | 'bottom-top';
|
|
37
|
+
/**
|
|
38
|
+
* [ID] : Arah layout (opsional).
|
|
39
|
+
* [EN] : Layout direction (optional).
|
|
40
|
+
*/
|
|
41
|
+
direction?: 'ltr' | 'rtl';
|
|
42
|
+
/**
|
|
43
|
+
* [ID] : Waktu debounce untuk resize event dalam milidetik (opsional, default: 150).
|
|
44
|
+
* [EN] : Debounce wait for resize event in milliseconds (optional, default: 150).
|
|
45
|
+
*/
|
|
46
|
+
debounceResize?: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* [ID] : Interface untuk return value hook usePacked.
|
|
50
|
+
* [EN] : Interface for usePacked hook return value.
|
|
51
|
+
*/
|
|
52
|
+
export interface IUsePackedReturn {
|
|
53
|
+
/**
|
|
54
|
+
* [ID] : Referensi elemen kontainer DOM.
|
|
55
|
+
* [EN] : DOM container element reference.
|
|
56
|
+
*/
|
|
57
|
+
containerRef: React.RefObject<HTMLDivElement | null>;
|
|
58
|
+
/**
|
|
59
|
+
* [ID] : Tinggi kontainer yang dihitung.
|
|
60
|
+
* [EN] : Calculated container height.
|
|
61
|
+
*/
|
|
62
|
+
containerHeight: number;
|
|
63
|
+
/**
|
|
64
|
+
* [ID] : Fungsi untuk menghitung ulang layout secara manual.
|
|
65
|
+
* [EN] : Function to manually recalculate layout.
|
|
66
|
+
*/
|
|
67
|
+
recalculate: () => void;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* [ID] : Type fungsi hook usePacked.
|
|
71
|
+
* [EN] : usePacked hook function type.
|
|
72
|
+
* @param options - [ID] : Opsi konfigurasi layout. [EN] : Layout configuration options.
|
|
73
|
+
* @param dependencies - [ID] : Daftar dependensi untuk memicu hitung ulang.
|
|
74
|
+
* [EN] : Dependency list to trigger recalculation.
|
|
75
|
+
* @returns [ID] : Referensi kontainer, tinggi kontainer, dan fungsi hitung ulang.
|
|
76
|
+
* [EN] : Container ref, container height, and recalculate function.
|
|
77
|
+
*/
|
|
78
|
+
export type TUsePacked = (options: IUsePackedOptions, dependencies?: React.DependencyList) => IUsePackedReturn;
|
|
79
|
+
/**
|
|
80
|
+
* [ID] : Hook untuk mengatur layout packed/grid dengan penempatan item otomatis berdasarkan kolom terpendek.
|
|
81
|
+
* [EN] : Hook to manage packed/grid layout with automatic item placement based on shortest column.
|
|
82
|
+
*/
|
|
83
|
+
declare const usePacked: TUsePacked;
|
|
84
|
+
export default usePacked;
|
|
@@ -687,6 +687,28 @@ export interface IPieChartThreshold {
|
|
|
687
687
|
*/
|
|
688
688
|
otherBackgroundColor?: string;
|
|
689
689
|
}
|
|
690
|
+
/**
|
|
691
|
+
* [ID] : Interface untuk dataset grafik pie, menextend ChartDataset<'pie'>.
|
|
692
|
+
* [EN] : Interface for pie chart dataset, extends ChartDataset<'pie'>.
|
|
693
|
+
*/
|
|
694
|
+
export interface IPieChartDataSet extends ChartDataset<'pie'> {
|
|
695
|
+
/**
|
|
696
|
+
* [ID] : background untuk slice pie chart
|
|
697
|
+
* [EN] : background for slice pie chart
|
|
698
|
+
*/
|
|
699
|
+
backgroundColor: string[];
|
|
700
|
+
}
|
|
701
|
+
/**
|
|
702
|
+
* [ID] : Interface untuk data grafik pie menggunakan format ChartData standar.
|
|
703
|
+
* [EN] : Interface for pie chart data using standard ChartData format.
|
|
704
|
+
*/
|
|
705
|
+
export interface IPieChartData extends Omit<ChartData<'pie'>, 'datasets'> {
|
|
706
|
+
/**
|
|
707
|
+
* [ID] : Kumpulan dataset.
|
|
708
|
+
* [EN] : Collection of datasets.
|
|
709
|
+
*/
|
|
710
|
+
datasets: IPieChartDataSet[];
|
|
711
|
+
}
|
|
690
712
|
/**
|
|
691
713
|
* [ID] : Tipe komponen tooltip kustom untuk grafik pie.
|
|
692
714
|
* [EN] : Custom tooltip component type for pie chart.
|
|
@@ -716,10 +738,10 @@ export type TPieChartCustomTooltip = React.ComponentType<{
|
|
|
716
738
|
*/
|
|
717
739
|
export interface IPieChart {
|
|
718
740
|
/**
|
|
719
|
-
* [ID] : Data grafik pie.
|
|
720
|
-
* [EN] : Pie chart data.
|
|
741
|
+
* [ID] : Data grafik pie menggunakan format ChartData standar (labels + datasets).
|
|
742
|
+
* [EN] : Pie chart data using standard ChartData format (labels + datasets).
|
|
721
743
|
*/
|
|
722
|
-
data:
|
|
744
|
+
data: IPieChartData;
|
|
723
745
|
/**
|
|
724
746
|
* [ID] : ID grafik.
|
|
725
747
|
* [EN] : Chart ID.
|
|
@@ -750,11 +772,6 @@ export interface IPieChart {
|
|
|
750
772
|
* [EN] : Threshold configuration for grouping small data (optional).
|
|
751
773
|
*/
|
|
752
774
|
threshold?: IPieChartThreshold;
|
|
753
|
-
/**
|
|
754
|
-
* [ID] : Array warna kustom untuk slice pie (opsional, jika tidak disediakan akan random).
|
|
755
|
-
* [EN] : Custom color array for pie slices (optional, if not provided will be random).
|
|
756
|
-
*/
|
|
757
|
-
colors?: string[];
|
|
758
775
|
/**
|
|
759
776
|
* [ID] : Format tampilan nilai — 'percentage', 'decimal', atau 'currency' (default: 'percentage').
|
|
760
777
|
* [EN] : Value display format — 'percentage', 'decimal', or 'currency' (default: 'percentage').
|