1mpacto-react-ui 2.0.19 → 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 (98) 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 -0
  83. package/dist/hooks/useDebounce.mjs +27 -0
  84. package/dist/hooks/useOtpInput.cjs +1 -1
  85. package/dist/hooks/useOtpInput.mjs +47 -51
  86. package/dist/hooks/usePacked.cjs +1 -0
  87. package/dist/hooks/usePacked.mjs +56 -0
  88. package/dist/index.cjs +1 -1
  89. package/dist/index.mjs +52 -48
  90. package/dist/package.json.cjs +1 -1
  91. package/dist/package.json.d.ts +5 -4
  92. package/dist/package.json.mjs +1 -1
  93. package/dist/src/hooks/index.d.ts +4 -2
  94. package/dist/src/hooks/useDebounce.d.ts +61 -0
  95. package/dist/src/hooks/usePacked.d.ts +84 -0
  96. package/dist/utils/common.cjs +1 -1
  97. package/dist/utils/common.mjs +172 -173
  98. package/package.json +4 -4
@@ -1,85 +1,84 @@
1
- import { jsxs as h, jsx as r, Fragment as j } from "react/jsx-runtime";
2
- import B from "react";
3
- import w from "../Button/Button.mjs";
4
- import a from "./UploadMultipleFile.module.scss.mjs";
5
- import D from "../Input/InputNative.mjs";
6
- import { parseFileName as M } from "../../utils/common.mjs";
7
- const W = ({
8
- value: o,
9
- validateFile: g,
10
- classNameContainer: C,
11
- classNameButton: F,
12
- textUpload: U = "Unggah Lampiran",
13
- buttonProps: x = {},
14
- maxFile: l = 1,
15
- maxSize: d = 1,
16
- error: k,
17
- removeElement: e,
18
- onChange: N,
19
- handlerDownload: y,
20
- priorityError: z = "external",
21
- eventError: p,
22
- locationRemoveElement: b = "right",
23
- idItemAttachment: P
1
+ import { jsxs as o, jsx as t, Fragment as y } from "react/jsx-runtime";
2
+ import b from "react";
3
+ import S from "../Button/Button.mjs";
4
+ import r from "./UploadMultipleFile.module.scss.mjs";
5
+ import T from "../Input/InputNative.mjs";
6
+ import { parseFileName as $ } from "../../utils/common.mjs";
7
+ const O = ({
8
+ value: j,
9
+ validateFile: f,
10
+ classNameContainer: B,
11
+ classNameButton: M,
12
+ textUpload: v = "Unggah Lampiran",
13
+ buttonProps: C = {},
14
+ maxFile: p = 1,
15
+ maxSize: m = 1,
16
+ error: u,
17
+ removeElement: n,
18
+ onChange: h,
19
+ handlerDownload: g,
20
+ priorityError: F = "external",
21
+ eventError: U,
22
+ locationRemoveElement: d = "right",
23
+ idItemAttachment: x
24
24
  }) => {
25
- const A = { variants: "ghost-laba-blue-10", size: "small" }, s = B.useRef(null), c = g || ["image/png", "image/jpeg", "image/jpg"], [$, I] = B.useState(""), J = {
26
- internal: $ || k,
27
- external: k || $
28
- }, L = (t) => {
29
- if (t != null && t.length) {
30
- const n = Array.from(t).slice(0, l), m = n == null ? void 0 : n.filter((u) => !c.includes(u.type)), T = (n == null ? void 0 : n.reduce((u, q) => u + q.size, 0)) / 1024 / 1024;
31
- let i = "";
32
- if (m.length > 0 ? i = "Berkas tidak didukung, silahkan pilih file kembali." : T > d ? i = `${t.length > 1 ? "Jumlah u" : "U"}kuran berkas tidak boleh melebihi ${d}MB.` : typeof N == "function" && N(n), I(i), p == null || p(i), !(s != null && s.current)) return;
33
- s.current.value = "";
25
+ const z = { variants: "ghost-laba-blue-10", size: "small" }, a = b.useRef(null), k = f || ["image/png", "image/jpeg", "image/jpg"], [N, P] = b.useState(""), R = {
26
+ internal: N || u,
27
+ external: u || N
28
+ }, A = (e) => {
29
+ if (e?.length) {
30
+ const i = Array.from(e).slice(0, p), l = i?.filter((c) => !k.includes(c.type)), J = i?.reduce((c, L) => c + L.size, 0) / 1024 / 1024;
31
+ let s = "";
32
+ if (l.length > 0 ? s = "Berkas tidak didukung, silahkan pilih file kembali." : J > m ? s = `${e.length > 1 ? "Jumlah u" : "U"}kuran berkas tidak boleh melebihi ${m}MB.` : typeof h == "function" && h(i), P(s), U?.(s), !a?.current) return;
33
+ a.current.value = "";
34
34
  }
35
- }, S = (t) => {
36
- var n;
37
- t.preventDefault(), s != null && s.current && ((n = s.current) == null || n.click());
35
+ }, I = (e) => {
36
+ e.preventDefault(), a?.current && a.current?.click();
38
37
  };
39
- return /* @__PURE__ */ h("div", { className: `${a.container} ${C ?? ""}`, children: [
40
- /* @__PURE__ */ r(
41
- w,
38
+ return /* @__PURE__ */ o("div", { className: `${r.container} ${B ?? ""}`, children: [
39
+ /* @__PURE__ */ t(
40
+ S,
42
41
  {
43
- ...A,
44
- ...x,
45
- className: F ?? "",
46
- onClick: (t) => S(t),
47
- children: U
42
+ ...z,
43
+ ...C,
44
+ className: M ?? "",
45
+ onClick: (e) => I(e),
46
+ children: v
48
47
  }
49
48
  ),
50
- /* @__PURE__ */ r(
51
- D,
49
+ /* @__PURE__ */ t(
50
+ T,
52
51
  {
53
- accept: c == null ? void 0 : c.join(", "),
54
- ref: s,
52
+ accept: k?.join(", "),
53
+ ref: a,
55
54
  type: "file",
56
- onChange: (t) => L(t.target.files),
57
- error: J[z],
58
- multiple: l > 1,
55
+ onChange: (e) => A(e.target.files),
56
+ error: R[F],
57
+ multiple: p > 1,
59
58
  hidden: !0
60
59
  }
61
60
  ),
62
- /* @__PURE__ */ r("div", { className: a.files, children: o == null ? void 0 : o.map((t, n) => /* @__PURE__ */ h(
61
+ /* @__PURE__ */ t("div", { className: r.files, children: j?.map((e, i) => /* @__PURE__ */ o(
63
62
  "div",
64
63
  {
65
- id: `${P}-${n}`,
66
- className: a.file,
67
- onClick: (m) => {
68
- m.stopPropagation(), typeof y == "function" && y(t);
64
+ id: `${x}-${i}`,
65
+ className: r.file,
66
+ onClick: (l) => {
67
+ l.stopPropagation(), typeof g == "function" && g(e);
69
68
  },
70
69
  children: [
71
- typeof e == "function" && b === "left" && /* @__PURE__ */ r(j, { children: e(t, n) }),
72
- /* @__PURE__ */ h("div", { className: a["file-name-wrapper"], children: [
73
- /* @__PURE__ */ r("span", { className: a["file-name"], children: M((t == null ? void 0 : t.originalName) ?? (t == null ? void 0 : t.name) ?? (t == null ? void 0 : t.fileName) ?? "").filename }),
74
- /* @__PURE__ */ r("span", { className: a["file-extension"], children: M((t == null ? void 0 : t.originalName) ?? (t == null ? void 0 : t.name) ?? (t == null ? void 0 : t.fileName) ?? "").extension })
70
+ typeof n == "function" && d === "left" && /* @__PURE__ */ t(y, { children: n(e, i) }),
71
+ /* @__PURE__ */ o("div", { className: r["file-name-wrapper"], children: [
72
+ /* @__PURE__ */ t("span", { className: r["file-name"], children: $(e?.originalName ?? e?.name ?? e?.fileName ?? "").filename }),
73
+ /* @__PURE__ */ t("span", { className: r["file-extension"], children: $(e?.originalName ?? e?.name ?? e?.fileName ?? "").extension })
75
74
  ] }),
76
- typeof e == "function" && b === "right" && /* @__PURE__ */ r(j, { children: e(t, n) })
75
+ typeof n == "function" && d === "right" && /* @__PURE__ */ t(y, { children: n(e, i) })
77
76
  ]
78
77
  },
79
- n
78
+ i
80
79
  )) })
81
80
  ] });
82
81
  };
83
82
  export {
84
- W as default
83
+ O as default
85
84
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),o=require("react"),N=require("react-virtuoso"),W=({children:i,...r})=>n.jsx(n.Fragment,{children:i(r)}),_=({children:i,...r})=>n.jsx(n.Fragment,{children:o.isValidElement(i)&&n.jsx(n.Fragment,{children:o.cloneElement(i,r)})}),y=o.forwardRef((i,r)=>{const{classNameContainer:v="",computeItemKey:H=()=>"",itemSize:E=()=>0,totalCount:s=0,typeHight:t="min-max",minHeightItem:z=0,maxHeightTable:l=0,minLengthItem:L=0,itemContent:j,typeCalculateItemSize:R="manual",itemSizeNames:u=[],overscan:d=null,component:S={},idContainer:g="",triggerCalCulateContainer:V="",accumulationHeight:I=0,delayTriggerCalculateHeight:T=0,increaseViewportBy:b=()=>0,context:B={},endReached:q,increaseTotalCount:h=1}=i,[a,f]=o.useState(0),F=()=>{if(t==="min-max"){const e=(s+h)*z;return{height:s>L?l:a>e?a:e}}return t==="container"?{height:a}:{}},$=e=>{var p;const m=e.getAttribute("data-index");let C=((p=e.getBoundingClientRect())==null?void 0:p.height)||0;return u==null||u.forEach(M=>{var w,x;C+=((x=(w=document.querySelector(`[${M}="${m}"]`))==null?void 0:w.getBoundingClientRect())==null?void 0:x.height)??0}),C},c=()=>{var e;if(g&&t==="container"){const m=((e=document==null?void 0:document.getElementById(g))==null?void 0:e.offsetHeight)??0;f(m-I)}};return o.useEffect(()=>{const e=setTimeout(c,T);return window==null||window.addEventListener("resize",c),window==null||window.addEventListener("load",c),()=>{clearTimeout(e),window==null||window.removeEventListener("resize",c),window==null||window.removeEventListener("load",c)}},[t,V]),n.jsx("div",{className:`iru-w-full ${v}`,children:n.jsx(N.Virtuoso,{context:B,ref:r,overscan:typeof d=="function"?d(t==="container"?a:l):t==="container"?a:l,totalListHeightChanged:e=>t==="min-max"?f(e):null,style:F(),totalCount:s,computeItemKey:H,itemSize:o.useCallback(e=>R==="manual"?E(e):$(e),[]),itemContent:(...e)=>j(W,...e),components:{Item:_,...S},endReached:q,increaseViewportBy:b(t==="container"?a:l)})})});y.displayName="ListVirtualization";exports.default=y;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),o=require("react"),N=require("react-virtuoso"),F=({children:i,...r})=>n.jsx(n.Fragment,{children:i(r)}),$=({children:i,...r})=>n.jsx(n.Fragment,{children:o.isValidElement(i)&&n.jsx(n.Fragment,{children:o.cloneElement(i,r)})}),f=o.forwardRef((i,r)=>{const{classNameContainer:C="",computeItemKey:p=()=>"",itemSize:w=()=>0,totalCount:s=0,typeHight:t="min-max",minHeightItem:x=0,maxHeightTable:l=0,minLengthItem:y=0,itemContent:v,typeCalculateItemSize:H="manual",itemSizeNames:z=[],overscan:u=null,component:E={},idContainer:m="",triggerCalCulateContainer:S="",accumulationHeight:L=0,delayTriggerCalculateHeight:j=0,increaseViewportBy:R=()=>0,context:V={},endReached:I,increaseTotalCount:d=1}=i,[a,g]=o.useState(0),T=()=>{if(t==="min-max"){const e=(s+d)*x;return{height:s>y?l:a>e?a:e}}return t==="container"?{height:a}:{}},b=e=>{const B=e.getAttribute("data-index");let h=e.getBoundingClientRect()?.height||0;return z?.forEach(q=>{h+=document.querySelector(`[${q}="${B}"]`)?.getBoundingClientRect()?.height??0}),h},c=()=>{if(m&&t==="container"){const e=document?.getElementById(m)?.offsetHeight??0;g(e-L)}};return o.useEffect(()=>{const e=setTimeout(c,j);return window?.addEventListener("resize",c),window?.addEventListener("load",c),()=>{clearTimeout(e),window?.removeEventListener("resize",c),window?.removeEventListener("load",c)}},[t,S]),n.jsx("div",{className:`iru-w-full ${C}`,children:n.jsx(N.Virtuoso,{context:V,ref:r,overscan:typeof u=="function"?u(t==="container"?a:l):t==="container"?a:l,totalListHeightChanged:e=>t==="min-max"?g(e):null,style:T(),totalCount:s,computeItemKey:p,itemSize:o.useCallback(e=>H==="manual"?w(e):b(e),[]),itemContent:(...e)=>v(F,...e),components:{Item:$,...E},endReached:I,increaseViewportBy:R(t==="container"?a:l)})})});f.displayName="ListVirtualization";exports.default=f;
@@ -1,82 +1,79 @@
1
- import { jsx as r, Fragment as u } from "react/jsx-runtime";
2
- import { forwardRef as k, useState as q, useEffect as A, useCallback as F, isValidElement as K, cloneElement as D } from "react";
3
- import { Virtuoso as G } from "react-virtuoso";
4
- const J = ({ children: n, ...o }) => /* @__PURE__ */ r(u, { children: n(o) }), M = ({ children: n, ...o }) => /* @__PURE__ */ r(u, { children: K(n) && /* @__PURE__ */ r(u, { children: D(n, o) }) }), O = k((n, o) => {
1
+ import { jsx as r, Fragment as m } from "react/jsx-runtime";
2
+ import { forwardRef as $, useState as W, useEffect as j, useCallback as k, isValidElement as q, cloneElement as A } from "react";
3
+ import { Virtuoso as F } from "react-virtuoso";
4
+ const K = ({ children: n, ...o }) => /* @__PURE__ */ r(m, { children: n(o) }), D = ({ children: n, ...o }) => /* @__PURE__ */ r(m, { children: q(n) && /* @__PURE__ */ r(m, { children: A(n, o) }) }), G = $((n, o) => {
5
5
  const {
6
- classNameContainer: H = "",
7
- computeItemKey: v = () => "",
8
- itemSize: x = () => 0,
6
+ classNameContainer: f = "",
7
+ computeItemKey: p = () => "",
8
+ itemSize: C = () => 0,
9
9
  totalCount: c = 0,
10
10
  typeHight: t = "min-max",
11
- minHeightItem: E = 0,
11
+ minHeightItem: w = 0,
12
12
  maxHeightTable: l = 0,
13
- minLengthItem: z = 0,
14
- itemContent: L,
15
- typeCalculateItemSize: I = "manual",
16
- itemSizeNames: s = [],
17
- overscan: d = null,
18
- component: V = {},
19
- idContainer: h = "",
20
- triggerCalCulateContainer: B = "",
21
- accumulationHeight: R = 0,
13
+ minLengthItem: y = 0,
14
+ itemContent: H,
15
+ typeCalculateItemSize: z = "manual",
16
+ itemSizeNames: v = [],
17
+ overscan: s = null,
18
+ component: x = {},
19
+ idContainer: u = "",
20
+ triggerCalCulateContainer: E = "",
21
+ accumulationHeight: L = 0,
22
22
  delayTriggerCalculateHeight: S = 0,
23
- increaseViewportBy: T = () => 0,
24
- context: b = {},
25
- endReached: $,
26
- increaseTotalCount: g = 1
27
- } = n, [i, f] = q(0), N = () => {
23
+ increaseViewportBy: I = () => 0,
24
+ context: V = {},
25
+ endReached: B,
26
+ increaseTotalCount: d = 1
27
+ } = n, [i, h] = W(0), R = () => {
28
28
  if (t === "min-max") {
29
- const e = (c + g) * E;
30
- return { height: c > z ? l : i > e ? i : e };
29
+ const e = (c + d) * w;
30
+ return { height: c > y ? l : i > e ? i : e };
31
31
  }
32
32
  return t === "container" ? { height: i } : {};
33
- }, W = (e) => {
34
- var C;
35
- const m = e.getAttribute("data-index");
36
- let p = ((C = e.getBoundingClientRect()) == null ? void 0 : C.height) || 0;
37
- return s == null || s.forEach((j) => {
38
- var w, y;
39
- p += ((y = (w = document.querySelector(`[${j}="${m}"]`)) == null ? void 0 : w.getBoundingClientRect()) == null ? void 0 : y.height) ?? 0;
40
- }), p;
33
+ }, T = (e) => {
34
+ const N = e.getAttribute("data-index");
35
+ let g = e.getBoundingClientRect()?.height || 0;
36
+ return v?.forEach((b) => {
37
+ g += document.querySelector(`[${b}="${N}"]`)?.getBoundingClientRect()?.height ?? 0;
38
+ }), g;
41
39
  }, a = () => {
42
- var e;
43
- if (h && t === "container") {
44
- const m = ((e = document == null ? void 0 : document.getElementById(h)) == null ? void 0 : e.offsetHeight) ?? 0;
45
- f(m - R);
40
+ if (u && t === "container") {
41
+ const e = document?.getElementById(u)?.offsetHeight ?? 0;
42
+ h(e - L);
46
43
  }
47
44
  };
48
- return A(() => {
45
+ return j(() => {
49
46
  const e = setTimeout(a, S);
50
- return window == null || window.addEventListener("resize", a), window == null || window.addEventListener("load", a), () => {
51
- clearTimeout(e), window == null || window.removeEventListener("resize", a), window == null || window.removeEventListener("load", a);
47
+ return window?.addEventListener("resize", a), window?.addEventListener("load", a), () => {
48
+ clearTimeout(e), window?.removeEventListener("resize", a), window?.removeEventListener("load", a);
52
49
  };
53
- }, [t, B]), /* @__PURE__ */ r("div", { className: `iru-w-full ${H}`, children: /* @__PURE__ */ r(
54
- G,
50
+ }, [t, E]), /* @__PURE__ */ r("div", { className: `iru-w-full ${f}`, children: /* @__PURE__ */ r(
51
+ F,
55
52
  {
56
- context: b,
53
+ context: V,
57
54
  ref: o,
58
- overscan: typeof d == "function" ? d(t === "container" ? i : l) : t === "container" ? i : l,
59
- totalListHeightChanged: (e) => t === "min-max" ? f(e) : null,
60
- style: N(),
55
+ overscan: typeof s == "function" ? s(t === "container" ? i : l) : t === "container" ? i : l,
56
+ totalListHeightChanged: (e) => t === "min-max" ? h(e) : null,
57
+ style: R(),
61
58
  totalCount: c,
62
- computeItemKey: v,
63
- itemSize: F(
64
- (e) => I === "manual" ? x(e) : W(e),
59
+ computeItemKey: p,
60
+ itemSize: k(
61
+ (e) => z === "manual" ? C(e) : T(e),
65
62
  []
66
63
  ),
67
- itemContent: (...e) => L(J, ...e),
64
+ itemContent: (...e) => H(K, ...e),
68
65
  components: {
69
66
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
70
67
  // @ts-ignore
71
- Item: M,
72
- ...V
68
+ Item: D,
69
+ ...x
73
70
  },
74
- endReached: $,
75
- increaseViewportBy: T(t === "container" ? i : l)
71
+ endReached: B,
72
+ increaseViewportBy: I(t === "container" ? i : l)
76
73
  }
77
74
  ) });
78
75
  });
79
- O.displayName = "ListVirtualization";
76
+ G.displayName = "ListVirtualization";
80
77
  export {
81
- O as default
78
+ G as default
82
79
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),o=require("react"),W=require("react-virtuoso"),_=({children:i,...r})=>n.jsx(n.Fragment,{children:i(r)}),k=({children:i,...r})=>n.jsx(n.Fragment,{children:o.isValidElement(i)&&n.jsx(n.Fragment,{children:o.cloneElement(i,r)})}),y=o.forwardRef((i,r)=>{const{classNameContainer:H="",computeItemKey:v=()=>"",itemSize:T=()=>0,totalCount:l=0,typeHight:t="min-max",minHeightItem:b=0,maxHeightTable:s=0,minLengthItem:E=0,fixedHeaderContent:z,itemContent:R,typeCalculateItemSize:j="manual",itemSizeNames:u=[],overscan:d=null,component:S={},idContainer:g="",triggerCalCulateContainer:V="",accumulationHeight:L=0,delayTriggerCalculateHeight:B=0,increaseViewportBy:I=()=>0,context:q={},endReached:F,increaseTotalCount:h=1}=i,[a,f]=o.useState(0),$=()=>{if(t==="min-max"){const e=(l+h)*b;return{height:l>E?s:a>e?a:e}}return t==="container"?{height:a}:{}},M=e=>{var w;const m=e.getAttribute("data-index");let C=((w=e.getBoundingClientRect())==null?void 0:w.height)||0;return u==null||u.forEach(N=>{var x,p;C+=((p=(x=document.querySelector(`[${N}="${m}"]`))==null?void 0:x.getBoundingClientRect())==null?void 0:p.height)??0}),C},c=()=>{var e;if(g&&t==="container"){const m=((e=document==null?void 0:document.getElementById(g))==null?void 0:e.offsetHeight)??0;f(m-L)}};return o.useEffect(()=>{const e=setTimeout(c,B);return window==null||window.addEventListener("resize",c),window==null||window.addEventListener("load",c),()=>{clearTimeout(e),window==null||window.removeEventListener("resize",c),window==null||window.removeEventListener("load",c)}},[t,V]),n.jsx("div",{className:`iru-w-full ${H}`,children:n.jsx(W.TableVirtuoso,{context:q,ref:r,overscan:typeof d=="function"?d(t==="container"?a:s):t==="container"?a:s,totalListHeightChanged:e=>t==="min-max"?f(e):null,style:$(),totalCount:l,computeItemKey:v,itemSize:o.useCallback(e=>j==="manual"?T(e):M(e),[]),components:{TableRow:k,...S},fixedHeaderContent:z,itemContent:(...e)=>R(_,...e),endReached:F,increaseViewportBy:I(t==="container"?a:s)})})});y.displayName="TableVirtualization";exports.default=y;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),o=require("react"),F=require("react-virtuoso"),$=({children:i,...r})=>n.jsx(n.Fragment,{children:i(r)}),M=({children:i,...r})=>n.jsx(n.Fragment,{children:o.isValidElement(i)&&n.jsx(n.Fragment,{children:o.cloneElement(i,r)})}),f=o.forwardRef((i,r)=>{const{classNameContainer:C="",computeItemKey:w=()=>"",itemSize:x=()=>0,totalCount:l=0,typeHight:t="min-max",minHeightItem:p=0,maxHeightTable:s=0,minLengthItem:y=0,fixedHeaderContent:H,itemContent:v,typeCalculateItemSize:z="manual",itemSizeNames:T=[],overscan:u=null,component:b={},idContainer:m="",triggerCalCulateContainer:E="",accumulationHeight:S=0,delayTriggerCalculateHeight:R=0,increaseViewportBy:j=()=>0,context:V={},endReached:L,increaseTotalCount:d=1}=i,[a,g]=o.useState(0),B=()=>{if(t==="min-max"){const e=(l+d)*p;return{height:l>y?s:a>e?a:e}}return t==="container"?{height:a}:{}},I=e=>{const q=e.getAttribute("data-index");let h=e.getBoundingClientRect()?.height||0;return T?.forEach(N=>{h+=document.querySelector(`[${N}="${q}"]`)?.getBoundingClientRect()?.height??0}),h},c=()=>{if(m&&t==="container"){const e=document?.getElementById(m)?.offsetHeight??0;g(e-S)}};return o.useEffect(()=>{const e=setTimeout(c,R);return window?.addEventListener("resize",c),window?.addEventListener("load",c),()=>{clearTimeout(e),window?.removeEventListener("resize",c),window?.removeEventListener("load",c)}},[t,E]),n.jsx("div",{className:`iru-w-full ${C}`,children:n.jsx(F.TableVirtuoso,{context:V,ref:r,overscan:typeof u=="function"?u(t==="container"?a:s):t==="container"?a:s,totalListHeightChanged:e=>t==="min-max"?g(e):null,style:B(),totalCount:l,computeItemKey:w,itemSize:o.useCallback(e=>z==="manual"?x(e):I(e),[]),components:{TableRow:M,...b},fixedHeaderContent:H,itemContent:(...e)=>v($,...e),endReached:L,increaseViewportBy:j(t==="container"?a:s)})})});f.displayName="TableVirtualization";exports.default=f;
@@ -1,84 +1,81 @@
1
- import { jsx as r, Fragment as u } from "react/jsx-runtime";
2
- import { forwardRef as q, useState as A, useEffect as F, useCallback as K, isValidElement as D, cloneElement as G } from "react";
3
- import { TableVirtuoso as J } from "react-virtuoso";
4
- const M = ({ children: n, ...a }) => /* @__PURE__ */ r(u, { children: n(a) }), O = ({ children: n, ...a }) => /* @__PURE__ */ r(u, { children: D(n) && /* @__PURE__ */ r(u, { children: G(n, a) }) }), P = q((n, a) => {
1
+ import { jsx as r, Fragment as m } from "react/jsx-runtime";
2
+ import { forwardRef as W, useState as j, useEffect as k, useCallback as q, isValidElement as A, cloneElement as F } from "react";
3
+ import { TableVirtuoso as K } from "react-virtuoso";
4
+ const D = ({ children: n, ...a }) => /* @__PURE__ */ r(m, { children: n(a) }), G = ({ children: n, ...a }) => /* @__PURE__ */ r(m, { children: A(n) && /* @__PURE__ */ r(m, { children: F(n, a) }) }), J = W((n, a) => {
5
5
  const {
6
- classNameContainer: H = "",
7
- computeItemKey: x = () => "",
8
- itemSize: v = () => 0,
6
+ classNameContainer: f = "",
7
+ computeItemKey: p = () => "",
8
+ itemSize: C = () => 0,
9
9
  totalCount: c = 0,
10
10
  typeHight: t = "min-max",
11
- minHeightItem: E = 0,
11
+ minHeightItem: w = 0,
12
12
  maxHeightTable: l = 0,
13
- minLengthItem: T = 0,
14
- fixedHeaderContent: z,
15
- itemContent: b,
16
- typeCalculateItemSize: L = "manual",
17
- itemSizeNames: m = [],
18
- overscan: d = null,
19
- component: R = {},
20
- idContainer: h = "",
21
- triggerCalCulateContainer: V = "",
22
- accumulationHeight: B = 0,
23
- delayTriggerCalculateHeight: I = 0,
24
- increaseViewportBy: S = () => 0,
25
- context: $ = {},
26
- endReached: N,
27
- increaseTotalCount: g = 1
28
- } = n, [i, f] = A(0), W = () => {
13
+ minLengthItem: y = 0,
14
+ fixedHeaderContent: H,
15
+ itemContent: x,
16
+ typeCalculateItemSize: z = "manual",
17
+ itemSizeNames: v = [],
18
+ overscan: s = null,
19
+ component: E = {},
20
+ idContainer: u = "",
21
+ triggerCalCulateContainer: T = "",
22
+ accumulationHeight: b = 0,
23
+ delayTriggerCalculateHeight: S = 0,
24
+ increaseViewportBy: L = () => 0,
25
+ context: R = {},
26
+ endReached: V,
27
+ increaseTotalCount: d = 1
28
+ } = n, [i, h] = j(0), B = () => {
29
29
  if (t === "min-max") {
30
- const e = (c + g) * E;
31
- return { height: c > T ? l : i > e ? i : e };
30
+ const e = (c + d) * w;
31
+ return { height: c > y ? l : i > e ? i : e };
32
32
  }
33
33
  return t === "container" ? { height: i } : {};
34
- }, j = (e) => {
35
- var C;
36
- const s = e.getAttribute("data-index");
37
- let p = ((C = e.getBoundingClientRect()) == null ? void 0 : C.height) || 0;
38
- return m == null || m.forEach((k) => {
39
- var w, y;
40
- p += ((y = (w = document.querySelector(`[${k}="${s}"]`)) == null ? void 0 : w.getBoundingClientRect()) == null ? void 0 : y.height) ?? 0;
41
- }), p;
34
+ }, I = (e) => {
35
+ const N = e.getAttribute("data-index");
36
+ let g = e.getBoundingClientRect()?.height || 0;
37
+ return v?.forEach(($) => {
38
+ g += document.querySelector(`[${$}="${N}"]`)?.getBoundingClientRect()?.height ?? 0;
39
+ }), g;
42
40
  }, o = () => {
43
- var e;
44
- if (h && t === "container") {
45
- const s = ((e = document == null ? void 0 : document.getElementById(h)) == null ? void 0 : e.offsetHeight) ?? 0;
46
- f(s - B);
41
+ if (u && t === "container") {
42
+ const e = document?.getElementById(u)?.offsetHeight ?? 0;
43
+ h(e - b);
47
44
  }
48
45
  };
49
- return F(() => {
50
- const e = setTimeout(o, I);
51
- return window == null || window.addEventListener("resize", o), window == null || window.addEventListener("load", o), () => {
52
- clearTimeout(e), window == null || window.removeEventListener("resize", o), window == null || window.removeEventListener("load", o);
46
+ return k(() => {
47
+ const e = setTimeout(o, S);
48
+ return window?.addEventListener("resize", o), window?.addEventListener("load", o), () => {
49
+ clearTimeout(e), window?.removeEventListener("resize", o), window?.removeEventListener("load", o);
53
50
  };
54
- }, [t, V]), /* @__PURE__ */ r("div", { className: `iru-w-full ${H}`, children: /* @__PURE__ */ r(
55
- J,
51
+ }, [t, T]), /* @__PURE__ */ r("div", { className: `iru-w-full ${f}`, children: /* @__PURE__ */ r(
52
+ K,
56
53
  {
57
- context: $,
54
+ context: R,
58
55
  ref: a,
59
- overscan: typeof d == "function" ? d(t === "container" ? i : l) : t === "container" ? i : l,
60
- totalListHeightChanged: (e) => t === "min-max" ? f(e) : null,
61
- style: W(),
56
+ overscan: typeof s == "function" ? s(t === "container" ? i : l) : t === "container" ? i : l,
57
+ totalListHeightChanged: (e) => t === "min-max" ? h(e) : null,
58
+ style: B(),
62
59
  totalCount: c,
63
- computeItemKey: x,
64
- itemSize: K(
65
- (e) => L === "manual" ? v(e) : j(e),
60
+ computeItemKey: p,
61
+ itemSize: q(
62
+ (e) => z === "manual" ? C(e) : I(e),
66
63
  []
67
64
  ),
68
65
  components: {
69
66
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
70
67
  // @ts-ignore
71
- TableRow: O,
72
- ...R
68
+ TableRow: G,
69
+ ...E
73
70
  },
74
- fixedHeaderContent: z,
75
- itemContent: (...e) => b(M, ...e),
76
- endReached: N,
77
- increaseViewportBy: S(t === "container" ? i : l)
71
+ fixedHeaderContent: H,
72
+ itemContent: (...e) => x(D, ...e),
73
+ endReached: V,
74
+ increaseViewportBy: L(t === "container" ? i : l)
78
75
  }
79
76
  ) });
80
77
  });
81
- P.displayName = "TableVirtualization";
78
+ J.displayName = "TableVirtualization";
82
79
  export {
83
- P as default
80
+ J as default
84
81
  };
@@ -17,7 +17,7 @@
17
17
  Verdana=Verdana,geneva;
18
18
  Webdings=Webdings;
19
19
  Wingdings=Wingdings,zapf dingbats
20
- `,forced_root_block:"p",forced_root_block_attrs:{style:"font-family: Lato; margin: 0px"},autosave_interval:"5s",autosave_prefix:"{path}{query}-{id}-",autosave_restore_when_empty:!1,autosave_retention:"2m",paste_block_drop:!0,branding:!1,paste_data_images:!1,resize:!1,width:"100%",init_instance_callback:t=>{if(n){const e=document.getElementById(`${t.id}_ifr`),a=e==null?void 0:e.parentNode,i=document.createElement("p");i.className=`
20
+ `,forced_root_block:"p",forced_root_block_attrs:{style:"font-family: Lato; margin: 0px"},autosave_interval:"5s",autosave_prefix:"{path}{query}-{id}-",autosave_restore_when_empty:!1,autosave_retention:"2m",paste_block_drop:!0,branding:!1,paste_data_images:!1,resize:!1,width:"100%",init_instance_callback:t=>{if(n){const e=document.getElementById(`${t.id}_ifr`),i=e?.parentNode,a=document.createElement("p");a.className=`
21
21
  !iru-text-laba-grey-10
22
22
  !iru-absolute
23
23
  !iru-font-Lato
@@ -25,4 +25,4 @@
25
25
  !iru-pl-2
26
26
  !iru-pt-2
27
27
  !iru-pointer-events-none
28
- `,e!=null&&e.className&&(e.className="!iru-mt-6 !iru-w-full"),i.appendChild(document.createTextNode(n||"")),a==null||a.appendChild(i)}},setup:t=>{t.on("PostProcess",function(e){/<p style="font-family: Lato; margin: 0px;">&nbsp;<\/p>/i.test(e.content)&&(e.content=e.content.replace(/&nbsp;/gi,"<br />"))}),t.on("PastePostProcess",e=>{e.node.querySelectorAll("*").forEach(o=>{t.dom.setStyle(o,"font-family","Lato"),t.dom.setStyle(o,"margin","0px")})})}}});exports.default=l;
28
+ `,e?.className&&(e.className="!iru-mt-6 !iru-w-full"),a.appendChild(document.createTextNode(n||"")),i?.appendChild(a)}},setup:t=>{t.on("PostProcess",function(e){/<p style="font-family: Lato; margin: 0px;">&nbsp;<\/p>/i.test(e.content)&&(e.content=e.content.replace(/&nbsp;/gi,"<br />"))}),t.on("PastePostProcess",e=>{e.node.querySelectorAll("*").forEach(o=>{t.dom.setStyle(o,"font-family","Lato"),t.dom.setStyle(o,"margin","0px")})})}}});exports.default=l;
@@ -53,8 +53,8 @@ const m = ({ label: n }) => ({
53
53
  width: "100%",
54
54
  init_instance_callback: (t) => {
55
55
  if (n) {
56
- const e = document.getElementById(`${t.id}_ifr`), a = e == null ? void 0 : e.parentNode, i = document.createElement("p");
57
- i.className = `
56
+ const e = document.getElementById(`${t.id}_ifr`), i = e?.parentNode, a = document.createElement("p");
57
+ a.className = `
58
58
  !iru-text-laba-grey-10
59
59
  !iru-absolute
60
60
  !iru-font-Lato
@@ -62,7 +62,7 @@ const m = ({ label: n }) => ({
62
62
  !iru-pl-2
63
63
  !iru-pt-2
64
64
  !iru-pointer-events-none
65
- `, e != null && e.className && (e.className = "!iru-mt-6 !iru-w-full"), i.appendChild(document.createTextNode(n || "")), a == null || a.appendChild(i);
65
+ `, e?.className && (e.className = "!iru-mt-6 !iru-w-full"), a.appendChild(document.createTextNode(n || "")), i?.appendChild(a);
66
66
  }
67
67
  },
68
68
  setup: (t) => {
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react"),i=t=>{const u=t.getTime()-Date.now();return Math.max(Math.floor(u/1e3),0)},w=t=>{const u=a.useMemo(()=>{const e=new Date(t.date);return t.adjustTimesTime&&e.setHours(e.getHours()-t.adjustTimesTime),e},[t.date,t.adjustTimesTime]),[o,g]=a.useState(u),[r,f]=a.useState(()=>i(o)),[c,s]=a.useState(t.running??!1),[l,m]=a.useState(()=>t==null?void 0:t.callbackDone);return a.useEffect(()=>{let e;return c&&r>0&&(e=setInterval(()=>{const n=i(o);f(n),n<=0&&(s(!1),e&&clearInterval(e),typeof l=="function"&&l())},t.intervalMs)),()=>{e&&clearInterval(e)}},[c,o,t.intervalMs,l,r]),{count:r,isRunning:c,startCountdown:()=>{!c&&r>0&&s(!0)},stopCountdown:()=>{s(!1)},resetCountdown:e=>{let n;e instanceof Date?n=e:typeof e=="number"?n=new Date(Date.now()+e*1e3):n=u,g(n);const d=i(n);d<=0?s(!1):s(!0),f(d)},setCallbackDone:e=>m(()=>e)}};exports.default=w;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react"),l=t=>{const o=t.getTime()-Date.now();return Math.max(Math.floor(o/1e3),0)},w=t=>{const o=s.useMemo(()=>{const e=new Date(t.date);return t.adjustTimesTime&&e.setHours(e.getHours()-t.adjustTimesTime),e},[t.date,t.adjustTimesTime]),[c,g]=s.useState(o),[u,f]=s.useState(()=>l(c)),[r,a]=s.useState(t.running??!1),[i,m]=s.useState(()=>t?.callbackDone);return s.useEffect(()=>{let e;return r&&u>0&&(e=setInterval(()=>{const n=l(c);f(n),n<=0&&(a(!1),e&&clearInterval(e),typeof i=="function"&&i())},t.intervalMs)),()=>{e&&clearInterval(e)}},[r,c,t.intervalMs,i,u]),{count:u,isRunning:r,startCountdown:()=>{!r&&u>0&&a(!0)},stopCountdown:()=>{a(!1)},resetCountdown:e=>{let n;e instanceof Date?n=e:typeof e=="number"?n=new Date(Date.now()+e*1e3):n=o,g(n);const d=l(n);d<=0?a(!1):a(!0),f(d)},setCallbackDone:e=>m(()=>e)}};exports.default=w;
@@ -1,34 +1,34 @@
1
1
  import a from "react";
2
- const l = (t) => {
3
- const r = t.getTime() - Date.now();
4
- return Math.max(Math.floor(r / 1e3), 0);
2
+ const f = (t) => {
3
+ const o = t.getTime() - Date.now();
4
+ return Math.max(Math.floor(o / 1e3), 0);
5
5
  }, M = (t) => {
6
- const r = a.useMemo(() => {
6
+ const o = a.useMemo(() => {
7
7
  const e = new Date(t.date);
8
8
  return t.adjustTimesTime && e.setHours(e.getHours() - t.adjustTimesTime), e;
9
- }, [t.date, t.adjustTimesTime]), [o, m] = a.useState(r), [u, i] = a.useState(() => l(o)), [c, s] = a.useState(t.running ?? !1), [f, w] = a.useState(() => t == null ? void 0 : t.callbackDone);
9
+ }, [t.date, t.adjustTimesTime]), [c, m] = a.useState(o), [r, l] = a.useState(() => f(c)), [u, s] = a.useState(t.running ?? !1), [i, w] = a.useState(() => t?.callbackDone);
10
10
  return a.useEffect(() => {
11
11
  let e;
12
- return c && u > 0 && (e = setInterval(() => {
13
- const n = l(o);
14
- i(n), n <= 0 && (s(!1), e && clearInterval(e), typeof f == "function" && f());
12
+ return u && r > 0 && (e = setInterval(() => {
13
+ const n = f(c);
14
+ l(n), n <= 0 && (s(!1), e && clearInterval(e), typeof i == "function" && i());
15
15
  }, t.intervalMs)), () => {
16
16
  e && clearInterval(e);
17
17
  };
18
- }, [c, o, t.intervalMs, f, u]), {
19
- count: u,
20
- isRunning: c,
18
+ }, [u, c, t.intervalMs, i, r]), {
19
+ count: r,
20
+ isRunning: u,
21
21
  startCountdown: () => {
22
- !c && u > 0 && s(!0);
22
+ !u && r > 0 && s(!0);
23
23
  },
24
24
  stopCountdown: () => {
25
25
  s(!1);
26
26
  },
27
27
  resetCountdown: (e) => {
28
28
  let n;
29
- e instanceof Date ? n = e : typeof e == "number" ? n = new Date(Date.now() + e * 1e3) : n = r, m(n);
30
- const d = l(n);
31
- d <= 0 ? s(!1) : s(!0), i(d);
29
+ e instanceof Date ? n = e : typeof e == "number" ? n = new Date(Date.now() + e * 1e3) : n = o, m(n);
30
+ const d = f(n);
31
+ d <= 0 ? s(!1) : s(!0), l(d);
32
32
  },
33
33
  setCallbackDone: (e) => w(() => e)
34
34
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react"),a=(i,l,c,n)=>{c.current!==null&&(clearTimeout(c.current),c.current=null),n.current!==null&&(clearTimeout(n.current),n.current=null),l.current!==null&&(i.current(...l.current),l.current=null)},b=(i,l)=>{const c=l?.wait??0,n=l?.maxWait,u=r.useRef(null),e=r.useRef(null),s=r.useRef(i),t=r.useRef(null);s.current=i;const o=r.useCallback(()=>{u.current!==null&&(clearTimeout(u.current),u.current=null),e.current!==null&&(clearTimeout(e.current),e.current=null),t.current=null},[]),f=r.useCallback(()=>{a(s,t,u,e)},[]),m=r.useCallback(()=>u.current!==null,[]),T=r.useCallback((...d)=>{t.current=d,u.current!==null&&clearTimeout(u.current),u.current=setTimeout(()=>{u.current=null,e.current!==null&&(clearTimeout(e.current),e.current=null),t.current!==null&&(s.current(...t.current),t.current=null)},c),n!==void 0&&e.current===null&&(e.current=setTimeout(()=>{e.current=null,a(s,t,u,e)},n))},[c,n]);return r.useEffect(()=>()=>{u.current!==null&&clearTimeout(u.current),e.current!==null&&clearTimeout(e.current)},[]),{debouncedFn:T,cancel:o,flush:f,pending:m}};exports.default=b;
@@ -0,0 +1,27 @@
1
+ import e from "react";
2
+ const o = (a, l, c, n) => {
3
+ c.current !== null && (clearTimeout(c.current), c.current = null), n.current !== null && (clearTimeout(n.current), n.current = null), l.current !== null && (a.current(...l.current), l.current = null);
4
+ }, C = (a, l) => {
5
+ const c = l?.wait ?? 0, n = l?.maxWait, u = e.useRef(null), r = e.useRef(null), i = e.useRef(a), t = e.useRef(null);
6
+ i.current = a;
7
+ const s = e.useCallback(() => {
8
+ u.current !== null && (clearTimeout(u.current), u.current = null), r.current !== null && (clearTimeout(r.current), r.current = null), t.current = null;
9
+ }, []), f = e.useCallback(() => {
10
+ o(i, t, u, r);
11
+ }, []), m = e.useCallback(() => u.current !== null, []), T = e.useCallback(
12
+ (...b) => {
13
+ t.current = b, u.current !== null && clearTimeout(u.current), u.current = setTimeout(() => {
14
+ u.current = null, r.current !== null && (clearTimeout(r.current), r.current = null), t.current !== null && (i.current(...t.current), t.current = null);
15
+ }, c), n !== void 0 && r.current === null && (r.current = setTimeout(() => {
16
+ r.current = null, o(i, t, u, r);
17
+ }, n));
18
+ },
19
+ [c, n]
20
+ );
21
+ return e.useEffect(() => () => {
22
+ u.current !== null && clearTimeout(u.current), r.current !== null && clearTimeout(r.current);
23
+ }, []), { debouncedFn: T, cancel: s, flush: f, pending: m };
24
+ };
25
+ export {
26
+ C as default
27
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("react"),A=require("../utils/common.cjs"),v=({id:y,numInputs:e,onComplete:i,disableFocusOnEdit:w=!1,blurOnComplete:h=!1,disableOnComplete:O=!1})=>{const[c,D]=u.useState(()=>Array(e).fill("")),r=u.useRef([]),[S]=u.useState(()=>`otp-${Math.random().toString(36).slice(2,9)}`),d=y||S;u.useEffect(()=>{r.current=r.current.slice(0,e)},[e]);const F=u.useCallback((t,a)=>{var g,b;const o=t.target.value,s=o.length>1?o.slice(-1):o,l=c[a]!=="",f=[...c];f[a]=s,D(f);const p=f.join(""),n=!f.slice(0,e).includes("");s!==""&&a<e-1&&(w&&l&&n||(g=r.current[a+1])==null||g.focus()),n&&(typeof i=="function"&&i(p),h&&((b=r.current[a])==null||b.blur()))},[c,e,i,w,h]),$=u.useCallback((t,a)=>{var o,s,l,f,p;switch(t.key){case"Backspace":if(c[a]===""&&a>0){t.preventDefault();const n=[...c];n[a-1]="",D(n),(o=r.current[a-1])==null||o.focus()}break;case"ArrowLeft":a>0&&(t.preventDefault(),(s=r.current[a-1])==null||s.focus());break;case"ArrowRight":a<e-1&&(t.preventDefault(),(l=r.current[a+1])==null||l.focus());break;case"Home":t.preventDefault(),(f=r.current[0])==null||f.focus();break;case"End":t.preventDefault(),(p=r.current[e-1])==null||p.focus();break}},[c,e]),j=u.useCallback((t,a)=>{var g,b;t.preventDefault();const o=t.clipboardData.getData("text").trim();if(!o)return;const s=[...c];let l=a;for(const M of o){if(l>=e)break;s[l]=M,l++}D(s);const f=s.join(""),p=!s.includes(""),n=Math.min(l,e-1);(g=r.current[n])==null||g.focus(),p&&(typeof i=="function"&&i(f),h&&((b=r.current[n])==null||b.blur()))},[c,e,i,h]),P=t=>{t.target.select()},V=()=>{var t;D(Array(e).fill("")),(t=r.current[0])==null||t.focus()},k=t=>{if(t<0||t>=e)throw new Error(`useOtpInput: index ${t} is out of bounds for numInputs ${e}.`);const a=c.join("").length===e;return{id:`${d}-${t}`,"aria-label":`OTP digit ${t+1} of ${e}`,ref:o=>{r.current[t]=o},value:c[t],onChange:o=>F(o,t),onKeyDown:o=>$(o,t),onPaste:o=>j(o,t),onFocus:P,disabled:O&&a,type:"text",inputMode:"numeric",autoComplete:"one-time-code"}};return{getInputProps:k,getInputData:t=>({...A.deleteKeysImmutable(k(t),["onChange","onKeyDown","onPaste","onFocus","aria-label","autoComplete"]),isOtpFilled:c[t]!==""}),otpValues:c,otpString:c.join(""),clearOtp:V,isOtpComplete:c.join("").length===e}};exports.default=v;exports.useOtpInput=v;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react"),V=require("../utils/common.cjs"),w=({id:k,numInputs:e,onComplete:f,disableFocusOnEdit:h=!1,blurOnComplete:p=!1,disableOnComplete:v=!1})=>{const[c,g]=l.useState(()=>Array(e).fill("")),r=l.useRef([]),[y]=l.useState(()=>`otp-${Math.random().toString(36).slice(2,9)}`),O=k||y;l.useEffect(()=>{r.current=r.current.slice(0,e)},[e]);const S=l.useCallback((t,a)=>{const o=t.target.value,s=o.length>1?o.slice(-1):o,n=c[a]!=="",u=[...c];u[a]=s,g(u);const b=u.join(""),i=!u.slice(0,e).includes("");s!==""&&a<e-1&&(h&&n&&i||r.current[a+1]?.focus()),i&&(typeof f=="function"&&f(b),p&&r.current[a]?.blur())},[c,e,f,h,p]),d=l.useCallback((t,a)=>{switch(t.key){case"Backspace":if(c[a]===""&&a>0){t.preventDefault();const o=[...c];o[a-1]="",g(o),r.current[a-1]?.focus()}break;case"ArrowLeft":a>0&&(t.preventDefault(),r.current[a-1]?.focus());break;case"ArrowRight":a<e-1&&(t.preventDefault(),r.current[a+1]?.focus());break;case"Home":t.preventDefault(),r.current[0]?.focus();break;case"End":t.preventDefault(),r.current[e-1]?.focus();break}},[c,e]),F=l.useCallback((t,a)=>{t.preventDefault();const o=t.clipboardData.getData("text").trim();if(!o)return;const s=[...c];let n=a;for(const P of o){if(n>=e)break;s[n]=P,n++}g(s);const u=s.join(""),b=!s.includes(""),i=Math.min(n,e-1);r.current[i]?.focus(),b&&(typeof f=="function"&&f(u),p&&r.current[i]?.blur())},[c,e,f,p]),$=t=>{t.target.select()},j=()=>{g(Array(e).fill("")),r.current[0]?.focus()},D=t=>{if(t<0||t>=e)throw new Error(`useOtpInput: index ${t} is out of bounds for numInputs ${e}.`);const a=c.join("").length===e;return{id:`${O}-${t}`,"aria-label":`OTP digit ${t+1} of ${e}`,ref:o=>{r.current[t]=o},value:c[t],onChange:o=>S(o,t),onKeyDown:o=>d(o,t),onPaste:o=>F(o,t),onFocus:$,disabled:v&&a,type:"text",inputMode:"numeric",autoComplete:"one-time-code"}};return{getInputProps:D,getInputData:t=>({...V.deleteKeysImmutable(D(t),["onChange","onKeyDown","onPaste","onFocus","aria-label","autoComplete"]),isOtpFilled:c[t]!==""}),otpValues:c,otpString:c.join(""),clearOtp:j,isOtpComplete:c.join("").length===e}};exports.default=w;exports.useOtpInput=w;