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.
- 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/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 +2 -2
- package/dist/components/Calendar/CalendarYear.mjs +37 -38
- 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/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 +3 -3
- package/dist/components/Upload/UploadImage.mjs +62 -68
- 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/package.json.cjs +1 -1
- package/dist/package.json.d.ts +5 -4
- package/dist/package.json.mjs +1 -1
- package/dist/utils/common.cjs +1 -1
- package/dist/utils/common.mjs +172 -173
- package/package.json +4 -4
|
@@ -1,112 +1,111 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { useLocale as
|
|
4
|
-
import
|
|
5
|
-
import { toCalendarDate as
|
|
6
|
-
import
|
|
7
|
-
const
|
|
8
|
-
let
|
|
9
|
-
const
|
|
10
|
-
return
|
|
11
|
-
},
|
|
12
|
-
const
|
|
13
|
-
return
|
|
14
|
-
},
|
|
1
|
+
import { jsx as S, jsxs as Z } from "react/jsx-runtime";
|
|
2
|
+
import A, { useEffect as q } from "react";
|
|
3
|
+
import { useLocale as z, I18nProvider as B } from "react-aria";
|
|
4
|
+
import K from "../Calendar/CalendarRange.mjs";
|
|
5
|
+
import { toCalendarDate as L, fromDate as P, getLocalTimeZone as c, createCalendar as Q, parseDate as U, CalendarDate as Y } from "@internationalized/date";
|
|
6
|
+
import W from "../Calendar/Calendar.mjs";
|
|
7
|
+
const R = (o) => {
|
|
8
|
+
let e;
|
|
9
|
+
const n = new Date(o ?? /* @__PURE__ */ new Date());
|
|
10
|
+
return o && (e = U(new Date(n.setHours(n.getHours() + 7)).toISOString().slice(0, 10))), e;
|
|
11
|
+
}, j = (o) => {
|
|
12
|
+
const e = new Date(o?.startDate ?? /* @__PURE__ */ new Date()), n = new Date(o?.endDate ?? /* @__PURE__ */ new Date()), s = new Y(e.getFullYear(), e.getMonth() + 1, e.getDate()), d = new Y(n.getFullYear(), n.getMonth() + 1, n.getDate());
|
|
13
|
+
return o ? { start: s, end: d } : void 0;
|
|
14
|
+
}, nt = (o) => {
|
|
15
15
|
const {
|
|
16
|
-
minDate:
|
|
17
|
-
maxDate:
|
|
16
|
+
minDate: e,
|
|
17
|
+
maxDate: n,
|
|
18
18
|
defaultValue: s,
|
|
19
|
-
withConfirm:
|
|
20
|
-
prevIcon:
|
|
21
|
-
nextIcon:
|
|
22
|
-
buttonReset:
|
|
23
|
-
buttonSubmit:
|
|
24
|
-
typePicker:
|
|
25
|
-
onChange:
|
|
26
|
-
value:
|
|
27
|
-
onReset:
|
|
28
|
-
isCustomTime:
|
|
29
|
-
} =
|
|
30
|
-
typeof
|
|
31
|
-
},
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
j.getTime() < k.getTime() && A({ startDate: j, endDate: k });
|
|
19
|
+
withConfirm: d,
|
|
20
|
+
prevIcon: H,
|
|
21
|
+
nextIcon: x,
|
|
22
|
+
buttonReset: y,
|
|
23
|
+
buttonSubmit: T,
|
|
24
|
+
typePicker: M = "RANGE",
|
|
25
|
+
onChange: E,
|
|
26
|
+
value: D,
|
|
27
|
+
onReset: I,
|
|
28
|
+
isCustomTime: l
|
|
29
|
+
} = o, { locale: k } = z(), N = R(e), V = R(n), [r, g] = A.useState(), [h, w] = A.useState({ start: void 0, end: void 0 }), b = (t) => {
|
|
30
|
+
typeof E == "function" && E(t);
|
|
31
|
+
}, p = (t, a) => {
|
|
32
|
+
const i = t.start.toDate(c()), u = t.end.toDate(c());
|
|
33
|
+
g(t), w({ start: { hour: 0, minut: 0, second: 0 }, end: { hour: 23, minut: 59, second: 59 } }), (a ?? !d) && b({ startDate: i, endDate: new Date(u.setHours(23, 59, 59)) });
|
|
34
|
+
}, C = (t, a) => {
|
|
35
|
+
if (r?.start && r?.end && (w(t), t.start?.hour?.toString() && t.start?.minut?.toString() && t.end?.hour?.toString() && t.end?.minut?.toString() && (a ?? !d))) {
|
|
36
|
+
const i = r.start.toDate(c()), u = r.end.toDate(c()), m = new Date(i.setHours(t.start.hour, t.start.minut)), f = new Date(u.setHours(t.end.hour, t.end.minut, 59));
|
|
37
|
+
m.getTime() < f.getTime() && b({ startDate: m, endDate: f });
|
|
39
38
|
}
|
|
40
|
-
},
|
|
41
|
-
if (typeof
|
|
42
|
-
|
|
39
|
+
}, F = (t) => {
|
|
40
|
+
if (typeof I == "function")
|
|
41
|
+
I();
|
|
43
42
|
else if (s && t) {
|
|
44
|
-
const
|
|
45
|
-
month:
|
|
46
|
-
year:
|
|
43
|
+
const a = new Date(s.endDate ?? /* @__PURE__ */ new Date()), i = t.focusedDate.set({
|
|
44
|
+
month: a.getMonth() + 1,
|
|
45
|
+
year: a.getFullYear()
|
|
47
46
|
});
|
|
48
|
-
t.setFocusedDate(
|
|
47
|
+
t.setFocusedDate(i);
|
|
49
48
|
}
|
|
50
|
-
|
|
51
|
-
},
|
|
52
|
-
|
|
49
|
+
g(j(s));
|
|
50
|
+
}, G = () => {
|
|
51
|
+
r && (l ? C(h, !0) : p(r, !0));
|
|
53
52
|
};
|
|
54
|
-
return
|
|
55
|
-
if (
|
|
56
|
-
const t = new Date(
|
|
57
|
-
|
|
53
|
+
return q(() => {
|
|
54
|
+
if (D?.endDate && D?.startDate) {
|
|
55
|
+
const t = new Date(D.startDate), a = new Date(D.endDate), i = t.getHours(), u = t.getMinutes(), m = a.getHours(), f = a.getMinutes(), O = L(P(t, c())), J = L(P(a, c()));
|
|
56
|
+
g({ start: O, end: J }), w({ start: { hour: i, minut: u }, end: { hour: m, minut: f } });
|
|
58
57
|
}
|
|
59
|
-
}, [JSON.stringify(
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
}, [JSON.stringify(D)]), /* @__PURE__ */ S("div", { className: "iru-flex iru-flex-col", children: /* @__PURE__ */ Z(B, { locale: "id-ID", children: [
|
|
59
|
+
M === "RANGE" && /* @__PURE__ */ S(
|
|
60
|
+
K,
|
|
62
61
|
{
|
|
63
|
-
defaultValue:
|
|
64
|
-
value:
|
|
65
|
-
minValue:
|
|
66
|
-
maxValue:
|
|
67
|
-
withConfirm:
|
|
68
|
-
prevIcon:
|
|
69
|
-
nextIcon:
|
|
70
|
-
buttonReset:
|
|
71
|
-
buttonSubmit:
|
|
72
|
-
onChange: (t) =>
|
|
73
|
-
isCustomTime:
|
|
74
|
-
handlerReset:
|
|
75
|
-
handlerSubmit:
|
|
76
|
-
time:
|
|
77
|
-
minDate:
|
|
78
|
-
maxDate:
|
|
79
|
-
handlerChangeTimeRange:
|
|
62
|
+
defaultValue: j(s),
|
|
63
|
+
value: r,
|
|
64
|
+
minValue: N,
|
|
65
|
+
maxValue: V,
|
|
66
|
+
withConfirm: d,
|
|
67
|
+
prevIcon: H,
|
|
68
|
+
nextIcon: x,
|
|
69
|
+
buttonReset: y,
|
|
70
|
+
buttonSubmit: T,
|
|
71
|
+
onChange: (t) => p(t),
|
|
72
|
+
isCustomTime: l,
|
|
73
|
+
handlerReset: F,
|
|
74
|
+
handlerSubmit: G,
|
|
75
|
+
time: h,
|
|
76
|
+
minDate: e,
|
|
77
|
+
maxDate: n,
|
|
78
|
+
handlerChangeTimeRange: C
|
|
80
79
|
}
|
|
81
80
|
),
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
M === "SINGLE" && /* @__PURE__ */ S(
|
|
82
|
+
W,
|
|
84
83
|
{
|
|
85
|
-
defaultValue:
|
|
86
|
-
value:
|
|
87
|
-
minValue:
|
|
88
|
-
maxValue:
|
|
89
|
-
minDate:
|
|
90
|
-
maxDate:
|
|
91
|
-
withConfirm:
|
|
92
|
-
prevIcon:
|
|
93
|
-
nextIcon:
|
|
94
|
-
buttonReset:
|
|
95
|
-
buttonSubmit:
|
|
96
|
-
locale:
|
|
97
|
-
time:
|
|
84
|
+
defaultValue: R(s?.endDate),
|
|
85
|
+
value: r?.end,
|
|
86
|
+
minValue: N,
|
|
87
|
+
maxValue: V,
|
|
88
|
+
minDate: e,
|
|
89
|
+
maxDate: n,
|
|
90
|
+
withConfirm: d,
|
|
91
|
+
prevIcon: H,
|
|
92
|
+
nextIcon: x,
|
|
93
|
+
buttonReset: y,
|
|
94
|
+
buttonSubmit: T,
|
|
95
|
+
locale: k,
|
|
96
|
+
time: h,
|
|
98
97
|
typeTime: "RANGE",
|
|
99
|
-
handlerChangeTime:
|
|
100
|
-
isCustomTime:
|
|
101
|
-
createCalendar:
|
|
102
|
-
onChange: (t) =>
|
|
103
|
-
handlerReset:
|
|
104
|
-
handlerSubmit:
|
|
98
|
+
handlerChangeTime: C,
|
|
99
|
+
isCustomTime: l,
|
|
100
|
+
createCalendar: Q,
|
|
101
|
+
onChange: (t) => p({ start: t, end: t }),
|
|
102
|
+
handlerReset: F,
|
|
103
|
+
handlerSubmit: G,
|
|
105
104
|
type: ["date", "month", "year"]
|
|
106
105
|
}
|
|
107
106
|
)
|
|
108
107
|
] }) });
|
|
109
108
|
};
|
|
110
109
|
export {
|
|
111
|
-
|
|
110
|
+
nt as default
|
|
112
111
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),n=require("react"),L=require("./DateRangePicker.cjs"),Q=require("../Popover/Popover.cjs"),h=require("../Calendar/style.module.scss.cjs"),m=require("../../utils/common.cjs"),U=require("../Button/Button.cjs"),X=({value:r,prevIcon:v,nextIcon:F,buttonReset:k,buttonSubmit:T,className:K,classNameButton:q,buttonClick:i,buttonList:g,typePicker:H="RANGE",onChange:j,idPopover:N="filter-date-popover",id:R="filter-date",floatingOptions:W={},offsetPopover:P=5,zIndexPopper:B=0,defaultValueLabel:c,isCustomTime:E=!1,mountedExecuteChange:O=!0,formatingDate:u})=>{const w=[{key:"thisDay",value:"Hari ini"},{key:"thisWeek",value:"Minggu ini"},{key:"thisMonth",value:"Bulan ini"},{key:"thisYear",value:"Tahun ini"},{key:"yesterday",value:"Kemarin"},{key:"lastWeek",value:"Minggu lalu"},{key:"lastMonth",value:"Bulan lalu"},{key:"lastYear",value:"Tahun lalu"},{key:"custom",value:"Kustom"}],S=n.useRef(null),[b,M]=n.useState(),[$,o]=n.useState(),[x,Y]=n.useState(),D=(e,t)=>{const a=new Date(e??new Date);return t==="start"?new Date(a.setHours(0,0,0)):new Date(a.setHours(23,59,59))},_=()=>{const e=new Date;return{startDate:e,endDate:e}},z=()=>{const e=new Date;e.setDate(e.getDate()-e.getDay());const t=new Date;return t.setDate(t.getDate()+(6-t.getDay())),{startDate:e,endDate:t}},V=()=>{const e=new Date,t=new Date(e.getFullYear(),e.getMonth(),1),a=new Date(e.getFullYear(),e.getMonth()+1,0);return{startDate:t,endDate:a}},A=()=>{const e=new Date(new Date().getFullYear(),0,1),t=new Date(new Date().getFullYear(),11,31);return{startDate:e,endDate:t}},G=()=>{const e=new Date(new Date().setDate(new Date().getDate()-1));return{startDate:e,endDate:e}},I=()=>{const e=new Date;e.setDate(e.getDate()-(7+e.getDay()));const t=new Date;return t.setDate(t.getDate()-(t.getDay()+1)),{startDate:e,endDate:t}},J=()=>{const e=new Date,t=new Date(e.getFullYear(),e.getMonth()-1,1),a=new Date(e.getFullYear(),e.getMonth(),0);return{startDate:t,endDate:a}},C=()=>{const e=new Date(new Date().getFullYear()-1,0,1),t=new Date(new Date().getFullYear()-1,11,31);return{startDate:e,endDate:t}},d=(e,t,a)=>{if(Y(e),typeof j=="function"){let l=e;u==="string"&&e?l={startDate:m.formatDate(e.startDate,u),endDate:m.formatDate(e.endDate,u)}:typeof u=="boolean"&&e&&(l={startDate:m.formatDate(e.startDate,"yyyy-MM-dd'T'HH:mm:ss.SSSxxx"),endDate:m.formatDate(e.endDate,"yyyy-MM-dd'T'HH:mm:ss.SSSxxx")}),S.current?.setShow(!1),j(l,t??"",a)}},f=(e,t)=>{M(e);let a;if(e?.key!=="custom"){switch(o(e),e?.key){case"thisDay":a=_();break;case"thisWeek":a=z();break;case"thisMonth":a=V();break;case"thisYear":a=A();break;case"yesterday":a=G();break;case"lastWeek":a=I();break;case"lastMonth":a=J();break;case"lastYear":a=C();break}a&&t&&d({startDate:D(a.startDate,"start"),endDate:D(a.endDate,"end")},e?.value,e)}},y=(e,t)=>{const a=(g??w).find(l=>l.key===e);!e&&!a?(t&&d(),f(void 0,t),o(void 0)):typeof e=="object"?(t&&d({startDate:D(e.startDate,"start"),endDate:D(e.endDate,"end")},"Kustom",{key:"custom",value:"Kustom"}),f({key:"custom",value:"Kustom"},t),o({key:"custom",value:"Kustom"})):(f(a,t),o(a))},p=()=>{if(r){Y(r);const e=(g??w)?.find(t=>t.key===r.label||t.value===r.label);Object.keys(e||{}).length>0&&M(e)}else M(void 0),o(void 0)};return n.useEffect(()=>{p()},[JSON.stringify(r)]),n.useEffect(()=>{y(c??r,O)},[]),s.jsxs(s.Fragment,{children:[s.jsxs("div",{onClick:e=>{S.current?.handlerShow(e),p()},className:q,id:R,children:[n.isValidElement(i)&&i,typeof i=="function"?i(x,$):"Pilih Filter"]}),s.jsx(Q.default,{zIndex:B,ref:S,offset:P,id:N,floatingOptions:{placement:"bottom-end",...W},children:s.jsxs("div",{className:`${h.default["container-filter-date"]} ${K}`,children:[s.jsxs("div",{children:[(g??w).map((e,t)=>s.jsx("div",{className:`${h.default["button-filter-date"]} hover:iru-bg-laba-blue-01 ${b?.key===e.key?"iru-text-laba-blue-10":""}`,onClick:()=>f(e,!0),children:e.value},t)),b?.key!=="custom"&&s.jsx(s.Fragment,{children:typeof k=="function"?s.jsx("div",{className:h.default["button-filter-date-custome"],onClick:()=>y(c,!0),children:k()}):s.jsx(U.default,{className:h.default["button-reset-filter-date"],variants:"nude-laba-blue-10",size:"small",onClick:()=>y(c,!0),children:"Reset"})})]}),b?.key==="custom"&&s.jsx("div",{children:s.jsx(L.default,{defaultValue:x,value:x,prevIcon:v,nextIcon:F,buttonReset:k,buttonSubmit:T,isCustomTime:E,onChange:e=>{d(e,"Kustom",{key:"custom",value:"Kustom"}),o({key:"custom",value:"Kustom"})},onReset:()=>{y(c,!0)},typePicker:H,withConfirm:!0})})]})})]})};exports.default=X;
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { formatDate as
|
|
7
|
-
import
|
|
8
|
-
const
|
|
9
|
-
value:
|
|
10
|
-
prevIcon:
|
|
11
|
-
nextIcon:
|
|
12
|
-
buttonReset:
|
|
13
|
-
buttonSubmit:
|
|
14
|
-
className:
|
|
15
|
-
classNameButton:
|
|
16
|
-
buttonClick:
|
|
17
|
-
buttonList:
|
|
18
|
-
typePicker:
|
|
19
|
-
onChange:
|
|
20
|
-
idPopover:
|
|
21
|
-
id:
|
|
22
|
-
floatingOptions:
|
|
23
|
-
offsetPopover:
|
|
24
|
-
zIndexPopper:
|
|
25
|
-
defaultValueLabel:
|
|
26
|
-
isCustomTime:
|
|
27
|
-
mountedExecuteChange:
|
|
28
|
-
formatingDate:
|
|
1
|
+
import { jsxs as m, Fragment as T, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import o, { isValidElement as X } from "react";
|
|
3
|
+
import Z from "./DateRangePicker.mjs";
|
|
4
|
+
import _ from "../Popover/Popover.mjs";
|
|
5
|
+
import h from "../Calendar/style.module.scss.mjs";
|
|
6
|
+
import { formatDate as k } from "../../utils/common.mjs";
|
|
7
|
+
import ee from "../Button/Button.mjs";
|
|
8
|
+
const le = ({
|
|
9
|
+
value: n,
|
|
10
|
+
prevIcon: x,
|
|
11
|
+
nextIcon: H,
|
|
12
|
+
buttonReset: w,
|
|
13
|
+
buttonSubmit: N,
|
|
14
|
+
className: R,
|
|
15
|
+
classNameButton: W,
|
|
16
|
+
buttonClick: l,
|
|
17
|
+
buttonList: g,
|
|
18
|
+
typePicker: j = "RANGE",
|
|
19
|
+
onChange: v,
|
|
20
|
+
idPopover: B = "filter-date-popover",
|
|
21
|
+
id: E = "filter-date",
|
|
22
|
+
floatingOptions: P = {},
|
|
23
|
+
offsetPopover: $ = 5,
|
|
24
|
+
zIndexPopper: O = 0,
|
|
25
|
+
defaultValueLabel: c,
|
|
26
|
+
isCustomTime: z = !1,
|
|
27
|
+
mountedExecuteChange: V = !0,
|
|
28
|
+
formatingDate: D
|
|
29
29
|
}) => {
|
|
30
|
-
const
|
|
30
|
+
const p = [
|
|
31
31
|
{ key: "thisDay", value: "Hari ini" },
|
|
32
32
|
{ key: "thisWeek", value: "Minggu ini" },
|
|
33
33
|
{ key: "thisMonth", value: "Bulan ini" },
|
|
@@ -37,16 +37,16 @@ const De = ({
|
|
|
37
37
|
{ key: "lastMonth", value: "Bulan lalu" },
|
|
38
38
|
{ key: "lastYear", value: "Tahun lalu" },
|
|
39
39
|
{ key: "custom", value: "Kustom" }
|
|
40
|
-
],
|
|
40
|
+
], S = o.useRef(null), [b, M] = o.useState(), [A, r] = o.useState(), [Y, F] = o.useState(), d = (e, t) => {
|
|
41
41
|
const a = new Date(e ?? /* @__PURE__ */ new Date());
|
|
42
42
|
return t === "start" ? new Date(a.setHours(0, 0, 0)) : new Date(a.setHours(23, 59, 59));
|
|
43
|
-
},
|
|
43
|
+
}, G = () => {
|
|
44
44
|
const e = /* @__PURE__ */ new Date();
|
|
45
45
|
return {
|
|
46
46
|
startDate: e,
|
|
47
47
|
endDate: e
|
|
48
48
|
};
|
|
49
|
-
},
|
|
49
|
+
}, I = () => {
|
|
50
50
|
const e = /* @__PURE__ */ new Date();
|
|
51
51
|
e.setDate(e.getDate() - e.getDay());
|
|
52
52
|
const t = /* @__PURE__ */ new Date();
|
|
@@ -54,25 +54,25 @@ const De = ({
|
|
|
54
54
|
startDate: e,
|
|
55
55
|
endDate: t
|
|
56
56
|
};
|
|
57
|
-
},
|
|
57
|
+
}, J = () => {
|
|
58
58
|
const e = /* @__PURE__ */ new Date(), t = new Date(e.getFullYear(), e.getMonth(), 1), a = new Date(e.getFullYear(), e.getMonth() + 1, 0);
|
|
59
59
|
return {
|
|
60
60
|
startDate: t,
|
|
61
61
|
endDate: a
|
|
62
62
|
};
|
|
63
|
-
},
|
|
63
|
+
}, q = () => {
|
|
64
64
|
const e = new Date((/* @__PURE__ */ new Date()).getFullYear(), 0, 1), t = new Date((/* @__PURE__ */ new Date()).getFullYear(), 11, 31);
|
|
65
65
|
return {
|
|
66
66
|
startDate: e,
|
|
67
67
|
endDate: t
|
|
68
68
|
};
|
|
69
|
-
},
|
|
69
|
+
}, C = () => {
|
|
70
70
|
const e = new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() - 1));
|
|
71
71
|
return {
|
|
72
72
|
startDate: e,
|
|
73
73
|
endDate: e
|
|
74
74
|
};
|
|
75
|
-
},
|
|
75
|
+
}, L = () => {
|
|
76
76
|
const e = /* @__PURE__ */ new Date();
|
|
77
77
|
e.setDate(e.getDate() - (7 + e.getDay()));
|
|
78
78
|
const t = /* @__PURE__ */ new Date();
|
|
@@ -80,161 +80,158 @@ const De = ({
|
|
|
80
80
|
startDate: e,
|
|
81
81
|
endDate: t
|
|
82
82
|
};
|
|
83
|
-
},
|
|
83
|
+
}, Q = () => {
|
|
84
84
|
const e = /* @__PURE__ */ new Date(), t = new Date(e.getFullYear(), e.getMonth() - 1, 1), a = new Date(e.getFullYear(), e.getMonth(), 0);
|
|
85
85
|
return {
|
|
86
86
|
startDate: t,
|
|
87
87
|
endDate: a
|
|
88
88
|
};
|
|
89
|
-
},
|
|
89
|
+
}, U = () => {
|
|
90
90
|
const e = new Date((/* @__PURE__ */ new Date()).getFullYear() - 1, 0, 1), t = new Date((/* @__PURE__ */ new Date()).getFullYear() - 1, 11, 31);
|
|
91
91
|
return {
|
|
92
92
|
startDate: e,
|
|
93
93
|
endDate: t
|
|
94
94
|
};
|
|
95
95
|
}, u = (e, t, a) => {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}), (m = b.current) == null || m.setShow(!1), K(F, t ?? "", a);
|
|
96
|
+
if (F(e), typeof v == "function") {
|
|
97
|
+
let i = e;
|
|
98
|
+
D === "string" && e ? i = {
|
|
99
|
+
startDate: k(e.startDate, D),
|
|
100
|
+
endDate: k(e.endDate, D)
|
|
101
|
+
} : typeof D == "boolean" && e && (i = {
|
|
102
|
+
startDate: k(e.startDate, "yyyy-MM-dd'T'HH:mm:ss.SSSxxx"),
|
|
103
|
+
endDate: k(e.endDate, "yyyy-MM-dd'T'HH:mm:ss.SSSxxx")
|
|
104
|
+
}), S.current?.setShow(!1), v(i, t ?? "", a);
|
|
106
105
|
}
|
|
107
106
|
}, y = (e, t) => {
|
|
108
107
|
M(e);
|
|
109
108
|
let a;
|
|
110
|
-
if (
|
|
111
|
-
switch (
|
|
109
|
+
if (e?.key !== "custom") {
|
|
110
|
+
switch (r(e), e?.key) {
|
|
112
111
|
case "thisDay":
|
|
113
|
-
a =
|
|
112
|
+
a = G();
|
|
114
113
|
break;
|
|
115
114
|
case "thisWeek":
|
|
116
|
-
a =
|
|
115
|
+
a = I();
|
|
117
116
|
break;
|
|
118
117
|
case "thisMonth":
|
|
119
|
-
a =
|
|
118
|
+
a = J();
|
|
120
119
|
break;
|
|
121
120
|
case "thisYear":
|
|
122
|
-
a =
|
|
121
|
+
a = q();
|
|
123
122
|
break;
|
|
124
123
|
case "yesterday":
|
|
125
|
-
a =
|
|
124
|
+
a = C();
|
|
126
125
|
break;
|
|
127
126
|
case "lastWeek":
|
|
128
|
-
a =
|
|
127
|
+
a = L();
|
|
129
128
|
break;
|
|
130
129
|
case "lastMonth":
|
|
131
|
-
a =
|
|
130
|
+
a = Q();
|
|
132
131
|
break;
|
|
133
132
|
case "lastYear":
|
|
134
|
-
a =
|
|
133
|
+
a = U();
|
|
135
134
|
break;
|
|
136
135
|
}
|
|
137
136
|
a && t && u(
|
|
138
137
|
{ startDate: d(a.startDate, "start"), endDate: d(a.endDate, "end") },
|
|
139
|
-
e
|
|
138
|
+
e?.value,
|
|
140
139
|
e
|
|
141
140
|
);
|
|
142
141
|
}
|
|
143
142
|
}, f = (e, t) => {
|
|
144
|
-
const a = (
|
|
145
|
-
!e && !a ? (t && u(), y(void 0, t),
|
|
143
|
+
const a = (g ?? p).find((i) => i.key === e);
|
|
144
|
+
!e && !a ? (t && u(), y(void 0, t), r(void 0)) : typeof e == "object" ? (t && u(
|
|
146
145
|
{
|
|
147
146
|
startDate: d(e.startDate, "start"),
|
|
148
147
|
endDate: d(e.endDate, "end")
|
|
149
148
|
},
|
|
150
149
|
"Kustom",
|
|
151
150
|
{ key: "custom", value: "Kustom" }
|
|
152
|
-
), y({ key: "custom", value: "Kustom" }, t),
|
|
153
|
-
},
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
(a) => a.key === r.label || a.value === r.label
|
|
151
|
+
), y({ key: "custom", value: "Kustom" }, t), r({ key: "custom", value: "Kustom" })) : (y(a, t), r(a));
|
|
152
|
+
}, K = () => {
|
|
153
|
+
if (n) {
|
|
154
|
+
F(n);
|
|
155
|
+
const e = (g ?? p)?.find(
|
|
156
|
+
(t) => t.key === n.label || t.value === n.label
|
|
159
157
|
);
|
|
160
|
-
Object.keys(
|
|
158
|
+
Object.keys(e || {}).length > 0 && M(e);
|
|
161
159
|
} else
|
|
162
|
-
M(void 0),
|
|
160
|
+
M(void 0), r(void 0);
|
|
163
161
|
};
|
|
164
|
-
return
|
|
165
|
-
|
|
166
|
-
}, [JSON.stringify(
|
|
167
|
-
f(
|
|
168
|
-
}, []), /* @__PURE__ */
|
|
169
|
-
/* @__PURE__ */
|
|
162
|
+
return o.useEffect(() => {
|
|
163
|
+
K();
|
|
164
|
+
}, [JSON.stringify(n)]), o.useEffect(() => {
|
|
165
|
+
f(c ?? n, V);
|
|
166
|
+
}, []), /* @__PURE__ */ m(T, { children: [
|
|
167
|
+
/* @__PURE__ */ m(
|
|
170
168
|
"div",
|
|
171
169
|
{
|
|
172
170
|
onClick: (e) => {
|
|
173
|
-
|
|
174
|
-
(t = b.current) == null || t.handlerShow(e), x();
|
|
171
|
+
S.current?.handlerShow(e), K();
|
|
175
172
|
},
|
|
176
|
-
className:
|
|
177
|
-
id:
|
|
173
|
+
className: W,
|
|
174
|
+
id: E,
|
|
178
175
|
children: [
|
|
179
|
-
|
|
180
|
-
typeof
|
|
176
|
+
X(l) && l,
|
|
177
|
+
typeof l == "function" ? l(Y, A) : "Pilih Filter"
|
|
181
178
|
]
|
|
182
179
|
}
|
|
183
180
|
),
|
|
184
181
|
/* @__PURE__ */ s(
|
|
185
|
-
|
|
182
|
+
_,
|
|
186
183
|
{
|
|
187
|
-
zIndex:
|
|
188
|
-
ref:
|
|
189
|
-
offset:
|
|
190
|
-
id:
|
|
191
|
-
floatingOptions: { placement: "bottom-end", ...
|
|
192
|
-
children: /* @__PURE__ */
|
|
193
|
-
/* @__PURE__ */
|
|
194
|
-
(
|
|
184
|
+
zIndex: O,
|
|
185
|
+
ref: S,
|
|
186
|
+
offset: $,
|
|
187
|
+
id: B,
|
|
188
|
+
floatingOptions: { placement: "bottom-end", ...P },
|
|
189
|
+
children: /* @__PURE__ */ m("div", { className: `${h["container-filter-date"]} ${R}`, children: [
|
|
190
|
+
/* @__PURE__ */ m("div", { children: [
|
|
191
|
+
(g ?? p).map((e, t) => /* @__PURE__ */ s(
|
|
195
192
|
"div",
|
|
196
193
|
{
|
|
197
|
-
className: `${
|
|
194
|
+
className: `${h["button-filter-date"]} hover:iru-bg-laba-blue-01 ${b?.key === e.key ? "iru-text-laba-blue-10" : ""}`,
|
|
198
195
|
onClick: () => y(e, !0),
|
|
199
196
|
children: e.value
|
|
200
197
|
},
|
|
201
198
|
t
|
|
202
199
|
)),
|
|
203
|
-
|
|
200
|
+
b?.key !== "custom" && /* @__PURE__ */ s(T, { children: typeof w == "function" ? /* @__PURE__ */ s(
|
|
204
201
|
"div",
|
|
205
202
|
{
|
|
206
|
-
className:
|
|
207
|
-
onClick: () => f(
|
|
208
|
-
children:
|
|
203
|
+
className: h["button-filter-date-custome"],
|
|
204
|
+
onClick: () => f(c, !0),
|
|
205
|
+
children: w()
|
|
209
206
|
}
|
|
210
207
|
) : /* @__PURE__ */ s(
|
|
211
|
-
|
|
208
|
+
ee,
|
|
212
209
|
{
|
|
213
|
-
className:
|
|
210
|
+
className: h["button-reset-filter-date"],
|
|
214
211
|
variants: "nude-laba-blue-10",
|
|
215
212
|
size: "small",
|
|
216
|
-
onClick: () => f(
|
|
213
|
+
onClick: () => f(c, !0),
|
|
217
214
|
children: "Reset"
|
|
218
215
|
}
|
|
219
216
|
) })
|
|
220
217
|
] }),
|
|
221
|
-
|
|
222
|
-
|
|
218
|
+
b?.key === "custom" && /* @__PURE__ */ s("div", { children: /* @__PURE__ */ s(
|
|
219
|
+
Z,
|
|
223
220
|
{
|
|
224
221
|
defaultValue: Y,
|
|
225
222
|
value: Y,
|
|
226
|
-
prevIcon:
|
|
227
|
-
nextIcon:
|
|
228
|
-
buttonReset:
|
|
229
|
-
buttonSubmit:
|
|
230
|
-
isCustomTime:
|
|
223
|
+
prevIcon: x,
|
|
224
|
+
nextIcon: H,
|
|
225
|
+
buttonReset: w,
|
|
226
|
+
buttonSubmit: N,
|
|
227
|
+
isCustomTime: z,
|
|
231
228
|
onChange: (e) => {
|
|
232
|
-
u(e, "Kustom", { key: "custom", value: "Kustom" }),
|
|
229
|
+
u(e, "Kustom", { key: "custom", value: "Kustom" }), r({ key: "custom", value: "Kustom" });
|
|
233
230
|
},
|
|
234
231
|
onReset: () => {
|
|
235
|
-
f(
|
|
232
|
+
f(c, !0);
|
|
236
233
|
},
|
|
237
|
-
typePicker:
|
|
234
|
+
typePicker: j,
|
|
238
235
|
withConfirm: !0
|
|
239
236
|
}
|
|
240
237
|
) })
|
|
@@ -244,5 +241,5 @@ const De = ({
|
|
|
244
241
|
] });
|
|
245
242
|
};
|
|
246
243
|
export {
|
|
247
|
-
|
|
244
|
+
le as default
|
|
248
245
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime")
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),$=require("react"),u=require("react-aria"),f=require("@internationalized/date"),k=require("../Popover/Popover.cjs"),I=require("../Calendar/Calendar.cjs"),o=r=>{let a;const n=new Date(r??new Date);return r&&(a=f.parseDate(new Date(n.setHours(n.getHours()+7)).toISOString().slice(0,10))),a},R=({month:r,year:a,type:n=["month","year"],activeType:h="month",minDate:l,maxDate:i,className:p,classNameButton:g,onChange:c,buttonClick:d,id:m="date-picker",idPopover:v="date-picker-popover",floatingOptions:j={},offsetPopover:x=5,zIndexPopper:P=1,hiddenHeader:S})=>{const{locale:q}=u.useLocale(),s=$.useRef(null),w=o(l),D=o(i),C=e=>{typeof c=="function"&&(c({month:e.month,year:e.year}),s.current?.setShow(!1))};return t.jsxs(t.Fragment,{children:[t.jsx("div",{id:m,onClick:e=>{e.stopPropagation(),s.current?.handlerShow(e)},className:g,children:typeof d=="function"?d({month:r,year:a}):"Pilih Tanggal"}),t.jsx("div",{className:p??"",children:t.jsx(k.default,{zIndex:P,ref:s,offset:x,id:v,floatingOptions:{placement:"bottom-end",...j},onClick:e=>e.stopPropagation(),children:t.jsx(u.I18nProvider,{locale:"id-ID",children:t.jsx(I.default,{minValue:w,maxValue:D,minDate:l,maxDate:i,activeType:n.length===1?n[0]:h,locale:q,value:o(`${a}/${r}/1`),createCalendar:f.createCalendar,defaultValue:o(`${a}/${r}/1`),onChange:C,handlerReset:()=>{},handlerSubmit:()=>{},withDateSelect:!1,type:n,hiddenHeader:S})})})})]})};exports.default=R;
|