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,74 +1,73 @@
1
- import { jsxs as N, jsx as r } from "react/jsx-runtime";
2
- import { useDateFormatter as v } from "react-aria";
3
- import n from "./style.module.scss.mjs";
4
- import $ from "./CalendarButton.mjs";
5
- import { isValidElement as c } from "react";
6
- import { ChevronDownIcon as p } from "./CalendarYear.mjs";
7
- const E = ({
1
+ import { jsxs as h, jsx as o } from "react/jsx-runtime";
2
+ import { useDateFormatter as Y } from "react-aria";
3
+ import r from "./style.module.scss.mjs";
4
+ import y from "./CalendarButton.mjs";
5
+ import { isValidElement as m } from "react";
6
+ import { ChevronDownIcon as D } from "./CalendarYear.mjs";
7
+ const w = ({
8
8
  prevIcon: l,
9
9
  nextIcon: i,
10
10
  state: e,
11
- setActiveTypeCalendar: f,
12
- onChangeMonth: s,
13
- type: u,
14
- hiddenHeader: x
11
+ setActiveTypeCalendar: u,
12
+ onChangeMonth: t,
13
+ type: c,
14
+ hiddenHeader: V
15
15
  }) => {
16
- const g = (/* @__PURE__ */ new Date()).getFullYear(), t = e.focusedDate.calendar.getMonthsInYear(e.focusedDate), C = v({
16
+ const b = (/* @__PURE__ */ new Date()).getFullYear(), N = e.focusedDate.calendar.getMonthsInYear(e.focusedDate), $ = Y({
17
17
  month: "short",
18
18
  timeZone: e.timeZone
19
- }), Y = (a, o) => {
20
- const d = e.focusedDate.set({ month: a });
21
- o ? (f("date"), e.setFocusedDate(d)) : !o && typeof s == "function" && s(d);
22
- }, h = (a) => {
23
- const o = e.focusedDate.set({ year: a });
24
- e.setFocusedDate(o);
19
+ }), p = (n, a) => {
20
+ const s = e.focusedDate.set({ month: n });
21
+ a ? (u("date"), e.setFocusedDate(s)) : !a && typeof t == "function" && t(s);
22
+ }, f = (n) => {
23
+ const a = e.focusedDate.set({ year: n });
24
+ e.setFocusedDate(a);
25
25
  };
26
- return /* @__PURE__ */ N("div", { className: `iru-w-[296px] ${n["container-calendar"]}`, children: [
27
- !x && /* @__PURE__ */ N("div", { className: n["header-calendar"], children: [
28
- /* @__PURE__ */ r(
29
- $,
26
+ return /* @__PURE__ */ h("div", { className: `iru-w-[296px] ${r["container-calendar"]}`, children: [
27
+ !V && /* @__PURE__ */ h("div", { className: r["header-calendar"], children: [
28
+ /* @__PURE__ */ o(
29
+ y,
30
30
  {
31
- isDisabled: e != null && e.minValue ? e.focusedDate.year <= e.minValue.year : !1,
32
- onPress: () => h(e.focusedDate.year - 1),
33
- children: typeof l == "function" || c(l) ? c(l) ? l : l() : /* @__PURE__ */ r(p, { className: "iru-rotate-90" })
31
+ isDisabled: e?.minValue ? e.focusedDate.year <= e.minValue.year : !1,
32
+ onPress: () => f(e.focusedDate.year - 1),
33
+ children: typeof l == "function" || m(l) ? m(l) ? l : l() : /* @__PURE__ */ o(D, { className: "iru-rotate-90" })
34
34
  }
35
35
  ),
36
- /* @__PURE__ */ r(
36
+ /* @__PURE__ */ o(
37
37
  "div",
38
38
  {
39
- className: `${n["header-button-calendar"]} ${u.includes("year") ? "" : n.disabled}`,
39
+ className: `${r["header-button-calendar"]} ${c.includes("year") ? "" : r.disabled}`,
40
40
  onClick: () => {
41
- u.includes("year") && f("year");
41
+ c.includes("year") && u("year");
42
42
  },
43
43
  children: e.focusedDate.year
44
44
  }
45
45
  ),
46
- /* @__PURE__ */ r(
47
- $,
46
+ /* @__PURE__ */ o(
47
+ y,
48
48
  {
49
- isDisabled: e != null && e.maxValue ? e.focusedDate.year >= e.maxValue.year : !1,
50
- onPress: () => h(e.focusedDate.year + 1),
51
- children: typeof i == "function" || c(i) ? c(i) ? i : i() : /* @__PURE__ */ r(p, { className: "-iru-rotate-90" })
49
+ isDisabled: e?.maxValue ? e.focusedDate.year >= e.maxValue.year : !1,
50
+ onPress: () => f(e.focusedDate.year + 1),
51
+ children: typeof i == "function" || m(i) ? m(i) ? i : i() : /* @__PURE__ */ o(D, { className: "-iru-rotate-90" })
52
52
  }
53
53
  )
54
54
  ] }),
55
- /* @__PURE__ */ r("div", { className: n["month-calendar"], children: [...Array(t).keys()].map((a) => {
56
- var y, D, V, b;
57
- const o = e.focusedDate.set({ month: a + 1 }), d = C.format(o.toDate(e.timeZone)), F = ((y = e.value) == null ? void 0 : y.year) || ((V = (D = e.value) == null ? void 0 : D.start) == null ? void 0 : V.year) || g, M = e != null && e.minValue ? o.month < ((b = e == null ? void 0 : e.minValue) == null ? void 0 : b.month) && o.year <= e.minValue.year : !1, k = e != null && e.maxValue ? o.month > e.maxValue.month && o.year >= e.maxValue.year : !1, m = M || k;
58
- return /* @__PURE__ */ r(
55
+ /* @__PURE__ */ o("div", { className: r["month-calendar"], children: [...Array(N).keys()].map((n) => {
56
+ const a = e.focusedDate.set({ month: n + 1 }), s = $.format(a.toDate(e.timeZone)), x = e.value?.year || e.value?.start?.year || b, g = e?.minValue ? a.month < e?.minValue?.month && a.year <= e.minValue.year : !1, C = e?.maxValue ? a.month > e.maxValue.month && a.year >= e.maxValue.year : !1, d = g || C;
57
+ return /* @__PURE__ */ o(
59
58
  "div",
60
59
  {
61
60
  onClick: () => {
62
- m || Y(o.month, u.includes("date"));
61
+ d || p(a.month, c.includes("date"));
63
62
  },
64
- className: `${n["cell-month"]} ${e.focusedDate.month === o.month && !m && o.year === F ? n.selected : ""} ${e.focusedDate.month !== o.month && !m ? "hover:iru-bg-laba-blue-01" : ""} ${m ? "iru-text-gray-400" : "iru-cursor-pointer"}`,
65
- children: d
63
+ className: `${r["cell-month"]} ${e.focusedDate.month === a.month && !d && a.year === x ? r.selected : ""} ${e.focusedDate.month !== a.month && !d ? "hover:iru-bg-laba-blue-01" : ""} ${d ? "iru-text-gray-400" : "iru-cursor-pointer"}`,
64
+ children: s
66
65
  },
67
- a
66
+ n
68
67
  );
69
68
  }) })
70
69
  ] });
71
70
  };
72
71
  export {
73
- E as default
72
+ w as default
74
73
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),l=require("react"),o=require("@internationalized/date"),m=require("react-aria"),A=require("react-stately"),P=require("./CalendarButton.cjs"),r=require("./style.module.scss.cjs"),K=require("./CalendarCell.cjs"),E=require("../Button/Button.cjs"),Y=require("./CalendarMonth.cjs"),f=require("./CalendarYear.cjs"),M=require("./Calendar.cjs"),Z=e=>{var j,g,y,R,D,S,k,T,I,N,q,w;const u=l.useRef(null),{locale:s}=m.useLocale(),i=A.useRangeCalendarState({...e,locale:s,createCalendar:o.createCalendar}),B=n=>{let a="";switch(n){case 0:a="Min";break;case 1:a="Sen";break;case 2:a="Sel";break;case 3:a="Rab";break;case 4:a="Kam";break;case 5:a="Jum";break;case 6:a="Sab";break}return a},{calendarProps:L,prevButtonProps:V,nextButtonProps:_,title:C}=m.useRangeCalendar(e,i,u),{gridProps:z,headerProps:J,weekDays:O}=m.useCalendarGrid({},i),W=o.getWeeksInMonth(i.visibleRange.start,s),[h,x]=l.useState("date"),[c,b]=l.useState({start:void 0,end:void 0}),F=((g=(j=c.start)==null?void 0:j.hour)==null?void 0:g.toString())&&((R=(y=c==null?void 0:c.start)==null?void 0:y.minut)==null?void 0:R.toString())&&((T=(D=e.value)==null?void 0:D.start)==null?void 0:T.toDate(o.getLocalTimeZone()).setHours((S=c.start)==null?void 0:S.hour,(k=c.start)==null?void 0:k.minut))||e.minDate,G=e.maxDate,v=(n,a)=>{const d={...c,[a]:n};b(d),typeof(e==null?void 0:e.handlerChangeTimeRange)=="function"&&e.handlerChangeTimeRange(d)};return l.useEffect(()=>{var n,a;if((n=e.time)!=null&&n.start&&((a=e.time)!=null&&a.end)){const d=e.time.start,H=e.time.end;b({start:d,end:H})}},[JSON.stringify(e.time)]),t.jsxs("div",{className:"iru-text-laba-base-sr",children:[h==="date"&&t.jsx(t.Fragment,{children:t.jsx("div",{...L,ref:u,children:t.jsxs("div",{className:r.default["container-calendar"],children:[t.jsxs("div",{className:"iru-flex iru-gap-2",children:[t.jsxs("div",{children:[t.jsxs("div",{className:r.default["header-calendar"],children:[t.jsx(P.default,{...V,children:typeof(e==null?void 0:e.prevIcon)=="function"||l.isValidElement(e==null?void 0:e.prevIcon)?l.isValidElement(e.prevIcon)?e.prevIcon:e.prevIcon():t.jsx(f.ChevronDownIcon,{className:"iru-rotate-90"})}),t.jsx("div",{className:r.default["header-button-calendar"],onClick:()=>x("month"),children:C}),t.jsx(P.default,{..._,children:typeof(e==null?void 0:e.nextIcon)=="function"||l.isValidElement(e==null?void 0:e.nextIcon)?l.isValidElement(e.nextIcon)?e.nextIcon:e.nextIcon():t.jsx(f.ChevronDownIcon,{className:"-iru-rotate-90"})})]}),t.jsxs("table",{...z,cellPadding:"0",className:"flex-1",children:[t.jsx("thead",{...J,className:"text-gray-600",children:t.jsx("tr",{children:O.map((n,a)=>t.jsx("th",{className:r.default["days-calendar"],children:B(a)},a))})}),t.jsx("tbody",{children:[...new Array(W).keys()].map(n=>t.jsx("tr",{children:i.getDatesInWeek(n).map((a,d)=>a?t.jsx(K.default,{state:i,date:a},d):t.jsx("td",{},d))},n))})]})]}),(e==null?void 0:e.isCustomTime)&&t.jsxs("div",{className:"iru-flex",children:[t.jsx(M.CustomTimeCalendar,{minDate:e.minDate,maxDate:e.maxDate,time:(I=e.time)==null?void 0:I.start,value:(N=e.value)==null?void 0:N.start,timeLabel:"Awal",type:"start",handlerChangeTime:n=>v(n,"start")}),t.jsx(M.CustomTimeCalendar,{minDate:F,maxDate:G,time:(q=e.time)==null?void 0:q.end,value:(w=e.value)==null?void 0:w.end,timeLabel:"Akhir",type:"end",handlerChangeTime:n=>v(n,"end")})]})]}),e.withConfirm&&t.jsxs("div",{className:r.default["footer-calendar"],children:[typeof(e==null?void 0:e.buttonReset)=="function"?t.jsx("div",{onClick:()=>e.handlerReset(i),children:e.buttonReset()}):t.jsx(E.default,{variants:"nude-laba-blue-10",size:"small",onClick:()=>e.handlerReset(i),children:"Reset"}),typeof(e==null?void 0:e.buttonSubmit)=="function"?t.jsx("div",{onClick:e.handlerSubmit,children:e.buttonSubmit()}):t.jsx(E.default,{size:"small",onClick:e.handlerSubmit,children:"Terapkan"})]})]})})}),h==="month"&&t.jsx(Y.default,{state:i,setActiveTypeCalendar:x,type:["date","month","year"]}),h==="year"&&t.jsx(f.default,{state:i,setActiveTypeCalendar:x,title:C,type:["date","month","year"]})]})},Q=e=>{const u=A.useDateRangePickerState(e),s=l.useRef(null),{calendarProps:i}=m.useDateRangePicker(e,u,s);return t.jsx("div",{ref:s,children:t.jsx(Z,{handlerReset:e.handlerReset,handlerSubmit:e.handlerSubmit,withConfirm:e.withConfirm,prevIcon:e.prevIcon,nextIcon:e.nextIcon,buttonReset:e.buttonReset,buttonSubmit:e.buttonSubmit,isCustomTime:e.isCustomTime,time:e.time,minDate:e.minDate,maxDate:e.maxDate,handlerChangeTimeRange:e.handlerChangeTimeRange,...i})})};exports.default=Q;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),l=require("react"),x=require("@internationalized/date"),m=require("react-aria"),y=require("react-stately"),v=require("./CalendarButton.cjs"),d=require("./style.module.scss.cjs"),M=require("./CalendarCell.cjs"),j=require("../Button/Button.cjs"),A=require("./CalendarMonth.cjs"),f=require("./CalendarYear.cjs"),R=require("./Calendar.cjs"),B=e=>{const u=l.useRef(null),{locale:s}=m.useLocale(),i=y.useRangeCalendarState({...e,locale:s,createCalendar:x.createCalendar}),D=n=>{let a="";switch(n){case 0:a="Min";break;case 1:a="Sen";break;case 2:a="Sel";break;case 3:a="Rab";break;case 4:a="Kam";break;case 5:a="Jum";break;case 6:a="Sab";break}return a},{calendarProps:S,prevButtonProps:k,nextButtonProps:T,title:C}=m.useRangeCalendar(e,i,u),{gridProps:I,headerProps:N,weekDays:q}=m.useCalendarGrid({},i),w=x.getWeeksInMonth(i.visibleRange.start,s),[o,h]=l.useState("date"),[r,b]=l.useState({start:void 0,end:void 0}),P=r.start?.hour?.toString()&&r?.start?.minut?.toString()&&e.value?.start?.toDate(x.getLocalTimeZone()).setHours(r.start?.hour,r.start?.minut)||e.minDate,E=e.maxDate,g=(n,a)=>{const c={...r,[a]:n};b(c),typeof e?.handlerChangeTimeRange=="function"&&e.handlerChangeTimeRange(c)};return l.useEffect(()=>{if(e.time?.start&&e.time?.end){const n=e.time.start,a=e.time.end;b({start:n,end:a})}},[JSON.stringify(e.time)]),t.jsxs("div",{className:"iru-text-laba-base-sr",children:[o==="date"&&t.jsx(t.Fragment,{children:t.jsx("div",{...S,ref:u,children:t.jsxs("div",{className:d.default["container-calendar"],children:[t.jsxs("div",{className:"iru-flex iru-gap-2",children:[t.jsxs("div",{children:[t.jsxs("div",{className:d.default["header-calendar"],children:[t.jsx(v.default,{...k,children:typeof e?.prevIcon=="function"||l.isValidElement(e?.prevIcon)?l.isValidElement(e.prevIcon)?e.prevIcon:e.prevIcon():t.jsx(f.ChevronDownIcon,{className:"iru-rotate-90"})}),t.jsx("div",{className:d.default["header-button-calendar"],onClick:()=>h("month"),children:C}),t.jsx(v.default,{...T,children:typeof e?.nextIcon=="function"||l.isValidElement(e?.nextIcon)?l.isValidElement(e.nextIcon)?e.nextIcon:e.nextIcon():t.jsx(f.ChevronDownIcon,{className:"-iru-rotate-90"})})]}),t.jsxs("table",{...I,cellPadding:"0",className:"flex-1",children:[t.jsx("thead",{...N,className:"text-gray-600",children:t.jsx("tr",{children:q.map((n,a)=>t.jsx("th",{className:d.default["days-calendar"],children:D(a)},a))})}),t.jsx("tbody",{children:[...new Array(w).keys()].map(n=>t.jsx("tr",{children:i.getDatesInWeek(n).map((a,c)=>a?t.jsx(M.default,{state:i,date:a},c):t.jsx("td",{},c))},n))})]})]}),e?.isCustomTime&&t.jsxs("div",{className:"iru-flex",children:[t.jsx(R.CustomTimeCalendar,{minDate:e.minDate,maxDate:e.maxDate,time:e.time?.start,value:e.value?.start,timeLabel:"Awal",type:"start",handlerChangeTime:n=>g(n,"start")}),t.jsx(R.CustomTimeCalendar,{minDate:P,maxDate:E,time:e.time?.end,value:e.value?.end,timeLabel:"Akhir",type:"end",handlerChangeTime:n=>g(n,"end")})]})]}),e.withConfirm&&t.jsxs("div",{className:d.default["footer-calendar"],children:[typeof e?.buttonReset=="function"?t.jsx("div",{onClick:()=>e.handlerReset(i),children:e.buttonReset()}):t.jsx(j.default,{variants:"nude-laba-blue-10",size:"small",onClick:()=>e.handlerReset(i),children:"Reset"}),typeof e?.buttonSubmit=="function"?t.jsx("div",{onClick:e.handlerSubmit,children:e.buttonSubmit()}):t.jsx(j.default,{size:"small",onClick:e.handlerSubmit,children:"Terapkan"})]})]})})}),o==="month"&&t.jsx(A.default,{state:i,setActiveTypeCalendar:h,type:["date","month","year"]}),o==="year"&&t.jsx(f.default,{state:i,setActiveTypeCalendar:h,title:C,type:["date","month","year"]})]})},L=e=>{const u=y.useDateRangePickerState(e),s=l.useRef(null),{calendarProps:i}=m.useDateRangePicker(e,u,s);return t.jsx("div",{ref:s,children:t.jsx(B,{handlerReset:e.handlerReset,handlerSubmit:e.handlerSubmit,withConfirm:e.withConfirm,prevIcon:e.prevIcon,nextIcon:e.nextIcon,buttonReset:e.buttonReset,buttonSubmit:e.buttonSubmit,isCustomTime:e.isCustomTime,time:e.time,minDate:e.minDate,maxDate:e.maxDate,handlerChangeTimeRange:e.handlerChangeTimeRange,...i})})};exports.default=L;
@@ -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
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=$;
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
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
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,74 +1,73 @@
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
- d: `M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 \r
15
- 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
14
+ d: `M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8
15
+ 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
16
16
  0s-12.5 32.8 0 45.3l192 192z`
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;