1mpacto-react-ui 2.0.20 → 2.0.22

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.
Files changed (114) hide show
  1. package/dist/assets/_mixins.scss +72 -72
  2. package/dist/assets/icons/arrow-narrow-down.svg +3 -3
  3. package/dist/assets/style.css +1 -1
  4. package/dist/components/Alert/index.cjs +1 -1
  5. package/dist/components/Alert/index.mjs +40 -40
  6. package/dist/components/Breadcrumbs/Breadcrumbs.cjs +3 -3
  7. package/dist/components/Breadcrumbs/Breadcrumbs.mjs +43 -43
  8. package/dist/components/Button/Button.cjs +12 -12
  9. package/dist/components/Button/Button.config.cjs +1 -1
  10. package/dist/components/Button/Button.config.mjs +3 -1
  11. package/dist/components/Button/Button.mjs +24 -24
  12. package/dist/components/Button/style.module.scss.cjs +1 -1
  13. package/dist/components/Button/style.module.scss.mjs +57 -55
  14. package/dist/components/ButtonIcon/ButtonIcon.cjs +12 -12
  15. package/dist/components/ButtonIcon/ButtonIcon.mjs +20 -20
  16. package/dist/components/ButtonPopover/ButtonPopover.cjs +1 -1
  17. package/dist/components/ButtonPopover/ButtonPopover.mjs +28 -31
  18. package/dist/components/Calendar/Calendar.cjs +1 -1
  19. package/dist/components/Calendar/Calendar.mjs +98 -100
  20. package/dist/components/Calendar/CalendarMonth.cjs +1 -1
  21. package/dist/components/Calendar/CalendarMonth.mjs +41 -42
  22. package/dist/components/Calendar/CalendarRange.cjs +1 -1
  23. package/dist/components/Calendar/CalendarRange.mjs +59 -61
  24. package/dist/components/Calendar/CalendarYear.cjs +3 -3
  25. package/dist/components/Calendar/CalendarYear.mjs +39 -40
  26. package/dist/components/Chart/DoughnutChart.cjs +1 -1
  27. package/dist/components/Chart/DoughnutChart.mjs +93 -96
  28. package/dist/components/Chart/GradientBarChart.cjs +1 -1
  29. package/dist/components/Chart/GradientBarChart.mjs +80 -81
  30. package/dist/components/Chart/GradientLineChart.cjs +1 -1
  31. package/dist/components/Chart/GradientLineChart.mjs +50 -51
  32. package/dist/components/Chart/LineChart.cjs +1 -1
  33. package/dist/components/Chart/LineChart.mjs +23 -23
  34. package/dist/components/Chart/PieChart.cjs +1 -1
  35. package/dist/components/Chart/PieChart.mjs +45 -48
  36. package/dist/components/Collapse/Collapse.cjs +1 -1
  37. package/dist/components/Collapse/Collapse.mjs +23 -24
  38. package/dist/components/DatePicker/DatePicker.cjs +1 -1
  39. package/dist/components/DatePicker/DatePicker.mjs +86 -89
  40. package/dist/components/DatePicker/DateRangePicker.cjs +1 -1
  41. package/dist/components/DatePicker/DateRangePicker.mjs +91 -92
  42. package/dist/components/DatePicker/FilterDate.cjs +1 -1
  43. package/dist/components/DatePicker/FilterDate.mjs +107 -110
  44. package/dist/components/DatePicker/MonthYearPicker.cjs +1 -1
  45. package/dist/components/DatePicker/MonthYearPicker.mjs +51 -53
  46. package/dist/components/FilterContainer/FilterContainer.cjs +1 -1
  47. package/dist/components/FilterContainer/FilterContainer.mjs +27 -27
  48. package/dist/components/Input/InputFloatingInner.cjs +5 -5
  49. package/dist/components/Input/InputFloatingInner.mjs +24 -25
  50. package/dist/components/NumberFormat/NumberFormat.cjs +1 -1
  51. package/dist/components/NumberFormat/NumberFormat.mjs +12 -13
  52. package/dist/components/Pagination/Pagination.cjs +2 -2
  53. package/dist/components/Pagination/Pagination.mjs +76 -80
  54. package/dist/components/SelectDropdownContainer/SelectDropdownContainer.cjs +1 -1
  55. package/dist/components/SelectDropdownContainer/SelectDropdownContainer.mjs +98 -102
  56. package/dist/components/Sidebar/ItemSidebar.cjs +8 -8
  57. package/dist/components/Sidebar/ItemSidebar.mjs +71 -72
  58. package/dist/components/Sidebar/Sidebar.cjs +1 -1
  59. package/dist/components/Sidebar/Sidebar.mjs +65 -68
  60. package/dist/components/Slider/Slider.cjs +1 -0
  61. package/dist/components/Slider/Slider.mjs +61 -0
  62. package/dist/components/Slider/style.module.scss.cjs +1 -0
  63. package/dist/components/Slider/style.module.scss.mjs +14 -0
  64. package/dist/components/Step/Step.cjs +5 -5
  65. package/dist/components/Step/Step.mjs +52 -52
  66. package/dist/components/Table/Table.cjs +3 -3
  67. package/dist/components/Table/Table.mjs +275 -298
  68. package/dist/components/Table/TableSubMobile.cjs +1 -1
  69. package/dist/components/Table/TableSubMobile.mjs +32 -35
  70. package/dist/components/Tabs/Tabs.cjs +8 -8
  71. package/dist/components/Tabs/Tabs.mjs +66 -70
  72. package/dist/components/Textarea/Textarea.cjs +7 -7
  73. package/dist/components/Textarea/Textarea.mjs +47 -50
  74. package/dist/components/Textarea/TextareaFloatingInner.cjs +6 -6
  75. package/dist/components/Textarea/TextareaFloatingInner.mjs +56 -61
  76. package/dist/components/Textarea/TextareaInnerLabel.cjs +6 -6
  77. package/dist/components/Textarea/TextareaInnerLabel.mjs +47 -50
  78. package/dist/components/TimeRange/TimeRange.cjs +1 -1
  79. package/dist/components/TimeRange/TimeRange.mjs +88 -91
  80. package/dist/components/Tooltip/Tooltip.cjs +1 -1
  81. package/dist/components/Tooltip/Tooltip.mjs +44 -46
  82. package/dist/components/Upload/UploadFile.cjs +1 -1
  83. package/dist/components/Upload/UploadFile.mjs +50 -54
  84. package/dist/components/Upload/UploadImage.cjs +12 -12
  85. package/dist/components/Upload/UploadImage.mjs +73 -79
  86. package/dist/components/Upload/UploadMultipleFile.cjs +1 -1
  87. package/dist/components/Upload/UploadMultipleFile.mjs +61 -62
  88. package/dist/components/Virtualization/ListVirtualization.cjs +1 -1
  89. package/dist/components/Virtualization/ListVirtualization.mjs +52 -55
  90. package/dist/components/Virtualization/TableVirtualization.cjs +1 -1
  91. package/dist/components/Virtualization/TableVirtualization.mjs +56 -59
  92. package/dist/config/components/tinymce.cjs +2 -2
  93. package/dist/config/components/tinymce.mjs +3 -3
  94. package/dist/hooks/useCountdown.cjs +1 -1
  95. package/dist/hooks/useCountdown.mjs +15 -15
  96. package/dist/hooks/useDebounce.cjs +1 -1
  97. package/dist/hooks/useDebounce.mjs +19 -19
  98. package/dist/hooks/useOtpInput.cjs +1 -1
  99. package/dist/hooks/useOtpInput.mjs +47 -51
  100. package/dist/index.cjs +1 -1
  101. package/dist/index.mjs +48 -46
  102. package/dist/package.json.cjs +1 -1
  103. package/dist/package.json.d.ts +129 -128
  104. package/dist/package.json.mjs +1 -1
  105. package/dist/src/components/Button/Button.config.d.ts +2 -0
  106. package/dist/src/components/Slider/Slider.d.ts +3 -0
  107. package/dist/src/components/Slider/Slider.stories.d.ts +6 -0
  108. package/dist/src/components/index.d.ts +4 -2
  109. package/dist/src/interfaces/components/Button/index.d.ts +1 -1
  110. package/dist/src/interfaces/components/Slider/index.d.ts +51 -0
  111. package/dist/types-external/table.d.ts +15 -15
  112. package/dist/utils/common.cjs +1 -1
  113. package/dist/utils/common.mjs +172 -173
  114. package/package.json +128 -128
@@ -1,41 +1,40 @@
1
- import { jsxs as R, jsx as S } from "react/jsx-runtime";
2
- import { Chart as w, CategoryScale as D, LinearScale as F, PointElement as O, LineElement as E, Filler as L, Tooltip as Z } from "chart.js";
1
+ import { jsxs as S, jsx as y } from "react/jsx-runtime";
2
+ import { Chart as R, CategoryScale as w, LinearScale as D, PointElement as F, LineElement as O, Filler as E, Tooltip as L } from "chart.js";
3
3
  import f from "react";
4
- import { Line as G } from "react-chartjs-2";
5
- import { mergeObjects as N } from "../../utils/common.mjs";
6
- import j from "../PortalComponent/PortalComponent.mjs";
7
- w.register(D, F, O, E, L, Z);
8
- const H = (r) => ({ chart: u, tooltip: e }) => {
9
- var P, C, x, y, v, B;
4
+ import { Line as Z } from "react-chartjs-2";
5
+ import { mergeObjects as G } from "../../utils/common.mjs";
6
+ import N from "../PortalComponent/PortalComponent.mjs";
7
+ R.register(w, D, F, O, E, L);
8
+ const j = (r) => ({ chart: u, tooltip: t }) => {
10
9
  const a = {};
11
- if (e.opacity === 0) {
12
- r((k) => ({ ...k, style: { ...k.style, opacity: 0, pointerEvents: "none" } }));
10
+ if (t.opacity === 0) {
11
+ r((P) => ({ ...P, style: { ...P.style, opacity: 0, pointerEvents: "none" } }));
13
12
  return;
14
13
  }
15
- if (!e.dataPoints || e.dataPoints.length === 0)
14
+ if (!t.dataPoints || t.dataPoints.length === 0)
16
15
  return;
17
16
  a.opacity = "1", a.position = "absolute", a.pointerEvents = "none";
18
17
  const b = u.canvas.getBoundingClientRect();
19
- a.left = b.left + window.pageXOffset + e.caretX + "px", a.top = b.top + window.pageYOffset + e.caretY + "px";
20
- const c = ((C = (P = e.dataPoints) == null ? void 0 : P[0]) == null ? void 0 : C.label) ?? "", n = ((y = (x = e.dataPoints) == null ? void 0 : x[0]) == null ? void 0 : y.raw) ?? "", i = ((B = (v = e.dataPoints) == null ? void 0 : v[0]) == null ? void 0 : B.dataset.label) ?? "";
18
+ a.left = b.left + window.pageXOffset + t.caretX + "px", a.top = b.top + window.pageYOffset + t.caretY + "px";
19
+ const i = t.dataPoints?.[0]?.label ?? "", n = t.dataPoints?.[0]?.raw ?? "", c = t.dataPoints?.[0]?.dataset.label ?? "";
21
20
  r({
22
- dataset: i,
23
- label: c,
21
+ dataset: c,
22
+ label: i,
24
23
  value: n,
25
24
  style: a,
26
- dataPoints: e.dataPoints
25
+ dataPoints: t.dataPoints
27
26
  });
28
- }, W = {
27
+ }, H = {
29
28
  id: "hairlinePlugin",
30
29
  beforeDatasetsDraw: (r) => {
31
30
  const u = r.scales.y;
32
31
  if (!u) return;
33
- const { ctx: e } = r, { top: a, bottom: b, left: c, right: n } = r.chartArea;
32
+ const { ctx: t } = r, { top: a, bottom: b, left: i, right: n } = r.chartArea;
34
33
  if (u.min > 0 || u.max < 0) return;
35
- const i = u.getPixelForValue(0);
36
- i < a || i > b || (e.save(), e.beginPath(), e.moveTo(c, i), e.lineTo(n, i), e.lineWidth = 2, e.strokeStyle = "rgb(207, 216, 220)", e.setLineDash([4, 3]), e.stroke(), e.restore());
34
+ const c = u.getPixelForValue(0);
35
+ c < a || c > b || (t.save(), t.beginPath(), t.moveTo(i, c), t.lineTo(n, c), t.lineWidth = 2, t.strokeStyle = "rgb(207, 216, 220)", t.setLineDash([4, 3]), t.stroke(), t.restore());
37
36
  }
38
- }, z = {
37
+ }, W = {
39
38
  responsive: !0,
40
39
  maintainAspectRatio: !1,
41
40
  plugins: {
@@ -72,72 +71,72 @@ const H = (r) => ({ chart: u, tooltip: e }) => {
72
71
  mode: "index",
73
72
  intersect: !1
74
73
  }
75
- }, J = ({ data: r, height: u, classNameContainer: e, id: a, options: b, CustomTooltip: c }) => {
76
- const n = f.useRef(void 0), i = f.useRef(0), P = f.useRef(0), [C, x] = f.useState({
74
+ }, I = ({ data: r, height: u, classNameContainer: t, id: a, options: b, CustomTooltip: i }) => {
75
+ const n = f.useRef(void 0), c = f.useRef(0), P = f.useRef(0), [C, x] = f.useState({
77
76
  dataset: "",
78
77
  label: "",
79
78
  value: 0,
80
79
  style: { opacity: 0, position: "absolute", left: 0, bottom: 0 },
81
80
  dataPoints: []
82
- }), y = f.useCallback(function({
81
+ }), m = f.useCallback(function({
83
82
  ctx: h,
84
- chartArea: o,
83
+ chartArea: e,
85
84
  scales: s,
86
85
  chartHeight: l,
87
86
  gradientFor: g,
88
- item: t
87
+ item: o
89
88
  }) {
90
- let p = (s.y.getPixelForValue(0) - o.top) / l;
91
- p = p < 0 ? 0 : p > 1 ? 1 : p, n.current = h.createLinearGradient(0, o.top, 0, l + o.top), g === "background" ? (n.current.addColorStop(0, (t == null ? void 0 : t.colorBackgroundPositiveZero) || "#9FD2FF"), n.current.addColorStop(
89
+ let p = (s.y.getPixelForValue(0) - e.top) / l;
90
+ p = p < 0 ? 0 : p > 1 ? 1 : p, n.current = h.createLinearGradient(0, e.top, 0, l + e.top), g === "background" ? (n.current.addColorStop(0, o?.colorBackgroundPositiveZero || "#9FD2FF"), n.current.addColorStop(
92
91
  p,
93
- (t == null ? void 0 : t.colorBackgroundPositivePercentage) || "rgba(115, 235, 163, 0.1)"
92
+ o?.colorBackgroundPositivePercentage || "rgba(115, 235, 163, 0.1)"
94
93
  ), n.current.addColorStop(
95
94
  p,
96
- (t == null ? void 0 : t.colorBackgroundNegativePercentage) || "rgba(235, 107, 107, 0.1)"
97
- ), n.current.addColorStop(1, (t == null ? void 0 : t.colorBackgroundNegativeOne) || "#EB6B6B")) : (n.current.addColorStop(p, (t == null ? void 0 : t.colorBorderPositive) || "#80CBC4"), n.current.addColorStop(p, (t == null ? void 0 : t.colorBorderNegative) || "#EB6B6B"));
95
+ o?.colorBackgroundNegativePercentage || "rgba(235, 107, 107, 0.1)"
96
+ ), n.current.addColorStop(1, o?.colorBackgroundNegativeOne || "#EB6B6B")) : (n.current.addColorStop(p, o?.colorBorderPositive || "#80CBC4"), n.current.addColorStop(p, o?.colorBorderNegative || "#EB6B6B"));
98
97
  }, []), v = f.useCallback(function({
99
98
  ctx: h,
100
- chartArea: o,
99
+ chartArea: e,
101
100
  scales: s,
102
101
  gradientFor: l,
103
102
  item: g
104
103
  }) {
105
- const t = o.right - o.left, d = o.bottom - o.top;
106
- return (!n.current || i.current !== t || P.current !== d) && (i.current = t, P.current = d, y({ ctx: h, chartArea: o, scales: s, chartHeight: d, gradientFor: l, item: g })), y({ ctx: h, chartArea: o, scales: s, chartHeight: d, gradientFor: l, item: g }), n.current;
104
+ const o = e.right - e.left, d = e.bottom - e.top;
105
+ return (!n.current || c.current !== o || P.current !== d) && (c.current = o, P.current = d, m({ ctx: h, chartArea: e, scales: s, chartHeight: d, gradientFor: l, item: g })), m({ ctx: h, chartArea: e, scales: s, chartHeight: d, gradientFor: l, item: g }), n.current;
107
106
  }, []), B = f.useMemo(() => ({
108
107
  ...r,
109
- datasets: r.datasets.map((o) => ({
108
+ datasets: r.datasets.map((e) => ({
110
109
  fill: !0,
111
110
  backgroundColor: function(s) {
112
- const l = s.chart, { ctx: g, chartArea: t, scales: d } = l;
113
- if (t)
114
- return v({ ctx: g, chartArea: t, scales: d, gradientFor: "background", item: o });
111
+ const l = s.chart, { ctx: g, chartArea: o, scales: d } = l;
112
+ if (o)
113
+ return v({ ctx: g, chartArea: o, scales: d, gradientFor: "background", item: e });
115
114
  },
116
115
  borderColor: function(s) {
117
- const l = s.chart, { ctx: g, chartArea: t, scales: d } = l;
118
- if (t)
119
- return v({ ctx: g, chartArea: t, scales: d, gradientFor: "border", item: o });
116
+ const l = s.chart, { ctx: g, chartArea: o, scales: d } = l;
117
+ if (o)
118
+ return v({ ctx: g, chartArea: o, scales: d, gradientFor: "border", item: e });
120
119
  },
121
120
  borderWidth: 3,
122
121
  tension: 0,
123
122
  pointRadius: 0,
124
123
  pointHoverRadius: 4,
125
- ...o,
126
- data: o.data
124
+ ...e,
125
+ data: e.data
127
126
  }))
128
- }), [r]), k = f.useMemo(() => N(z, {
127
+ }), [r]), k = f.useMemo(() => G(W, {
129
128
  plugins: {
130
129
  tooltip: {
131
- enabled: !c,
132
- external: ({ chart: o, tooltip: s }) => c ? H(x)({ chart: o, tooltip: s }) : void 0
130
+ enabled: !i,
131
+ external: ({ chart: e, tooltip: s }) => i ? j(x)({ chart: e, tooltip: s }) : void 0
133
132
  }
134
133
  }
135
- }, b ?? {}), [b, c]);
136
- return /* @__PURE__ */ R("div", { id: a, className: e, style: { height: u || "300px" }, children: [
137
- c && /* @__PURE__ */ S(j, { selector: "body", children: /* @__PURE__ */ S(c, { ...C }) }),
138
- /* @__PURE__ */ S(G, { data: B, options: k, plugins: [W] })
134
+ }, b ?? {}), [b, i]);
135
+ return /* @__PURE__ */ S("div", { id: a, className: t, style: { height: u || "300px" }, children: [
136
+ i && /* @__PURE__ */ y(N, { selector: "body", children: /* @__PURE__ */ y(i, { ...C }) }),
137
+ /* @__PURE__ */ y(Z, { data: B, options: k, plugins: [H] })
139
138
  ] });
140
139
  };
141
140
  export {
142
- J as default
141
+ I as default
143
142
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("react/jsx-runtime"),y=require("react"),s=require("chart.js"),B=require("react-chartjs-2"),S=require("date-fns"),v=require("date-fns/locale"),E=require("../../utils/common.cjs");s.Chart.register(s.CategoryScale,s.LinearScale,s.PointElement,s.LineElement,s.Title,s.Tooltip,s.Legend);const R=(a,f,b)=>{const i=a,g=f||new Date().getMonth(),c=b||new Date().getFullYear();return new Date(`${g}/${i}/${c}`)},$=({data:a,className:f,height:b=65})=>{const i=y.useRef(null),g=a.map(t=>S.formatDate(R(1,t.label,t.year),"MMM yy",{locale:v.id}))||[],[c,x]=y.useState(""),[h,M]=y.useState(""),D=t=>{const e=[],o=[];let u=!t.find(n=>n.isCurrent);return t.forEach(n=>{u?(o.push(n.value),e.push(null)):(e.push(n.value),n.isCurrent?(u=!0,o.push(n.value)):o.push(null))}),{passed:e,notPassed:o}},k={labels:g,datasets:[{label:"",fill:"blue",backgroundColor:"rgba(75,192,192,1)",borderColor:c,borderCapStyle:"butt",borderDashOffset:0,borderJoinStyle:"miter",pointBackgroundColor:function(t){const e=a[t.dataIndex];let o=h;return e.isCurrent&&(o="#ED0019"),o},pointBorderWidth:.1,pointHoverRadius:4,pointRadius:5,pointBorderColor:h,pointHoverBorderColor:c,data:D(a).passed||[]},{label:"",fill:"grey",backgroundColor:"rgba(75,192,192,1)",borderColor:"#D6D6D6",borderCapStyle:"butt",borderDashOffset:0,pointRadius:5,borderJoinStyle:"miter",pointBackgroundColor:h,pointBorderWidth:.1,pointHoverRadius:4,borderDash:[15,5],data:D(a).notPassed||[]}]},j={interaction:{mode:"index",intersect:!1},plugins:{legend:{display:!1,labels:{usePointStyle:!0}},tooltip:{external:function(t){let e=document.getElementById("chartjs-tooltip");e||(e=document.createElement("div"),e.id="chartjs-tooltip",e.innerHTML="<table></table>",document.body.appendChild(e));const o=t.tooltip;if(o.opacity===0){e.style.opacity="0";return}e.classList.remove("above","below","no-transform"),o.yAlign?e.classList.add(o.yAlign):e.classList.add("no-transform");function u(m){return m.lines}if(o.body){const m=o.title||[];let l=o.body.map(u),d="<thead>";m.forEach(C=>{let r="";r+="display: flex",r+="; justify-content: center",r+="; font-weight: 600",r+="; font-size: 12px",r+="; padding: 0px 14px",d+=`<tr><span style="${r}">${C}</span></tr>`}),d+="</thead><tbody>",l.length>1&&l[0][0]===l[1][0]&&(l=[l[0]]),l.forEach(C=>{let r="";r+="display: flex",r+="; justify-content: center",r+="; color: #0163C8",r+="; padding: 0px 14px",r+="; font-size: 12px";const w=`<span style="${r}">${C}</span>`;d+=`<tr><td>${w}</td></tr>`}),d+="</tbody>";const L=e.querySelector("table");L&&(L.innerHTML=d)}const n=t.chart.canvas.getBoundingClientRect();e.style.opacity="1",e.style.border="solid 1px #0163C8",e.style.background="white",e.style.height="fit-content",e.style.borderRadius="10px",e.style.position="absolute",e.style.zIndex="10",e.style.padding="4px 0",e.style.left=n.left+window.pageXOffset+o.caretX-30+"px",e.style.top=n.top+window.pageYOffset+o.caretY-60+"px",e.style.pointerEvents="none"},displayColors:!0,enabled:!1,callbacks:{title:function(t){const e=a[t[0].dataIndex];return S.formatDate(new Date(`1/${e.label}/${e.year}`),"MMMM yyyy",{locale:v.id})},label:function(t){let e=t.dataset.label??"";return e&&(e+=": "),t.parsed.y!==null&&(e+=new Intl.NumberFormat("id-ID",{style:"currency",currency:"IDR"}).format(t.parsed.y)),e}}}},scales:{x:{grid:{display:!1},beginAtZero:!0,ticks:{autoSkip:!0,maxTicksLimit:20}},y:{min:0,grid:{display:!1},beginAtZero:!0,ticks:{maxTicksLimit:6,callback:function(t){return E.setDigit(t)??0}}}}};return y.useEffect(()=>{if(i.current){const t=i.current.getContext("2d"),e=t==null?void 0:t.createLinearGradient(0,100,500,-500);e==null||e.addColorStop(0,"rgba(237, 0, 25, 0)"),e==null||e.addColorStop(1,"rgba(237, 0, 25, 20)");const o=t.fillStyle="rgba(255, 255, 255, 0)";M(o),x(e)}},[]),p.jsxs("div",{className:f??"",children:[p.jsx(B.Line,{options:j,data:k,height:b}),p.jsx("div",{className:"iru-h-5",children:p.jsx("canvas",{ref:i})})]})};exports.default=$;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("react/jsx-runtime"),y=require("react"),a=require("chart.js"),B=require("react-chartjs-2"),L=require("date-fns"),S=require("date-fns/locale"),E=require("../../utils/common.cjs");a.Chart.register(a.CategoryScale,a.LinearScale,a.PointElement,a.LineElement,a.Title,a.Tooltip,a.Legend);const R=(s,f,b)=>{const i=s,g=f||new Date().getMonth(),c=b||new Date().getFullYear();return new Date(`${g}/${i}/${c}`)},$=({data:s,className:f,height:b=65})=>{const i=y.useRef(null),g=s.map(t=>L.formatDate(R(1,t.label,t.year),"MMM yy",{locale:S.id}))||[],[c,x]=y.useState(""),[h,M]=y.useState(""),D=t=>{const e=[],o=[];let u=!t.find(n=>n.isCurrent);return t.forEach(n=>{u?(o.push(n.value),e.push(null)):(e.push(n.value),n.isCurrent?(u=!0,o.push(n.value)):o.push(null))}),{passed:e,notPassed:o}},k={labels:g,datasets:[{label:"",fill:"blue",backgroundColor:"rgba(75,192,192,1)",borderColor:c,borderCapStyle:"butt",borderDashOffset:0,borderJoinStyle:"miter",pointBackgroundColor:function(t){const e=s[t.dataIndex];let o=h;return e.isCurrent&&(o="#ED0019"),o},pointBorderWidth:.1,pointHoverRadius:4,pointRadius:5,pointBorderColor:h,pointHoverBorderColor:c,data:D(s).passed||[]},{label:"",fill:"grey",backgroundColor:"rgba(75,192,192,1)",borderColor:"#D6D6D6",borderCapStyle:"butt",borderDashOffset:0,pointRadius:5,borderJoinStyle:"miter",pointBackgroundColor:h,pointBorderWidth:.1,pointHoverRadius:4,borderDash:[15,5],data:D(s).notPassed||[]}]},j={interaction:{mode:"index",intersect:!1},plugins:{legend:{display:!1,labels:{usePointStyle:!0}},tooltip:{external:function(t){let e=document.getElementById("chartjs-tooltip");e||(e=document.createElement("div"),e.id="chartjs-tooltip",e.innerHTML="<table></table>",document.body.appendChild(e));const o=t.tooltip;if(o.opacity===0){e.style.opacity="0";return}e.classList.remove("above","below","no-transform"),o.yAlign?e.classList.add(o.yAlign):e.classList.add("no-transform");function u(m){return m.lines}if(o.body){const m=o.title||[];let l=o.body.map(u),d="<thead>";m.forEach(C=>{let r="";r+="display: flex",r+="; justify-content: center",r+="; font-weight: 600",r+="; font-size: 12px",r+="; padding: 0px 14px",d+=`<tr><span style="${r}">${C}</span></tr>`}),d+="</thead><tbody>",l.length>1&&l[0][0]===l[1][0]&&(l=[l[0]]),l.forEach(C=>{let r="";r+="display: flex",r+="; justify-content: center",r+="; color: #0163C8",r+="; padding: 0px 14px",r+="; font-size: 12px";const w=`<span style="${r}">${C}</span>`;d+=`<tr><td>${w}</td></tr>`}),d+="</tbody>";const v=e.querySelector("table");v&&(v.innerHTML=d)}const n=t.chart.canvas.getBoundingClientRect();e.style.opacity="1",e.style.border="solid 1px #0163C8",e.style.background="white",e.style.height="fit-content",e.style.borderRadius="10px",e.style.position="absolute",e.style.zIndex="10",e.style.padding="4px 0",e.style.left=n.left+window.pageXOffset+o.caretX-30+"px",e.style.top=n.top+window.pageYOffset+o.caretY-60+"px",e.style.pointerEvents="none"},displayColors:!0,enabled:!1,callbacks:{title:function(t){const e=s[t[0].dataIndex];return L.formatDate(new Date(`1/${e.label}/${e.year}`),"MMMM yyyy",{locale:S.id})},label:function(t){let e=t.dataset.label??"";return e&&(e+=": "),t.parsed.y!==null&&(e+=new Intl.NumberFormat("id-ID",{style:"currency",currency:"IDR"}).format(t.parsed.y)),e}}}},scales:{x:{grid:{display:!1},beginAtZero:!0,ticks:{autoSkip:!0,maxTicksLimit:20}},y:{min:0,grid:{display:!1},beginAtZero:!0,ticks:{maxTicksLimit:6,callback:function(t){return E.setDigit(t)??0}}}}};return y.useEffect(()=>{if(i.current){const t=i.current.getContext("2d"),e=t?.createLinearGradient(0,100,500,-500);e?.addColorStop(0,"rgba(237, 0, 25, 0)"),e?.addColorStop(1,"rgba(237, 0, 25, 20)");const o=t.fillStyle="rgba(255, 255, 255, 0)";M(o),x(e)}},[]),p.jsxs("div",{className:f??"",children:[p.jsx(B.Line,{options:j,data:k,height:b}),p.jsx("div",{className:"iru-h-5",children:p.jsx("canvas",{ref:i})})]})};exports.default=$;
@@ -3,20 +3,20 @@ import p from "react";
3
3
  import { Chart as E, CategoryScale as R, LinearScale as $, PointElement as I, LineElement as T, Title as j, Tooltip as H, Legend as O } from "chart.js";
4
4
  import { Line as A } from "react-chartjs-2";
5
5
  import { formatDate as L } from "date-fns";
6
- import { id as S } from "date-fns/locale";
6
+ import { id as v } from "date-fns/locale";
7
7
  import { setDigit as P } from "../../utils/common.mjs";
8
8
  E.register(R, $, I, T, j, H, O);
9
- const Y = (l, u, f) => {
10
- const s = l, y = u || (/* @__PURE__ */ new Date()).getMonth(), d = f || (/* @__PURE__ */ new Date()).getFullYear();
9
+ const Y = (a, u, f) => {
10
+ const s = a, y = u || (/* @__PURE__ */ new Date()).getMonth(), d = f || (/* @__PURE__ */ new Date()).getFullYear();
11
11
  return /* @__PURE__ */ new Date(`${y}/${s}/${d}`);
12
- }, q = ({ data: l, className: u, height: f = 65 }) => {
13
- const s = p.useRef(null), y = l.map((e) => L(Y(1, e.label, e.year), "MMM yy", { locale: S })) || [], [d, C] = p.useState(""), [b, k] = p.useState(""), x = (e) => {
12
+ }, q = ({ data: a, className: u, height: f = 65 }) => {
13
+ const s = p.useRef(null), y = a.map((e) => L(Y(1, e.label, e.year), "MMM yy", { locale: v })) || [], [d, C] = p.useState(""), [b, S] = p.useState(""), x = (e) => {
14
14
  const t = [], o = [];
15
15
  let c = !e.find((n) => n.isCurrent);
16
16
  return e.forEach((n) => {
17
17
  c ? (o.push(n.value), t.push(null)) : (t.push(n.value), n.isCurrent ? (c = !0, o.push(n.value)) : o.push(null));
18
18
  }), { passed: t, notPassed: o };
19
- }, v = {
19
+ }, k = {
20
20
  labels: y,
21
21
  datasets: [
22
22
  {
@@ -28,7 +28,7 @@ const Y = (l, u, f) => {
28
28
  borderDashOffset: 0,
29
29
  borderJoinStyle: "miter",
30
30
  pointBackgroundColor: function(e) {
31
- const t = l[e.dataIndex];
31
+ const t = a[e.dataIndex];
32
32
  let o = b;
33
33
  return t.isCurrent && (o = "#ED0019"), o;
34
34
  },
@@ -37,7 +37,7 @@ const Y = (l, u, f) => {
37
37
  pointRadius: 5,
38
38
  pointBorderColor: b,
39
39
  pointHoverBorderColor: d,
40
- data: x(l).passed || []
40
+ data: x(a).passed || []
41
41
  },
42
42
  {
43
43
  label: "",
@@ -53,7 +53,7 @@ const Y = (l, u, f) => {
53
53
  pointBorderWidth: 0.1,
54
54
  pointHoverRadius: 4,
55
55
  borderDash: [15, 5],
56
- data: x(l).notPassed || []
56
+ data: x(a).notPassed || []
57
57
  }
58
58
  ]
59
59
  }, w = {
@@ -78,19 +78,19 @@ const Y = (l, u, f) => {
78
78
  return;
79
79
  }
80
80
  t.classList.remove("above", "below", "no-transform"), o.yAlign ? t.classList.add(o.yAlign) : t.classList.add("no-transform");
81
- function c(m) {
82
- return m.lines;
81
+ function c(g) {
82
+ return g.lines;
83
83
  }
84
84
  if (o.body) {
85
- const m = o.title || [];
86
- let a = o.body.map(c), i = "<thead>";
87
- m.forEach((g) => {
85
+ const g = o.title || [];
86
+ let l = o.body.map(c), i = "<thead>";
87
+ g.forEach((m) => {
88
88
  let r = "";
89
- r += "display: flex", r += "; justify-content: center", r += "; font-weight: 600", r += "; font-size: 12px", r += "; padding: 0px 14px", i += `<tr><span style="${r}">${g}</span></tr>`;
90
- }), i += "</thead><tbody>", a.length > 1 && a[0][0] === a[1][0] && (a = [a[0]]), a.forEach((g) => {
89
+ r += "display: flex", r += "; justify-content: center", r += "; font-weight: 600", r += "; font-size: 12px", r += "; padding: 0px 14px", i += `<tr><span style="${r}">${m}</span></tr>`;
90
+ }), i += "</thead><tbody>", l.length > 1 && l[0][0] === l[1][0] && (l = [l[0]]), l.forEach((m) => {
91
91
  let r = "";
92
92
  r += "display: flex", r += "; justify-content: center", r += "; color: #0163C8", r += "; padding: 0px 14px", r += "; font-size: 12px";
93
- const M = `<span style="${r}">${g}</span>`;
93
+ const M = `<span style="${r}">${m}</span>`;
94
94
  i += `<tr><td>${M}</td></tr>`;
95
95
  }), i += "</tbody>";
96
96
  const D = t.querySelector("table");
@@ -103,8 +103,8 @@ const Y = (l, u, f) => {
103
103
  enabled: !1,
104
104
  callbacks: {
105
105
  title: function(e) {
106
- const t = l[e[0].dataIndex];
107
- return L(/* @__PURE__ */ new Date(`1/${t.label}/${t.year}`), "MMMM yyyy", { locale: S });
106
+ const t = a[e[0].dataIndex];
107
+ return L(/* @__PURE__ */ new Date(`1/${t.label}/${t.year}`), "MMMM yyyy", { locale: v });
108
108
  },
109
109
  label: function(e) {
110
110
  let t = e.dataset.label ?? "";
@@ -143,13 +143,13 @@ const Y = (l, u, f) => {
143
143
  };
144
144
  return p.useEffect(() => {
145
145
  if (s.current) {
146
- const e = s.current.getContext("2d"), t = e == null ? void 0 : e.createLinearGradient(0, 100, 500, -500);
147
- t == null || t.addColorStop(0, "rgba(237, 0, 25, 0)"), t == null || t.addColorStop(1, "rgba(237, 0, 25, 20)");
146
+ const e = s.current.getContext("2d"), t = e?.createLinearGradient(0, 100, 500, -500);
147
+ t?.addColorStop(0, "rgba(237, 0, 25, 0)"), t?.addColorStop(1, "rgba(237, 0, 25, 20)");
148
148
  const o = e.fillStyle = "rgba(255, 255, 255, 0)";
149
- k(o), C(t);
149
+ S(o), C(t);
150
150
  }
151
151
  }, []), /* @__PURE__ */ B("div", { className: u ?? "", children: [
152
- /* @__PURE__ */ h(A, { options: w, data: v, height: f }),
152
+ /* @__PURE__ */ h(A, { options: w, data: k, height: f }),
153
153
  /* @__PURE__ */ h("div", { className: "iru-h-5", children: /* @__PURE__ */ h("canvas", { ref: s }) })
154
154
  ] });
155
155
  };
@@ -1 +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;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("react/jsx-runtime"),v=require("chart.js"),g=require("react"),S=require("react-chartjs-2"),x=require("../../utils/common.cjs"),k=require("../PortalComponent/PortalComponent.cjs");v.Chart.register(v.ArcElement,v.Tooltip);const M=(t,l,n)=>{const r=l>0?t/l*100:0;switch(n){case"decimal":return x.formatNumber(t,"decimal");case"currency":return x.formatNumber(t,"currency");default:return`${Math.round(r)}%`}},m=()=>{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)},I=(t,l)=>Array.isArray(t)?t[l]||m():typeof t=="string"?t:m(),q=t=>{const l=t.labels??[],n=t.datasets[0];return n?(n.data??[]).map((o,a)=>({label:l[a]??"",value:o,backgroundColor:I(n.backgroundColor,a)})):[]},E=(t,l)=>{if(!l)return{labels:t.map(e=>e.label),values:t.map(e=>e.value),colors:t.map(e=>e.backgroundColor||m()),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||m()})});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}},T=(t,l,n)=>({chart:r,tooltip:o})=>{const a={};if(o.opacity===0){t(f=>({...f,style:{...f.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=o.dataPoints?.[0]?.label??"",u=o.dataPoints?.[0]?.raw??0,i=o.dataPoints?.[0]?.dataset.backgroundColor?.[s]??"",e=o.dataPoints?.[0]?.dataset.data?.reduce((f,b)=>f+b,0)||1,p=e>0?u/e*100:0;t({label:d,value:u,percentage:p,formattedValue:M(u,e,l),backgroundColor:typeof i=="string"?i:"#000",mergedItems:n[s]??[],style:a,dataPoints:o.dataPoints})},A=(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)=>{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),f=n.data.labels?.[s];r.save(),r.textAlign="center",r.textBaseline="middle",r.fillStyle="#FFFFFF",r.font="bold 10px Inter, sans-serif",r.fillText(f,e||0,(p||0)-6),r.fillText(M(u,a,t),e||0,(p||0)+8),r.restore()})}}),B={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{enabled:!0}},elements:{arc:{hoverOffset:8,borderWidth:0}}},R=({data:t,height:l,classNameContainer:n,id:r,options:o,CustomTooltip:a,threshold:c,valueFormat:s,hideLabelBelowPercentage:d=5})=>{const[u,i]=g.useState({style:{opacity:0,position:"absolute",left:0,top:0},label:"",value:0,percentage:0,formattedValue:"",backgroundColor:"",mergedItems:[],dataPoints:[]}),e=g.useMemo(()=>q(t),[t]),{labels:p,values:f,colors:b,mergedMap:y}=g.useMemo(()=>E(e,c),[e,c]),P=g.useMemo(()=>({labels:p,datasets:[{...t.datasets[0],data:f,backgroundColor:b,hoverOffset:8,borderWidth:0}]}),[p,f,b,t.datasets]),C=g.useMemo(()=>{const O={plugins:{tooltip:{enabled:!a,external:a?({chart:j,tooltip:w})=>T(i,s,y)({chart:j,tooltip:w}):void 0}}};return x.mergeObjects(B,O,o??{})},[o,a,s,y]);return h.jsxs("div",{id:r,className:n,style:{height:l||"300px"},children:[a&&h.jsx(k.default,{selector:"body",children:h.jsx(a,{...u})}),h.jsx(S.Pie,{data:P,options:C,plugins:[A(s,d)]})]})};exports.default=R;
@@ -1,22 +1,21 @@
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) => {
1
+ import { jsxs as w, jsx as b } from "react/jsx-runtime";
2
+ import { Chart as k, ArcElement as I, Tooltip as E } from "chart.js";
3
+ import m from "react";
4
+ import { Pie as S } from "react-chartjs-2";
5
+ import { mergeObjects as A, formatNumber as y } from "../../utils/common.mjs";
6
+ import B from "../PortalComponent/PortalComponent.mjs";
7
+ k.register(I, E);
8
+ const x = (t, l, n) => {
9
9
  const r = l > 0 ? t / l * 100 : 0;
10
10
  switch (n) {
11
11
  case "decimal":
12
- return I(t, "decimal");
12
+ return y(t, "decimal");
13
13
  case "currency":
14
- return I(t, "currency");
15
- case "percentage":
14
+ return y(t, "currency");
16
15
  default:
17
16
  return `${Math.round(r)}%`;
18
17
  }
19
- }, P = () => {
18
+ }, h = () => {
20
19
  const t = Math.floor(Math.random() * 360), l = 60 + Math.floor(Math.random() * 30), n = 45 + Math.floor(Math.random() * 20);
21
20
  return ((o, a, c) => {
22
21
  a /= 100, c /= 100;
@@ -26,19 +25,19 @@ const E = (t, l, n) => {
26
25
  };
27
26
  return `#${u(0)}${u(8)}${u(4)}`;
28
27
  })(t, l, n);
29
- }, j = (t, l) => Array.isArray(t) ? t[l] || P() : typeof t == "string" ? t : P(), D = (t) => {
28
+ }, T = (t, l) => Array.isArray(t) ? t[l] || h() : typeof t == "string" ? t : h(), F = (t) => {
30
29
  const l = t.labels ?? [], n = t.datasets[0];
31
30
  return n ? (n.data ?? []).map((o, a) => ({
32
31
  label: l[a] ?? "",
33
32
  value: o,
34
- backgroundColor: j(n.backgroundColor, a)
33
+ backgroundColor: T(n.backgroundColor, a)
35
34
  })) : [];
36
- }, L = (t, l) => {
35
+ }, R = (t, l) => {
37
36
  if (!l)
38
37
  return {
39
38
  labels: t.map((e) => e.label),
40
39
  values: t.map((e) => e.value),
41
- colors: t.map((e) => e.backgroundColor || P()),
40
+ colors: t.map((e) => e.backgroundColor || h()),
42
41
  mergedMap: {}
43
42
  };
44
43
  const { mode: n, value: r, otherLabel: o = "Other", otherBackgroundColor: a = "#B0BEC5" } = l, c = t.reduce((e, p) => e + p.value, 0), s = [], u = [];
@@ -47,7 +46,7 @@ const E = (t, l, n) => {
47
46
  (n === "percentage" ? e.value / c * 100 < r : e.value < r) ? (d += e.value, u.push(e)) : s.push({
48
47
  label: e.label,
49
48
  value: e.value,
50
- color: e.backgroundColor || P()
49
+ color: e.backgroundColor || h()
51
50
  });
52
51
  });
53
52
  const i = {};
@@ -57,41 +56,39 @@ const E = (t, l, n) => {
57
56
  colors: s.map((e) => e.color),
58
57
  mergedMap: i
59
58
  };
60
- }, G = (t, l, n) => ({ chart: r, tooltip: o }) => {
61
- var m, f, g, b, v, C, y, x, w, k;
59
+ }, V = (t, l, n) => ({ chart: r, tooltip: o }) => {
62
60
  const a = {};
63
61
  if (o.opacity === 0) {
64
- t((M) => ({ ...M, style: { ...M.style, opacity: 0, pointerEvents: "none" } }));
62
+ t((f) => ({ ...f, style: { ...f.style, opacity: 0, pointerEvents: "none" } }));
65
63
  return;
66
64
  }
67
65
  if (!o.dataPoints || o.dataPoints.length === 0) return;
68
66
  a.opacity = "1", a.position = "absolute", a.pointerEvents = "none";
69
67
  const c = r.canvas.getBoundingClientRect();
70
68
  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;
69
+ const s = o.dataPoints[0].dataIndex, u = o.dataPoints?.[0]?.label ?? "", d = o.dataPoints?.[0]?.raw ?? 0, i = o.dataPoints?.[0]?.dataset.backgroundColor?.[s] ?? "", e = o.dataPoints?.[0]?.dataset.data?.reduce((f, g) => f + g, 0) || 1, p = e > 0 ? d / e * 100 : 0;
72
70
  t({
73
71
  label: u,
74
72
  value: d,
75
73
  percentage: p,
76
- formattedValue: E(d, e, l),
74
+ formattedValue: x(d, e, l),
77
75
  backgroundColor: typeof i == "string" ? i : "#000",
78
76
  mergedItems: n[s] ?? [],
79
77
  style: a,
80
78
  dataPoints: o.dataPoints
81
79
  });
82
- }, H = (t, l) => ({
80
+ }, $ = (t, l) => ({
83
81
  id: "pieLabelPlugin",
84
82
  afterDraw(n) {
85
83
  const { ctx: r } = n, o = n.getDatasetMeta(0), a = n.data.datasets[0].data.reduce((c, s) => c + s, 0);
86
84
  o.data.forEach((c, s) => {
87
- var f;
88
85
  const d = n.data.datasets[0].data[s] ?? 0;
89
86
  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();
87
+ const { x: e, y: p } = c.tooltipPosition(!1), f = n.data.labels?.[s];
88
+ r.save(), r.textAlign = "center", r.textBaseline = "middle", r.fillStyle = "#FFFFFF", r.font = "bold 10px Inter, sans-serif", r.fillText(f, e || 0, (p || 0) - 6), r.fillText(x(d, a, t), e || 0, (p || 0) + 8), r.restore();
92
89
  });
93
90
  }
94
- }), N = {
91
+ }), j = {
95
92
  responsive: !0,
96
93
  maintainAspectRatio: !1,
97
94
  plugins: {
@@ -108,7 +105,7 @@ const E = (t, l, n) => {
108
105
  borderWidth: 0
109
106
  }
110
107
  }
111
- }, K = ({
108
+ }, Y = ({
112
109
  data: t,
113
110
  height: l,
114
111
  classNameContainer: n,
@@ -119,7 +116,7 @@ const E = (t, l, n) => {
119
116
  valueFormat: s,
120
117
  hideLabelBelowPercentage: u = 5
121
118
  }) => {
122
- const [d, i] = h.useState({
119
+ const [d, i] = m.useState({
123
120
  style: { opacity: 0, position: "absolute", left: 0, top: 0 },
124
121
  label: "",
125
122
  value: 0,
@@ -128,45 +125,45 @@ const E = (t, l, n) => {
128
125
  backgroundColor: "",
129
126
  mergedItems: [],
130
127
  dataPoints: []
131
- }), e = h.useMemo(() => D(t), [t]), {
128
+ }), e = m.useMemo(() => F(t), [t]), {
132
129
  labels: p,
133
- values: m,
134
- colors: f,
135
- mergedMap: g
136
- } = h.useMemo(() => L(e, c), [e, c]), b = h.useMemo(
130
+ values: f,
131
+ colors: g,
132
+ mergedMap: v
133
+ } = m.useMemo(() => R(e, c), [e, c]), M = m.useMemo(
137
134
  () => ({
138
135
  labels: p,
139
136
  datasets: [
140
137
  {
141
138
  ...t.datasets[0],
142
- data: m,
143
- backgroundColor: f,
139
+ data: f,
140
+ backgroundColor: g,
144
141
  hoverOffset: 8,
145
142
  borderWidth: 0
146
143
  }
147
144
  ]
148
145
  }),
149
- [p, m, f, t.datasets]
150
- ), v = h.useMemo(() => V(N, {
146
+ [p, f, g, t.datasets]
147
+ ), P = m.useMemo(() => A(j, {
151
148
  plugins: {
152
149
  tooltip: {
153
150
  enabled: !a,
154
- external: a ? ({ chart: y, tooltip: x }) => G(i, s, g)({ chart: y, tooltip: x }) : void 0
151
+ external: a ? ({ chart: C, tooltip: O }) => V(i, s, v)({ chart: C, tooltip: O }) : void 0
155
152
  }
156
153
  }
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,
154
+ }, o ?? {}), [o, a, s, v]);
155
+ return /* @__PURE__ */ w("div", { id: r, className: n, style: { height: l || "300px" }, children: [
156
+ a && /* @__PURE__ */ b(B, { selector: "body", children: /* @__PURE__ */ b(a, { ...d }) }),
157
+ /* @__PURE__ */ b(
158
+ S,
162
159
  {
163
- data: b,
164
- options: v,
165
- plugins: [H(s, u)]
160
+ data: M,
161
+ options: P,
162
+ plugins: [$(s, u)]
166
163
  }
167
164
  )
168
165
  ] });
169
166
  };
170
167
  export {
171
- K as default
168
+ Y as default
172
169
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),o=require("react"),g=require("./style.module.scss.cjs"),w=({children:l,id:s,open:r,className:a,classNameContainer:c,maxCollapsedHeight:u="0px",triggerCalCulateContainer:d,delayTriggerCalculateHeight:h=0})=>{const[m,v]=o.useState("1000vh"),e=()=>{var i;const t=((i=document==null?void 0:document.getElementById(s))==null?void 0:i.offsetHeight)??0;v(t||"1000vh")};return o.useEffect(()=>{const t=setTimeout(e,h);return window==null||window.addEventListener("resize",e),window==null||window.addEventListener("load",e),()=>{clearTimeout(t),window==null||window.removeEventListener("resize",e),window==null||window.removeEventListener("load",e)}},[d]),n.jsx("div",{className:`${g.default.collapse} ${c??""}`,style:{maxHeight:r?m:u},children:n.jsx("div",{id:s,className:a??"",children:l})})};exports.default=w;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react/jsx-runtime"),n=require("react"),v=require("./style.module.scss.cjs"),g=({children:o,id:s,open:l,className:r,classNameContainer:a,maxCollapsedHeight:c="0px",triggerCalCulateContainer:u,delayTriggerCalculateHeight:d=0})=>{const[h,m]=n.useState("1000vh"),e=()=>{const t=document?.getElementById(s)?.offsetHeight??0;m(t||"1000vh")};return n.useEffect(()=>{const t=setTimeout(e,d);return window?.addEventListener("resize",e),window?.addEventListener("load",e),()=>{clearTimeout(t),window?.removeEventListener("resize",e),window?.removeEventListener("load",e)}},[u]),i.jsx("div",{className:`${v.default.collapse} ${a??""}`,style:{maxHeight:l?h:c},children:i.jsx("div",{id:s,className:r??"",children:o})})};exports.default=g;
@@ -1,35 +1,34 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import n from "react";
3
- import w from "./style.module.scss.mjs";
4
- const E = ({
5
- children: r,
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import i from "react";
3
+ import v from "./style.module.scss.mjs";
4
+ const p = ({
5
+ children: n,
6
6
  id: o,
7
- open: a,
8
- className: l,
9
- classNameContainer: c,
10
- maxCollapsedHeight: d = "0px",
11
- triggerCalCulateContainer: m,
12
- delayTriggerCalculateHeight: h = 0
7
+ open: r,
8
+ className: a,
9
+ classNameContainer: l,
10
+ maxCollapsedHeight: c = "0px",
11
+ triggerCalCulateContainer: d,
12
+ delayTriggerCalculateHeight: m = 0
13
13
  }) => {
14
- const [u, v] = n.useState("1000vh"), e = () => {
15
- var s;
16
- const t = ((s = document == null ? void 0 : document.getElementById(o)) == null ? void 0 : s.offsetHeight) ?? 0;
17
- v(t || "1000vh");
14
+ const [h, u] = i.useState("1000vh"), e = () => {
15
+ const t = document?.getElementById(o)?.offsetHeight ?? 0;
16
+ u(t || "1000vh");
18
17
  };
19
- return n.useEffect(() => {
20
- const t = setTimeout(e, h);
21
- return window == null || window.addEventListener("resize", e), window == null || window.addEventListener("load", e), () => {
22
- clearTimeout(t), window == null || window.removeEventListener("resize", e), window == null || window.removeEventListener("load", e);
18
+ return i.useEffect(() => {
19
+ const t = setTimeout(e, m);
20
+ return window?.addEventListener("resize", e), window?.addEventListener("load", e), () => {
21
+ clearTimeout(t), window?.removeEventListener("resize", e), window?.removeEventListener("load", e);
23
22
  };
24
- }, [m]), /* @__PURE__ */ i(
23
+ }, [d]), /* @__PURE__ */ s(
25
24
  "div",
26
25
  {
27
- className: `${w.collapse} ${c ?? ""}`,
28
- style: { maxHeight: a ? u : d },
29
- children: /* @__PURE__ */ i("div", { id: o, className: l ?? "", children: r })
26
+ className: `${v.collapse} ${l ?? ""}`,
27
+ style: { maxHeight: r ? h : c },
28
+ children: /* @__PURE__ */ s("div", { id: o, className: a ?? "", children: n })
30
29
  }
31
30
  );
32
31
  };
33
32
  export {
34
- E as default
33
+ p as default
35
34
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("react/jsx-runtime"),m=require("react"),w=require("@internationalized/date"),Z=require("../Calendar/Calendar.cjs"),p=require("react-aria"),J=require("../Popover/Popover.cjs"),S=l=>{let r;const i=new Date(l??new Date);return l&&(r=w.parseDate(new Date(i.setHours(i.getHours()+7)).toISOString().slice(0,10))),r},K=l=>{const{minDate:r,maxDate:i,value:c,defaultValue:b,withConfirm:H=!1,isCustomTime:D=!1,className:j,classNameButton:I,buttonClick:C,buttonReset:M,buttonSubmit:y,prevIcon:q,nextIcon:R,onChange:d,id:k="date-picker",idPopover:N="date-picker-popover",floatingOptions:O={},offsetPopover:V=5,zIndexPopper:L=1,hiddenHeader:z}=l,g=p.useDateFormatter(),{locale:F}=p.useLocale(),_=S(r),$=S(i),f=m.useRef(null),[h,v]=m.useState(),[a,x]=m.useState(),A=s=>{var T;const o=new Date;let e=s.toDate(w.getLocalTimeZone());e.setHours(o.getHours(),o.getMinutes(),o.getSeconds());const t=r?new Date(r):null,n=i?new Date(i):null;if(D){if(e=new Date(new Date(e).setHours((a==null?void 0:a.hour)??0,a==null?void 0:a.minut,a==null?void 0:a.second)),t&&(t==null?void 0:t.toDateString())===new Date(e).toDateString()&&(t==null?void 0:t.toTimeString())>=(e==null?void 0:e.toTimeString())){if(t&&(t.getHours()>e.getHours()||t.getHours()===e.getHours()&&t.getMinutes()>e.getMinutes()))return;e=new Date(t.setSeconds(t.getSeconds()+1))}if(n&&(n==null?void 0:n.toDateString())===new Date(e).toDateString()&&(n==null?void 0:n.toTimeString())<(e==null?void 0:e.toTimeString())){if(n&&(n.getHours()<e.getHours()||n.getHours()===e.getHours()&&n.getMinutes()<e.getMinutes()))return;e=new Date(n.setSeconds(n.getSeconds()-1))}}else t&&g.format(e)===g.format(t)&&t.getTime()>=e.getTime()?e=new Date(t.setSeconds(t.getSeconds()+1)):n&&g.format(e)===g.format(n)&&n.getTime()<=e.getTime()&&(e=new Date(n.setSeconds(n.getSeconds()-1)));typeof d=="function"&&(d(e),(T=f.current)==null||T.setShow(!1))},P=(s,o)=>{v(s),(o??(!H&&!D))&&A(s)},B=s=>{const{start:o}=s;x(o)},E=s=>{const o=new Date(c??new Date);x({hour:o.getHours(),minut:o.getMinutes(),second:o.getSeconds()}),v(S(c))},G=()=>{h&&P(h,!0)};return u.jsxs(u.Fragment,{children:[u.jsx("div",{id:k,onClick:s=>{var o;(o=f.current)==null||o.handlerShow(s),E()},className:I,children:typeof C=="function"?C(c):c?new Date(c).toDateString():"Pilih Tanggal"}),u.jsx(J.default,{zIndex:L,ref:f,offset:V,id:N,floatingOptions:{placement:"bottom-end",...O},children:u.jsx("div",{className:j??"",children:u.jsx(p.I18nProvider,{locale:"id-ID",children:u.jsx(Z.default,{minValue:_,maxValue:$,minDate:r,maxDate:i,time:{start:a},locale:F,value:h,typeTime:"SINGLE",buttonReset:M,buttonSubmit:y,prevIcon:q,nextIcon:R,createCalendar:w.createCalendar,defaultValue:S(c),onChange:P,handlerReset:()=>{var s;typeof d=="function"&&(d(b),(s=f.current)==null||s.setShow(!1))},handlerSubmit:G,handlerChangeTime:B,withConfirm:H,isCustomTime:D,type:["date","month","year"],hiddenHeader:z})})})})]})};exports.default=K;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react/jsx-runtime"),h=require("react"),p=require("@internationalized/date"),G=require("../Calendar/Calendar.cjs"),w=require("react-aria"),Z=require("../Popover/Popover.cjs"),f=c=>{let s;const r=new Date(c??new Date);return c&&(s=p.parseDate(new Date(r.setHours(r.getHours()+7)).toISOString().slice(0,10))),s},J=c=>{const{minDate:s,maxDate:r,value:u,defaultValue:P,withConfirm:T=!1,isCustomTime:D=!1,className:b,classNameButton:j,buttonClick:H,buttonReset:I,buttonSubmit:M,prevIcon:y,nextIcon:q,onChange:l,id:R="date-picker",idPopover:k="date-picker-popover",floatingOptions:N={},offsetPopover:O=5,zIndexPopper:V=1,hiddenHeader:L}=c,d=w.useDateFormatter(),{locale:z}=w.useLocale(),F=f(s),_=f(r),g=h.useRef(null),[S,x]=h.useState(),[m,C]=h.useState(),$=a=>{const o=new Date;let e=a.toDate(p.getLocalTimeZone());e.setHours(o.getHours(),o.getMinutes(),o.getSeconds());const t=s?new Date(s):null,n=r?new Date(r):null;if(D){if(e=new Date(new Date(e).setHours(m?.hour??0,m?.minut,m?.second)),t&&t?.toDateString()===new Date(e).toDateString()&&t?.toTimeString()>=e?.toTimeString()){if(t&&(t.getHours()>e.getHours()||t.getHours()===e.getHours()&&t.getMinutes()>e.getMinutes()))return;e=new Date(t.setSeconds(t.getSeconds()+1))}if(n&&n?.toDateString()===new Date(e).toDateString()&&n?.toTimeString()<e?.toTimeString()){if(n&&(n.getHours()<e.getHours()||n.getHours()===e.getHours()&&n.getMinutes()<e.getMinutes()))return;e=new Date(n.setSeconds(n.getSeconds()-1))}}else t&&d.format(e)===d.format(t)&&t.getTime()>=e.getTime()?e=new Date(t.setSeconds(t.getSeconds()+1)):n&&d.format(e)===d.format(n)&&n.getTime()<=e.getTime()&&(e=new Date(n.setSeconds(n.getSeconds()-1)));typeof l=="function"&&(l(e),g.current?.setShow(!1))},v=(a,o)=>{x(a),(o??(!T&&!D))&&$(a)},A=a=>{const{start:o}=a;C(o)},B=a=>{const o=new Date(u??new Date);C({hour:o.getHours(),minut:o.getMinutes(),second:o.getSeconds()}),x(f(u))},E=()=>{S&&v(S,!0)};return i.jsxs(i.Fragment,{children:[i.jsx("div",{id:R,onClick:a=>{g.current?.handlerShow(a),B()},className:j,children:typeof H=="function"?H(u):u?new Date(u).toDateString():"Pilih Tanggal"}),i.jsx(Z.default,{zIndex:V,ref:g,offset:O,id:k,floatingOptions:{placement:"bottom-end",...N},children:i.jsx("div",{className:b??"",children:i.jsx(w.I18nProvider,{locale:"id-ID",children:i.jsx(G.default,{minValue:F,maxValue:_,minDate:s,maxDate:r,time:{start:m},locale:z,value:S,typeTime:"SINGLE",buttonReset:I,buttonSubmit:M,prevIcon:y,nextIcon:q,createCalendar:p.createCalendar,defaultValue:f(u),onChange:v,handlerReset:()=>{typeof l=="function"&&(l(P),g.current?.setShow(!1))},handlerSubmit:E,handlerChangeTime:A,withConfirm:T,isCustomTime:D,type:["date","month","year"],hiddenHeader:L})})})})]})};exports.default=J;