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,17 +1,17 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { createCalendar as P, getLocalTimeZone as
|
|
4
|
-
import { useCalendar as
|
|
1
|
+
import { jsxs as h, jsx as n, Fragment as G } from "react/jsx-runtime";
|
|
2
|
+
import $, { useEffect as L, isValidElement as N } from "react";
|
|
3
|
+
import { createCalendar as P, getLocalTimeZone as I, getWeeksInMonth as V } from "@internationalized/date";
|
|
4
|
+
import { useCalendar as q, useCalendarGrid as W } from "react-aria";
|
|
5
5
|
import { useCalendarState as j } from "react-stately";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import i from "./style.module.scss.mjs";
|
|
7
|
+
import M from "../Button/Button.mjs";
|
|
8
8
|
import F from "./CalendarCell.mjs";
|
|
9
|
-
import
|
|
9
|
+
import w from "./CalendarButton.mjs";
|
|
10
10
|
import O from "./CalendarMonth.mjs";
|
|
11
|
-
import z, { ChevronDownIcon as
|
|
11
|
+
import z, { ChevronDownIcon as H } from "./CalendarYear.mjs";
|
|
12
12
|
import { useDeepCompareEffect as _ } from "../../hooks/useDeepCompareEffect.mjs";
|
|
13
13
|
const K = (e) => {
|
|
14
|
-
const
|
|
14
|
+
const y = V(e.state.visibleRange.start, e.locale), { gridProps: a, headerProps: c, weekDays: C } = W({}, e.state), { prevButtonProps: f, nextButtonProps: g, title: d } = q(e, e.state), o = (l) => {
|
|
15
15
|
let r = "";
|
|
16
16
|
switch (l) {
|
|
17
17
|
case 0:
|
|
@@ -38,72 +38,72 @@ const K = (e) => {
|
|
|
38
38
|
}
|
|
39
39
|
return r;
|
|
40
40
|
};
|
|
41
|
-
return /* @__PURE__ */
|
|
42
|
-
!e.hiddenHeader && /* @__PURE__ */
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
/* @__PURE__ */
|
|
41
|
+
return /* @__PURE__ */ h("div", { children: [
|
|
42
|
+
!e.hiddenHeader && /* @__PURE__ */ h("div", { className: i["header-calendar"], children: [
|
|
43
|
+
/* @__PURE__ */ n(w, { ...f, children: typeof e?.prevIcon == "function" || N(e?.prevIcon) ? N(e.prevIcon) ? e.prevIcon : e.prevIcon() : /* @__PURE__ */ n(H, { className: "iru-rotate-90" }) }),
|
|
44
|
+
/* @__PURE__ */ n("div", { className: i["header-button-calendar"], onClick: () => e.setActiveTypeCalendar("month"), children: d }),
|
|
45
|
+
/* @__PURE__ */ n(w, { ...g, children: typeof e?.nextIcon == "function" || N(e?.nextIcon) ? N(e.nextIcon) ? e.nextIcon : e.nextIcon() : /* @__PURE__ */ n(H, { className: "-iru-rotate-90" }) })
|
|
46
46
|
] }),
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
/* @__PURE__ */
|
|
47
|
+
/* @__PURE__ */ h("table", { ...a, children: [
|
|
48
|
+
/* @__PURE__ */ n("thead", { ...c, children: /* @__PURE__ */ n("tr", { children: C.map((l, r) => /* @__PURE__ */ n("th", { className: i["days-calendar"], children: o(r) }, r)) }) }),
|
|
49
|
+
/* @__PURE__ */ n("tbody", { children: [...new Array(y).keys()].map((l) => /* @__PURE__ */ n("tr", { children: e.state.getDatesInWeek(l).map((r, b) => r ? /* @__PURE__ */ n(F, { state: e.state, date: r }, b) : /* @__PURE__ */ n("td", {}, b)) }, l)) })
|
|
50
50
|
] })
|
|
51
51
|
] });
|
|
52
|
-
},
|
|
52
|
+
}, R = ({
|
|
53
53
|
minDate: e,
|
|
54
|
-
maxDate:
|
|
55
|
-
value:
|
|
56
|
-
time:
|
|
57
|
-
hiddenHeader:
|
|
58
|
-
handlerChangeTime:
|
|
59
|
-
timeLabel:
|
|
60
|
-
type:
|
|
54
|
+
maxDate: y,
|
|
55
|
+
value: a,
|
|
56
|
+
time: c,
|
|
57
|
+
hiddenHeader: C,
|
|
58
|
+
handlerChangeTime: f,
|
|
59
|
+
timeLabel: g,
|
|
60
|
+
type: d
|
|
61
61
|
}) => {
|
|
62
|
-
const
|
|
63
|
-
typeof
|
|
64
|
-
},
|
|
65
|
-
const t = document.getElementById(`calendar-hour-${
|
|
66
|
-
t &&
|
|
67
|
-
},
|
|
68
|
-
let
|
|
69
|
-
if (
|
|
70
|
-
const
|
|
71
|
-
|
|
62
|
+
const o = e ? new Date(e) : null, l = y ? new Date(y) : null, r = o?.getHours(), b = l?.getHours(), m = o?.getMinutes(), D = l?.getMinutes(), [E, A] = $.useState(!0), S = (t, u, s) => Array.from({ length: (u - t) / s + 1 }, (v, k) => t + k * s), x = (t, u) => {
|
|
63
|
+
typeof f == "function" && f({ hour: t, minut: u, second: c?.second });
|
|
64
|
+
}, B = () => {
|
|
65
|
+
const t = document.getElementById(`calendar-hour-${c?.hour}-${d}`), u = document.getElementById(`calendar-minut-${c?.minut}-${d}`), s = document.getElementById(`wrapper-calendar-hour-${d}`), v = document.getElementById(`wrapper-calendar-minut-${d}`);
|
|
66
|
+
t && s && s.scrollTo({ behavior: "instant", top: t.offsetTop - 78 }), u && v && v.scrollTo({ behavior: "instant", top: u.offsetTop - 78 });
|
|
67
|
+
}, T = (t, u) => {
|
|
68
|
+
let s = !0;
|
|
69
|
+
if (o && a) {
|
|
70
|
+
const v = a.year === o.getFullYear(), k = a.month === o.getMonth() + 1;
|
|
71
|
+
a.day === o.getDate() && k && v ? (u === "hour" && t < (r ?? 0) || u === "minut" && (c?.hour ?? 0) <= o.getHours() && t < (m ?? 0)) && (s = !1) : a.toDate(I()).getTime() < o.getTime() && (s = !1);
|
|
72
72
|
}
|
|
73
|
-
if (l &&
|
|
74
|
-
const
|
|
75
|
-
|
|
73
|
+
if (l && a) {
|
|
74
|
+
const v = a.year === l.getFullYear(), k = a.month === l.getMonth() + 1;
|
|
75
|
+
a.day === l.getDate() && k && v ? (u === "hour" && t > (b ?? 0) || u === "minut" && (c?.hour ?? 0) >= l.getHours() && t > (D ?? 0)) && (s = !1) : a.toDate(I()).getTime() > l.getTime() && (s = !1);
|
|
76
76
|
}
|
|
77
|
-
return
|
|
77
|
+
return s;
|
|
78
78
|
};
|
|
79
|
-
return
|
|
80
|
-
|
|
81
|
-
}, [JSON.stringify(
|
|
82
|
-
!
|
|
83
|
-
/* @__PURE__ */
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
/* @__PURE__ */
|
|
79
|
+
return $.useEffect(() => {
|
|
80
|
+
E && B(), c && A(!1);
|
|
81
|
+
}, [JSON.stringify(a), JSON.stringify(c)]), /* @__PURE__ */ h("div", { className: i["custom-time-calendar"], children: [
|
|
82
|
+
!C && /* @__PURE__ */ n("div", { className: i["header-time"], children: g || "Atur Waktu" }),
|
|
83
|
+
/* @__PURE__ */ h("div", { className: i["type-time"], children: [
|
|
84
|
+
/* @__PURE__ */ n("div", { children: "Jam" }),
|
|
85
|
+
/* @__PURE__ */ n("div", { children: "Menit" })
|
|
86
86
|
] }),
|
|
87
|
-
/* @__PURE__ */
|
|
88
|
-
/* @__PURE__ */
|
|
87
|
+
/* @__PURE__ */ h("div", { className: "iru-flex iru-justify-around", children: [
|
|
88
|
+
/* @__PURE__ */ n("div", { id: `wrapper-calendar-hour-${d}`, className: i["container-cell-time"], children: S(0, 23, 1).map((t) => /* @__PURE__ */ n(
|
|
89
89
|
"div",
|
|
90
90
|
{
|
|
91
|
-
id: `calendar-hour-${t}-${
|
|
92
|
-
className: `${
|
|
91
|
+
id: `calendar-hour-${t}-${d}`,
|
|
92
|
+
className: `${i["cell-time"]} ${c?.hour === t ? T(t, "hour") ? i.selected : i.error : ""} ${T(t, "hour") && c?.hour != t ? i.valid : i.invalid}`,
|
|
93
93
|
onClick: () => {
|
|
94
|
-
|
|
94
|
+
T(t, "hour") && x(t, c?.minut);
|
|
95
95
|
},
|
|
96
96
|
children: t < 10 ? `0${t}` : t
|
|
97
97
|
},
|
|
98
98
|
t
|
|
99
99
|
)) }),
|
|
100
|
-
/* @__PURE__ */
|
|
100
|
+
/* @__PURE__ */ n("div", { id: `wrapper-calendar-minut-${d}`, className: i["container-cell-time"], children: S(0, 59, 1).map((t) => /* @__PURE__ */ n(
|
|
101
101
|
"div",
|
|
102
102
|
{
|
|
103
|
-
id: `calendar-minut-${t}-${
|
|
104
|
-
className: `${
|
|
103
|
+
id: `calendar-minut-${t}-${d}`,
|
|
104
|
+
className: `${i["cell-time"]} ${c?.minut === t ? T(t, "minut") ? i.selected : i.error : ""} ${T(t, "minut") && c?.minut != t ? i.valid : i.invalid}`,
|
|
105
105
|
onClick: () => {
|
|
106
|
-
|
|
106
|
+
T(t, "minut") && x(c?.hour, t);
|
|
107
107
|
},
|
|
108
108
|
children: t < 10 ? `0${t}` : t
|
|
109
109
|
},
|
|
@@ -111,89 +111,87 @@ const K = (e) => {
|
|
|
111
111
|
)) })
|
|
112
112
|
] })
|
|
113
113
|
] });
|
|
114
|
-
},
|
|
115
|
-
|
|
116
|
-
const C = e.typeTime ?? "SINGLE", i = j({
|
|
114
|
+
}, le = (e) => {
|
|
115
|
+
const y = e.typeTime ?? "SINGLE", a = j({
|
|
117
116
|
...e,
|
|
118
117
|
locale: e.locale,
|
|
119
118
|
createCalendar: P
|
|
120
|
-
}), { title:
|
|
121
|
-
const
|
|
122
|
-
...
|
|
123
|
-
[
|
|
119
|
+
}), { title: c } = q(e, a), [C, f] = $.useState(e?.activeType ?? "date"), [g, d] = $.useState({ start: void 0, end: void 0 }), o = g.start?.hour?.toString() && g?.start?.minut?.toString() && e.value?.toDate(I()).setHours(g.start?.hour, g.start?.minut) || e.minDate, l = e.maxDate, r = (m, D) => {
|
|
120
|
+
const E = {
|
|
121
|
+
...g,
|
|
122
|
+
[D]: m
|
|
124
123
|
};
|
|
125
|
-
|
|
126
|
-
},
|
|
127
|
-
|
|
124
|
+
d(E), typeof e?.handlerChangeTime == "function" && e.handlerChangeTime(E);
|
|
125
|
+
}, b = (m) => {
|
|
126
|
+
a.setValue(m);
|
|
128
127
|
};
|
|
129
128
|
return _(() => {
|
|
130
|
-
e
|
|
131
|
-
}, [e
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
s({ start: o, end: T });
|
|
129
|
+
e?.activeType && f(e.activeType);
|
|
130
|
+
}, [e?.activeType]), L(() => {
|
|
131
|
+
if (e.time?.start && e.time?.end) {
|
|
132
|
+
const m = e.time.start, D = e.time.end;
|
|
133
|
+
d({ start: m, end: D });
|
|
136
134
|
}
|
|
137
|
-
}, [JSON.stringify(e.time)]), /* @__PURE__ */
|
|
138
|
-
|
|
139
|
-
/* @__PURE__ */
|
|
140
|
-
/* @__PURE__ */
|
|
141
|
-
|
|
142
|
-
/* @__PURE__ */
|
|
143
|
-
|
|
135
|
+
}, [JSON.stringify(e.time)]), /* @__PURE__ */ h("div", { className: "iru-text-laba-base-sr", children: [
|
|
136
|
+
C === "date" && /* @__PURE__ */ n(G, { children: /* @__PURE__ */ h("div", { className: i["container-calendar"], children: [
|
|
137
|
+
/* @__PURE__ */ h("div", { className: "iru-flex iru-gap-2", children: [
|
|
138
|
+
/* @__PURE__ */ n(K, { state: a, setActiveTypeCalendar: f, ...e }),
|
|
139
|
+
e?.isCustomTime && /* @__PURE__ */ h("div", { className: "iru-flex", children: [
|
|
140
|
+
/* @__PURE__ */ n(
|
|
141
|
+
R,
|
|
144
142
|
{
|
|
145
143
|
minDate: e.minDate,
|
|
146
144
|
maxDate: e.maxDate,
|
|
147
|
-
time:
|
|
145
|
+
time: e.time?.start,
|
|
148
146
|
value: e.value,
|
|
149
|
-
timeLabel:
|
|
147
|
+
timeLabel: y === "RANGE" ? "Awal" : "Atur Waktu",
|
|
150
148
|
type: "start",
|
|
151
|
-
handlerChangeTime: (
|
|
149
|
+
handlerChangeTime: (m) => r(m, "start")
|
|
152
150
|
}
|
|
153
151
|
),
|
|
154
|
-
|
|
155
|
-
|
|
152
|
+
y === "RANGE" && /* @__PURE__ */ n(
|
|
153
|
+
R,
|
|
156
154
|
{
|
|
157
|
-
minDate:
|
|
155
|
+
minDate: o,
|
|
158
156
|
maxDate: l,
|
|
159
|
-
time:
|
|
157
|
+
time: e.time?.end,
|
|
160
158
|
value: e.value,
|
|
161
159
|
timeLabel: "Akhir",
|
|
162
160
|
type: "end",
|
|
163
|
-
handlerChangeTime: (
|
|
161
|
+
handlerChangeTime: (m) => r(m, "end")
|
|
164
162
|
}
|
|
165
163
|
)
|
|
166
164
|
] })
|
|
167
165
|
] }),
|
|
168
|
-
(
|
|
169
|
-
typeof
|
|
170
|
-
typeof
|
|
166
|
+
(e?.withConfirm ?? e?.isCustomTime) && /* @__PURE__ */ h("div", { className: `${i["footer-calendar"]}`, children: [
|
|
167
|
+
typeof e?.buttonReset == "function" ? /* @__PURE__ */ n("div", { onClick: () => e.handlerReset(a), children: e.buttonReset() }) : /* @__PURE__ */ n(M, { variants: "nude-laba-blue-10", size: "small", onClick: () => e.handlerReset(a), children: "Reset" }),
|
|
168
|
+
typeof e?.buttonSubmit == "function" ? /* @__PURE__ */ n("div", { onClick: e.handlerSubmit, children: e.buttonSubmit() }) : /* @__PURE__ */ n(M, { size: "small", onClick: e.handlerSubmit, children: "Terapkan" })
|
|
171
169
|
] })
|
|
172
170
|
] }) }),
|
|
173
|
-
|
|
171
|
+
C === "month" && /* @__PURE__ */ n(
|
|
174
172
|
O,
|
|
175
173
|
{
|
|
176
|
-
state:
|
|
177
|
-
setActiveTypeCalendar:
|
|
174
|
+
state: a,
|
|
175
|
+
setActiveTypeCalendar: f,
|
|
178
176
|
type: e.type,
|
|
179
|
-
onChangeMonth:
|
|
177
|
+
onChangeMonth: b,
|
|
180
178
|
hiddenHeader: e.hiddenHeader
|
|
181
179
|
}
|
|
182
180
|
),
|
|
183
|
-
|
|
181
|
+
C === "year" && /* @__PURE__ */ n(
|
|
184
182
|
z,
|
|
185
183
|
{
|
|
186
|
-
state:
|
|
184
|
+
state: a,
|
|
187
185
|
type: e.type,
|
|
188
|
-
setActiveTypeCalendar:
|
|
189
|
-
title:
|
|
190
|
-
onChangeYear:
|
|
186
|
+
setActiveTypeCalendar: f,
|
|
187
|
+
title: c,
|
|
188
|
+
onChangeYear: b,
|
|
191
189
|
hiddenHeader: e.hiddenHeader
|
|
192
190
|
}
|
|
193
191
|
)
|
|
194
192
|
] });
|
|
195
193
|
};
|
|
196
194
|
export {
|
|
197
|
-
|
|
198
|
-
|
|
195
|
+
R as CustomTimeCalendar,
|
|
196
|
+
le as default
|
|
199
197
|
};
|
|
@@ -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 r=require("react/jsx-runtime"),$=require("react-aria"),n=require("./style.module.scss.cjs"),h=require("./CalendarButton.cjs"),i=require("react"),y=require("./CalendarYear.cjs"),q=({prevIcon:l,nextIcon:s,state:e,setActiveTypeCalendar:c,onChangeMonth:m,type:t,hiddenHeader:D})=>{const V=new Date().getFullYear(),x=e.focusedDate.calendar.getMonthsInYear(e.focusedDate),j=$.useDateFormatter({month:"short",timeZone:e.timeZone}),b=(o,a)=>{const d=e.focusedDate.set({month:o});a?(c("date"),e.setFocusedDate(d)):!a&&typeof m=="function"&&m(d)},f=o=>{const a=e.focusedDate.set({year:o});e.setFocusedDate(a)};return r.jsxs("div",{className:`iru-w-[296px] ${n.default["container-calendar"]}`,children:[!D&&r.jsxs("div",{className:n.default["header-calendar"],children:[r.jsx(h.default,{isDisabled:e?.minValue?e.focusedDate.year<=e.minValue.year:!1,onPress:()=>f(e.focusedDate.year-1),children:typeof l=="function"||i.isValidElement(l)?i.isValidElement(l)?l:l():r.jsx(y.ChevronDownIcon,{className:"iru-rotate-90"})}),r.jsx("div",{className:`${n.default["header-button-calendar"]} ${t.includes("year")?"":n.default.disabled}`,onClick:()=>{t.includes("year")&&c("year")},children:e.focusedDate.year}),r.jsx(h.default,{isDisabled:e?.maxValue?e.focusedDate.year>=e.maxValue.year:!1,onPress:()=>f(e.focusedDate.year+1),children:typeof s=="function"||i.isValidElement(s)?i.isValidElement(s)?s:s():r.jsx(y.ChevronDownIcon,{className:"-iru-rotate-90"})})]}),r.jsx("div",{className:n.default["month-calendar"],children:[...Array(x).keys()].map(o=>{const a=e.focusedDate.set({month:o+1}),d=j.format(a.toDate(e.timeZone)),g=e.value?.year||e.value?.start?.year||V,C=e?.minValue?a.month<e?.minValue?.month&&a.year<=e.minValue.year:!1,N=e?.maxValue?a.month>e.maxValue.month&&a.year>=e.maxValue.year:!1,u=C||N;return r.jsx("div",{onClick:()=>{u||b(a.month,t.includes("date"))},className:`${n.default["cell-month"]} ${e.focusedDate.month===a.month&&!u&&a.year===g?n.default.selected:""} ${e.focusedDate.month!==a.month&&!u?"hover:iru-bg-laba-blue-01":""} ${u?"iru-text-gray-400":"iru-cursor-pointer"}`,children:d},o)})})]})};exports.default=q;
|
|
@@ -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;
|