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,69 +1,64 @@
|
|
|
1
1
|
import { jsxs as c, jsx as u } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { useMergeRefs as
|
|
5
|
-
import { useIsomorphicLayoutEffect as
|
|
6
|
-
import { configTextareaFloatingInner as
|
|
7
|
-
const
|
|
2
|
+
import s from "react";
|
|
3
|
+
import e from "./TextareaFloatingInner.module.scss.mjs";
|
|
4
|
+
import { useMergeRefs as M } from "../../hooks/useMergeRefs.mjs";
|
|
5
|
+
import { useIsomorphicLayoutEffect as P } from "../../hooks/useCombinedResizeObserver.mjs";
|
|
6
|
+
import { configTextareaFloatingInner as A } from "./TextareaFloatingInner.config.mjs";
|
|
7
|
+
const D = s.forwardRef((n, y) => {
|
|
8
8
|
const {
|
|
9
|
-
isRequired:
|
|
10
|
-
classNameContainer:
|
|
11
|
-
className:
|
|
12
|
-
classNameLabel:
|
|
13
|
-
classNameLabelError:
|
|
9
|
+
isRequired: N,
|
|
10
|
+
classNameContainer: R,
|
|
11
|
+
className: v,
|
|
12
|
+
classNameLabel: H,
|
|
13
|
+
classNameLabelError: I,
|
|
14
14
|
name: f,
|
|
15
15
|
id: m,
|
|
16
16
|
label: d,
|
|
17
|
-
error:
|
|
18
|
-
height:
|
|
17
|
+
error: l,
|
|
18
|
+
height: L,
|
|
19
19
|
minHeight: h = 94,
|
|
20
|
-
maxHeight:
|
|
21
|
-
style:
|
|
22
|
-
sizeInput:
|
|
23
|
-
translateLabel:
|
|
24
|
-
autoTranslateLabel:
|
|
25
|
-
...
|
|
26
|
-
} = n,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}, o = function(e) {
|
|
40
|
-
y();
|
|
41
|
-
const t = (e == null ? void 0 : e.target) ?? s.current;
|
|
42
|
-
t.style.height = "0px", t.style.height = t.scrollHeight + "px";
|
|
20
|
+
maxHeight: T = 150,
|
|
21
|
+
style: F,
|
|
22
|
+
sizeInput: w = "medium",
|
|
23
|
+
translateLabel: E = 20,
|
|
24
|
+
autoTranslateLabel: S = !1,
|
|
25
|
+
...o
|
|
26
|
+
} = n, t = s.useRef(null), V = M(t, y), g = s.useRef(null), Y = { ...F ?? {}, maxHeight: T, height: L ?? h, minHeight: h }, [p, x] = s.useState(!1), [j, b] = s.useState(!1), [z, B] = s.useState(E), $ = () => {
|
|
27
|
+
["", void 0, null].includes(o.value) || ["", void 0, null].includes(t.current?.value) ? (b(!1), S && setTimeout(() => {
|
|
28
|
+
const a = t.current?.offsetHeight ?? 0, r = g.current?.offsetHeight ?? 0, C = (a - r) / 2;
|
|
29
|
+
B(C);
|
|
30
|
+
}, 100)) : b(!0);
|
|
31
|
+
}, k = function(a) {
|
|
32
|
+
x(!0), $(), n.onFocus?.(a);
|
|
33
|
+
}, q = function(a) {
|
|
34
|
+
x(!1), n.onBlur?.(a);
|
|
35
|
+
}, i = function(a) {
|
|
36
|
+
$();
|
|
37
|
+
const r = a?.target ?? t.current;
|
|
38
|
+
r.style.height = "0px", r.style.height = r.scrollHeight + "px";
|
|
43
39
|
};
|
|
44
|
-
return
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}), [x]), /* @__PURE__ */ c(
|
|
40
|
+
return P(() => (p && t.current ? t.current.addEventListener("input", i) : i(), () => {
|
|
41
|
+
t.current?.removeEventListener("input", i);
|
|
42
|
+
}), [p]), /* @__PURE__ */ c(
|
|
48
43
|
"div",
|
|
49
44
|
{
|
|
50
|
-
className: `${
|
|
51
|
-
${
|
|
52
|
-
${
|
|
45
|
+
className: `${e.container}
|
|
46
|
+
${A.size[w]}
|
|
47
|
+
${R ?? ""}`,
|
|
53
48
|
children: [
|
|
54
|
-
/* @__PURE__ */ c("div", { className: `${
|
|
49
|
+
/* @__PURE__ */ c("div", { className: `${e["container-textarea"]}`, children: [
|
|
55
50
|
/* @__PURE__ */ u(
|
|
56
51
|
"textarea",
|
|
57
52
|
{
|
|
58
53
|
id: m ?? f,
|
|
59
|
-
className: `${
|
|
60
|
-
${
|
|
61
|
-
${
|
|
62
|
-
ref:
|
|
63
|
-
style:
|
|
64
|
-
...
|
|
65
|
-
onFocus:
|
|
66
|
-
onBlur:
|
|
54
|
+
className: `${j ? "" : e["placeholder-shown"]} ${l ? e.error : ""}
|
|
55
|
+
${e.textarea}
|
|
56
|
+
${v ?? ""}`,
|
|
57
|
+
ref: V,
|
|
58
|
+
style: Y,
|
|
59
|
+
...o,
|
|
60
|
+
onFocus: k,
|
|
61
|
+
onBlur: q
|
|
67
62
|
}
|
|
68
63
|
),
|
|
69
64
|
d && /* @__PURE__ */ c(
|
|
@@ -72,30 +67,30 @@ const K = l.forwardRef((n, v) => {
|
|
|
72
67
|
htmlFor: m ?? f,
|
|
73
68
|
ref: g,
|
|
74
69
|
style: {
|
|
75
|
-
transform: `translateY(${
|
|
70
|
+
transform: `translateY(${z}px)`
|
|
76
71
|
},
|
|
77
|
-
className: `${
|
|
72
|
+
className: `${e.label} ${H ?? ""}`,
|
|
78
73
|
children: [
|
|
79
74
|
d,
|
|
80
75
|
" ",
|
|
81
|
-
|
|
76
|
+
N && /* @__PURE__ */ u("span", { className: "iru-text-laba-red-08", children: "*" })
|
|
82
77
|
]
|
|
83
78
|
}
|
|
84
79
|
)
|
|
85
80
|
] }),
|
|
86
|
-
|
|
81
|
+
l && /* @__PURE__ */ u(
|
|
87
82
|
"label",
|
|
88
83
|
{
|
|
89
|
-
className: `${
|
|
90
|
-
${
|
|
91
|
-
children:
|
|
84
|
+
className: `${e["label-error"]}
|
|
85
|
+
${o.disabled ? e.disabled : ""} ${I ?? ""}`,
|
|
86
|
+
children: l
|
|
92
87
|
}
|
|
93
88
|
)
|
|
94
89
|
]
|
|
95
90
|
}
|
|
96
91
|
);
|
|
97
92
|
});
|
|
98
|
-
|
|
93
|
+
D.displayName = "TextareaFloatingInner";
|
|
99
94
|
export {
|
|
100
|
-
|
|
95
|
+
D as default
|
|
101
96
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
2
|
-
${
|
|
3
|
-
${
|
|
4
|
-
${
|
|
5
|
-
${
|
|
6
|
-
${
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),c=require("react"),S=require("../../hooks/useCombinedResizeObserver.cjs"),_=require("../../hooks/useMergeRefs.cjs"),e=require("./TextareaInnerLabel.module.scss.cjs"),w=require("./TextareaInnerLabel.config.cjs"),x=c.forwardRef((s,g)=>{const{isRequired:$,classNameContainer:p,className:y,classNameLabel:R,classNameLabelError:L,name:o,id:d,label:f,error:n,height:N,minHeight:b=94,maxHeight:j=150,style:v,sizeInput:I="large",...l}=s,a=c.useRef(null),q=_.useMergeRefs(a,g),T={...v??{},maxHeight:j,height:N??b,minHeight:b},[m,h]=c.useState(!1),E=function(r){h(!0),s.onFocus?.(r)},M=function(r){h(!1),s.onBlur?.(r)},i=function(r){const u=r?.target??a.current;u.style.height="0px",u.style.height=u.scrollHeight+"px"};return S.useIsomorphicLayoutEffect(()=>(m&&a.current?a.current.addEventListener("input",i):i(),()=>{a.current?.removeEventListener("input",i)}),[m]),t.jsxs("div",{className:`${e.default.container}
|
|
2
|
+
${w.configTextareaInnerLabel.size[I]}
|
|
3
|
+
${p??""}`,children:[t.jsxs("div",{className:`${e.default["container-textarea"]}`,children:[t.jsx("textarea",{id:d??o,className:` ${n?e.default.error:""}
|
|
4
|
+
${e.default.textarea}
|
|
5
|
+
${y??""}`,ref:q,style:T,...l,onFocus:E,onBlur:M}),f&&t.jsxs("label",{htmlFor:d??o,className:`${e.default.label} ${l.disabled?e.default.disabled:""} ${R??""}`,children:[f," ",$&&t.jsx("span",{children:"*"})]})]}),n&&t.jsx("label",{className:`${e.default["label-error"]}
|
|
6
|
+
${l.disabled?e.default.disabled:""} ${L??""}`,children:n})]})});x.displayName="TextareaInnerLabel";exports.default=x;
|
|
@@ -1,87 +1,84 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as o, jsx as c } from "react/jsx-runtime";
|
|
2
2
|
import m from "react";
|
|
3
|
-
import { useIsomorphicLayoutEffect as
|
|
4
|
-
import { useMergeRefs as
|
|
5
|
-
import
|
|
6
|
-
import { configTextareaInnerLabel as
|
|
7
|
-
const
|
|
3
|
+
import { useIsomorphicLayoutEffect as j } from "../../hooks/useCombinedResizeObserver.mjs";
|
|
4
|
+
import { useMergeRefs as z } from "../../hooks/useMergeRefs.mjs";
|
|
5
|
+
import e from "./TextareaInnerLabel.module.scss.mjs";
|
|
6
|
+
import { configTextareaInnerLabel as B } from "./TextareaInnerLabel.config.mjs";
|
|
7
|
+
const S = m.forwardRef((a, g) => {
|
|
8
8
|
const {
|
|
9
|
-
isRequired:
|
|
10
|
-
classNameContainer:
|
|
11
|
-
className:
|
|
12
|
-
classNameLabel:
|
|
13
|
-
classNameLabelError:
|
|
9
|
+
isRequired: x,
|
|
10
|
+
classNameContainer: $,
|
|
11
|
+
className: y,
|
|
12
|
+
classNameLabel: N,
|
|
13
|
+
classNameLabelError: L,
|
|
14
14
|
name: u,
|
|
15
15
|
id: d,
|
|
16
16
|
label: f,
|
|
17
|
-
error:
|
|
18
|
-
height:
|
|
17
|
+
error: n,
|
|
18
|
+
height: R,
|
|
19
19
|
minHeight: h = 94,
|
|
20
|
-
maxHeight:
|
|
21
|
-
style:
|
|
22
|
-
sizeInput:
|
|
20
|
+
maxHeight: I = 150,
|
|
21
|
+
style: v,
|
|
22
|
+
sizeInput: E = "large",
|
|
23
23
|
...s
|
|
24
|
-
} =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const t = (e == null ? void 0 : e.target) ?? n.current;
|
|
32
|
-
t.style.height = "0px", t.style.height = t.scrollHeight + "px";
|
|
24
|
+
} = a, t = m.useRef(null), T = z(t, g), w = { ...v ?? {}, maxHeight: I, height: R ?? h, minHeight: h }, [p, b] = m.useState(!1), F = function(r) {
|
|
25
|
+
b(!0), a.onFocus?.(r);
|
|
26
|
+
}, H = function(r) {
|
|
27
|
+
b(!1), a.onBlur?.(r);
|
|
28
|
+
}, l = function(r) {
|
|
29
|
+
const i = r?.target ?? t.current;
|
|
30
|
+
i.style.height = "0px", i.style.height = i.scrollHeight + "px";
|
|
33
31
|
};
|
|
34
|
-
return
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}), [b]), /* @__PURE__ */ c(
|
|
32
|
+
return j(() => (p && t.current ? t.current.addEventListener("input", l) : l(), () => {
|
|
33
|
+
t.current?.removeEventListener("input", l);
|
|
34
|
+
}), [p]), /* @__PURE__ */ o(
|
|
38
35
|
"div",
|
|
39
36
|
{
|
|
40
|
-
className: `${
|
|
41
|
-
${
|
|
42
|
-
${
|
|
37
|
+
className: `${e.container}
|
|
38
|
+
${B.size[E]}
|
|
39
|
+
${$ ?? ""}`,
|
|
43
40
|
children: [
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
/* @__PURE__ */
|
|
41
|
+
/* @__PURE__ */ o("div", { className: `${e["container-textarea"]}`, children: [
|
|
42
|
+
/* @__PURE__ */ c(
|
|
46
43
|
"textarea",
|
|
47
44
|
{
|
|
48
45
|
id: d ?? u,
|
|
49
|
-
className: ` ${
|
|
50
|
-
${
|
|
51
|
-
${
|
|
52
|
-
ref:
|
|
53
|
-
style:
|
|
46
|
+
className: ` ${n ? e.error : ""}
|
|
47
|
+
${e.textarea}
|
|
48
|
+
${y ?? ""}`,
|
|
49
|
+
ref: T,
|
|
50
|
+
style: w,
|
|
54
51
|
...s,
|
|
55
|
-
onFocus:
|
|
56
|
-
onBlur:
|
|
52
|
+
onFocus: F,
|
|
53
|
+
onBlur: H
|
|
57
54
|
}
|
|
58
55
|
),
|
|
59
|
-
f && /* @__PURE__ */
|
|
56
|
+
f && /* @__PURE__ */ o(
|
|
60
57
|
"label",
|
|
61
58
|
{
|
|
62
59
|
htmlFor: d ?? u,
|
|
63
|
-
className: `${
|
|
60
|
+
className: `${e.label} ${s.disabled ? e.disabled : ""} ${N ?? ""}`,
|
|
64
61
|
children: [
|
|
65
62
|
f,
|
|
66
63
|
" ",
|
|
67
|
-
|
|
64
|
+
x && /* @__PURE__ */ c("span", { children: "*" })
|
|
68
65
|
]
|
|
69
66
|
}
|
|
70
67
|
)
|
|
71
68
|
] }),
|
|
72
|
-
|
|
69
|
+
n && /* @__PURE__ */ c(
|
|
73
70
|
"label",
|
|
74
71
|
{
|
|
75
|
-
className: `${
|
|
76
|
-
${s.disabled ?
|
|
77
|
-
children:
|
|
72
|
+
className: `${e["label-error"]}
|
|
73
|
+
${s.disabled ? e.disabled : ""} ${L ?? ""}`,
|
|
74
|
+
children: n
|
|
78
75
|
}
|
|
79
76
|
)
|
|
80
77
|
]
|
|
81
78
|
}
|
|
82
79
|
);
|
|
83
80
|
});
|
|
84
|
-
|
|
81
|
+
S.displayName = "TextareaInnerLabel";
|
|
85
82
|
export {
|
|
86
|
-
|
|
83
|
+
S as default
|
|
87
84
|
};
|
|
@@ -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 n=require("react/jsx-runtime"),S=require("react"),I=require("../Popover/Popover.cjs"),s=require("./TimeRange.module.scss.cjs"),C=require("../Button/Button.cjs"),x=(a,o=2)=>String(a).padStart(o,"0"),R=(a,o)=>a[0][0]&&a[0][1]&&a[1][0]&&a[1][1]?`${a[0][0]}:${a[0][1]} - ${a[1][0]}:${a[1][1]}`:f[o]["Select Time"],f={"en-US":{to:"to",Hour:"Hour",Minute:"Minute","Select Time":"Select Time",Reset:"Reset",Apply:"Apply"},"id-ID":{to:"to",Hour:"Jam",Minute:"Menit","Select Time":"Pilih Waktu",Reset:"Reset",Apply:"Terapkan"},"zh-CN":{to:"到",Hour:"小时",Minute:"分钟","Select Time":"选择时间",Reset:"重置",Apply:"应用"},"nl-NL":{to:"tot",Hour:"Uur",Minute:"Minuten","Select Time":"Select Time",Reset:"Reset",Apply:"Toepassen"}},j=[["",""],["",""]],w=a=>{const{id:o="time-range",classNameContainer:v,value:r=j,buttonClick:p,zIndexPopper:i=1,offsetPopover:g=5,floatingOptions:T,locale:d="id-ID",disableValidation:$=!1}=a,h=S.useRef(null),[t,b]=S.useState(j),e=(c,y)=>{if(y==="start"){const N=[c,t[1]];b(N)}else{const N=[t[0],c];b(N)}},l=c=>{h.current?.handlerShow(c),b(r||j)},u=()=>{typeof a?.onChange=="function"&&a.onChange(j),b(j),h.current?.setShow(!1)},m=()=>{const c=Number(t[0][0]),y=Number(t[0][1]),N=Number(t[1][0]),M=Number(t[1][1]),k=t[0][0]&&t[0][1]&&t[1][0]&&t[1][1],E=c<N||c===N&&y<=M;k&&(E||$)&&(typeof a?.onChange=="function"&&a.onChange(t),h.current?.setShow(!1))};return n.jsxs(n.Fragment,{children:[n.jsx("div",{id:o,onClick:l,className:v,children:typeof p=="function"?p(r,R(r,d)):r?R(r,d):f[d]["Select Time"]}),n.jsx(I.default,{zIndex:i,ref:h,offset:g,id:`${o}-popover`,floatingOptions:{placement:"bottom-end",...T},className:"iru-flex iru-flex-col",children:n.jsxs("div",{className:s.default["container-time-range"],children:[n.jsxs("div",{className:s.default["time-range-header"],children:[n.jsx("div",{className:s.default["time-range"],children:t[0][0]&&t[0][1]?`${t[0][0]}:${t[0][1]}`:"--:--"}),n.jsx("p",{className:s.default["text-to"],children:f[d].to}),n.jsx("div",{className:s.default["time-range"],children:t[1][0]&&t[1][1]?`${t[1][0]}:${t[1][1]}`:"--:--"})]}),n.jsxs("div",{className:s.default["time-range-body"],children:[n.jsx(H,{type:"start",value:[t[0][0],t[0][1]],onChange:c=>e(c,"start"),locale:d,values:t,disableValidation:$}),n.jsx("div",{className:s.default["time-range-divider"]}),n.jsx(H,{type:"end",value:[t[1][0],t[1][1]],onChange:c=>e(c,"end"),locale:d,values:t,disableValidation:$})]}),n.jsxs("div",{className:`${s.default["time-range-footer"]}`,children:[typeof a?.buttonReset=="function"?n.jsx("div",{onClick:u,children:a.buttonReset()}):n.jsx(C.default,{variants:"nude-laba-blue-10",size:"small",onClick:u,children:f[d].Reset}),typeof a?.buttonSubmit=="function"?n.jsx("div",{onClick:m,children:a.buttonSubmit()}):n.jsx(C.default,{size:"small",onClick:m,children:f[d].Apply})]})]})})]})},H=a=>{const{value:o,onChange:v,type:r,locale:p,values:i,disableValidation:g}=a,T=(e,l,u)=>Array.from({length:(l-e)/u+1},(m,c)=>e+c*u),d=()=>{const e=document.getElementById(`time-range-${r}-hour-${o[0]}`),l=document.getElementById(`time-range-${r}-minute-${o[1]}`),u=document.getElementById(`time-range-${r}-hour`),m=document.getElementById(`time-range-${r}-minute`);e&&u&&u.scrollTo({behavior:"instant",top:e.offsetTop-75}),l&&m&&m.scrollTo({behavior:"instant",top:l.offsetTop-75})},$=e=>{if(r==="start"||g)return!1;{if(!i[0][0])return!1;const l=Number(i[0][0]);return e<l}},h=e=>{if(r==="start"||g)return!1;{if(!i[0][0]||!i[0][1]||!i[1][0])return!1;const l=Number(i[0][0]),u=Number(i[1][0]),m=Number(i[0][1]);return l===u&&e<m}},t=e=>{if(r==="start"||g)return!1;{const l=Number(i[0][0]);return e<l}},b=e=>{if(r==="start"||g)return!1;{if(!i[0][0]||!i[0][1]||!i[1][0])return!1;const l=Number(i[0][0]),u=Number(i[1][0]),m=Number(i[0][1]);return l===u&&e<m}};return S.useEffect(()=>{d()},[]),n.jsxs("div",{className:s.default["list-time"],children:[n.jsxs("div",{className:s.default["container-time"],children:[n.jsx("p",{className:s.default["title-time"],children:f[p].Hour}),n.jsx("div",{id:`time-range-${r}-hour`,className:s.default["container-cell-time"],children:T(0,23,1).map(e=>n.jsx("div",{id:`time-range-${r}-hour-${e}`,className:`${s.default["cell-time"]} ${o[0]===x(e)?s.default.selected:""} ${$(e)?s.default.error:""} ${t(e)?s.default.disabled:""}`,onClick:()=>v([x(e),o[1]]),children:x(e)},e))})]}),n.jsxs("div",{className:s.default["container-time"],children:[n.jsx("p",{className:s.default["title-time"],children:f[p].Minute}),n.jsx("div",{id:`time-range-${r}-minute`,className:s.default["container-cell-time"],children:T(0,59,1).map(e=>n.jsx("div",{id:`time-range-${r}-minute-${e}`,className:`${s.default["cell-time"]} ${o[1]===x(e)?s.default.selected:""} ${h(e)?s.default.error:""} ${b(e)?s.default.disabled:""}`,onClick:()=>v([o[0],x(e)]),children:x(e)},e))})]})]})};exports.default=w;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsxs as f, Fragment as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
const
|
|
1
|
+
import { jsxs as f, Fragment as A, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import R, { useEffect as V } from "react";
|
|
3
|
+
import z from "../Popover/Popover.mjs";
|
|
4
|
+
import n from "./TimeRange.module.scss.mjs";
|
|
5
|
+
import M from "../Button/Button.mjs";
|
|
6
|
+
const $ = (r, l = 2) => String(r).padStart(l, "0"), k = (r, l) => r[0][0] && r[0][1] && r[1][0] && r[1][1] ? `${r[0][0]}:${r[0][1]} - ${r[1][0]}:${r[1][1]}` : h[l]["Select Time"], h = {
|
|
7
7
|
"en-US": {
|
|
8
8
|
to: "to",
|
|
9
9
|
Hour: "Hour",
|
|
@@ -36,146 +36,143 @@ const T = (t, c = 2) => String(t).padStart(c, "0"), E = (t, c) => t[0][0] && t[0
|
|
|
36
36
|
Reset: "Reset",
|
|
37
37
|
Apply: "Toepassen"
|
|
38
38
|
}
|
|
39
|
-
},
|
|
39
|
+
}, y = [
|
|
40
40
|
["", ""],
|
|
41
41
|
["", ""]
|
|
42
|
-
],
|
|
42
|
+
], O = (r) => {
|
|
43
43
|
const {
|
|
44
|
-
id:
|
|
45
|
-
classNameContainer:
|
|
46
|
-
value:
|
|
47
|
-
buttonClick:
|
|
48
|
-
zIndexPopper:
|
|
44
|
+
id: l = "time-range",
|
|
45
|
+
classNameContainer: C,
|
|
46
|
+
value: i = y,
|
|
47
|
+
buttonClick: v,
|
|
48
|
+
zIndexPopper: s = 1,
|
|
49
49
|
offsetPopover: g = 5,
|
|
50
|
-
floatingOptions:
|
|
50
|
+
floatingOptions: H,
|
|
51
51
|
locale: u = "id-ID",
|
|
52
|
-
disableValidation:
|
|
53
|
-
} =
|
|
54
|
-
if (
|
|
55
|
-
const
|
|
56
|
-
b
|
|
52
|
+
disableValidation: T = !1
|
|
53
|
+
} = r, p = R.useRef(null), [t, N] = R.useState(y), e = (c, S) => {
|
|
54
|
+
if (S === "start") {
|
|
55
|
+
const b = [c, t[1]];
|
|
56
|
+
N(b);
|
|
57
57
|
} else {
|
|
58
|
-
const
|
|
59
|
-
b
|
|
58
|
+
const b = [t[0], c];
|
|
59
|
+
N(b);
|
|
60
60
|
}
|
|
61
|
-
}, o = (
|
|
62
|
-
|
|
63
|
-
($ = N.current) == null || $.handlerShow(s), b(r || H);
|
|
61
|
+
}, o = (c) => {
|
|
62
|
+
p.current?.handlerShow(c), N(i || y);
|
|
64
63
|
}, m = () => {
|
|
65
|
-
|
|
66
|
-
typeof (t == null ? void 0 : t.onChange) == "function" && t.onChange(H), b(H), (s = N.current) == null || s.setShow(!1);
|
|
64
|
+
typeof r?.onChange == "function" && r.onChange(y), N(y), p.current?.setShow(!1);
|
|
67
65
|
}, d = () => {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
A && (V || C) && (typeof (t == null ? void 0 : t.onChange) == "function" && t.onChange(n), (M = N.current) == null || M.setShow(!1));
|
|
66
|
+
const c = Number(t[0][0]), S = Number(t[0][1]), b = Number(t[1][0]), E = Number(t[1][1]), I = t[0][0] && t[0][1] && t[1][0] && t[1][1], w = c < b || c === b && S <= E;
|
|
67
|
+
I && (w || T) && (typeof r?.onChange == "function" && r.onChange(t), p.current?.setShow(!1));
|
|
71
68
|
};
|
|
72
|
-
return /* @__PURE__ */ f(
|
|
73
|
-
/* @__PURE__ */ a("div", { id:
|
|
69
|
+
return /* @__PURE__ */ f(A, { children: [
|
|
70
|
+
/* @__PURE__ */ a("div", { id: l, onClick: o, className: C, children: typeof v == "function" ? v(i, k(i, u)) : i ? k(i, u) : h[u]["Select Time"] }),
|
|
74
71
|
/* @__PURE__ */ a(
|
|
75
|
-
|
|
72
|
+
z,
|
|
76
73
|
{
|
|
77
|
-
zIndex:
|
|
78
|
-
ref:
|
|
74
|
+
zIndex: s,
|
|
75
|
+
ref: p,
|
|
79
76
|
offset: g,
|
|
80
|
-
id: `${
|
|
81
|
-
floatingOptions: { placement: "bottom-end", ...
|
|
77
|
+
id: `${l}-popover`,
|
|
78
|
+
floatingOptions: { placement: "bottom-end", ...H },
|
|
82
79
|
className: "iru-flex iru-flex-col",
|
|
83
|
-
children: /* @__PURE__ */ f("div", { className:
|
|
84
|
-
/* @__PURE__ */ f("div", { className:
|
|
85
|
-
/* @__PURE__ */ a("div", { className:
|
|
86
|
-
/* @__PURE__ */ a("p", { className:
|
|
87
|
-
/* @__PURE__ */ a("div", { className:
|
|
80
|
+
children: /* @__PURE__ */ f("div", { className: n["container-time-range"], children: [
|
|
81
|
+
/* @__PURE__ */ f("div", { className: n["time-range-header"], children: [
|
|
82
|
+
/* @__PURE__ */ a("div", { className: n["time-range"], children: t[0][0] && t[0][1] ? `${t[0][0]}:${t[0][1]}` : "--:--" }),
|
|
83
|
+
/* @__PURE__ */ a("p", { className: n["text-to"], children: h[u].to }),
|
|
84
|
+
/* @__PURE__ */ a("div", { className: n["time-range"], children: t[1][0] && t[1][1] ? `${t[1][0]}:${t[1][1]}` : "--:--" })
|
|
88
85
|
] }),
|
|
89
|
-
/* @__PURE__ */ f("div", { className:
|
|
86
|
+
/* @__PURE__ */ f("div", { className: n["time-range-body"], children: [
|
|
90
87
|
/* @__PURE__ */ a(
|
|
91
|
-
|
|
88
|
+
x,
|
|
92
89
|
{
|
|
93
90
|
type: "start",
|
|
94
|
-
value: [
|
|
95
|
-
onChange: (
|
|
91
|
+
value: [t[0][0], t[0][1]],
|
|
92
|
+
onChange: (c) => e(c, "start"),
|
|
96
93
|
locale: u,
|
|
97
|
-
values:
|
|
98
|
-
disableValidation:
|
|
94
|
+
values: t,
|
|
95
|
+
disableValidation: T
|
|
99
96
|
}
|
|
100
97
|
),
|
|
101
|
-
/* @__PURE__ */ a("div", { className:
|
|
98
|
+
/* @__PURE__ */ a("div", { className: n["time-range-divider"] }),
|
|
102
99
|
/* @__PURE__ */ a(
|
|
103
|
-
|
|
100
|
+
x,
|
|
104
101
|
{
|
|
105
102
|
type: "end",
|
|
106
|
-
value: [
|
|
107
|
-
onChange: (
|
|
103
|
+
value: [t[1][0], t[1][1]],
|
|
104
|
+
onChange: (c) => e(c, "end"),
|
|
108
105
|
locale: u,
|
|
109
|
-
values:
|
|
110
|
-
disableValidation:
|
|
106
|
+
values: t,
|
|
107
|
+
disableValidation: T
|
|
111
108
|
}
|
|
112
109
|
)
|
|
113
110
|
] }),
|
|
114
|
-
/* @__PURE__ */ f("div", { className: `${
|
|
115
|
-
typeof
|
|
116
|
-
typeof
|
|
111
|
+
/* @__PURE__ */ f("div", { className: `${n["time-range-footer"]}`, children: [
|
|
112
|
+
typeof r?.buttonReset == "function" ? /* @__PURE__ */ a("div", { onClick: m, children: r.buttonReset() }) : /* @__PURE__ */ a(M, { variants: "nude-laba-blue-10", size: "small", onClick: m, children: h[u].Reset }),
|
|
113
|
+
typeof r?.buttonSubmit == "function" ? /* @__PURE__ */ a("div", { onClick: d, children: r.buttonSubmit() }) : /* @__PURE__ */ a(M, { size: "small", onClick: d, children: h[u].Apply })
|
|
117
114
|
] })
|
|
118
115
|
] })
|
|
119
116
|
}
|
|
120
117
|
)
|
|
121
118
|
] });
|
|
122
|
-
},
|
|
123
|
-
const { value:
|
|
124
|
-
const e = document.getElementById(`time-range-${
|
|
119
|
+
}, x = (r) => {
|
|
120
|
+
const { value: l, onChange: C, type: i, locale: v, values: s, disableValidation: g } = r, H = (e, o, m) => Array.from({ length: (o - e) / m + 1 }, (d, c) => e + c * m), u = () => {
|
|
121
|
+
const e = document.getElementById(`time-range-${i}-hour-${l[0]}`), o = document.getElementById(`time-range-${i}-minute-${l[1]}`), m = document.getElementById(`time-range-${i}-hour`), d = document.getElementById(`time-range-${i}-minute`);
|
|
125
122
|
e && m && m.scrollTo({ behavior: "instant", top: e.offsetTop - 75 }), o && d && d.scrollTo({ behavior: "instant", top: o.offsetTop - 75 });
|
|
126
|
-
},
|
|
127
|
-
if (
|
|
123
|
+
}, T = (e) => {
|
|
124
|
+
if (i === "start" || g) return !1;
|
|
128
125
|
{
|
|
129
|
-
if (!
|
|
130
|
-
const o = Number(
|
|
126
|
+
if (!s[0][0]) return !1;
|
|
127
|
+
const o = Number(s[0][0]);
|
|
131
128
|
return e < o;
|
|
132
129
|
}
|
|
133
|
-
},
|
|
134
|
-
if (
|
|
130
|
+
}, p = (e) => {
|
|
131
|
+
if (i === "start" || g) return !1;
|
|
135
132
|
{
|
|
136
|
-
if (!
|
|
137
|
-
const o = Number(
|
|
133
|
+
if (!s[0][0] || !s[0][1] || !s[1][0]) return !1;
|
|
134
|
+
const o = Number(s[0][0]), m = Number(s[1][0]), d = Number(s[0][1]);
|
|
138
135
|
return o === m && e < d;
|
|
139
136
|
}
|
|
140
|
-
},
|
|
141
|
-
if (
|
|
137
|
+
}, t = (e) => {
|
|
138
|
+
if (i === "start" || g) return !1;
|
|
142
139
|
{
|
|
143
|
-
const o = Number(
|
|
140
|
+
const o = Number(s[0][0]);
|
|
144
141
|
return e < o;
|
|
145
142
|
}
|
|
146
|
-
},
|
|
147
|
-
if (
|
|
143
|
+
}, N = (e) => {
|
|
144
|
+
if (i === "start" || g) return !1;
|
|
148
145
|
{
|
|
149
|
-
if (!
|
|
150
|
-
const o = Number(
|
|
146
|
+
if (!s[0][0] || !s[0][1] || !s[1][0]) return !1;
|
|
147
|
+
const o = Number(s[0][0]), m = Number(s[1][0]), d = Number(s[0][1]);
|
|
151
148
|
return o === m && e < d;
|
|
152
149
|
}
|
|
153
150
|
};
|
|
154
|
-
return
|
|
151
|
+
return V(() => {
|
|
155
152
|
u();
|
|
156
|
-
}, []), /* @__PURE__ */ f("div", { className:
|
|
157
|
-
/* @__PURE__ */ f("div", { className:
|
|
158
|
-
/* @__PURE__ */ a("p", { className:
|
|
159
|
-
/* @__PURE__ */ a("div", { id: `time-range-${
|
|
153
|
+
}, []), /* @__PURE__ */ f("div", { className: n["list-time"], children: [
|
|
154
|
+
/* @__PURE__ */ f("div", { className: n["container-time"], children: [
|
|
155
|
+
/* @__PURE__ */ a("p", { className: n["title-time"], children: h[v].Hour }),
|
|
156
|
+
/* @__PURE__ */ a("div", { id: `time-range-${i}-hour`, className: n["container-cell-time"], children: H(0, 23, 1).map((e) => /* @__PURE__ */ a(
|
|
160
157
|
"div",
|
|
161
158
|
{
|
|
162
|
-
id: `time-range-${
|
|
163
|
-
className: `${
|
|
164
|
-
onClick: () =>
|
|
165
|
-
children:
|
|
159
|
+
id: `time-range-${i}-hour-${e}`,
|
|
160
|
+
className: `${n["cell-time"]} ${l[0] === $(e) ? n.selected : ""} ${T(e) ? n.error : ""} ${t(e) ? n.disabled : ""}`,
|
|
161
|
+
onClick: () => C([$(e), l[1]]),
|
|
162
|
+
children: $(e)
|
|
166
163
|
},
|
|
167
164
|
e
|
|
168
165
|
)) })
|
|
169
166
|
] }),
|
|
170
|
-
/* @__PURE__ */ f("div", { className:
|
|
171
|
-
/* @__PURE__ */ a("p", { className:
|
|
172
|
-
/* @__PURE__ */ a("div", { id: `time-range-${
|
|
167
|
+
/* @__PURE__ */ f("div", { className: n["container-time"], children: [
|
|
168
|
+
/* @__PURE__ */ a("p", { className: n["title-time"], children: h[v].Minute }),
|
|
169
|
+
/* @__PURE__ */ a("div", { id: `time-range-${i}-minute`, className: n["container-cell-time"], children: H(0, 59, 1).map((e) => /* @__PURE__ */ a(
|
|
173
170
|
"div",
|
|
174
171
|
{
|
|
175
|
-
id: `time-range-${
|
|
176
|
-
className: `${
|
|
177
|
-
onClick: () =>
|
|
178
|
-
children:
|
|
172
|
+
id: `time-range-${i}-minute-${e}`,
|
|
173
|
+
className: `${n["cell-time"]} ${l[1] === $(e) ? n.selected : ""} ${p(e) ? n.error : ""} ${N(e) ? n.disabled : ""}`,
|
|
174
|
+
onClick: () => C([l[0], $(e)]),
|
|
175
|
+
children: $(e)
|
|
179
176
|
},
|
|
180
177
|
e
|
|
181
178
|
)) })
|
|
@@ -183,5 +180,5 @@ const T = (t, c = 2) => String(t).padStart(c, "0"), E = (t, c) => t[0][0] && t[0
|
|
|
183
180
|
] });
|
|
184
181
|
};
|
|
185
182
|
export {
|
|
186
|
-
|
|
183
|
+
O as default
|
|
187
184
|
};
|