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.
Files changed (91) hide show
  1. package/dist/assets/style.css +1 -1
  2. package/dist/components/Alert/index.cjs +1 -1
  3. package/dist/components/Alert/index.mjs +40 -40
  4. package/dist/components/Breadcrumbs/Breadcrumbs.cjs +3 -3
  5. package/dist/components/Breadcrumbs/Breadcrumbs.mjs +43 -43
  6. package/dist/components/ButtonPopover/ButtonPopover.cjs +1 -1
  7. package/dist/components/ButtonPopover/ButtonPopover.mjs +28 -31
  8. package/dist/components/Calendar/Calendar.cjs +1 -1
  9. package/dist/components/Calendar/Calendar.mjs +98 -100
  10. package/dist/components/Calendar/CalendarMonth.cjs +1 -1
  11. package/dist/components/Calendar/CalendarMonth.mjs +41 -42
  12. package/dist/components/Calendar/CalendarRange.cjs +1 -1
  13. package/dist/components/Calendar/CalendarRange.mjs +59 -61
  14. package/dist/components/Calendar/CalendarYear.cjs +2 -2
  15. package/dist/components/Calendar/CalendarYear.mjs +37 -38
  16. package/dist/components/Chart/DoughnutChart.cjs +1 -1
  17. package/dist/components/Chart/DoughnutChart.mjs +93 -96
  18. package/dist/components/Chart/GradientBarChart.cjs +1 -1
  19. package/dist/components/Chart/GradientBarChart.mjs +80 -81
  20. package/dist/components/Chart/GradientLineChart.cjs +1 -1
  21. package/dist/components/Chart/GradientLineChart.mjs +50 -51
  22. package/dist/components/Chart/LineChart.cjs +1 -1
  23. package/dist/components/Chart/LineChart.mjs +23 -23
  24. package/dist/components/Chart/PieChart.cjs +1 -1
  25. package/dist/components/Chart/PieChart.mjs +45 -48
  26. package/dist/components/Collapse/Collapse.cjs +1 -1
  27. package/dist/components/Collapse/Collapse.mjs +23 -24
  28. package/dist/components/DatePicker/DatePicker.cjs +1 -1
  29. package/dist/components/DatePicker/DatePicker.mjs +86 -89
  30. package/dist/components/DatePicker/DateRangePicker.cjs +1 -1
  31. package/dist/components/DatePicker/DateRangePicker.mjs +91 -92
  32. package/dist/components/DatePicker/FilterDate.cjs +1 -1
  33. package/dist/components/DatePicker/FilterDate.mjs +107 -110
  34. package/dist/components/DatePicker/MonthYearPicker.cjs +1 -1
  35. package/dist/components/DatePicker/MonthYearPicker.mjs +51 -53
  36. package/dist/components/FilterContainer/FilterContainer.cjs +1 -1
  37. package/dist/components/FilterContainer/FilterContainer.mjs +27 -27
  38. package/dist/components/Input/InputFloatingInner.cjs +5 -5
  39. package/dist/components/Input/InputFloatingInner.mjs +24 -25
  40. package/dist/components/NumberFormat/NumberFormat.cjs +1 -1
  41. package/dist/components/NumberFormat/NumberFormat.mjs +12 -13
  42. package/dist/components/Pagination/Pagination.cjs +2 -2
  43. package/dist/components/Pagination/Pagination.mjs +76 -80
  44. package/dist/components/SelectDropdownContainer/SelectDropdownContainer.cjs +1 -1
  45. package/dist/components/SelectDropdownContainer/SelectDropdownContainer.mjs +98 -102
  46. package/dist/components/Sidebar/ItemSidebar.cjs +8 -8
  47. package/dist/components/Sidebar/ItemSidebar.mjs +71 -72
  48. package/dist/components/Sidebar/Sidebar.cjs +1 -1
  49. package/dist/components/Sidebar/Sidebar.mjs +65 -68
  50. package/dist/components/Step/Step.cjs +5 -5
  51. package/dist/components/Step/Step.mjs +52 -52
  52. package/dist/components/Table/Table.cjs +3 -3
  53. package/dist/components/Table/Table.mjs +275 -298
  54. package/dist/components/Table/TableSubMobile.cjs +1 -1
  55. package/dist/components/Table/TableSubMobile.mjs +32 -35
  56. package/dist/components/Tabs/Tabs.cjs +8 -8
  57. package/dist/components/Tabs/Tabs.mjs +66 -70
  58. package/dist/components/Textarea/Textarea.cjs +7 -7
  59. package/dist/components/Textarea/Textarea.mjs +47 -50
  60. package/dist/components/Textarea/TextareaFloatingInner.cjs +6 -6
  61. package/dist/components/Textarea/TextareaFloatingInner.mjs +56 -61
  62. package/dist/components/Textarea/TextareaInnerLabel.cjs +6 -6
  63. package/dist/components/Textarea/TextareaInnerLabel.mjs +47 -50
  64. package/dist/components/TimeRange/TimeRange.cjs +1 -1
  65. package/dist/components/TimeRange/TimeRange.mjs +88 -91
  66. package/dist/components/Tooltip/Tooltip.cjs +1 -1
  67. package/dist/components/Tooltip/Tooltip.mjs +44 -46
  68. package/dist/components/Upload/UploadFile.cjs +1 -1
  69. package/dist/components/Upload/UploadFile.mjs +50 -54
  70. package/dist/components/Upload/UploadImage.cjs +3 -3
  71. package/dist/components/Upload/UploadImage.mjs +62 -68
  72. package/dist/components/Upload/UploadMultipleFile.cjs +1 -1
  73. package/dist/components/Upload/UploadMultipleFile.mjs +61 -62
  74. package/dist/components/Virtualization/ListVirtualization.cjs +1 -1
  75. package/dist/components/Virtualization/ListVirtualization.mjs +52 -55
  76. package/dist/components/Virtualization/TableVirtualization.cjs +1 -1
  77. package/dist/components/Virtualization/TableVirtualization.mjs +56 -59
  78. package/dist/config/components/tinymce.cjs +2 -2
  79. package/dist/config/components/tinymce.mjs +3 -3
  80. package/dist/hooks/useCountdown.cjs +1 -1
  81. package/dist/hooks/useCountdown.mjs +15 -15
  82. package/dist/hooks/useDebounce.cjs +1 -1
  83. package/dist/hooks/useDebounce.mjs +19 -19
  84. package/dist/hooks/useOtpInput.cjs +1 -1
  85. package/dist/hooks/useOtpInput.mjs +47 -51
  86. package/dist/package.json.cjs +1 -1
  87. package/dist/package.json.d.ts +5 -4
  88. package/dist/package.json.mjs +1 -1
  89. package/dist/utils/common.cjs +1 -1
  90. package/dist/utils/common.mjs +172 -173
  91. package/package.json +4 -4
@@ -1,22 +1,21 @@
1
- import { jsxs as A, jsx as O } from "react/jsx-runtime";
2
- import { Chart as B, ArcElement as T, Tooltip as F } from "chart.js";
3
- import h from "react";
4
- import { Pie as R } from "react-chartjs-2";
5
- import { mergeObjects as V, formatNumber as I } from "../../utils/common.mjs";
6
- import $ from "../PortalComponent/PortalComponent.mjs";
7
- B.register(T, F);
8
- const E = (t, l, n) => {
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 I(t, "decimal");
12
+ return y(t, "decimal");
13
13
  case "currency":
14
- return I(t, "currency");
15
- case "percentage":
14
+ return y(t, "currency");
16
15
  default:
17
16
  return `${Math.round(r)}%`;
18
17
  }
19
- }, P = () => {
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
- }, j = (t, l) => Array.isArray(t) ? t[l] || P() : typeof t == "string" ? t : P(), D = (t) => {
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: j(n.backgroundColor, a)
33
+ backgroundColor: T(n.backgroundColor, a)
35
34
  })) : [];
36
- }, L = (t, l) => {
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 || P()),
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 || P()
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
- }, G = (t, l, n) => ({ chart: r, tooltip: o }) => {
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((M) => ({ ...M, style: { ...M.style, opacity: 0, pointerEvents: "none" } }));
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 = ((f = (m = o.dataPoints) == null ? void 0 : m[0]) == null ? void 0 : f.label) ?? "", d = ((b = (g = o.dataPoints) == null ? void 0 : g[0]) == null ? void 0 : b.raw) ?? 0, i = ((y = (C = (v = o.dataPoints) == null ? void 0 : v[0]) == null ? void 0 : C.dataset.backgroundColor) == null ? void 0 : y[s]) ?? "", e = ((k = (w = (x = o.dataPoints) == null ? void 0 : x[0]) == null ? void 0 : w.dataset.data) == null ? void 0 : k.reduce((M, S) => M + S, 0)) || 1, p = e > 0 ? d / e * 100 : 0;
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: E(d, e, l),
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
- }, H = (t, l) => ({
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), m = (f = n.data.labels) == null ? void 0 : f[s];
91
- r.save(), r.textAlign = "center", r.textBaseline = "middle", r.fillStyle = "#FFFFFF", r.font = "bold 10px Inter, sans-serif", r.fillText(m, e || 0, (p || 0) - 6), r.fillText(E(d, a, t), e || 0, (p || 0) + 8), r.restore();
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
- }), N = {
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
- }, K = ({
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] = h.useState({
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 = h.useMemo(() => D(t), [t]), {
128
+ }), e = m.useMemo(() => F(t), [t]), {
132
129
  labels: p,
133
- values: m,
134
- colors: f,
135
- mergedMap: g
136
- } = h.useMemo(() => L(e, c), [e, c]), b = h.useMemo(
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: m,
143
- backgroundColor: f,
139
+ data: f,
140
+ backgroundColor: g,
144
141
  hoverOffset: 8,
145
142
  borderWidth: 0
146
143
  }
147
144
  ]
148
145
  }),
149
- [p, m, f, t.datasets]
150
- ), v = h.useMemo(() => V(N, {
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: y, tooltip: x }) => G(i, s, g)({ chart: y, tooltip: x }) : void 0
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, g]);
158
- return /* @__PURE__ */ A("div", { id: r, className: n, style: { height: l || "300px" }, children: [
159
- a && /* @__PURE__ */ O($, { selector: "body", children: /* @__PURE__ */ O(a, { ...d }) }),
160
- /* @__PURE__ */ O(
161
- R,
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: b,
164
- options: v,
165
- plugins: [H(s, u)]
160
+ data: M,
161
+ options: P,
162
+ plugins: [$(s, u)]
166
163
  }
167
164
  )
168
165
  ] });
169
166
  };
170
167
  export {
171
- K as default
168
+ Y as default
172
169
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),o=require("react"),g=require("./style.module.scss.cjs"),w=({children:l,id:s,open:r,className:a,classNameContainer:c,maxCollapsedHeight:u="0px",triggerCalCulateContainer:d,delayTriggerCalculateHeight:h=0})=>{const[m,v]=o.useState("1000vh"),e=()=>{var i;const t=((i=document==null?void 0:document.getElementById(s))==null?void 0:i.offsetHeight)??0;v(t||"1000vh")};return o.useEffect(()=>{const t=setTimeout(e,h);return window==null||window.addEventListener("resize",e),window==null||window.addEventListener("load",e),()=>{clearTimeout(t),window==null||window.removeEventListener("resize",e),window==null||window.removeEventListener("load",e)}},[d]),n.jsx("div",{className:`${g.default.collapse} ${c??""}`,style:{maxHeight:r?m:u},children:n.jsx("div",{id:s,className:a??"",children:l})})};exports.default=w;
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 i } from "react/jsx-runtime";
2
- import n from "react";
3
- import w from "./style.module.scss.mjs";
4
- const E = ({
5
- children: r,
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: a,
8
- className: l,
9
- classNameContainer: c,
10
- maxCollapsedHeight: d = "0px",
11
- triggerCalCulateContainer: m,
12
- delayTriggerCalculateHeight: h = 0
7
+ open: r,
8
+ className: a,
9
+ classNameContainer: l,
10
+ maxCollapsedHeight: c = "0px",
11
+ triggerCalCulateContainer: d,
12
+ delayTriggerCalculateHeight: m = 0
13
13
  }) => {
14
- const [u, v] = n.useState("1000vh"), e = () => {
15
- var s;
16
- const t = ((s = document == null ? void 0 : document.getElementById(o)) == null ? void 0 : s.offsetHeight) ?? 0;
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 n.useEffect(() => {
20
- const t = setTimeout(e, h);
21
- return window == null || window.addEventListener("resize", e), window == null || window.addEventListener("load", e), () => {
22
- clearTimeout(t), window == null || window.removeEventListener("resize", e), window == null || window.removeEventListener("load", e);
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
- }, [m]), /* @__PURE__ */ i(
23
+ }, [d]), /* @__PURE__ */ s(
25
24
  "div",
26
25
  {
27
- className: `${w.collapse} ${c ?? ""}`,
28
- style: { maxHeight: a ? u : d },
29
- children: /* @__PURE__ */ i("div", { id: o, className: l ?? "", children: r })
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
- E as default
33
+ p as default
35
34
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("react/jsx-runtime"),m=require("react"),w=require("@internationalized/date"),Z=require("../Calendar/Calendar.cjs"),p=require("react-aria"),J=require("../Popover/Popover.cjs"),S=l=>{let r;const i=new Date(l??new Date);return l&&(r=w.parseDate(new Date(i.setHours(i.getHours()+7)).toISOString().slice(0,10))),r},K=l=>{const{minDate:r,maxDate:i,value:c,defaultValue:b,withConfirm:H=!1,isCustomTime:D=!1,className:j,classNameButton:I,buttonClick:C,buttonReset:M,buttonSubmit:y,prevIcon:q,nextIcon:R,onChange:d,id:k="date-picker",idPopover:N="date-picker-popover",floatingOptions:O={},offsetPopover:V=5,zIndexPopper:L=1,hiddenHeader:z}=l,g=p.useDateFormatter(),{locale:F}=p.useLocale(),_=S(r),$=S(i),f=m.useRef(null),[h,v]=m.useState(),[a,x]=m.useState(),A=s=>{var T;const o=new Date;let e=s.toDate(w.getLocalTimeZone());e.setHours(o.getHours(),o.getMinutes(),o.getSeconds());const t=r?new Date(r):null,n=i?new Date(i):null;if(D){if(e=new Date(new Date(e).setHours((a==null?void 0:a.hour)??0,a==null?void 0:a.minut,a==null?void 0:a.second)),t&&(t==null?void 0:t.toDateString())===new Date(e).toDateString()&&(t==null?void 0:t.toTimeString())>=(e==null?void 0: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==null?void 0:n.toDateString())===new Date(e).toDateString()&&(n==null?void 0:n.toTimeString())<(e==null?void 0: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&&g.format(e)===g.format(t)&&t.getTime()>=e.getTime()?e=new Date(t.setSeconds(t.getSeconds()+1)):n&&g.format(e)===g.format(n)&&n.getTime()<=e.getTime()&&(e=new Date(n.setSeconds(n.getSeconds()-1)));typeof d=="function"&&(d(e),(T=f.current)==null||T.setShow(!1))},P=(s,o)=>{v(s),(o??(!H&&!D))&&A(s)},B=s=>{const{start:o}=s;x(o)},E=s=>{const o=new Date(c??new Date);x({hour:o.getHours(),minut:o.getMinutes(),second:o.getSeconds()}),v(S(c))},G=()=>{h&&P(h,!0)};return u.jsxs(u.Fragment,{children:[u.jsx("div",{id:k,onClick:s=>{var o;(o=f.current)==null||o.handlerShow(s),E()},className:I,children:typeof C=="function"?C(c):c?new Date(c).toDateString():"Pilih Tanggal"}),u.jsx(J.default,{zIndex:L,ref:f,offset:V,id:N,floatingOptions:{placement:"bottom-end",...O},children:u.jsx("div",{className:j??"",children:u.jsx(p.I18nProvider,{locale:"id-ID",children:u.jsx(Z.default,{minValue:_,maxValue:$,minDate:r,maxDate:i,time:{start:a},locale:F,value:h,typeTime:"SINGLE",buttonReset:M,buttonSubmit:y,prevIcon:q,nextIcon:R,createCalendar:w.createCalendar,defaultValue:S(c),onChange:P,handlerReset:()=>{var s;typeof d=="function"&&(d(b),(s=f.current)==null||s.setShow(!1))},handlerSubmit:G,handlerChangeTime:B,withConfirm:H,isCustomTime:D,type:["date","month","year"],hiddenHeader:z})})})})]})};exports.default=K;
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 A, Fragment as J, jsx as u } from "react/jsx-runtime";
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 K, parseDate as Q, getLocalTimeZone as U } from "@internationalized/date";
4
- import W from "../Calendar/Calendar.mjs";
5
- import { useDateFormatter as X, useLocale as Y, I18nProvider as _ } from "react-aria";
6
- import $ from "../Popover/Popover.mjs";
7
- const m = (l) => {
8
- let a;
9
- const i = new Date(l ?? /* @__PURE__ */ new Date());
10
- return l && (a = Q(new Date(i.setHours(i.getHours() + 7)).toISOString().slice(0, 10))), a;
11
- }, ae = (l) => {
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: a,
14
- maxDate: i,
15
- value: c,
16
- defaultValue: P,
13
+ minDate: s,
14
+ maxDate: r,
15
+ value: i,
16
+ defaultValue: v,
17
17
  withConfirm: h = !1,
18
18
  isCustomTime: D = !1,
19
- className: T,
20
- classNameButton: b,
19
+ className: x,
20
+ classNameButton: I,
21
21
  buttonClick: w,
22
- buttonReset: y,
23
- buttonSubmit: M,
24
- prevIcon: k,
25
- nextIcon: x,
26
- onChange: d,
27
- id: N = "date-picker",
28
- idPopover: R = "date-picker-popover",
29
- floatingOptions: V = {},
30
- offsetPopover: L = 5,
31
- zIndexPopper: O = 1,
32
- hiddenHeader: j
33
- } = l, f = X(), { locale: z } = Y(), F = m(a), B = m(i), g = p.useRef(null), [S, H] = p.useState(), [r, C] = p.useState(), E = (s) => {
34
- var I;
35
- const n = /* @__PURE__ */ new Date();
36
- let e = s.toDate(U());
37
- e.setHours(n.getHours(), n.getMinutes(), n.getSeconds());
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((r == null ? void 0 : r.hour) ?? 0, r == null ? void 0 : r.minut, r == null ? void 0 : r.second)), t && (t == null ? void 0 : t.toDateString()) === new Date(e).toDateString() && (t == null ? void 0 : t.toTimeString()) >= (e == null ? void 0 : e.toTimeString())) {
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 (o && (o == null ? void 0 : o.toDateString()) === new Date(e).toDateString() && (o == null ? void 0 : o.toTimeString()) < (e == null ? void 0 : e.toTimeString())) {
46
- if (o && (o.getHours() < e.getHours() || o.getHours() === e.getHours() && o.getMinutes() < e.getMinutes()))
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(o.setSeconds(o.getSeconds() - 1));
47
+ e = new Date(n.setSeconds(n.getSeconds() - 1));
49
48
  }
50
49
  } else
51
- t && f.format(e) === f.format(t) && t.getTime() >= e.getTime() ? e = new Date(t.setSeconds(t.getSeconds() + 1)) : o && f.format(e) === f.format(o) && o.getTime() <= e.getTime() && (e = new Date(o.setSeconds(o.getSeconds() - 1)));
52
- typeof d == "function" && (d(e), (I = g.current) == null || I.setShow(!1));
53
- }, v = (s, n) => {
54
- H(s), (n ?? (!h && !D)) && E(s);
55
- }, G = (s) => {
56
- const { start: n } = s;
57
- C(n);
58
- }, Z = (s) => {
59
- const n = new Date(c ?? /* @__PURE__ */ new Date());
60
- C({
61
- hour: n.getHours(),
62
- minut: n.getMinutes(),
63
- second: n.getSeconds()
64
- }), H(m(c));
65
- }, q = () => {
66
- S && v(S, !0);
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(J, { children: [
69
- /* @__PURE__ */ u(
67
+ return /* @__PURE__ */ q(A, { children: [
68
+ /* @__PURE__ */ c(
70
69
  "div",
71
70
  {
72
- id: N,
73
- onClick: (s) => {
74
- var n;
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: b,
78
- children: typeof w == "function" ? w(c) : c ? new Date(c).toDateString() : "Pilih Tanggal"
75
+ className: I,
76
+ children: typeof w == "function" ? w(i) : i ? new Date(i).toDateString() : "Pilih Tanggal"
79
77
  }
80
78
  ),
81
- /* @__PURE__ */ u(
82
- $,
79
+ /* @__PURE__ */ c(
80
+ _,
83
81
  {
84
- zIndex: O,
85
- ref: g,
86
- offset: L,
87
- id: R,
88
- floatingOptions: { placement: "bottom-end", ...V },
89
- children: /* @__PURE__ */ u("div", { className: T ?? "", children: /* @__PURE__ */ u(_, { locale: "id-ID", children: /* @__PURE__ */ u(
90
- W,
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: F,
93
- maxValue: B,
94
- minDate: a,
95
- maxDate: i,
96
- time: { start: r },
97
- locale: z,
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: y,
101
- buttonSubmit: M,
102
- prevIcon: k,
103
- nextIcon: x,
104
- createCalendar: K,
105
- defaultValue: m(c),
106
- onChange: v,
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
- var s;
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: q,
112
- handlerChangeTime: G,
108
+ handlerSubmit: Z,
109
+ handlerChangeTime: E,
113
110
  withConfirm: h,
114
111
  isCustomTime: D,
115
112
  type: ["date", "month", "year"],
116
- hiddenHeader: j
113
+ hiddenHeader: O
117
114
  }
118
115
  ) }) })
119
116
  }
@@ -121,5 +118,5 @@ const m = (l) => {
121
118
  ] });
122
119
  };
123
120
  export {
124
- ae as default
121
+ se as default
125
122
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("react/jsx-runtime"),y=require("react"),Y=require("react-aria"),B=require("../Calendar/CalendarRange.cjs"),n=require("@internationalized/date"),K=require("../Calendar/Calendar.cjs"),H=a=>{let o;const r=new Date(a??new Date);return a&&(o=n.parseDate(new Date(r.setHours(r.getHours()+7)).toISOString().slice(0,10))),o},k=a=>{const o=new Date((a==null?void 0:a.startDate)??new Date),r=new Date((a==null?void 0:a.endDate)??new Date),i=new n.CalendarDate(o.getFullYear(),o.getMonth()+1,o.getDate()),D=new n.CalendarDate(r.getFullYear(),r.getMonth()+1,r.getDate());return a?{start:i,end:D}:void 0},Q=a=>{const{minDate:o,maxDate:r,defaultValue:i,withConfirm:D,prevIcon:M,nextIcon:p,buttonReset:L,buttonSubmit:b,typePicker:j="RANGE",onChange:q,value:c,onReset:E,isCustomTime:w}=a,{locale:_}=Y.useLocale(),I=H(o),N=H(r),[e,C]=y.useState(),[S,T]=y.useState({start:void 0,end:void 0}),Z=t=>{typeof q=="function"&&q(t)},R=(t,s)=>{const d=t.start.toDate(n.getLocalTimeZone()),u=t.end.toDate(n.getLocalTimeZone());C(t),T({start:{hour:0,minut:0,second:0},end:{hour:23,minut:59,second:59}}),(s??!D)&&Z({startDate:d,endDate:new Date(u.setHours(23,59,59))})},x=(t,s)=>{var d,u,g,m,l,f,G,P;if(e!=null&&e.start&&(e!=null&&e.end)&&(T(t),(u=(d=t.start)==null?void 0:d.hour)!=null&&u.toString()&&((m=(g=t.start)==null?void 0:g.minut)!=null&&m.toString())&&((f=(l=t.end)==null?void 0:l.hour)!=null&&f.toString())&&((P=(G=t.end)==null?void 0:G.minut)!=null&&P.toString())&&(s??!D))){const J=e.start.toDate(n.getLocalTimeZone()),z=e.end.toDate(n.getLocalTimeZone()),O=new Date(J.setHours(t.start.hour,t.start.minut)),V=new Date(z.setHours(t.end.hour,t.end.minut,59));O.getTime()<V.getTime()&&Z({startDate:O,endDate:V})}},A=t=>{if(typeof E=="function")E();else if(i&&t){const s=new Date(i.endDate??new Date),d=t.focusedDate.set({month:s.getMonth()+1,year:s.getFullYear()});t.setFocusedDate(d)}C(k(i))},F=()=>{e&&(w?x(S,!0):R(e,!0))};return y.useEffect(()=>{if(c!=null&&c.endDate&&(c!=null&&c.startDate)){const t=new Date(c.startDate),s=new Date(c.endDate),d=t.getHours(),u=t.getMinutes(),g=s.getHours(),m=s.getMinutes(),l=n.toCalendarDate(n.fromDate(t,n.getLocalTimeZone())),f=n.toCalendarDate(n.fromDate(s,n.getLocalTimeZone()));C({start:l,end:f}),T({start:{hour:d,minut:u},end:{hour:g,minut:m}})}},[JSON.stringify(c)]),h.jsx("div",{className:"iru-flex iru-flex-col",children:h.jsxs(Y.I18nProvider,{locale:"id-ID",children:[j==="RANGE"&&h.jsx(B.default,{defaultValue:k(i),value:e,minValue:I,maxValue:N,withConfirm:D,prevIcon:M,nextIcon:p,buttonReset:L,buttonSubmit:b,onChange:t=>R(t),isCustomTime:w,handlerReset:A,handlerSubmit:F,time:S,minDate:o,maxDate:r,handlerChangeTimeRange:x}),j==="SINGLE"&&h.jsx(K.default,{defaultValue:H(i==null?void 0:i.endDate),value:e==null?void 0:e.end,minValue:I,maxValue:N,minDate:o,maxDate:r,withConfirm:D,prevIcon:M,nextIcon:p,buttonReset:L,buttonSubmit:b,locale:_,time:S,typeTime:"RANGE",handlerChangeTime:x,isCustomTime:w,createCalendar:n.createCalendar,onChange:t=>R({start:t,end:t}),handlerReset:A,handlerSubmit:F,type:["date","month","year"]})]})})};exports.default=Q;
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;