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.
- package/dist/assets/_mixins.scss +72 -72
- package/dist/assets/icons/arrow-narrow-down.svg +3 -3
- package/dist/assets/style.css +1 -1
- package/dist/components/Alert/index.cjs +1 -1
- package/dist/components/Alert/index.mjs +40 -40
- package/dist/components/Breadcrumbs/Breadcrumbs.cjs +3 -3
- package/dist/components/Breadcrumbs/Breadcrumbs.mjs +43 -43
- package/dist/components/Button/Button.cjs +12 -12
- package/dist/components/Button/Button.config.cjs +1 -1
- package/dist/components/Button/Button.config.mjs +3 -1
- package/dist/components/Button/Button.mjs +24 -24
- package/dist/components/Button/style.module.scss.cjs +1 -1
- package/dist/components/Button/style.module.scss.mjs +57 -55
- package/dist/components/ButtonIcon/ButtonIcon.cjs +12 -12
- package/dist/components/ButtonIcon/ButtonIcon.mjs +20 -20
- package/dist/components/ButtonPopover/ButtonPopover.cjs +1 -1
- package/dist/components/ButtonPopover/ButtonPopover.mjs +28 -31
- package/dist/components/Calendar/Calendar.cjs +1 -1
- package/dist/components/Calendar/Calendar.mjs +98 -100
- package/dist/components/Calendar/CalendarMonth.cjs +1 -1
- package/dist/components/Calendar/CalendarMonth.mjs +41 -42
- package/dist/components/Calendar/CalendarRange.cjs +1 -1
- package/dist/components/Calendar/CalendarRange.mjs +59 -61
- package/dist/components/Calendar/CalendarYear.cjs +3 -3
- package/dist/components/Calendar/CalendarYear.mjs +39 -40
- package/dist/components/Chart/DoughnutChart.cjs +1 -1
- package/dist/components/Chart/DoughnutChart.mjs +93 -96
- package/dist/components/Chart/GradientBarChart.cjs +1 -1
- package/dist/components/Chart/GradientBarChart.mjs +80 -81
- package/dist/components/Chart/GradientLineChart.cjs +1 -1
- package/dist/components/Chart/GradientLineChart.mjs +50 -51
- package/dist/components/Chart/LineChart.cjs +1 -1
- package/dist/components/Chart/LineChart.mjs +23 -23
- package/dist/components/Chart/PieChart.cjs +1 -1
- package/dist/components/Chart/PieChart.mjs +45 -48
- package/dist/components/Collapse/Collapse.cjs +1 -1
- package/dist/components/Collapse/Collapse.mjs +23 -24
- package/dist/components/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/DatePicker/DatePicker.mjs +86 -89
- package/dist/components/DatePicker/DateRangePicker.cjs +1 -1
- package/dist/components/DatePicker/DateRangePicker.mjs +91 -92
- package/dist/components/DatePicker/FilterDate.cjs +1 -1
- package/dist/components/DatePicker/FilterDate.mjs +107 -110
- package/dist/components/DatePicker/MonthYearPicker.cjs +1 -1
- package/dist/components/DatePicker/MonthYearPicker.mjs +51 -53
- package/dist/components/FilterContainer/FilterContainer.cjs +1 -1
- package/dist/components/FilterContainer/FilterContainer.mjs +27 -27
- package/dist/components/Input/InputFloatingInner.cjs +5 -5
- package/dist/components/Input/InputFloatingInner.mjs +24 -25
- package/dist/components/NumberFormat/NumberFormat.cjs +1 -1
- package/dist/components/NumberFormat/NumberFormat.mjs +12 -13
- package/dist/components/Pagination/Pagination.cjs +2 -2
- package/dist/components/Pagination/Pagination.mjs +76 -80
- package/dist/components/SelectDropdownContainer/SelectDropdownContainer.cjs +1 -1
- package/dist/components/SelectDropdownContainer/SelectDropdownContainer.mjs +98 -102
- package/dist/components/Sidebar/ItemSidebar.cjs +8 -8
- package/dist/components/Sidebar/ItemSidebar.mjs +71 -72
- package/dist/components/Sidebar/Sidebar.cjs +1 -1
- package/dist/components/Sidebar/Sidebar.mjs +65 -68
- package/dist/components/Slider/Slider.cjs +1 -0
- package/dist/components/Slider/Slider.mjs +61 -0
- package/dist/components/Slider/style.module.scss.cjs +1 -0
- package/dist/components/Slider/style.module.scss.mjs +14 -0
- package/dist/components/Step/Step.cjs +5 -5
- package/dist/components/Step/Step.mjs +52 -52
- package/dist/components/Table/Table.cjs +3 -3
- package/dist/components/Table/Table.mjs +275 -298
- package/dist/components/Table/TableSubMobile.cjs +1 -1
- package/dist/components/Table/TableSubMobile.mjs +32 -35
- package/dist/components/Tabs/Tabs.cjs +8 -8
- package/dist/components/Tabs/Tabs.mjs +66 -70
- package/dist/components/Textarea/Textarea.cjs +7 -7
- package/dist/components/Textarea/Textarea.mjs +47 -50
- package/dist/components/Textarea/TextareaFloatingInner.cjs +6 -6
- package/dist/components/Textarea/TextareaFloatingInner.mjs +56 -61
- package/dist/components/Textarea/TextareaInnerLabel.cjs +6 -6
- package/dist/components/Textarea/TextareaInnerLabel.mjs +47 -50
- package/dist/components/TimeRange/TimeRange.cjs +1 -1
- package/dist/components/TimeRange/TimeRange.mjs +88 -91
- package/dist/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/components/Tooltip/Tooltip.mjs +44 -46
- package/dist/components/Upload/UploadFile.cjs +1 -1
- package/dist/components/Upload/UploadFile.mjs +50 -54
- package/dist/components/Upload/UploadImage.cjs +12 -12
- package/dist/components/Upload/UploadImage.mjs +73 -79
- package/dist/components/Upload/UploadMultipleFile.cjs +1 -1
- package/dist/components/Upload/UploadMultipleFile.mjs +61 -62
- package/dist/components/Virtualization/ListVirtualization.cjs +1 -1
- package/dist/components/Virtualization/ListVirtualization.mjs +52 -55
- package/dist/components/Virtualization/TableVirtualization.cjs +1 -1
- package/dist/components/Virtualization/TableVirtualization.mjs +56 -59
- package/dist/config/components/tinymce.cjs +2 -2
- package/dist/config/components/tinymce.mjs +3 -3
- package/dist/hooks/useCountdown.cjs +1 -1
- package/dist/hooks/useCountdown.mjs +15 -15
- package/dist/hooks/useDebounce.cjs +1 -1
- package/dist/hooks/useDebounce.mjs +19 -19
- package/dist/hooks/useOtpInput.cjs +1 -1
- package/dist/hooks/useOtpInput.mjs +47 -51
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +48 -46
- package/dist/package.json.cjs +1 -1
- package/dist/package.json.d.ts +129 -128
- package/dist/package.json.mjs +1 -1
- package/dist/src/components/Button/Button.config.d.ts +2 -0
- package/dist/src/components/Slider/Slider.d.ts +3 -0
- package/dist/src/components/Slider/Slider.stories.d.ts +6 -0
- package/dist/src/components/index.d.ts +4 -2
- package/dist/src/interfaces/components/Button/index.d.ts +1 -1
- package/dist/src/interfaces/components/Slider/index.d.ts +51 -0
- package/dist/types-external/table.d.ts +15 -15
- package/dist/utils/common.cjs +1 -1
- package/dist/utils/common.mjs +172 -173
- package/package.json +128 -128
|
@@ -1,74 +1,73 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useDateFormatter as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { isValidElement as
|
|
6
|
-
import { ChevronDownIcon as
|
|
7
|
-
const
|
|
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:
|
|
12
|
-
onChangeMonth:
|
|
13
|
-
type:
|
|
14
|
-
hiddenHeader:
|
|
11
|
+
setActiveTypeCalendar: u,
|
|
12
|
+
onChangeMonth: t,
|
|
13
|
+
type: c,
|
|
14
|
+
hiddenHeader: V
|
|
15
15
|
}) => {
|
|
16
|
-
const
|
|
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
|
-
}),
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
const
|
|
24
|
-
e.setFocusedDate(
|
|
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__ */
|
|
27
|
-
!
|
|
28
|
-
/* @__PURE__ */
|
|
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
|
|
32
|
-
onPress: () =>
|
|
33
|
-
children: typeof l == "function" ||
|
|
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__ */
|
|
36
|
+
/* @__PURE__ */ o(
|
|
37
37
|
"div",
|
|
38
38
|
{
|
|
39
|
-
className: `${
|
|
39
|
+
className: `${r["header-button-calendar"]} ${c.includes("year") ? "" : r.disabled}`,
|
|
40
40
|
onClick: () => {
|
|
41
|
-
|
|
41
|
+
c.includes("year") && u("year");
|
|
42
42
|
},
|
|
43
43
|
children: e.focusedDate.year
|
|
44
44
|
}
|
|
45
45
|
),
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
-
|
|
46
|
+
/* @__PURE__ */ o(
|
|
47
|
+
y,
|
|
48
48
|
{
|
|
49
|
-
isDisabled: e
|
|
50
|
-
onPress: () =>
|
|
51
|
-
children: typeof i == "function" ||
|
|
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__ */
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
|
|
61
|
+
d || p(a.month, c.includes("date"));
|
|
63
62
|
},
|
|
64
|
-
className: `${
|
|
65
|
-
children:
|
|
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
|
-
|
|
66
|
+
n
|
|
68
67
|
);
|
|
69
68
|
}) })
|
|
70
69
|
] });
|
|
71
70
|
};
|
|
72
71
|
export {
|
|
73
|
-
|
|
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"),
|
|
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
|
|
2
|
-
import
|
|
3
|
-
import { createCalendar as
|
|
4
|
-
import { useDateRangePicker as
|
|
5
|
-
import { useDateRangePickerState as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { CustomTimeCalendar as
|
|
13
|
-
const
|
|
14
|
-
|
|
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:
|
|
18
|
-
createCalendar:
|
|
19
|
-
}),
|
|
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:
|
|
46
|
-
const
|
|
47
|
-
...
|
|
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(
|
|
49
|
+
C(c), typeof e?.handlerChangeTimeRange == "function" && e.handlerChangeTimeRange(c);
|
|
51
50
|
};
|
|
52
|
-
return
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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__ */
|
|
59
|
-
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
/* @__PURE__ */
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
/* @__PURE__ */ t(
|
|
64
|
-
/* @__PURE__ */ t("div", { className:
|
|
65
|
-
/* @__PURE__ */ t(
|
|
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__ */
|
|
68
|
-
/* @__PURE__ */ t("thead", { ...
|
|
69
|
-
/* @__PURE__ */ t("tbody", { children: [...new Array(
|
|
70
|
-
(a,
|
|
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
|
-
|
|
72
|
+
e?.isCustomTime && /* @__PURE__ */ r("div", { className: "iru-flex", children: [
|
|
75
73
|
/* @__PURE__ */ t(
|
|
76
|
-
|
|
74
|
+
D,
|
|
77
75
|
{
|
|
78
76
|
minDate: e.minDate,
|
|
79
77
|
maxDate: e.maxDate,
|
|
80
|
-
time:
|
|
81
|
-
value:
|
|
78
|
+
time: e.time?.start,
|
|
79
|
+
value: e.value?.start,
|
|
82
80
|
timeLabel: "Awal",
|
|
83
81
|
type: "start",
|
|
84
|
-
handlerChangeTime: (n) =>
|
|
82
|
+
handlerChangeTime: (n) => g(n, "start")
|
|
85
83
|
}
|
|
86
84
|
),
|
|
87
85
|
/* @__PURE__ */ t(
|
|
88
|
-
|
|
86
|
+
D,
|
|
89
87
|
{
|
|
90
|
-
minDate:
|
|
91
|
-
maxDate:
|
|
92
|
-
time:
|
|
93
|
-
value:
|
|
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) =>
|
|
94
|
+
handlerChangeTime: (n) => g(n, "end")
|
|
97
95
|
}
|
|
98
96
|
)
|
|
99
97
|
] })
|
|
100
98
|
] }),
|
|
101
|
-
e.withConfirm && /* @__PURE__ */
|
|
102
|
-
typeof
|
|
103
|
-
typeof
|
|
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
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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
|
-
},
|
|
118
|
-
const
|
|
119
|
-
return /* @__PURE__ */ t("div", { ref:
|
|
120
|
-
|
|
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
|
-
|
|
137
|
+
re as default
|
|
140
138
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
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`})})
|
|
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
|
|
2
|
-
import
|
|
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
|
|
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 ${
|
|
9
|
+
className: `iru-h-4 iru-w-4 iru-text-blue-700 ${d ?? ""}`,
|
|
10
10
|
viewBox: "0 0 512 512",
|
|
11
|
-
children: /* @__PURE__ */
|
|
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
|
|
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
|
|
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
|
-
),
|
|
21
|
-
title:
|
|
22
|
-
state:
|
|
23
|
-
type:
|
|
24
|
-
setUpYear:
|
|
25
|
-
hiddenHeader:
|
|
26
|
-
setActiveTypeCalendar:
|
|
27
|
-
onChangeYear:
|
|
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
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
return
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
}, []), /* @__PURE__ */
|
|
37
|
-
!
|
|
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"]} ${
|
|
40
|
+
className: `${l["header-button-calendar"]} ${n.includes("date") || n.includes("month") ? "" : l.disabled}`,
|
|
41
41
|
onClick: () => {
|
|
42
|
-
|
|
42
|
+
n.includes("date") ? i("date") : n.includes("month") && i("month");
|
|
43
43
|
},
|
|
44
44
|
children: [
|
|
45
|
-
|
|
45
|
+
d,
|
|
46
46
|
" ",
|
|
47
|
-
(
|
|
47
|
+
(n.includes("date") || n.includes("month")) && /* @__PURE__ */ o($, {})
|
|
48
48
|
]
|
|
49
49
|
}
|
|
50
50
|
) }),
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
-
(
|
|
53
|
-
|
|
54
|
-
|
|
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-${
|
|
57
|
+
id: `calendar-year-${r}`,
|
|
59
58
|
onClick: () => {
|
|
60
|
-
|
|
59
|
+
s || y(e, n.includes("month"));
|
|
61
60
|
},
|
|
62
|
-
className: `${l["cell-year"]} ${
|
|
63
|
-
children:
|
|
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
|
-
|
|
64
|
+
r
|
|
66
65
|
);
|
|
67
66
|
}
|
|
68
67
|
) })
|
|
69
68
|
] });
|
|
70
69
|
};
|
|
71
70
|
export {
|
|
72
|
-
|
|
73
|
-
|
|
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
|
|
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;
|