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,119 +1,116 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as q, Fragment as A, jsx as c } from "react/jsx-runtime";
|
|
2
2
|
import p from "react";
|
|
3
|
-
import { createCalendar as
|
|
4
|
-
import
|
|
5
|
-
import { useDateFormatter as
|
|
6
|
-
import
|
|
7
|
-
const
|
|
8
|
-
let
|
|
9
|
-
const
|
|
10
|
-
return
|
|
11
|
-
},
|
|
3
|
+
import { createCalendar as J, parseDate as K, getLocalTimeZone as Q } from "@internationalized/date";
|
|
4
|
+
import U from "../Calendar/Calendar.mjs";
|
|
5
|
+
import { useDateFormatter as W, useLocale as X, I18nProvider as Y } from "react-aria";
|
|
6
|
+
import _ from "../Popover/Popover.mjs";
|
|
7
|
+
const g = (u) => {
|
|
8
|
+
let s;
|
|
9
|
+
const r = new Date(u ?? /* @__PURE__ */ new Date());
|
|
10
|
+
return u && (s = K(new Date(r.setHours(r.getHours() + 7)).toISOString().slice(0, 10))), s;
|
|
11
|
+
}, se = (u) => {
|
|
12
12
|
const {
|
|
13
|
-
minDate:
|
|
14
|
-
maxDate:
|
|
15
|
-
value:
|
|
16
|
-
defaultValue:
|
|
13
|
+
minDate: s,
|
|
14
|
+
maxDate: r,
|
|
15
|
+
value: i,
|
|
16
|
+
defaultValue: v,
|
|
17
17
|
withConfirm: h = !1,
|
|
18
18
|
isCustomTime: D = !1,
|
|
19
|
-
className:
|
|
20
|
-
classNameButton:
|
|
19
|
+
className: x,
|
|
20
|
+
classNameButton: I,
|
|
21
21
|
buttonClick: w,
|
|
22
|
-
buttonReset:
|
|
23
|
-
buttonSubmit:
|
|
24
|
-
prevIcon:
|
|
25
|
-
nextIcon:
|
|
26
|
-
onChange:
|
|
27
|
-
id:
|
|
28
|
-
idPopover:
|
|
29
|
-
floatingOptions:
|
|
30
|
-
offsetPopover:
|
|
31
|
-
zIndexPopper:
|
|
32
|
-
hiddenHeader:
|
|
33
|
-
} =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const t = a ? new Date(a) : null, o = i ? new Date(i) : null;
|
|
22
|
+
buttonReset: P,
|
|
23
|
+
buttonSubmit: b,
|
|
24
|
+
prevIcon: y,
|
|
25
|
+
nextIcon: M,
|
|
26
|
+
onChange: m,
|
|
27
|
+
id: k = "date-picker",
|
|
28
|
+
idPopover: N = "date-picker-popover",
|
|
29
|
+
floatingOptions: R = {},
|
|
30
|
+
offsetPopover: V = 5,
|
|
31
|
+
zIndexPopper: L = 1,
|
|
32
|
+
hiddenHeader: O
|
|
33
|
+
} = u, l = W(), { locale: j } = X(), z = g(s), F = g(r), d = p.useRef(null), [S, T] = p.useState(), [f, H] = p.useState(), B = (a) => {
|
|
34
|
+
const o = /* @__PURE__ */ new Date();
|
|
35
|
+
let e = a.toDate(Q());
|
|
36
|
+
e.setHours(o.getHours(), o.getMinutes(), o.getSeconds());
|
|
37
|
+
const t = s ? new Date(s) : null, n = r ? new Date(r) : null;
|
|
39
38
|
if (D) {
|
|
40
|
-
if (e = new Date(new Date(e).setHours(
|
|
39
|
+
if (e = new Date(new Date(e).setHours(f?.hour ?? 0, f?.minut, f?.second)), t && t?.toDateString() === new Date(e).toDateString() && t?.toTimeString() >= e?.toTimeString()) {
|
|
41
40
|
if (t && (t.getHours() > e.getHours() || t.getHours() === e.getHours() && t.getMinutes() > e.getMinutes()))
|
|
42
41
|
return;
|
|
43
42
|
e = new Date(t.setSeconds(t.getSeconds() + 1));
|
|
44
43
|
}
|
|
45
|
-
if (
|
|
46
|
-
if (
|
|
44
|
+
if (n && n?.toDateString() === new Date(e).toDateString() && n?.toTimeString() < e?.toTimeString()) {
|
|
45
|
+
if (n && (n.getHours() < e.getHours() || n.getHours() === e.getHours() && n.getMinutes() < e.getMinutes()))
|
|
47
46
|
return;
|
|
48
|
-
e = new Date(
|
|
47
|
+
e = new Date(n.setSeconds(n.getSeconds() - 1));
|
|
49
48
|
}
|
|
50
49
|
} else
|
|
51
|
-
t &&
|
|
52
|
-
typeof
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
},
|
|
56
|
-
const { start:
|
|
57
|
-
|
|
58
|
-
},
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
hour:
|
|
62
|
-
minut:
|
|
63
|
-
second:
|
|
64
|
-
}),
|
|
65
|
-
},
|
|
66
|
-
S &&
|
|
50
|
+
t && l.format(e) === l.format(t) && t.getTime() >= e.getTime() ? e = new Date(t.setSeconds(t.getSeconds() + 1)) : n && l.format(e) === l.format(n) && n.getTime() <= e.getTime() && (e = new Date(n.setSeconds(n.getSeconds() - 1)));
|
|
51
|
+
typeof m == "function" && (m(e), d.current?.setShow(!1));
|
|
52
|
+
}, C = (a, o) => {
|
|
53
|
+
T(a), (o ?? (!h && !D)) && B(a);
|
|
54
|
+
}, E = (a) => {
|
|
55
|
+
const { start: o } = a;
|
|
56
|
+
H(o);
|
|
57
|
+
}, G = (a) => {
|
|
58
|
+
const o = new Date(i ?? /* @__PURE__ */ new Date());
|
|
59
|
+
H({
|
|
60
|
+
hour: o.getHours(),
|
|
61
|
+
minut: o.getMinutes(),
|
|
62
|
+
second: o.getSeconds()
|
|
63
|
+
}), T(g(i));
|
|
64
|
+
}, Z = () => {
|
|
65
|
+
S && C(S, !0);
|
|
67
66
|
};
|
|
68
|
-
return /* @__PURE__ */ A
|
|
69
|
-
/* @__PURE__ */
|
|
67
|
+
return /* @__PURE__ */ q(A, { children: [
|
|
68
|
+
/* @__PURE__ */ c(
|
|
70
69
|
"div",
|
|
71
70
|
{
|
|
72
|
-
id:
|
|
73
|
-
onClick: (
|
|
74
|
-
|
|
75
|
-
(n = g.current) == null || n.handlerShow(s), Z();
|
|
71
|
+
id: k,
|
|
72
|
+
onClick: (a) => {
|
|
73
|
+
d.current?.handlerShow(a), G();
|
|
76
74
|
},
|
|
77
|
-
className:
|
|
78
|
-
children: typeof w == "function" ? w(
|
|
75
|
+
className: I,
|
|
76
|
+
children: typeof w == "function" ? w(i) : i ? new Date(i).toDateString() : "Pilih Tanggal"
|
|
79
77
|
}
|
|
80
78
|
),
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
-
|
|
79
|
+
/* @__PURE__ */ c(
|
|
80
|
+
_,
|
|
83
81
|
{
|
|
84
|
-
zIndex:
|
|
85
|
-
ref:
|
|
86
|
-
offset:
|
|
87
|
-
id:
|
|
88
|
-
floatingOptions: { placement: "bottom-end", ...
|
|
89
|
-
children: /* @__PURE__ */
|
|
90
|
-
|
|
82
|
+
zIndex: L,
|
|
83
|
+
ref: d,
|
|
84
|
+
offset: V,
|
|
85
|
+
id: N,
|
|
86
|
+
floatingOptions: { placement: "bottom-end", ...R },
|
|
87
|
+
children: /* @__PURE__ */ c("div", { className: x ?? "", children: /* @__PURE__ */ c(Y, { locale: "id-ID", children: /* @__PURE__ */ c(
|
|
88
|
+
U,
|
|
91
89
|
{
|
|
92
|
-
minValue:
|
|
93
|
-
maxValue:
|
|
94
|
-
minDate:
|
|
95
|
-
maxDate:
|
|
96
|
-
time: { start:
|
|
97
|
-
locale:
|
|
90
|
+
minValue: z,
|
|
91
|
+
maxValue: F,
|
|
92
|
+
minDate: s,
|
|
93
|
+
maxDate: r,
|
|
94
|
+
time: { start: f },
|
|
95
|
+
locale: j,
|
|
98
96
|
value: S,
|
|
99
97
|
typeTime: "SINGLE",
|
|
100
|
-
buttonReset:
|
|
101
|
-
buttonSubmit:
|
|
102
|
-
prevIcon:
|
|
103
|
-
nextIcon:
|
|
104
|
-
createCalendar:
|
|
105
|
-
defaultValue:
|
|
106
|
-
onChange:
|
|
98
|
+
buttonReset: P,
|
|
99
|
+
buttonSubmit: b,
|
|
100
|
+
prevIcon: y,
|
|
101
|
+
nextIcon: M,
|
|
102
|
+
createCalendar: J,
|
|
103
|
+
defaultValue: g(i),
|
|
104
|
+
onChange: C,
|
|
107
105
|
handlerReset: () => {
|
|
108
|
-
|
|
109
|
-
typeof d == "function" && (d(P), (s = g.current) == null || s.setShow(!1));
|
|
106
|
+
typeof m == "function" && (m(v), d.current?.setShow(!1));
|
|
110
107
|
},
|
|
111
|
-
handlerSubmit:
|
|
112
|
-
handlerChangeTime:
|
|
108
|
+
handlerSubmit: Z,
|
|
109
|
+
handlerChangeTime: E,
|
|
113
110
|
withConfirm: h,
|
|
114
111
|
isCustomTime: D,
|
|
115
112
|
type: ["date", "month", "year"],
|
|
116
|
-
hiddenHeader:
|
|
113
|
+
hiddenHeader: O
|
|
117
114
|
}
|
|
118
115
|
) }) })
|
|
119
116
|
}
|
|
@@ -121,5 +118,5 @@ const m = (l) => {
|
|
|
121
118
|
] });
|
|
122
119
|
};
|
|
123
120
|
export {
|
|
124
|
-
|
|
121
|
+
se as default
|
|
125
122
|
};
|
|
@@ -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 m=require("react/jsx-runtime"),R=require("react"),V=require("react-aria"),O=require("../Calendar/CalendarRange.cjs"),t=require("@internationalized/date"),Y=require("../Calendar/Calendar.cjs"),x=r=>{let n;const a=new Date(r??new Date);return r&&(n=t.parseDate(new Date(a.setHours(a.getHours()+7)).toISOString().slice(0,10))),n},A=r=>{const n=new Date(r?.startDate??new Date),a=new Date(r?.endDate??new Date),i=new t.CalendarDate(n.getFullYear(),n.getMonth()+1,n.getDate()),d=new t.CalendarDate(a.getFullYear(),a.getMonth()+1,a.getDate());return r?{start:i,end:d}:void 0},k=r=>{const{minDate:n,maxDate:a,defaultValue:i,withConfirm:d,prevIcon:y,nextIcon:H,buttonReset:M,buttonSubmit:p,typePicker:L="RANGE",onChange:b,value:u,onReset:j,isCustomTime:f}=r,{locale:F}=V.useLocale(),q=x(n),E=x(a),[s,h]=R.useState(),[w,C]=R.useState({start:void 0,end:void 0}),I=e=>{typeof b=="function"&&b(e)},S=(e,o)=>{const c=e.start.toDate(t.getLocalTimeZone()),D=e.end.toDate(t.getLocalTimeZone());h(e),C({start:{hour:0,minut:0,second:0},end:{hour:23,minut:59,second:59}}),(o??!d)&&I({startDate:c,endDate:new Date(D.setHours(23,59,59))})},T=(e,o)=>{if(s?.start&&s?.end&&(C(e),e.start?.hour?.toString()&&e.start?.minut?.toString()&&e.end?.hour?.toString()&&e.end?.minut?.toString()&&(o??!d))){const c=s.start.toDate(t.getLocalTimeZone()),D=s.end.toDate(t.getLocalTimeZone()),l=new Date(c.setHours(e.start.hour,e.start.minut)),g=new Date(D.setHours(e.end.hour,e.end.minut,59));l.getTime()<g.getTime()&&I({startDate:l,endDate:g})}},N=e=>{if(typeof j=="function")j();else if(i&&e){const o=new Date(i.endDate??new Date),c=e.focusedDate.set({month:o.getMonth()+1,year:o.getFullYear()});e.setFocusedDate(c)}h(A(i))},Z=()=>{s&&(f?T(w,!0):S(s,!0))};return R.useEffect(()=>{if(u?.endDate&&u?.startDate){const e=new Date(u.startDate),o=new Date(u.endDate),c=e.getHours(),D=e.getMinutes(),l=o.getHours(),g=o.getMinutes(),G=t.toCalendarDate(t.fromDate(e,t.getLocalTimeZone())),P=t.toCalendarDate(t.fromDate(o,t.getLocalTimeZone()));h({start:G,end:P}),C({start:{hour:c,minut:D},end:{hour:l,minut:g}})}},[JSON.stringify(u)]),m.jsx("div",{className:"iru-flex iru-flex-col",children:m.jsxs(V.I18nProvider,{locale:"id-ID",children:[L==="RANGE"&&m.jsx(O.default,{defaultValue:A(i),value:s,minValue:q,maxValue:E,withConfirm:d,prevIcon:y,nextIcon:H,buttonReset:M,buttonSubmit:p,onChange:e=>S(e),isCustomTime:f,handlerReset:N,handlerSubmit:Z,time:w,minDate:n,maxDate:a,handlerChangeTimeRange:T}),L==="SINGLE"&&m.jsx(Y.default,{defaultValue:x(i?.endDate),value:s?.end,minValue:q,maxValue:E,minDate:n,maxDate:a,withConfirm:d,prevIcon:y,nextIcon:H,buttonReset:M,buttonSubmit:p,locale:F,time:w,typeTime:"RANGE",handlerChangeTime:T,isCustomTime:f,createCalendar:t.createCalendar,onChange:e=>S({start:e,end:e}),handlerReset:N,handlerSubmit:Z,type:["date","month","year"]})]})})};exports.default=k;
|
|
@@ -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;
|