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,150 +1,146 @@
1
- import { jsxs as ee, jsx as S } from "react/jsx-runtime";
2
- import t from "react";
3
- import te from "react-select";
4
- import oe from "../Popover/Popover.mjs";
5
- import ne from "./SelectDropdownContainer.module.scss.mjs";
6
- import { useDeepCompareEffect as re, useDeepCompareMemoize as ae } from "../../hooks/useDeepCompareEffect.mjs";
7
- import { configSelectDropdownContainer as p } from "./SelectDropdownContainer.config.mjs";
8
- const se = t.forwardRef(
9
- (C, R) => {
1
+ import { jsxs as _, jsx as w } from "react/jsx-runtime";
2
+ import e from "react";
3
+ import ee from "react-select";
4
+ import te from "../Popover/Popover.mjs";
5
+ import oe from "./SelectDropdownContainer.module.scss.mjs";
6
+ import { useDeepCompareEffect as ne, useDeepCompareMemoize as re } from "../../hooks/useDeepCompareEffect.mjs";
7
+ import { configSelectDropdownContainer as f } from "./SelectDropdownContainer.config.mjs";
8
+ const ae = e.forwardRef(
9
+ (S, O) => {
10
10
  const {
11
- width: d,
12
- children: g,
13
- components: I,
14
- classNameContainer: E = "",
15
- classNameContainerShowSelect: $ = "",
16
- classNameContainerSelect: D = "",
17
- classNameLabelError: x = "",
18
- error: z,
19
- onChange: v,
11
+ width: p,
12
+ children: R,
13
+ components: g,
14
+ classNameContainer: I = "",
15
+ classNameContainerShowSelect: E = "",
16
+ classNameContainerSelect: $ = "",
17
+ classNameLabelError: D = "",
18
+ error: x,
19
+ onChange: C,
20
20
  externalValue: l = !1,
21
- defaultValueButtonDropdown: r = {},
22
- autoClose: L = !0,
23
- onMenuOpen: M = () => {
21
+ defaultValueButtonDropdown: n = {},
22
+ autoClose: z = !0,
23
+ onMenuOpen: L = () => {
24
24
  },
25
- autoCloseOutside: b = !0,
26
- styleInnerPopper: W = {},
27
- onMenuClose: j = () => {
25
+ autoCloseOutside: M = !0,
26
+ styleInnerPopper: b = {},
27
+ onMenuClose: W = () => {
28
28
  },
29
- zIndexPopper: k = 0,
30
- id: F = "select-dropdown-container",
31
- idPopover: T = "select-dropdown-container-popover",
32
- useAutoPlacement: A,
33
- flipOptions: B,
34
- autoPlacementOptions: H,
35
- withSearch: q = !1,
36
- floatingOptions: G = {},
37
- offsetPopover: J = 5,
38
- selectProps: K = {},
39
- errorLabel: Q = "payhere",
40
- controlType: h = "payhere",
41
- actionValueChange: U = () => {
29
+ zIndexPopper: j = 0,
30
+ id: k = "select-dropdown-container",
31
+ idPopover: F = "select-dropdown-container-popover",
32
+ useAutoPlacement: T,
33
+ flipOptions: A,
34
+ autoPlacementOptions: B,
35
+ withSearch: H = !1,
36
+ floatingOptions: q = {},
37
+ offsetPopover: G = 5,
38
+ selectProps: J = {},
39
+ errorLabel: K = "payhere",
40
+ controlType: d = "payhere",
41
+ actionValueChange: Q = () => {
42
42
  },
43
- ...X
44
- } = C, a = t.useRef(null), s = t.useRef(null), [Y, P] = t.useState(""), [n, m] = t.useState(!1), [i, c] = t.useState({}), [V, y] = t.useState(0), w = (e) => {
45
- var o;
46
- (o = s.current) == null || o.setShow(e), m(e);
47
- }, Z = () => {
43
+ ...U
44
+ } = S, r = e.useRef(null), a = e.useRef(null), [X, v] = e.useState(""), [o, h] = e.useState(!1), [i, c] = e.useState({}), [P, V] = e.useState(0), m = (t) => {
45
+ a.current?.setShow(t), h(t);
46
+ }, Y = () => {
48
47
  if (l)
49
- return C.isMulti ? r : [r];
50
- }, N = (e) => {
51
- var o;
52
- (o = s.current) == null || o.handlerShow(e), y(a.current.offsetWidth), m((f) => !f);
53
- }, O = () => {
54
- var e;
55
- b && ((e = s.current) == null || e.setShow(!1));
56
- }, _ = (e, o) => {
57
- var f;
58
- L && (m(!1), (f = s.current) == null || f.setShow(!1)), typeof v == "function" && v(e, o), l || c(e);
48
+ return S.isMulti ? n : [n];
49
+ }, y = (t) => {
50
+ a.current?.handlerShow(t), V(r.current.offsetWidth), h((s) => !s);
51
+ }, N = () => {
52
+ M && a.current?.setShow(!1);
53
+ }, Z = (t, s) => {
54
+ z && (h(!1), a.current?.setShow(!1)), typeof C == "function" && C(t, s), l || c(t);
59
55
  }, u = () => {
60
- a.current && y(a.current.offsetWidth);
56
+ r.current && V(r.current.offsetWidth);
61
57
  };
62
- return re(() => {
63
- l && c(r), U(r);
64
- }, [l, r]), t.useEffect(() => {
65
- n ? M() : n || (j(), P(""));
66
- }, [n]), t.useImperativeHandle(
67
- R,
58
+ return ne(() => {
59
+ l && c(n), Q(n);
60
+ }, [l, n]), e.useEffect(() => {
61
+ o ? L() : o || (W(), v(""));
62
+ }, [o]), e.useImperativeHandle(
63
+ O,
68
64
  () => ({
69
65
  selectValue: i,
70
66
  setSelectValue: c,
71
- handlerClose: O,
72
- handlerShow: N,
73
- show: n,
74
- setShow: w
67
+ handlerClose: N,
68
+ handlerShow: y,
69
+ show: o,
70
+ setShow: m
75
71
  }),
76
- [n, ae(i)]
77
- ), t.useEffect(() => (window.addEventListener("resize", u), window.addEventListener("load", u), () => {
72
+ [o, re(i)]
73
+ ), e.useEffect(() => (window.addEventListener("resize", u), window.addEventListener("load", u), () => {
78
74
  window.removeEventListener("resize", u), window.removeEventListener("load", u);
79
- }), [a]), /* @__PURE__ */ ee(
75
+ }), [r]), /* @__PURE__ */ _(
80
76
  "div",
81
77
  {
82
- id: F,
83
- className: `${ne.container} ${E} ${n ? `${$} open-popover` : null}`,
84
- ref: a,
78
+ id: k,
79
+ className: `${oe.container} ${I} ${o ? `${E} open-popover` : null}`,
80
+ ref: r,
85
81
  children: [
86
- g({
82
+ R({
87
83
  selectValue: i,
88
84
  setSelectValue: c,
89
- handlerClose: O,
90
- handlerShow: N,
91
- show: n,
92
- setShow: w
85
+ handlerClose: N,
86
+ handlerShow: y,
87
+ show: o,
88
+ setShow: m
93
89
  }),
94
- /* @__PURE__ */ S(
95
- oe,
90
+ /* @__PURE__ */ w(
91
+ te,
96
92
  {
97
- ref: s,
98
- offset: J,
99
- useAutoPlacement: A,
100
- flipOptions: B,
101
- autoPlacementOptions: H,
102
- zIndex: k,
103
- styleInnerPopover: W,
104
- id: T,
105
- width: typeof d == "function" ? d(V, i) : d || V,
106
- className: `${D} ${p.classNamePopover[h]}`,
107
- floatingOptions: G,
108
- children: /* @__PURE__ */ S(
109
- te,
93
+ ref: a,
94
+ offset: G,
95
+ useAutoPlacement: T,
96
+ flipOptions: A,
97
+ autoPlacementOptions: B,
98
+ zIndex: j,
99
+ styleInnerPopover: b,
100
+ id: F,
101
+ width: typeof p == "function" ? p(P, i) : p || P,
102
+ className: `${$} ${f.classNamePopover[d]}`,
103
+ floatingOptions: q,
104
+ children: /* @__PURE__ */ w(
105
+ ee,
110
106
  {
111
107
  className: "iru-w-full",
112
- defaultValue: Z(),
113
- inputValue: Y,
114
- onInputChange: (e, { action: o }) => {
115
- o === "input-change" && P(e);
108
+ defaultValue: Y(),
109
+ inputValue: X,
110
+ onInputChange: (t, { action: s }) => {
111
+ s === "input-change" && v(t);
116
112
  },
117
113
  openMenuOnFocus: !0,
118
114
  autoFocus: !1,
119
115
  backspaceRemovesValue: !1,
120
116
  components: {
121
117
  IndicatorSeparator: null,
122
- ...I
118
+ ...g
123
119
  },
124
120
  controlShouldRenderValue: !1,
125
121
  hideSelectedOptions: !1,
126
122
  isClearable: !1,
127
123
  menuIsOpen: !0,
128
124
  tabSelectsValue: !1,
129
- styles: q ? p.variant[h] : p.noSearchVariant[h],
125
+ styles: H ? f.variant[d] : f.noSearchVariant[d],
130
126
  noOptionsMessage: () => "Tidak ada data.",
131
- onChange: _,
127
+ onChange: Z,
132
128
  selectProps: {
133
- ...K,
134
- setShowDropdown: w
129
+ ...J,
130
+ setShowDropdown: m
135
131
  },
136
- ...X
132
+ ...U
137
133
  }
138
134
  )
139
135
  }
140
136
  ),
141
- /* @__PURE__ */ S("div", { className: `${p.error[Q]} ${x}`, children: z })
137
+ /* @__PURE__ */ w("div", { className: `${f.error[K]} ${D}`, children: x })
142
138
  ]
143
139
  }
144
140
  );
145
141
  }
146
142
  );
147
- se.displayName = "SelectDropdownContainer";
143
+ ae.displayName = "SelectDropdownContainer";
148
144
  export {
149
- se as default
145
+ ae as default
150
146
  };
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react/jsx-runtime"),o=require("react"),s=require("./itemSidebar.module.scss.cjs"),r=require("./ItemSidebar.config.cjs"),H=({as:I,show:h,open:t,patch:j,iconSubs:d,variant:c="payhere-brand-base-white",setShow:f,onClickItems:x,propsLink:g,...e})=>{var p,E,M,O,A,V,q,F;let b=i.jsx(i.Fragment,{});const N=I??"div",[y,a]=o.useState(!1),l=j===e.slug,$=h.split("/"),n=$.includes(e.name),S=()=>{if(e.subs.length>0)if(n){const m=$.splice(0,$.indexOf(e.name));m.length>0?f(`${m.join("/")}/`):f("")}else f(`${h}${e.name}/`);else typeof x=="function"&&x(e)};return e.isShow?([1,3,5,6,7,8].includes(e.parent)&&(b=i.jsxs(i.Fragment,{children:[i.jsxs(N,{id:e.name,className:`${s.default["item-sidebar-1"]}
2
- ${(p=r.configItemSidebar.variant)==null?void 0:p[c]} ${(E=r.configItemSidebar.parent)==null?void 0:E[e.parent.toString()]}
3
- ${l||e.subs.length>0&&n?s.default.active:""} ${typeof t=="boolean"&&t?s.default["item-sidebar-open"]:""} ${typeof t=="boolean"&&!t?s.default["item-sidebar-close"]:""}
4
- `,onClick:S,onMouseOver:()=>a(!0),onMouseOut:()=>a(!1),...g?g(e.slug,e):{},children:[i.jsxs("div",{className:"iru-flex iru-items-center iru-gap-3 iru-relative",children:[o.isValidElement(e.svgIcon)&&i.jsx("div",{className:s.default["item-icon"],children:l||e.subs.length>0&&n?e==null?void 0:e.svgIconActive:y?(e==null?void 0:e.svgIconHover)||(e==null?void 0:e.svgIconActive):e==null?void 0:e.svgIcon}),i.jsx("div",{className:s.default["item-label"],children:e.label})]}),o.isValidElement(e.endIcon)&&i.jsx("div",{className:s.default["end-icon"],children:e==null?void 0:e.endIcon}),e.subs.length>0&&t&&i.jsxs("div",{className:`${s.default["item-icon-subs"]} ${n?s.default["item-icon-subs-active"]:""}`,id:`item-sidebar-subs-${e.name}-icon`,children:[o.isValidElement(d)&&d,typeof d=="function"&&d()]})]}),e.parent===3&&!e.subs.length&&i.jsx("div",{className:(M=r.configItemSidebar.divider)==null?void 0:M[c]})]})),(e.parent===2||e.parent===4)&&(b=i.jsxs(i.Fragment,{children:[i.jsxs(N,{id:e.name,className:`${s.default["item-sidebar-2"]}
5
- ${(O=r.configItemSidebar.variant)==null?void 0:O[c]} ${(A=r.configItemSidebar.parent)==null?void 0:A[e.parent.toString()]}
6
- ${l||e.subs.length>0&&n?s.default.active:""} ${typeof t=="boolean"&&t?s.default["item-sidebar-open"]:""} ${typeof t=="boolean"&&!t?s.default["item-sidebar-close"]:""}
7
- `,onClick:S,onMouseOver:()=>a(!0),onMouseOut:()=>a(!1),...g?g(e.slug,e):{},children:[o.isValidElement(e.svgIcon)&&i.jsx("div",{className:s.default["item-icon"],children:l||e.subs.length>0&&n?e==null?void 0:e.svgIconActive:y?(e==null?void 0:e.svgIconHover)||(e==null?void 0:e.svgIconActive):e==null?void 0:e.svgIcon}),i.jsx("div",{className:s.default["item-label"],children:e.label}),e.subs.length>0&&t&&i.jsxs("div",{className:`${s.default["item-icon-subs"]} ${n?s.default["item-icon-subs-active"]:""}`,id:`item-sidebar-subs-${e.name}-icon`,children:[o.isValidElement(d)&&d,typeof d=="function"&&d()]})]}),e.parent===4&&!e.subs.length&&i.jsx("div",{className:(V=r.configItemSidebar.divider)==null?void 0:V[c]})]})),e.subs.length>0?i.jsxs("div",{className:`${t||n?"":"-mt-2"}`,children:[b,i.jsx("div",{id:`item-sidebar-subs-${e.name}-${t&&n?"open":"close"}`,className:`${s.default["item-subs-sidebar"]}
8
- ${(q=r.configItemSidebar.variant)==null?void 0:q[c]} ${!t||!n?s.default.hidden:""}`,children:e.subs.map(m=>o.createElement(H,{...m,as:m.manualRoute?"div":m.subs.length>0?I:e.linkComponent,key:m.name,patch:j,iconSubs:d,show:h,open:t,variant:c,setShow:f}))}),[3,4].includes(e.parent)&&i.jsx("div",{className:(F=r.configItemSidebar.divider)==null?void 0:F[c]})]}):b):i.jsx(i.Fragment,{})};exports.default=H;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react/jsx-runtime"),m=require("react"),s=require("./itemSidebar.module.scss.cjs"),r=require("./ItemSidebar.config.cjs"),S=({as:I,show:h,open:t,patch:j,iconSubs:d,variant:c="payhere-brand-base-white",setShow:l,onClickItems:x,propsLink:o,...e})=>{let f=i.jsx(i.Fragment,{});const u=I??"div",[N,g]=m.useState(!1),b=j===e.slug,$=h.split("/"),n=$.includes(e.name),y=()=>{if(e.subs.length>0)if(n){const a=$.splice(0,$.indexOf(e.name));a.length>0?l(`${a.join("/")}/`):l("")}else l(`${h}${e.name}/`);else typeof x=="function"&&x(e)};return e.isShow?([1,3,5,6,7,8].includes(e.parent)&&(f=i.jsxs(i.Fragment,{children:[i.jsxs(u,{id:e.name,className:`${s.default["item-sidebar-1"]}
2
+ ${r.configItemSidebar.variant?.[c]} ${r.configItemSidebar.parent?.[e.parent.toString()]}
3
+ ${b||e.subs.length>0&&n?s.default.active:""} ${typeof t=="boolean"&&t?s.default["item-sidebar-open"]:""} ${typeof t=="boolean"&&!t?s.default["item-sidebar-close"]:""}
4
+ `,onClick:y,onMouseOver:()=>g(!0),onMouseOut:()=>g(!1),...o?o(e.slug,e):{},children:[i.jsxs("div",{className:"iru-flex iru-items-center iru-gap-3 iru-relative",children:[m.isValidElement(e.svgIcon)&&i.jsx("div",{className:s.default["item-icon"],children:b||e.subs.length>0&&n?e?.svgIconActive:N?e?.svgIconHover||e?.svgIconActive:e?.svgIcon}),i.jsx("div",{className:s.default["item-label"],children:e.label})]}),m.isValidElement(e.endIcon)&&i.jsx("div",{className:s.default["end-icon"],children:e?.endIcon}),e.subs.length>0&&t&&i.jsxs("div",{className:`${s.default["item-icon-subs"]} ${n?s.default["item-icon-subs-active"]:""}`,id:`item-sidebar-subs-${e.name}-icon`,children:[m.isValidElement(d)&&d,typeof d=="function"&&d()]})]}),e.parent===3&&!e.subs.length&&i.jsx("div",{className:r.configItemSidebar.divider?.[c]})]})),(e.parent===2||e.parent===4)&&(f=i.jsxs(i.Fragment,{children:[i.jsxs(u,{id:e.name,className:`${s.default["item-sidebar-2"]}
5
+ ${r.configItemSidebar.variant?.[c]} ${r.configItemSidebar.parent?.[e.parent.toString()]}
6
+ ${b||e.subs.length>0&&n?s.default.active:""} ${typeof t=="boolean"&&t?s.default["item-sidebar-open"]:""} ${typeof t=="boolean"&&!t?s.default["item-sidebar-close"]:""}
7
+ `,onClick:y,onMouseOver:()=>g(!0),onMouseOut:()=>g(!1),...o?o(e.slug,e):{},children:[m.isValidElement(e.svgIcon)&&i.jsx("div",{className:s.default["item-icon"],children:b||e.subs.length>0&&n?e?.svgIconActive:N?e?.svgIconHover||e?.svgIconActive:e?.svgIcon}),i.jsx("div",{className:s.default["item-label"],children:e.label}),e.subs.length>0&&t&&i.jsxs("div",{className:`${s.default["item-icon-subs"]} ${n?s.default["item-icon-subs-active"]:""}`,id:`item-sidebar-subs-${e.name}-icon`,children:[m.isValidElement(d)&&d,typeof d=="function"&&d()]})]}),e.parent===4&&!e.subs.length&&i.jsx("div",{className:r.configItemSidebar.divider?.[c]})]})),e.subs.length>0?i.jsxs("div",{className:`${t||n?"":"-mt-2"}`,children:[f,i.jsx("div",{id:`item-sidebar-subs-${e.name}-${t&&n?"open":"close"}`,className:`${s.default["item-subs-sidebar"]}
8
+ ${r.configItemSidebar.variant?.[c]} ${!t||!n?s.default.hidden:""}`,children:e.subs.map(a=>m.createElement(S,{...a,as:a.manualRoute?"div":a.subs.length>0?I:e.linkComponent,key:a.name,patch:j,iconSubs:d,show:h,open:t,variant:c,setShow:l}))}),[3,4].includes(e.parent)&&i.jsx("div",{className:r.configItemSidebar.divider?.[c]})]}):f):i.jsx(i.Fragment,{})};exports.default=S;
@@ -1,56 +1,55 @@
1
- import { jsx as n, Fragment as N, jsxs as c } from "react/jsx-runtime";
2
- import { useState as l, isValidElement as b, createElement as q } from "react";
3
- import s from "./itemSidebar.module.scss.mjs";
1
+ import { jsx as t, Fragment as $, jsxs as c } from "react/jsx-runtime";
2
+ import { useState as M, isValidElement as a, createElement as j } from "react";
3
+ import i from "./itemSidebar.module.scss.mjs";
4
4
  import { configItemSidebar as d } from "./ItemSidebar.config.mjs";
5
- const w = ({
6
- as: x,
7
- show: p,
8
- open: t,
9
- patch: A,
5
+ const C = ({
6
+ as: p,
7
+ show: I,
8
+ open: s,
9
+ patch: y,
10
10
  iconSubs: r,
11
11
  variant: m = "payhere-brand-base-white",
12
- setShow: g,
13
- onClickItems: O,
14
- propsLink: f,
15
- ...i
12
+ setShow: l,
13
+ onClickItems: x,
14
+ propsLink: b,
15
+ ...e
16
16
  }) => {
17
- var C, a, E, k, F, R, T, V;
18
- let h = /* @__PURE__ */ n(N, {});
19
- const H = x ?? "div", [M, $] = l(!1), I = A === i.slug, y = p.split("/"), e = y.includes(i.name), j = () => {
20
- if (i.subs.length > 0)
21
- if (e) {
22
- const o = y.splice(0, y.indexOf(i.name));
23
- o.length > 0 ? g(`${o.join("/")}/`) : g("");
17
+ let g = /* @__PURE__ */ t($, {});
18
+ const A = p ?? "div", [O, f] = M(!1), h = y === e.slug, N = I.split("/"), n = N.includes(e.name), H = () => {
19
+ if (e.subs.length > 0)
20
+ if (n) {
21
+ const o = N.splice(0, N.indexOf(e.name));
22
+ o.length > 0 ? l(`${o.join("/")}/`) : l("");
24
23
  } else
25
- g(`${p}${i.name}/`);
26
- else typeof O == "function" && O(i);
24
+ l(`${I}${e.name}/`);
25
+ else typeof x == "function" && x(e);
27
26
  };
28
- return i.isShow ? ([1, 3, 5, 6, 7, 8].includes(i.parent) && (h = /* @__PURE__ */ c(N, { children: [
27
+ return e.isShow ? ([1, 3, 5, 6, 7, 8].includes(e.parent) && (g = /* @__PURE__ */ c($, { children: [
29
28
  /* @__PURE__ */ c(
30
- H,
29
+ A,
31
30
  {
32
- id: i.name,
33
- className: `${s["item-sidebar-1"]}
34
- ${(C = d.variant) == null ? void 0 : C[m]} ${(a = d.parent) == null ? void 0 : a[i.parent.toString()]}
35
- ${I || i.subs.length > 0 && e ? s.active : ""} ${typeof t == "boolean" && t ? s["item-sidebar-open"] : ""} ${typeof t == "boolean" && !t ? s["item-sidebar-close"] : ""}
31
+ id: e.name,
32
+ className: `${i["item-sidebar-1"]}
33
+ ${d.variant?.[m]} ${d.parent?.[e.parent.toString()]}
34
+ ${h || e.subs.length > 0 && n ? i.active : ""} ${typeof s == "boolean" && s ? i["item-sidebar-open"] : ""} ${typeof s == "boolean" && !s ? i["item-sidebar-close"] : ""}
36
35
  `,
37
- onClick: j,
38
- onMouseOver: () => $(!0),
39
- onMouseOut: () => $(!1),
40
- ...f ? f(i.slug, i) : {},
36
+ onClick: H,
37
+ onMouseOver: () => f(!0),
38
+ onMouseOut: () => f(!1),
39
+ ...b ? b(e.slug, e) : {},
41
40
  children: [
42
41
  /* @__PURE__ */ c("div", { className: "iru-flex iru-items-center iru-gap-3 iru-relative", children: [
43
- b(i.svgIcon) && /* @__PURE__ */ n("div", { className: s["item-icon"], children: I || i.subs.length > 0 && e ? i == null ? void 0 : i.svgIconActive : M ? (i == null ? void 0 : i.svgIconHover) || (i == null ? void 0 : i.svgIconActive) : i == null ? void 0 : i.svgIcon }),
44
- /* @__PURE__ */ n("div", { className: s["item-label"], children: i.label })
42
+ a(e.svgIcon) && /* @__PURE__ */ t("div", { className: i["item-icon"], children: h || e.subs.length > 0 && n ? e?.svgIconActive : O ? e?.svgIconHover || e?.svgIconActive : e?.svgIcon }),
43
+ /* @__PURE__ */ t("div", { className: i["item-label"], children: e.label })
45
44
  ] }),
46
- b(i.endIcon) && /* @__PURE__ */ n("div", { className: s["end-icon"], children: i == null ? void 0 : i.endIcon }),
47
- i.subs.length > 0 && t && /* @__PURE__ */ c(
45
+ a(e.endIcon) && /* @__PURE__ */ t("div", { className: i["end-icon"], children: e?.endIcon }),
46
+ e.subs.length > 0 && s && /* @__PURE__ */ c(
48
47
  "div",
49
48
  {
50
- className: `${s["item-icon-subs"]} ${e ? s["item-icon-subs-active"] : ""}`,
51
- id: `item-sidebar-subs-${i.name}-icon`,
49
+ className: `${i["item-icon-subs"]} ${n ? i["item-icon-subs-active"] : ""}`,
50
+ id: `item-sidebar-subs-${e.name}-icon`,
52
51
  children: [
53
- b(r) && r,
52
+ a(r) && r,
54
53
  typeof r == "function" && r()
55
54
  ]
56
55
  }
@@ -58,30 +57,30 @@ const w = ({
58
57
  ]
59
58
  }
60
59
  ),
61
- i.parent === 3 && !i.subs.length && /* @__PURE__ */ n("div", { className: (E = d.divider) == null ? void 0 : E[m] })
62
- ] })), (i.parent === 2 || i.parent === 4) && (h = /* @__PURE__ */ c(N, { children: [
60
+ e.parent === 3 && !e.subs.length && /* @__PURE__ */ t("div", { className: d.divider?.[m] })
61
+ ] })), (e.parent === 2 || e.parent === 4) && (g = /* @__PURE__ */ c($, { children: [
63
62
  /* @__PURE__ */ c(
64
- H,
63
+ A,
65
64
  {
66
- id: i.name,
67
- className: `${s["item-sidebar-2"]}
68
- ${(k = d.variant) == null ? void 0 : k[m]} ${(F = d.parent) == null ? void 0 : F[i.parent.toString()]}
69
- ${I || i.subs.length > 0 && e ? s.active : ""} ${typeof t == "boolean" && t ? s["item-sidebar-open"] : ""} ${typeof t == "boolean" && !t ? s["item-sidebar-close"] : ""}
65
+ id: e.name,
66
+ className: `${i["item-sidebar-2"]}
67
+ ${d.variant?.[m]} ${d.parent?.[e.parent.toString()]}
68
+ ${h || e.subs.length > 0 && n ? i.active : ""} ${typeof s == "boolean" && s ? i["item-sidebar-open"] : ""} ${typeof s == "boolean" && !s ? i["item-sidebar-close"] : ""}
70
69
  `,
71
- onClick: j,
72
- onMouseOver: () => $(!0),
73
- onMouseOut: () => $(!1),
74
- ...f ? f(i.slug, i) : {},
70
+ onClick: H,
71
+ onMouseOver: () => f(!0),
72
+ onMouseOut: () => f(!1),
73
+ ...b ? b(e.slug, e) : {},
75
74
  children: [
76
- b(i.svgIcon) && /* @__PURE__ */ n("div", { className: s["item-icon"], children: I || i.subs.length > 0 && e ? i == null ? void 0 : i.svgIconActive : M ? (i == null ? void 0 : i.svgIconHover) || (i == null ? void 0 : i.svgIconActive) : i == null ? void 0 : i.svgIcon }),
77
- /* @__PURE__ */ n("div", { className: s["item-label"], children: i.label }),
78
- i.subs.length > 0 && t && /* @__PURE__ */ c(
75
+ a(e.svgIcon) && /* @__PURE__ */ t("div", { className: i["item-icon"], children: h || e.subs.length > 0 && n ? e?.svgIconActive : O ? e?.svgIconHover || e?.svgIconActive : e?.svgIcon }),
76
+ /* @__PURE__ */ t("div", { className: i["item-label"], children: e.label }),
77
+ e.subs.length > 0 && s && /* @__PURE__ */ c(
79
78
  "div",
80
79
  {
81
- className: `${s["item-icon-subs"]} ${e ? s["item-icon-subs-active"] : ""}`,
82
- id: `item-sidebar-subs-${i.name}-icon`,
80
+ className: `${i["item-icon-subs"]} ${n ? i["item-icon-subs-active"] : ""}`,
81
+ id: `item-sidebar-subs-${e.name}-icon`,
83
82
  children: [
84
- b(r) && r,
83
+ a(r) && r,
85
84
  typeof r == "function" && r()
86
85
  ]
87
86
  }
@@ -89,34 +88,34 @@ const w = ({
89
88
  ]
90
89
  }
91
90
  ),
92
- i.parent === 4 && !i.subs.length && /* @__PURE__ */ n("div", { className: (R = d.divider) == null ? void 0 : R[m] })
93
- ] })), i.subs.length > 0 ? /* @__PURE__ */ c("div", { className: `${t || e ? "" : "-mt-2"}`, children: [
94
- h,
95
- /* @__PURE__ */ n(
91
+ e.parent === 4 && !e.subs.length && /* @__PURE__ */ t("div", { className: d.divider?.[m] })
92
+ ] })), e.subs.length > 0 ? /* @__PURE__ */ c("div", { className: `${s || n ? "" : "-mt-2"}`, children: [
93
+ g,
94
+ /* @__PURE__ */ t(
96
95
  "div",
97
96
  {
98
- id: `item-sidebar-subs-${i.name}-${t && e ? "open" : "close"}`,
99
- className: `${s["item-subs-sidebar"]}
100
- ${(T = d.variant) == null ? void 0 : T[m]} ${!t || !e ? s.hidden : ""}`,
101
- children: i.subs.map((o) => /* @__PURE__ */ q(
102
- w,
97
+ id: `item-sidebar-subs-${e.name}-${s && n ? "open" : "close"}`,
98
+ className: `${i["item-subs-sidebar"]}
99
+ ${d.variant?.[m]} ${!s || !n ? i.hidden : ""}`,
100
+ children: e.subs.map((o) => /* @__PURE__ */ j(
101
+ C,
103
102
  {
104
103
  ...o,
105
- as: o.manualRoute ? "div" : o.subs.length > 0 ? x : i.linkComponent,
104
+ as: o.manualRoute ? "div" : o.subs.length > 0 ? p : e.linkComponent,
106
105
  key: o.name,
107
- patch: A,
106
+ patch: y,
108
107
  iconSubs: r,
109
- show: p,
110
- open: t,
108
+ show: I,
109
+ open: s,
111
110
  variant: m,
112
- setShow: g
111
+ setShow: l
113
112
  }
114
113
  ))
115
114
  }
116
115
  ),
117
- [3, 4].includes(i.parent) && /* @__PURE__ */ n("div", { className: (V = d.divider) == null ? void 0 : V[m] })
118
- ] }) : h) : /* @__PURE__ */ n(N, {});
116
+ [3, 4].includes(e.parent) && /* @__PURE__ */ t("div", { className: d.divider?.[m] })
117
+ ] }) : g) : /* @__PURE__ */ t($, {});
119
118
  };
120
119
  export {
121
- w as default
120
+ C as default
122
121
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),e=require("react"),a=require("./Sidebar.module.scss.cjs"),A=require("./ItemSidebar.cjs"),W=require("../../config/tailwind/nativeScreen.cjs"),v=require("./Sidebar.config.cjs"),k=e.forwardRef((q,O)=>{var I;const{as:w,children:C,patch:d="/",iconCompany:r,iconSubs:$,iconCollapse:m,iconCollapseClose:g,modules:V,toleranceWidthIconCompany:L=25,onClickItems:M,variant:c="payhere-brand-base-white",footer:o,withInheritance:j,id:p="1ru-sidebar",styleSidebar:_,styleContent:z,...F}=q,T=e.useRef(null),[i,l]=e.useState(null),[s,f]=e.useState(null),[B,x]=e.useState(""),[E,h]=e.useState(),[N,P]=e.useState(0),b=()=>{var R;let n=0;const S=document.getElementById("icon-company-sidebar");(R=S==null?void 0:S.childNodes)==null||R.forEach(H=>{n+=H.getBoundingClientRect().width??0}),h(n+L+"px")},y=()=>{P(window.innerWidth)},u=()=>{l(!s),s?h("auto"):setTimeout(()=>{b()},100)};return e.useEffect(()=>{N>=(v.configSidebar.mobileSupport.includes(c)?W.default.lg:W.default.md)?(l(!0),setTimeout(()=>{b()},100)):(l(!1),h("auto"))},[N]),e.useEffect(()=>{typeof i=="boolean"&&f(i)},[i]),e.useImperativeHandle(O,()=>({openSidebar:i,setOpenSidebar:l,handlerClickCollapse:u}),[i,s]),e.useEffect(()=>(d&&d.split("/").length>1&&x(d+"/"),b(),y(),window.addEventListener("resize",y),()=>window.removeEventListener("resize",y)),[]),t.jsxs("div",{className:v.configSidebar.variants[c],...F,ref:T,children:[t.jsxs("div",{id:p,className:`${a.default.sidebar} ${typeof s=="boolean"&&s?a.default["sidebar-open"]:""} ${typeof s=="boolean"&&!s?a.default["sidebar-close"]:""}`,style:_||{},children:[e.isValidElement(m)&&t.jsxs("div",{className:a.default["button-collaps-sidebar"],id:`${p}-${i?"close-collapse":"open-collapse"}`,onClick:u,children:[i&&m,i?"":e.isValidElement(g)?g:m]}),t.jsx("div",{className:a.default["container-icon-company-sidebar"],children:t.jsxs("div",{id:"icon-company-sidebar",className:a.default["icon-company-sidebar"],style:{width:E&&v.configSidebar.withCuctomWidthIconCompany.includes(c)?E:"100%"},children:[e.isValidElement(r)&&r,typeof r=="function"&&r({openSidebar:s,setOpenSidebar:l})]})}),t.jsx("div",{className:a.default["menu-sidebar"],onMouseOver:()=>{i||f(!0)},onMouseOut:()=>{i||f(!1)},children:V.map(n=>e.createElement(A.default,{...n,as:n.manualRoute||n.subs.length>0?"div":w,linkComponent:w,key:n.name,show:B,open:s,patch:d,iconSubs:$,variant:c,setShow:x,onClickItems:M}))}),o&&t.jsxs("div",{className:s?"iru-opacity-[1]":"iru-opacity-0",children:[e.isValidElement(o)&&t.jsx("div",{children:o}),typeof o=="function"&&t.jsx("div",{children:o()})]})]}),i&&t.jsx("div",{id:`${p}-splace-screen`,className:a.default["splace-screen"],onClick:u}),t.jsxs("div",{className:a.default["content-sidebar"],style:z||{},children:[j&&((I=e.Children)==null?void 0:I.map(C,n=>t.jsx(t.Fragment,{children:e.isValidElement(n)&&t.jsx(t.Fragment,{children:e.cloneElement(n,{openSidebar:i,handlerClickCollapse:u})})}))),!j&&t.jsx(t.Fragment,{children:C})]})]})});k.displayName="Sidebar";exports.default=k;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),e=require("react"),a=require("./Sidebar.module.scss.cjs"),B=require("./ItemSidebar.cjs"),N=require("../../config/tailwind/nativeScreen.cjs"),S=require("./Sidebar.config.cjs"),I=e.forwardRef((R,W)=>{const{as:C,children:v,patch:d="/",iconCompany:c,iconSubs:k,iconCollapse:m,iconCollapseClose:w,modules:q,toleranceWidthIconCompany:O=25,onClickItems:$,variant:r="payhere-brand-base-white",footer:o,withInheritance:g,id:p="1ru-sidebar",styleSidebar:V,styleContent:L,...M}=R,_=e.useRef(null),[n,l]=e.useState(null),[i,f]=e.useState(null),[z,j]=e.useState(""),[x,h]=e.useState(),[E,F]=e.useState(0),b=()=>{let s=0;document.getElementById("icon-company-sidebar")?.childNodes?.forEach(T=>{s+=T.getBoundingClientRect().width??0}),h(s+O+"px")},y=()=>{F(window.innerWidth)},u=()=>{l(!i),i?h("auto"):setTimeout(()=>{b()},100)};return e.useEffect(()=>{E>=(S.configSidebar.mobileSupport.includes(r)?N.default.lg:N.default.md)?(l(!0),setTimeout(()=>{b()},100)):(l(!1),h("auto"))},[E]),e.useEffect(()=>{typeof n=="boolean"&&f(n)},[n]),e.useImperativeHandle(W,()=>({openSidebar:n,setOpenSidebar:l,handlerClickCollapse:u}),[n,i]),e.useEffect(()=>(d&&d.split("/").length>1&&j(d+"/"),b(),y(),window.addEventListener("resize",y),()=>window.removeEventListener("resize",y)),[]),t.jsxs("div",{className:S.configSidebar.variants[r],...M,ref:_,children:[t.jsxs("div",{id:p,className:`${a.default.sidebar} ${typeof i=="boolean"&&i?a.default["sidebar-open"]:""} ${typeof i=="boolean"&&!i?a.default["sidebar-close"]:""}`,style:V||{},children:[e.isValidElement(m)&&t.jsxs("div",{className:a.default["button-collaps-sidebar"],id:`${p}-${n?"close-collapse":"open-collapse"}`,onClick:u,children:[n&&m,n?"":e.isValidElement(w)?w:m]}),t.jsx("div",{className:a.default["container-icon-company-sidebar"],children:t.jsxs("div",{id:"icon-company-sidebar",className:a.default["icon-company-sidebar"],style:{width:x&&S.configSidebar.withCuctomWidthIconCompany.includes(r)?x:"100%"},children:[e.isValidElement(c)&&c,typeof c=="function"&&c({openSidebar:i,setOpenSidebar:l})]})}),t.jsx("div",{className:a.default["menu-sidebar"],onMouseOver:()=>{n||f(!0)},onMouseOut:()=>{n||f(!1)},children:q.map(s=>e.createElement(B.default,{...s,as:s.manualRoute||s.subs.length>0?"div":C,linkComponent:C,key:s.name,show:z,open:i,patch:d,iconSubs:k,variant:r,setShow:j,onClickItems:$}))}),o&&t.jsxs("div",{className:i?"iru-opacity-[1]":"iru-opacity-0",children:[e.isValidElement(o)&&t.jsx("div",{children:o}),typeof o=="function"&&t.jsx("div",{children:o()})]})]}),n&&t.jsx("div",{id:`${p}-splace-screen`,className:a.default["splace-screen"],onClick:u}),t.jsxs("div",{className:a.default["content-sidebar"],style:L||{},children:[g&&e.Children?.map(v,s=>t.jsx(t.Fragment,{children:e.isValidElement(s)&&t.jsx(t.Fragment,{children:e.cloneElement(s,{openSidebar:n,handlerClickCollapse:u})})})),!g&&t.jsx(t.Fragment,{children:v})]})]})});I.displayName="Sidebar";exports.default=I;