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.
Files changed (114) hide show
  1. package/dist/assets/_mixins.scss +72 -72
  2. package/dist/assets/icons/arrow-narrow-down.svg +3 -3
  3. package/dist/assets/style.css +1 -1
  4. package/dist/components/Alert/index.cjs +1 -1
  5. package/dist/components/Alert/index.mjs +40 -40
  6. package/dist/components/Breadcrumbs/Breadcrumbs.cjs +3 -3
  7. package/dist/components/Breadcrumbs/Breadcrumbs.mjs +43 -43
  8. package/dist/components/Button/Button.cjs +12 -12
  9. package/dist/components/Button/Button.config.cjs +1 -1
  10. package/dist/components/Button/Button.config.mjs +3 -1
  11. package/dist/components/Button/Button.mjs +24 -24
  12. package/dist/components/Button/style.module.scss.cjs +1 -1
  13. package/dist/components/Button/style.module.scss.mjs +57 -55
  14. package/dist/components/ButtonIcon/ButtonIcon.cjs +12 -12
  15. package/dist/components/ButtonIcon/ButtonIcon.mjs +20 -20
  16. package/dist/components/ButtonPopover/ButtonPopover.cjs +1 -1
  17. package/dist/components/ButtonPopover/ButtonPopover.mjs +28 -31
  18. package/dist/components/Calendar/Calendar.cjs +1 -1
  19. package/dist/components/Calendar/Calendar.mjs +98 -100
  20. package/dist/components/Calendar/CalendarMonth.cjs +1 -1
  21. package/dist/components/Calendar/CalendarMonth.mjs +41 -42
  22. package/dist/components/Calendar/CalendarRange.cjs +1 -1
  23. package/dist/components/Calendar/CalendarRange.mjs +59 -61
  24. package/dist/components/Calendar/CalendarYear.cjs +3 -3
  25. package/dist/components/Calendar/CalendarYear.mjs +39 -40
  26. package/dist/components/Chart/DoughnutChart.cjs +1 -1
  27. package/dist/components/Chart/DoughnutChart.mjs +93 -96
  28. package/dist/components/Chart/GradientBarChart.cjs +1 -1
  29. package/dist/components/Chart/GradientBarChart.mjs +80 -81
  30. package/dist/components/Chart/GradientLineChart.cjs +1 -1
  31. package/dist/components/Chart/GradientLineChart.mjs +50 -51
  32. package/dist/components/Chart/LineChart.cjs +1 -1
  33. package/dist/components/Chart/LineChart.mjs +23 -23
  34. package/dist/components/Chart/PieChart.cjs +1 -1
  35. package/dist/components/Chart/PieChart.mjs +45 -48
  36. package/dist/components/Collapse/Collapse.cjs +1 -1
  37. package/dist/components/Collapse/Collapse.mjs +23 -24
  38. package/dist/components/DatePicker/DatePicker.cjs +1 -1
  39. package/dist/components/DatePicker/DatePicker.mjs +86 -89
  40. package/dist/components/DatePicker/DateRangePicker.cjs +1 -1
  41. package/dist/components/DatePicker/DateRangePicker.mjs +91 -92
  42. package/dist/components/DatePicker/FilterDate.cjs +1 -1
  43. package/dist/components/DatePicker/FilterDate.mjs +107 -110
  44. package/dist/components/DatePicker/MonthYearPicker.cjs +1 -1
  45. package/dist/components/DatePicker/MonthYearPicker.mjs +51 -53
  46. package/dist/components/FilterContainer/FilterContainer.cjs +1 -1
  47. package/dist/components/FilterContainer/FilterContainer.mjs +27 -27
  48. package/dist/components/Input/InputFloatingInner.cjs +5 -5
  49. package/dist/components/Input/InputFloatingInner.mjs +24 -25
  50. package/dist/components/NumberFormat/NumberFormat.cjs +1 -1
  51. package/dist/components/NumberFormat/NumberFormat.mjs +12 -13
  52. package/dist/components/Pagination/Pagination.cjs +2 -2
  53. package/dist/components/Pagination/Pagination.mjs +76 -80
  54. package/dist/components/SelectDropdownContainer/SelectDropdownContainer.cjs +1 -1
  55. package/dist/components/SelectDropdownContainer/SelectDropdownContainer.mjs +98 -102
  56. package/dist/components/Sidebar/ItemSidebar.cjs +8 -8
  57. package/dist/components/Sidebar/ItemSidebar.mjs +71 -72
  58. package/dist/components/Sidebar/Sidebar.cjs +1 -1
  59. package/dist/components/Sidebar/Sidebar.mjs +65 -68
  60. package/dist/components/Slider/Slider.cjs +1 -0
  61. package/dist/components/Slider/Slider.mjs +61 -0
  62. package/dist/components/Slider/style.module.scss.cjs +1 -0
  63. package/dist/components/Slider/style.module.scss.mjs +14 -0
  64. package/dist/components/Step/Step.cjs +5 -5
  65. package/dist/components/Step/Step.mjs +52 -52
  66. package/dist/components/Table/Table.cjs +3 -3
  67. package/dist/components/Table/Table.mjs +275 -298
  68. package/dist/components/Table/TableSubMobile.cjs +1 -1
  69. package/dist/components/Table/TableSubMobile.mjs +32 -35
  70. package/dist/components/Tabs/Tabs.cjs +8 -8
  71. package/dist/components/Tabs/Tabs.mjs +66 -70
  72. package/dist/components/Textarea/Textarea.cjs +7 -7
  73. package/dist/components/Textarea/Textarea.mjs +47 -50
  74. package/dist/components/Textarea/TextareaFloatingInner.cjs +6 -6
  75. package/dist/components/Textarea/TextareaFloatingInner.mjs +56 -61
  76. package/dist/components/Textarea/TextareaInnerLabel.cjs +6 -6
  77. package/dist/components/Textarea/TextareaInnerLabel.mjs +47 -50
  78. package/dist/components/TimeRange/TimeRange.cjs +1 -1
  79. package/dist/components/TimeRange/TimeRange.mjs +88 -91
  80. package/dist/components/Tooltip/Tooltip.cjs +1 -1
  81. package/dist/components/Tooltip/Tooltip.mjs +44 -46
  82. package/dist/components/Upload/UploadFile.cjs +1 -1
  83. package/dist/components/Upload/UploadFile.mjs +50 -54
  84. package/dist/components/Upload/UploadImage.cjs +12 -12
  85. package/dist/components/Upload/UploadImage.mjs +73 -79
  86. package/dist/components/Upload/UploadMultipleFile.cjs +1 -1
  87. package/dist/components/Upload/UploadMultipleFile.mjs +61 -62
  88. package/dist/components/Virtualization/ListVirtualization.cjs +1 -1
  89. package/dist/components/Virtualization/ListVirtualization.mjs +52 -55
  90. package/dist/components/Virtualization/TableVirtualization.cjs +1 -1
  91. package/dist/components/Virtualization/TableVirtualization.mjs +56 -59
  92. package/dist/config/components/tinymce.cjs +2 -2
  93. package/dist/config/components/tinymce.mjs +3 -3
  94. package/dist/hooks/useCountdown.cjs +1 -1
  95. package/dist/hooks/useCountdown.mjs +15 -15
  96. package/dist/hooks/useDebounce.cjs +1 -1
  97. package/dist/hooks/useDebounce.mjs +19 -19
  98. package/dist/hooks/useOtpInput.cjs +1 -1
  99. package/dist/hooks/useOtpInput.mjs +47 -51
  100. package/dist/index.cjs +1 -1
  101. package/dist/index.mjs +48 -46
  102. package/dist/package.json.cjs +1 -1
  103. package/dist/package.json.d.ts +129 -128
  104. package/dist/package.json.mjs +1 -1
  105. package/dist/src/components/Button/Button.config.d.ts +2 -0
  106. package/dist/src/components/Slider/Slider.d.ts +3 -0
  107. package/dist/src/components/Slider/Slider.stories.d.ts +6 -0
  108. package/dist/src/components/index.d.ts +4 -2
  109. package/dist/src/interfaces/components/Button/index.d.ts +1 -1
  110. package/dist/src/interfaces/components/Slider/index.d.ts +51 -0
  111. package/dist/types-external/table.d.ts +15 -15
  112. package/dist/utils/common.cjs +1 -1
  113. package/dist/utils/common.mjs +172 -173
  114. package/package.json +128 -128
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),s=require("react"),v=require("./Tooltip.module.scss.cjs"),x=require("../Popover/Popover.cjs"),y=require("../../config/tailwind/colors.cjs"),M=({id:m="1ru-tooltip",children:S,text:T,zIndexPopover:k=1,onShow:i,onClose:u,placement:w="top",backgroundColor:c="black",popoverProps:C={},arrowProps:b={},className:I,isHover:a,delay:j=600})=>{let n;const l=s.useRef(null),f={backgroundColor:y.default[c]||c},[o,d]=s.useState(!1),[q,p]=s.useState(!1),g=e=>{var t;(t=l.current)==null||t.handlerShow(e),p(!0),typeof i=="function"&&i()},h=()=>{var e;p(!1),o||(clearInterval(n),(e=l.current)==null||e.setShow(!1),typeof u=="function"&&u())};return r.jsxs(r.Fragment,{children:[r.jsx("div",{id:m,onMouseEnter:e=>{if(a&&!o){const t=e.currentTarget;n=setTimeout(()=>{g({...e,currentTarget:t})},j)}},onMouseLeave:()=>{a&&!o&&h()},onClick:e=>{d(!0),clearInterval(n),q||g(e)},className:v.default.container,children:S}),r.jsx(x.default,{floatingOptions:{placement:w},ref:l,id:"1ru-popover-tooltip",offset:10,withArrow:!0,zIndex:k,onClose:()=>{o&&(d(!1),h())},styleInnerPopover:{backgroundColor:f.backgroundColor},propsArrow:{fill:f.backgroundColor,...b},className:`${v.default["container-popover"]} ${I??""}`,...C,children:T})]})};exports.default=M;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),l=require("react"),h=require("./Tooltip.module.scss.cjs"),x=require("../Popover/Popover.cjs"),y=require("../../config/tailwind/colors.cjs"),M=({id:v="1ru-tooltip",children:m,text:S,zIndexPopover:T=1,onShow:s,onClose:i,placement:k="top",backgroundColor:u="black",popoverProps:w={},arrowProps:C={},className:b,isHover:c,delay:I=600})=>{let r;const n=l.useRef(null),a={backgroundColor:y.default[u]||u},[o,f]=l.useState(!1),[j,d]=l.useState(!1),p=e=>{n.current?.handlerShow(e),d(!0),typeof s=="function"&&s()},g=()=>{d(!1),o||(clearInterval(r),n.current?.setShow(!1),typeof i=="function"&&i())};return t.jsxs(t.Fragment,{children:[t.jsx("div",{id:v,onMouseEnter:e=>{if(c&&!o){const q=e.currentTarget;r=setTimeout(()=>{p({...e,currentTarget:q})},I)}},onMouseLeave:()=>{c&&!o&&g()},onClick:e=>{f(!0),clearInterval(r),j||p(e)},className:h.default.container,children:m}),t.jsx(x.default,{floatingOptions:{placement:k},ref:n,id:"1ru-popover-tooltip",offset:10,withArrow:!0,zIndex:T,onClose:()=>{o&&(f(!1),g())},styleInnerPopover:{backgroundColor:a.backgroundColor},propsArrow:{fill:a.backgroundColor,...C},className:`${h.default["container-popover"]} ${b??""}`,...w,children:S})]})};exports.default=M;
@@ -1,73 +1,71 @@
1
- import { jsxs as j, Fragment as A, jsx as h } from "react/jsx-runtime";
2
- import s from "react";
3
- import g from "./Tooltip.module.scss.mjs";
1
+ import { jsxs as j, Fragment as A, jsx as d } from "react/jsx-runtime";
2
+ import n from "react";
3
+ import h from "./Tooltip.module.scss.mjs";
4
4
  import M from "../Popover/Popover.mjs";
5
5
  import N from "../../config/tailwind/colors.mjs";
6
6
  const F = ({
7
- id: k = "1ru-tooltip",
8
- children: v,
9
- text: w,
10
- zIndexPopover: C = 1,
11
- onShow: l,
12
- onClose: i,
13
- placement: I = "top",
14
- backgroundColor: a = "black",
15
- popoverProps: S = {},
16
- arrowProps: T = {},
17
- className: b,
18
- isHover: c,
19
- delay: x = 600
7
+ id: g = "1ru-tooltip",
8
+ children: k,
9
+ text: v,
10
+ zIndexPopover: w = 1,
11
+ onShow: s,
12
+ onClose: l,
13
+ placement: C = "top",
14
+ backgroundColor: i = "black",
15
+ popoverProps: I = {},
16
+ arrowProps: S = {},
17
+ className: T,
18
+ isHover: a,
19
+ delay: b = 600
20
20
  }) => {
21
- let r;
22
- const n = s.useRef(null), f = {
23
- backgroundColor: N[a] || a
24
- }, [e, p] = s.useState(!1), [y, u] = s.useState(!1), m = (o) => {
25
- var t;
26
- (t = n.current) == null || t.handlerShow(o), u(!0), typeof l == "function" && l();
27
- }, d = () => {
28
- var o;
29
- u(!1), e || (clearInterval(r), (o = n.current) == null || o.setShow(!1), typeof i == "function" && i());
21
+ let t;
22
+ const r = n.useRef(null), c = {
23
+ backgroundColor: N[i] || i
24
+ }, [e, f] = n.useState(!1), [x, p] = n.useState(!1), u = (o) => {
25
+ r.current?.handlerShow(o), p(!0), typeof s == "function" && s();
26
+ }, m = () => {
27
+ p(!1), e || (clearInterval(t), r.current?.setShow(!1), typeof l == "function" && l());
30
28
  };
31
29
  return /* @__PURE__ */ j(A, { children: [
32
- /* @__PURE__ */ h(
30
+ /* @__PURE__ */ d(
33
31
  "div",
34
32
  {
35
- id: k,
33
+ id: g,
36
34
  onMouseEnter: (o) => {
37
- if (c && !e) {
38
- const t = o.currentTarget;
39
- r = setTimeout(() => {
40
- m({ ...o, currentTarget: t });
41
- }, x);
35
+ if (a && !e) {
36
+ const y = o.currentTarget;
37
+ t = setTimeout(() => {
38
+ u({ ...o, currentTarget: y });
39
+ }, b);
42
40
  }
43
41
  },
44
42
  onMouseLeave: () => {
45
- c && !e && d();
43
+ a && !e && m();
46
44
  },
47
45
  onClick: (o) => {
48
- p(!0), clearInterval(r), y || m(o);
46
+ f(!0), clearInterval(t), x || u(o);
49
47
  },
50
- className: g.container,
51
- children: v
48
+ className: h.container,
49
+ children: k
52
50
  }
53
51
  ),
54
- /* @__PURE__ */ h(
52
+ /* @__PURE__ */ d(
55
53
  M,
56
54
  {
57
- floatingOptions: { placement: I },
58
- ref: n,
55
+ floatingOptions: { placement: C },
56
+ ref: r,
59
57
  id: "1ru-popover-tooltip",
60
58
  offset: 10,
61
59
  withArrow: !0,
62
- zIndex: C,
60
+ zIndex: w,
63
61
  onClose: () => {
64
- e && (p(!1), d());
62
+ e && (f(!1), m());
65
63
  },
66
- styleInnerPopover: { backgroundColor: f.backgroundColor },
67
- propsArrow: { fill: f.backgroundColor, ...T },
68
- className: `${g["container-popover"]} ${b ?? ""}`,
69
- ...S,
70
- children: w
64
+ styleInnerPopover: { backgroundColor: c.backgroundColor },
65
+ propsArrow: { fill: c.backgroundColor, ...S },
66
+ className: `${h["container-popover"]} ${T ?? ""}`,
67
+ ...I,
68
+ children: v
71
69
  }
72
70
  )
73
71
  ] });
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),g=require("react"),B=require("../Input/InputReguler.cjs"),I=require("./UploadFile.module.scss.cjs"),E=()=>r.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:r.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.19544 6.19126C6.32045 6.06628 6.48999 5.99607 6.66677 5.99607C6.84354 5.99607 7.01308 6.06628 7.1381 6.19126L10.0001 9.05326L12.8621 6.19126C12.9236 6.12758 12.9972 6.0768 13.0785 6.04186C13.1598 6.00692 13.2473 5.98853 13.3358 5.98776C13.4244 5.98699 13.5121 6.00386 13.5941 6.03738C13.676 6.0709 13.7504 6.1204 13.813 6.18299C13.8756 6.24559 13.9251 6.32002 13.9587 6.40195C13.9922 6.48389 14.009 6.57167 14.0083 6.66019C14.0075 6.74871 13.9891 6.83619 13.9542 6.91753C13.9192 6.99886 13.8684 7.07243 13.8048 7.13392L10.9428 9.99592L13.8048 12.8579C13.9262 12.9837 13.9934 13.1521 13.9919 13.3269C13.9904 13.5017 13.9203 13.6689 13.7966 13.7925C13.673 13.9161 13.5058 13.9862 13.331 13.9877C13.1562 13.9892 12.9878 13.922 12.8621 13.8006L10.0001 10.9386L7.1381 13.8006C7.01237 13.922 6.84397 13.9892 6.66917 13.9877C6.49437 13.9862 6.32716 13.9161 6.20356 13.7925C6.07995 13.6689 6.00984 13.5017 6.00832 13.3269C6.0068 13.1521 6.074 12.9837 6.19544 12.8579L9.05744 9.99592L6.19544 7.13392C6.07045 7.00891 6.00024 6.83937 6.00024 6.66259C6.00024 6.48581 6.07045 6.31628 6.19544 6.19126Z",fill:"#212121"})}),S=()=>r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:r.jsx("path",{d:"M2 11.3334V4.66671C2 4.31309 2.14048 3.97395 2.39052 3.7239C2.64057 3.47385 2.97971 3.33337 3.33333 3.33337H7.33333L8.66667 4.66671H12.6667C13.0203 4.66671 13.3594 4.80718 13.6095 5.05723C13.8595 5.30728 14 5.64642 14 6.00004V11.3334C14 11.687 13.8595 12.0261 13.6095 12.2762C13.3594 12.5262 13.0203 12.6667 12.6667 12.6667H3.33333C2.97971 12.6667 2.64057 12.5262 2.39052 12.2762C2.14048 12.0261 2 11.687 2 11.3334Z",stroke:"#9E9E9E",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),p=m=>{const n=g.useRef(null),{fileName:o,onChange:u,maxFile:x,maxSize:a=2,validateFile:c,error:d,label:k,inputProps:v,priorityError:f="external",eventError:s}=m,l=c||["image/png","image/jpeg","image/jpg"],[C,j]=g.useState(""),w={internal:C||d,external:d||C},L=e=>{if(e!=null&&e.length){const t=e[0],M=t.size/1024/1024;let i="";if(l.some(y=>{var h;return(h=e[0].type)==null?void 0:h.includes(y)})?M>a?i=`${e.length>1?"Jumlah u":"U"}kuran berkas tidak boleh melebihi ${a}MB.`:u(t):i="Berkas tidak didukung, silahkan pilih file kembali.",j(i),s==null||s(i),!(n!=null&&n.current))return;n.current.value=""}},b=e=>{var t;e.preventDefault(),n!=null&&n.current&&((t=n.current)==null||t.click())},F=e=>{e.preventDefault(),n!=null&&n.current&&(u(null),n.current.value="")};return r.jsxs(r.Fragment,{children:[r.jsx("input",{accept:l==null?void 0:l.join(", "),ref:n,hidden:!0,type:"file",max:x,onChange:e=>{L(e.target.files)}}),r.jsx(B.default,{sizeInput:"medium",placeholder:"Pilih Berkas",label:k,value:o,readOnly:!0,onClick:e=>b(e),startIcon:r.jsx(S,{}),endIcon:o&&r.jsx("div",{className:I.default["button-remove"],onClick:e=>F(e),children:r.jsx(E,{})}),error:w[f],...v})]})};p.displayName="UploadFile";exports.default=p;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),C=require("react"),R=require("../Input/InputReguler.cjs"),y=require("./UploadFile.module.scss.cjs"),B=()=>t.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.19544 6.19126C6.32045 6.06628 6.48999 5.99607 6.66677 5.99607C6.84354 5.99607 7.01308 6.06628 7.1381 6.19126L10.0001 9.05326L12.8621 6.19126C12.9236 6.12758 12.9972 6.0768 13.0785 6.04186C13.1598 6.00692 13.2473 5.98853 13.3358 5.98776C13.4244 5.98699 13.5121 6.00386 13.5941 6.03738C13.676 6.0709 13.7504 6.1204 13.813 6.18299C13.8756 6.24559 13.9251 6.32002 13.9587 6.40195C13.9922 6.48389 14.009 6.57167 14.0083 6.66019C14.0075 6.74871 13.9891 6.83619 13.9542 6.91753C13.9192 6.99886 13.8684 7.07243 13.8048 7.13392L10.9428 9.99592L13.8048 12.8579C13.9262 12.9837 13.9934 13.1521 13.9919 13.3269C13.9904 13.5017 13.9203 13.6689 13.7966 13.7925C13.673 13.9161 13.5058 13.9862 13.331 13.9877C13.1562 13.9892 12.9878 13.922 12.8621 13.8006L10.0001 10.9386L7.1381 13.8006C7.01237 13.922 6.84397 13.9892 6.66917 13.9877C6.49437 13.9862 6.32716 13.9161 6.20356 13.7925C6.07995 13.6689 6.00984 13.5017 6.00832 13.3269C6.0068 13.1521 6.074 12.9837 6.19544 12.8579L9.05744 9.99592L6.19544 7.13392C6.07045 7.00891 6.00024 6.83937 6.00024 6.66259C6.00024 6.48581 6.07045 6.31628 6.19544 6.19126Z",fill:"#212121"})}),E=()=>t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:t.jsx("path",{d:"M2 11.3334V4.66671C2 4.31309 2.14048 3.97395 2.39052 3.7239C2.64057 3.47385 2.97971 3.33337 3.33333 3.33337H7.33333L8.66667 4.66671H12.6667C13.0203 4.66671 13.3594 4.80718 13.6095 5.05723C13.8595 5.30728 14 5.64642 14 6.00004V11.3334C14 11.687 13.8595 12.0261 13.6095 12.2762C13.3594 12.5262 13.0203 12.6667 12.6667 12.6667H3.33333C2.97971 12.6667 2.64057 12.5262 2.39052 12.2762C2.14048 12.0261 2 11.687 2 11.3334Z",stroke:"#9E9E9E",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),h=f=>{const r=C.useRef(null),{fileName:l,onChange:i,maxFile:g,maxSize:s=2,validateFile:o,error:a,label:p,inputProps:m,priorityError:v="external",eventError:x}=f,u=o||["image/png","image/jpeg","image/jpg"],[c,k]=C.useState(""),j={internal:c||a,external:a||c},w=e=>{if(e?.length){const d=e[0],F=d.size/1024/1024;let n="";if(u.some(M=>e[0].type?.includes(M))?F>s?n=`${e.length>1?"Jumlah u":"U"}kuran berkas tidak boleh melebihi ${s}MB.`:i(d):n="Berkas tidak didukung, silahkan pilih file kembali.",k(n),x?.(n),!r?.current)return;r.current.value=""}},L=e=>{e.preventDefault(),r?.current&&r.current?.click()},b=e=>{e.preventDefault(),r?.current&&(i(null),r.current.value="")};return t.jsxs(t.Fragment,{children:[t.jsx("input",{accept:u?.join(", "),ref:r,hidden:!0,type:"file",max:g,onChange:e=>{w(e.target.files)}}),t.jsx(R.default,{sizeInput:"medium",placeholder:"Pilih Berkas",label:p,value:l,readOnly:!0,onClick:e=>L(e),startIcon:t.jsx(E,{}),endIcon:l&&t.jsx("div",{className:y.default["button-remove"],onClick:e=>b(e),children:t.jsx(B,{})}),error:j[v],...m})]})};h.displayName="UploadFile";exports.default=h;
@@ -1,8 +1,8 @@
1
- import { jsxs as j, Fragment as I, jsx as n } from "react/jsx-runtime";
2
- import m from "react";
3
- import M from "../Input/InputReguler.mjs";
4
- import E from "./UploadFile.module.scss.mjs";
5
- const z = () => /* @__PURE__ */ n("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ n(
1
+ import { jsxs as F, Fragment as R, jsx as r } from "react/jsx-runtime";
2
+ import d from "react";
3
+ import b from "../Input/InputReguler.mjs";
4
+ import j from "./UploadFile.module.scss.mjs";
5
+ const I = () => /* @__PURE__ */ r("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ r(
6
6
  "path",
7
7
  {
8
8
  fillRule: "evenodd",
@@ -10,7 +10,7 @@ const z = () => /* @__PURE__ */ n("svg", { width: "20", height: "20", viewBox: "
10
10
  d: "M6.19544 6.19126C6.32045 6.06628 6.48999 5.99607 6.66677 5.99607C6.84354 5.99607 7.01308 6.06628 7.1381 6.19126L10.0001 9.05326L12.8621 6.19126C12.9236 6.12758 12.9972 6.0768 13.0785 6.04186C13.1598 6.00692 13.2473 5.98853 13.3358 5.98776C13.4244 5.98699 13.5121 6.00386 13.5941 6.03738C13.676 6.0709 13.7504 6.1204 13.813 6.18299C13.8756 6.24559 13.9251 6.32002 13.9587 6.40195C13.9922 6.48389 14.009 6.57167 14.0083 6.66019C14.0075 6.74871 13.9891 6.83619 13.9542 6.91753C13.9192 6.99886 13.8684 7.07243 13.8048 7.13392L10.9428 9.99592L13.8048 12.8579C13.9262 12.9837 13.9934 13.1521 13.9919 13.3269C13.9904 13.5017 13.9203 13.6689 13.7966 13.7925C13.673 13.9161 13.5058 13.9862 13.331 13.9877C13.1562 13.9892 12.9878 13.922 12.8621 13.8006L10.0001 10.9386L7.1381 13.8006C7.01237 13.922 6.84397 13.9892 6.66917 13.9877C6.49437 13.9862 6.32716 13.9161 6.20356 13.7925C6.07995 13.6689 6.00984 13.5017 6.00832 13.3269C6.0068 13.1521 6.074 12.9837 6.19544 12.8579L9.05744 9.99592L6.19544 7.13392C6.07045 7.00891 6.00024 6.83937 6.00024 6.66259C6.00024 6.48581 6.07045 6.31628 6.19544 6.19126Z",
11
11
  fill: "#212121"
12
12
  }
13
- ) }), D = () => /* @__PURE__ */ n("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ n(
13
+ ) }), M = () => /* @__PURE__ */ r("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ r(
14
14
  "path",
15
15
  {
16
16
  d: "M2 11.3334V4.66671C2 4.31309 2.14048 3.97395 2.39052 3.7239C2.64057 3.47385 2.97971 3.33337 3.33333 3.33337H7.33333L8.66667 4.66671H12.6667C13.0203 4.66671 13.3594 4.80718 13.6095 5.05723C13.8595 5.30728 14 5.64642 14 6.00004V11.3334C14 11.687 13.8595 12.0261 13.6095 12.2762C13.3594 12.5262 13.0203 12.6667 12.6667 12.6667H3.33333C2.97971 12.6667 2.64057 12.5262 2.39052 12.2762C2.14048 12.0261 2 11.687 2 11.3334Z",
@@ -19,76 +19,72 @@ const z = () => /* @__PURE__ */ n("svg", { width: "20", height: "20", viewBox: "
19
19
  strokeLinecap: "round",
20
20
  strokeLinejoin: "round"
21
21
  }
22
- ) }), H = (d) => {
23
- const r = m.useRef(null), {
24
- fileName: s,
25
- onChange: u,
26
- maxFile: g,
27
- maxSize: a = 2,
28
- validateFile: c,
29
- error: C,
30
- label: k,
31
- inputProps: f,
32
- priorityError: v = "external",
33
- eventError: o
34
- } = d, i = c || ["image/png", "image/jpeg", "image/jpg"], [h, w] = m.useState(""), x = {
35
- internal: h || C,
36
- external: C || h
37
- }, L = (e) => {
38
- if (e != null && e.length) {
39
- const t = e[0], F = t.size / 1024 / 1024;
40
- let l = "";
41
- if (i.some((b) => {
42
- var p;
43
- return (p = e[0].type) == null ? void 0 : p.includes(b);
44
- }) ? F > a ? l = `${e.length > 1 ? "Jumlah u" : "U"}kuran berkas tidak boleh melebihi ${a}MB.` : u(t) : l = "Berkas tidak didukung, silahkan pilih file kembali.", w(l), o == null || o(l), !(r != null && r.current)) return;
45
- r.current.value = "";
22
+ ) }), z = (h) => {
23
+ const t = d.useRef(null), {
24
+ fileName: i,
25
+ onChange: l,
26
+ maxFile: p,
27
+ maxSize: o = 2,
28
+ validateFile: s,
29
+ error: a,
30
+ label: f,
31
+ inputProps: m,
32
+ priorityError: g = "external",
33
+ eventError: v
34
+ } = h, u = s || ["image/png", "image/jpeg", "image/jpg"], [c, k] = d.useState(""), w = {
35
+ internal: c || a,
36
+ external: a || c
37
+ }, x = (e) => {
38
+ if (e?.length) {
39
+ const C = e[0], B = C.size / 1024 / 1024;
40
+ let n = "";
41
+ if (u.some((E) => e[0].type?.includes(E)) ? B > o ? n = `${e.length > 1 ? "Jumlah u" : "U"}kuran berkas tidak boleh melebihi ${o}MB.` : l(C) : n = "Berkas tidak didukung, silahkan pilih file kembali.", k(n), v?.(n), !t?.current) return;
42
+ t.current.value = "";
46
43
  }
44
+ }, L = (e) => {
45
+ e.preventDefault(), t?.current && t.current?.click();
47
46
  }, y = (e) => {
48
- var t;
49
- e.preventDefault(), r != null && r.current && ((t = r.current) == null || t.click());
50
- }, B = (e) => {
51
- e.preventDefault(), r != null && r.current && (u(null), r.current.value = "");
47
+ e.preventDefault(), t?.current && (l(null), t.current.value = "");
52
48
  };
53
- return /* @__PURE__ */ j(I, { children: [
54
- /* @__PURE__ */ n(
49
+ return /* @__PURE__ */ F(R, { children: [
50
+ /* @__PURE__ */ r(
55
51
  "input",
56
52
  {
57
- accept: i == null ? void 0 : i.join(", "),
58
- ref: r,
53
+ accept: u?.join(", "),
54
+ ref: t,
59
55
  hidden: !0,
60
56
  type: "file",
61
- max: g,
57
+ max: p,
62
58
  onChange: (e) => {
63
- L(e.target.files);
59
+ x(e.target.files);
64
60
  }
65
61
  }
66
62
  ),
67
- /* @__PURE__ */ n(
68
- M,
63
+ /* @__PURE__ */ r(
64
+ b,
69
65
  {
70
66
  sizeInput: "medium",
71
67
  placeholder: "Pilih Berkas",
72
- label: k,
73
- value: s,
68
+ label: f,
69
+ value: i,
74
70
  readOnly: !0,
75
- onClick: (e) => y(e),
76
- startIcon: /* @__PURE__ */ n(D, {}),
77
- endIcon: s && /* @__PURE__ */ n(
71
+ onClick: (e) => L(e),
72
+ startIcon: /* @__PURE__ */ r(M, {}),
73
+ endIcon: i && /* @__PURE__ */ r(
78
74
  "div",
79
75
  {
80
- className: E["button-remove"],
81
- onClick: (e) => B(e),
82
- children: /* @__PURE__ */ n(z, {})
76
+ className: j["button-remove"],
77
+ onClick: (e) => y(e),
78
+ children: /* @__PURE__ */ r(I, {})
83
79
  }
84
80
  ),
85
- error: x[v],
86
- ...f
81
+ error: w[g],
82
+ ...m
87
83
  }
88
84
  )
89
85
  ] });
90
86
  };
91
- H.displayName = "UploadFile";
87
+ z.displayName = "UploadFile";
92
88
  export {
93
- H as default
89
+ z as default
94
90
  };
@@ -1,12 +1,12 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),p=require("react"),k=require("../Button/Button.cjs"),r=require("./UploadImage.module.scss.cjs"),y=({className:s})=>t.jsx("svg",{viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",className:`iru-h-5 iru-w-5 iru-text-red-600 ${s??""}`,fill:"currentColor",children:t.jsx("g",{id:"x",children:t.jsx("path",{id:"Vector",fillRule:"evenodd",clipRule:"evenodd",d:`M6.19544 6.19126C6.32045 6.06628 6.48999 5.99607 6.66677 5.99607C6.84354 5.99607 7.01308 6.06628 7.1381 \r
2
- 6.19126L10.0001 9.05326L12.8621 6.19126C12.9236 6.12758 12.9972 6.0768 13.0785 6.04186C13.1598 6.00692 13.2473 \r
3
- 5.98853 13.3358 5.98776C13.4244 5.98699 13.5121 6.00386 13.5941 6.03738C13.676 6.0709 13.7504 6.1204 13.813 \r
4
- 6.18299C13.8756 6.24559 13.9251 6.32002 13.9587 6.40195C13.9922 6.48389 14.009 6.57167 14.0083 6.66019C14.0075 \r
5
- 6.74871 13.9891 6.83619 13.9542 6.91753C13.9192 6.99886 13.8684 7.07243 13.8048 7.13392L10.9428 9.99592L13.8048 \r
6
- 12.8579C13.9262 12.9837 13.9934 13.1521 13.9919 13.3269C13.9904 13.5017 13.9203 13.6689 13.7966 13.7925C13.673 \r
7
- 13.9161 13.5058 13.9862 13.331 13.9877C13.1562 13.9892 12.9878 13.922 12.8621 13.8006L10.0001 10.9386L7.1381 \r
8
- 13.8006C7.01237 13.922 6.84397 13.9892 6.66917 13.9877C6.49437 13.9862 6.32716 13.9161 6.20356 13.7925C6.07995 \r
9
- 13.6689 6.00984 13.5017 6.00832 13.3269C6.0068 13.1521 6.074 12.9837 6.19544 12.8579L9.05744 9.99592L6.19544 \r
10
- 7.13392C6.07045 7.00891 6.00024 6.83937 6.00024 6.66259C6.00024 6.48581 6.07045 6.31628 6.19544 6.19126Z`})})}),B=({className:s})=>t.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:`iru-h-5 iru-w-5 ${s??""}`,children:t.jsx("g",{id:"upload",children:t.jsx("path",{id:"Vector",d:`M3.83337 13.3333V14.1666C3.83337 14.8297 4.09677 15.4656 4.56561 15.9344C5.03445 16.4033 5.67033 \r
11
- 16.6666 6.33337 16.6666H14.6667C15.3297 16.6666 15.9656 16.4033 16.4345 15.9344C16.9033 15.4656 17.1667 \r
12
- 14.8297 17.1667 14.1666V13.3333M13.8334 6.66665L10.5 3.33331M10.5 3.33331L7.16671 6.66665M10.5 3.33331V13.3333`,stroke:"#1976D2",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),R=({onChange:s,valueUrl:i,validateFile:h,validateFileDesc:D="Max 2MB (.jpg, .jpeg, .png, .svg)",maxSize:m=2,icon:L,desc:c,classNameContainer:w,classNameImage:u,classNameAction:M,id:l})=>{const n=p.useRef(null),a=h||["image/png","image/jpeg","image/jpg"],[o,x]=p.useState(""),[j,d]=p.useState(""),C=e=>{if(e!=null&&e.length){const g=e[0],N=g.size/1024/1024;if(!a.some(f=>{var $;return($=e[0].type)==null?void 0:$.includes(f)}))d("Berkas tidak didukung, silahkan pilih file kembali.");else if(N>m){const f=`${e.length>1?"Jumlah u":"U"}kuran berkas tidak boleh melebihi ${m}MB.`;d(f)}else{if(!(n!=null&&n.current))return;d(""),s(g),x(URL.createObjectURL(g)),n.current.value=""}}},v=e=>{e.preventDefault(),C(e.dataTransfer.files)},b=e=>{e.preventDefault(),n!=null&&n.current&&(typeof s=="function"&&s(null),x(""),n.current.value="")};return t.jsxs("div",{className:`${r.default.container} ${w}`,children:[t.jsx("input",{accept:a==null?void 0:a.join(", "),ref:n,hidden:!0,type:"file",multiple:!1,onChange:e=>{e.target.files&&C(e.target.files)}}),o||i?t.jsx("div",{id:`${l}-exist`,className:`${r.default["image-content"]} ${u}`,onDrop:v,onDragOver:e=>e.preventDefault(),onDragLeave:e=>e.preventDefault(),children:t.jsx("img",{src:o||i,alt:"upload-image",className:`${r.default.image} ${u}`})}):t.jsxs("div",{id:l,className:`${r.default["image-content"]} ${u}`,onDrop:v,onDragOver:e=>e.preventDefault(),onDragLeave:e=>e.preventDefault(),children:[L,t.jsx("div",{className:r.default["text-desc"],children:typeof c=="function"?c():c})]}),t.jsxs("div",{className:r.default["action-content"],children:[t.jsxs("div",{className:`${r.default["button-content"]} ${M}`,children:[(o||i)&&t.jsx(k.default,{id:`${l}-delete-img`,variants:"tertiary-red-600",size:"xs",startIcon:t.jsx(y,{}),onClick:e=>b(e),children:"Hapus"}),t.jsxs(k.default,{id:`${l}-change-img`,variants:"tertiary-blue-700",size:"xs",onClick:()=>{var e;return(e=n.current)==null?void 0:e.click()},startIcon:t.jsx(B,{}),children:[o||i?"Ganti":"Pilih"," Gambar"]})]}),t.jsx("p",{className:r.default["text-desc"],children:D}),j&&t.jsx("p",{className:r.default["text-error"],children:j})]})]})};exports.default=R;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),g=require("react"),$=require("../Button/Button.cjs"),n=require("./UploadImage.module.scss.cjs"),R=({className:s})=>t.jsx("svg",{viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",className:`iru-h-5 iru-w-5 iru-text-red-600 ${s??""}`,fill:"currentColor",children:t.jsx("g",{id:"x",children:t.jsx("path",{id:"Vector",fillRule:"evenodd",clipRule:"evenodd",d:`M6.19544 6.19126C6.32045 6.06628 6.48999 5.99607 6.66677 5.99607C6.84354 5.99607 7.01308 6.06628 7.1381
2
+ 6.19126L10.0001 9.05326L12.8621 6.19126C12.9236 6.12758 12.9972 6.0768 13.0785 6.04186C13.1598 6.00692 13.2473
3
+ 5.98853 13.3358 5.98776C13.4244 5.98699 13.5121 6.00386 13.5941 6.03738C13.676 6.0709 13.7504 6.1204 13.813
4
+ 6.18299C13.8756 6.24559 13.9251 6.32002 13.9587 6.40195C13.9922 6.48389 14.009 6.57167 14.0083 6.66019C14.0075
5
+ 6.74871 13.9891 6.83619 13.9542 6.91753C13.9192 6.99886 13.8684 7.07243 13.8048 7.13392L10.9428 9.99592L13.8048
6
+ 12.8579C13.9262 12.9837 13.9934 13.1521 13.9919 13.3269C13.9904 13.5017 13.9203 13.6689 13.7966 13.7925C13.673
7
+ 13.9161 13.5058 13.9862 13.331 13.9877C13.1562 13.9892 12.9878 13.922 12.8621 13.8006L10.0001 10.9386L7.1381
8
+ 13.8006C7.01237 13.922 6.84397 13.9892 6.66917 13.9877C6.49437 13.9862 6.32716 13.9161 6.20356 13.7925C6.07995
9
+ 13.6689 6.00984 13.5017 6.00832 13.3269C6.0068 13.1521 6.074 12.9837 6.19544 12.8579L9.05744 9.99592L6.19544
10
+ 7.13392C6.07045 7.00891 6.00024 6.83937 6.00024 6.66259C6.00024 6.48581 6.07045 6.31628 6.19544 6.19126Z`})})}),N=({className:s})=>t.jsx("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:`iru-h-5 iru-w-5 ${s??""}`,children:t.jsx("g",{id:"upload",children:t.jsx("path",{id:"Vector",d:`M3.83337 13.3333V14.1666C3.83337 14.8297 4.09677 15.4656 4.56561 15.9344C5.03445 16.4033 5.67033
11
+ 16.6666 6.33337 16.6666H14.6667C15.3297 16.6666 15.9656 16.4033 16.4345 15.9344C16.9033 15.4656 17.1667
12
+ 14.8297 17.1667 14.1666V13.3333M13.8334 6.66665L10.5 3.33331M10.5 3.33331L7.16671 6.66665M10.5 3.33331V13.3333`,stroke:"#1976D2",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),y=({onChange:s,valueUrl:i,validateFile:p,validateFileDesc:k="Max 2MB (.jpg, .jpeg, .png, .svg)",maxSize:h=2,icon:D,desc:o,classNameContainer:L,classNameImage:c,classNameAction:w,id:l})=>{const r=g.useRef(null),m=p||["image/png","image/jpeg","image/jpg"],[a,x]=g.useState(""),[j,u]=g.useState(""),v=e=>{if(e?.length){const d=e[0],b=d.size/1024/1024;if(!m.some(f=>e[0].type?.includes(f)))u("Berkas tidak didukung, silahkan pilih file kembali.");else if(b>h){const f=`${e.length>1?"Jumlah u":"U"}kuran berkas tidak boleh melebihi ${h}MB.`;u(f)}else{if(!r?.current)return;u(""),s(d),x(URL.createObjectURL(d)),r.current.value=""}}},C=e=>{e.preventDefault(),v(e.dataTransfer.files)},M=e=>{e.preventDefault(),r?.current&&(typeof s=="function"&&s(null),x(""),r.current.value="")};return t.jsxs("div",{className:`${n.default.container} ${L}`,children:[t.jsx("input",{accept:m?.join(", "),ref:r,hidden:!0,type:"file",multiple:!1,onChange:e=>{e.target.files&&v(e.target.files)}}),a||i?t.jsx("div",{id:`${l}-exist`,className:`${n.default["image-content"]} ${c}`,onDrop:C,onDragOver:e=>e.preventDefault(),onDragLeave:e=>e.preventDefault(),children:t.jsx("img",{src:a||i,alt:"upload-image",className:`${n.default.image} ${c}`})}):t.jsxs("div",{id:l,className:`${n.default["image-content"]} ${c}`,onDrop:C,onDragOver:e=>e.preventDefault(),onDragLeave:e=>e.preventDefault(),children:[D,t.jsx("div",{className:n.default["text-desc"],children:typeof o=="function"?o():o})]}),t.jsxs("div",{className:n.default["action-content"],children:[t.jsxs("div",{className:`${n.default["button-content"]} ${w}`,children:[(a||i)&&t.jsx($.default,{id:`${l}-delete-img`,variants:"tertiary-red-600",size:"xs",startIcon:t.jsx(R,{}),onClick:e=>M(e),children:"Hapus"}),t.jsxs($.default,{id:`${l}-change-img`,variants:"tertiary-blue-700",size:"xs",onClick:()=>r.current?.click(),startIcon:t.jsx(N,{}),children:[a||i?"Ganti":"Pilih"," Gambar"]})]}),t.jsx("p",{className:n.default["text-desc"],children:k}),j&&t.jsx("p",{className:n.default["text-error"],children:j})]})]})};exports.default=y;
@@ -1,46 +1,46 @@
1
- import { jsxs as s, jsx as r } from "react/jsx-runtime";
2
- import h from "react";
3
- import x from "../Button/Button.mjs";
4
- import t from "./UploadImage.module.scss.mjs";
5
- const B = ({ className: i }) => /* @__PURE__ */ r(
1
+ import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
+ import g from "react";
3
+ import L from "../Button/Button.mjs";
4
+ import n from "./UploadImage.module.scss.mjs";
5
+ const b = ({ className: r }) => /* @__PURE__ */ t(
6
6
  "svg",
7
7
  {
8
8
  viewBox: "0 0 20 20",
9
9
  xmlns: "http://www.w3.org/2000/svg",
10
- className: `iru-h-5 iru-w-5 iru-text-red-600 ${i ?? ""}`,
10
+ className: `iru-h-5 iru-w-5 iru-text-red-600 ${r ?? ""}`,
11
11
  fill: "currentColor",
12
- children: /* @__PURE__ */ r("g", { id: "x", children: /* @__PURE__ */ r(
12
+ children: /* @__PURE__ */ t("g", { id: "x", children: /* @__PURE__ */ t(
13
13
  "path",
14
14
  {
15
15
  id: "Vector",
16
16
  fillRule: "evenodd",
17
17
  clipRule: "evenodd",
18
- d: `M6.19544 6.19126C6.32045 6.06628 6.48999 5.99607 6.66677 5.99607C6.84354 5.99607 7.01308 6.06628 7.1381 \r
19
- 6.19126L10.0001 9.05326L12.8621 6.19126C12.9236 6.12758 12.9972 6.0768 13.0785 6.04186C13.1598 6.00692 13.2473 \r
20
- 5.98853 13.3358 5.98776C13.4244 5.98699 13.5121 6.00386 13.5941 6.03738C13.676 6.0709 13.7504 6.1204 13.813 \r
21
- 6.18299C13.8756 6.24559 13.9251 6.32002 13.9587 6.40195C13.9922 6.48389 14.009 6.57167 14.0083 6.66019C14.0075 \r
22
- 6.74871 13.9891 6.83619 13.9542 6.91753C13.9192 6.99886 13.8684 7.07243 13.8048 7.13392L10.9428 9.99592L13.8048 \r
23
- 12.8579C13.9262 12.9837 13.9934 13.1521 13.9919 13.3269C13.9904 13.5017 13.9203 13.6689 13.7966 13.7925C13.673 \r
24
- 13.9161 13.5058 13.9862 13.331 13.9877C13.1562 13.9892 12.9878 13.922 12.8621 13.8006L10.0001 10.9386L7.1381 \r
25
- 13.8006C7.01237 13.922 6.84397 13.9892 6.66917 13.9877C6.49437 13.9862 6.32716 13.9161 6.20356 13.7925C6.07995 \r
26
- 13.6689 6.00984 13.5017 6.00832 13.3269C6.0068 13.1521 6.074 12.9837 6.19544 12.8579L9.05744 9.99592L6.19544 \r
18
+ d: `M6.19544 6.19126C6.32045 6.06628 6.48999 5.99607 6.66677 5.99607C6.84354 5.99607 7.01308 6.06628 7.1381
19
+ 6.19126L10.0001 9.05326L12.8621 6.19126C12.9236 6.12758 12.9972 6.0768 13.0785 6.04186C13.1598 6.00692 13.2473
20
+ 5.98853 13.3358 5.98776C13.4244 5.98699 13.5121 6.00386 13.5941 6.03738C13.676 6.0709 13.7504 6.1204 13.813
21
+ 6.18299C13.8756 6.24559 13.9251 6.32002 13.9587 6.40195C13.9922 6.48389 14.009 6.57167 14.0083 6.66019C14.0075
22
+ 6.74871 13.9891 6.83619 13.9542 6.91753C13.9192 6.99886 13.8684 7.07243 13.8048 7.13392L10.9428 9.99592L13.8048
23
+ 12.8579C13.9262 12.9837 13.9934 13.1521 13.9919 13.3269C13.9904 13.5017 13.9203 13.6689 13.7966 13.7925C13.673
24
+ 13.9161 13.5058 13.9862 13.331 13.9877C13.1562 13.9892 12.9878 13.922 12.8621 13.8006L10.0001 10.9386L7.1381
25
+ 13.8006C7.01237 13.922 6.84397 13.9892 6.66917 13.9877C6.49437 13.9862 6.32716 13.9161 6.20356 13.7925C6.07995
26
+ 13.6689 6.00984 13.5017 6.00832 13.3269C6.0068 13.1521 6.074 12.9837 6.19544 12.8579L9.05744 9.99592L6.19544
27
27
  7.13392C6.07045 7.00891 6.00024 6.83937 6.00024 6.66259C6.00024 6.48581 6.07045 6.31628 6.19544 6.19126Z`
28
28
  }
29
29
  ) })
30
30
  }
31
- ), R = ({ className: i }) => /* @__PURE__ */ r(
31
+ ), y = ({ className: r }) => /* @__PURE__ */ t(
32
32
  "svg",
33
33
  {
34
34
  viewBox: "0 0 20 20",
35
35
  fill: "none",
36
36
  xmlns: "http://www.w3.org/2000/svg",
37
- className: `iru-h-5 iru-w-5 ${i ?? ""}`,
38
- children: /* @__PURE__ */ r("g", { id: "upload", children: /* @__PURE__ */ r(
37
+ className: `iru-h-5 iru-w-5 ${r ?? ""}`,
38
+ children: /* @__PURE__ */ t("g", { id: "upload", children: /* @__PURE__ */ t(
39
39
  "path",
40
40
  {
41
41
  id: "Vector",
42
- d: `M3.83337 13.3333V14.1666C3.83337 14.8297 4.09677 15.4656 4.56561 15.9344C5.03445 16.4033 5.67033 \r
43
- 16.6666 6.33337 16.6666H14.6667C15.3297 16.6666 15.9656 16.4033 16.4345 15.9344C16.9033 15.4656 17.1667 \r
42
+ d: `M3.83337 13.3333V14.1666C3.83337 14.8297 4.09677 15.4656 4.56561 15.9344C5.03445 16.4033 5.67033
43
+ 16.6666 6.33337 16.6666H14.6667C15.3297 16.6666 15.9656 16.4033 16.4345 15.9344C16.9033 15.4656 17.1667
44
44
  14.8297 17.1667 14.1666V13.3333M13.8334 6.66665L10.5 3.33331M10.5 3.33331L7.16671 6.66665M10.5 3.33331V13.3333`,
45
45
  stroke: "#1976D2",
46
46
  strokeWidth: "1.5",
@@ -49,46 +49,43 @@ const B = ({ className: i }) => /* @__PURE__ */ r(
49
49
  }
50
50
  ) })
51
51
  }
52
- ), O = ({
53
- onChange: i,
54
- valueUrl: l,
55
- validateFile: f,
56
- validateFileDesc: w = "Max 2MB (.jpg, .jpeg, .png, .svg)",
57
- maxSize: C = 2,
58
- icon: M,
59
- desc: u,
60
- classNameContainer: j,
52
+ ), z = ({
53
+ onChange: r,
54
+ valueUrl: a,
55
+ validateFile: m,
56
+ validateFileDesc: x = "Max 2MB (.jpg, .jpeg, .png, .svg)",
57
+ maxSize: h = 2,
58
+ icon: w,
59
+ desc: c,
60
+ classNameContainer: M,
61
61
  classNameImage: d,
62
- classNameAction: N,
63
- id: o
62
+ classNameAction: j,
63
+ id: s
64
64
  }) => {
65
- const n = h.useRef(null), a = f || ["image/png", "image/jpeg", "image/jpg"], [c, v] = h.useState(""), [$, p] = h.useState(""), k = (e) => {
66
- if (e != null && e.length) {
67
- const g = e[0], y = g.size / 1024 / 1024;
68
- if (!a.some((m) => {
69
- var L;
70
- return (L = e[0].type) == null ? void 0 : L.includes(m);
71
- }))
72
- p("Berkas tidak didukung, silahkan pilih file kembali.");
73
- else if (y > C) {
74
- const m = `${e.length > 1 ? "Jumlah u" : "U"}kuran berkas tidak boleh melebihi ${C}MB.`;
75
- p(m);
65
+ const i = g.useRef(null), C = m || ["image/png", "image/jpeg", "image/jpg"], [o, v] = g.useState(""), [$, u] = g.useState(""), k = (e) => {
66
+ if (e?.length) {
67
+ const p = e[0], R = p.size / 1024 / 1024;
68
+ if (!C.some((f) => e[0].type?.includes(f)))
69
+ u("Berkas tidak didukung, silahkan pilih file kembali.");
70
+ else if (R > h) {
71
+ const f = `${e.length > 1 ? "Jumlah u" : "U"}kuran berkas tidak boleh melebihi ${h}MB.`;
72
+ u(f);
76
73
  } else {
77
- if (!(n != null && n.current)) return;
78
- p(""), i(g), v(URL.createObjectURL(g)), n.current.value = "";
74
+ if (!i?.current) return;
75
+ u(""), r(p), v(URL.createObjectURL(p)), i.current.value = "";
79
76
  }
80
77
  }
81
78
  }, D = (e) => {
82
79
  e.preventDefault(), k(e.dataTransfer.files);
83
- }, b = (e) => {
84
- e.preventDefault(), n != null && n.current && (typeof i == "function" && i(null), v(""), n.current.value = "");
80
+ }, N = (e) => {
81
+ e.preventDefault(), i?.current && (typeof r == "function" && r(null), v(""), i.current.value = "");
85
82
  };
86
- return /* @__PURE__ */ s("div", { className: `${t.container} ${j}`, children: [
87
- /* @__PURE__ */ r(
83
+ return /* @__PURE__ */ l("div", { className: `${n.container} ${M}`, children: [
84
+ /* @__PURE__ */ t(
88
85
  "input",
89
86
  {
90
- accept: a == null ? void 0 : a.join(", "),
91
- ref: n,
87
+ accept: C?.join(", "),
88
+ ref: i,
92
89
  hidden: !0,
93
90
  type: "file",
94
91
  multiple: !1,
@@ -97,66 +94,63 @@ const B = ({ className: i }) => /* @__PURE__ */ r(
97
94
  }
98
95
  }
99
96
  ),
100
- c || l ? /* @__PURE__ */ r(
97
+ o || a ? /* @__PURE__ */ t(
101
98
  "div",
102
99
  {
103
- id: `${o}-exist`,
104
- className: `${t["image-content"]} ${d}`,
100
+ id: `${s}-exist`,
101
+ className: `${n["image-content"]} ${d}`,
105
102
  onDrop: D,
106
103
  onDragOver: (e) => e.preventDefault(),
107
104
  onDragLeave: (e) => e.preventDefault(),
108
- children: /* @__PURE__ */ r("img", { src: c || l, alt: "upload-image", className: `${t.image} ${d}` })
105
+ children: /* @__PURE__ */ t("img", { src: o || a, alt: "upload-image", className: `${n.image} ${d}` })
109
106
  }
110
- ) : /* @__PURE__ */ s(
107
+ ) : /* @__PURE__ */ l(
111
108
  "div",
112
109
  {
113
- id: o,
114
- className: `${t["image-content"]} ${d}`,
110
+ id: s,
111
+ className: `${n["image-content"]} ${d}`,
115
112
  onDrop: D,
116
113
  onDragOver: (e) => e.preventDefault(),
117
114
  onDragLeave: (e) => e.preventDefault(),
118
115
  children: [
119
- M,
120
- /* @__PURE__ */ r("div", { className: t["text-desc"], children: typeof u == "function" ? u() : u })
116
+ w,
117
+ /* @__PURE__ */ t("div", { className: n["text-desc"], children: typeof c == "function" ? c() : c })
121
118
  ]
122
119
  }
123
120
  ),
124
- /* @__PURE__ */ s("div", { className: t["action-content"], children: [
125
- /* @__PURE__ */ s("div", { className: `${t["button-content"]} ${N}`, children: [
126
- (c || l) && /* @__PURE__ */ r(
127
- x,
121
+ /* @__PURE__ */ l("div", { className: n["action-content"], children: [
122
+ /* @__PURE__ */ l("div", { className: `${n["button-content"]} ${j}`, children: [
123
+ (o || a) && /* @__PURE__ */ t(
124
+ L,
128
125
  {
129
- id: `${o}-delete-img`,
126
+ id: `${s}-delete-img`,
130
127
  variants: "tertiary-red-600",
131
128
  size: "xs",
132
- startIcon: /* @__PURE__ */ r(B, {}),
133
- onClick: (e) => b(e),
129
+ startIcon: /* @__PURE__ */ t(b, {}),
130
+ onClick: (e) => N(e),
134
131
  children: "Hapus"
135
132
  }
136
133
  ),
137
- /* @__PURE__ */ s(
138
- x,
134
+ /* @__PURE__ */ l(
135
+ L,
139
136
  {
140
- id: `${o}-change-img`,
137
+ id: `${s}-change-img`,
141
138
  variants: "tertiary-blue-700",
142
139
  size: "xs",
143
- onClick: () => {
144
- var e;
145
- return (e = n.current) == null ? void 0 : e.click();
146
- },
147
- startIcon: /* @__PURE__ */ r(R, {}),
140
+ onClick: () => i.current?.click(),
141
+ startIcon: /* @__PURE__ */ t(y, {}),
148
142
  children: [
149
- c || l ? "Ganti" : "Pilih",
143
+ o || a ? "Ganti" : "Pilih",
150
144
  " Gambar"
151
145
  ]
152
146
  }
153
147
  )
154
148
  ] }),
155
- /* @__PURE__ */ r("p", { className: t["text-desc"], children: w }),
156
- $ && /* @__PURE__ */ r("p", { className: t["text-error"], children: $ })
149
+ /* @__PURE__ */ t("p", { className: n["text-desc"], children: x }),
150
+ $ && /* @__PURE__ */ t("p", { className: n["text-error"], children: $ })
157
151
  ] })
158
152
  ] });
159
153
  };
160
154
  export {
161
- O as default
155
+ z as default
162
156
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),y=require("react"),A=require("../Button/Button.cjs"),a=require("./UploadMultipleFile.module.scss.cjs"),I=require("../Input/InputNative.cjs"),b=require("../../utils/common.cjs"),J=({value:i,validateFile:m,classNameContainer:M,classNameButton:F,textUpload:q="Unggah Lampiran",buttonProps:$={},maxFile:d=1,maxSize:g=1,error:h,removeElement:r,onChange:j,handlerDownload:N,priorityError:B="external",eventError:o,locationRemoveElement:k="right",idItemAttachment:C})=>{const U={variants:"ghost-laba-blue-10",size:"small"},n=y.useRef(null),c=m||["image/png","image/jpeg","image/jpg"],[x,P]=y.useState(""),S={internal:x||h,external:h||x},_=e=>{if(e!=null&&e.length){const t=Array.from(e).slice(0,d),l=t==null?void 0:t.filter(p=>!c.includes(p.type)),z=(t==null?void 0:t.reduce((p,T)=>p+T.size,0))/1024/1024;let u="";if(l.length>0?u="Berkas tidak didukung, silahkan pilih file kembali.":z>g?u=`${e.length>1?"Jumlah u":"U"}kuran berkas tidak boleh melebihi ${g}MB.`:typeof j=="function"&&j(t),P(u),o==null||o(u),!(n!=null&&n.current))return;n.current.value=""}},f=e=>{var t;e.preventDefault(),n!=null&&n.current&&((t=n.current)==null||t.click())};return s.jsxs("div",{className:`${a.default.container} ${M??""}`,children:[s.jsx(A.default,{...U,...$,className:F??"",onClick:e=>f(e),children:q}),s.jsx(I.default,{accept:c==null?void 0:c.join(", "),ref:n,type:"file",onChange:e=>_(e.target.files),error:S[B],multiple:d>1,hidden:!0}),s.jsx("div",{className:a.default.files,children:i==null?void 0:i.map((e,t)=>s.jsxs("div",{id:`${C}-${t}`,className:a.default.file,onClick:l=>{l.stopPropagation(),typeof N=="function"&&N(e)},children:[typeof r=="function"&&k==="left"&&s.jsx(s.Fragment,{children:r(e,t)}),s.jsxs("div",{className:a.default["file-name-wrapper"],children:[s.jsx("span",{className:a.default["file-name"],children:b.parseFileName((e==null?void 0:e.originalName)??(e==null?void 0:e.name)??(e==null?void 0:e.fileName)??"").filename}),s.jsx("span",{className:a.default["file-extension"],children:b.parseFileName((e==null?void 0:e.originalName)??(e==null?void 0:e.name)??(e==null?void 0:e.fileName)??"").extension})]}),typeof r=="function"&&k==="right"&&s.jsx(s.Fragment,{children:r(e,t)})]},t))})]})};exports.default=J;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),N=require("react"),z=require("../Button/Button.cjs"),s=require("./UploadMultipleFile.module.scss.cjs"),T=require("../Input/InputNative.cjs"),k=require("../../utils/common.cjs"),A=({value:x,validateFile:u,classNameContainer:y,classNameButton:b,textUpload:M="Unggah Lampiran",buttonProps:F={},maxFile:o=1,maxSize:f=1,error:d,removeElement:n,onChange:p,handlerDownload:m,priorityError:q="external",eventError:v,locationRemoveElement:g="right",idItemAttachment:$})=>{const B={variants:"ghost-laba-blue-10",size:"small"},a=N.useRef(null),h=u||["image/png","image/jpeg","image/jpg"],[j,C]=N.useState(""),U={internal:j||d,external:d||j},P=e=>{if(e?.length){const i=Array.from(e).slice(0,o),r=i?.filter(c=>!h.includes(c.type)),S=i?.reduce((c,_)=>c+_.size,0)/1024/1024;let l="";if(r.length>0?l="Berkas tidak didukung, silahkan pilih file kembali.":S>f?l=`${e.length>1?"Jumlah u":"U"}kuran berkas tidak boleh melebihi ${f}MB.`:typeof p=="function"&&p(i),C(l),v?.(l),!a?.current)return;a.current.value=""}},R=e=>{e.preventDefault(),a?.current&&a.current?.click()};return t.jsxs("div",{className:`${s.default.container} ${y??""}`,children:[t.jsx(z.default,{...B,...F,className:b??"",onClick:e=>R(e),children:M}),t.jsx(T.default,{accept:h?.join(", "),ref:a,type:"file",onChange:e=>P(e.target.files),error:U[q],multiple:o>1,hidden:!0}),t.jsx("div",{className:s.default.files,children:x?.map((e,i)=>t.jsxs("div",{id:`${$}-${i}`,className:s.default.file,onClick:r=>{r.stopPropagation(),typeof m=="function"&&m(e)},children:[typeof n=="function"&&g==="left"&&t.jsx(t.Fragment,{children:n(e,i)}),t.jsxs("div",{className:s.default["file-name-wrapper"],children:[t.jsx("span",{className:s.default["file-name"],children:k.parseFileName(e?.originalName??e?.name??e?.fileName??"").filename}),t.jsx("span",{className:s.default["file-extension"],children:k.parseFileName(e?.originalName??e?.name??e?.fileName??"").extension})]}),typeof n=="function"&&g==="right"&&t.jsx(t.Fragment,{children:n(e,i)})]},i))})]})};exports.default=A;