1mpacto-react-ui 2.0.20 → 2.0.21

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 (91) hide show
  1. package/dist/assets/style.css +1 -1
  2. package/dist/components/Alert/index.cjs +1 -1
  3. package/dist/components/Alert/index.mjs +40 -40
  4. package/dist/components/Breadcrumbs/Breadcrumbs.cjs +3 -3
  5. package/dist/components/Breadcrumbs/Breadcrumbs.mjs +43 -43
  6. package/dist/components/ButtonPopover/ButtonPopover.cjs +1 -1
  7. package/dist/components/ButtonPopover/ButtonPopover.mjs +28 -31
  8. package/dist/components/Calendar/Calendar.cjs +1 -1
  9. package/dist/components/Calendar/Calendar.mjs +98 -100
  10. package/dist/components/Calendar/CalendarMonth.cjs +1 -1
  11. package/dist/components/Calendar/CalendarMonth.mjs +41 -42
  12. package/dist/components/Calendar/CalendarRange.cjs +1 -1
  13. package/dist/components/Calendar/CalendarRange.mjs +59 -61
  14. package/dist/components/Calendar/CalendarYear.cjs +2 -2
  15. package/dist/components/Calendar/CalendarYear.mjs +37 -38
  16. package/dist/components/Chart/DoughnutChart.cjs +1 -1
  17. package/dist/components/Chart/DoughnutChart.mjs +93 -96
  18. package/dist/components/Chart/GradientBarChart.cjs +1 -1
  19. package/dist/components/Chart/GradientBarChart.mjs +80 -81
  20. package/dist/components/Chart/GradientLineChart.cjs +1 -1
  21. package/dist/components/Chart/GradientLineChart.mjs +50 -51
  22. package/dist/components/Chart/LineChart.cjs +1 -1
  23. package/dist/components/Chart/LineChart.mjs +23 -23
  24. package/dist/components/Chart/PieChart.cjs +1 -1
  25. package/dist/components/Chart/PieChart.mjs +45 -48
  26. package/dist/components/Collapse/Collapse.cjs +1 -1
  27. package/dist/components/Collapse/Collapse.mjs +23 -24
  28. package/dist/components/DatePicker/DatePicker.cjs +1 -1
  29. package/dist/components/DatePicker/DatePicker.mjs +86 -89
  30. package/dist/components/DatePicker/DateRangePicker.cjs +1 -1
  31. package/dist/components/DatePicker/DateRangePicker.mjs +91 -92
  32. package/dist/components/DatePicker/FilterDate.cjs +1 -1
  33. package/dist/components/DatePicker/FilterDate.mjs +107 -110
  34. package/dist/components/DatePicker/MonthYearPicker.cjs +1 -1
  35. package/dist/components/DatePicker/MonthYearPicker.mjs +51 -53
  36. package/dist/components/FilterContainer/FilterContainer.cjs +1 -1
  37. package/dist/components/FilterContainer/FilterContainer.mjs +27 -27
  38. package/dist/components/Input/InputFloatingInner.cjs +5 -5
  39. package/dist/components/Input/InputFloatingInner.mjs +24 -25
  40. package/dist/components/NumberFormat/NumberFormat.cjs +1 -1
  41. package/dist/components/NumberFormat/NumberFormat.mjs +12 -13
  42. package/dist/components/Pagination/Pagination.cjs +2 -2
  43. package/dist/components/Pagination/Pagination.mjs +76 -80
  44. package/dist/components/SelectDropdownContainer/SelectDropdownContainer.cjs +1 -1
  45. package/dist/components/SelectDropdownContainer/SelectDropdownContainer.mjs +98 -102
  46. package/dist/components/Sidebar/ItemSidebar.cjs +8 -8
  47. package/dist/components/Sidebar/ItemSidebar.mjs +71 -72
  48. package/dist/components/Sidebar/Sidebar.cjs +1 -1
  49. package/dist/components/Sidebar/Sidebar.mjs +65 -68
  50. package/dist/components/Step/Step.cjs +5 -5
  51. package/dist/components/Step/Step.mjs +52 -52
  52. package/dist/components/Table/Table.cjs +3 -3
  53. package/dist/components/Table/Table.mjs +275 -298
  54. package/dist/components/Table/TableSubMobile.cjs +1 -1
  55. package/dist/components/Table/TableSubMobile.mjs +32 -35
  56. package/dist/components/Tabs/Tabs.cjs +8 -8
  57. package/dist/components/Tabs/Tabs.mjs +66 -70
  58. package/dist/components/Textarea/Textarea.cjs +7 -7
  59. package/dist/components/Textarea/Textarea.mjs +47 -50
  60. package/dist/components/Textarea/TextareaFloatingInner.cjs +6 -6
  61. package/dist/components/Textarea/TextareaFloatingInner.mjs +56 -61
  62. package/dist/components/Textarea/TextareaInnerLabel.cjs +6 -6
  63. package/dist/components/Textarea/TextareaInnerLabel.mjs +47 -50
  64. package/dist/components/TimeRange/TimeRange.cjs +1 -1
  65. package/dist/components/TimeRange/TimeRange.mjs +88 -91
  66. package/dist/components/Tooltip/Tooltip.cjs +1 -1
  67. package/dist/components/Tooltip/Tooltip.mjs +44 -46
  68. package/dist/components/Upload/UploadFile.cjs +1 -1
  69. package/dist/components/Upload/UploadFile.mjs +50 -54
  70. package/dist/components/Upload/UploadImage.cjs +3 -3
  71. package/dist/components/Upload/UploadImage.mjs +62 -68
  72. package/dist/components/Upload/UploadMultipleFile.cjs +1 -1
  73. package/dist/components/Upload/UploadMultipleFile.mjs +61 -62
  74. package/dist/components/Virtualization/ListVirtualization.cjs +1 -1
  75. package/dist/components/Virtualization/ListVirtualization.mjs +52 -55
  76. package/dist/components/Virtualization/TableVirtualization.cjs +1 -1
  77. package/dist/components/Virtualization/TableVirtualization.mjs +56 -59
  78. package/dist/config/components/tinymce.cjs +2 -2
  79. package/dist/config/components/tinymce.mjs +3 -3
  80. package/dist/hooks/useCountdown.cjs +1 -1
  81. package/dist/hooks/useCountdown.mjs +15 -15
  82. package/dist/hooks/useDebounce.cjs +1 -1
  83. package/dist/hooks/useDebounce.mjs +19 -19
  84. package/dist/hooks/useOtpInput.cjs +1 -1
  85. package/dist/hooks/useOtpInput.mjs +47 -51
  86. package/dist/package.json.cjs +1 -1
  87. package/dist/package.json.d.ts +5 -4
  88. package/dist/package.json.mjs +1 -1
  89. package/dist/utils/common.cjs +1 -1
  90. package/dist/utils/common.mjs +172 -173
  91. package/package.json +4 -4
@@ -1,22 +1,21 @@
1
- import { jsx as t, jsxs as l, Fragment as Y } from "react/jsx-runtime";
2
- import o, { useEffect as Z, isValidElement as h } from "react";
3
- import { createCalendar as _, getWeeksInMonth as q, getLocalTimeZone as Q } from "@internationalized/date";
4
- import { useDateRangePicker as U, useLocale as X, useRangeCalendar as $, useCalendarGrid as p } from "react-aria";
5
- import { useDateRangePickerState as ee, useRangeCalendarState as te } from "react-stately";
6
- import A from "./CalendarButton.mjs";
7
- import r from "./style.module.scss.mjs";
8
- import ae from "./CalendarCell.mjs";
9
- import B from "../Button/Button.mjs";
10
- import ne from "./CalendarMonth.mjs";
11
- import ie, { ChevronDownIcon as E } from "./CalendarYear.mjs";
12
- import { CustomTimeCalendar as L } from "./Calendar.mjs";
13
- const le = (e) => {
14
- var g, R, y, D, x, k, S, I, T, N, w, P;
15
- const u = o.useRef(null), { locale: d } = X(), i = te({
1
+ import { jsx as t, jsxs as r, Fragment as E } from "react/jsx-runtime";
2
+ import u, { useEffect as L, isValidElement as s } from "react";
3
+ import { createCalendar as M, getWeeksInMonth as j, getLocalTimeZone as z } from "@internationalized/date";
4
+ import { useDateRangePicker as J, useLocale as W, useRangeCalendar as F, useCalendarGrid as G } from "react-aria";
5
+ import { useDateRangePickerState as H, useRangeCalendarState as K } from "react-stately";
6
+ import v from "./CalendarButton.mjs";
7
+ import d from "./style.module.scss.mjs";
8
+ import O from "./CalendarCell.mjs";
9
+ import R from "../Button/Button.mjs";
10
+ import V from "./CalendarMonth.mjs";
11
+ import Y, { ChevronDownIcon as y } from "./CalendarYear.mjs";
12
+ import { CustomTimeCalendar as D } from "./Calendar.mjs";
13
+ const Z = (e) => {
14
+ const o = u.useRef(null), { locale: l } = W(), i = K({
16
15
  ...e,
17
- locale: d,
18
- createCalendar: _
19
- }), M = (n) => {
16
+ locale: l,
17
+ createCalendar: M
18
+ }), x = (n) => {
20
19
  let a = "";
21
20
  switch (n) {
22
21
  case 0:
@@ -42,70 +41,69 @@ const le = (e) => {
42
41
  break;
43
42
  }
44
43
  return a;
45
- }, { calendarProps: j, prevButtonProps: z, nextButtonProps: J, title: b } = $(e, i, u), { gridProps: W, headerProps: F, weekDays: G } = p({}, i), H = q(i.visibleRange.start, d), [s, f] = o.useState("date"), [c, C] = o.useState({ start: void 0, end: void 0 }), K = ((R = (g = c.start) == null ? void 0 : g.hour) == null ? void 0 : R.toString()) && ((D = (y = c == null ? void 0 : c.start) == null ? void 0 : y.minut) == null ? void 0 : D.toString()) && ((I = (x = e.value) == null ? void 0 : x.start) == null ? void 0 : I.toDate(Q()).setHours((k = c.start) == null ? void 0 : k.hour, (S = c.start) == null ? void 0 : S.minut)) || e.minDate, O = e.maxDate, v = (n, a) => {
46
- const m = {
47
- ...c,
44
+ }, { calendarProps: k, prevButtonProps: S, nextButtonProps: I, title: b } = F(e, i, o), { gridProps: T, headerProps: N, weekDays: w } = G({}, i), P = j(i.visibleRange.start, l), [h, f] = u.useState("date"), [m, C] = u.useState({ start: void 0, end: void 0 }), A = m.start?.hour?.toString() && m?.start?.minut?.toString() && e.value?.start?.toDate(z()).setHours(m.start?.hour, m.start?.minut) || e.minDate, B = e.maxDate, g = (n, a) => {
45
+ const c = {
46
+ ...m,
48
47
  [a]: n
49
48
  };
50
- C(m), typeof (e == null ? void 0 : e.handlerChangeTimeRange) == "function" && e.handlerChangeTimeRange(m);
49
+ C(c), typeof e?.handlerChangeTimeRange == "function" && e.handlerChangeTimeRange(c);
51
50
  };
52
- return Z(() => {
53
- var n, a;
54
- if ((n = e.time) != null && n.start && ((a = e.time) != null && a.end)) {
55
- const m = e.time.start, V = e.time.end;
56
- C({ start: m, end: V });
51
+ return L(() => {
52
+ if (e.time?.start && e.time?.end) {
53
+ const n = e.time.start, a = e.time.end;
54
+ C({ start: n, end: a });
57
55
  }
58
- }, [JSON.stringify(e.time)]), /* @__PURE__ */ l("div", { className: "iru-text-laba-base-sr", children: [
59
- s === "date" && /* @__PURE__ */ t(Y, { children: /* @__PURE__ */ t("div", { ...j, ref: u, children: /* @__PURE__ */ l("div", { className: r["container-calendar"], children: [
60
- /* @__PURE__ */ l("div", { className: "iru-flex iru-gap-2", children: [
61
- /* @__PURE__ */ l("div", { children: [
62
- /* @__PURE__ */ l("div", { className: r["header-calendar"], children: [
63
- /* @__PURE__ */ t(A, { ...z, children: typeof (e == null ? void 0 : e.prevIcon) == "function" || h(e == null ? void 0 : e.prevIcon) ? h(e.prevIcon) ? e.prevIcon : e.prevIcon() : /* @__PURE__ */ t(E, { className: "iru-rotate-90" }) }),
64
- /* @__PURE__ */ t("div", { className: r["header-button-calendar"], onClick: () => f("month"), children: b }),
65
- /* @__PURE__ */ t(A, { ...J, children: typeof (e == null ? void 0 : e.nextIcon) == "function" || h(e == null ? void 0 : e.nextIcon) ? h(e.nextIcon) ? e.nextIcon : e.nextIcon() : /* @__PURE__ */ t(E, { className: "-iru-rotate-90" }) })
56
+ }, [JSON.stringify(e.time)]), /* @__PURE__ */ r("div", { className: "iru-text-laba-base-sr", children: [
57
+ h === "date" && /* @__PURE__ */ t(E, { children: /* @__PURE__ */ t("div", { ...k, ref: o, children: /* @__PURE__ */ r("div", { className: d["container-calendar"], children: [
58
+ /* @__PURE__ */ r("div", { className: "iru-flex iru-gap-2", children: [
59
+ /* @__PURE__ */ r("div", { children: [
60
+ /* @__PURE__ */ r("div", { className: d["header-calendar"], children: [
61
+ /* @__PURE__ */ t(v, { ...S, children: typeof e?.prevIcon == "function" || s(e?.prevIcon) ? s(e.prevIcon) ? e.prevIcon : e.prevIcon() : /* @__PURE__ */ t(y, { className: "iru-rotate-90" }) }),
62
+ /* @__PURE__ */ t("div", { className: d["header-button-calendar"], onClick: () => f("month"), children: b }),
63
+ /* @__PURE__ */ t(v, { ...I, children: typeof e?.nextIcon == "function" || s(e?.nextIcon) ? s(e.nextIcon) ? e.nextIcon : e.nextIcon() : /* @__PURE__ */ t(y, { className: "-iru-rotate-90" }) })
66
64
  ] }),
67
- /* @__PURE__ */ l("table", { ...W, cellPadding: "0", className: "flex-1", children: [
68
- /* @__PURE__ */ t("thead", { ...F, className: "text-gray-600", children: /* @__PURE__ */ t("tr", { children: G.map((n, a) => /* @__PURE__ */ t("th", { className: r["days-calendar"], children: M(a) }, a)) }) }),
69
- /* @__PURE__ */ t("tbody", { children: [...new Array(H).keys()].map((n) => /* @__PURE__ */ t("tr", { children: i.getDatesInWeek(n).map(
70
- (a, m) => a ? /* @__PURE__ */ t(ae, { state: i, date: a }, m) : /* @__PURE__ */ t("td", {}, m)
65
+ /* @__PURE__ */ r("table", { ...T, cellPadding: "0", className: "flex-1", children: [
66
+ /* @__PURE__ */ t("thead", { ...N, className: "text-gray-600", children: /* @__PURE__ */ t("tr", { children: w.map((n, a) => /* @__PURE__ */ t("th", { className: d["days-calendar"], children: x(a) }, a)) }) }),
67
+ /* @__PURE__ */ t("tbody", { children: [...new Array(P).keys()].map((n) => /* @__PURE__ */ t("tr", { children: i.getDatesInWeek(n).map(
68
+ (a, c) => a ? /* @__PURE__ */ t(O, { state: i, date: a }, c) : /* @__PURE__ */ t("td", {}, c)
71
69
  ) }, n)) })
72
70
  ] })
73
71
  ] }),
74
- (e == null ? void 0 : e.isCustomTime) && /* @__PURE__ */ l("div", { className: "iru-flex", children: [
72
+ e?.isCustomTime && /* @__PURE__ */ r("div", { className: "iru-flex", children: [
75
73
  /* @__PURE__ */ t(
76
- L,
74
+ D,
77
75
  {
78
76
  minDate: e.minDate,
79
77
  maxDate: e.maxDate,
80
- time: (T = e.time) == null ? void 0 : T.start,
81
- value: (N = e.value) == null ? void 0 : N.start,
78
+ time: e.time?.start,
79
+ value: e.value?.start,
82
80
  timeLabel: "Awal",
83
81
  type: "start",
84
- handlerChangeTime: (n) => v(n, "start")
82
+ handlerChangeTime: (n) => g(n, "start")
85
83
  }
86
84
  ),
87
85
  /* @__PURE__ */ t(
88
- L,
86
+ D,
89
87
  {
90
- minDate: K,
91
- maxDate: O,
92
- time: (w = e.time) == null ? void 0 : w.end,
93
- value: (P = e.value) == null ? void 0 : P.end,
88
+ minDate: A,
89
+ maxDate: B,
90
+ time: e.time?.end,
91
+ value: e.value?.end,
94
92
  timeLabel: "Akhir",
95
93
  type: "end",
96
- handlerChangeTime: (n) => v(n, "end")
94
+ handlerChangeTime: (n) => g(n, "end")
97
95
  }
98
96
  )
99
97
  ] })
100
98
  ] }),
101
- e.withConfirm && /* @__PURE__ */ l("div", { className: r["footer-calendar"], children: [
102
- typeof (e == null ? void 0 : e.buttonReset) == "function" ? /* @__PURE__ */ t("div", { onClick: () => e.handlerReset(i), children: e.buttonReset() }) : /* @__PURE__ */ t(B, { variants: "nude-laba-blue-10", size: "small", onClick: () => e.handlerReset(i), children: "Reset" }),
103
- typeof (e == null ? void 0 : e.buttonSubmit) == "function" ? /* @__PURE__ */ t("div", { onClick: e.handlerSubmit, children: e.buttonSubmit() }) : /* @__PURE__ */ t(B, { size: "small", onClick: e.handlerSubmit, children: "Terapkan" })
99
+ e.withConfirm && /* @__PURE__ */ r("div", { className: d["footer-calendar"], children: [
100
+ typeof e?.buttonReset == "function" ? /* @__PURE__ */ t("div", { onClick: () => e.handlerReset(i), children: e.buttonReset() }) : /* @__PURE__ */ t(R, { variants: "nude-laba-blue-10", size: "small", onClick: () => e.handlerReset(i), children: "Reset" }),
101
+ typeof e?.buttonSubmit == "function" ? /* @__PURE__ */ t("div", { onClick: e.handlerSubmit, children: e.buttonSubmit() }) : /* @__PURE__ */ t(R, { size: "small", onClick: e.handlerSubmit, children: "Terapkan" })
104
102
  ] })
105
103
  ] }) }) }),
106
- s === "month" && /* @__PURE__ */ t(ne, { state: i, setActiveTypeCalendar: f, type: ["date", "month", "year"] }),
107
- s === "year" && /* @__PURE__ */ t(
108
- ie,
104
+ h === "month" && /* @__PURE__ */ t(V, { state: i, setActiveTypeCalendar: f, type: ["date", "month", "year"] }),
105
+ h === "year" && /* @__PURE__ */ t(
106
+ Y,
109
107
  {
110
108
  state: i,
111
109
  setActiveTypeCalendar: f,
@@ -114,10 +112,10 @@ const le = (e) => {
114
112
  }
115
113
  )
116
114
  ] });
117
- }, ge = (e) => {
118
- const u = ee(e), d = o.useRef(null), { calendarProps: i } = U(e, u, d);
119
- return /* @__PURE__ */ t("div", { ref: d, children: /* @__PURE__ */ t(
120
- le,
115
+ }, re = (e) => {
116
+ const o = H(e), l = u.useRef(null), { calendarProps: i } = J(e, o, l);
117
+ return /* @__PURE__ */ t("div", { ref: l, children: /* @__PURE__ */ t(
118
+ Z,
121
119
  {
122
120
  handlerReset: e.handlerReset,
123
121
  handlerSubmit: e.handlerSubmit,
@@ -136,5 +134,5 @@ const le = (e) => {
136
134
  ) });
137
135
  };
138
136
  export {
139
- ge as default
137
+ re as default
140
138
  };
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),w=require("react"),d=require("./style.module.scss.cjs"),x=({className:u})=>l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:`iru-h-4 iru-w-4 iru-text-blue-700 ${u??""}`,viewBox:"0 0 512 512",children:l.jsx("path",{d:`M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 \r
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),y=require("react"),c=require("./style.module.scss.cjs"),m=({className:o})=>n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:`iru-h-4 iru-w-4 iru-text-blue-700 ${o??""}`,viewBox:"0 0 512 512",children:n.jsx("path",{d:`M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 \r
2
2
  0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 \r
3
- 0s-12.5 32.8 0 45.3l192 192z`})}),$=({title:u,state:e,type:a,setUpYear:i={startYear:1970,endAfterThisYear:20},hiddenHeader:g,setActiveTypeCalendar:s,onChangeYear:f})=>{const y=(n,r)=>{const c=e.focusedDate.set({year:n});r?(s("month"),e.setFocusedDate(c)):!r&&typeof f=="function"&&f(c)},b=(n,r,c)=>Array.from({length:(r-n)/c+1},(m,o)=>n+o*c);return w.useEffect(()=>{const n=document.getElementById(`calendar-year-${e.focusedDate.year}`),r=document.getElementById("wrapper-calendar-year");n&&r&&r.scrollTo({behavior:"instant",top:n.offsetTop-93})},[]),l.jsxs("div",{className:`iru-w-[296px] ${d.default["container-calendar"]}`,children:[!g&&l.jsx("div",{className:`${d.default["header-calendar"]} iru-my-2`,children:l.jsxs("div",{className:`${d.default["header-button-calendar"]} ${a.includes("date")||a.includes("month")?"":d.default.disabled}`,onClick:()=>{a.includes("date")?s("date"):a.includes("month")&&s("month")},children:[u," ",(a.includes("date")||a.includes("month"))&&l.jsx(x,{})]})}),l.jsx("div",{id:"wrapper-calendar-year",className:d.default["year-calendar"],children:b(i==null?void 0:i.startYear,new Date().getFullYear()+i.endAfterThisYear,1).map(n=>{var h,t;const r=Number(n),c=e!=null&&e.minValue?r<((h=e==null?void 0:e.minValue)==null?void 0:h.year):!1,m=e!=null&&e.maxValue?r>((t=e==null?void 0:e.maxValue)==null?void 0:t.year):!1,o=c||m;return l.jsx("div",{id:`calendar-year-${n}`,onClick:()=>{o||y(r,a.includes("month"))},className:`${d.default["cell-year"]} ${e.focusedDate.year===r&&!o?d.default.selected:""} ${e.focusedDate.year!==r&&!o?"hover:iru-bg-laba-blue-01":""} ${o?"iru-text-gray-400":"iru-cursor-pointer"}`,children:n},n)})})]})};exports.ChevronDownIcon=x;exports.default=$;
3
+ 0s-12.5 32.8 0 45.3l192 192z`})}),b=({title:o,state:a,type:l,setUpYear:t={startYear:1970,endAfterThisYear:20},hiddenHeader:h,setActiveTypeCalendar:i,onChangeYear:u})=>{const x=(r,e)=>{const s=a.focusedDate.set({year:r});e?(i("month"),a.setFocusedDate(s)):!e&&typeof u=="function"&&u(s)},g=(r,e,s)=>Array.from({length:(e-r)/s+1},(f,d)=>r+d*s);return y.useEffect(()=>{const r=document.getElementById(`calendar-year-${a.focusedDate.year}`),e=document.getElementById("wrapper-calendar-year");r&&e&&e.scrollTo({behavior:"instant",top:r.offsetTop-93})},[]),n.jsxs("div",{className:`iru-w-[296px] ${c.default["container-calendar"]}`,children:[!h&&n.jsx("div",{className:`${c.default["header-calendar"]} iru-my-2`,children:n.jsxs("div",{className:`${c.default["header-button-calendar"]} ${l.includes("date")||l.includes("month")?"":c.default.disabled}`,onClick:()=>{l.includes("date")?i("date"):l.includes("month")&&i("month")},children:[o," ",(l.includes("date")||l.includes("month"))&&n.jsx(m,{})]})}),n.jsx("div",{id:"wrapper-calendar-year",className:c.default["year-calendar"],children:g(t?.startYear,new Date().getFullYear()+t.endAfterThisYear,1).map(r=>{const e=Number(r),s=a?.minValue?e<a?.minValue?.year:!1,f=a?.maxValue?e>a?.maxValue?.year:!1,d=s||f;return n.jsx("div",{id:`calendar-year-${r}`,onClick:()=>{d||x(e,l.includes("month"))},className:`${c.default["cell-year"]} ${a.focusedDate.year===e&&!d?c.default.selected:""} ${a.focusedDate.year!==e&&!d?"hover:iru-bg-laba-blue-01":""} ${d?"iru-text-gray-400":"iru-cursor-pointer"}`,children:r},r)})})]})};exports.ChevronDownIcon=m;exports.default=b;
@@ -1,14 +1,14 @@
1
- import { jsxs as g, jsx as d } from "react/jsx-runtime";
2
- import x from "react";
1
+ import { jsxs as f, jsx as o } from "react/jsx-runtime";
2
+ import w from "react";
3
3
  import l from "./style.module.scss.mjs";
4
- const D = ({ className: u }) => /* @__PURE__ */ d(
4
+ const $ = ({ className: d }) => /* @__PURE__ */ o(
5
5
  "svg",
6
6
  {
7
7
  xmlns: "http://www.w3.org/2000/svg",
8
8
  fill: "currentColor",
9
- className: `iru-h-4 iru-w-4 iru-text-blue-700 ${u ?? ""}`,
9
+ className: `iru-h-4 iru-w-4 iru-text-blue-700 ${d ?? ""}`,
10
10
  viewBox: "0 0 512 512",
11
- children: /* @__PURE__ */ d(
11
+ children: /* @__PURE__ */ o(
12
12
  "path",
13
13
  {
14
14
  d: `M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 \r
@@ -17,58 +17,57 @@ const D = ({ className: u }) => /* @__PURE__ */ d(
17
17
  }
18
18
  )
19
19
  }
20
- ), p = ({
21
- title: u,
22
- state: e,
23
- type: c,
24
- setUpYear: i = { startYear: 1970, endAfterThisYear: 20 },
25
- hiddenHeader: w,
26
- setActiveTypeCalendar: s,
27
- onChangeYear: m
20
+ ), D = ({
21
+ title: d,
22
+ state: a,
23
+ type: n,
24
+ setUpYear: t = { startYear: 1970, endAfterThisYear: 20 },
25
+ hiddenHeader: h,
26
+ setActiveTypeCalendar: i,
27
+ onChangeYear: u
28
28
  }) => {
29
- const $ = (n, r) => {
30
- const a = e.focusedDate.set({ year: n });
31
- r ? (s("month"), e.setFocusedDate(a)) : !r && typeof m == "function" && m(a);
32
- }, b = (n, r, a) => Array.from({ length: (r - n) / a + 1 }, (f, o) => n + o * a);
33
- return x.useEffect(() => {
34
- const n = document.getElementById(`calendar-year-${e.focusedDate.year}`), r = document.getElementById("wrapper-calendar-year");
35
- n && r && r.scrollTo({ behavior: "instant", top: n.offsetTop - 93 });
36
- }, []), /* @__PURE__ */ g("div", { className: `iru-w-[296px] ${l["container-calendar"]}`, children: [
37
- !w && /* @__PURE__ */ d("div", { className: `${l["header-calendar"]} iru-my-2`, children: /* @__PURE__ */ g(
29
+ const y = (r, e) => {
30
+ const c = a.focusedDate.set({ year: r });
31
+ e ? (i("month"), a.setFocusedDate(c)) : !e && typeof u == "function" && u(c);
32
+ }, g = (r, e, c) => Array.from({ length: (e - r) / c + 1 }, (m, s) => r + s * c);
33
+ return w.useEffect(() => {
34
+ const r = document.getElementById(`calendar-year-${a.focusedDate.year}`), e = document.getElementById("wrapper-calendar-year");
35
+ r && e && e.scrollTo({ behavior: "instant", top: r.offsetTop - 93 });
36
+ }, []), /* @__PURE__ */ f("div", { className: `iru-w-[296px] ${l["container-calendar"]}`, children: [
37
+ !h && /* @__PURE__ */ o("div", { className: `${l["header-calendar"]} iru-my-2`, children: /* @__PURE__ */ f(
38
38
  "div",
39
39
  {
40
- className: `${l["header-button-calendar"]} ${c.includes("date") || c.includes("month") ? "" : l.disabled}`,
40
+ className: `${l["header-button-calendar"]} ${n.includes("date") || n.includes("month") ? "" : l.disabled}`,
41
41
  onClick: () => {
42
- c.includes("date") ? s("date") : c.includes("month") && s("month");
42
+ n.includes("date") ? i("date") : n.includes("month") && i("month");
43
43
  },
44
44
  children: [
45
- u,
45
+ d,
46
46
  " ",
47
- (c.includes("date") || c.includes("month")) && /* @__PURE__ */ d(D, {})
47
+ (n.includes("date") || n.includes("month")) && /* @__PURE__ */ o($, {})
48
48
  ]
49
49
  }
50
50
  ) }),
51
- /* @__PURE__ */ d("div", { id: "wrapper-calendar-year", className: l["year-calendar"], children: b(i == null ? void 0 : i.startYear, (/* @__PURE__ */ new Date()).getFullYear() + i.endAfterThisYear, 1).map(
52
- (n) => {
53
- var h, y;
54
- const r = Number(n), a = e != null && e.minValue ? r < ((h = e == null ? void 0 : e.minValue) == null ? void 0 : h.year) : !1, f = e != null && e.maxValue ? r > ((y = e == null ? void 0 : e.maxValue) == null ? void 0 : y.year) : !1, o = a || f;
55
- return /* @__PURE__ */ d(
51
+ /* @__PURE__ */ o("div", { id: "wrapper-calendar-year", className: l["year-calendar"], children: g(t?.startYear, (/* @__PURE__ */ new Date()).getFullYear() + t.endAfterThisYear, 1).map(
52
+ (r) => {
53
+ const e = Number(r), c = a?.minValue ? e < a?.minValue?.year : !1, m = a?.maxValue ? e > a?.maxValue?.year : !1, s = c || m;
54
+ return /* @__PURE__ */ o(
56
55
  "div",
57
56
  {
58
- id: `calendar-year-${n}`,
57
+ id: `calendar-year-${r}`,
59
58
  onClick: () => {
60
- o || $(r, c.includes("month"));
59
+ s || y(e, n.includes("month"));
61
60
  },
62
- className: `${l["cell-year"]} ${e.focusedDate.year === r && !o ? l.selected : ""} ${e.focusedDate.year !== r && !o ? "hover:iru-bg-laba-blue-01" : ""} ${o ? "iru-text-gray-400" : "iru-cursor-pointer"}`,
63
- children: n
61
+ className: `${l["cell-year"]} ${a.focusedDate.year === e && !s ? l.selected : ""} ${a.focusedDate.year !== e && !s ? "hover:iru-bg-laba-blue-01" : ""} ${s ? "iru-text-gray-400" : "iru-cursor-pointer"}`,
62
+ children: r
64
63
  },
65
- n
64
+ r
66
65
  );
67
66
  }
68
67
  ) })
69
68
  ] });
70
69
  };
71
70
  export {
72
- D as ChevronDownIcon,
73
- p as default
71
+ $ as ChevronDownIcon,
72
+ D as default
74
73
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const z=require("react/jsx-runtime"),A=require("react-chartjs-2"),f=require("chart.js");f.Chart.register(f.CategoryScale,f.LinearScale,f.PointElement,f.LineElement,f.ArcElement,f.Title,f.Tooltip,f.Legend);const H=(p,n)=>{var m,D,w,x;const C=p.getVisibleDatasetCount(),h=p.getDatasetMeta(C-1).data.at(0);if(h){const{innerRadius:E}=h.getProps(["innerRadius"]),{ctx:s}=p,v=()=>{var g;const c=[].concat(n),d=c.length,o=s.font;let r=0,u=0,l;for(l=0;l<d;++l)s.font=c[l].font,r=Math.max(s.measureText(c[l].text).width,r),u+=(g=c[l].font)==null?void 0:g.lineHeight;return s.font=o,{height:u,width:r}},b=(c,d)=>{let o=document.createElement("div");document.body.appendChild(o),o.style.fontSize=`${d}px`,o.style.position="absolute",o.style.left="-10",o.style.top="-10",o.textContent=c;const r={width:o.clientWidth,height:o.clientHeight};return document.body.removeChild(o),o=null,r},$=v(),j=parseFloat(parseFloat(E).toFixed(2));s.textAlign="center",s.textBaseline="middle";const I=(p.chartArea.left+p.chartArea.right)/2,e=(p.chartArea.top+p.chartArea.bottom)/2-$.height/2;let t;const T=n.length;let S=0;for(t=0;t<T;++t){let c=(m=n[t].font)==null?void 0:m.size,d=(D=n[t].font)==null?void 0:D.lineHeight;const o=typeof n[t].text=="number"?n[t].text.toString():n[t].text;for(;b(o,c).width>j+(n[t].id==="value"?50:0);)c-=1,d=b(o,c).height;o.length>22&&d<14&&(d=18);const r=e+d/2+S,u=typeof n[t].text=="number"?new Intl.NumberFormat("id-ID",{style:"currency",currency:"IDR"}).format(n[t].text):n[t].text;let l=n[t].urlIconDesc?" ":"";if(n[t].percentage!==void 0?l+=`${n[t].percentage}% ${n[t].text}`:l+=u,s.fillStyle=n[t].color,s.font=`${c<10?10:c}px sans-serif`,S+=d,n[t].percentage!==void 0&&n[t].urlIconDesc){const y=((x=(w=n[t])==null?void 0:w.percentage)==null?void 0:x.length)??0,g=new Image;g.src=n[t].urlIconDesc,s.drawImage(g,45-(y>6?y+2:y-2.5),r-8,16,14)}s.fillText(l,I,r)}s.restore(),s.save()}},M=({labels:p,data:n,backgroundColor:C,options:h={},redraw:m,widthInnerDoughnut:D,innerLabels:w,open:x=!0,keyRemoveDataOpen:E="gap",keyLabel:s="title",keyValue:v="originalValue",keyBackground:b="backgroundColor",className:$})=>{const j={labels:p||n.map(i=>i[s]),datasets:[{data:n.map(i=>i[v]),backgroundColor:C||n.map(i=>i[b])}]},I={cutout:D,animation:{duration:m?400:0},plugins:{legend:{display:!1},tooltip:{external(i){let e=document.getElementById("chartjs-tooltip");e||(e=document.createElement("div"),e.id="chartjs-tooltip",e.innerHTML="<table></table>",document.body.appendChild(e));const t=i.tooltip;if(t.opacity===0){e.style.opacity="0";return}e.classList.remove("above","below","no-transform"),t.yAlign?e.classList.add(t.yAlign):e.classList.add("no-transform");const T=n.filter(r=>!r[s]),S=n.filter(r=>r[v]>0&&r[v]<1);if(T.length===1&&S.length===1)return;function c(r){return r.lines}if(t.body){const r=t.title||[];let u=t.body.map(c),l="<thead>";r.forEach(g=>{let a="";a+="display: flex",a+="; justify-content: center",a+="; font-weight: 600",a+="; font-size: 12px",a+="; padding: 0px 14px",l+=`<tr><span style="${a}">${g}</span></tr>`}),l+="</thead><tbody>",u.length>1&&u[0][0]===u[1][0]&&(u=[u[0]]),u.forEach(g=>{let a="";a+="display: flex",a+="; justify-content: center",a+="; color: #0163C8",a+="; padding: 0px 14px",a+="; font-size: 12px";const L=`<span style="${a}">${g}</span>`;l+=`<tr><td>${L}</td></tr>`}),l+="</tbody>";const y=e.querySelector("table");y&&(y.innerHTML=l)}const d=i.chart.canvas.getBoundingClientRect(),o=d.top+window.pageYOffset+t.caretY;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=`${d.left+window.pageXOffset+t.caretX-80}px`,e.style.top=`${o>300&&!x?280:o}px`,e.style.pointerEvents="none"},displayColors:!0,enabled:!1,callbacks:{title(i){const e=n[i[0].dataIndex];return e==null?void 0:e[s]},label(i){const e=n==null?void 0:n[i.dataIndex];let t="Nilai: ";return e&&(t+=e.value),t}}}},elements:{arc:{borderWidth:0}}};return z.jsxs("div",{className:$??"",children:[!x&&z.jsx(A.Doughnut,{data:j,redraw:m,plugins:[{id:"draw",beforeDraw(i){H(i,w)}}],options:Object.keys(h).length>1?h:I}),x&&z.jsx(A.Doughnut,{data:j,redraw:m,plugins:[{id:"draw",beforeDraw(i){H(i,w.filter(e=>e.id!==E))}}],options:Object.keys(h).length>1?h:I})]})};exports.default=M;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const $=require("react/jsx-runtime"),A=require("react-chartjs-2"),p=require("chart.js");p.Chart.register(p.CategoryScale,p.LinearScale,p.PointElement,p.LineElement,p.ArcElement,p.Title,p.Tooltip,p.Legend);const B=(d,e)=>{const D=d.getVisibleDatasetCount(),g=d.getDatasetMeta(D-1).data.at(0);if(g){const{innerRadius:m}=g.getProps(["innerRadius"]),{ctx:s}=d,I=()=>{const t=[].concat(e),o=t.length,r=s.font;let u=0,y=0,l;for(l=0;l<o;++l)s.font=t[l].font,u=Math.max(s.measureText(t[l].text).width,u),y+=t[l].font?.lineHeight;return s.font=r,{height:y,width:u}},h=(t,o)=>{let r=document.createElement("div");document.body.appendChild(r),r.style.fontSize=`${o}px`,r.style.position="absolute",r.style.left="-10",r.style.top="-10",r.textContent=t;const u={width:r.clientWidth,height:r.clientHeight};return document.body.removeChild(r),r=null,u},j=I(),w=parseFloat(parseFloat(m).toFixed(2));s.textAlign="center",s.textBaseline="middle";const v=(d.chartArea.left+d.chartArea.right)/2,S=(d.chartArea.top+d.chartArea.bottom)/2-j.height/2;let n;const b=e.length;let i=0;for(n=0;n<b;++n){let t=e[n].font?.size,o=e[n].font?.lineHeight;const r=typeof e[n].text=="number"?e[n].text.toString():e[n].text;for(;h(r,t).width>w+(e[n].id==="value"?50:0);)t-=1,o=h(r,t).height;r.length>22&&o<14&&(o=18);const u=S+o/2+i,y=typeof e[n].text=="number"?new Intl.NumberFormat("id-ID",{style:"currency",currency:"IDR"}).format(e[n].text):e[n].text;let l=e[n].urlIconDesc?" ":"";if(e[n].percentage!==void 0?l+=`${e[n].percentage}% ${e[n].text}`:l+=y,s.fillStyle=e[n].color,s.font=`${t<10?10:t}px sans-serif`,i+=o,e[n].percentage!==void 0&&e[n].urlIconDesc){const f=e[n]?.percentage?.length??0,a=new Image;a.src=e[n].urlIconDesc,s.drawImage(a,45-(f>6?f+2:f-2.5),u-8,16,14)}s.fillText(l,v,u)}s.restore(),s.save()}},L=({labels:d,data:e,backgroundColor:D,options:g={},redraw:m,widthInnerDoughnut:s,innerLabels:I,open:h=!0,keyRemoveDataOpen:j="gap",keyLabel:w="title",keyValue:v="originalValue",keyBackground:T="backgroundColor",className:S})=>{const n={labels:d||e.map(i=>i[w]),datasets:[{data:e.map(i=>i[v]),backgroundColor:D||e.map(i=>i[T])}]},b={cutout:s,animation:{duration:m?400:0},plugins:{legend:{display:!1},tooltip:{external(i){let t=document.getElementById("chartjs-tooltip");t||(t=document.createElement("div"),t.id="chartjs-tooltip",t.innerHTML="<table></table>",document.body.appendChild(t));const o=i.tooltip;if(o.opacity===0){t.style.opacity="0";return}t.classList.remove("above","below","no-transform"),o.yAlign?t.classList.add(o.yAlign):t.classList.add("no-transform");const r=e.filter(a=>!a[w]),u=e.filter(a=>a[v]>0&&a[v]<1);if(r.length===1&&u.length===1)return;function y(a){return a.lines}if(o.body){const a=o.title||[];let x=o.body.map(y),C="<thead>";a.forEach(E=>{let c="";c+="display: flex",c+="; justify-content: center",c+="; font-weight: 600",c+="; font-size: 12px",c+="; padding: 0px 14px",C+=`<tr><span style="${c}">${E}</span></tr>`}),C+="</thead><tbody>",x.length>1&&x[0][0]===x[1][0]&&(x=[x[0]]),x.forEach(E=>{let c="";c+="display: flex",c+="; justify-content: center",c+="; color: #0163C8",c+="; padding: 0px 14px",c+="; font-size: 12px";const H=`<span style="${c}">${E}</span>`;C+=`<tr><td>${H}</td></tr>`}),C+="</tbody>";const z=t.querySelector("table");z&&(z.innerHTML=C)}const l=i.chart.canvas.getBoundingClientRect(),f=l.top+window.pageYOffset+o.caretY;t.style.opacity="1",t.style.border="solid 1px #0163C8",t.style.background="white",t.style.height="fit-content",t.style.borderRadius="10px",t.style.position="absolute",t.style.zIndex="10",t.style.padding="4px 0",t.style.left=`${l.left+window.pageXOffset+o.caretX-80}px`,t.style.top=`${f>300&&!h?280:f}px`,t.style.pointerEvents="none"},displayColors:!0,enabled:!1,callbacks:{title(i){return e[i[0].dataIndex]?.[w]},label(i){const t=e?.[i.dataIndex];let o="Nilai: ";return t&&(o+=t.value),o}}}},elements:{arc:{borderWidth:0}}};return $.jsxs("div",{className:S??"",children:[!h&&$.jsx(A.Doughnut,{data:n,redraw:m,plugins:[{id:"draw",beforeDraw(i){B(i,I)}}],options:Object.keys(g).length>1?g:b}),h&&$.jsx(A.Doughnut,{data:n,redraw:m,plugins:[{id:"draw",beforeDraw(i){B(i,I.filter(t=>t.id!==j))}}],options:Object.keys(g).length>1?g:b})]})};exports.default=L;
@@ -1,125 +1,122 @@
1
- import { jsxs as L, jsx as A } from "react/jsx-runtime";
1
+ import { jsxs as H, jsx as A } from "react/jsx-runtime";
2
2
  import { Doughnut as T } from "react-chartjs-2";
3
- import { Chart as R, CategoryScale as F, LinearScale as M, PointElement as Y, LineElement as B, ArcElement as O, Title as k, Tooltip as N, Legend as P } from "chart.js";
4
- R.register(F, M, Y, B, O, k, N, P);
5
- const j = (f, n) => {
6
- var m, v, x, y;
7
- const C = f.getVisibleDatasetCount(), g = f.getDatasetMeta(C - 1).data.at(0);
8
- if (g) {
9
- const { innerRadius: $ } = g.getProps(["innerRadius"]), { ctx: s } = f, w = () => {
10
- var u;
11
- const c = [].concat(n), d = c.length, o = s.font;
12
- let r = 0, p = 0, l;
13
- for (l = 0; l < d; ++l)
14
- s.font = c[l].font, r = Math.max(s.measureText(c[l].text).width, r), p += (u = c[l].font) == null ? void 0 : u.lineHeight;
15
- return s.font = o, {
16
- height: p,
17
- width: r
3
+ import { Chart as L, CategoryScale as R, LinearScale as F, PointElement as M, LineElement as Y, ArcElement as O, Title as k, Tooltip as N, Legend as P } from "chart.js";
4
+ L.register(R, F, M, Y, O, k, N, P);
5
+ const j = (d, e) => {
6
+ const I = d.getVisibleDatasetCount(), f = d.getDatasetMeta(I - 1).data.at(0);
7
+ if (f) {
8
+ const { innerRadius: m } = f.getProps(["innerRadius"]), { ctx: s } = d, v = () => {
9
+ const t = [].concat(e), o = t.length, r = s.font;
10
+ let p = 0, h = 0, l;
11
+ for (l = 0; l < o; ++l)
12
+ s.font = t[l].font, p = Math.max(s.measureText(t[l].text).width, p), h += t[l].font?.lineHeight;
13
+ return s.font = r, {
14
+ height: h,
15
+ width: p
18
16
  };
19
- }, D = (c, d) => {
20
- let o = document.createElement("div");
21
- document.body.appendChild(o), o.style.fontSize = `${d}px`, o.style.position = "absolute", o.style.left = "-10", o.style.top = "-10", o.textContent = c;
22
- const r = {
23
- width: o.clientWidth,
24
- height: o.clientHeight
17
+ }, g = (t, o) => {
18
+ let r = document.createElement("div");
19
+ document.body.appendChild(r), r.style.fontSize = `${o}px`, r.style.position = "absolute", r.style.left = "-10", r.style.top = "-10", r.textContent = t;
20
+ const p = {
21
+ width: r.clientWidth,
22
+ height: r.clientHeight
25
23
  };
26
- return document.body.removeChild(o), o = null, r;
27
- }, S = w(), b = parseFloat(parseFloat($).toFixed(2));
24
+ return document.body.removeChild(r), r = null, p;
25
+ }, b = v(), x = parseFloat(parseFloat(m).toFixed(2));
28
26
  s.textAlign = "center", s.textBaseline = "middle";
29
- const I = (f.chartArea.left + f.chartArea.right) / 2, e = (f.chartArea.top + f.chartArea.bottom) / 2 - S.height / 2;
30
- let t;
31
- const z = n.length;
32
- let E = 0;
33
- for (t = 0; t < z; ++t) {
34
- let c = (m = n[t].font) == null ? void 0 : m.size, d = (v = n[t].font) == null ? void 0 : v.lineHeight;
35
- const o = typeof n[t].text == "number" ? n[t].text.toString() : n[t].text;
36
- for (; D(o, c).width > b + (n[t].id === "value" ? 50 : 0); )
37
- c -= 1, d = D(o, c).height;
38
- o.length > 22 && d < 14 && (d = 18);
39
- const r = e + d / 2 + E, p = typeof n[t].text == "number" ? new Intl.NumberFormat("id-ID", { style: "currency", currency: "IDR" }).format(
40
- n[t].text
41
- ) : n[t].text;
42
- let l = n[t].urlIconDesc ? " " : "";
43
- if (n[t].percentage !== void 0 ? l += `${n[t].percentage}% ${n[t].text}` : l += p, s.fillStyle = n[t].color, s.font = `${c < 10 ? 10 : c}px sans-serif`, E += d, n[t].percentage !== void 0 && n[t].urlIconDesc) {
44
- const h = ((y = (x = n[t]) == null ? void 0 : x.percentage) == null ? void 0 : y.length) ?? 0, u = new Image();
45
- u.src = n[t].urlIconDesc, s.drawImage(u, 45 - (h > 6 ? h + 2 : h - 2.5), r - 8, 16, 14);
27
+ const w = (d.chartArea.left + d.chartArea.right) / 2, E = (d.chartArea.top + d.chartArea.bottom) / 2 - b.height / 2;
28
+ let n;
29
+ const D = e.length;
30
+ let i = 0;
31
+ for (n = 0; n < D; ++n) {
32
+ let t = e[n].font?.size, o = e[n].font?.lineHeight;
33
+ const r = typeof e[n].text == "number" ? e[n].text.toString() : e[n].text;
34
+ for (; g(r, t).width > x + (e[n].id === "value" ? 50 : 0); )
35
+ t -= 1, o = g(r, t).height;
36
+ r.length > 22 && o < 14 && (o = 18);
37
+ const p = E + o / 2 + i, h = typeof e[n].text == "number" ? new Intl.NumberFormat("id-ID", { style: "currency", currency: "IDR" }).format(
38
+ e[n].text
39
+ ) : e[n].text;
40
+ let l = e[n].urlIconDesc ? " " : "";
41
+ if (e[n].percentage !== void 0 ? l += `${e[n].percentage}% ${e[n].text}` : l += h, s.fillStyle = e[n].color, s.font = `${t < 10 ? 10 : t}px sans-serif`, i += o, e[n].percentage !== void 0 && e[n].urlIconDesc) {
42
+ const u = e[n]?.percentage?.length ?? 0, c = new Image();
43
+ c.src = e[n].urlIconDesc, s.drawImage(c, 45 - (u > 6 ? u + 2 : u - 2.5), p - 8, 16, 14);
46
44
  }
47
- s.fillText(l, I, r);
45
+ s.fillText(l, w, p);
48
46
  }
49
47
  s.restore(), s.save();
50
48
  }
51
49
  }, V = ({
52
- labels: f,
53
- data: n,
54
- backgroundColor: C,
55
- options: g = {},
50
+ labels: d,
51
+ data: e,
52
+ backgroundColor: I,
53
+ options: f = {},
56
54
  redraw: m,
57
- widthInnerDoughnut: v,
58
- innerLabels: x,
59
- open: y = !0,
60
- keyRemoveDataOpen: $ = "gap",
61
- keyLabel: s = "title",
55
+ widthInnerDoughnut: s,
56
+ innerLabels: v,
57
+ open: g = !0,
58
+ keyRemoveDataOpen: b = "gap",
59
+ keyLabel: x = "title",
62
60
  keyValue: w = "originalValue",
63
- keyBackground: D = "backgroundColor",
64
- className: S
61
+ keyBackground: S = "backgroundColor",
62
+ className: E
65
63
  }) => {
66
- const b = {
67
- labels: f || n.map((i) => i[s]),
64
+ const n = {
65
+ labels: d || e.map((i) => i[x]),
68
66
  datasets: [
69
67
  {
70
- data: n.map((i) => i[w]),
71
- backgroundColor: C || n.map((i) => i[D])
68
+ data: e.map((i) => i[w]),
69
+ backgroundColor: I || e.map((i) => i[S])
72
70
  }
73
71
  ]
74
- }, I = {
75
- cutout: v,
72
+ }, D = {
73
+ cutout: s,
76
74
  animation: { duration: m ? 400 : 0 },
77
75
  plugins: {
78
76
  legend: { display: !1 },
79
77
  tooltip: {
80
78
  external(i) {
81
- let e = document.getElementById("chartjs-tooltip");
82
- e || (e = document.createElement("div"), e.id = "chartjs-tooltip", e.innerHTML = "<table></table>", document.body.appendChild(e));
83
- const t = i.tooltip;
84
- if (t.opacity === 0) {
85
- e.style.opacity = "0";
79
+ let t = document.getElementById("chartjs-tooltip");
80
+ t || (t = document.createElement("div"), t.id = "chartjs-tooltip", t.innerHTML = "<table></table>", document.body.appendChild(t));
81
+ const o = i.tooltip;
82
+ if (o.opacity === 0) {
83
+ t.style.opacity = "0";
86
84
  return;
87
85
  }
88
- e.classList.remove("above", "below", "no-transform"), t.yAlign ? e.classList.add(t.yAlign) : e.classList.add("no-transform");
89
- const z = n.filter((r) => !r[s]), E = n.filter((r) => r[w] > 0 && r[w] < 1);
90
- if (z.length === 1 && E.length === 1) return;
91
- function c(r) {
92
- return r.lines;
86
+ t.classList.remove("above", "below", "no-transform"), o.yAlign ? t.classList.add(o.yAlign) : t.classList.add("no-transform");
87
+ const r = e.filter((c) => !c[x]), p = e.filter((c) => c[w] > 0 && c[w] < 1);
88
+ if (r.length === 1 && p.length === 1) return;
89
+ function h(c) {
90
+ return c.lines;
93
91
  }
94
- if (t.body) {
95
- const r = t.title || [];
96
- let p = t.body.map(c), l = "<thead>";
97
- r.forEach((u) => {
92
+ if (o.body) {
93
+ const c = o.title || [];
94
+ let y = o.body.map(h), C = "<thead>";
95
+ c.forEach(($) => {
98
96
  let a = "";
99
- a += "display: flex", a += "; justify-content: center", a += "; font-weight: 600", a += "; font-size: 12px", a += "; padding: 0px 14px", l += `<tr><span style="${a}">${u}</span></tr>`;
100
- }), l += "</thead><tbody>", p.length > 1 && p[0][0] === p[1][0] && (p = [p[0]]), p.forEach((u) => {
97
+ a += "display: flex", a += "; justify-content: center", a += "; font-weight: 600", a += "; font-size: 12px", a += "; padding: 0px 14px", C += `<tr><span style="${a}">${$}</span></tr>`;
98
+ }), C += "</thead><tbody>", y.length > 1 && y[0][0] === y[1][0] && (y = [y[0]]), y.forEach(($) => {
101
99
  let a = "";
102
100
  a += "display: flex", a += "; justify-content: center", a += "; color: #0163C8", a += "; padding: 0px 14px", a += "; font-size: 12px";
103
- const H = `<span style="${a}">${u}</span>`;
104
- l += `<tr><td>${H}</td></tr>`;
105
- }), l += "</tbody>";
106
- const h = e.querySelector("table");
107
- h && (h.innerHTML = l);
101
+ const B = `<span style="${a}">${$}</span>`;
102
+ C += `<tr><td>${B}</td></tr>`;
103
+ }), C += "</tbody>";
104
+ const z = t.querySelector("table");
105
+ z && (z.innerHTML = C);
108
106
  }
109
- const d = i.chart.canvas.getBoundingClientRect(), o = d.top + window.pageYOffset + t.caretY;
110
- 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 = `${d.left + window.pageXOffset + t.caretX - 80}px`, e.style.top = `${o > 300 && !y ? 280 : o}px`, e.style.pointerEvents = "none";
107
+ const l = i.chart.canvas.getBoundingClientRect(), u = l.top + window.pageYOffset + o.caretY;
108
+ t.style.opacity = "1", t.style.border = "solid 1px #0163C8", t.style.background = "white", t.style.height = "fit-content", t.style.borderRadius = "10px", t.style.position = "absolute", t.style.zIndex = "10", t.style.padding = "4px 0", t.style.left = `${l.left + window.pageXOffset + o.caretX - 80}px`, t.style.top = `${u > 300 && !g ? 280 : u}px`, t.style.pointerEvents = "none";
111
109
  },
112
110
  displayColors: !0,
113
111
  enabled: !1,
114
112
  callbacks: {
115
113
  title(i) {
116
- const e = n[i[0].dataIndex];
117
- return e == null ? void 0 : e[s];
114
+ return e[i[0].dataIndex]?.[x];
118
115
  },
119
116
  label(i) {
120
- const e = n == null ? void 0 : n[i.dataIndex];
121
- let t = "Nilai: ";
122
- return e && (t += e.value), t;
117
+ const t = e?.[i.dataIndex];
118
+ let o = "Nilai: ";
119
+ return t && (o += t.value), o;
123
120
  }
124
121
  }
125
122
  }
@@ -130,27 +127,27 @@ const j = (f, n) => {
130
127
  }
131
128
  }
132
129
  };
133
- return /* @__PURE__ */ L("div", { className: S ?? "", children: [
134
- !y && /* @__PURE__ */ A(
130
+ return /* @__PURE__ */ H("div", { className: E ?? "", children: [
131
+ !g && /* @__PURE__ */ A(
135
132
  T,
136
133
  {
137
- data: b,
134
+ data: n,
138
135
  redraw: m,
139
136
  plugins: [
140
137
  {
141
138
  id: "draw",
142
139
  beforeDraw(i) {
143
- j(i, x);
140
+ j(i, v);
144
141
  }
145
142
  }
146
143
  ],
147
- options: Object.keys(g).length > 1 ? g : I
144
+ options: Object.keys(f).length > 1 ? f : D
148
145
  }
149
146
  ),
150
- y && /* @__PURE__ */ A(
147
+ g && /* @__PURE__ */ A(
151
148
  T,
152
149
  {
153
- data: b,
150
+ data: n,
154
151
  redraw: m,
155
152
  plugins: [
156
153
  {
@@ -158,12 +155,12 @@ const j = (f, n) => {
158
155
  beforeDraw(i) {
159
156
  j(
160
157
  i,
161
- x.filter((e) => e.id !== $)
158
+ v.filter((t) => t.id !== b)
162
159
  );
163
160
  }
164
161
  }
165
162
  ],
166
- options: Object.keys(g).length > 1 ? g : I
163
+ options: Object.keys(f).length > 1 ? f : D
167
164
  }
168
165
  )
169
166
  ] });