mytek-components 2.1.3 → 2.1.6
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/main.es.js +788 -186
- package/dist/main.es.js.map +1 -1
- package/dist/main.umd.js +788 -186
- package/dist/main.umd.js.map +1 -1
- package/package.json +3 -3
package/dist/main.umd.js
CHANGED
|
@@ -530,40 +530,44 @@
|
|
|
530
530
|
children,
|
|
531
531
|
onClick,
|
|
532
532
|
fontSize = "16px",
|
|
533
|
-
color: color2 = "#
|
|
534
|
-
backgroundColor: backgroundColor2 = "#
|
|
533
|
+
color: color2 = "#fff",
|
|
534
|
+
backgroundColor: backgroundColor2 = "#3B5AA1",
|
|
535
|
+
hoverBackgroundColor = "#2F4B8A",
|
|
536
|
+
disabledBackgroundColor = "#9CA3AF",
|
|
537
|
+
// gray-400
|
|
538
|
+
disabledTextColor = "#E5E7EB",
|
|
539
|
+
// gray-200
|
|
535
540
|
height: height2 = "40px",
|
|
536
|
-
width: width2 = "
|
|
541
|
+
width: width2 = "auto",
|
|
537
542
|
border: border2 = "none",
|
|
538
|
-
borderRadius: borderRadius2 = "
|
|
539
|
-
padding: padding2 = "10px
|
|
540
|
-
fontWeight = "
|
|
541
|
-
style: style2 = {},
|
|
543
|
+
borderRadius: borderRadius2 = "6px",
|
|
544
|
+
padding: padding2 = "10px 16px",
|
|
545
|
+
fontWeight = "500",
|
|
542
546
|
loader = false,
|
|
543
547
|
disabled = false,
|
|
548
|
+
style: style2 = {},
|
|
544
549
|
...rest
|
|
545
550
|
}) => {
|
|
546
551
|
const isDisabled = loader || disabled;
|
|
547
552
|
const className = clsx(
|
|
548
|
-
"flex items-center justify-center transition-
|
|
553
|
+
"flex items-center justify-center transition-all duration-200 overflow-hidden",
|
|
549
554
|
{
|
|
550
555
|
"cursor-not-allowed opacity-60": isDisabled,
|
|
551
|
-
"cursor-pointer": !isDisabled
|
|
556
|
+
"cursor-pointer hover:brightness-110 active:scale-[0.98]": !isDisabled
|
|
552
557
|
},
|
|
553
558
|
rest.className
|
|
554
|
-
// ✅ allow external Tailwind className overrides
|
|
555
559
|
);
|
|
556
560
|
const buttonStyle = {
|
|
557
561
|
fontSize,
|
|
558
|
-
color: color2,
|
|
559
|
-
backgroundColor: backgroundColor2,
|
|
562
|
+
color: isDisabled ? disabledTextColor : color2,
|
|
563
|
+
backgroundColor: isDisabled ? disabledBackgroundColor : backgroundColor2,
|
|
560
564
|
height: height2,
|
|
561
|
-
// ✅ Only apply width if w-full is NOT passed via className
|
|
562
565
|
width: rest.className?.includes("w-full") ? void 0 : width2,
|
|
563
566
|
border: border2,
|
|
564
567
|
borderRadius: borderRadius2,
|
|
565
568
|
padding: padding2,
|
|
566
569
|
fontWeight,
|
|
570
|
+
cursor: isDisabled ? "not-allowed" : "pointer",
|
|
567
571
|
...style2
|
|
568
572
|
};
|
|
569
573
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -573,8 +577,14 @@
|
|
|
573
577
|
disabled: isDisabled,
|
|
574
578
|
className,
|
|
575
579
|
style: buttonStyle,
|
|
580
|
+
onMouseEnter: (e) => {
|
|
581
|
+
if (!isDisabled) e.currentTarget.style.backgroundColor = hoverBackgroundColor;
|
|
582
|
+
},
|
|
583
|
+
onMouseLeave: (e) => {
|
|
584
|
+
if (!isDisabled) e.currentTarget.style.backgroundColor = backgroundColor2;
|
|
585
|
+
},
|
|
576
586
|
...rest,
|
|
577
|
-
children: loader ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { inline: true }) : label || children
|
|
587
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate w-full", children: loader ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { inline: true }) : label || children })
|
|
578
588
|
}
|
|
579
589
|
);
|
|
580
590
|
};
|
|
@@ -12597,7 +12607,7 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
|
|
|
12597
12607
|
}
|
|
12598
12608
|
var E, T, I, A = Array.prototype, D = Function.prototype, P = Object.prototype, F = b["__core-js_shared__"], M = (E = /[^.]+$/.exec(F && F.keys && F.keys.IE_PROTO || "")) ? "Symbol(src)_1." + E : "", R = D.toString, L = P.hasOwnProperty, z = P.toString, B = RegExp("^" + R.call(L).replace(/[\\^$.*+?()[\]{}|]/g, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"), G = b.Symbol, $ = b.Uint8Array, V = P.propertyIsEnumerable, K = A.splice, U = (T = Object.keys, I = Object, function(e3) {
|
|
12599
12609
|
return T(I(e3));
|
|
12600
|
-
}), q = Ne(b, "DataView"), H = Ne(b, "Map"), W = Ne(b, "Promise"), J = Ne(b, "Set"), Z = Ne(b, "WeakMap"), Q = Ne(Object, "create"), Y = Pe(q),
|
|
12610
|
+
}), q = Ne(b, "DataView"), H = Ne(b, "Map"), W = Ne(b, "Promise"), J = Ne(b, "Set"), Z = Ne(b, "WeakMap"), Q = Ne(Object, "create"), Y = Pe(q), X2 = Pe(H), ee = Pe(W), te = Pe(J), re = Pe(Z), ne = G ? G.prototype : void 0, ae = ne ? ne.valueOf : void 0, oe = ne ? ne.toString : void 0;
|
|
12601
12611
|
function ie(e3) {
|
|
12602
12612
|
var t2 = -1, r4 = e3 ? e3.length : 0;
|
|
12603
12613
|
for (this.clear(); ++t2 < r4; ) {
|
|
@@ -12935,7 +12945,7 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
|
|
|
12935
12945
|
if (n2) switch (n2) {
|
|
12936
12946
|
case Y:
|
|
12937
12947
|
return "[object DataView]";
|
|
12938
|
-
case
|
|
12948
|
+
case X2:
|
|
12939
12949
|
return a;
|
|
12940
12950
|
case ee:
|
|
12941
12951
|
return "[object Promise]";
|
|
@@ -13990,7 +14000,11 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
|
|
|
13990
14000
|
onValidationChange,
|
|
13991
14001
|
// color,
|
|
13992
14002
|
showTimer,
|
|
13993
|
-
timer
|
|
14003
|
+
timer,
|
|
14004
|
+
minValue,
|
|
14005
|
+
maxValue,
|
|
14006
|
+
stepValue,
|
|
14007
|
+
wrapperClassName
|
|
13994
14008
|
}) => {
|
|
13995
14009
|
const [countryCode, setCountryCode] = React.useState("IN");
|
|
13996
14010
|
const [nationalNumber, setNationalNumber] = React.useState("");
|
|
@@ -14003,7 +14017,6 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
|
|
|
14003
14017
|
validate(value);
|
|
14004
14018
|
}
|
|
14005
14019
|
}, [value]);
|
|
14006
|
-
console.log(enable);
|
|
14007
14020
|
const validate = (val) => {
|
|
14008
14021
|
const raw = category === "amount" ? removeCommas(val) : val;
|
|
14009
14022
|
if (!isRequired && !val) {
|
|
@@ -14226,7 +14239,6 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
|
|
|
14226
14239
|
const handleChange = (e) => {
|
|
14227
14240
|
let val;
|
|
14228
14241
|
if (category == "mobile") {
|
|
14229
|
-
console.log(e);
|
|
14230
14242
|
val = e;
|
|
14231
14243
|
validate(val);
|
|
14232
14244
|
} else {
|
|
@@ -14317,20 +14329,9 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
|
|
|
14317
14329
|
}
|
|
14318
14330
|
const nationalNumber1 = parsed.nationalNumber || "";
|
|
14319
14331
|
setNationalNumber(nationalNumber1);
|
|
14320
|
-
console.log(nationalNumber);
|
|
14321
14332
|
const { length, startsWith } = rules;
|
|
14322
14333
|
const callingCodeLength = country.dialCode.length;
|
|
14323
14334
|
const maxTotalLength = callingCodeLength + length;
|
|
14324
|
-
console.log(
|
|
14325
|
-
value2,
|
|
14326
|
-
value2.length,
|
|
14327
|
-
maxTotalLength,
|
|
14328
|
-
length,
|
|
14329
|
-
nationalNumber.length,
|
|
14330
|
-
startsWith,
|
|
14331
|
-
startsWith.test(nationalNumber),
|
|
14332
|
-
"len"
|
|
14333
|
-
);
|
|
14334
14335
|
if (value2.length > maxTotalLength) {
|
|
14335
14336
|
setError("Invalid phone number for selected country");
|
|
14336
14337
|
setEnable(true);
|
|
@@ -14377,7 +14378,7 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
|
|
|
14377
14378
|
prefix && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
14378
14379
|
InputGroup.Text,
|
|
14379
14380
|
{
|
|
14380
|
-
style: { backgroundColor: "#fff", borderColor: "#
|
|
14381
|
+
style: { backgroundColor: "#fff", borderColor: "#3B5AA1" },
|
|
14381
14382
|
children: prefix
|
|
14382
14383
|
}
|
|
14383
14384
|
),
|
|
@@ -14386,107 +14387,138 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
|
|
|
14386
14387
|
{
|
|
14387
14388
|
placement: "top",
|
|
14388
14389
|
overlay: isAmount && amountInWords && (currency === "₹" || currency === "$") ? /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { id: `${name}-tooltip`, children: amountInWords }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
|
|
14389
|
-
children: category === "mobile" ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
14390
|
-
|
|
14391
|
-
|
|
14392
|
-
|
|
14393
|
-
|
|
14394
|
-
|
|
14395
|
-
|
|
14396
|
-
|
|
14397
|
-
|
|
14398
|
-
|
|
14399
|
-
|
|
14400
|
-
|
|
14401
|
-
|
|
14402
|
-
|
|
14403
|
-
|
|
14404
|
-
|
|
14405
|
-
|
|
14406
|
-
|
|
14407
|
-
|
|
14408
|
-
|
|
14409
|
-
|
|
14410
|
-
|
|
14411
|
-
|
|
14412
|
-
|
|
14413
|
-
|
|
14414
|
-
|
|
14415
|
-
|
|
14416
|
-
|
|
14417
|
-
|
|
14418
|
-
|
|
14419
|
-
|
|
14420
|
-
|
|
14421
|
-
|
|
14422
|
-
|
|
14423
|
-
|
|
14424
|
-
|
|
14425
|
-
|
|
14426
|
-
|
|
14427
|
-
|
|
14428
|
-
|
|
14429
|
-
|
|
14430
|
-
|
|
14431
|
-
|
|
14432
|
-
|
|
14433
|
-
|
|
14434
|
-
|
|
14435
|
-
|
|
14436
|
-
|
|
14437
|
-
|
|
14438
|
-
|
|
14439
|
-
|
|
14440
|
-
|
|
14441
|
-
|
|
14442
|
-
|
|
14443
|
-
|
|
14444
|
-
|
|
14445
|
-
|
|
14446
|
-
|
|
14447
|
-
|
|
14448
|
-
|
|
14449
|
-
|
|
14450
|
-
|
|
14451
|
-
|
|
14452
|
-
|
|
14453
|
-
|
|
14454
|
-
|
|
14455
|
-
|
|
14456
|
-
|
|
14457
|
-
|
|
14458
|
-
|
|
14459
|
-
|
|
14460
|
-
|
|
14461
|
-
|
|
14462
|
-
|
|
14463
|
-
|
|
14464
|
-
|
|
14465
|
-
|
|
14466
|
-
|
|
14467
|
-
|
|
14468
|
-
|
|
14469
|
-
|
|
14470
|
-
|
|
14471
|
-
|
|
14472
|
-
|
|
14473
|
-
|
|
14474
|
-
|
|
14475
|
-
|
|
14476
|
-
|
|
14477
|
-
|
|
14478
|
-
|
|
14479
|
-
|
|
14480
|
-
|
|
14481
|
-
|
|
14482
|
-
|
|
14483
|
-
|
|
14484
|
-
|
|
14485
|
-
|
|
14486
|
-
|
|
14487
|
-
|
|
14488
|
-
|
|
14489
|
-
|
|
14390
|
+
children: category === "mobile" ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
14391
|
+
"div",
|
|
14392
|
+
{
|
|
14393
|
+
className: `
|
|
14394
|
+
flex items-center w-full
|
|
14395
|
+
rounded-md
|
|
14396
|
+
transition-all duration-200
|
|
14397
|
+
border border-[1px]
|
|
14398
|
+
${disabled ? "border-gray-300 bg-gray-100 cursor-not-allowed" : "border-[#3B5AA1] focus-within:ring-1 focus-within:ring-[#3B5AA1] focus-within:border-[#3B5AA1]"}
|
|
14399
|
+
${wrapperClassName || ""}
|
|
14400
|
+
`,
|
|
14401
|
+
children: [
|
|
14402
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
14403
|
+
PhoneInput,
|
|
14404
|
+
{
|
|
14405
|
+
value,
|
|
14406
|
+
onChange: (value2, country) => handlePhoneChange(value2, country),
|
|
14407
|
+
country: countryCode.toLowerCase(),
|
|
14408
|
+
enableLongNumbers: false,
|
|
14409
|
+
disableDropdown: false,
|
|
14410
|
+
countryCodeEditable: false,
|
|
14411
|
+
inputProps: { autoComplete: "off" },
|
|
14412
|
+
containerStyle: { width: "100%" },
|
|
14413
|
+
disabled,
|
|
14414
|
+
inputStyle: {
|
|
14415
|
+
width: "100%",
|
|
14416
|
+
height: "40px",
|
|
14417
|
+
fontSize: "14px",
|
|
14418
|
+
paddingLeft: "48px",
|
|
14419
|
+
// leave space for flag
|
|
14420
|
+
border: "none",
|
|
14421
|
+
backgroundColor: disabled ? "#f1f1f1" : "#fff",
|
|
14422
|
+
// ✅ gray when disabled
|
|
14423
|
+
color: disabled ? "#6c757d" : "#000",
|
|
14424
|
+
// ✅ muted text when disabled
|
|
14425
|
+
cursor: disabled ? "not-allowed" : "text"
|
|
14426
|
+
// ✅ show disabled cursor
|
|
14427
|
+
},
|
|
14428
|
+
buttonStyle: {
|
|
14429
|
+
borderRight: "1px solid #3B5AA1",
|
|
14430
|
+
backgroundColor: disabled ? "#f1f1f1" : "#fff",
|
|
14431
|
+
// ✅ gray when disabled
|
|
14432
|
+
borderRadius: "0.375rem 0 0 0.375rem",
|
|
14433
|
+
cursor: disabled ? "not-allowed" : "pointer"
|
|
14434
|
+
},
|
|
14435
|
+
dropdownClass: "z-50 mt-1 bg-white border border-gray-300 rounded-md text-sm max-h-60 overflow-y-auto shadow-lg"
|
|
14436
|
+
}
|
|
14437
|
+
),
|
|
14438
|
+
button?.label && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
14439
|
+
"button",
|
|
14440
|
+
{
|
|
14441
|
+
type: "button",
|
|
14442
|
+
onClick: button.onClick,
|
|
14443
|
+
disabled: button.disabled || enable,
|
|
14444
|
+
className: `px-4 py-2 text-white ${backgroundColor2 || "bg-[#3B5AA1]"} border-l border-[#3B5AA1] rounded-r-md ${button.disabled || enable ? "opacity-50 cursor-not-allowed" : ""}`,
|
|
14445
|
+
style: { height: height2 },
|
|
14446
|
+
children: button.loader ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { inline: true }) : button.label
|
|
14447
|
+
}
|
|
14448
|
+
)
|
|
14449
|
+
]
|
|
14450
|
+
}
|
|
14451
|
+
) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
14452
|
+
"div",
|
|
14453
|
+
{
|
|
14454
|
+
className: `
|
|
14455
|
+
flex items-center
|
|
14456
|
+
overflow-hidden
|
|
14457
|
+
rounded-md
|
|
14458
|
+
transition-all duration-200
|
|
14459
|
+
|
|
14460
|
+
${disabled ? "border border-gray-300 bg-gray-100 cursor-not-allowed" : "border border-[#3B5AA1] focus-within:border-[#3B5AA1] focus-within:ring-1 focus-within:ring-[#3B5AA1]"}
|
|
14461
|
+
|
|
14462
|
+
${wrapperClassName || ""}
|
|
14463
|
+
`,
|
|
14464
|
+
children: [
|
|
14465
|
+
prefix && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "px-2 bg-white text-gray-700 border-r border-[#3B5AA1]", children: prefix }),
|
|
14466
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
14467
|
+
"input",
|
|
14468
|
+
{
|
|
14469
|
+
type: isPassword ? showPassword ? "text" : "password" : type,
|
|
14470
|
+
name,
|
|
14471
|
+
value,
|
|
14472
|
+
onChange: handleChange,
|
|
14473
|
+
disabled,
|
|
14474
|
+
placeholder,
|
|
14475
|
+
className: `flex-1 px-2 py-2 focus:outline-none ${disabled ? "bg-gray-100 cursor-not-allowed text-gray-500" : ""}`,
|
|
14476
|
+
style: {
|
|
14477
|
+
height: height2,
|
|
14478
|
+
backgroundColor: disabled ? "#f1f1f1" : void 0,
|
|
14479
|
+
color: disabled ? "#6c757d" : void 0
|
|
14480
|
+
},
|
|
14481
|
+
min: minValue,
|
|
14482
|
+
max: maxValue,
|
|
14483
|
+
step: stepValue
|
|
14484
|
+
}
|
|
14485
|
+
),
|
|
14486
|
+
suffix && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "px-2 bg-white text-gray-700 border-l border-[#3B5AA1]", children: suffix }),
|
|
14487
|
+
!error && showTimer && /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
14488
|
+
"span",
|
|
14489
|
+
{
|
|
14490
|
+
className: `flex items-center gap-1 justify-center h-[40px] min-w-[60px] px-2 ml-1 rounded text-sm
|
|
14491
|
+
${validationStatus === "valid" ? "text-green-600 bg-gray-100" : validationStatus === "invalid" ? "text-red-600" : "text-gray-600 bg-gray-100"}`,
|
|
14492
|
+
title: validationStatus === "valid" ? "Correct OTP" : validationStatus === "invalid" ? "Incorrect OTP" : "OTP Timer",
|
|
14493
|
+
children: [
|
|
14494
|
+
validationStatus === "valid" && /* @__PURE__ */ jsxRuntimeExports.jsx(FaCheck, { size: 18 }),
|
|
14495
|
+
validationStatus === "invalid" && /* @__PURE__ */ jsxRuntimeExports.jsx(IoMdClose, { size: 18 }),
|
|
14496
|
+
typeof timer === "number" && validationStatus !== "valid" && `${timer}s`
|
|
14497
|
+
]
|
|
14498
|
+
}
|
|
14499
|
+
),
|
|
14500
|
+
isPassword && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
14501
|
+
"button",
|
|
14502
|
+
{
|
|
14503
|
+
type: "button",
|
|
14504
|
+
onClick: () => setShowPassword(!showPassword),
|
|
14505
|
+
className: "px-2 bg-white text-gray-500 border-l border-[#3B5AA1]",
|
|
14506
|
+
children: showPassword ? /* @__PURE__ */ jsxRuntimeExports.jsx(FiEye, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(FiEyeOff, {})
|
|
14507
|
+
}
|
|
14508
|
+
),
|
|
14509
|
+
button?.label && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
14510
|
+
"button",
|
|
14511
|
+
{
|
|
14512
|
+
onClick: button?.onClick,
|
|
14513
|
+
disabled: disabled || enable,
|
|
14514
|
+
className: `px-2 py-2 text-white ${backgroundColor2 || "bg-[#3B5AA1]"} border-l border-[#3B5AA1] rounded-r-md ${disabled || enable ? "opacity-50 cursor-not-allowed" : ""}`,
|
|
14515
|
+
style: { height: height2 },
|
|
14516
|
+
children: button.loader ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { inline: true }) : button.label
|
|
14517
|
+
}
|
|
14518
|
+
)
|
|
14519
|
+
]
|
|
14520
|
+
}
|
|
14521
|
+
)
|
|
14490
14522
|
}
|
|
14491
14523
|
)
|
|
14492
14524
|
] }),
|
|
@@ -15788,11 +15820,18 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
|
|
|
15788
15820
|
centered = false,
|
|
15789
15821
|
scrollButtons = "auto",
|
|
15790
15822
|
indicatorColor = "primary",
|
|
15791
|
-
textColor = "primary"
|
|
15823
|
+
textColor = "primary",
|
|
15824
|
+
handleTabChange,
|
|
15825
|
+
tabIndex
|
|
15792
15826
|
}) {
|
|
15793
|
-
const [value, setValue] = React.useState(defaultValue);
|
|
15827
|
+
const [value, setValue] = React.useState(tabIndex || defaultValue);
|
|
15828
|
+
React.useEffect(() => {
|
|
15829
|
+
const setUpVal = tabs.length - 1 >= tabIndex ? tabIndex : tabs.length - 1;
|
|
15830
|
+
setValue(setUpVal);
|
|
15831
|
+
}, [tabIndex]);
|
|
15794
15832
|
const handleChange = (event, newValue) => {
|
|
15795
15833
|
setValue(newValue);
|
|
15834
|
+
handleTabChange(newValue);
|
|
15796
15835
|
};
|
|
15797
15836
|
const getTabsStyles = () => {
|
|
15798
15837
|
const baseStyles = "w-full";
|
|
@@ -16415,13 +16454,20 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
|
|
|
16415
16454
|
Component.displayName = toPascalCase(iconName);
|
|
16416
16455
|
return Component;
|
|
16417
16456
|
};
|
|
16418
|
-
const __iconNode$
|
|
16457
|
+
const __iconNode$6 = [
|
|
16458
|
+
["path", { d: "M8 2v4", key: "1cmpym" }],
|
|
16459
|
+
["path", { d: "M16 2v4", key: "4m81vk" }],
|
|
16460
|
+
["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
|
|
16461
|
+
["path", { d: "M3 10h18", key: "8toen8" }]
|
|
16462
|
+
];
|
|
16463
|
+
const Calendar = createLucideIcon("calendar", __iconNode$6);
|
|
16464
|
+
const __iconNode$5 = [
|
|
16419
16465
|
["path", { d: "M12 15V3", key: "m9g1x1" }],
|
|
16420
16466
|
["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
|
|
16421
16467
|
["path", { d: "m7 10 5 5 5-5", key: "brsn70" }]
|
|
16422
16468
|
];
|
|
16423
|
-
const Download = createLucideIcon("download", __iconNode$
|
|
16424
|
-
const __iconNode$
|
|
16469
|
+
const Download = createLucideIcon("download", __iconNode$5);
|
|
16470
|
+
const __iconNode$4 = [
|
|
16425
16471
|
[
|
|
16426
16472
|
"path",
|
|
16427
16473
|
{
|
|
@@ -16430,28 +16476,33 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
|
|
|
16430
16476
|
}
|
|
16431
16477
|
]
|
|
16432
16478
|
];
|
|
16433
|
-
const Funnel = createLucideIcon("funnel", __iconNode$
|
|
16434
|
-
const __iconNode$
|
|
16479
|
+
const Funnel = createLucideIcon("funnel", __iconNode$4);
|
|
16480
|
+
const __iconNode$3 = [
|
|
16435
16481
|
["path", { d: "m8 11 2 2 4-4", key: "1sed1v" }],
|
|
16436
16482
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
|
16437
16483
|
["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
|
|
16438
16484
|
];
|
|
16439
|
-
const SearchCheck = createLucideIcon("search-check", __iconNode$
|
|
16440
|
-
const __iconNode$
|
|
16485
|
+
const SearchCheck = createLucideIcon("search-check", __iconNode$3);
|
|
16486
|
+
const __iconNode$2 = [
|
|
16441
16487
|
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
|
|
16442
16488
|
["line", { x1: "3", x2: "21", y1: "9", y2: "9", key: "1vqk6q" }],
|
|
16443
16489
|
["line", { x1: "3", x2: "21", y1: "15", y2: "15", key: "o2sbyz" }],
|
|
16444
16490
|
["line", { x1: "9", x2: "9", y1: "9", y2: "21", key: "1ib60c" }],
|
|
16445
16491
|
["line", { x1: "15", x2: "15", y1: "9", y2: "21", key: "1n26ft" }]
|
|
16446
16492
|
];
|
|
16447
|
-
const Sheet = createLucideIcon("sheet", __iconNode$
|
|
16448
|
-
const __iconNode = [
|
|
16493
|
+
const Sheet = createLucideIcon("sheet", __iconNode$2);
|
|
16494
|
+
const __iconNode$1 = [
|
|
16449
16495
|
["path", { d: "M12 3v18", key: "108xh3" }],
|
|
16450
16496
|
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
16451
16497
|
["path", { d: "M3 9h18", key: "1pudct" }],
|
|
16452
16498
|
["path", { d: "M3 15h18", key: "5xshup" }]
|
|
16453
16499
|
];
|
|
16454
|
-
const Table = createLucideIcon("table", __iconNode);
|
|
16500
|
+
const Table = createLucideIcon("table", __iconNode$1);
|
|
16501
|
+
const __iconNode = [
|
|
16502
|
+
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
16503
|
+
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
16504
|
+
];
|
|
16505
|
+
const X = createLucideIcon("x", __iconNode);
|
|
16455
16506
|
var weekOfYear$1 = { exports: {} };
|
|
16456
16507
|
var weekOfYear = weekOfYear$1.exports;
|
|
16457
16508
|
var hasRequiredWeekOfYear;
|
|
@@ -17794,9 +17845,41 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
|
|
|
17794
17845
|
};
|
|
17795
17846
|
}
|
|
17796
17847
|
if (col.TotTyp) {
|
|
17797
|
-
column.Footer = () => {
|
|
17798
|
-
const
|
|
17799
|
-
if (
|
|
17848
|
+
column.Footer = ({ table }) => {
|
|
17849
|
+
const rows = table.getFilteredRowModel().rows;
|
|
17850
|
+
if (!rows.length) return "";
|
|
17851
|
+
let count = 0;
|
|
17852
|
+
let sum = 0;
|
|
17853
|
+
let min2 = Infinity;
|
|
17854
|
+
let max2 = -Infinity;
|
|
17855
|
+
for (const row of rows) {
|
|
17856
|
+
const val = Number(row.original[col.ColFields]);
|
|
17857
|
+
if (isNaN(val)) continue;
|
|
17858
|
+
count++;
|
|
17859
|
+
sum += val;
|
|
17860
|
+
min2 = Math.min(min2, val);
|
|
17861
|
+
max2 = Math.max(max2, val);
|
|
17862
|
+
}
|
|
17863
|
+
let value;
|
|
17864
|
+
switch (col.TotTyp) {
|
|
17865
|
+
case "SUM":
|
|
17866
|
+
value = sum;
|
|
17867
|
+
break;
|
|
17868
|
+
case "AVG":
|
|
17869
|
+
value = count ? sum / count : 0;
|
|
17870
|
+
break;
|
|
17871
|
+
case "MIN":
|
|
17872
|
+
value = count ? min2 : "";
|
|
17873
|
+
break;
|
|
17874
|
+
case "MAX":
|
|
17875
|
+
value = count ? max2 : "";
|
|
17876
|
+
break;
|
|
17877
|
+
case "COUNT":
|
|
17878
|
+
value = count;
|
|
17879
|
+
break;
|
|
17880
|
+
default:
|
|
17881
|
+
return "";
|
|
17882
|
+
}
|
|
17800
17883
|
if (isNumericColumn && col.IsPercentage) {
|
|
17801
17884
|
return formatPercentage({
|
|
17802
17885
|
value,
|
|
@@ -17837,6 +17920,7 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
|
|
|
17837
17920
|
colPinning: true,
|
|
17838
17921
|
pagination: true,
|
|
17839
17922
|
rowSelection: false,
|
|
17923
|
+
enableSelectAllRows: true,
|
|
17840
17924
|
rowPinning: false,
|
|
17841
17925
|
grouping: false,
|
|
17842
17926
|
sorting: true,
|
|
@@ -17853,7 +17937,8 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
|
|
|
17853
17937
|
topToolbar = defaultToolBarOpt,
|
|
17854
17938
|
controls = defaultControlOpt,
|
|
17855
17939
|
onRowSelectionChange,
|
|
17856
|
-
isLoading = false
|
|
17940
|
+
isLoading = false,
|
|
17941
|
+
resetRowSelection
|
|
17857
17942
|
}) {
|
|
17858
17943
|
const safeColumns = React.useMemo(
|
|
17859
17944
|
() => sanitizeColumns(columns),
|
|
@@ -17865,6 +17950,9 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
|
|
|
17865
17950
|
);
|
|
17866
17951
|
const [rowSelection, setRowSelection] = React.useState({});
|
|
17867
17952
|
const isMobile = material.useMediaQuery("(max-width:600px)");
|
|
17953
|
+
React.useEffect(() => {
|
|
17954
|
+
setRowSelection({});
|
|
17955
|
+
}, [resetRowSelection]);
|
|
17868
17956
|
const mergedTheme = { ...DEFAULT_THEME, ...theme };
|
|
17869
17957
|
topToolbar = { ...defaultToolBarOpt, ...topToolbar };
|
|
17870
17958
|
controls = { ...defaultControlOpt, ...controls };
|
|
@@ -17942,7 +18030,7 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
|
|
|
17942
18030
|
const finalColumns = React.useMemo(() => {
|
|
17943
18031
|
if (safeColumns.length === 0) return [];
|
|
17944
18032
|
return safeColumns.sort((a, b) => a.ColOrder - b.ColOrder).map(
|
|
17945
|
-
(col) => buildColumn(col, fyOptions, detectedColumnTypes
|
|
18033
|
+
(col) => buildColumn(col, fyOptions, detectedColumnTypes)
|
|
17946
18034
|
);
|
|
17947
18035
|
}, [safeColumns, fyOptions, detectedColumnTypes, aggregates]);
|
|
17948
18036
|
const columnPinning = React.useMemo(() => {
|
|
@@ -17991,6 +18079,7 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
|
|
|
17991
18079
|
enablePagination: !isGridDisabled && controls.pagination,
|
|
17992
18080
|
enableColumnActions: !isGridDisabled && controls.columnActions,
|
|
17993
18081
|
enableRowSelection: !isGridDisabled && controls.rowSelection,
|
|
18082
|
+
enableSelectAll: !isGridDisabled && controls.rowSelection && controls?.enableSelectAllRows,
|
|
17994
18083
|
enableGrouping: !isGridDisabled && controls.grouping,
|
|
17995
18084
|
enableSorting: !isGridDisabled && controls.sorting,
|
|
17996
18085
|
enableEditing: !isGridDisabled && controls.editing,
|
|
@@ -18435,47 +18524,560 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
|
|
|
18435
18524
|
)
|
|
18436
18525
|
] });
|
|
18437
18526
|
};
|
|
18438
|
-
const SmartTable = ({
|
|
18439
|
-
|
|
18440
|
-
|
|
18441
|
-
|
|
18442
|
-
colPinning: true,
|
|
18443
|
-
pagination: true,
|
|
18444
|
-
rowSelection: false,
|
|
18445
|
-
rowPinning: false,
|
|
18446
|
-
grouping: false,
|
|
18447
|
-
sorting: true,
|
|
18448
|
-
editing: false,
|
|
18449
|
-
resizing: true
|
|
18450
|
-
},
|
|
18451
|
-
topToolbar = {
|
|
18452
|
-
enabled: true,
|
|
18453
|
-
globalSearch: true,
|
|
18454
|
-
columnFilters: true,
|
|
18455
|
-
densityToggle: true,
|
|
18456
|
-
fullscreenToggle: false,
|
|
18457
|
-
exportBtn: true,
|
|
18458
|
-
showHideColumnsBtn: true
|
|
18459
|
-
},
|
|
18460
|
-
theme = {
|
|
18461
|
-
headerBg: "#3f5fa3",
|
|
18462
|
-
headerText: "#ffffff",
|
|
18463
|
-
bodyBg: "#ffffff",
|
|
18464
|
-
border: "#cfd6e4"
|
|
18527
|
+
const SmartTable = (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(xDatePickers.LocalizationProvider, { dateAdapter: AdapterDayjs, children: /* @__PURE__ */ jsxRuntimeExports.jsx(SmartGridTable, { ...props }) });
|
|
18528
|
+
const FinancialDateRangePicker = ({
|
|
18529
|
+
value = null,
|
|
18530
|
+
onChange = () => {
|
|
18465
18531
|
},
|
|
18466
|
-
|
|
18467
|
-
|
|
18468
|
-
|
|
18469
|
-
|
|
18470
|
-
|
|
18471
|
-
|
|
18472
|
-
|
|
18473
|
-
|
|
18532
|
+
placeholder = "Select date range",
|
|
18533
|
+
className = "",
|
|
18534
|
+
disabled = false,
|
|
18535
|
+
error = "",
|
|
18536
|
+
label = "",
|
|
18537
|
+
required = false,
|
|
18538
|
+
defaultMode = "yearly",
|
|
18539
|
+
showFinancialYear = true,
|
|
18540
|
+
showYearly = true,
|
|
18541
|
+
showMonthly = true,
|
|
18542
|
+
showCustom = true,
|
|
18543
|
+
isSticky = false,
|
|
18544
|
+
stickyTop = 0,
|
|
18545
|
+
stickyRight = 0
|
|
18474
18546
|
}) => {
|
|
18475
|
-
const
|
|
18476
|
-
|
|
18547
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
18548
|
+
const [selectionMode, setSelectionMode] = React.useState(defaultMode);
|
|
18549
|
+
const [financialYear, setFinancialYear] = React.useState("");
|
|
18550
|
+
const [yearlySubMode, setYearlySubMode] = React.useState("half-yearly");
|
|
18551
|
+
const [selectedHalfYear, setSelectedHalfYear] = React.useState(null);
|
|
18552
|
+
const [selectedQuarter, setSelectedQuarter] = React.useState(null);
|
|
18553
|
+
const [selectedMonthStart, setSelectedMonthStart] = React.useState(null);
|
|
18554
|
+
const [selectedMonthEnd, setSelectedMonthEnd] = React.useState(null);
|
|
18555
|
+
const [monthRangeSelecting, setMonthRangeSelecting] = React.useState(false);
|
|
18556
|
+
const [customStart, setCustomStart] = React.useState("");
|
|
18557
|
+
const [customEnd, setCustomEnd] = React.useState("");
|
|
18558
|
+
const [tempDateRange, setTempDateRange] = React.useState({ start: "", end: "" });
|
|
18559
|
+
const [dropdownPosition, setDropdownPosition] = React.useState({
|
|
18560
|
+
top: true,
|
|
18561
|
+
left: 0,
|
|
18562
|
+
right: "auto",
|
|
18563
|
+
arrowLeft: 24
|
|
18564
|
+
});
|
|
18565
|
+
const containerRef = React.useRef(null);
|
|
18566
|
+
const dropdownRef = React.useRef(null);
|
|
18567
|
+
const inputRef = React.useRef(null);
|
|
18568
|
+
const [parentWidth, setParentWidth] = React.useState("100%");
|
|
18569
|
+
React.useEffect(() => {
|
|
18570
|
+
if (containerRef.current) {
|
|
18571
|
+
const parent = containerRef.current.parentElement;
|
|
18572
|
+
const updateWidth = () => {
|
|
18573
|
+
setParentWidth(parent.offsetWidth);
|
|
18574
|
+
};
|
|
18575
|
+
updateWidth();
|
|
18576
|
+
window.addEventListener("resize", updateWidth);
|
|
18577
|
+
return () => window.removeEventListener("resize", updateWidth);
|
|
18578
|
+
}
|
|
18579
|
+
}, []);
|
|
18580
|
+
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
18581
|
+
const financialYears = Array.from({ length: 5 }, (_, i) => {
|
|
18582
|
+
const year = currentYear - 5 + i + 1;
|
|
18583
|
+
return `${year}-${String(year + 1).slice(2)}`;
|
|
18584
|
+
});
|
|
18585
|
+
const halfYears = [
|
|
18586
|
+
{ id: "H1", label: "H1 (Apr-Sep)", startMonth: 3, endMonth: 8 },
|
|
18587
|
+
{ id: "H2", label: "H2 (Oct-Mar)", startMonth: 9, endMonth: 2 }
|
|
18588
|
+
];
|
|
18589
|
+
const quarters = [
|
|
18590
|
+
{ id: "Q1", label: "Q1 (Apr-Jun)", startMonth: 3, endMonth: 5 },
|
|
18591
|
+
{ id: "Q2", label: "Q2 (Jul-Sep)", startMonth: 6, endMonth: 8 },
|
|
18592
|
+
{ id: "Q3", label: "Q3 (Oct-Dec)", startMonth: 9, endMonth: 11 },
|
|
18593
|
+
{ id: "Q4", label: "Q4 (Jan-Mar)", startMonth: 0, endMonth: 2 }
|
|
18594
|
+
];
|
|
18595
|
+
const months = [
|
|
18596
|
+
{ id: 4, label: "April", short: "Apr", index: 3 },
|
|
18597
|
+
{ id: 5, label: "May", short: "May", index: 4 },
|
|
18598
|
+
{ id: 6, label: "June", short: "Jun", index: 5 },
|
|
18599
|
+
{ id: 7, label: "July", short: "Jul", index: 6 },
|
|
18600
|
+
{ id: 8, label: "August", short: "Aug", index: 7 },
|
|
18601
|
+
{ id: 9, label: "September", short: "Sep", index: 8 },
|
|
18602
|
+
{ id: 10, label: "October", short: "Oct", index: 9 },
|
|
18603
|
+
{ id: 11, label: "November", short: "Nov", index: 10 },
|
|
18604
|
+
{ id: 12, label: "December", short: "Dec", index: 11 },
|
|
18605
|
+
{ id: 1, label: "January", short: "Jan", index: 0 },
|
|
18606
|
+
{ id: 2, label: "February", short: "Feb", index: 1 },
|
|
18607
|
+
{ id: 3, label: "March", short: "Mar", index: 2 }
|
|
18608
|
+
];
|
|
18609
|
+
React.useEffect(() => {
|
|
18610
|
+
if (isOpen && value) {
|
|
18611
|
+
setTempDateRange(value);
|
|
18612
|
+
setSelectionMode(value?.mode);
|
|
18613
|
+
setFinancialYear(value?.financialYear);
|
|
18614
|
+
if (value?.mode === "monthly") {
|
|
18615
|
+
setSelectedMonthStart(value?.monthStart);
|
|
18616
|
+
setSelectedMonthEnd(value?.monthEnd);
|
|
18617
|
+
}
|
|
18618
|
+
if (value?.mode === "yearly") {
|
|
18619
|
+
setYearlySubMode(value?.yearlySubMode);
|
|
18620
|
+
setSelectedHalfYear(value?.halfYear);
|
|
18621
|
+
setSelectedQuarter(value?.quarter);
|
|
18622
|
+
}
|
|
18623
|
+
if (value?.mode === "custom") {
|
|
18624
|
+
setCustomStart(value?.start);
|
|
18625
|
+
setCustomEnd(value?.end);
|
|
18626
|
+
}
|
|
18627
|
+
}
|
|
18628
|
+
}, [value, isOpen]);
|
|
18629
|
+
React.useEffect(() => {
|
|
18630
|
+
if (isOpen && containerRef.current && dropdownRef.current && inputRef.current) {
|
|
18631
|
+
const calculatePosition = () => {
|
|
18632
|
+
const container = containerRef.current.getBoundingClientRect();
|
|
18633
|
+
const input = inputRef.current.getBoundingClientRect();
|
|
18634
|
+
const dropdown = dropdownRef.current;
|
|
18635
|
+
const dropdownWidth = 400;
|
|
18636
|
+
const dropdownHeight = dropdown.scrollHeight;
|
|
18637
|
+
const viewportHeight = window.innerHeight;
|
|
18638
|
+
const viewportWidth = window.innerWidth;
|
|
18639
|
+
const spaceBelow = viewportHeight - container.bottom;
|
|
18640
|
+
const spaceAbove = container.top;
|
|
18641
|
+
const showBelow = spaceBelow >= dropdownHeight + 10 || spaceBelow > spaceAbove;
|
|
18642
|
+
let leftPos = 0;
|
|
18643
|
+
let rightPos = "auto";
|
|
18644
|
+
let arrowLeftPos = 24;
|
|
18645
|
+
const containerLeft = container.left;
|
|
18646
|
+
const containerWidth = container.width;
|
|
18647
|
+
const containerRight = containerLeft + containerWidth;
|
|
18648
|
+
const fitsOnRight = containerLeft + dropdownWidth <= viewportWidth - 16;
|
|
18649
|
+
const fitsOnLeft = containerRight - dropdownWidth >= 16;
|
|
18650
|
+
if (fitsOnRight) {
|
|
18651
|
+
leftPos = 0;
|
|
18652
|
+
rightPos = "auto";
|
|
18653
|
+
arrowLeftPos = 24;
|
|
18654
|
+
} else if (fitsOnLeft) {
|
|
18655
|
+
leftPos = "auto";
|
|
18656
|
+
rightPos = 0;
|
|
18657
|
+
arrowLeftPos = dropdownWidth - 40;
|
|
18658
|
+
} else {
|
|
18659
|
+
const maxLeft = viewportWidth - dropdownWidth - 16;
|
|
18660
|
+
const desiredLeft = Math.max(16 - containerLeft, Math.min(0, maxLeft - containerLeft));
|
|
18661
|
+
leftPos = desiredLeft;
|
|
18662
|
+
rightPos = "auto";
|
|
18663
|
+
const inputCenter = input.left + input.width / 2 - container.left;
|
|
18664
|
+
arrowLeftPos = Math.max(16, Math.min(dropdownWidth - 32, inputCenter - desiredLeft - 8));
|
|
18665
|
+
}
|
|
18666
|
+
setDropdownPosition({
|
|
18667
|
+
top: showBelow,
|
|
18668
|
+
left: leftPos,
|
|
18669
|
+
right: rightPos,
|
|
18670
|
+
arrowLeft: arrowLeftPos
|
|
18671
|
+
});
|
|
18672
|
+
};
|
|
18673
|
+
setTimeout(calculatePosition, 10);
|
|
18674
|
+
window.addEventListener("resize", calculatePosition);
|
|
18675
|
+
window.addEventListener("scroll", calculatePosition, true);
|
|
18676
|
+
return () => {
|
|
18677
|
+
window.removeEventListener("resize", calculatePosition);
|
|
18678
|
+
window.removeEventListener("scroll", calculatePosition, true);
|
|
18679
|
+
};
|
|
18680
|
+
}
|
|
18681
|
+
}, [isOpen]);
|
|
18682
|
+
React.useEffect(() => {
|
|
18683
|
+
const handleClickOutside = (e) => {
|
|
18684
|
+
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
18685
|
+
setIsOpen(false);
|
|
18686
|
+
}
|
|
18687
|
+
};
|
|
18688
|
+
if (isOpen) {
|
|
18689
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
18690
|
+
}
|
|
18691
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
18692
|
+
}, [isOpen]);
|
|
18693
|
+
const getHalfYearDates = (fy, halfYear) => {
|
|
18694
|
+
const [startYear] = fy.split("-");
|
|
18695
|
+
const year = parseInt(startYear);
|
|
18696
|
+
const hy = halfYears.find((h) => h.id === halfYear);
|
|
18697
|
+
const startDate = new Date(
|
|
18698
|
+
hy.startMonth >= 3 ? year : year + 1,
|
|
18699
|
+
hy.startMonth,
|
|
18700
|
+
1
|
|
18701
|
+
);
|
|
18702
|
+
const endDate = new Date(
|
|
18703
|
+
hy.endMonth >= 3 ? year : year + 1,
|
|
18704
|
+
hy.endMonth + 1,
|
|
18705
|
+
0
|
|
18706
|
+
);
|
|
18707
|
+
return {
|
|
18708
|
+
start: startDate.toLocaleDateString("en-CA"),
|
|
18709
|
+
end: endDate.toLocaleDateString("en-CA")
|
|
18710
|
+
};
|
|
18711
|
+
};
|
|
18712
|
+
const getQuarterDates = (fy, quarter) => {
|
|
18713
|
+
const [startYear] = fy.split("-");
|
|
18714
|
+
const year = parseInt(startYear);
|
|
18715
|
+
const q = quarters.find((q2) => q2.id === quarter);
|
|
18716
|
+
const startDate = new Date(
|
|
18717
|
+
q.startMonth >= 3 ? year : year + 1,
|
|
18718
|
+
q.startMonth,
|
|
18719
|
+
1
|
|
18720
|
+
);
|
|
18721
|
+
const endDate = new Date(
|
|
18722
|
+
q.endMonth >= 3 ? year : year + 1,
|
|
18723
|
+
q.endMonth + 1,
|
|
18724
|
+
0
|
|
18725
|
+
);
|
|
18726
|
+
return {
|
|
18727
|
+
start: startDate.toLocaleDateString("en-CA"),
|
|
18728
|
+
end: endDate.toLocaleDateString("en-CA")
|
|
18729
|
+
};
|
|
18730
|
+
};
|
|
18731
|
+
const getMonthRangeDates = (fy, startMonthId, endMonthId) => {
|
|
18732
|
+
const [startYear] = fy.split("-");
|
|
18733
|
+
const year = parseInt(startYear);
|
|
18734
|
+
const startMonth = months.find((m) => m.id === startMonthId);
|
|
18735
|
+
const endMonth = months.find((m) => m.id === endMonthId);
|
|
18736
|
+
const startDate = new Date(
|
|
18737
|
+
startMonth.index >= 3 ? year : year + 1,
|
|
18738
|
+
startMonth.index,
|
|
18739
|
+
1
|
|
18740
|
+
);
|
|
18741
|
+
const endDate = new Date(
|
|
18742
|
+
endMonth.index >= 3 ? year : year + 1,
|
|
18743
|
+
endMonth.index + 1,
|
|
18744
|
+
0
|
|
18745
|
+
);
|
|
18746
|
+
return {
|
|
18747
|
+
start: startDate.toLocaleDateString("en-CA"),
|
|
18748
|
+
end: endDate.toLocaleDateString("en-CA")
|
|
18749
|
+
};
|
|
18750
|
+
};
|
|
18751
|
+
React.useEffect(() => {
|
|
18752
|
+
if (selectionMode === "yearly") {
|
|
18753
|
+
if (selectedHalfYear) {
|
|
18754
|
+
const dates = getHalfYearDates(financialYear, selectedHalfYear);
|
|
18755
|
+
setTempDateRange(dates);
|
|
18756
|
+
} else if (selectedQuarter) {
|
|
18757
|
+
const dates = getQuarterDates(financialYear, selectedQuarter);
|
|
18758
|
+
setTempDateRange(dates);
|
|
18759
|
+
}
|
|
18760
|
+
} else if (selectionMode === "monthly" && selectedMonthStart && selectedMonthEnd) {
|
|
18761
|
+
const dates = getMonthRangeDates(financialYear, selectedMonthStart, selectedMonthEnd);
|
|
18762
|
+
setTempDateRange(dates);
|
|
18763
|
+
} else if (selectionMode === "custom" && customStart && customEnd) {
|
|
18764
|
+
setTempDateRange({ start: customStart, end: customEnd });
|
|
18765
|
+
}
|
|
18766
|
+
}, [selectionMode, yearlySubMode, financialYear, selectedHalfYear, selectedQuarter, selectedMonthStart, selectedMonthEnd, customStart, customEnd]);
|
|
18767
|
+
const handleHalfYearSelect = (halfYearId) => {
|
|
18768
|
+
setSelectedHalfYear(halfYearId);
|
|
18769
|
+
setSelectedQuarter(null);
|
|
18770
|
+
};
|
|
18771
|
+
const handleQuarterSelect = (quarterId) => {
|
|
18772
|
+
setSelectedQuarter(quarterId);
|
|
18773
|
+
setSelectedHalfYear(null);
|
|
18774
|
+
};
|
|
18775
|
+
const handleMonthClick = (monthId) => {
|
|
18776
|
+
if (!monthRangeSelecting) {
|
|
18777
|
+
setSelectedMonthStart(monthId);
|
|
18778
|
+
setSelectedMonthEnd(null);
|
|
18779
|
+
setMonthRangeSelecting(true);
|
|
18780
|
+
} else {
|
|
18781
|
+
const startId = selectedMonthStart;
|
|
18782
|
+
const endId = monthId;
|
|
18783
|
+
const startIndex = months.findIndex((m) => m.id === startId);
|
|
18784
|
+
const endIndex = months.findIndex((m) => m.id === endId);
|
|
18785
|
+
if (startIndex <= endIndex) {
|
|
18786
|
+
setSelectedMonthStart(startId);
|
|
18787
|
+
setSelectedMonthEnd(endId);
|
|
18788
|
+
} else {
|
|
18789
|
+
setSelectedMonthStart(endId);
|
|
18790
|
+
setSelectedMonthEnd(startId);
|
|
18791
|
+
}
|
|
18792
|
+
setMonthRangeSelecting(false);
|
|
18793
|
+
}
|
|
18794
|
+
};
|
|
18795
|
+
const isMonthInRange = (monthId) => {
|
|
18796
|
+
if (!selectedMonthStart) return false;
|
|
18797
|
+
if (!selectedMonthEnd) return monthId === selectedMonthStart;
|
|
18798
|
+
const startIndex = months.findIndex((m) => m.id === selectedMonthStart);
|
|
18799
|
+
const endIndex = months.findIndex((m) => m.id === selectedMonthEnd);
|
|
18800
|
+
const currentIndex = months.findIndex((m) => m.id === monthId);
|
|
18801
|
+
const minIndex = Math.min(startIndex, endIndex);
|
|
18802
|
+
const maxIndex = Math.max(startIndex, endIndex);
|
|
18803
|
+
return currentIndex >= minIndex && currentIndex <= maxIndex;
|
|
18804
|
+
};
|
|
18805
|
+
const isMonthRangeEdge = (monthId) => {
|
|
18806
|
+
return monthId === selectedMonthStart || monthId === selectedMonthEnd;
|
|
18807
|
+
};
|
|
18808
|
+
const resetAllSelections = () => {
|
|
18809
|
+
setSelectedHalfYear(null);
|
|
18810
|
+
setSelectedQuarter(null);
|
|
18811
|
+
setSelectedMonthStart(null);
|
|
18812
|
+
setSelectedMonthEnd(null);
|
|
18813
|
+
setMonthRangeSelecting(false);
|
|
18814
|
+
setCustomStart("");
|
|
18815
|
+
setCustomEnd("");
|
|
18816
|
+
setTempDateRange({ start: "", end: "" });
|
|
18817
|
+
};
|
|
18818
|
+
const handleCancel = () => {
|
|
18819
|
+
resetAllSelections();
|
|
18820
|
+
setIsOpen(false);
|
|
18821
|
+
};
|
|
18822
|
+
const handleApply = () => {
|
|
18823
|
+
if (tempDateRange.start && tempDateRange.end) {
|
|
18824
|
+
onChange({
|
|
18825
|
+
start: tempDateRange.start,
|
|
18826
|
+
end: tempDateRange.end,
|
|
18827
|
+
financialYear,
|
|
18828
|
+
mode: selectionMode,
|
|
18829
|
+
yearlySubMode: selectionMode === "yearly" ? yearlySubMode : null,
|
|
18830
|
+
halfYear: selectedHalfYear,
|
|
18831
|
+
quarter: selectedQuarter,
|
|
18832
|
+
monthStart: selectedMonthStart,
|
|
18833
|
+
monthEnd: selectedMonthEnd
|
|
18834
|
+
});
|
|
18835
|
+
setIsOpen(false);
|
|
18836
|
+
}
|
|
18837
|
+
};
|
|
18838
|
+
const handleClear = () => {
|
|
18839
|
+
resetAllSelections();
|
|
18840
|
+
onChange(null);
|
|
18841
|
+
setFinancialYear((/* @__PURE__ */ new Date()).getFullYear() + "-" + String((/* @__PURE__ */ new Date()).getFullYear() + 1).slice(2));
|
|
18842
|
+
};
|
|
18843
|
+
const formatDate2 = (dateStr) => {
|
|
18844
|
+
if (!dateStr) return "";
|
|
18845
|
+
const date = new Date(dateStr);
|
|
18846
|
+
return date.toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
|
|
18847
|
+
};
|
|
18848
|
+
const getDisplayValue = () => {
|
|
18849
|
+
if (!value) return "";
|
|
18850
|
+
return `${formatDate2(value.start)} - ${formatDate2(value.end)}`;
|
|
18851
|
+
};
|
|
18852
|
+
const availableModes = [];
|
|
18853
|
+
if (showYearly) availableModes.push("yearly");
|
|
18854
|
+
if (showMonthly) availableModes.push("monthly");
|
|
18855
|
+
if (showCustom) availableModes.push("custom");
|
|
18856
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
18857
|
+
"div",
|
|
18858
|
+
{
|
|
18859
|
+
ref: containerRef,
|
|
18860
|
+
className: `${isSticky ? "fixed z-40 bg-white" : "relative"} ${className}`,
|
|
18861
|
+
style: isSticky ? {
|
|
18862
|
+
top: stickyTop,
|
|
18863
|
+
right: stickyRight || "auto",
|
|
18864
|
+
width: parentWidth
|
|
18865
|
+
// dynamic width applied here
|
|
18866
|
+
} : {},
|
|
18867
|
+
children: [
|
|
18868
|
+
label && /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: [
|
|
18869
|
+
label,
|
|
18870
|
+
required && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" })
|
|
18871
|
+
] }),
|
|
18872
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
18873
|
+
"div",
|
|
18874
|
+
{
|
|
18875
|
+
ref: inputRef,
|
|
18876
|
+
onClick: () => !disabled && setIsOpen(!isOpen),
|
|
18877
|
+
className: `
|
|
18878
|
+
flex items-center justify-between px-3 sm:px-4 py-2 sm:py-3 border-2 rounded-lg cursor-pointer transition
|
|
18879
|
+
${disabled ? "bg-gray-100 cursor-not-allowed" : "bg-white hover:border-[#3B5AA1]/70"}
|
|
18880
|
+
${error ? "border-red-500" : "border-gray-300"}
|
|
18881
|
+
${isOpen ? "border-[#3B5AA1]/70 ring-2 ring-[#3B5AA1]/70" : ""}
|
|
18882
|
+
`,
|
|
18883
|
+
children: [
|
|
18884
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 flex-1 min-w-0", children: [
|
|
18885
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Calendar, { className: `w-4 h-4 sm:w-5 sm:h-5 flex-shrink-0 ${disabled ? "text-gray-400" : "text-[#3B5AA1]"}` }),
|
|
18886
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-xs sm:text-sm truncate ${value ? "text-gray-900" : "text-gray-400"}`, children: getDisplayValue() || placeholder })
|
|
18887
|
+
] }),
|
|
18888
|
+
value && !disabled && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
18889
|
+
"button",
|
|
18890
|
+
{
|
|
18891
|
+
onClick: (e) => {
|
|
18892
|
+
e.stopPropagation();
|
|
18893
|
+
handleClear();
|
|
18894
|
+
},
|
|
18895
|
+
className: "p-1 hover:bg-gray-100 rounded flex-shrink-0 ml-2",
|
|
18896
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "w-3 h-3 sm:w-4 sm:h-4 text-gray-500" })
|
|
18897
|
+
}
|
|
18898
|
+
)
|
|
18899
|
+
]
|
|
18900
|
+
}
|
|
18901
|
+
),
|
|
18902
|
+
error && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-1 text-xs text-red-500", children: error }),
|
|
18903
|
+
isOpen && /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
18904
|
+
"div",
|
|
18905
|
+
{
|
|
18906
|
+
ref: dropdownRef,
|
|
18907
|
+
style: {
|
|
18908
|
+
left: dropdownPosition.left !== "auto" ? `${dropdownPosition.left}px` : "auto",
|
|
18909
|
+
right: dropdownPosition.right !== "auto" ? `${dropdownPosition.right}px` : "auto"
|
|
18910
|
+
},
|
|
18911
|
+
className: `
|
|
18912
|
+
absolute z-50 w-full sm:w-[400px] bg-white rounded-xl shadow-2xl border-2 border-gray-200
|
|
18913
|
+
${dropdownPosition.top ? "mt-2" : "mb-2 bottom-full"}
|
|
18914
|
+
`,
|
|
18915
|
+
children: [
|
|
18916
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
18917
|
+
"div",
|
|
18918
|
+
{
|
|
18919
|
+
style: { left: `${dropdownPosition.arrowLeft}px` },
|
|
18920
|
+
className: `
|
|
18921
|
+
absolute w-4 h-4 bg-white border-gray-200 transform rotate-45
|
|
18922
|
+
${dropdownPosition.top ? "-top-2 border-t-2 border-l-2" : "-bottom-2 border-b-2 border-r-2"}
|
|
18923
|
+
`
|
|
18924
|
+
}
|
|
18925
|
+
),
|
|
18926
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative bg-white rounded-xl p-4 sm:p-5 max-h-[70vh] overflow-y-auto", children: [
|
|
18927
|
+
showFinancialYear && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-4", children: [
|
|
18928
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "block text-xs sm:text-sm font-semibold text-gray-700 mb-2", children: "Financial Year" }),
|
|
18929
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
18930
|
+
"select",
|
|
18931
|
+
{
|
|
18932
|
+
value: financialYear,
|
|
18933
|
+
onChange: (e) => {
|
|
18934
|
+
setFinancialYear(e.target.value);
|
|
18935
|
+
resetAllSelections();
|
|
18936
|
+
},
|
|
18937
|
+
className: "w-full px-3 py-2 text-sm border-2 border-gray-300 rounded-lg focus:border-[#3B5AA1]/70 focus:ring-2 focus:ring-[#3B5AA1]/70 transition",
|
|
18938
|
+
children: financialYears.map((fy) => /* @__PURE__ */ jsxRuntimeExports.jsxs("option", { value: fy, children: [
|
|
18939
|
+
"FY ",
|
|
18940
|
+
fy
|
|
18941
|
+
] }, fy))
|
|
18942
|
+
}
|
|
18943
|
+
)
|
|
18944
|
+
] }),
|
|
18945
|
+
availableModes.length > 1 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex gap-2 mb-4 bg-gray-100 p-1 rounded-lg", children: availableModes.map((mode) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
18946
|
+
"button",
|
|
18947
|
+
{
|
|
18948
|
+
onClick: () => {
|
|
18949
|
+
setSelectionMode(mode);
|
|
18950
|
+
resetAllSelections();
|
|
18951
|
+
},
|
|
18952
|
+
className: `flex-1 px-3 py-2 font-medium capitalize rounded-md transition text-sm ${selectionMode === mode ? "bg-[#3B5AA1] text-white shadow-md" : "bg-transparent text-gray-600 hover:bg-gray-200"}`,
|
|
18953
|
+
children: mode
|
|
18954
|
+
},
|
|
18955
|
+
mode
|
|
18956
|
+
)) }),
|
|
18957
|
+
selectionMode === "yearly" && showYearly && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-4", children: [
|
|
18958
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
18959
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-sm font-semibold text-gray-700 mb-3", children: "Select Half Year" }),
|
|
18960
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-2 gap-2", children: halfYears.map((halfYear) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
18961
|
+
"button",
|
|
18962
|
+
{
|
|
18963
|
+
onClick: () => handleHalfYearSelect(halfYear.id),
|
|
18964
|
+
className: `p-3 rounded-lg border-2 font-medium text-sm transition ${selectedHalfYear === halfYear.id ? "bg-[#3B5AA1] text-white border-[#3B5AA1]/70 shadow-md" : "bg-white text-gray-700 border-gray-300 hover:border-[#3B5AA1]/70 hover:bg-[#3B5AA1]/10"}`,
|
|
18965
|
+
children: halfYear.label
|
|
18966
|
+
},
|
|
18967
|
+
halfYear.id
|
|
18968
|
+
)) })
|
|
18969
|
+
] }),
|
|
18970
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-3", children: [
|
|
18971
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-sm font-semibold text-gray-700 mb-3", children: "Select Quarter" }),
|
|
18972
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-2 gap-2", children: quarters.map((quarter) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
18973
|
+
"button",
|
|
18974
|
+
{
|
|
18975
|
+
onClick: () => handleQuarterSelect(quarter.id),
|
|
18976
|
+
className: `p-3 rounded-lg border-2 font-medium text-sm transition ${selectedQuarter === quarter.id ? "bg-[#3B5AA1] text-white border-[#3B5AA1]/70 shadow-md" : "bg-white text-gray-700 border-gray-300 hover:border-[#3B5AA1]/70 hover:bg-[#3B5AA1]/10"}`,
|
|
18977
|
+
children: quarter.label
|
|
18978
|
+
},
|
|
18979
|
+
quarter.id
|
|
18980
|
+
)) })
|
|
18981
|
+
] })
|
|
18982
|
+
] }),
|
|
18983
|
+
selectionMode === "monthly" && showMonthly && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-4", children: [
|
|
18984
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between mb-2", children: [
|
|
18985
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-sm font-semibold text-gray-700", children: "Select Month Range" }),
|
|
18986
|
+
monthRangeSelecting && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-[#3B5AA1] font-medium", children: "Select end →" })
|
|
18987
|
+
] }),
|
|
18988
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-3 gap-2", children: months.map((month) => {
|
|
18989
|
+
const inRange = isMonthInRange(month.id);
|
|
18990
|
+
const isEdge = isMonthRangeEdge(month.id);
|
|
18991
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
18992
|
+
"button",
|
|
18993
|
+
{
|
|
18994
|
+
onClick: () => handleMonthClick(month.id),
|
|
18995
|
+
className: `p-2 rounded-lg border-2 font-medium text-xs transition ${inRange ? isEdge ? "bg-[#3B5AA1] text-white border-[#3B5AA1]/70 shadow-md" : "bg-[#3B5AA1]/10 text-[#3B5AA1] border-[#3B5AA1]/70" : "bg-white text-gray-700 border-gray-300 hover:border-[#3B5AA1]/70 hover:bg-[#3B5AA1]/10"}`,
|
|
18996
|
+
children: month.short
|
|
18997
|
+
},
|
|
18998
|
+
month.id
|
|
18999
|
+
);
|
|
19000
|
+
}) }),
|
|
19001
|
+
selectedMonthStart && selectedMonthEnd && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
19002
|
+
"button",
|
|
19003
|
+
{
|
|
19004
|
+
onClick: () => {
|
|
19005
|
+
setSelectedMonthStart(null);
|
|
19006
|
+
setSelectedMonthEnd(null);
|
|
19007
|
+
setMonthRangeSelecting(false);
|
|
19008
|
+
},
|
|
19009
|
+
className: "mt-2 text-xs text-[#3B5AA1] hover:underline font-medium",
|
|
19010
|
+
children: "Clear Selection"
|
|
19011
|
+
}
|
|
19012
|
+
)
|
|
19013
|
+
] }),
|
|
19014
|
+
selectionMode === "custom" && showCustom && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-4", children: [
|
|
19015
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-sm font-semibold text-gray-700 mb-3", children: "Custom Date Range" }),
|
|
19016
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
19017
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
19018
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "block text-xs font-medium text-gray-600 mb-1", children: "Start Date" }),
|
|
19019
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
19020
|
+
"input",
|
|
19021
|
+
{
|
|
19022
|
+
type: "date",
|
|
19023
|
+
value: customStart,
|
|
19024
|
+
onChange: (e) => setCustomStart(e.target.value),
|
|
19025
|
+
className: "w-full px-2.5 py-2 border-2 border-gray-300 rounded-lg text-xs focus:border-[#3B5AA1]/70 focus:ring-2 focus:ring-[#3B5AA1]/70 transition"
|
|
19026
|
+
}
|
|
19027
|
+
)
|
|
19028
|
+
] }),
|
|
19029
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
19030
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "block text-xs font-medium text-gray-600 mb-1", children: "End Date" }),
|
|
19031
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
19032
|
+
"input",
|
|
19033
|
+
{
|
|
19034
|
+
type: "date",
|
|
19035
|
+
value: customEnd,
|
|
19036
|
+
onChange: (e) => setCustomEnd(e.target.value),
|
|
19037
|
+
min: customStart,
|
|
19038
|
+
className: "w-full px-2.5 py-2 border-2 border-gray-300 rounded-lg text-xs focus:border-[#3B5AA1]/70 focus:ring-2 focus:ring-[#3B5AA1]/70 transition"
|
|
19039
|
+
}
|
|
19040
|
+
)
|
|
19041
|
+
] })
|
|
19042
|
+
] })
|
|
19043
|
+
] }),
|
|
19044
|
+
tempDateRange.start && tempDateRange.end && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-[#3B5AA1]/10 rounded-lg p-3 mb-4 border border-[#3B5AA1]/70", children: [
|
|
19045
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs font-medium text-gray-600 mb-1", children: "Selected Range" }),
|
|
19046
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-xs font-semibold text-[#3B5AA1] break-words", children: [
|
|
19047
|
+
formatDate2(tempDateRange.start),
|
|
19048
|
+
" - ",
|
|
19049
|
+
formatDate2(tempDateRange.end)
|
|
19050
|
+
] })
|
|
19051
|
+
] }),
|
|
19052
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2", children: [
|
|
19053
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
19054
|
+
"button",
|
|
19055
|
+
{
|
|
19056
|
+
onClick: handleCancel,
|
|
19057
|
+
className: "flex-1 px-4 py-2 border-2 border-gray-300 rounded-lg font-medium text-gray-700 hover:bg-gray-50 transition text-sm",
|
|
19058
|
+
children: "Cancel"
|
|
19059
|
+
}
|
|
19060
|
+
),
|
|
19061
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
19062
|
+
"button",
|
|
19063
|
+
{
|
|
19064
|
+
onClick: handleApply,
|
|
19065
|
+
disabled: !tempDateRange.start || !tempDateRange.end,
|
|
19066
|
+
className: `flex-1 px-4 py-2 rounded-lg font-medium transition text-sm ${tempDateRange.start && tempDateRange.end ? "bg-[#3B5AA1] text-white hover:bg-[#2d4680] shadow-md" : "bg-gray-200 text-gray-400 cursor-not-allowed"}`,
|
|
19067
|
+
children: "Apply"
|
|
19068
|
+
}
|
|
19069
|
+
)
|
|
19070
|
+
] })
|
|
19071
|
+
] })
|
|
19072
|
+
]
|
|
19073
|
+
}
|
|
19074
|
+
)
|
|
19075
|
+
]
|
|
19076
|
+
}
|
|
19077
|
+
);
|
|
18477
19078
|
};
|
|
18478
19079
|
exports2.MytekComboDropdown = ComboDropdown;
|
|
19080
|
+
exports2.MytekFinancialDateRangePicker = FinancialDateRangePicker;
|
|
18479
19081
|
exports2.MytekInputField = CustomInput;
|
|
18480
19082
|
exports2.MytekLoader = Loader;
|
|
18481
19083
|
exports2.MytekMessageBox = Mt_MessageBox;
|