1mpacto-react-ui 2.0.20 → 2.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/_mixins.scss +72 -72
- package/dist/assets/icons/arrow-narrow-down.svg +3 -3
- package/dist/assets/style.css +1 -1
- package/dist/components/Alert/index.cjs +1 -1
- package/dist/components/Alert/index.mjs +40 -40
- package/dist/components/Breadcrumbs/Breadcrumbs.cjs +3 -3
- package/dist/components/Breadcrumbs/Breadcrumbs.mjs +43 -43
- package/dist/components/Button/Button.cjs +12 -12
- package/dist/components/Button/Button.config.cjs +1 -1
- package/dist/components/Button/Button.config.mjs +3 -1
- package/dist/components/Button/Button.mjs +24 -24
- package/dist/components/Button/style.module.scss.cjs +1 -1
- package/dist/components/Button/style.module.scss.mjs +57 -55
- package/dist/components/ButtonIcon/ButtonIcon.cjs +12 -12
- package/dist/components/ButtonIcon/ButtonIcon.mjs +20 -20
- package/dist/components/ButtonPopover/ButtonPopover.cjs +1 -1
- package/dist/components/ButtonPopover/ButtonPopover.mjs +28 -31
- package/dist/components/Calendar/Calendar.cjs +1 -1
- package/dist/components/Calendar/Calendar.mjs +98 -100
- package/dist/components/Calendar/CalendarMonth.cjs +1 -1
- package/dist/components/Calendar/CalendarMonth.mjs +41 -42
- package/dist/components/Calendar/CalendarRange.cjs +1 -1
- package/dist/components/Calendar/CalendarRange.mjs +59 -61
- package/dist/components/Calendar/CalendarYear.cjs +3 -3
- package/dist/components/Calendar/CalendarYear.mjs +39 -40
- package/dist/components/Chart/DoughnutChart.cjs +1 -1
- package/dist/components/Chart/DoughnutChart.mjs +93 -96
- package/dist/components/Chart/GradientBarChart.cjs +1 -1
- package/dist/components/Chart/GradientBarChart.mjs +80 -81
- package/dist/components/Chart/GradientLineChart.cjs +1 -1
- package/dist/components/Chart/GradientLineChart.mjs +50 -51
- package/dist/components/Chart/LineChart.cjs +1 -1
- package/dist/components/Chart/LineChart.mjs +23 -23
- package/dist/components/Chart/PieChart.cjs +1 -1
- package/dist/components/Chart/PieChart.mjs +45 -48
- package/dist/components/Collapse/Collapse.cjs +1 -1
- package/dist/components/Collapse/Collapse.mjs +23 -24
- package/dist/components/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/DatePicker/DatePicker.mjs +86 -89
- package/dist/components/DatePicker/DateRangePicker.cjs +1 -1
- package/dist/components/DatePicker/DateRangePicker.mjs +91 -92
- package/dist/components/DatePicker/FilterDate.cjs +1 -1
- package/dist/components/DatePicker/FilterDate.mjs +107 -110
- package/dist/components/DatePicker/MonthYearPicker.cjs +1 -1
- package/dist/components/DatePicker/MonthYearPicker.mjs +51 -53
- package/dist/components/FilterContainer/FilterContainer.cjs +1 -1
- package/dist/components/FilterContainer/FilterContainer.mjs +27 -27
- package/dist/components/Input/InputFloatingInner.cjs +5 -5
- package/dist/components/Input/InputFloatingInner.mjs +24 -25
- package/dist/components/NumberFormat/NumberFormat.cjs +1 -1
- package/dist/components/NumberFormat/NumberFormat.mjs +12 -13
- package/dist/components/Pagination/Pagination.cjs +2 -2
- package/dist/components/Pagination/Pagination.mjs +76 -80
- package/dist/components/SelectDropdownContainer/SelectDropdownContainer.cjs +1 -1
- package/dist/components/SelectDropdownContainer/SelectDropdownContainer.mjs +98 -102
- package/dist/components/Sidebar/ItemSidebar.cjs +8 -8
- package/dist/components/Sidebar/ItemSidebar.mjs +71 -72
- package/dist/components/Sidebar/Sidebar.cjs +1 -1
- package/dist/components/Sidebar/Sidebar.mjs +65 -68
- package/dist/components/Slider/Slider.cjs +1 -0
- package/dist/components/Slider/Slider.mjs +61 -0
- package/dist/components/Slider/style.module.scss.cjs +1 -0
- package/dist/components/Slider/style.module.scss.mjs +14 -0
- package/dist/components/Step/Step.cjs +5 -5
- package/dist/components/Step/Step.mjs +52 -52
- package/dist/components/Table/Table.cjs +3 -3
- package/dist/components/Table/Table.mjs +275 -298
- package/dist/components/Table/TableSubMobile.cjs +1 -1
- package/dist/components/Table/TableSubMobile.mjs +32 -35
- package/dist/components/Tabs/Tabs.cjs +8 -8
- package/dist/components/Tabs/Tabs.mjs +66 -70
- package/dist/components/Textarea/Textarea.cjs +7 -7
- package/dist/components/Textarea/Textarea.mjs +47 -50
- package/dist/components/Textarea/TextareaFloatingInner.cjs +6 -6
- package/dist/components/Textarea/TextareaFloatingInner.mjs +56 -61
- package/dist/components/Textarea/TextareaInnerLabel.cjs +6 -6
- package/dist/components/Textarea/TextareaInnerLabel.mjs +47 -50
- package/dist/components/TimeRange/TimeRange.cjs +1 -1
- package/dist/components/TimeRange/TimeRange.mjs +88 -91
- package/dist/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/components/Tooltip/Tooltip.mjs +44 -46
- package/dist/components/Upload/UploadFile.cjs +1 -1
- package/dist/components/Upload/UploadFile.mjs +50 -54
- package/dist/components/Upload/UploadImage.cjs +12 -12
- package/dist/components/Upload/UploadImage.mjs +73 -79
- package/dist/components/Upload/UploadMultipleFile.cjs +1 -1
- package/dist/components/Upload/UploadMultipleFile.mjs +61 -62
- package/dist/components/Virtualization/ListVirtualization.cjs +1 -1
- package/dist/components/Virtualization/ListVirtualization.mjs +52 -55
- package/dist/components/Virtualization/TableVirtualization.cjs +1 -1
- package/dist/components/Virtualization/TableVirtualization.mjs +56 -59
- package/dist/config/components/tinymce.cjs +2 -2
- package/dist/config/components/tinymce.mjs +3 -3
- package/dist/hooks/useCountdown.cjs +1 -1
- package/dist/hooks/useCountdown.mjs +15 -15
- package/dist/hooks/useDebounce.cjs +1 -1
- package/dist/hooks/useDebounce.mjs +19 -19
- package/dist/hooks/useOtpInput.cjs +1 -1
- package/dist/hooks/useOtpInput.mjs +47 -51
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +48 -46
- package/dist/package.json.cjs +1 -1
- package/dist/package.json.d.ts +129 -128
- package/dist/package.json.mjs +1 -1
- package/dist/src/components/Button/Button.config.d.ts +2 -0
- package/dist/src/components/Slider/Slider.d.ts +3 -0
- package/dist/src/components/Slider/Slider.stories.d.ts +6 -0
- package/dist/src/components/index.d.ts +4 -2
- package/dist/src/interfaces/components/Button/index.d.ts +1 -1
- package/dist/src/interfaces/components/Slider/index.d.ts +51 -0
- package/dist/types-external/table.d.ts +15 -15
- package/dist/utils/common.cjs +1 -1
- package/dist/utils/common.mjs +172 -173
- package/package.json +128 -128
|
@@ -1,37 +1,36 @@
|
|
|
1
1
|
import { jsxs as t, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
2
|
+
import { forwardRef as x, isValidElement as s } from "react";
|
|
3
3
|
import e from "./InputFloatingInner.module.scss.mjs";
|
|
4
|
-
import { configInputFloatingInner as
|
|
5
|
-
const
|
|
6
|
-
var d;
|
|
4
|
+
import { configInputFloatingInner as v } from "./InputFloatingInner.config.mjs";
|
|
5
|
+
const F = x((d, m) => {
|
|
7
6
|
const {
|
|
8
|
-
isRequired:
|
|
9
|
-
classNameContainer:
|
|
10
|
-
classNameLabelError:
|
|
11
|
-
classNameLabel:
|
|
12
|
-
className:
|
|
7
|
+
isRequired: p,
|
|
8
|
+
classNameContainer: f,
|
|
9
|
+
classNameLabelError: u,
|
|
10
|
+
classNameLabel: N,
|
|
11
|
+
className: $,
|
|
13
12
|
name: l,
|
|
14
13
|
id: o,
|
|
15
|
-
label:
|
|
16
|
-
type:
|
|
14
|
+
label: I,
|
|
15
|
+
type: b = "text",
|
|
17
16
|
startIcon: n,
|
|
18
17
|
endIcon: a,
|
|
19
18
|
error: i,
|
|
20
|
-
sizeInput:
|
|
19
|
+
sizeInput: h = "large",
|
|
21
20
|
...c
|
|
22
|
-
} =
|
|
23
|
-
return /* @__PURE__ */ t("div", { className: `${e.container} ${
|
|
21
|
+
} = d, y = () => typeof n == "function" || s(n), g = () => typeof a == "function" || s(a);
|
|
22
|
+
return /* @__PURE__ */ t("div", { className: `${e.container} ${v.size?.[h]} ${f ?? ""}`, children: [
|
|
24
23
|
/* @__PURE__ */ t("div", { className: e["container-input"], children: [
|
|
25
24
|
/* @__PURE__ */ r(
|
|
26
25
|
"input",
|
|
27
26
|
{
|
|
28
27
|
id: o ?? l,
|
|
29
28
|
className: `${e.input} ${i ? e.error : ""}
|
|
30
|
-
${
|
|
31
|
-
${
|
|
32
|
-
${
|
|
33
|
-
ref:
|
|
34
|
-
type:
|
|
29
|
+
${y() ? e["isset-left-icon"] : ""}
|
|
30
|
+
${g() ? e["isset-right-icon"] : ""}
|
|
31
|
+
${$ ?? ""}`,
|
|
32
|
+
ref: m,
|
|
33
|
+
type: b,
|
|
35
34
|
...c
|
|
36
35
|
}
|
|
37
36
|
),
|
|
@@ -39,10 +38,10 @@ const E = v((m, p) => {
|
|
|
39
38
|
typeof n == "function" && n(),
|
|
40
39
|
s(n) && n
|
|
41
40
|
] }),
|
|
42
|
-
/* @__PURE__ */ t("label", { className: `${e.label} ${
|
|
43
|
-
|
|
41
|
+
/* @__PURE__ */ t("label", { className: `${e.label} ${N ?? ""}`, htmlFor: o ?? l, children: [
|
|
42
|
+
I,
|
|
44
43
|
" ",
|
|
45
|
-
|
|
44
|
+
p && /* @__PURE__ */ r("span", { className: "iru-text-laba-red-08", children: "*" })
|
|
46
45
|
] }),
|
|
47
46
|
/* @__PURE__ */ t("div", { className: e["end-icon"], children: [
|
|
48
47
|
typeof a == "function" && a(),
|
|
@@ -53,13 +52,13 @@ const E = v((m, p) => {
|
|
|
53
52
|
"label",
|
|
54
53
|
{
|
|
55
54
|
className: `${e["label-error"]}
|
|
56
|
-
${c.disabled ? e.disabled : ""} ${
|
|
55
|
+
${c.disabled ? e.disabled : ""} ${u ?? ""}`,
|
|
57
56
|
children: i
|
|
58
57
|
}
|
|
59
58
|
)
|
|
60
59
|
] });
|
|
61
60
|
});
|
|
62
|
-
|
|
61
|
+
F.displayName = "InputFloatingInner";
|
|
63
62
|
export {
|
|
64
|
-
|
|
63
|
+
F as default
|
|
65
64
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("react/jsx-runtime"),n=require("react-number-format"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("react/jsx-runtime"),n=require("react-number-format"),i=require("../../config/bigNumber/index.cjs"),o=require("../../utils/common.cjs"),d=({max:r,min:u,selectedText:s="Rp0",onChange:e,onFocusInput:a,...l})=>f.jsx(n.NumericFormat,{isAllowed:t=>r!==void 0&&o.isAccurateBigNumber(r)&&i.BigNumber(t.value).isGreaterThan(r)?(typeof e=="function"&&e({target:{value:i.BigNumber(r).toString()}}),!1):u!==void 0&&o.isAccurateBigNumber(u)&&i.BigNumber(t.value).isLessThan(u)?(typeof e=="function"&&e({target:{value:i.BigNumber(u).toString()}}),!1):!0,onValueChange:(t,{source:c})=>{typeof e=="function"&&c.includes("event")&&e({target:{value:t.value}})},decimalSeparator:",",thousandSeparator:".",decimalScale:2,valueIsNumericString:!0,thousandsGroupStyle:"thousand",onFocus:t=>{t?.target?.value===s&&(typeof a=="function"?a(""):typeof e=="function"&&e({target:{value:""}}))},...l});exports.default=d;
|
|
@@ -1,31 +1,30 @@
|
|
|
1
1
|
import { jsx as c } from "react/jsx-runtime";
|
|
2
2
|
import { NumericFormat as p } from "react-number-format";
|
|
3
|
-
import { BigNumber as
|
|
4
|
-
import { isAccurateBigNumber as
|
|
3
|
+
import { BigNumber as i } from "../../config/bigNumber/index.mjs";
|
|
4
|
+
import { isAccurateBigNumber as o } from "../../utils/common.mjs";
|
|
5
5
|
const S = ({
|
|
6
6
|
max: r,
|
|
7
7
|
min: u,
|
|
8
|
-
selectedText:
|
|
9
|
-
onChange:
|
|
10
|
-
onFocusInput:
|
|
11
|
-
...
|
|
8
|
+
selectedText: f = "Rp0",
|
|
9
|
+
onChange: e,
|
|
10
|
+
onFocusInput: a,
|
|
11
|
+
...l
|
|
12
12
|
}) => /* @__PURE__ */ c(
|
|
13
13
|
p,
|
|
14
14
|
{
|
|
15
|
-
isAllowed: (
|
|
16
|
-
onValueChange: (
|
|
17
|
-
typeof
|
|
15
|
+
isAllowed: (t) => r !== void 0 && o(r) && i(t.value).isGreaterThan(r) ? (typeof e == "function" && e({ target: { value: i(r).toString() } }), !1) : u !== void 0 && o(u) && i(t.value).isLessThan(u) ? (typeof e == "function" && e({ target: { value: i(u).toString() } }), !1) : !0,
|
|
16
|
+
onValueChange: (t, { source: s }) => {
|
|
17
|
+
typeof e == "function" && s.includes("event") && e({ target: { value: t.value } });
|
|
18
18
|
},
|
|
19
19
|
decimalSeparator: ",",
|
|
20
20
|
thousandSeparator: ".",
|
|
21
21
|
decimalScale: 2,
|
|
22
22
|
valueIsNumericString: !0,
|
|
23
23
|
thousandsGroupStyle: "thousand",
|
|
24
|
-
onFocus: (
|
|
25
|
-
|
|
26
|
-
((i = e == null ? void 0 : e.target) == null ? void 0 : i.value) === l && (typeof o == "function" ? o("") : typeof t == "function" && t({ target: { value: "" } }));
|
|
24
|
+
onFocus: (t) => {
|
|
25
|
+
t?.target?.value === f && (typeof a == "function" ? a("") : typeof e == "function" && e({ target: { value: "" } }));
|
|
27
26
|
},
|
|
28
|
-
...
|
|
27
|
+
...l
|
|
29
28
|
}
|
|
30
29
|
);
|
|
31
30
|
export {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),l=require("react"),
|
|
2
|
-
${q.configPagination.fonts[S].typographyButtonLabel}`,disabled:e===
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),l=require("react"),i=require("./style.module.scss.cjs"),m=require("../../utils/common.cjs"),G=require("../Calendar/CalendarYear.cjs"),W=require("../Popover/Popover.cjs"),X=require("../Button/Button.cjs"),q=require("./Pagination.config.cjs"),x=(t,o)=>{const c=o-t+1;return Array.from({length:c},(r,N)=>N+t)},k={"en-US":{"Rows per page:":"Rows per page:",of:"of","Go to:":"Go to:"},"id-ID":{"Rows per page:":"Baris per halaman:",of:"dari","Go to:":"Go to:"},"zh-CN":{"Rows per page:":"每页行数:",of:"共","Go to:":"跳至:"},"nl-NL":{"Rows per page:":"Rijen per pagina:",of:"van","Go to:":"Ga naar:"}},Z=({totalData:t,totalPage:o,pageNumber:c,pageSize:r,className:N,id:u="1ru-pagination",kind:E="box",prevIcon:g,nextIcon:p,onChange:j,optionPageSize:I=[25,50,75,100],offset:L=1.5,zIndex:O,withGotoPage:A=!1,withMorePage:M=!0,withOptionPageSize:F=!1,locale:$="id-ID",fonts:S="inter"})=>{const w=l.useRef(null),[s,C]=l.useState(c),[T,y]=l.useState(c.toString()),f=1,U=(s-1)*r+1,_=r*s,Y=t?`${m.formatNumber(U,"decimal")}-${_>=t?m.formatNumber(t,"decimal"):m.formatNumber(_,"decimal")}`:0,H=l.useMemo(()=>{const e=Math.ceil(t/r);if(f+5>=e)return x(1,e);const d=Math.max(s-f,1),B=Math.min(s+f,e),R=d>2,P=B<e-2,V=1,Q=e;if(!R&&P){const b=3+2*f;return[...x(1,b),"mr",e]}if(R&&!P){const b=3+2*f,v=x(e-b+1,e);return[V,"ml",...v]}if(R&&P){const b=x(d,B);return[V,"ml",...b,"mr",Q]}},[t,r,f,s]),h=e=>{typeof j=="function"&&(j(e),C(e.pageNumber),y(e.pageNumber.toString()))},J=e=>{if(typeof j=="function"&&M){if(e==="ml"){const d=s-5;C(d<1?1:s-5)}else if(e==="mr"){const d=s+5;C(d>o?o:s+5)}}},K=e=>{y(e);const a=Number(e);a>0&&a<=o&&h({pageSize:r,totalData:t,totalPage:o,pageNumber:a})};return n.jsxs(n.Fragment,{children:[n.jsxs("div",{id:u,className:`${q.configPagination.kind[E]} ${q.configPagination.fonts[S].value} ${N}`,children:[n.jsxs("div",{className:i.default["pagination-size"],children:[n.jsx("span",{children:k[$]["Rows per page:"]}),F&&n.jsx(X.default,{id:`${u}-option-size`,variants:"ghost-blue-gray-100-bg_white",size:"xs",endIcon:n.jsx(G.ChevronDownIcon,{className:"!iru-text-gray-500 !iru-w-[14px] !iru-h-[14px] iru-mx-0.5"}),className:"!iru-rounded-md !iru-min-w-[60px] iru-justify-between",onClick:e=>w.current?.handlerShow(e),children:m.formatNumber(r,"decimal")}),n.jsxs("span",{children:[Y," ",k[$].of," ",m.formatNumber(t,"decimal")]})]}),n.jsxs("div",{className:i.default["navigation-container"],children:[n.jsx("button",{id:`${u}-button-prev`,className:`${i.default["button-prev"]}`,disabled:s===1,onClick:()=>h({pageSize:r,totalData:t,totalPage:o,pageNumber:c-1}),children:typeof g=="function"||l.isValidElement(g)?l.isValidElement(g)?g:g():n.jsx(G.ChevronDownIcon,{className:"iru-rotate-90 !iru-text-gray-500 !iru-w-[14px] !iru-h-[14px]"})}),(H??[]).map((e,a)=>{if(typeof e!="number"){const d=["ml","mr"].includes(e);return n.jsx("button",{className:i.default["button-container"],disabled:!M,onClick:()=>J(e),children:d?"...":e},a)}return n.jsx("button",{id:`${u}-button-${e}`,className:`${e===c?i.default["pagination-active"]:""} ${i.default["button-container"]}
|
|
2
|
+
${q.configPagination.fonts[S].typographyButtonLabel}`,disabled:e===c,onClick:()=>h({pageSize:r,totalData:t,totalPage:o,pageNumber:e}),children:m.formatNumber(e,"decimal")},a)}),n.jsx("button",{id:`${u}-button-next`,className:`${i.default["button-next"]}`,disabled:s===o||!o,onClick:()=>h({pageSize:r,totalData:t,totalPage:o,pageNumber:c+1}),children:typeof p=="function"||l.isValidElement(p)?l.isValidElement(p)?p:p():n.jsx(G.ChevronDownIcon,{className:"-iru-rotate-90 !iru-text-gray-500 !iru-w-[14px] !iru-h-[14px]"})}),A&&n.jsxs("div",{className:i.default["goto-page"],children:[n.jsx("span",{children:k[$]["Go to:"]}),n.jsx("input",{id:`${u}-goto-page`,type:"number",className:i.default["goto-page-input"],value:T,onChange:e=>K(e.target.value),onBlur:()=>y(s.toString())})]})]})]}),n.jsx(W.default,{floatingOptions:{placement:"bottom-end"},ref:w,className:i.default["options-size"],offset:L,zIndex:O,id:`${u}-popover-options-size`,children:I.map((e,a)=>n.jsx("p",{id:`${u}-option-size-${e}`,className:`${i.default.option} ${e===r?i.default.active:""}`,onClick:()=>{h({totalData:t,totalPage:o,pageSize:e,pageNumber:1}),w.current?.setShow(!1)},children:m.formatNumber(e,"decimal")},a))})]})};exports.default=Z;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsxs as l, Fragment as Z, jsx as
|
|
1
|
+
import { jsxs as l, Fragment as Z, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import B, { useMemo as z, isValidElement as N } from "react";
|
|
3
|
-
import
|
|
3
|
+
import r from "./style.module.scss.mjs";
|
|
4
4
|
import { formatNumber as u } from "../../utils/common.mjs";
|
|
5
5
|
import { ChevronDownIcon as M } from "../Calendar/CalendarYear.mjs";
|
|
6
6
|
import D from "../Popover/Popover.mjs";
|
|
7
7
|
import nn from "../Button/Button.mjs";
|
|
8
8
|
import { configPagination as j } from "./Pagination.config.mjs";
|
|
9
|
-
const $ = (t,
|
|
10
|
-
const
|
|
11
|
-
return Array.from({ length:
|
|
9
|
+
const $ = (t, o) => {
|
|
10
|
+
const a = o - t + 1;
|
|
11
|
+
return Array.from({ length: a }, (s, w) => w + t);
|
|
12
12
|
}, L = {
|
|
13
13
|
"en-US": {
|
|
14
14
|
"Rows per page:": "Rows per page:",
|
|
@@ -32,11 +32,11 @@ const $ = (t, i) => {
|
|
|
32
32
|
}
|
|
33
33
|
}, dn = ({
|
|
34
34
|
totalData: t,
|
|
35
|
-
totalPage:
|
|
36
|
-
pageNumber:
|
|
37
|
-
pageSize:
|
|
35
|
+
totalPage: o,
|
|
36
|
+
pageNumber: a,
|
|
37
|
+
pageSize: s,
|
|
38
38
|
className: w,
|
|
39
|
-
id:
|
|
39
|
+
id: m = "1ru-pagination",
|
|
40
40
|
kind: F = "box",
|
|
41
41
|
prevIcon: f,
|
|
42
42
|
nextIcon: g,
|
|
@@ -50,11 +50,11 @@ const $ = (t, i) => {
|
|
|
50
50
|
locale: y = "id-ID",
|
|
51
51
|
fonts: I = "inter"
|
|
52
52
|
}) => {
|
|
53
|
-
const C = B.useRef(null), [
|
|
54
|
-
const n = Math.ceil(t /
|
|
53
|
+
const C = B.useRef(null), [i, R] = B.useState(a), [J, G] = B.useState(a.toString()), p = 1, K = (i - 1) * s + 1, V = s * i, Q = t ? `${u(K, "decimal")}-${V >= t ? u(t, "decimal") : u(V, "decimal")}` : 0, T = z(() => {
|
|
54
|
+
const n = Math.ceil(t / s);
|
|
55
55
|
if (p + 5 >= n)
|
|
56
56
|
return $(1, n);
|
|
57
|
-
const
|
|
57
|
+
const d = Math.max(i - p, 1), _ = Math.min(i + p, n), k = d > 2, P = _ < n - 2, A = 1, Y = n;
|
|
58
58
|
if (!k && P) {
|
|
59
59
|
const b = 3 + 2 * p;
|
|
60
60
|
return [...$(1, b), "mr", n];
|
|
@@ -64,48 +64,45 @@ const $ = (t, i) => {
|
|
|
64
64
|
return [A, "ml", ...E];
|
|
65
65
|
}
|
|
66
66
|
if (k && P) {
|
|
67
|
-
const b = $(
|
|
67
|
+
const b = $(d, _);
|
|
68
68
|
return [A, "ml", ...b, "mr", Y];
|
|
69
69
|
}
|
|
70
|
-
}, [t,
|
|
70
|
+
}, [t, s, p, i]), h = (n) => {
|
|
71
71
|
typeof x == "function" && (x(n), R(n.pageNumber), G(n.pageNumber.toString()));
|
|
72
72
|
}, W = (n) => {
|
|
73
73
|
if (typeof x == "function" && S) {
|
|
74
74
|
if (n === "ml") {
|
|
75
|
-
const
|
|
76
|
-
R(
|
|
75
|
+
const d = i - 5;
|
|
76
|
+
R(d < 1 ? 1 : i - 5);
|
|
77
77
|
} else if (n === "mr") {
|
|
78
|
-
const
|
|
79
|
-
R(
|
|
78
|
+
const d = i + 5;
|
|
79
|
+
R(d > o ? o : i + 5);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
}, X = (n) => {
|
|
83
83
|
G(n);
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
pageSize:
|
|
84
|
+
const c = Number(n);
|
|
85
|
+
c > 0 && c <= o && h({
|
|
86
|
+
pageSize: s,
|
|
87
87
|
totalData: t,
|
|
88
|
-
totalPage:
|
|
89
|
-
pageNumber:
|
|
88
|
+
totalPage: o,
|
|
89
|
+
pageNumber: c
|
|
90
90
|
});
|
|
91
91
|
};
|
|
92
92
|
return /* @__PURE__ */ l(Z, { children: [
|
|
93
|
-
/* @__PURE__ */ l("div", { id:
|
|
94
|
-
/* @__PURE__ */ l("div", { className:
|
|
95
|
-
/* @__PURE__ */
|
|
96
|
-
H && /* @__PURE__ */
|
|
93
|
+
/* @__PURE__ */ l("div", { id: m, className: `${j.kind[F]} ${j.fonts[I].value} ${w}`, children: [
|
|
94
|
+
/* @__PURE__ */ l("div", { className: r["pagination-size"], children: [
|
|
95
|
+
/* @__PURE__ */ e("span", { children: L[y]["Rows per page:"] }),
|
|
96
|
+
H && /* @__PURE__ */ e(
|
|
97
97
|
nn,
|
|
98
98
|
{
|
|
99
|
-
id: `${
|
|
99
|
+
id: `${m}-option-size`,
|
|
100
100
|
variants: "ghost-blue-gray-100-bg_white",
|
|
101
101
|
size: "xs",
|
|
102
|
-
endIcon: /* @__PURE__ */
|
|
102
|
+
endIcon: /* @__PURE__ */ e(M, { className: "!iru-text-gray-500 !iru-w-[14px] !iru-h-[14px] iru-mx-0.5" }),
|
|
103
103
|
className: "!iru-rounded-md !iru-min-w-[60px] iru-justify-between",
|
|
104
|
-
onClick: (n) =>
|
|
105
|
-
|
|
106
|
-
return (e = C.current) == null ? void 0 : e.handlerShow(n);
|
|
107
|
-
},
|
|
108
|
-
children: u(c, "decimal")
|
|
104
|
+
onClick: (n) => C.current?.handlerShow(n),
|
|
105
|
+
children: u(s, "decimal")
|
|
109
106
|
}
|
|
110
107
|
),
|
|
111
108
|
/* @__PURE__ */ l("span", { children: [
|
|
@@ -116,111 +113,110 @@ const $ = (t, i) => {
|
|
|
116
113
|
u(t, "decimal")
|
|
117
114
|
] })
|
|
118
115
|
] }),
|
|
119
|
-
/* @__PURE__ */ l("div", { className:
|
|
120
|
-
/* @__PURE__ */
|
|
116
|
+
/* @__PURE__ */ l("div", { className: r["navigation-container"], children: [
|
|
117
|
+
/* @__PURE__ */ e(
|
|
121
118
|
"button",
|
|
122
119
|
{
|
|
123
|
-
id: `${
|
|
124
|
-
className: `${
|
|
125
|
-
disabled:
|
|
120
|
+
id: `${m}-button-prev`,
|
|
121
|
+
className: `${r["button-prev"]}`,
|
|
122
|
+
disabled: i === 1,
|
|
126
123
|
onClick: () => h({
|
|
127
|
-
pageSize:
|
|
124
|
+
pageSize: s,
|
|
128
125
|
totalData: t,
|
|
129
|
-
totalPage:
|
|
130
|
-
pageNumber:
|
|
126
|
+
totalPage: o,
|
|
127
|
+
pageNumber: a - 1
|
|
131
128
|
}),
|
|
132
|
-
children: typeof f == "function" || N(f) ? N(f) ? f : f() : /* @__PURE__ */
|
|
129
|
+
children: typeof f == "function" || N(f) ? N(f) ? f : f() : /* @__PURE__ */ e(M, { className: "iru-rotate-90 !iru-text-gray-500 !iru-w-[14px] !iru-h-[14px]" })
|
|
133
130
|
}
|
|
134
131
|
),
|
|
135
|
-
(T ?? []).map((n,
|
|
132
|
+
(T ?? []).map((n, c) => {
|
|
136
133
|
if (typeof n != "number") {
|
|
137
|
-
const
|
|
138
|
-
return /* @__PURE__ */
|
|
134
|
+
const d = ["ml", "mr"].includes(n);
|
|
135
|
+
return /* @__PURE__ */ e(
|
|
139
136
|
"button",
|
|
140
137
|
{
|
|
141
|
-
className:
|
|
138
|
+
className: r["button-container"],
|
|
142
139
|
disabled: !S,
|
|
143
140
|
onClick: () => W(n),
|
|
144
|
-
children:
|
|
141
|
+
children: d ? "..." : n
|
|
145
142
|
},
|
|
146
|
-
|
|
143
|
+
c
|
|
147
144
|
);
|
|
148
145
|
}
|
|
149
|
-
return /* @__PURE__ */
|
|
146
|
+
return /* @__PURE__ */ e(
|
|
150
147
|
"button",
|
|
151
148
|
{
|
|
152
|
-
id: `${
|
|
153
|
-
className: `${n ===
|
|
149
|
+
id: `${m}-button-${n}`,
|
|
150
|
+
className: `${n === a ? r["pagination-active"] : ""} ${r["button-container"]}
|
|
154
151
|
${j.fonts[I].typographyButtonLabel}`,
|
|
155
|
-
disabled: n ===
|
|
152
|
+
disabled: n === a,
|
|
156
153
|
onClick: () => h({
|
|
157
|
-
pageSize:
|
|
154
|
+
pageSize: s,
|
|
158
155
|
totalData: t,
|
|
159
|
-
totalPage:
|
|
156
|
+
totalPage: o,
|
|
160
157
|
pageNumber: n
|
|
161
158
|
}),
|
|
162
159
|
children: u(n, "decimal")
|
|
163
160
|
},
|
|
164
|
-
|
|
161
|
+
c
|
|
165
162
|
);
|
|
166
163
|
}),
|
|
167
|
-
/* @__PURE__ */
|
|
164
|
+
/* @__PURE__ */ e(
|
|
168
165
|
"button",
|
|
169
166
|
{
|
|
170
|
-
id: `${
|
|
171
|
-
className: `${
|
|
172
|
-
disabled:
|
|
167
|
+
id: `${m}-button-next`,
|
|
168
|
+
className: `${r["button-next"]}`,
|
|
169
|
+
disabled: i === o || !o,
|
|
173
170
|
onClick: () => h({
|
|
174
|
-
pageSize:
|
|
171
|
+
pageSize: s,
|
|
175
172
|
totalData: t,
|
|
176
|
-
totalPage:
|
|
177
|
-
pageNumber:
|
|
173
|
+
totalPage: o,
|
|
174
|
+
pageNumber: a + 1
|
|
178
175
|
}),
|
|
179
|
-
children: typeof g == "function" || N(g) ? N(g) ? g : g() : /* @__PURE__ */
|
|
176
|
+
children: typeof g == "function" || N(g) ? N(g) ? g : g() : /* @__PURE__ */ e(M, { className: "-iru-rotate-90 !iru-text-gray-500 !iru-w-[14px] !iru-h-[14px]" })
|
|
180
177
|
}
|
|
181
178
|
),
|
|
182
|
-
v && /* @__PURE__ */ l("div", { className:
|
|
183
|
-
/* @__PURE__ */
|
|
184
|
-
/* @__PURE__ */
|
|
179
|
+
v && /* @__PURE__ */ l("div", { className: r["goto-page"], children: [
|
|
180
|
+
/* @__PURE__ */ e("span", { children: L[y]["Go to:"] }),
|
|
181
|
+
/* @__PURE__ */ e(
|
|
185
182
|
"input",
|
|
186
183
|
{
|
|
187
|
-
id: `${
|
|
184
|
+
id: `${m}-goto-page`,
|
|
188
185
|
type: "number",
|
|
189
|
-
className:
|
|
186
|
+
className: r["goto-page-input"],
|
|
190
187
|
value: J,
|
|
191
188
|
onChange: (n) => X(n.target.value),
|
|
192
|
-
onBlur: () => G(
|
|
189
|
+
onBlur: () => G(i.toString())
|
|
193
190
|
}
|
|
194
191
|
)
|
|
195
192
|
] })
|
|
196
193
|
] })
|
|
197
194
|
] }),
|
|
198
|
-
/* @__PURE__ */
|
|
195
|
+
/* @__PURE__ */ e(
|
|
199
196
|
D,
|
|
200
197
|
{
|
|
201
198
|
floatingOptions: { placement: "bottom-end" },
|
|
202
199
|
ref: C,
|
|
203
|
-
className:
|
|
200
|
+
className: r["options-size"],
|
|
204
201
|
offset: U,
|
|
205
202
|
zIndex: q,
|
|
206
|
-
id: `${
|
|
207
|
-
children: O.map((n,
|
|
203
|
+
id: `${m}-popover-options-size`,
|
|
204
|
+
children: O.map((n, c) => /* @__PURE__ */ e(
|
|
208
205
|
"p",
|
|
209
206
|
{
|
|
210
|
-
id: `${
|
|
211
|
-
className: `${
|
|
207
|
+
id: `${m}-option-size-${n}`,
|
|
208
|
+
className: `${r.option} ${n === s ? r.active : ""}`,
|
|
212
209
|
onClick: () => {
|
|
213
|
-
var a;
|
|
214
210
|
h({
|
|
215
211
|
totalData: t,
|
|
216
|
-
totalPage:
|
|
212
|
+
totalPage: o,
|
|
217
213
|
pageSize: n,
|
|
218
214
|
pageNumber: 1
|
|
219
|
-
}),
|
|
215
|
+
}), C.current?.setShow(!1);
|
|
220
216
|
},
|
|
221
217
|
children: u(n, "decimal")
|
|
222
218
|
},
|
|
223
|
-
|
|
219
|
+
c
|
|
224
220
|
))
|
|
225
221
|
}
|
|
226
222
|
)
|
|
@@ -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 d=require("react/jsx-runtime"),e=require("react"),te=require("react-select"),ne=require("../Popover/Popover.cjs"),oe=require("./SelectDropdownContainer.module.scss.cjs"),R=require("../../hooks/useDeepCompareEffect.cjs"),f=require("./SelectDropdownContainer.config.cjs"),V=e.forwardRef((C,y)=>{const{width:p,children:N,components:E,classNameContainer:I="",classNameContainerShowSelect:x="",classNameContainerSelect:M="",classNameLabelError:$="",error:b,onChange:m,externalValue:l=!1,defaultValueButtonDropdown:o={},autoClose:q=!0,onMenuOpen:j=()=>{},autoCloseOutside:z=!0,styleInnerPopper:L={},onMenuClose:_=()=>{},zIndexPopper:T=0,id:W="select-dropdown-container",idPopover:k="select-dropdown-container-popover",useAutoPlacement:F,flipOptions:A,autoPlacementOptions:B,withSearch:H=!1,floatingOptions:G={},offsetPopover:J=5,selectProps:K={},errorLabel:Q="payhere",controlType:h="payhere",actionValueChange:U=()=>{},...X}=C,r=e.useRef(null),s=e.useRef(null),[Y,v]=e.useState(""),[n,w]=e.useState(!1),[i,c]=e.useState({}),[g,D]=e.useState(0),S=t=>{s.current?.setShow(t),w(t)},Z=()=>{if(l)return C.isMulti?o:[o]},P=t=>{s.current?.handlerShow(t),D(r.current.offsetWidth),w(a=>!a)},O=()=>{z&&s.current?.setShow(!1)},ee=(t,a)=>{q&&(w(!1),s.current?.setShow(!1)),typeof m=="function"&&m(t,a),l||c(t)},u=()=>{r.current&&D(r.current.offsetWidth)};return R.useDeepCompareEffect(()=>{l&&c(o),U(o)},[l,o]),e.useEffect(()=>{n?j():n||(_(),v(""))},[n]),e.useImperativeHandle(y,()=>({selectValue:i,setSelectValue:c,handlerClose:O,handlerShow:P,show:n,setShow:S}),[n,R.useDeepCompareMemoize(i)]),e.useEffect(()=>(window.addEventListener("resize",u),window.addEventListener("load",u),()=>{window.removeEventListener("resize",u),window.removeEventListener("load",u)}),[r]),d.jsxs("div",{id:W,className:`${oe.default.container} ${I} ${n?`${x} open-popover`:null}`,ref:r,children:[N({selectValue:i,setSelectValue:c,handlerClose:O,handlerShow:P,show:n,setShow:S}),d.jsx(ne.default,{ref:s,offset:J,useAutoPlacement:F,flipOptions:A,autoPlacementOptions:B,zIndex:T,styleInnerPopover:L,id:k,width:typeof p=="function"?p(g,i):p||g,className:`${M} ${f.configSelectDropdownContainer.classNamePopover[h]}`,floatingOptions:G,children:d.jsx(te,{className:"iru-w-full",defaultValue:Z(),inputValue:Y,onInputChange:(t,{action:a})=>{a==="input-change"&&v(t)},openMenuOnFocus:!0,autoFocus:!1,backspaceRemovesValue:!1,components:{IndicatorSeparator:null,...E},controlShouldRenderValue:!1,hideSelectedOptions:!1,isClearable:!1,menuIsOpen:!0,tabSelectsValue:!1,styles:H?f.configSelectDropdownContainer.variant[h]:f.configSelectDropdownContainer.noSearchVariant[h],noOptionsMessage:()=>"Tidak ada data.",onChange:ee,selectProps:{...K,setShowDropdown:S},...X})}),d.jsx("div",{className:`${f.configSelectDropdownContainer.error[Q]} ${$}`,children:b})]})});V.displayName="SelectDropdownContainer";exports.default=V;
|