1mpacto-react-ui 2.0.20 → 2.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/_mixins.scss +72 -72
- package/dist/assets/icons/arrow-narrow-down.svg +3 -3
- package/dist/assets/style.css +1 -1
- package/dist/components/Alert/index.cjs +1 -1
- package/dist/components/Alert/index.mjs +40 -40
- package/dist/components/Breadcrumbs/Breadcrumbs.cjs +3 -3
- package/dist/components/Breadcrumbs/Breadcrumbs.mjs +43 -43
- package/dist/components/Button/Button.cjs +12 -12
- package/dist/components/Button/Button.config.cjs +1 -1
- package/dist/components/Button/Button.config.mjs +3 -1
- package/dist/components/Button/Button.mjs +24 -24
- package/dist/components/Button/style.module.scss.cjs +1 -1
- package/dist/components/Button/style.module.scss.mjs +57 -55
- package/dist/components/ButtonIcon/ButtonIcon.cjs +12 -12
- package/dist/components/ButtonIcon/ButtonIcon.mjs +20 -20
- package/dist/components/ButtonPopover/ButtonPopover.cjs +1 -1
- package/dist/components/ButtonPopover/ButtonPopover.mjs +28 -31
- package/dist/components/Calendar/Calendar.cjs +1 -1
- package/dist/components/Calendar/Calendar.mjs +98 -100
- package/dist/components/Calendar/CalendarMonth.cjs +1 -1
- package/dist/components/Calendar/CalendarMonth.mjs +41 -42
- package/dist/components/Calendar/CalendarRange.cjs +1 -1
- package/dist/components/Calendar/CalendarRange.mjs +59 -61
- package/dist/components/Calendar/CalendarYear.cjs +3 -3
- package/dist/components/Calendar/CalendarYear.mjs +39 -40
- package/dist/components/Chart/DoughnutChart.cjs +1 -1
- package/dist/components/Chart/DoughnutChart.mjs +93 -96
- package/dist/components/Chart/GradientBarChart.cjs +1 -1
- package/dist/components/Chart/GradientBarChart.mjs +80 -81
- package/dist/components/Chart/GradientLineChart.cjs +1 -1
- package/dist/components/Chart/GradientLineChart.mjs +50 -51
- package/dist/components/Chart/LineChart.cjs +1 -1
- package/dist/components/Chart/LineChart.mjs +23 -23
- package/dist/components/Chart/PieChart.cjs +1 -1
- package/dist/components/Chart/PieChart.mjs +45 -48
- package/dist/components/Collapse/Collapse.cjs +1 -1
- package/dist/components/Collapse/Collapse.mjs +23 -24
- package/dist/components/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/DatePicker/DatePicker.mjs +86 -89
- package/dist/components/DatePicker/DateRangePicker.cjs +1 -1
- package/dist/components/DatePicker/DateRangePicker.mjs +91 -92
- package/dist/components/DatePicker/FilterDate.cjs +1 -1
- package/dist/components/DatePicker/FilterDate.mjs +107 -110
- package/dist/components/DatePicker/MonthYearPicker.cjs +1 -1
- package/dist/components/DatePicker/MonthYearPicker.mjs +51 -53
- package/dist/components/FilterContainer/FilterContainer.cjs +1 -1
- package/dist/components/FilterContainer/FilterContainer.mjs +27 -27
- package/dist/components/Input/InputFloatingInner.cjs +5 -5
- package/dist/components/Input/InputFloatingInner.mjs +24 -25
- package/dist/components/NumberFormat/NumberFormat.cjs +1 -1
- package/dist/components/NumberFormat/NumberFormat.mjs +12 -13
- package/dist/components/Pagination/Pagination.cjs +2 -2
- package/dist/components/Pagination/Pagination.mjs +76 -80
- package/dist/components/SelectDropdownContainer/SelectDropdownContainer.cjs +1 -1
- package/dist/components/SelectDropdownContainer/SelectDropdownContainer.mjs +98 -102
- package/dist/components/Sidebar/ItemSidebar.cjs +8 -8
- package/dist/components/Sidebar/ItemSidebar.mjs +71 -72
- package/dist/components/Sidebar/Sidebar.cjs +1 -1
- package/dist/components/Sidebar/Sidebar.mjs +65 -68
- package/dist/components/Slider/Slider.cjs +1 -0
- package/dist/components/Slider/Slider.mjs +61 -0
- package/dist/components/Slider/style.module.scss.cjs +1 -0
- package/dist/components/Slider/style.module.scss.mjs +14 -0
- package/dist/components/Step/Step.cjs +5 -5
- package/dist/components/Step/Step.mjs +52 -52
- package/dist/components/Table/Table.cjs +3 -3
- package/dist/components/Table/Table.mjs +275 -298
- package/dist/components/Table/TableSubMobile.cjs +1 -1
- package/dist/components/Table/TableSubMobile.mjs +32 -35
- package/dist/components/Tabs/Tabs.cjs +8 -8
- package/dist/components/Tabs/Tabs.mjs +66 -70
- package/dist/components/Textarea/Textarea.cjs +7 -7
- package/dist/components/Textarea/Textarea.mjs +47 -50
- package/dist/components/Textarea/TextareaFloatingInner.cjs +6 -6
- package/dist/components/Textarea/TextareaFloatingInner.mjs +56 -61
- package/dist/components/Textarea/TextareaInnerLabel.cjs +6 -6
- package/dist/components/Textarea/TextareaInnerLabel.mjs +47 -50
- package/dist/components/TimeRange/TimeRange.cjs +1 -1
- package/dist/components/TimeRange/TimeRange.mjs +88 -91
- package/dist/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/components/Tooltip/Tooltip.mjs +44 -46
- package/dist/components/Upload/UploadFile.cjs +1 -1
- package/dist/components/Upload/UploadFile.mjs +50 -54
- package/dist/components/Upload/UploadImage.cjs +12 -12
- package/dist/components/Upload/UploadImage.mjs +73 -79
- package/dist/components/Upload/UploadMultipleFile.cjs +1 -1
- package/dist/components/Upload/UploadMultipleFile.mjs +61 -62
- package/dist/components/Virtualization/ListVirtualization.cjs +1 -1
- package/dist/components/Virtualization/ListVirtualization.mjs +52 -55
- package/dist/components/Virtualization/TableVirtualization.cjs +1 -1
- package/dist/components/Virtualization/TableVirtualization.mjs +56 -59
- package/dist/config/components/tinymce.cjs +2 -2
- package/dist/config/components/tinymce.mjs +3 -3
- package/dist/hooks/useCountdown.cjs +1 -1
- package/dist/hooks/useCountdown.mjs +15 -15
- package/dist/hooks/useDebounce.cjs +1 -1
- package/dist/hooks/useDebounce.mjs +19 -19
- package/dist/hooks/useOtpInput.cjs +1 -1
- package/dist/hooks/useOtpInput.mjs +47 -51
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +48 -46
- package/dist/package.json.cjs +1 -1
- package/dist/package.json.d.ts +129 -128
- package/dist/package.json.mjs +1 -1
- package/dist/src/components/Button/Button.config.d.ts +2 -0
- package/dist/src/components/Slider/Slider.d.ts +3 -0
- package/dist/src/components/Slider/Slider.stories.d.ts +6 -0
- package/dist/src/components/index.d.ts +4 -2
- package/dist/src/interfaces/components/Button/index.d.ts +1 -1
- package/dist/src/interfaces/components/Slider/index.d.ts +51 -0
- package/dist/types-external/table.d.ts +15 -15
- package/dist/utils/common.cjs +1 -1
- package/dist/utils/common.mjs +172 -173
- package/package.json +128 -128
|
@@ -1,150 +1,146 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { useDeepCompareEffect as
|
|
7
|
-
import { configSelectDropdownContainer as
|
|
8
|
-
const
|
|
9
|
-
(
|
|
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:
|
|
12
|
-
children:
|
|
13
|
-
components:
|
|
14
|
-
classNameContainer:
|
|
15
|
-
classNameContainerShowSelect:
|
|
16
|
-
classNameContainerSelect:
|
|
17
|
-
classNameLabelError:
|
|
18
|
-
error:
|
|
19
|
-
onChange:
|
|
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:
|
|
22
|
-
autoClose:
|
|
23
|
-
onMenuOpen:
|
|
21
|
+
defaultValueButtonDropdown: n = {},
|
|
22
|
+
autoClose: z = !0,
|
|
23
|
+
onMenuOpen: L = () => {
|
|
24
24
|
},
|
|
25
|
-
autoCloseOutside:
|
|
26
|
-
styleInnerPopper:
|
|
27
|
-
onMenuClose:
|
|
25
|
+
autoCloseOutside: M = !0,
|
|
26
|
+
styleInnerPopper: b = {},
|
|
27
|
+
onMenuClose: W = () => {
|
|
28
28
|
},
|
|
29
|
-
zIndexPopper:
|
|
30
|
-
id:
|
|
31
|
-
idPopover:
|
|
32
|
-
useAutoPlacement:
|
|
33
|
-
flipOptions:
|
|
34
|
-
autoPlacementOptions:
|
|
35
|
-
withSearch:
|
|
36
|
-
floatingOptions:
|
|
37
|
-
offsetPopover:
|
|
38
|
-
selectProps:
|
|
39
|
-
errorLabel:
|
|
40
|
-
controlType:
|
|
41
|
-
actionValueChange:
|
|
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
|
-
...
|
|
44
|
-
} =
|
|
45
|
-
|
|
46
|
-
|
|
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
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
|
|
56
|
+
r.current && V(r.current.offsetWidth);
|
|
61
57
|
};
|
|
62
|
-
return
|
|
63
|
-
l && c(
|
|
64
|
-
}, [l,
|
|
65
|
-
|
|
66
|
-
}, [
|
|
67
|
-
|
|
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:
|
|
72
|
-
handlerShow:
|
|
73
|
-
show:
|
|
74
|
-
setShow:
|
|
67
|
+
handlerClose: N,
|
|
68
|
+
handlerShow: y,
|
|
69
|
+
show: o,
|
|
70
|
+
setShow: m
|
|
75
71
|
}),
|
|
76
|
-
[
|
|
77
|
-
),
|
|
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
|
-
}), [
|
|
75
|
+
}), [r]), /* @__PURE__ */ _(
|
|
80
76
|
"div",
|
|
81
77
|
{
|
|
82
|
-
id:
|
|
83
|
-
className: `${
|
|
84
|
-
ref:
|
|
78
|
+
id: k,
|
|
79
|
+
className: `${oe.container} ${I} ${o ? `${E} open-popover` : null}`,
|
|
80
|
+
ref: r,
|
|
85
81
|
children: [
|
|
86
|
-
|
|
82
|
+
R({
|
|
87
83
|
selectValue: i,
|
|
88
84
|
setSelectValue: c,
|
|
89
|
-
handlerClose:
|
|
90
|
-
handlerShow:
|
|
91
|
-
show:
|
|
92
|
-
setShow:
|
|
85
|
+
handlerClose: N,
|
|
86
|
+
handlerShow: y,
|
|
87
|
+
show: o,
|
|
88
|
+
setShow: m
|
|
93
89
|
}),
|
|
94
|
-
/* @__PURE__ */
|
|
95
|
-
|
|
90
|
+
/* @__PURE__ */ w(
|
|
91
|
+
te,
|
|
96
92
|
{
|
|
97
|
-
ref:
|
|
98
|
-
offset:
|
|
99
|
-
useAutoPlacement:
|
|
100
|
-
flipOptions:
|
|
101
|
-
autoPlacementOptions:
|
|
102
|
-
zIndex:
|
|
103
|
-
styleInnerPopover:
|
|
104
|
-
id:
|
|
105
|
-
width: typeof
|
|
106
|
-
className: `${
|
|
107
|
-
floatingOptions:
|
|
108
|
-
children: /* @__PURE__ */
|
|
109
|
-
|
|
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:
|
|
113
|
-
inputValue:
|
|
114
|
-
onInputChange: (
|
|
115
|
-
|
|
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
|
-
...
|
|
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:
|
|
125
|
+
styles: H ? f.variant[d] : f.noSearchVariant[d],
|
|
130
126
|
noOptionsMessage: () => "Tidak ada data.",
|
|
131
|
-
onChange:
|
|
127
|
+
onChange: Z,
|
|
132
128
|
selectProps: {
|
|
133
|
-
...
|
|
134
|
-
setShowDropdown:
|
|
129
|
+
...J,
|
|
130
|
+
setShowDropdown: m
|
|
135
131
|
},
|
|
136
|
-
...
|
|
132
|
+
...U
|
|
137
133
|
}
|
|
138
134
|
)
|
|
139
135
|
}
|
|
140
136
|
),
|
|
141
|
-
/* @__PURE__ */
|
|
137
|
+
/* @__PURE__ */ w("div", { className: `${f.error[K]} ${D}`, children: x })
|
|
142
138
|
]
|
|
143
139
|
}
|
|
144
140
|
);
|
|
145
141
|
}
|
|
146
142
|
);
|
|
147
|
-
|
|
143
|
+
ae.displayName = "SelectDropdownContainer";
|
|
148
144
|
export {
|
|
149
|
-
|
|
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"),
|
|
2
|
-
${
|
|
3
|
-
${
|
|
4
|
-
`,onClick:
|
|
5
|
-
${
|
|
6
|
-
${
|
|
7
|
-
`,onClick:
|
|
8
|
-
${
|
|
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
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
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
|
|
6
|
-
as:
|
|
7
|
-
show:
|
|
8
|
-
open:
|
|
9
|
-
patch:
|
|
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:
|
|
13
|
-
onClickItems:
|
|
14
|
-
propsLink:
|
|
15
|
-
...
|
|
12
|
+
setShow: l,
|
|
13
|
+
onClickItems: x,
|
|
14
|
+
propsLink: b,
|
|
15
|
+
...e
|
|
16
16
|
}) => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
26
|
-
else typeof
|
|
24
|
+
l(`${I}${e.name}/`);
|
|
25
|
+
else typeof x == "function" && x(e);
|
|
27
26
|
};
|
|
28
|
-
return
|
|
27
|
+
return e.isShow ? ([1, 3, 5, 6, 7, 8].includes(e.parent) && (g = /* @__PURE__ */ c($, { children: [
|
|
29
28
|
/* @__PURE__ */ c(
|
|
30
|
-
|
|
29
|
+
A,
|
|
31
30
|
{
|
|
32
|
-
id:
|
|
33
|
-
className: `${
|
|
34
|
-
${
|
|
35
|
-
${
|
|
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:
|
|
38
|
-
onMouseOver: () =>
|
|
39
|
-
onMouseOut: () =>
|
|
40
|
-
...
|
|
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
|
-
|
|
44
|
-
/* @__PURE__ */
|
|
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
|
-
|
|
47
|
-
|
|
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: `${
|
|
51
|
-
id: `item-sidebar-subs-${
|
|
49
|
+
className: `${i["item-icon-subs"]} ${n ? i["item-icon-subs-active"] : ""}`,
|
|
50
|
+
id: `item-sidebar-subs-${e.name}-icon`,
|
|
52
51
|
children: [
|
|
53
|
-
|
|
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
|
-
|
|
62
|
-
] })), (
|
|
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
|
-
|
|
63
|
+
A,
|
|
65
64
|
{
|
|
66
|
-
id:
|
|
67
|
-
className: `${
|
|
68
|
-
${
|
|
69
|
-
${
|
|
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:
|
|
72
|
-
onMouseOver: () =>
|
|
73
|
-
onMouseOut: () =>
|
|
74
|
-
...
|
|
70
|
+
onClick: H,
|
|
71
|
+
onMouseOver: () => f(!0),
|
|
72
|
+
onMouseOut: () => f(!1),
|
|
73
|
+
...b ? b(e.slug, e) : {},
|
|
75
74
|
children: [
|
|
76
|
-
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
|
|
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: `${
|
|
82
|
-
id: `item-sidebar-subs-${
|
|
80
|
+
className: `${i["item-icon-subs"]} ${n ? i["item-icon-subs-active"] : ""}`,
|
|
81
|
+
id: `item-sidebar-subs-${e.name}-icon`,
|
|
83
82
|
children: [
|
|
84
|
-
|
|
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
|
-
|
|
93
|
-
] })),
|
|
94
|
-
|
|
95
|
-
/* @__PURE__ */
|
|
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-${
|
|
99
|
-
className: `${
|
|
100
|
-
${
|
|
101
|
-
children:
|
|
102
|
-
|
|
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 ?
|
|
104
|
+
as: o.manualRoute ? "div" : o.subs.length > 0 ? p : e.linkComponent,
|
|
106
105
|
key: o.name,
|
|
107
|
-
patch:
|
|
106
|
+
patch: y,
|
|
108
107
|
iconSubs: r,
|
|
109
|
-
show:
|
|
110
|
-
open:
|
|
108
|
+
show: I,
|
|
109
|
+
open: s,
|
|
111
110
|
variant: m,
|
|
112
|
-
setShow:
|
|
111
|
+
setShow: l
|
|
113
112
|
}
|
|
114
113
|
))
|
|
115
114
|
}
|
|
116
115
|
),
|
|
117
|
-
[3, 4].includes(
|
|
118
|
-
] }) :
|
|
116
|
+
[3, 4].includes(e.parent) && /* @__PURE__ */ t("div", { className: d.divider?.[m] })
|
|
117
|
+
] }) : g) : /* @__PURE__ */ t($, {});
|
|
119
118
|
};
|
|
120
119
|
export {
|
|
121
|
-
|
|
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"),
|
|
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;
|