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