react-core-ts 1.1.21 → 1.1.23

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.
@@ -0,0 +1,16 @@
1
+ import React from "react";
2
+ import { FieldErrors } from "react-hook-form";
3
+ type OTPInputProps = {
4
+ BoxLength?: number;
5
+ value?: string;
6
+ onChangeOTP: (otp: string) => void;
7
+ label?: string;
8
+ errors?: FieldErrors;
9
+ name: string;
10
+ id: string;
11
+ labelTitle?: string;
12
+ initialTime?: number;
13
+ callbackFn?: (data: boolean) => void;
14
+ };
15
+ declare const OTPInput: React.FC<OTPInputProps>;
16
+ export default OTPInput;
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
14
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
15
+ if (ar || !(i in from)) {
16
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
17
+ ar[i] = from[i];
18
+ }
19
+ }
20
+ return to.concat(ar || Array.prototype.slice.call(from));
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ var jsx_runtime_1 = require("react/jsx-runtime");
24
+ var react_1 = require("react");
25
+ var OTPInput = function (_a) {
26
+ var _b = _a.BoxLength, BoxLength = _b === void 0 ? 6 : _b, onChangeOTP = _a.onChangeOTP, _c = _a.value, value = _c === void 0 ? "" : _c, label = _a.label, errors = _a.errors, name = _a.name, id = _a.id, labelTitle = _a.labelTitle, _d = _a.initialTime, initialTime = _d === void 0 ? 240 : _d, callbackFn = _a.callbackFn;
27
+ // Initialize OTP state from value prop
28
+ var _e = (0, react_1.useState)(value.split("").concat(Array(BoxLength - value.length).fill(""))), otp = _e[0], setOtp = _e[1];
29
+ var inputRefs = (0, react_1.useRef)([]);
30
+ var _f = (0, react_1.useState)(initialTime), remainingTime = _f[0], setRemainingTime = _f[1];
31
+ var _g = (0, react_1.useState)(false), isTimerCompleted = _g[0], setIsTimerCompleted = _g[1];
32
+ (0, react_1.useEffect)(function () {
33
+ // Synchronize local otp state with value prop changes
34
+ setOtp(value.split("").concat(Array(BoxLength - value.length).fill("")));
35
+ }, [value, BoxLength]);
36
+ (0, react_1.useEffect)(function () {
37
+ if (otp)
38
+ onChangeOTP(otp.join(""));
39
+ }, [otp]);
40
+ (0, react_1.useEffect)(function () {
41
+ if (remainingTime > 0) {
42
+ var timerId_1 = setInterval(function () {
43
+ setRemainingTime(function (prev) { return prev - 1; });
44
+ }, 1000);
45
+ return function () { return clearInterval(timerId_1); };
46
+ }
47
+ else {
48
+ setIsTimerCompleted(true);
49
+ }
50
+ }, [remainingTime]);
51
+ var formatTime = function (time) {
52
+ var minutes = Math.floor(time / 60);
53
+ var seconds = time % 60;
54
+ return "".concat(minutes, ":").concat(seconds < 10 ? "0".concat(seconds) : seconds);
55
+ };
56
+ var handleChange = function (e, index) {
57
+ var _a;
58
+ var value = e.target.value;
59
+ if (/[^0-9]/.test(value))
60
+ return;
61
+ var newOtp = __spreadArray([], otp, true);
62
+ newOtp[index] = value;
63
+ setOtp(newOtp);
64
+ if (value !== "" && index < BoxLength - 1) {
65
+ (_a = inputRefs.current[index + 1]) === null || _a === void 0 ? void 0 : _a.focus(); // Move focus to next input
66
+ }
67
+ };
68
+ var handleKeyDown = function (e, index) {
69
+ var _a;
70
+ if (e.key === "Backspace" && otp[index] === "" && index > 0) {
71
+ (_a = inputRefs.current[index - 1]) === null || _a === void 0 ? void 0 : _a.focus(); // Move focus to previous input
72
+ }
73
+ };
74
+ var handlePaste = function (e) {
75
+ var _a, _b;
76
+ var pastedData = e.clipboardData.getData("Text").slice(0, BoxLength);
77
+ if (/[^0-9]/.test(pastedData))
78
+ return;
79
+ var newOtp = pastedData
80
+ .split("")
81
+ .concat(Array(BoxLength - pastedData.length).fill(""));
82
+ setOtp(newOtp);
83
+ // Move focus to the last filled input field
84
+ var lastIndex = newOtp.findIndex(function (val) { return val === ""; });
85
+ if (lastIndex !== -1) {
86
+ (_a = inputRefs.current[lastIndex]) === null || _a === void 0 ? void 0 : _a.focus();
87
+ }
88
+ else {
89
+ (_b = inputRefs.current[BoxLength - 1]) === null || _b === void 0 ? void 0 : _b.focus();
90
+ }
91
+ };
92
+ var getErrors = function (err) {
93
+ var errMsg = "";
94
+ if (err.message) {
95
+ errMsg = err === null || err === void 0 ? void 0 : err.message;
96
+ }
97
+ return errMsg;
98
+ };
99
+ var handleError = function (data) {
100
+ var _a;
101
+ if (getErrors(data[name]) === "required" ||
102
+ getErrors(data[name]) === "Required") {
103
+ return "".concat(label !== null && label !== void 0 ? label : labelTitle, " is ").concat(getErrors(data[name]));
104
+ }
105
+ else {
106
+ return (_a = getErrors(data[name])) !== null && _a !== void 0 ? _a : "";
107
+ }
108
+ };
109
+ // Reset time function added
110
+ var resetTimer = function () {
111
+ setRemainingTime(initialTime);
112
+ setIsTimerCompleted(false);
113
+ };
114
+ var handleResend = function () {
115
+ if (isTimerCompleted) {
116
+ callbackFn === null || callbackFn === void 0 ? void 0 : callbackFn(isTimerCompleted);
117
+ resetTimer();
118
+ }
119
+ };
120
+ return ((0, jsx_runtime_1.jsxs)("div", { children: [label && ((0, jsx_runtime_1.jsx)("div", __assign({ className: "mb-2 me-2" }, { children: (0, jsx_runtime_1.jsx)("label", __assign({ className: "text-grey-label font-normal text-common" }, { children: label })) }))), (0, jsx_runtime_1.jsxs)("div", __assign({ className: "flex flex-col w-fit" }, { children: [(0, jsx_runtime_1.jsx)("div", __assign({ className: "flex gap-x-5 " }, { children: Array(BoxLength)
121
+ .fill("")
122
+ .map(function (_, index) { return ((0, jsx_runtime_1.jsx)("input", { name: name, id: id, type: "text", value: otp[index], onChange: function (e) { return handleChange(e, index); }, onKeyDown: function (e) { return handleKeyDown(e, index); }, onPaste: handlePaste, ref: function (el) { return (inputRefs.current[index] = el); }, maxLength: 1, onFocus: function (e) { return (e.target.style.borderColor = "#667085"); }, onBlur: function (e) { return (e.target.style.borderColor = "#D0D5DD"); }, className: "w-[54px] h-10 text-center text-lg border border-[#D0D5DD] focus:border-[#667085] transition-colors duration-200 outline-none rounded-sm" }, index)); }) })), (0, jsx_runtime_1.jsxs)("div", __assign({ className: "flex items-center pt-3" }, { children: [(0, jsx_runtime_1.jsx)("p", __assign({ className: "text-common text-[#475467]" }, { children: "Didn't receive a code? " })), (0, jsx_runtime_1.jsx)("span", __assign({ className: "text-common text-[#003C71] ml-2 ".concat(!isTimerCompleted ? "cursor-not-allowed" : "cursor-pointer"), onClick: handleResend }, { children: "Resend Code" }))] })), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("span", __assign({ className: "text-common text-[#475467]" }, { children: ["Remaining Time: ", formatTime(remainingTime)] })) }), (0, jsx_runtime_1.jsx)("div", __assign({ className: "flex justify-center items-center text-[#F94110] text-base font-medium\t" }, { children: errors && errors[name] && (0, jsx_runtime_1.jsxs)("span", { children: [" ", handleError(errors)] }) }))] }))] }));
123
+ };
124
+ exports.default = OTPInput;
125
+ //# sourceMappingURL=ReactOTPInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactOTPInput.js","sourceRoot":"","sources":["../src/ReactOTPInput.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA2D;AAgB3D,IAAM,QAAQ,GAA4B,UAAC,EAW1C;QAVC,iBAAa,EAAb,SAAS,mBAAG,CAAC,KAAA,EACb,WAAW,iBAAA,EACX,aAAU,EAAV,KAAK,mBAAG,EAAE,KAAA,EACV,KAAK,WAAA,EACL,MAAM,YAAA,EACN,IAAI,UAAA,EACJ,EAAE,QAAA,EACF,UAAU,gBAA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AAE,CAAC,EAA/B,CAA+B,EAC5C,SAAS,EAAE,CAAC,EACZ,OAAO,EAAE,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,GAAG,SAAS,CAAC,EAAxC,CAAwC,EACxD,MAAM,EAAE,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,GAAG,SAAS,CAAC,EAAxC,CAAwC,EACvD,SAAS,EAAC,0IAA0I,IAZ/I,KAAK,CAaV,CACH,EAhBkB,CAgBlB,CAAC,IACA,EACN,0CAAK,SAAS,EAAC,wBAAwB,iBACrC,uCAAG,SAAS,EAAC,4BAA4B,6CAA4B,EACrE,0CACE,SAAS,EAAE,2CACT,CAAC,gBAAgB,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,gBAAgB,CAC3D,EACF,OAAO,EAAE,YAAY,iCAGhB,KACH,EACN,0CACE,2CAAM,SAAS,EAAC,4BAA4B,qCACzB,UAAU,CAAC,aAAa,CAAC,KACrC,GACH,EAEN,yCAAK,SAAS,EAAC,yEAAwE,gBACpF,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,kDAAQ,WAAW,CAAC,MAAM,CAAC,IAAQ,IAC1D,KACF,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { RadioProps } from "./commontypes";
3
+ declare const Radio: React.FC<RadioProps>;
4
+ export default Radio;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ var jsx_runtime_1 = require("react/jsx-runtime");
15
+ var react_1 = require("react");
16
+ var Radio = function (_a) {
17
+ var name = _a.name, id = _a.id, label = _a.label, checked = _a.checked, _b = _a.value, value = _b === void 0 ? undefined : _b, handleChange = _a.handleChange, _c = _a.disabled, disabled = _c === void 0 ? false : _c, customLabel = _a.customLabel;
18
+ var radioRef = (0, react_1.useRef)(null);
19
+ var onChange = function (e) {
20
+ handleChange === null || handleChange === void 0 ? void 0 : handleChange(e);
21
+ };
22
+ var labelClick = function () {
23
+ if (radioRef.current) {
24
+ radioRef.current.click();
25
+ }
26
+ };
27
+ return ((0, jsx_runtime_1.jsxs)("div", __assign({ className: "labels label-text flex items-center justify-start ".concat(!customLabel && "gap-0", " ").concat(disabled ? " opacity-70" : "", " ") }, { children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("label", __assign({ className: "radio-button ".concat(disabled ? "cursor-not-allowed" : "cursor-pointer") }, { children: [(0, jsx_runtime_1.jsx)("input", { type: "radio", checked: checked, disabled: disabled, ref: radioRef, name: name, "data-testid": "app-common-radio", value: value, id: id, onChange: onChange }), (0, jsx_runtime_1.jsx)("span", { className: "radio" })] })), " "] }), (0, jsx_runtime_1.jsx)("div", __assign({ className: "text-common font-normal cursor-pointer ".concat(checked ? "text-secondary" : ""), onClick: labelClick }, { children: label }))] })));
28
+ };
29
+ exports.default = Radio;
30
+ //# sourceMappingURL=ReactRadioButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactRadioButton.js","sourceRoot":"","sources":["../src/ReactRadioButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+BAAsC;AAItC,IAAM,KAAK,GAAyB,UAAC,EASpC;QARC,IAAI,UAAA,EACJ,EAAE,QAAA,EACF,KAAK,WAAA,EACL,OAAO,aAAA,EACP,aAAiB,EAAjB,KAAK,mBAAG,SAAS,KAAA,EACjB,YAAY,kBAAA,EACZ,gBAAgB,EAAhB,QAAQ,mBAAG,KAAK,KAAA,EAChB,WAAW,iBAAA;IAEX,IAAM,QAAQ,GAAG,IAAA,cAAM,EAAmB,IAAI,CAAC,CAAC;IAChD,IAAM,QAAQ,GAAG,UAAC,CAAM;QACtB,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAG,CAAC,CAAC,CAAC;IACpB,CAAC,CAAC;IACF,IAAM,UAAU,GAAG;QACjB,IAAI,QAAQ,CAAC,OAAO,EAAE;YACpB,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;SAC1B;IACH,CAAC,CAAC;IACF,OAAO,CACL,0CACE,SAAS,EAAE,4DACT,CAAC,WAAW,IAAI,OAAO,eACpB,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,MAAG,iBAErC,4CACE,4CACE,SAAS,EAAE,uBACT,QAAQ,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,gBAAgB,CAClD,iBAEF,kCACE,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,IAAI,iBACE,kBAAkB,EAC9B,KAAK,EAAE,KAAK,EACZ,EAAE,EAAE,EAAE,EACN,QAAQ,EAAE,QAAQ,GAClB,EACF,iCAAM,SAAS,EAAC,OAAO,GAAQ,KACzB,EAAC,GAAG,IACR,EACN,yCACE,SAAS,EAAE,iDACT,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAC/B,EACF,OAAO,EAAE,UAAU,gBAElB,KAAK,IACF,KACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,KAAK,CAAC"}
@@ -164,3 +164,13 @@ export interface CheckboxProps {
164
164
  handleChange?: (e: any) => void;
165
165
  value?: string | number;
166
166
  }
167
+ export interface RadioProps {
168
+ id: string;
169
+ name: string;
170
+ label?: string;
171
+ value?: string | number;
172
+ checked?: boolean;
173
+ disabled?: boolean;
174
+ customLabel?: boolean;
175
+ handleChange?: (e: any) => void;
176
+ }
package/dist/index.d.ts CHANGED
@@ -6,6 +6,8 @@ export type { AutoSuggestionInputProps } from "./commontypes";
6
6
  export { default as ExpandableAutoComplete } from "./ExpandableAutoComplete";
7
7
  export { default as ModernAutoComplete } from "./ReactAutoComplete";
8
8
  export { default as ModernCheckBox } from "./ReactCheckbox";
9
+ export { default as ModernOtpInput } from "./ReactOTPInput";
10
+ export { default as ModernRadio } from "./ReactRadioButton";
9
11
  export { default as ModernTextArea } from "./ReactTextArea";
10
12
  export { default as ModernTextField } from "./ReactTextField";
11
13
  export { deepEqual } from "./utilities/deepEqual";
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ToolTip = exports.ExpandableToolTip = exports.deepEqual = exports.ModernTextField = exports.ModernTextArea = exports.ModernCheckBox = exports.ModernAutoComplete = exports.ExpandableAutoComplete = exports.AutoCompleteWithTreeStructure = exports.AutoCompleteWithSelectedList = exports.CustomAutoComplete = exports.AutoComplete = void 0;
6
+ exports.ToolTip = exports.ExpandableToolTip = exports.deepEqual = exports.ModernTextField = exports.ModernTextArea = exports.ModernRadio = exports.ModernOtpInput = exports.ModernCheckBox = exports.ModernAutoComplete = exports.ExpandableAutoComplete = exports.AutoCompleteWithTreeStructure = exports.AutoCompleteWithSelectedList = exports.CustomAutoComplete = exports.AutoComplete = void 0;
7
7
  require("./styles/global.css");
8
8
  var AutoComplete_1 = require("./AutoComplete");
9
9
  Object.defineProperty(exports, "AutoComplete", { enumerable: true, get: function () { return __importDefault(AutoComplete_1).default; } });
@@ -18,6 +18,10 @@ var ReactAutoComplete_1 = require("./ReactAutoComplete");
18
18
  Object.defineProperty(exports, "ModernAutoComplete", { enumerable: true, get: function () { return __importDefault(ReactAutoComplete_1).default; } });
19
19
  var ReactCheckbox_1 = require("./ReactCheckbox");
20
20
  Object.defineProperty(exports, "ModernCheckBox", { enumerable: true, get: function () { return __importDefault(ReactCheckbox_1).default; } });
21
+ var ReactOTPInput_1 = require("./ReactOTPInput");
22
+ Object.defineProperty(exports, "ModernOtpInput", { enumerable: true, get: function () { return __importDefault(ReactOTPInput_1).default; } });
23
+ var ReactRadioButton_1 = require("./ReactRadioButton");
24
+ Object.defineProperty(exports, "ModernRadio", { enumerable: true, get: function () { return __importDefault(ReactRadioButton_1).default; } });
21
25
  var ReactTextArea_1 = require("./ReactTextArea");
22
26
  Object.defineProperty(exports, "ModernTextArea", { enumerable: true, get: function () { return __importDefault(ReactTextArea_1).default; } });
23
27
  var ReactTextField_1 = require("./ReactTextField");
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";;;;;;AAAA,+BAA6B;AAE7B,+CAGwB;AAFtB,6HAAA,OAAO,OAAgB;AACvB,mIAAA,OAAO,OAAsB;AAE/B,+EAAyF;AAAhF,6JAAA,OAAO,OAAgC;AAChD,iFAA2F;AAAlF,+JAAA,OAAO,OAAiC;AAEjD,mEAA6E;AAApE,iJAAA,OAAO,OAA0B;AAC1C,yDAAoE;AAA3D,wIAAA,OAAO,OAAsB;AACtC,iDAA4D;AAAnD,gIAAA,OAAO,OAAkB;AAClC,iDAA4D;AAAnD,gIAAA,OAAO,OAAkB;AAClC,mDAA8D;AAArD,kIAAA,OAAO,OAAmB;AACnC,mDAAkD;AAAzC,sGAAA,SAAS,OAAA;AAClB,qEAA8E;AAArE,wIAAA,OAAO,OAAqB;AACrC,+CAAyD;AAAhD,mHAAA,OAAO,OAAW"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";;;;;;AAAA,+BAA6B;AAE7B,+CAGwB;AAFtB,6HAAA,OAAO,OAAgB;AACvB,mIAAA,OAAO,OAAsB;AAE/B,+EAAyF;AAAhF,6JAAA,OAAO,OAAgC;AAChD,iFAA2F;AAAlF,+JAAA,OAAO,OAAiC;AAEjD,mEAA6E;AAApE,iJAAA,OAAO,OAA0B;AAC1C,yDAAoE;AAA3D,wIAAA,OAAO,OAAsB;AACtC,iDAA4D;AAAnD,gIAAA,OAAO,OAAkB;AAClC,iDAA4D;AAAnD,gIAAA,OAAO,OAAkB;AAClC,uDAA4D;AAAnD,gIAAA,OAAO,OAAe;AAC/B,iDAA4D;AAAnD,gIAAA,OAAO,OAAkB;AAClC,mDAA8D;AAArD,kIAAA,OAAO,OAAmB;AACnC,mDAAkD;AAAzC,sGAAA,SAAS,OAAA;AAClB,qEAA8E;AAArE,wIAAA,OAAO,OAAqB;AACrC,+CAAyD;AAAhD,mHAAA,OAAO,OAAW"}
@@ -0,0 +1,441 @@
1
+ .tooltip-container {
2
+ position: relative;
3
+ transition:
4
+ background-color 0.3s,
5
+ width 0.3s,
6
+ height 0.3s,
7
+ color 0.3s;
8
+ }
9
+
10
+ .bottom {
11
+ .tooltip {
12
+ position: absolute;
13
+ bottom: -40;
14
+ right: 3px;
15
+ transform: translateX(0%);
16
+ padding: 0.3em 0.6em;
17
+ opacity: 0;
18
+ width: max-content;
19
+ max-width: 100%;
20
+ z-index: 999;
21
+ font-size: 12px;
22
+ color: #fff !important;
23
+ pointer-events: none;
24
+ transition: all 0.3s;
25
+ border: 1px solid #e55353;
26
+ background-color: #e55353;
27
+ border-radius: 6px;
28
+ color: rgb(34, 34, 34);
29
+
30
+ &.info {
31
+ color: #ffffff !important;
32
+ border: 1px solid #ffffff;
33
+ background-color: #000000;
34
+ right: 1px;
35
+ top: 5px;
36
+ }
37
+
38
+ &.card {
39
+ color: #ffffff !important;
40
+ border: 1px solid #ffffff;
41
+ background-color: #000000;
42
+ right: -8px;
43
+ top: 5px;
44
+ }
45
+ }
46
+
47
+ .tooltip::before {
48
+ position: absolute;
49
+ content: '';
50
+ height: 0.6em;
51
+ width: 0.6em;
52
+ right: 20px;
53
+ z-index: 999;
54
+ top: -4px;
55
+ border: 1px solid #e55353;
56
+ border-right: none;
57
+ border-bottom: none;
58
+ transform: translate(50%) rotate(45deg);
59
+ background-color: #e55353;
60
+ }
61
+
62
+ .info.tooltip::before {
63
+ border: 1px solid #000000;
64
+ background-color: #000000;
65
+ right: 14px;
66
+ position: absolute;
67
+ content: '';
68
+ height: 0.6em;
69
+ width: 0.6em;
70
+ z-index: 999;
71
+ top: -4px;
72
+ border-right: none;
73
+ border-bottom: none;
74
+ transform: translate(50%) rotate(45deg);
75
+ }
76
+
77
+ .card.tooltip::before {
78
+ border: 1px solid #000000;
79
+ background-color: #000000;
80
+ right: 14px;
81
+ position: absolute;
82
+ content: '';
83
+ height: 0.6em;
84
+ width: 0.6em;
85
+ z-index: 999;
86
+ top: -3px;
87
+ border-right: none;
88
+ border-bottom: none;
89
+ transform: translate(50%) rotate(45deg);
90
+ }
91
+
92
+ .tooltip-container:hover .tooltip {
93
+ top: 46px;
94
+ opacity: 1;
95
+ visibility: visible;
96
+ z-index: 999;
97
+ pointer-events: auto;
98
+
99
+ &.info {
100
+ top: 30px;
101
+ max-width: 500px;
102
+ position: absolute;
103
+ }
104
+
105
+ &.card {
106
+ top: 20px;
107
+ max-width: 300px;
108
+ position: absolute;
109
+ }
110
+ }
111
+ }
112
+ .top-tool {
113
+ .tooltip {
114
+ position: absolute;
115
+ bottom: 45px !important;
116
+ left: 0;
117
+ top: auto !important;
118
+ transform: translateX(0%);
119
+ padding: 0.3em 0.6em;
120
+ opacity: 0;
121
+ width: max-content;
122
+ white-space: normal;
123
+ z-index: 999;
124
+ font-size: 12px;
125
+ max-width: 100%;
126
+ color: #ff681d !important;
127
+ pointer-events: none;
128
+ transition: all 0.3s;
129
+ border: 1px solid #ff681d;
130
+ background-color: #fff;
131
+ border-radius: 6px;
132
+ color: rgb(34, 34, 34);
133
+ }
134
+
135
+ .tooltip::before {
136
+ position: absolute;
137
+ content: '';
138
+ height: 0.6em;
139
+ width: 0.6em;
140
+ z-index: 999;
141
+ bottom: -4px;
142
+ border: 1px solid #ff681d;
143
+ border-left: none;
144
+ border-top: none;
145
+ transform: translate(50%) rotate(45deg);
146
+ background-color: #fff;
147
+ }
148
+
149
+ .tooltip-container:hover .tooltip {
150
+ bottom: 45px !important;
151
+ opacity: 1;
152
+ top: auto !important;
153
+ visibility: visible;
154
+ z-index: 999;
155
+ pointer-events: auto;
156
+ }
157
+ }
158
+ .bottom-tool {
159
+ .tooltip {
160
+ position: absolute;
161
+ bottom: -40;
162
+ transform: translateX(0%);
163
+ padding: 0.3em 0.6em;
164
+ opacity: 0;
165
+ width: max-content;
166
+ max-width: 100%;
167
+ z-index: 999;
168
+ font-size: 12px;
169
+ color: #ff681d !important;
170
+ white-space: wrap;
171
+ pointer-events: none;
172
+ transition:
173
+ background-color 0.3s,
174
+ width 0.3s,
175
+ height 0.3s,
176
+ color 0.3s;
177
+ border: 1px solid #ff681d;
178
+ background-color: #fff;
179
+ border-radius: 6px;
180
+ color: rgb(34, 34, 34);
181
+ }
182
+
183
+ .tooltip::before {
184
+ position: absolute;
185
+ content: '';
186
+ height: 0.6em;
187
+ width: 0.6em;
188
+ z-index: 999;
189
+ top: -4px;
190
+ border: 1px solid #ff681d;
191
+ border-right: none;
192
+ border-bottom: none;
193
+ transform: translate(50%) rotate(45deg);
194
+ background-color: #fff;
195
+ }
196
+
197
+ .tooltip-container:hover .tooltip {
198
+ top: 46px;
199
+ opacity: 1;
200
+ visibility: visible;
201
+ z-index: 999;
202
+ pointer-events: auto;
203
+ }
204
+ }
205
+
206
+ .right {
207
+ .tooltip {
208
+ position: absolute;
209
+ top: 2.5px;
210
+ left: calc(100% + 9px);
211
+ transform: translateX(0%);
212
+ padding: 8px;
213
+ opacity: 0;
214
+ min-width: 200px;
215
+ max-width: 200px;
216
+ min-height: calc(100% - 16px);
217
+ height: auto;
218
+ z-index: 999;
219
+ font-size: 12px;
220
+ color: #fff !important;
221
+ pointer-events: none;
222
+ transition:
223
+ background-color 0.3s,
224
+ width 0.3s,
225
+ height 0.3s,
226
+ color 0.3s;
227
+ border: 1px solid #e55353;
228
+ background-color: #e55353;
229
+ border-radius: 6px;
230
+ color: rgb(34, 34, 34);
231
+ }
232
+
233
+ .tooltip-card {
234
+ padding: 3px 10px 4px;
235
+ top: -4px;
236
+ min-width: 175px;
237
+ background-color: #3d414a;
238
+ border: 1px solid #3d414a;
239
+
240
+ }
241
+
242
+ .tooltip::before {
243
+ position: absolute;
244
+ content: '';
245
+ height: 0.6em;
246
+ width: 0.6em;
247
+ left: -8px;
248
+ top: 14px;
249
+ z-index: 999;
250
+ transform: translateY(10px);
251
+ border: 1px solid #e55353;
252
+ border-top: none;
253
+ border-right: none;
254
+ transform: translate(50%) rotate(45deg);
255
+ background-color: #e55353;
256
+ }
257
+
258
+ .tooltip-card::before {
259
+ top: 8px;
260
+ background-color: #3d414a;
261
+ border: 1px solid #3d414a;
262
+ }
263
+
264
+ .tooltip-container:hover {
265
+ .tooltip {
266
+ top: 2.5px;
267
+ opacity: 1;
268
+ visibility: visible;
269
+ z-index: 999;
270
+ pointer-events: auto;
271
+ }
272
+
273
+ .tooltip-card {
274
+ top: -4px;
275
+ }
276
+ }
277
+ }
278
+
279
+ .left {
280
+ .tooltip {
281
+ position: absolute;
282
+ top: 2.5px;
283
+ right: calc(100% + 9px);
284
+ transform: translateX(0%);
285
+ padding: 8px;
286
+ opacity: 0;
287
+ min-width: 200px;
288
+ max-width: 200px;
289
+ min-height: calc(100% - 16px);
290
+ z-index: 999;
291
+ font-size: 12px;
292
+ color: #fff !important;
293
+ pointer-events: none;
294
+ transition:
295
+ background-color 0.3s,
296
+ width 0.3s,
297
+ height 0.3s,
298
+ color 0.3s;
299
+ border: 1px solid #e55353;
300
+ background-color: #e55353;
301
+ border-radius: 6px;
302
+ color: rgb(34, 34, 34);
303
+ }
304
+
305
+ .tooltip::before {
306
+ position: absolute;
307
+ content: '';
308
+ height: 0.6em;
309
+ width: 0.6em;
310
+ right: 0px;
311
+ top: 14px;
312
+ z-index: 999;
313
+ transform: translateY(10px);
314
+ border: 1px solid #e55353;
315
+ border-bottom: none;
316
+ border-left: none;
317
+ transform: translate(50%) rotate(45deg);
318
+ background-color: #e55353;
319
+ }
320
+
321
+ .tooltip-container:hover .tooltip {
322
+ top: 2.5px;
323
+ opacity: 1;
324
+ visibility: visible;
325
+ z-index: 999;
326
+ pointer-events: auto;
327
+ }
328
+ }
329
+
330
+ .top {
331
+ .tooltip {
332
+ position: absolute;
333
+ top: -40;
334
+ left: 0;
335
+ transform: translateX(0%);
336
+ padding: 0.3em 0.6em;
337
+ opacity: 0;
338
+ width: 100%;
339
+ z-index: 999;
340
+ font-size: 12px;
341
+ color: #fff !important;
342
+ pointer-events: none;
343
+ transition:
344
+ background-color 0.3s,
345
+ width 0.3s,
346
+ height 0.3s,
347
+ color 0.3s;
348
+ border: 1px solid #e55353;
349
+ background-color: #e55353;
350
+ border-radius: 6px;
351
+ color: rgb(34, 34, 34);
352
+ }
353
+
354
+ .tooltip::before {
355
+ position: absolute;
356
+ content: '';
357
+ height: 0.6em;
358
+ width: 0.6em;
359
+ right: 20px;
360
+ z-index: 999;
361
+ bottom: -4px;
362
+ border: 1px solid #e55353;
363
+ border-left: none;
364
+ border-top: none;
365
+ transform: translate(50%) rotate(45deg);
366
+ background-color: #e55353;
367
+ }
368
+
369
+ .tooltip-container:hover .tooltip {
370
+ top: -40px;
371
+ opacity: 1;
372
+ visibility: visible;
373
+ z-index: 999;
374
+ pointer-events: auto;
375
+ }
376
+ }
377
+
378
+ .custom-tooltip-container {
379
+ position: relative;
380
+ display: inline-block;
381
+ }
382
+
383
+ .custom-text {
384
+ font-size: 18px;
385
+ cursor: pointer;
386
+ }
387
+
388
+ .custom-tooltip {
389
+ position: absolute;
390
+ top: 100%;
391
+ left: 20%;
392
+ opacity: 0;
393
+ visibility: hidden;
394
+ font-size: 12px;
395
+ background: #deefff;
396
+ border-color: #bee0ff;
397
+ padding: 5px;
398
+ align-items: center;
399
+ transition:
400
+ opacity 0.3s,
401
+ visibility 0.3s,
402
+ top 0.3s,
403
+ background 0.3s;
404
+ z-index: 1;
405
+ }
406
+
407
+ .custom-tooltip::before {
408
+ content: '';
409
+ position: absolute;
410
+ bottom: 100%;
411
+ left: 20%;
412
+ /* Center the arrow */
413
+ border-width: 9px;
414
+ /* Slightly larger to act as border */
415
+ border-style: solid;
416
+ border-color: transparent transparent #bee0ff transparent;
417
+ /* Border color */
418
+ transform: translateX(-20%);
419
+ z-index: -1;
420
+ /* Ensure it's behind the ::after pseudo-element */
421
+ }
422
+
423
+ .custom-tooltip::after {
424
+ content: '';
425
+ position: absolute;
426
+ bottom: 100%;
427
+ left: 20%;
428
+ border-width: 8px;
429
+ border-style: solid;
430
+ border-color: transparent transparent #deefff transparent;
431
+ transform: translateX(-20%);
432
+ z-index: 1;
433
+ }
434
+
435
+ .custom-tooltip-container:hover .custom-tooltip {
436
+ top: 100%;
437
+ opacity: 1;
438
+ visibility: visible;
439
+ background: #deefff;
440
+ transform: translate(-20%, 10px);
441
+ }