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,22 +1,21 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Chart as
|
|
3
|
-
import
|
|
4
|
-
import { Pie as
|
|
5
|
-
import { mergeObjects as
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
const
|
|
1
|
+
import { jsxs as w, jsx as b } from "react/jsx-runtime";
|
|
2
|
+
import { Chart as k, ArcElement as I, Tooltip as E } from "chart.js";
|
|
3
|
+
import m from "react";
|
|
4
|
+
import { Pie as S } from "react-chartjs-2";
|
|
5
|
+
import { mergeObjects as A, formatNumber as y } from "../../utils/common.mjs";
|
|
6
|
+
import B from "../PortalComponent/PortalComponent.mjs";
|
|
7
|
+
k.register(I, E);
|
|
8
|
+
const x = (t, l, n) => {
|
|
9
9
|
const r = l > 0 ? t / l * 100 : 0;
|
|
10
10
|
switch (n) {
|
|
11
11
|
case "decimal":
|
|
12
|
-
return
|
|
12
|
+
return y(t, "decimal");
|
|
13
13
|
case "currency":
|
|
14
|
-
return
|
|
15
|
-
case "percentage":
|
|
14
|
+
return y(t, "currency");
|
|
16
15
|
default:
|
|
17
16
|
return `${Math.round(r)}%`;
|
|
18
17
|
}
|
|
19
|
-
},
|
|
18
|
+
}, h = () => {
|
|
20
19
|
const t = Math.floor(Math.random() * 360), l = 60 + Math.floor(Math.random() * 30), n = 45 + Math.floor(Math.random() * 20);
|
|
21
20
|
return ((o, a, c) => {
|
|
22
21
|
a /= 100, c /= 100;
|
|
@@ -26,19 +25,19 @@ const E = (t, l, n) => {
|
|
|
26
25
|
};
|
|
27
26
|
return `#${u(0)}${u(8)}${u(4)}`;
|
|
28
27
|
})(t, l, n);
|
|
29
|
-
},
|
|
28
|
+
}, T = (t, l) => Array.isArray(t) ? t[l] || h() : typeof t == "string" ? t : h(), F = (t) => {
|
|
30
29
|
const l = t.labels ?? [], n = t.datasets[0];
|
|
31
30
|
return n ? (n.data ?? []).map((o, a) => ({
|
|
32
31
|
label: l[a] ?? "",
|
|
33
32
|
value: o,
|
|
34
|
-
backgroundColor:
|
|
33
|
+
backgroundColor: T(n.backgroundColor, a)
|
|
35
34
|
})) : [];
|
|
36
|
-
},
|
|
35
|
+
}, R = (t, l) => {
|
|
37
36
|
if (!l)
|
|
38
37
|
return {
|
|
39
38
|
labels: t.map((e) => e.label),
|
|
40
39
|
values: t.map((e) => e.value),
|
|
41
|
-
colors: t.map((e) => e.backgroundColor ||
|
|
40
|
+
colors: t.map((e) => e.backgroundColor || h()),
|
|
42
41
|
mergedMap: {}
|
|
43
42
|
};
|
|
44
43
|
const { mode: n, value: r, otherLabel: o = "Other", otherBackgroundColor: a = "#B0BEC5" } = l, c = t.reduce((e, p) => e + p.value, 0), s = [], u = [];
|
|
@@ -47,7 +46,7 @@ const E = (t, l, n) => {
|
|
|
47
46
|
(n === "percentage" ? e.value / c * 100 < r : e.value < r) ? (d += e.value, u.push(e)) : s.push({
|
|
48
47
|
label: e.label,
|
|
49
48
|
value: e.value,
|
|
50
|
-
color: e.backgroundColor ||
|
|
49
|
+
color: e.backgroundColor || h()
|
|
51
50
|
});
|
|
52
51
|
});
|
|
53
52
|
const i = {};
|
|
@@ -57,41 +56,39 @@ const E = (t, l, n) => {
|
|
|
57
56
|
colors: s.map((e) => e.color),
|
|
58
57
|
mergedMap: i
|
|
59
58
|
};
|
|
60
|
-
},
|
|
61
|
-
var m, f, g, b, v, C, y, x, w, k;
|
|
59
|
+
}, V = (t, l, n) => ({ chart: r, tooltip: o }) => {
|
|
62
60
|
const a = {};
|
|
63
61
|
if (o.opacity === 0) {
|
|
64
|
-
t((
|
|
62
|
+
t((f) => ({ ...f, style: { ...f.style, opacity: 0, pointerEvents: "none" } }));
|
|
65
63
|
return;
|
|
66
64
|
}
|
|
67
65
|
if (!o.dataPoints || o.dataPoints.length === 0) return;
|
|
68
66
|
a.opacity = "1", a.position = "absolute", a.pointerEvents = "none";
|
|
69
67
|
const c = r.canvas.getBoundingClientRect();
|
|
70
68
|
a.left = c.left + window.pageXOffset + o.caretX + "px", a.top = c.top + window.pageYOffset + o.caretY + "px";
|
|
71
|
-
const s = o.dataPoints[0].dataIndex, u =
|
|
69
|
+
const s = o.dataPoints[0].dataIndex, u = o.dataPoints?.[0]?.label ?? "", d = o.dataPoints?.[0]?.raw ?? 0, i = o.dataPoints?.[0]?.dataset.backgroundColor?.[s] ?? "", e = o.dataPoints?.[0]?.dataset.data?.reduce((f, g) => f + g, 0) || 1, p = e > 0 ? d / e * 100 : 0;
|
|
72
70
|
t({
|
|
73
71
|
label: u,
|
|
74
72
|
value: d,
|
|
75
73
|
percentage: p,
|
|
76
|
-
formattedValue:
|
|
74
|
+
formattedValue: x(d, e, l),
|
|
77
75
|
backgroundColor: typeof i == "string" ? i : "#000",
|
|
78
76
|
mergedItems: n[s] ?? [],
|
|
79
77
|
style: a,
|
|
80
78
|
dataPoints: o.dataPoints
|
|
81
79
|
});
|
|
82
|
-
},
|
|
80
|
+
}, $ = (t, l) => ({
|
|
83
81
|
id: "pieLabelPlugin",
|
|
84
82
|
afterDraw(n) {
|
|
85
83
|
const { ctx: r } = n, o = n.getDatasetMeta(0), a = n.data.datasets[0].data.reduce((c, s) => c + s, 0);
|
|
86
84
|
o.data.forEach((c, s) => {
|
|
87
|
-
var f;
|
|
88
85
|
const d = n.data.datasets[0].data[s] ?? 0;
|
|
89
86
|
if ((a > 0 ? d / a * 100 : 0) < l) return;
|
|
90
|
-
const { x: e, y: p } = c.tooltipPosition(!1),
|
|
91
|
-
r.save(), r.textAlign = "center", r.textBaseline = "middle", r.fillStyle = "#FFFFFF", r.font = "bold 10px Inter, sans-serif", r.fillText(
|
|
87
|
+
const { x: e, y: p } = c.tooltipPosition(!1), f = n.data.labels?.[s];
|
|
88
|
+
r.save(), r.textAlign = "center", r.textBaseline = "middle", r.fillStyle = "#FFFFFF", r.font = "bold 10px Inter, sans-serif", r.fillText(f, e || 0, (p || 0) - 6), r.fillText(x(d, a, t), e || 0, (p || 0) + 8), r.restore();
|
|
92
89
|
});
|
|
93
90
|
}
|
|
94
|
-
}),
|
|
91
|
+
}), j = {
|
|
95
92
|
responsive: !0,
|
|
96
93
|
maintainAspectRatio: !1,
|
|
97
94
|
plugins: {
|
|
@@ -108,7 +105,7 @@ const E = (t, l, n) => {
|
|
|
108
105
|
borderWidth: 0
|
|
109
106
|
}
|
|
110
107
|
}
|
|
111
|
-
},
|
|
108
|
+
}, Y = ({
|
|
112
109
|
data: t,
|
|
113
110
|
height: l,
|
|
114
111
|
classNameContainer: n,
|
|
@@ -119,7 +116,7 @@ const E = (t, l, n) => {
|
|
|
119
116
|
valueFormat: s,
|
|
120
117
|
hideLabelBelowPercentage: u = 5
|
|
121
118
|
}) => {
|
|
122
|
-
const [d, i] =
|
|
119
|
+
const [d, i] = m.useState({
|
|
123
120
|
style: { opacity: 0, position: "absolute", left: 0, top: 0 },
|
|
124
121
|
label: "",
|
|
125
122
|
value: 0,
|
|
@@ -128,45 +125,45 @@ const E = (t, l, n) => {
|
|
|
128
125
|
backgroundColor: "",
|
|
129
126
|
mergedItems: [],
|
|
130
127
|
dataPoints: []
|
|
131
|
-
}), e =
|
|
128
|
+
}), e = m.useMemo(() => F(t), [t]), {
|
|
132
129
|
labels: p,
|
|
133
|
-
values:
|
|
134
|
-
colors:
|
|
135
|
-
mergedMap:
|
|
136
|
-
} =
|
|
130
|
+
values: f,
|
|
131
|
+
colors: g,
|
|
132
|
+
mergedMap: v
|
|
133
|
+
} = m.useMemo(() => R(e, c), [e, c]), M = m.useMemo(
|
|
137
134
|
() => ({
|
|
138
135
|
labels: p,
|
|
139
136
|
datasets: [
|
|
140
137
|
{
|
|
141
138
|
...t.datasets[0],
|
|
142
|
-
data:
|
|
143
|
-
backgroundColor:
|
|
139
|
+
data: f,
|
|
140
|
+
backgroundColor: g,
|
|
144
141
|
hoverOffset: 8,
|
|
145
142
|
borderWidth: 0
|
|
146
143
|
}
|
|
147
144
|
]
|
|
148
145
|
}),
|
|
149
|
-
[p,
|
|
150
|
-
),
|
|
146
|
+
[p, f, g, t.datasets]
|
|
147
|
+
), P = m.useMemo(() => A(j, {
|
|
151
148
|
plugins: {
|
|
152
149
|
tooltip: {
|
|
153
150
|
enabled: !a,
|
|
154
|
-
external: a ? ({ chart:
|
|
151
|
+
external: a ? ({ chart: C, tooltip: O }) => V(i, s, v)({ chart: C, tooltip: O }) : void 0
|
|
155
152
|
}
|
|
156
153
|
}
|
|
157
|
-
}, o ?? {}), [o, a, s,
|
|
158
|
-
return /* @__PURE__ */
|
|
159
|
-
a && /* @__PURE__ */
|
|
160
|
-
/* @__PURE__ */
|
|
161
|
-
|
|
154
|
+
}, o ?? {}), [o, a, s, v]);
|
|
155
|
+
return /* @__PURE__ */ w("div", { id: r, className: n, style: { height: l || "300px" }, children: [
|
|
156
|
+
a && /* @__PURE__ */ b(B, { selector: "body", children: /* @__PURE__ */ b(a, { ...d }) }),
|
|
157
|
+
/* @__PURE__ */ b(
|
|
158
|
+
S,
|
|
162
159
|
{
|
|
163
|
-
data:
|
|
164
|
-
options:
|
|
165
|
-
plugins: [
|
|
160
|
+
data: M,
|
|
161
|
+
options: P,
|
|
162
|
+
plugins: [$(s, u)]
|
|
166
163
|
}
|
|
167
164
|
)
|
|
168
165
|
] });
|
|
169
166
|
};
|
|
170
167
|
export {
|
|
171
|
-
|
|
168
|
+
Y as default
|
|
172
169
|
};
|
|
@@ -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 i=require("react/jsx-runtime"),n=require("react"),v=require("./style.module.scss.cjs"),g=({children:o,id:s,open:l,className:r,classNameContainer:a,maxCollapsedHeight:c="0px",triggerCalCulateContainer:u,delayTriggerCalculateHeight:d=0})=>{const[h,m]=n.useState("1000vh"),e=()=>{const t=document?.getElementById(s)?.offsetHeight??0;m(t||"1000vh")};return n.useEffect(()=>{const t=setTimeout(e,d);return window?.addEventListener("resize",e),window?.addEventListener("load",e),()=>{clearTimeout(t),window?.removeEventListener("resize",e),window?.removeEventListener("load",e)}},[u]),i.jsx("div",{className:`${v.default.collapse} ${a??""}`,style:{maxHeight:l?h:c},children:i.jsx("div",{id:s,className:r??"",children:o})})};exports.default=g;
|
|
@@ -1,35 +1,34 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
children:
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import i from "react";
|
|
3
|
+
import v from "./style.module.scss.mjs";
|
|
4
|
+
const p = ({
|
|
5
|
+
children: n,
|
|
6
6
|
id: o,
|
|
7
|
-
open:
|
|
8
|
-
className:
|
|
9
|
-
classNameContainer:
|
|
10
|
-
maxCollapsedHeight:
|
|
11
|
-
triggerCalCulateContainer:
|
|
12
|
-
delayTriggerCalculateHeight:
|
|
7
|
+
open: r,
|
|
8
|
+
className: a,
|
|
9
|
+
classNameContainer: l,
|
|
10
|
+
maxCollapsedHeight: c = "0px",
|
|
11
|
+
triggerCalCulateContainer: d,
|
|
12
|
+
delayTriggerCalculateHeight: m = 0
|
|
13
13
|
}) => {
|
|
14
|
-
const [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
v(t || "1000vh");
|
|
14
|
+
const [h, u] = i.useState("1000vh"), e = () => {
|
|
15
|
+
const t = document?.getElementById(o)?.offsetHeight ?? 0;
|
|
16
|
+
u(t || "1000vh");
|
|
18
17
|
};
|
|
19
|
-
return
|
|
20
|
-
const t = setTimeout(e,
|
|
21
|
-
return window
|
|
22
|
-
clearTimeout(t), window
|
|
18
|
+
return i.useEffect(() => {
|
|
19
|
+
const t = setTimeout(e, m);
|
|
20
|
+
return window?.addEventListener("resize", e), window?.addEventListener("load", e), () => {
|
|
21
|
+
clearTimeout(t), window?.removeEventListener("resize", e), window?.removeEventListener("load", e);
|
|
23
22
|
};
|
|
24
|
-
}, [
|
|
23
|
+
}, [d]), /* @__PURE__ */ s(
|
|
25
24
|
"div",
|
|
26
25
|
{
|
|
27
|
-
className: `${
|
|
28
|
-
style: { maxHeight:
|
|
29
|
-
children: /* @__PURE__ */
|
|
26
|
+
className: `${v.collapse} ${l ?? ""}`,
|
|
27
|
+
style: { maxHeight: r ? h : c },
|
|
28
|
+
children: /* @__PURE__ */ s("div", { id: o, className: a ?? "", children: n })
|
|
30
29
|
}
|
|
31
30
|
);
|
|
32
31
|
};
|
|
33
32
|
export {
|
|
34
|
-
|
|
33
|
+
p as default
|
|
35
34
|
};
|
|
@@ -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 i=require("react/jsx-runtime"),h=require("react"),p=require("@internationalized/date"),G=require("../Calendar/Calendar.cjs"),w=require("react-aria"),Z=require("../Popover/Popover.cjs"),f=c=>{let s;const r=new Date(c??new Date);return c&&(s=p.parseDate(new Date(r.setHours(r.getHours()+7)).toISOString().slice(0,10))),s},J=c=>{const{minDate:s,maxDate:r,value:u,defaultValue:P,withConfirm:T=!1,isCustomTime:D=!1,className:b,classNameButton:j,buttonClick:H,buttonReset:I,buttonSubmit:M,prevIcon:y,nextIcon:q,onChange:l,id:R="date-picker",idPopover:k="date-picker-popover",floatingOptions:N={},offsetPopover:O=5,zIndexPopper:V=1,hiddenHeader:L}=c,d=w.useDateFormatter(),{locale:z}=w.useLocale(),F=f(s),_=f(r),g=h.useRef(null),[S,x]=h.useState(),[m,C]=h.useState(),$=a=>{const o=new Date;let e=a.toDate(p.getLocalTimeZone());e.setHours(o.getHours(),o.getMinutes(),o.getSeconds());const t=s?new Date(s):null,n=r?new Date(r):null;if(D){if(e=new Date(new Date(e).setHours(m?.hour??0,m?.minut,m?.second)),t&&t?.toDateString()===new Date(e).toDateString()&&t?.toTimeString()>=e?.toTimeString()){if(t&&(t.getHours()>e.getHours()||t.getHours()===e.getHours()&&t.getMinutes()>e.getMinutes()))return;e=new Date(t.setSeconds(t.getSeconds()+1))}if(n&&n?.toDateString()===new Date(e).toDateString()&&n?.toTimeString()<e?.toTimeString()){if(n&&(n.getHours()<e.getHours()||n.getHours()===e.getHours()&&n.getMinutes()<e.getMinutes()))return;e=new Date(n.setSeconds(n.getSeconds()-1))}}else t&&d.format(e)===d.format(t)&&t.getTime()>=e.getTime()?e=new Date(t.setSeconds(t.getSeconds()+1)):n&&d.format(e)===d.format(n)&&n.getTime()<=e.getTime()&&(e=new Date(n.setSeconds(n.getSeconds()-1)));typeof l=="function"&&(l(e),g.current?.setShow(!1))},v=(a,o)=>{x(a),(o??(!T&&!D))&&$(a)},A=a=>{const{start:o}=a;C(o)},B=a=>{const o=new Date(u??new Date);C({hour:o.getHours(),minut:o.getMinutes(),second:o.getSeconds()}),x(f(u))},E=()=>{S&&v(S,!0)};return i.jsxs(i.Fragment,{children:[i.jsx("div",{id:R,onClick:a=>{g.current?.handlerShow(a),B()},className:j,children:typeof H=="function"?H(u):u?new Date(u).toDateString():"Pilih Tanggal"}),i.jsx(Z.default,{zIndex:V,ref:g,offset:O,id:k,floatingOptions:{placement:"bottom-end",...N},children:i.jsx("div",{className:b??"",children:i.jsx(w.I18nProvider,{locale:"id-ID",children:i.jsx(G.default,{minValue:F,maxValue:_,minDate:s,maxDate:r,time:{start:m},locale:z,value:S,typeTime:"SINGLE",buttonReset:I,buttonSubmit:M,prevIcon:y,nextIcon:q,createCalendar:p.createCalendar,defaultValue:f(u),onChange:v,handlerReset:()=>{typeof l=="function"&&(l(P),g.current?.setShow(!1))},handlerSubmit:E,handlerChangeTime:A,withConfirm:T,isCustomTime:D,type:["date","month","year"],hiddenHeader:L})})})})]})};exports.default=J;
|
|
@@ -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;
|