@inceptionbg/iui 1.0.5 → 1.0.7

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 (107) hide show
  1. package/dist/index.css +1 -0
  2. package/dist/index.d.ts +407 -0
  3. package/dist/index.js +269 -0
  4. package/dist/index.js.map +1 -0
  5. package/package.json +7 -6
  6. package/src/Elements/Accordions/Accordions.tsx +0 -63
  7. package/src/Elements/Alert/Alert.tsx +0 -31
  8. package/src/Elements/Alert/alert.scss +0 -36
  9. package/src/Elements/Button/Button.tsx +0 -55
  10. package/src/Elements/Button/IconButton.tsx +0 -42
  11. package/src/Elements/Button/button.scss +0 -97
  12. package/src/Elements/Dialog/Dialog.tsx +0 -175
  13. package/src/Elements/Helper/Collapse.tsx +0 -39
  14. package/src/Elements/Helper/NoAccessInfo.tsx +0 -195
  15. package/src/Elements/Tooltip/Tooltip.tsx +0 -116
  16. package/src/Elements/Tooltip/tooltip.scss +0 -46
  17. package/src/Elements/Wrappers/ConditionalWrapper.tsx +0 -10
  18. package/src/Elements/Wrappers/FormWrapper.tsx +0 -67
  19. package/src/Elements/Wrappers/FullPageWrapper.tsx +0 -87
  20. package/src/icons/duotone/faArrowLeftFromLine.ts +0 -17
  21. package/src/icons/duotone/faArrowRightToLine.ts +0 -17
  22. package/src/icons/duotone/faBell.ts +0 -17
  23. package/src/icons/duotone/faEye.ts +0 -17
  24. package/src/icons/duotone/faEyeSlash.ts +0 -17
  25. package/src/icons/duotone/faHouseHeart.ts +0 -17
  26. package/src/icons/duotone/faPlusCircle.ts +0 -18
  27. package/src/icons/duotone/faUser.ts +0 -18
  28. package/src/icons/duotone/index.ts +0 -19
  29. package/src/icons/light/faAngleDown.ts +0 -15
  30. package/src/icons/light/faArrowDownShortWide.ts +0 -15
  31. package/src/icons/light/faArrowDownWideShort.ts +0 -15
  32. package/src/icons/light/faArrowsToLine.ts +0 -15
  33. package/src/icons/light/faArrowsUpDown.ts +0 -15
  34. package/src/icons/light/faBell.ts +0 -15
  35. package/src/icons/light/faCheck.ts +0 -15
  36. package/src/icons/light/faClockRotateLeft.ts +0 -15
  37. package/src/icons/light/faEllipsisVertical.ts +0 -15
  38. package/src/icons/light/faXmark.ts +0 -15
  39. package/src/icons/light/index.ts +0 -23
  40. package/src/icons/regular/faArrowRightArrowLeft.ts +0 -15
  41. package/src/icons/regular/faCalendar.ts +0 -15
  42. package/src/icons/regular/faCircleCheck.ts +0 -15
  43. package/src/icons/regular/faCircleExclamation.ts +0 -15
  44. package/src/icons/regular/faCircleInfo.ts +0 -15
  45. package/src/icons/regular/faFileArrowDown.ts +0 -15
  46. package/src/icons/regular/faFilterCircleXmark.ts +0 -15
  47. package/src/icons/regular/faTriangleExclamation.ts +0 -15
  48. package/src/icons/solid/faAngleLeft.ts +0 -15
  49. package/src/icons/solid/faAngleRight.ts +0 -15
  50. package/src/icons/solid/faArrowDownWideShort.ts +0 -15
  51. package/src/icons/solid/faArrowLeft.ts +0 -15
  52. package/src/icons/solid/faEllipsisVertical.ts +0 -15
  53. package/src/icons/solid/faFilter.ts +0 -15
  54. package/src/icons/solid/faGripDotsVertical.ts +0 -15
  55. package/src/icons/solid/faListUl.ts +0 -15
  56. package/src/icons/solid/faMagnifyingGlass.ts +0 -15
  57. package/src/icons/solid/faPrint.ts +0 -15
  58. package/src/icons/solid/faRotateRight.ts +0 -15
  59. package/src/icons/solid/faXmark.ts +0 -15
  60. package/src/index.ts +0 -186
  61. package/src/styles/App.scss +0 -25
  62. package/src/styles/iui/common/_animations.scss +0 -56
  63. package/src/styles/iui/common/_typography.scss +0 -76
  64. package/src/styles/iui/common/_variables.scss +0 -56
  65. package/src/styles/iui/common/helpers/_base.scss +0 -32
  66. package/src/styles/iui/common/helpers/_color.scss +0 -7
  67. package/src/styles/iui/common/helpers/_display.scss +0 -54
  68. package/src/styles/iui/common/helpers/_size.scss +0 -17
  69. package/src/styles/iui/common/maps/_align.scss +0 -24
  70. package/src/styles/iui/common/maps/_spacing.scss +0 -78
  71. package/src/styles/iui/components/_accordions.scss +0 -47
  72. package/src/styles/iui/components/_badge.scss +0 -52
  73. package/src/styles/iui/components/_card.scss +0 -24
  74. package/src/styles/iui/components/_dialog.scss +0 -75
  75. package/src/styles/iui/components/_header.scss +0 -22
  76. package/src/styles/iui/components/_input.scss +0 -225
  77. package/src/styles/iui/components/_loader.scss +0 -93
  78. package/src/styles/iui/components/_menu.scss +0 -44
  79. package/src/styles/iui/components/_notifications.scss +0 -86
  80. package/src/styles/iui/components/_page.scss +0 -50
  81. package/src/styles/iui/components/_pagePrelogin.scss +0 -66
  82. package/src/styles/iui/components/_portal.scss +0 -8
  83. package/src/styles/iui/components/_print.scss +0 -92
  84. package/src/styles/iui/components/_scrollbar.scss +0 -18
  85. package/src/styles/iui/components/_selectInput.scss +0 -15
  86. package/src/styles/iui/components/_sidebar.scss +0 -171
  87. package/src/styles/iui/components/_smallComponents.scss +0 -24
  88. package/src/styles/iui/components/_table.scss +0 -207
  89. package/src/styles/iui/components/_tabs.scss +0 -94
  90. package/src/styles/iui.scss +0 -28
  91. package/src/styles/red-variables.scss +0 -9
  92. package/src/types/IBasic.ts +0 -31
  93. package/src/types/IError.ts +0 -4
  94. package/src/types/IHeaderAction.ts +0 -12
  95. package/src/types/ISelect.ts +0 -6
  96. package/src/types/ISidebar.ts +0 -29
  97. package/src/types/ITab.ts +0 -10
  98. package/src/types/ITable.ts +0 -210
  99. package/src/types/custom.d.ts +0 -9
  100. package/src/utils/DateUtils.ts +0 -30
  101. package/src/utils/NumberUtils.ts +0 -21
  102. package/src/utils/ObjectUtils.ts +0 -49
  103. package/src/utils/StringUtils.ts +0 -2
  104. package/src/utils/Toasts.ts +0 -6
  105. package/src/utils/icons.ts +0 -11
  106. package/src/utils/index.ts +0 -41
  107. package/tsconfig.json +0 -20
@@ -1,97 +0,0 @@
1
- .iui-btn {
2
- cursor: pointer;
3
- user-select: none;
4
- background: none;
5
- border: none;
6
- display: inline-flex;
7
- align-items: center;
8
- letter-spacing: 0.4px;
9
- font-weight: 500;
10
- transition: background-color 250ms;
11
- border-radius: 8px;
12
- color: var(--primary-dark);
13
- svg {
14
- font-size: 16px;
15
- margin: 0 4px;
16
- }
17
- &.primary {
18
- background-color: var(--primary);
19
- color: white;
20
- }
21
- &.outlined {
22
- border: 2px solid var(--primary-o25);
23
- }
24
- &:disabled {
25
- opacity: 0.4;
26
- cursor: default;
27
- }
28
- &:hover:not(:disabled):not(.primary),
29
- &:active:not(:disabled):not(.primary),
30
- &.active:not(:disabled):not(.primary) {
31
- background-color: var(--primary-o25);
32
- }
33
- &.primary:hover:not(:disabled),
34
- &.primary:active:not(:disabled),
35
- &.primary.active:not(:disabled) {
36
- background-color: var(--primary-dark);
37
- }
38
- &:active:not(:disabled) {
39
- transform: translateY(2px);
40
- }
41
- // Sizes
42
- &.xs {
43
- font-size: 10px;
44
- padding: 4px;
45
- height: 23px;
46
- &.outlined {
47
- padding: 3px;
48
- border-width: 1px;
49
- }
50
- svg {
51
- font-size: 10px;
52
- margin-right: 0px;
53
- }
54
- }
55
- &.s {
56
- font-size: 12px;
57
- padding: 6px;
58
- &.outlined {
59
- padding: 4px;
60
- }
61
- svg {
62
- font-size: 14px;
63
- }
64
- }
65
- &.m {
66
- font-size: 13px;
67
- padding: 10px;
68
- height: 38px;
69
- &.outlined {
70
- padding: 8px;
71
- }
72
- }
73
- &.l {
74
- font-size: 15px;
75
- padding: 12px;
76
- &.outlined {
77
- padding: 10px;
78
- }
79
- svg {
80
- font-size: 18px;
81
- }
82
- }
83
- }
84
-
85
- .iui-btn-label {
86
- margin: 0 4px;
87
- }
88
-
89
- .iui-icon-btn {
90
- padding: 6px;
91
- border-radius: 50%;
92
- svg {
93
- margin: 0 !important;
94
- height: 20px;
95
- width: 20px;
96
- }
97
- }
@@ -1,175 +0,0 @@
1
- import { IconDefinition } from "@fortawesome/fontawesome-svg-core";
2
- import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
3
- import clsx from "clsx";
4
- import { FC, ReactNode, useCallback, useEffect, useRef } from "react";
5
- import { createPortal } from "react-dom";
6
- import { faCircleInfo } from "../../icons/regular/faCircleInfo";
7
- import { faTriangleExclamation } from "../../icons/regular/faTriangleExclamation";
8
- import { ConditionalWrapper } from "../Wrappers/ConditionalWrapper";
9
- import { Button } from "../Button/Button";
10
-
11
- interface Props {
12
- title?: string;
13
- titleEl?: ReactNode;
14
- desc?: string;
15
- descEl?: ReactNode;
16
- isOpen: boolean;
17
- onClose: () => void;
18
- confirmButton?: {
19
- label?: string;
20
- icon?: IconDefinition;
21
- onClick?: () => void;
22
- onFormSubmit?: () => void;
23
- disabled?: boolean;
24
- keepOpen?: boolean;
25
- };
26
- cancelButton?: {
27
- label?: string;
28
- icon?: IconDefinition;
29
- onClick?: () => void;
30
- };
31
- additionalButton?: {
32
- label: string;
33
- icon?: IconDefinition;
34
- onClick?: () => void;
35
- disabled?: boolean;
36
- };
37
- noBackgroundClick?: boolean;
38
- noOverflow?: boolean;
39
- type?: "info" | "error";
40
- size?: "m" | "l" | "xl";
41
- noPadding?: boolean;
42
- className?: string;
43
- children?: ReactNode;
44
- }
45
-
46
- const typeIcon = {
47
- info: faCircleInfo,
48
- error: faTriangleExclamation,
49
- };
50
-
51
- export const Dialog: FC<Props> = ({
52
- title,
53
- titleEl,
54
- desc,
55
- descEl,
56
- isOpen,
57
- onClose,
58
- confirmButton,
59
- cancelButton,
60
- additionalButton,
61
- noBackgroundClick,
62
- noOverflow,
63
- type,
64
- size,
65
- noPadding,
66
- className,
67
- children,
68
- }) => {
69
- const dialogRef = useRef<HTMLDivElement>(null);
70
-
71
- const handleClose = useCallback(() => {
72
- dialogRef.current?.classList.add("closing");
73
- setTimeout(onClose, 200);
74
- }, [dialogRef, onClose]);
75
-
76
- useEffect(() => {
77
- if (!noBackgroundClick) {
78
- const handleClick = (ev: MouseEvent) =>
79
- ev.target === dialogRef.current && handleClose();
80
- window.addEventListener("click", handleClick);
81
- return () => window.removeEventListener("click", handleClick);
82
- }
83
- }, [noBackgroundClick, handleClose]);
84
-
85
- return isOpen
86
- ? createPortal(
87
- <div ref={dialogRef} className="iui-dialog">
88
- <ConditionalWrapper
89
- condition={!!confirmButton?.onFormSubmit}
90
- wrapper={(children) => (
91
- <form
92
- onSubmit={(e) => {
93
- e.preventDefault();
94
- e.stopPropagation();
95
- confirmButton!.onFormSubmit!();
96
- !confirmButton!.keepOpen && handleClose();
97
- }}
98
- >
99
- {children}
100
- </form>
101
- )}
102
- >
103
- <div
104
- className={clsx("iui-dialog-container", size, type, className)}
105
- >
106
- {title && <h1>{title}</h1>}
107
- {titleEl}
108
- <div
109
- className={clsx("iui-dialog-content", {
110
- padding: !noPadding,
111
- "no-overflow": noOverflow,
112
- })}
113
- >
114
- {type && <FontAwesomeIcon icon={typeIcon[type]} />}
115
- {desc && <p>{desc}</p>}
116
- {descEl}
117
- {children}
118
- </div>
119
- <div className="iui-dialog-actions">
120
- <Button
121
- label={
122
- cancelButton?.label || (confirmButton ? "Otkaži" : "Ok")
123
- }
124
- icon={cancelButton?.icon}
125
- primary={!confirmButton}
126
- onClick={(e) => {
127
- e.stopPropagation();
128
- cancelButton?.onClick
129
- ? cancelButton.onClick()
130
- : handleClose();
131
- }}
132
- />
133
- {additionalButton && (
134
- <Button
135
- label={additionalButton.label}
136
- icon={additionalButton.icon}
137
- className="ml-2"
138
- onClick={
139
- !!additionalButton.onClick
140
- ? (e) => {
141
- e.stopPropagation();
142
- additionalButton.onClick!();
143
- handleClose();
144
- }
145
- : undefined
146
- }
147
- disabled={additionalButton.disabled}
148
- />
149
- )}
150
- {confirmButton && (
151
- <Button
152
- label={confirmButton.label || "Potvrdi"}
153
- icon={confirmButton.icon}
154
- primary
155
- className="ml-2"
156
- onClick={
157
- !!confirmButton.onClick
158
- ? (e) => {
159
- e.stopPropagation();
160
- confirmButton.onClick!();
161
- !confirmButton.keepOpen && handleClose();
162
- }
163
- : undefined
164
- }
165
- disabled={confirmButton.disabled}
166
- />
167
- )}
168
- </div>
169
- </div>
170
- </ConditionalWrapper>
171
- </div>,
172
- document.body
173
- )
174
- : null;
175
- };
@@ -1,39 +0,0 @@
1
- import clsx from "clsx";
2
- import { FC, ReactNode, useEffect, useRef, useState } from "react";
3
-
4
- interface Props {
5
- isOpen: boolean;
6
- className?: string;
7
- children?: ReactNode;
8
- }
9
-
10
- export const Collapse: FC<Props> = ({ isOpen, className, children }) => {
11
- const [height, setHeight] = useState<number>();
12
- const ref = useRef<HTMLDivElement>(null);
13
-
14
- useEffect(() => {
15
- const observer = new ResizeObserver((entries) => {
16
- const newHeight = Math.ceil(entries[0].contentRect.height);
17
- setHeight(newHeight);
18
- });
19
-
20
- let observerRefValue: HTMLDivElement;
21
- if (ref.current) {
22
- observerRefValue = ref.current;
23
- observer.observe(observerRefValue);
24
- }
25
-
26
- return () => {
27
- observerRefValue && observer.unobserve(observerRefValue);
28
- };
29
- }, [ref]);
30
-
31
- return (
32
- <div
33
- className={clsx("iui-colapse", className)}
34
- style={{ maxHeight: isOpen ? height : 0 }}
35
- >
36
- <div ref={ref}>{children}</div>
37
- </div>
38
- );
39
- };
@@ -1,195 +0,0 @@
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
- };
@@ -1,116 +0,0 @@
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
- };
@@ -1,46 +0,0 @@
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
- }
@@ -1,10 +0,0 @@
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;