@inceptionbg/iui 1.0.0
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/package.json +40 -0
- package/src/Elements/Accordions/Accordions.tsx +64 -0
- package/src/Elements/Alert/Alert.tsx +31 -0
- package/src/Elements/Alert/alert.scss +36 -0
- package/src/Elements/Button/Button.tsx +55 -0
- package/src/Elements/Button/IconButton.tsx +42 -0
- package/src/Elements/Button/button.scss +97 -0
- package/src/Elements/Dialog/Dialog.tsx +175 -0
- package/src/Elements/Helper/Collapse.tsx +39 -0
- package/src/Elements/Helper/NoAccessInfo.tsx +195 -0
- package/src/Elements/Tooltip/Tooltip.tsx +116 -0
- package/src/Elements/Tooltip/tooltip.scss +46 -0
- package/src/Elements/Wrappers/ConditionalWrapper.tsx +10 -0
- package/src/Elements/Wrappers/FormWrapper.tsx +67 -0
- package/src/Elements/Wrappers/FullPageWrapper.tsx +87 -0
- package/src/Elements/Wrappers/PageWrapper.tsx +148 -0
- package/src/icons/duotone/faArrowLeftFromLine.ts +17 -0
- package/src/icons/duotone/faArrowRightToLine.ts +17 -0
- package/src/icons/duotone/faBell.ts +17 -0
- package/src/icons/duotone/faEye.ts +17 -0
- package/src/icons/duotone/faEyeSlash.ts +17 -0
- package/src/icons/duotone/faHouseHeart.ts +17 -0
- package/src/icons/duotone/faPlusCircle.ts +18 -0
- package/src/icons/duotone/faUser.ts +18 -0
- package/src/icons/duotone/index.ts +19 -0
- package/src/icons/light/faAngleDown.ts +15 -0
- package/src/icons/light/faArrowDownShortWide.ts +15 -0
- package/src/icons/light/faArrowDownWideShort.ts +15 -0
- package/src/icons/light/faArrowsToLine.ts +15 -0
- package/src/icons/light/faArrowsUpDown.ts +15 -0
- package/src/icons/light/faBell.ts +15 -0
- package/src/icons/light/faCheck.ts +15 -0
- package/src/icons/light/faClockRotateLeft.ts +15 -0
- package/src/icons/light/faEllipsisVertical.ts +15 -0
- package/src/icons/light/faXmark.ts +15 -0
- package/src/icons/light/index.ts +23 -0
- package/src/icons/regular/faArrowRightArrowLeft.ts +15 -0
- package/src/icons/regular/faCalendar.ts +15 -0
- package/src/icons/regular/faCircleCheck.ts +15 -0
- package/src/icons/regular/faCircleExclamation.ts +15 -0
- package/src/icons/regular/faCircleInfo.ts +15 -0
- package/src/icons/regular/faFileArrowDown.ts +15 -0
- package/src/icons/regular/faFilterCircleXmark.ts +15 -0
- package/src/icons/regular/faTriangleExclamation.ts +15 -0
- package/src/icons/solid/faAngleLeft.ts +15 -0
- package/src/icons/solid/faAngleRight.ts +15 -0
- package/src/icons/solid/faArrowDownWideShort.ts +15 -0
- package/src/icons/solid/faArrowLeft.ts +15 -0
- package/src/icons/solid/faEllipsisVertical.ts +15 -0
- package/src/icons/solid/faFilter.ts +15 -0
- package/src/icons/solid/faGripDotsVertical.ts +15 -0
- package/src/icons/solid/faListUl.ts +15 -0
- package/src/icons/solid/faMagnifyingGlass.ts +15 -0
- package/src/icons/solid/faPrint.ts +15 -0
- package/src/icons/solid/faRotateRight.ts +15 -0
- package/src/icons/solid/faXmark.ts +15 -0
- package/src/index.ts +186 -0
- package/src/styles/App.scss +25 -0
- package/src/styles/iui/common/_animations.scss +56 -0
- package/src/styles/iui/common/_typography.scss +76 -0
- package/src/styles/iui/common/_variables.scss +56 -0
- package/src/styles/iui/common/helpers/_base.scss +32 -0
- package/src/styles/iui/common/helpers/_color.scss +7 -0
- package/src/styles/iui/common/helpers/_display.scss +54 -0
- package/src/styles/iui/common/helpers/_size.scss +17 -0
- package/src/styles/iui/common/maps/_align.scss +24 -0
- package/src/styles/iui/common/maps/_spacing.scss +78 -0
- package/src/styles/iui/components/_accordions.scss +47 -0
- package/src/styles/iui/components/_badge.scss +52 -0
- package/src/styles/iui/components/_card.scss +24 -0
- package/src/styles/iui/components/_dialog.scss +75 -0
- package/src/styles/iui/components/_header.scss +22 -0
- package/src/styles/iui/components/_input.scss +225 -0
- package/src/styles/iui/components/_loader.scss +93 -0
- package/src/styles/iui/components/_menu.scss +44 -0
- package/src/styles/iui/components/_notifications.scss +86 -0
- package/src/styles/iui/components/_page.scss +50 -0
- package/src/styles/iui/components/_pagePrelogin.scss +66 -0
- package/src/styles/iui/components/_portal.scss +8 -0
- package/src/styles/iui/components/_print.scss +92 -0
- package/src/styles/iui/components/_scrollbar.scss +18 -0
- package/src/styles/iui/components/_selectInput.scss +15 -0
- package/src/styles/iui/components/_sidebar.scss +171 -0
- package/src/styles/iui/components/_smallComponents.scss +24 -0
- package/src/styles/iui/components/_table.scss +207 -0
- package/src/styles/iui/components/_tabs.scss +94 -0
- package/src/styles/iui.scss +28 -0
- package/src/styles/red-variables.scss +9 -0
- package/src/types/IBasic.ts +31 -0
- package/src/types/IError.ts +4 -0
- package/src/types/IHeaderAction.ts +12 -0
- package/src/types/ISelect.ts +6 -0
- package/src/types/ISidebar.ts +29 -0
- package/src/types/ITab.ts +10 -0
- package/src/types/ITable.ts +210 -0
- package/src/types/custom.d.ts +9 -0
- package/src/utils/DateUtils.ts +30 -0
- package/src/utils/NumberUtils.ts +21 -0
- package/src/utils/ObjectUtils.ts +49 -0
- package/src/utils/StringUtils.ts +2 -0
- package/src/utils/Toasts.ts +6 -0
- package/src/utils/icons.ts +11 -0
- package/src/utils/index.ts +41 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { useNavigate } from "react-router-dom";
|
|
3
|
+
import { Button } from "../Button/Button";
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
title?: string;
|
|
7
|
+
buttonLabel?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const NoAccessInfo: FC<Props> = ({ title, buttonLabel }) => {
|
|
11
|
+
const navigate = useNavigate();
|
|
12
|
+
return (
|
|
13
|
+
<div className="flex center column mt-5">
|
|
14
|
+
<svg
|
|
15
|
+
id="aa03ddf9-f8f2-4819-a4ce-be9b0a220741"
|
|
16
|
+
data-name="Layer 1"
|
|
17
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
18
|
+
width="40%"
|
|
19
|
+
viewBox="0 0 1119.60911 699"
|
|
20
|
+
>
|
|
21
|
+
<title>No Access</title>
|
|
22
|
+
<circle cx="292.60911" cy="213" r="213" fill="#f2f2f2" />
|
|
23
|
+
<path
|
|
24
|
+
d="M31.39089,151.64237c0,77.49789,48.6181,140.20819,108.70073,140.20819"
|
|
25
|
+
transform="translate(-31.39089 -100.5)"
|
|
26
|
+
fill="#2f2e41"
|
|
27
|
+
/>
|
|
28
|
+
<path
|
|
29
|
+
d="M140.09162,291.85056c0-78.36865,54.255-141.78356,121.30372-141.78356"
|
|
30
|
+
transform="translate(-31.39089 -100.5)"
|
|
31
|
+
fill="#4191ff"
|
|
32
|
+
/>
|
|
33
|
+
<path
|
|
34
|
+
d="M70.77521,158.66768c0,73.61476,31.00285,133.18288,69.31641,133.18288"
|
|
35
|
+
transform="translate(-31.39089 -100.5)"
|
|
36
|
+
fill="#4191ff"
|
|
37
|
+
/>
|
|
38
|
+
<path
|
|
39
|
+
d="M140.09162,291.85056c0-100.13772,62.7103-181.16788,140.20819-181.16788"
|
|
40
|
+
transform="translate(-31.39089 -100.5)"
|
|
41
|
+
fill="#2f2e41"
|
|
42
|
+
/>
|
|
43
|
+
<path
|
|
44
|
+
d="M117.22379,292.83905s15.41555-.47479,20.06141-3.783,23.713-7.2585,24.86553-1.95278,23.16671,26.38821,5.76263,26.5286-40.43935-2.711-45.07627-5.53549S117.22379,292.83905,117.22379,292.83905Z"
|
|
45
|
+
transform="translate(-31.39089 -100.5)"
|
|
46
|
+
fill="#a8a8a8"
|
|
47
|
+
/>
|
|
48
|
+
<path
|
|
49
|
+
d="M168.224,311.78489c-17.40408.14042-40.43933-2.71094-45.07626-5.53548-3.53126-2.151-4.93843-9.86945-5.40926-13.43043-.32607.014-.51463.02-.51463.02s.97638,12.43276,5.61331,15.2573,27.67217,5.67589,45.07626,5.53547c5.02386-.04052,6.7592-1.82793,6.66391-4.47526C173.87935,310.756,171.96329,311.75474,168.224,311.78489Z"
|
|
50
|
+
transform="translate(-31.39089 -100.5)"
|
|
51
|
+
opacity="0.2"
|
|
52
|
+
/>
|
|
53
|
+
<ellipse cx="198.60911" cy="424.5" rx="187" ry="25.43993" fill="#3f3d56" />
|
|
54
|
+
<ellipse cx="198.60911" cy="424.5" rx="157" ry="21.35866" opacity="0.1" />
|
|
55
|
+
<ellipse cx="836.60911" cy="660.5" rx="283" ry="38.5" fill="#3f3d56" />
|
|
56
|
+
<ellipse cx="310.60911" cy="645.5" rx="170" ry="23.12721" fill="#3f3d56" />
|
|
57
|
+
<path
|
|
58
|
+
d="M494,726.5c90,23,263-30,282-90"
|
|
59
|
+
transform="translate(-31.39089 -100.5)"
|
|
60
|
+
fill="none"
|
|
61
|
+
stroke="#2f2e41"
|
|
62
|
+
strokeMiterlimit="10"
|
|
63
|
+
strokeWidth="2"
|
|
64
|
+
/>
|
|
65
|
+
<path
|
|
66
|
+
d="M341,359.5s130-36,138,80-107,149-17,172"
|
|
67
|
+
transform="translate(-31.39089 -100.5)"
|
|
68
|
+
fill="none"
|
|
69
|
+
stroke="#2f2e41"
|
|
70
|
+
strokeMiterlimit="10"
|
|
71
|
+
strokeWidth="2"
|
|
72
|
+
/>
|
|
73
|
+
<path
|
|
74
|
+
d="M215.40233,637.78332s39.0723-10.82,41.47675,24.04449-32.15951,44.78287-5.10946,51.69566"
|
|
75
|
+
transform="translate(-31.39089 -100.5)"
|
|
76
|
+
fill="none"
|
|
77
|
+
stroke="#2f2e41"
|
|
78
|
+
strokeMiterlimit="10"
|
|
79
|
+
strokeWidth="2"
|
|
80
|
+
/>
|
|
81
|
+
<path
|
|
82
|
+
d="M810.09554,663.73988,802.218,714.03505s-38.78182,20.60284-11.51335,21.20881,155.73324,0,155.73324,0,24.84461,0-14.54318-21.81478l-7.87756-52.719Z"
|
|
83
|
+
transform="translate(-31.39089 -100.5)"
|
|
84
|
+
fill="#2f2e41"
|
|
85
|
+
/>
|
|
86
|
+
<path
|
|
87
|
+
d="M785.21906,734.69812c6.193-5.51039,16.9989-11.252,16.9989-11.252l7.87756-50.2952,113.9216.10717,7.87756,49.582c9.185,5.08711,14.8749,8.987,18.20362,11.97818,5.05882-1.15422,10.58716-5.44353-18.20362-21.38921l-7.87756-52.719-113.9216,3.02983L802.218,714.03506S769.62985,731.34968,785.21906,734.69812Z"
|
|
88
|
+
transform="translate(-31.39089 -100.5)"
|
|
89
|
+
opacity="0.1"
|
|
90
|
+
/>
|
|
91
|
+
<rect
|
|
92
|
+
x="578.43291"
|
|
93
|
+
y="212.68859"
|
|
94
|
+
width="513.25314"
|
|
95
|
+
height="357.51989"
|
|
96
|
+
rx="18.04568"
|
|
97
|
+
fill="#2f2e41"
|
|
98
|
+
/>
|
|
99
|
+
<rect
|
|
100
|
+
x="595.70294"
|
|
101
|
+
y="231.77652"
|
|
102
|
+
width="478.71308"
|
|
103
|
+
height="267.83694"
|
|
104
|
+
fill="#3f3d56"
|
|
105
|
+
/>
|
|
106
|
+
<circle cx="835.05948" cy="223.29299" r="3.02983" fill="#f2f2f2" />
|
|
107
|
+
<path
|
|
108
|
+
d="M1123.07694,621.32226V652.6628a18.04341,18.04341,0,0,1-18.04568,18.04568H627.86949A18.04341,18.04341,0,0,1,609.8238,652.6628V621.32226Z"
|
|
109
|
+
transform="translate(-31.39089 -100.5)"
|
|
110
|
+
fill="#2f2e41"
|
|
111
|
+
/>
|
|
112
|
+
<polygon
|
|
113
|
+
points="968.978 667.466 968.978 673.526 642.968 673.526 642.968 668.678 643.417 667.466 651.452 645.651 962.312 645.651 968.978 667.466"
|
|
114
|
+
fill="#2f2e41"
|
|
115
|
+
/>
|
|
116
|
+
<path
|
|
117
|
+
d="M1125.828,762.03359c-.59383,2.539-2.83591,5.21743-7.90178,7.75032-18.179,9.08949-55.1429-2.42386-55.1429-2.42386s-28.4804-4.84773-28.4804-17.573a22.72457,22.72457,0,0,1,2.49658-1.48459c7.64294-4.04351,32.98449-14.02122,77.9177.42248a18.73921,18.73921,0,0,1,8.54106,5.59715C1125.07908,756.45353,1126.50669,759.15715,1125.828,762.03359Z"
|
|
118
|
+
transform="translate(-31.39089 -100.5)"
|
|
119
|
+
fill="#2f2e41"
|
|
120
|
+
/>
|
|
121
|
+
<path
|
|
122
|
+
d="M1125.828,762.03359c-22.251,8.526-42.0843,9.1622-62.43871-4.975-10.26507-7.12617-19.59089-8.88955-26.58979-8.75618,7.64294-4.04351,32.98449-14.02122,77.9177.42248a18.73921,18.73921,0,0,1,8.54106,5.59715C1125.07908,756.45353,1126.50669,759.15715,1125.828,762.03359Z"
|
|
123
|
+
transform="translate(-31.39089 -100.5)"
|
|
124
|
+
opacity="0.1"
|
|
125
|
+
/>
|
|
126
|
+
<ellipse
|
|
127
|
+
cx="1066.53846"
|
|
128
|
+
cy="654.13477"
|
|
129
|
+
rx="7.87756"
|
|
130
|
+
ry="2.42386"
|
|
131
|
+
fill="#f2f2f2"
|
|
132
|
+
/>
|
|
133
|
+
<circle cx="835.05948" cy="545.66686" r="11.51335" fill="#f2f2f2" />
|
|
134
|
+
<polygon
|
|
135
|
+
points="968.978 667.466 968.978 673.526 642.968 673.526 642.968 668.678 643.417 667.466 968.978 667.466"
|
|
136
|
+
opacity="0.1"
|
|
137
|
+
/>
|
|
138
|
+
<rect x="108.60911" y="159" width="208" height="242" fill="#2f2e41" />
|
|
139
|
+
<rect x="87.60911" y="135" width="250" height="86" fill="#3f3d56" />
|
|
140
|
+
<rect x="87.60911" y="237" width="250" height="86" fill="#3f3d56" />
|
|
141
|
+
<rect x="87.60911" y="339" width="250" height="86" fill="#3f3d56" />
|
|
142
|
+
<rect x="271.60911" y="150" width="16" height="16" fill="#4191ff" opacity="0.4" />
|
|
143
|
+
<rect x="294.60911" y="150" width="16" height="16" fill="#4191ff" opacity="0.8" />
|
|
144
|
+
<rect x="317.60911" y="150" width="16" height="16" fill="#4191ff" />
|
|
145
|
+
<rect x="271.60911" y="251" width="16" height="16" fill="#4191ff" opacity="0.4" />
|
|
146
|
+
<rect x="294.60911" y="251" width="16" height="16" fill="#4191ff" opacity="0.8" />
|
|
147
|
+
<rect x="317.60911" y="251" width="16" height="16" fill="#4191ff" />
|
|
148
|
+
<rect x="271.60911" y="352" width="16" height="16" fill="#4191ff" opacity="0.4" />
|
|
149
|
+
<rect x="294.60911" y="352" width="16" height="16" fill="#4191ff" opacity="0.8" />
|
|
150
|
+
<rect x="317.60911" y="352" width="16" height="16" fill="#4191ff" />
|
|
151
|
+
<circle cx="316.60911" cy="538" r="79" fill="#2f2e41" />
|
|
152
|
+
<rect x="280.60911" y="600" width="24" height="43" fill="#2f2e41" />
|
|
153
|
+
<rect x="328.60911" y="600" width="24" height="43" fill="#2f2e41" />
|
|
154
|
+
<ellipse cx="300.60911" cy="643.5" rx="20" ry="7.5" fill="#2f2e41" />
|
|
155
|
+
<ellipse cx="348.60911" cy="642.5" rx="20" ry="7.5" fill="#2f2e41" />
|
|
156
|
+
<circle cx="318.60911" cy="518" r="27" fill="#fff" />
|
|
157
|
+
<circle cx="318.60911" cy="518" r="9" fill="#3f3d56" />
|
|
158
|
+
<path
|
|
159
|
+
d="M271.36733,565.03228c-6.37889-28.56758,14.01185-57.43392,45.544-64.47477s62.2651,10.41,68.644,38.9776-14.51861,39.10379-46.05075,46.14464S277.74622,593.59986,271.36733,565.03228Z"
|
|
160
|
+
transform="translate(-31.39089 -100.5)"
|
|
161
|
+
fill="#4191ff"
|
|
162
|
+
/>
|
|
163
|
+
<ellipse
|
|
164
|
+
cx="417.21511"
|
|
165
|
+
cy="611.34365"
|
|
166
|
+
rx="39.5"
|
|
167
|
+
ry="12.40027"
|
|
168
|
+
transform="translate(-238.28665 112.98044) rotate(-23.17116)"
|
|
169
|
+
fill="#2f2e41"
|
|
170
|
+
/>
|
|
171
|
+
<ellipse
|
|
172
|
+
cx="269.21511"
|
|
173
|
+
cy="664.34365"
|
|
174
|
+
rx="39.5"
|
|
175
|
+
ry="12.40027"
|
|
176
|
+
transform="translate(-271.07969 59.02084) rotate(-23.17116)"
|
|
177
|
+
fill="#2f2e41"
|
|
178
|
+
/>
|
|
179
|
+
<path
|
|
180
|
+
d="M394,661.5c0,7.732-19.90861,23-42,23s-43-14.268-43-22,20.90861-6,43-6S394,653.768,394,661.5Z"
|
|
181
|
+
transform="translate(-31.39089 -100.5)"
|
|
182
|
+
fill="#fff"
|
|
183
|
+
/>
|
|
184
|
+
</svg>
|
|
185
|
+
<h1 className="fs-32 mt-5">{title || "You have no access to this resource"}</h1>
|
|
186
|
+
<Button
|
|
187
|
+
label={buttonLabel || "Return to homepage"}
|
|
188
|
+
className="mt-5"
|
|
189
|
+
primary
|
|
190
|
+
size="l"
|
|
191
|
+
onClick={() => navigate("/")}
|
|
192
|
+
/>
|
|
193
|
+
</div>
|
|
194
|
+
);
|
|
195
|
+
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
import {
|
|
3
|
+
cloneElement,
|
|
4
|
+
Dispatch,
|
|
5
|
+
FC,
|
|
6
|
+
ReactElement,
|
|
7
|
+
SetStateAction,
|
|
8
|
+
useEffect,
|
|
9
|
+
useRef,
|
|
10
|
+
useState,
|
|
11
|
+
} from "react";
|
|
12
|
+
import { createPortal } from "react-dom";
|
|
13
|
+
import "./tooltip.scss";
|
|
14
|
+
|
|
15
|
+
type Position = "left" | "right" | "top" | "bottom";
|
|
16
|
+
interface Props {
|
|
17
|
+
label?: string;
|
|
18
|
+
position?: Position;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
className?: string;
|
|
21
|
+
children: ReactElement;
|
|
22
|
+
}
|
|
23
|
+
export const Tooltip: FC<Props> = ({
|
|
24
|
+
label,
|
|
25
|
+
position = "bottom",
|
|
26
|
+
disabled,
|
|
27
|
+
className,
|
|
28
|
+
children,
|
|
29
|
+
}) => {
|
|
30
|
+
const [newPosition, setNewPosition] = useState<Position | "">("");
|
|
31
|
+
|
|
32
|
+
const containerRef = useRef<any>(null);
|
|
33
|
+
const tooltipRef = useRef<HTMLDivElement>(null);
|
|
34
|
+
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (!disabled && !!label) {
|
|
37
|
+
const container = containerRef.current;
|
|
38
|
+
const tooltip = tooltipRef.current;
|
|
39
|
+
|
|
40
|
+
const onMouseEnter = () => {
|
|
41
|
+
if (container && tooltip) {
|
|
42
|
+
setAbsolutePosition(container, tooltip, position, setNewPosition);
|
|
43
|
+
tooltip?.classList.add("visible");
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const onMouseLeave = () => tooltip?.classList.remove("visible");
|
|
47
|
+
|
|
48
|
+
container?.addEventListener("mouseenter", onMouseEnter);
|
|
49
|
+
container?.addEventListener("mouseleave", onMouseLeave);
|
|
50
|
+
|
|
51
|
+
return () => {
|
|
52
|
+
container?.removeEventListener("mouseenter", onMouseEnter);
|
|
53
|
+
container?.removeEventListener("mouseleave", onMouseLeave);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}, [disabled, label, position]);
|
|
57
|
+
|
|
58
|
+
return !!label && !disabled ? (
|
|
59
|
+
<>
|
|
60
|
+
{cloneElement(children, { ref: containerRef })}
|
|
61
|
+
{createPortal(
|
|
62
|
+
<div ref={tooltipRef} className={clsx("tooltip-container", className)}>
|
|
63
|
+
<div className="tooltip">
|
|
64
|
+
<div className={clsx("arrow", newPosition || position)} />
|
|
65
|
+
<div>{label}</div>
|
|
66
|
+
</div>
|
|
67
|
+
</div>,
|
|
68
|
+
document.body
|
|
69
|
+
)}
|
|
70
|
+
</>
|
|
71
|
+
) : (
|
|
72
|
+
children
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const setAbsolutePosition = (
|
|
77
|
+
containerEl: HTMLDivElement,
|
|
78
|
+
targetEl: HTMLDivElement,
|
|
79
|
+
position: Position,
|
|
80
|
+
setNewPosition: Dispatch<SetStateAction<Position | "">>
|
|
81
|
+
) => {
|
|
82
|
+
const containerRect = containerEl.getBoundingClientRect();
|
|
83
|
+
const tooltipRect = targetEl.getBoundingClientRect();
|
|
84
|
+
|
|
85
|
+
if (position === "bottom" || position === "top") {
|
|
86
|
+
const bottom = Math.floor(containerRect.bottom + 16);
|
|
87
|
+
const top = Math.floor(containerRect.top - tooltipRect.height - 16);
|
|
88
|
+
const leftCenter = Math.floor(
|
|
89
|
+
containerRect.left + containerRect.width / 2 - tooltipRect.width / 2
|
|
90
|
+
);
|
|
91
|
+
const reverse =
|
|
92
|
+
position === "top"
|
|
93
|
+
? top < 0
|
|
94
|
+
: bottom + tooltipRect.height > window.innerHeight;
|
|
95
|
+
|
|
96
|
+
setNewPosition(reverse ? (position === "bottom" ? "top" : "bottom") : "");
|
|
97
|
+
|
|
98
|
+
targetEl.style.top = `${
|
|
99
|
+
position === "bottom" ? (reverse ? top : bottom) : reverse ? bottom : top
|
|
100
|
+
}px`;
|
|
101
|
+
targetEl.style.left = `${leftCenter}px`;
|
|
102
|
+
} else if (position === "right") {
|
|
103
|
+
targetEl.style.top =
|
|
104
|
+
Math.floor(
|
|
105
|
+
containerRect.top + containerRect.height / 2 - tooltipRect.height / 2
|
|
106
|
+
) + "px";
|
|
107
|
+
targetEl.style.left = Math.floor(containerRect.right + 16) + "px";
|
|
108
|
+
} else if (position === "left") {
|
|
109
|
+
targetEl.style.top =
|
|
110
|
+
Math.floor(
|
|
111
|
+
containerRect.top + containerRect.height / 2 - tooltipRect.height / 2
|
|
112
|
+
) + "px";
|
|
113
|
+
targetEl.style.left =
|
|
114
|
+
Math.floor(containerRect.left - tooltipRect.width - 16) + "px";
|
|
115
|
+
}
|
|
116
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
.tooltip-container {
|
|
2
|
+
position: fixed;
|
|
3
|
+
border-radius: 8px;
|
|
4
|
+
background: #222;
|
|
5
|
+
color: #fff;
|
|
6
|
+
font-size: 12px;
|
|
7
|
+
font-weight: bold;
|
|
8
|
+
white-space: nowrap;
|
|
9
|
+
padding: 8px 16px;
|
|
10
|
+
text-align: center;
|
|
11
|
+
z-index: 1001;
|
|
12
|
+
transition: 0.3s opacity;
|
|
13
|
+
&:not(.visible) {
|
|
14
|
+
visibility: hidden;
|
|
15
|
+
opacity: 0;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
.tooltip {
|
|
19
|
+
position: relative;
|
|
20
|
+
height: 100%;
|
|
21
|
+
.arrow {
|
|
22
|
+
position: absolute;
|
|
23
|
+
border: 8px solid #222;
|
|
24
|
+
z-index: 1001;
|
|
25
|
+
&.top {
|
|
26
|
+
top: calc(100% + 8px);
|
|
27
|
+
left: calc(50% - 8px);
|
|
28
|
+
border-color: #222 transparent transparent transparent;
|
|
29
|
+
}
|
|
30
|
+
&.bottom {
|
|
31
|
+
bottom: calc(100% + 8px);
|
|
32
|
+
left: calc(50% - 8px);
|
|
33
|
+
border-color: transparent transparent #222 transparent;
|
|
34
|
+
}
|
|
35
|
+
&.left {
|
|
36
|
+
top: calc(50% - 8px);
|
|
37
|
+
left: calc(100% + 16px);
|
|
38
|
+
border-color: transparent transparent transparent #222;
|
|
39
|
+
}
|
|
40
|
+
&.right {
|
|
41
|
+
top: calc(50% - 8px);
|
|
42
|
+
right: calc(100% + 16px);
|
|
43
|
+
border-color: transparent #222 transparent transparent;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC, ReactElement } from "react";
|
|
2
|
+
|
|
3
|
+
interface Props {
|
|
4
|
+
condition: boolean;
|
|
5
|
+
wrapper: (children: ReactElement) => ReactElement;
|
|
6
|
+
children: ReactElement;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const ConditionalWrapper: FC<Props> = ({ condition, wrapper, children }) =>
|
|
10
|
+
condition ? wrapper(children) : children;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Button } from "Elements/Button/Button";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { FC, FormEvent, ReactNode } from "react";
|
|
4
|
+
|
|
5
|
+
export interface IFormWrapper {
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
submitButton: {
|
|
9
|
+
label?: string;
|
|
10
|
+
icon?: any;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
onSubmit: (e: FormEvent<HTMLFormElement>) => void;
|
|
13
|
+
primary?: boolean;
|
|
14
|
+
};
|
|
15
|
+
otherButtons?: {
|
|
16
|
+
label: string;
|
|
17
|
+
icon?: any;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
outlined?: boolean;
|
|
20
|
+
onClick: () => void;
|
|
21
|
+
}[];
|
|
22
|
+
noAccess?: boolean;
|
|
23
|
+
children: ReactNode;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const FormWrapper: FC<IFormWrapper> = ({
|
|
27
|
+
isLoading,
|
|
28
|
+
noAccess,
|
|
29
|
+
submitButton,
|
|
30
|
+
otherButtons,
|
|
31
|
+
className,
|
|
32
|
+
children,
|
|
33
|
+
}) => (
|
|
34
|
+
<form
|
|
35
|
+
className={clsx(className, { "form-disabled": isLoading })}
|
|
36
|
+
onSubmit={(e) => {
|
|
37
|
+
e.preventDefault();
|
|
38
|
+
!submitButton.disabled && submitButton.onSubmit(e);
|
|
39
|
+
}}
|
|
40
|
+
>
|
|
41
|
+
{children}
|
|
42
|
+
{(!noAccess || otherButtons) && (
|
|
43
|
+
<div className="text-center mt-3 mb-2">
|
|
44
|
+
{otherButtons?.map((e) => (
|
|
45
|
+
<Button
|
|
46
|
+
key={e.label}
|
|
47
|
+
label={e.label}
|
|
48
|
+
icon={e.icon}
|
|
49
|
+
disabled={isLoading || e.disabled}
|
|
50
|
+
outlined={e.outlined}
|
|
51
|
+
onClick={e.onClick}
|
|
52
|
+
className="mr-2"
|
|
53
|
+
/>
|
|
54
|
+
))}
|
|
55
|
+
{!noAccess && (
|
|
56
|
+
<Button
|
|
57
|
+
label={submitButton.label || "Submit"}
|
|
58
|
+
icon={submitButton.icon}
|
|
59
|
+
disabled={isLoading || submitButton.disabled}
|
|
60
|
+
outlined={!submitButton.primary}
|
|
61
|
+
primary={submitButton.primary}
|
|
62
|
+
/>
|
|
63
|
+
)}
|
|
64
|
+
</div>
|
|
65
|
+
)}
|
|
66
|
+
</form>
|
|
67
|
+
);
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import "../../styles/iui/components/_pagePrelogin.scss";
|
|
2
|
+
import { IconDefinition } from "@fortawesome/fontawesome-svg-core";
|
|
3
|
+
import { FC, ReactElement, ReactNode } from "react";
|
|
4
|
+
import { useNavigate } from "react-router-dom";
|
|
5
|
+
import { faArrowLeft } from "../../icons/solid/faArrowLeft";
|
|
6
|
+
import { Button } from "../Button/Button";
|
|
7
|
+
import { ConditionalWrapper } from "./ConditionalWrapper";
|
|
8
|
+
|
|
9
|
+
interface Props {
|
|
10
|
+
title: string;
|
|
11
|
+
description: string | ReactElement;
|
|
12
|
+
actionButton?: {
|
|
13
|
+
label: string;
|
|
14
|
+
icon?: IconDefinition;
|
|
15
|
+
onClick?: () => void;
|
|
16
|
+
onFormSubmit?: () => void;
|
|
17
|
+
marginLarge?: boolean;
|
|
18
|
+
regular?: boolean;
|
|
19
|
+
};
|
|
20
|
+
backButton?: boolean;
|
|
21
|
+
img?: string;
|
|
22
|
+
translations?: { Back?: string };
|
|
23
|
+
children?: ReactNode;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const FullPageWrapper: FC<Props> = ({
|
|
27
|
+
title,
|
|
28
|
+
description,
|
|
29
|
+
actionButton,
|
|
30
|
+
backButton,
|
|
31
|
+
img,
|
|
32
|
+
translations,
|
|
33
|
+
children,
|
|
34
|
+
}) => {
|
|
35
|
+
const navigate = useNavigate();
|
|
36
|
+
return (
|
|
37
|
+
<div className="full-page-container">
|
|
38
|
+
<h1>{title}</h1>
|
|
39
|
+
<h2>{description}</h2>
|
|
40
|
+
<div className="content">
|
|
41
|
+
<ConditionalWrapper
|
|
42
|
+
condition={!!actionButton?.onFormSubmit}
|
|
43
|
+
wrapper={(children) => (
|
|
44
|
+
<form
|
|
45
|
+
onSubmit={(e) => {
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
e.stopPropagation();
|
|
48
|
+
actionButton?.onFormSubmit!();
|
|
49
|
+
}}
|
|
50
|
+
>
|
|
51
|
+
{children}
|
|
52
|
+
</form>
|
|
53
|
+
)}
|
|
54
|
+
>
|
|
55
|
+
<div>
|
|
56
|
+
<div className="children">{children}</div>
|
|
57
|
+
{(!!actionButton || backButton) && (
|
|
58
|
+
<div className="flex">
|
|
59
|
+
{backButton && (
|
|
60
|
+
<Button
|
|
61
|
+
label={translations?.Back || "Back"}
|
|
62
|
+
icon={faArrowLeft}
|
|
63
|
+
className="mr-2"
|
|
64
|
+
onClick={() => navigate(-1)}
|
|
65
|
+
/>
|
|
66
|
+
)}
|
|
67
|
+
{!!actionButton && (
|
|
68
|
+
<Button
|
|
69
|
+
label={actionButton.label}
|
|
70
|
+
icon={actionButton.icon}
|
|
71
|
+
onClick={actionButton.onClick}
|
|
72
|
+
primary={!actionButton.regular}
|
|
73
|
+
/>
|
|
74
|
+
)}
|
|
75
|
+
</div>
|
|
76
|
+
)}
|
|
77
|
+
</div>
|
|
78
|
+
</ConditionalWrapper>
|
|
79
|
+
{img && (
|
|
80
|
+
<div className="full-page-image">
|
|
81
|
+
<img src={img} alt="ePismonosa" />
|
|
82
|
+
</div>
|
|
83
|
+
)}
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
87
|
+
};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { FC, ReactElement, ReactNode, useState } from "react";
|
|
2
|
+
import { useNavigate } from "react-router-dom";
|
|
3
|
+
import { faArrowLeft } from "../../icons/solid/faArrowLeft";
|
|
4
|
+
import { faEllipsisVertical } from "../../icons/solid/faEllipsisVertical";
|
|
5
|
+
import { IHeaderAction } from "../../types/IHeaderAction";
|
|
6
|
+
import { Button } from "../Button/Button";
|
|
7
|
+
import { Menu } from "../Menu/Menu";
|
|
8
|
+
import { MenuItem } from "../Menu/MenuItem";
|
|
9
|
+
import { NoAccessInfo } from "../Helper/NoAccessInfo";
|
|
10
|
+
import { Loader } from "../Loader/Loader";
|
|
11
|
+
import { ConditionalWrapper } from "./ConditionalWrapper";
|
|
12
|
+
import { Link } from "react-router-dom";
|
|
13
|
+
import { IconButton } from "../Button/IconButton";
|
|
14
|
+
|
|
15
|
+
export interface IPageWrapper {
|
|
16
|
+
breadcrumbs: string[];
|
|
17
|
+
actions?: IHeaderAction[];
|
|
18
|
+
moreActions?: IHeaderAction[];
|
|
19
|
+
showBackButton?: boolean;
|
|
20
|
+
noAccess?: boolean;
|
|
21
|
+
isLoading?: boolean;
|
|
22
|
+
loaderLogo?: string;
|
|
23
|
+
footer?: ReactElement;
|
|
24
|
+
translations?: {
|
|
25
|
+
NoAccessTitle?: string;
|
|
26
|
+
ReturnToHomepage?: string;
|
|
27
|
+
};
|
|
28
|
+
children?: ReactNode;
|
|
29
|
+
}
|
|
30
|
+
export const PageWrapper: FC<IPageWrapper> = ({
|
|
31
|
+
breadcrumbs,
|
|
32
|
+
actions,
|
|
33
|
+
moreActions,
|
|
34
|
+
showBackButton,
|
|
35
|
+
noAccess,
|
|
36
|
+
isLoading,
|
|
37
|
+
loaderLogo,
|
|
38
|
+
footer,
|
|
39
|
+
translations,
|
|
40
|
+
children,
|
|
41
|
+
}) => {
|
|
42
|
+
const [isMoreActionsOpen, setIsMoreActionsOpen] = useState(false);
|
|
43
|
+
const navigate = useNavigate();
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<ConditionalWrapper
|
|
47
|
+
condition={!!isLoading}
|
|
48
|
+
wrapper={(children) => (
|
|
49
|
+
<Loader isLoading logo={loaderLogo} fullWidth>
|
|
50
|
+
{children}
|
|
51
|
+
</Loader>
|
|
52
|
+
)}
|
|
53
|
+
>
|
|
54
|
+
<div className="page-container">
|
|
55
|
+
<div className="page-header">
|
|
56
|
+
<div className="flex align-center gap-3">
|
|
57
|
+
{showBackButton && (
|
|
58
|
+
<IconButton
|
|
59
|
+
icon={faArrowLeft}
|
|
60
|
+
className="c-primary"
|
|
61
|
+
onClick={() => navigate(-1)}
|
|
62
|
+
/>
|
|
63
|
+
)}
|
|
64
|
+
{/* ////// BREADCRUMBS ////// */}
|
|
65
|
+
<div className="breadcrumbs">
|
|
66
|
+
{breadcrumbs.map(
|
|
67
|
+
(e, i) =>
|
|
68
|
+
e && (
|
|
69
|
+
<h1 key={e}>{i + 1 < breadcrumbs.length ? `${e} /` : e}</h1>
|
|
70
|
+
)
|
|
71
|
+
)}
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
{/* ////// ACTIONS ////// */}
|
|
75
|
+
{!noAccess && (
|
|
76
|
+
<div className="flex align-center">
|
|
77
|
+
{actions?.map(
|
|
78
|
+
(action) =>
|
|
79
|
+
!action.hidden && (
|
|
80
|
+
<ConditionalWrapper
|
|
81
|
+
key={action.label}
|
|
82
|
+
condition={!!action.to}
|
|
83
|
+
wrapper={(children) => (
|
|
84
|
+
<Link to={action.to!}>{children}</Link>
|
|
85
|
+
)}
|
|
86
|
+
>
|
|
87
|
+
<Button key={action.label} {...action} className="ml-2" />
|
|
88
|
+
</ConditionalWrapper>
|
|
89
|
+
)
|
|
90
|
+
)}
|
|
91
|
+
{!!moreActions?.length && (
|
|
92
|
+
<Menu
|
|
93
|
+
isOpen={isMoreActionsOpen}
|
|
94
|
+
onClose={() => setIsMoreActionsOpen(false)}
|
|
95
|
+
placementX="right"
|
|
96
|
+
renderButton={(ref) => (
|
|
97
|
+
<IconButton
|
|
98
|
+
ref={ref}
|
|
99
|
+
icon={faEllipsisVertical}
|
|
100
|
+
active={isMoreActionsOpen}
|
|
101
|
+
onClick={() => setIsMoreActionsOpen(!isMoreActionsOpen)}
|
|
102
|
+
/>
|
|
103
|
+
)}
|
|
104
|
+
>
|
|
105
|
+
{moreActions.map(
|
|
106
|
+
(action) =>
|
|
107
|
+
!action.hidden && (
|
|
108
|
+
<MenuItem
|
|
109
|
+
key={action.label}
|
|
110
|
+
label={action.label}
|
|
111
|
+
icon={action.icon}
|
|
112
|
+
iconRotation={action.iconRotation}
|
|
113
|
+
disabled={action.disabled}
|
|
114
|
+
withDevider
|
|
115
|
+
to={action.to}
|
|
116
|
+
onClick={
|
|
117
|
+
action.onClick
|
|
118
|
+
? () => {
|
|
119
|
+
action.onClick!();
|
|
120
|
+
setIsMoreActionsOpen(false);
|
|
121
|
+
}
|
|
122
|
+
: undefined
|
|
123
|
+
}
|
|
124
|
+
/>
|
|
125
|
+
)
|
|
126
|
+
)}
|
|
127
|
+
</Menu>
|
|
128
|
+
)}
|
|
129
|
+
</div>
|
|
130
|
+
)}
|
|
131
|
+
</div>
|
|
132
|
+
<div className="page-content">
|
|
133
|
+
<div className="flex-grow">
|
|
134
|
+
{!noAccess ? (
|
|
135
|
+
children
|
|
136
|
+
) : (
|
|
137
|
+
<NoAccessInfo
|
|
138
|
+
title={translations?.NoAccessTitle}
|
|
139
|
+
buttonLabel={translations?.ReturnToHomepage}
|
|
140
|
+
/>
|
|
141
|
+
)}
|
|
142
|
+
</div>
|
|
143
|
+
{footer}
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
</ConditionalWrapper>
|
|
147
|
+
);
|
|
148
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IconDefinition } from "@fortawesome/fontawesome-svg-core";
|
|
2
|
+
|
|
3
|
+
const prefix = "fad";
|
|
4
|
+
const iconName = "arrow-left-from-line";
|
|
5
|
+
const width = 448;
|
|
6
|
+
const height = 512;
|
|
7
|
+
const unicode = "f344";
|
|
8
|
+
const svgPathData = [
|
|
9
|
+
"M384 96v320c0 17.69 14.31 32 32 32s32-14.31 32-32V96c0-17.69-14.31-32-32-32S384 78.31 384 96z",
|
|
10
|
+
"M182.6 406.6c-12.5 12.5-32.75 12.5-45.25 0l-128-128c-12.5-12.5-12.5-32.75 0-45.25l128-128c12.5-12.5 32.75-12.5 45.25 0C188.9 111.6 192 119.8 192 128S188.9 144.4 182.6 150.6L109.3 224H288c17.69 0 32 14.31 32 32s-14.31 32-32 32H109.3l73.38 73.38C195.1 373.9 195.1 394.1 182.6 406.6z",
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
export const faArrowLeftFromLine: IconDefinition = {
|
|
14
|
+
prefix,
|
|
15
|
+
iconName,
|
|
16
|
+
icon: [width, height, [], unicode, svgPathData],
|
|
17
|
+
};
|