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 CHANGED
@@ -518,40 +518,44 @@ const Button = ({
518
518
  children,
519
519
  onClick,
520
520
  fontSize = "16px",
521
- color: color2 = "#ffffff",
522
- backgroundColor: backgroundColor2 = "#3369BB",
521
+ color: color2 = "#fff",
522
+ backgroundColor: backgroundColor2 = "#3B5AA1",
523
+ hoverBackgroundColor = "#2F4B8A",
524
+ disabledBackgroundColor = "#9CA3AF",
525
+ // gray-400
526
+ disabledTextColor = "#E5E7EB",
527
+ // gray-200
523
528
  height: height2 = "40px",
524
- width: width2 = "100px",
529
+ width: width2 = "auto",
525
530
  border: border2 = "none",
526
- borderRadius: borderRadius2 = "4px",
527
- padding: padding2 = "10px 20px",
528
- fontWeight = "normal",
529
- style: style2 = {},
531
+ borderRadius: borderRadius2 = "6px",
532
+ padding: padding2 = "10px 16px",
533
+ fontWeight = "500",
530
534
  loader = false,
531
535
  disabled = false,
536
+ style: style2 = {},
532
537
  ...rest
533
538
  }) => {
534
539
  const isDisabled = loader || disabled;
535
540
  const className = clsx(
536
- "flex items-center justify-center transition-opacity",
541
+ "flex items-center justify-center transition-all duration-200 overflow-hidden",
537
542
  {
538
543
  "cursor-not-allowed opacity-60": isDisabled,
539
- "cursor-pointer": !isDisabled
544
+ "cursor-pointer hover:brightness-110 active:scale-[0.98]": !isDisabled
540
545
  },
541
546
  rest.className
542
- // ✅ allow external Tailwind className overrides
543
547
  );
544
548
  const buttonStyle = {
545
549
  fontSize,
546
- color: color2,
547
- backgroundColor: backgroundColor2,
550
+ color: isDisabled ? disabledTextColor : color2,
551
+ backgroundColor: isDisabled ? disabledBackgroundColor : backgroundColor2,
548
552
  height: height2,
549
- // ✅ Only apply width if w-full is NOT passed via className
550
553
  width: rest.className?.includes("w-full") ? void 0 : width2,
551
554
  border: border2,
552
555
  borderRadius: borderRadius2,
553
556
  padding: padding2,
554
557
  fontWeight,
558
+ cursor: isDisabled ? "not-allowed" : "pointer",
555
559
  ...style2
556
560
  };
557
561
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -561,8 +565,14 @@ const Button = ({
561
565
  disabled: isDisabled,
562
566
  className,
563
567
  style: buttonStyle,
568
+ onMouseEnter: (e) => {
569
+ if (!isDisabled) e.currentTarget.style.backgroundColor = hoverBackgroundColor;
570
+ },
571
+ onMouseLeave: (e) => {
572
+ if (!isDisabled) e.currentTarget.style.backgroundColor = backgroundColor2;
573
+ },
564
574
  ...rest,
565
- children: loader ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { inline: true }) : label || children
575
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate w-full", children: loader ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { inline: true }) : label || children })
566
576
  }
567
577
  );
568
578
  };
@@ -12585,7 +12595,7 @@ function requireLib() {
12585
12595
  }
12586
12596
  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) {
12587
12597
  return T(I(e3));
12588
- }), 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), X = 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;
12598
+ }), 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;
12589
12599
  function ie(e3) {
12590
12600
  var t2 = -1, r4 = e3 ? e3.length : 0;
12591
12601
  for (this.clear(); ++t2 < r4; ) {
@@ -12923,7 +12933,7 @@ function requireLib() {
12923
12933
  if (n2) switch (n2) {
12924
12934
  case Y:
12925
12935
  return "[object DataView]";
12926
- case X:
12936
+ case X2:
12927
12937
  return a;
12928
12938
  case ee:
12929
12939
  return "[object Promise]";
@@ -13978,7 +13988,11 @@ const CustomInput = ({
13978
13988
  onValidationChange,
13979
13989
  // color,
13980
13990
  showTimer,
13981
- timer
13991
+ timer,
13992
+ minValue,
13993
+ maxValue,
13994
+ stepValue,
13995
+ wrapperClassName
13982
13996
  }) => {
13983
13997
  const [countryCode, setCountryCode] = useState("IN");
13984
13998
  const [nationalNumber, setNationalNumber] = useState("");
@@ -13991,7 +14005,6 @@ const CustomInput = ({
13991
14005
  validate(value);
13992
14006
  }
13993
14007
  }, [value]);
13994
- console.log(enable);
13995
14008
  const validate = (val) => {
13996
14009
  const raw = category === "amount" ? removeCommas(val) : val;
13997
14010
  if (!isRequired && !val) {
@@ -14214,7 +14227,6 @@ const CustomInput = ({
14214
14227
  const handleChange = (e) => {
14215
14228
  let val;
14216
14229
  if (category == "mobile") {
14217
- console.log(e);
14218
14230
  val = e;
14219
14231
  validate(val);
14220
14232
  } else {
@@ -14305,20 +14317,9 @@ const CustomInput = ({
14305
14317
  }
14306
14318
  const nationalNumber1 = parsed.nationalNumber || "";
14307
14319
  setNationalNumber(nationalNumber1);
14308
- console.log(nationalNumber);
14309
14320
  const { length, startsWith } = rules;
14310
14321
  const callingCodeLength = country.dialCode.length;
14311
14322
  const maxTotalLength = callingCodeLength + length;
14312
- console.log(
14313
- value2,
14314
- value2.length,
14315
- maxTotalLength,
14316
- length,
14317
- nationalNumber.length,
14318
- startsWith,
14319
- startsWith.test(nationalNumber),
14320
- "len"
14321
- );
14322
14323
  if (value2.length > maxTotalLength) {
14323
14324
  setError("Invalid phone number for selected country");
14324
14325
  setEnable(true);
@@ -14365,7 +14366,7 @@ const CustomInput = ({
14365
14366
  prefix && /* @__PURE__ */ jsxRuntimeExports.jsx(
14366
14367
  InputGroup$1.Text,
14367
14368
  {
14368
- style: { backgroundColor: "#fff", borderColor: "#12AB5B" },
14369
+ style: { backgroundColor: "#fff", borderColor: "#3B5AA1" },
14369
14370
  children: prefix
14370
14371
  }
14371
14372
  ),
@@ -14374,107 +14375,138 @@ const CustomInput = ({
14374
14375
  {
14375
14376
  placement: "top",
14376
14377
  overlay: isAmount && amountInWords && (currency === "₹" || currency === "$") ? /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$2, { id: `${name}-tooltip`, children: amountInWords }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
14377
- children: category === "mobile" ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center border border-[#12AB5B] rounded-md w-full", children: [
14378
- /* @__PURE__ */ jsxRuntimeExports.jsx(
14379
- PhoneInput,
14380
- {
14381
- value,
14382
- onChange: (value2, country) => handlePhoneChange(value2, country),
14383
- country: countryCode.toLowerCase(),
14384
- enableLongNumbers: true,
14385
- disableDropdown: false,
14386
- countryCodeEditable: false,
14387
- inputProps: { autoComplete: "off" },
14388
- containerStyle: { width: "100%" },
14389
- disabled,
14390
- inputStyle: {
14391
- width: "100%",
14392
- height: "40px",
14393
- fontSize: "14px",
14394
- paddingLeft: "48px",
14395
- // leave space for flag
14396
- border: "none",
14397
- backgroundColor: disabled ? "#f1f1f1" : "#fff",
14398
- // gray when disabled
14399
- color: disabled ? "#6c757d" : "#000",
14400
- // ✅ muted text when disabled
14401
- cursor: disabled ? "not-allowed" : "text"
14402
- // ✅ show disabled cursor
14403
- },
14404
- buttonStyle: {
14405
- borderRight: "1px solid #12AB5B",
14406
- backgroundColor: disabled ? "#f1f1f1" : "#fff",
14407
- // ✅ gray when disabled
14408
- borderRadius: "0.375rem 0 0 0.375rem",
14409
- cursor: disabled ? "not-allowed" : "pointer"
14410
- },
14411
- dropdownClass: "z-50 mt-1 bg-white border border-gray-300 rounded-md text-sm max-h-60 overflow-y-auto shadow-lg"
14412
- }
14413
- ),
14414
- button?.label && /* @__PURE__ */ jsxRuntimeExports.jsx(
14415
- "button",
14416
- {
14417
- type: "button",
14418
- onClick: button.onClick,
14419
- disabled: button.disabled || enable,
14420
- className: `px-4 py-2 text-white ${backgroundColor2 || "bg-[#3B5AA1]"} border-l border-[#12AB5B] rounded-r-md ${button.disabled || enable ? "opacity-50 cursor-not-allowed" : ""}`,
14421
- style: { height: height2 },
14422
- children: button.loader ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { inline: true }) : button.label
14423
- }
14424
- )
14425
- ] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center border border-[#12AB5B] overflow-hidden rounded-md", children: [
14426
- prefix && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "px-2 bg-white text-gray-700 border-r border-[#12AB5B]", children: prefix }),
14427
- /* @__PURE__ */ jsxRuntimeExports.jsx(
14428
- "input",
14429
- {
14430
- type: isPassword ? showPassword ? "text" : "password" : type,
14431
- name,
14432
- value,
14433
- onChange: handleChange,
14434
- disabled,
14435
- placeholder,
14436
- className: `flex-1 px-2 py-2 focus:outline-none ${disabled ? "bg-gray-100 cursor-not-allowed text-gray-500" : ""}`,
14437
- style: {
14438
- height: height2,
14439
- backgroundColor: disabled ? "#f1f1f1" : void 0,
14440
- color: disabled ? "#6c757d" : void 0
14441
- }
14442
- }
14443
- ),
14444
- suffix && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "px-2 bg-white text-gray-700 border-l border-[#12AB5B]", children: suffix }),
14445
- !error && showTimer && /* @__PURE__ */ jsxRuntimeExports.jsxs(
14446
- "span",
14447
- {
14448
- className: `flex items-center gap-1 justify-center h-[40px] min-w-[60px] px-2 ml-1 rounded text-sm
14449
- ${validationStatus === "valid" ? "text-green-600 bg-gray-100" : validationStatus === "invalid" ? "text-red-600" : "text-gray-600 bg-gray-100"}`,
14450
- title: validationStatus === "valid" ? "Correct OTP" : validationStatus === "invalid" ? "Incorrect OTP" : "OTP Timer",
14451
- children: [
14452
- validationStatus === "valid" && /* @__PURE__ */ jsxRuntimeExports.jsx(FaCheck, { size: 18 }),
14453
- validationStatus === "invalid" && /* @__PURE__ */ jsxRuntimeExports.jsx(IoMdClose, { size: 18 }),
14454
- typeof timer === "number" && validationStatus !== "valid" && `${timer}s`
14455
- ]
14456
- }
14457
- ),
14458
- isPassword && /* @__PURE__ */ jsxRuntimeExports.jsx(
14459
- "button",
14460
- {
14461
- type: "button",
14462
- onClick: () => setShowPassword(!showPassword),
14463
- className: "px-2 bg-white text-gray-500 border-l border-[#12AB5B]",
14464
- children: showPassword ? /* @__PURE__ */ jsxRuntimeExports.jsx(FiEye, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(FiEyeOff, {})
14465
- }
14466
- ),
14467
- button?.label && /* @__PURE__ */ jsxRuntimeExports.jsx(
14468
- "button",
14469
- {
14470
- onClick: button?.onClick,
14471
- disabled: disabled || enable,
14472
- className: `px-2 py-2 text-white ${backgroundColor2 || "bg-[#3B5AA1]"} border-l border-[#12AB5B] rounded-r-md ${disabled || enable ? "opacity-50 cursor-not-allowed" : ""}`,
14473
- style: { height: height2 },
14474
- children: button.loader ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { inline: true }) : button.label
14475
- }
14476
- )
14477
- ] })
14378
+ children: category === "mobile" ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
14379
+ "div",
14380
+ {
14381
+ className: `
14382
+ flex items-center w-full
14383
+ rounded-md
14384
+ transition-all duration-200
14385
+ border border-[1px]
14386
+ ${disabled ? "border-gray-300 bg-gray-100 cursor-not-allowed" : "border-[#3B5AA1] focus-within:ring-1 focus-within:ring-[#3B5AA1] focus-within:border-[#3B5AA1]"}
14387
+ ${wrapperClassName || ""}
14388
+ `,
14389
+ children: [
14390
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
14391
+ PhoneInput,
14392
+ {
14393
+ value,
14394
+ onChange: (value2, country) => handlePhoneChange(value2, country),
14395
+ country: countryCode.toLowerCase(),
14396
+ enableLongNumbers: false,
14397
+ disableDropdown: false,
14398
+ countryCodeEditable: false,
14399
+ inputProps: { autoComplete: "off" },
14400
+ containerStyle: { width: "100%" },
14401
+ disabled,
14402
+ inputStyle: {
14403
+ width: "100%",
14404
+ height: "40px",
14405
+ fontSize: "14px",
14406
+ paddingLeft: "48px",
14407
+ // leave space for flag
14408
+ border: "none",
14409
+ backgroundColor: disabled ? "#f1f1f1" : "#fff",
14410
+ // gray when disabled
14411
+ color: disabled ? "#6c757d" : "#000",
14412
+ // muted text when disabled
14413
+ cursor: disabled ? "not-allowed" : "text"
14414
+ // ✅ show disabled cursor
14415
+ },
14416
+ buttonStyle: {
14417
+ borderRight: "1px solid #3B5AA1",
14418
+ backgroundColor: disabled ? "#f1f1f1" : "#fff",
14419
+ // ✅ gray when disabled
14420
+ borderRadius: "0.375rem 0 0 0.375rem",
14421
+ cursor: disabled ? "not-allowed" : "pointer"
14422
+ },
14423
+ dropdownClass: "z-50 mt-1 bg-white border border-gray-300 rounded-md text-sm max-h-60 overflow-y-auto shadow-lg"
14424
+ }
14425
+ ),
14426
+ button?.label && /* @__PURE__ */ jsxRuntimeExports.jsx(
14427
+ "button",
14428
+ {
14429
+ type: "button",
14430
+ onClick: button.onClick,
14431
+ disabled: button.disabled || enable,
14432
+ 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" : ""}`,
14433
+ style: { height: height2 },
14434
+ children: button.loader ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { inline: true }) : button.label
14435
+ }
14436
+ )
14437
+ ]
14438
+ }
14439
+ ) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
14440
+ "div",
14441
+ {
14442
+ className: `
14443
+ flex items-center
14444
+ overflow-hidden
14445
+ rounded-md
14446
+ transition-all duration-200
14447
+
14448
+ ${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]"}
14449
+
14450
+ ${wrapperClassName || ""}
14451
+ `,
14452
+ children: [
14453
+ prefix && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "px-2 bg-white text-gray-700 border-r border-[#3B5AA1]", children: prefix }),
14454
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
14455
+ "input",
14456
+ {
14457
+ type: isPassword ? showPassword ? "text" : "password" : type,
14458
+ name,
14459
+ value,
14460
+ onChange: handleChange,
14461
+ disabled,
14462
+ placeholder,
14463
+ className: `flex-1 px-2 py-2 focus:outline-none ${disabled ? "bg-gray-100 cursor-not-allowed text-gray-500" : ""}`,
14464
+ style: {
14465
+ height: height2,
14466
+ backgroundColor: disabled ? "#f1f1f1" : void 0,
14467
+ color: disabled ? "#6c757d" : void 0
14468
+ },
14469
+ min: minValue,
14470
+ max: maxValue,
14471
+ step: stepValue
14472
+ }
14473
+ ),
14474
+ suffix && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "px-2 bg-white text-gray-700 border-l border-[#3B5AA1]", children: suffix }),
14475
+ !error && showTimer && /* @__PURE__ */ jsxRuntimeExports.jsxs(
14476
+ "span",
14477
+ {
14478
+ className: `flex items-center gap-1 justify-center h-[40px] min-w-[60px] px-2 ml-1 rounded text-sm
14479
+ ${validationStatus === "valid" ? "text-green-600 bg-gray-100" : validationStatus === "invalid" ? "text-red-600" : "text-gray-600 bg-gray-100"}`,
14480
+ title: validationStatus === "valid" ? "Correct OTP" : validationStatus === "invalid" ? "Incorrect OTP" : "OTP Timer",
14481
+ children: [
14482
+ validationStatus === "valid" && /* @__PURE__ */ jsxRuntimeExports.jsx(FaCheck, { size: 18 }),
14483
+ validationStatus === "invalid" && /* @__PURE__ */ jsxRuntimeExports.jsx(IoMdClose, { size: 18 }),
14484
+ typeof timer === "number" && validationStatus !== "valid" && `${timer}s`
14485
+ ]
14486
+ }
14487
+ ),
14488
+ isPassword && /* @__PURE__ */ jsxRuntimeExports.jsx(
14489
+ "button",
14490
+ {
14491
+ type: "button",
14492
+ onClick: () => setShowPassword(!showPassword),
14493
+ className: "px-2 bg-white text-gray-500 border-l border-[#3B5AA1]",
14494
+ children: showPassword ? /* @__PURE__ */ jsxRuntimeExports.jsx(FiEye, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(FiEyeOff, {})
14495
+ }
14496
+ ),
14497
+ button?.label && /* @__PURE__ */ jsxRuntimeExports.jsx(
14498
+ "button",
14499
+ {
14500
+ onClick: button?.onClick,
14501
+ disabled: disabled || enable,
14502
+ className: `px-2 py-2 text-white ${backgroundColor2 || "bg-[#3B5AA1]"} border-l border-[#3B5AA1] rounded-r-md ${disabled || enable ? "opacity-50 cursor-not-allowed" : ""}`,
14503
+ style: { height: height2 },
14504
+ children: button.loader ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { inline: true }) : button.label
14505
+ }
14506
+ )
14507
+ ]
14508
+ }
14509
+ )
14478
14510
  }
14479
14511
  )
14480
14512
  ] }),
@@ -15776,11 +15808,18 @@ function DynamicTabs({
15776
15808
  centered = false,
15777
15809
  scrollButtons = "auto",
15778
15810
  indicatorColor = "primary",
15779
- textColor = "primary"
15811
+ textColor = "primary",
15812
+ handleTabChange,
15813
+ tabIndex
15780
15814
  }) {
15781
- const [value, setValue] = useState(defaultValue);
15815
+ const [value, setValue] = useState(tabIndex || defaultValue);
15816
+ useEffect(() => {
15817
+ const setUpVal = tabs.length - 1 >= tabIndex ? tabIndex : tabs.length - 1;
15818
+ setValue(setUpVal);
15819
+ }, [tabIndex]);
15782
15820
  const handleChange = (event, newValue) => {
15783
15821
  setValue(newValue);
15822
+ handleTabChange(newValue);
15784
15823
  };
15785
15824
  const getTabsStyles = () => {
15786
15825
  const baseStyles = "w-full";
@@ -16403,13 +16442,20 @@ const createLucideIcon = (iconName, iconNode) => {
16403
16442
  Component.displayName = toPascalCase(iconName);
16404
16443
  return Component;
16405
16444
  };
16406
- const __iconNode$4 = [
16445
+ const __iconNode$6 = [
16446
+ ["path", { d: "M8 2v4", key: "1cmpym" }],
16447
+ ["path", { d: "M16 2v4", key: "4m81vk" }],
16448
+ ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
16449
+ ["path", { d: "M3 10h18", key: "8toen8" }]
16450
+ ];
16451
+ const Calendar = createLucideIcon("calendar", __iconNode$6);
16452
+ const __iconNode$5 = [
16407
16453
  ["path", { d: "M12 15V3", key: "m9g1x1" }],
16408
16454
  ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
16409
16455
  ["path", { d: "m7 10 5 5 5-5", key: "brsn70" }]
16410
16456
  ];
16411
- const Download = createLucideIcon("download", __iconNode$4);
16412
- const __iconNode$3 = [
16457
+ const Download = createLucideIcon("download", __iconNode$5);
16458
+ const __iconNode$4 = [
16413
16459
  [
16414
16460
  "path",
16415
16461
  {
@@ -16418,28 +16464,33 @@ const __iconNode$3 = [
16418
16464
  }
16419
16465
  ]
16420
16466
  ];
16421
- const Funnel = createLucideIcon("funnel", __iconNode$3);
16422
- const __iconNode$2 = [
16467
+ const Funnel = createLucideIcon("funnel", __iconNode$4);
16468
+ const __iconNode$3 = [
16423
16469
  ["path", { d: "m8 11 2 2 4-4", key: "1sed1v" }],
16424
16470
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
16425
16471
  ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
16426
16472
  ];
16427
- const SearchCheck = createLucideIcon("search-check", __iconNode$2);
16428
- const __iconNode$1 = [
16473
+ const SearchCheck = createLucideIcon("search-check", __iconNode$3);
16474
+ const __iconNode$2 = [
16429
16475
  ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
16430
16476
  ["line", { x1: "3", x2: "21", y1: "9", y2: "9", key: "1vqk6q" }],
16431
16477
  ["line", { x1: "3", x2: "21", y1: "15", y2: "15", key: "o2sbyz" }],
16432
16478
  ["line", { x1: "9", x2: "9", y1: "9", y2: "21", key: "1ib60c" }],
16433
16479
  ["line", { x1: "15", x2: "15", y1: "9", y2: "21", key: "1n26ft" }]
16434
16480
  ];
16435
- const Sheet = createLucideIcon("sheet", __iconNode$1);
16436
- const __iconNode = [
16481
+ const Sheet = createLucideIcon("sheet", __iconNode$2);
16482
+ const __iconNode$1 = [
16437
16483
  ["path", { d: "M12 3v18", key: "108xh3" }],
16438
16484
  ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
16439
16485
  ["path", { d: "M3 9h18", key: "1pudct" }],
16440
16486
  ["path", { d: "M3 15h18", key: "5xshup" }]
16441
16487
  ];
16442
- const Table = createLucideIcon("table", __iconNode);
16488
+ const Table = createLucideIcon("table", __iconNode$1);
16489
+ const __iconNode = [
16490
+ ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
16491
+ ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
16492
+ ];
16493
+ const X = createLucideIcon("x", __iconNode);
16443
16494
  var weekOfYear$1 = { exports: {} };
16444
16495
  var weekOfYear = weekOfYear$1.exports;
16445
16496
  var hasRequiredWeekOfYear;
@@ -17782,9 +17833,41 @@ const buildColumn = (col, fyOptions, detectedColumnTypes, aggregates) => {
17782
17833
  };
17783
17834
  }
17784
17835
  if (col.TotTyp) {
17785
- column.Footer = () => {
17786
- const value = aggregates[col.ColFields];
17787
- if (value === void 0 || value === null) return "";
17836
+ column.Footer = ({ table }) => {
17837
+ const rows = table.getFilteredRowModel().rows;
17838
+ if (!rows.length) return "";
17839
+ let count = 0;
17840
+ let sum = 0;
17841
+ let min2 = Infinity;
17842
+ let max2 = -Infinity;
17843
+ for (const row of rows) {
17844
+ const val = Number(row.original[col.ColFields]);
17845
+ if (isNaN(val)) continue;
17846
+ count++;
17847
+ sum += val;
17848
+ min2 = Math.min(min2, val);
17849
+ max2 = Math.max(max2, val);
17850
+ }
17851
+ let value;
17852
+ switch (col.TotTyp) {
17853
+ case "SUM":
17854
+ value = sum;
17855
+ break;
17856
+ case "AVG":
17857
+ value = count ? sum / count : 0;
17858
+ break;
17859
+ case "MIN":
17860
+ value = count ? min2 : "";
17861
+ break;
17862
+ case "MAX":
17863
+ value = count ? max2 : "";
17864
+ break;
17865
+ case "COUNT":
17866
+ value = count;
17867
+ break;
17868
+ default:
17869
+ return "";
17870
+ }
17788
17871
  if (isNumericColumn && col.IsPercentage) {
17789
17872
  return formatPercentage({
17790
17873
  value,
@@ -17825,6 +17908,7 @@ const defaultControlOpt = {
17825
17908
  colPinning: true,
17826
17909
  pagination: true,
17827
17910
  rowSelection: false,
17911
+ enableSelectAllRows: true,
17828
17912
  rowPinning: false,
17829
17913
  grouping: false,
17830
17914
  sorting: true,
@@ -17841,7 +17925,8 @@ function SmartGridTable({
17841
17925
  topToolbar = defaultToolBarOpt,
17842
17926
  controls = defaultControlOpt,
17843
17927
  onRowSelectionChange,
17844
- isLoading = false
17928
+ isLoading = false,
17929
+ resetRowSelection
17845
17930
  }) {
17846
17931
  const safeColumns = useMemo(
17847
17932
  () => sanitizeColumns(columns),
@@ -17853,6 +17938,9 @@ function SmartGridTable({
17853
17938
  );
17854
17939
  const [rowSelection, setRowSelection] = useState({});
17855
17940
  const isMobile = useMediaQuery("(max-width:600px)");
17941
+ useEffect(() => {
17942
+ setRowSelection({});
17943
+ }, [resetRowSelection]);
17856
17944
  const mergedTheme = { ...DEFAULT_THEME, ...theme };
17857
17945
  topToolbar = { ...defaultToolBarOpt, ...topToolbar };
17858
17946
  controls = { ...defaultControlOpt, ...controls };
@@ -17930,7 +18018,7 @@ function SmartGridTable({
17930
18018
  const finalColumns = useMemo(() => {
17931
18019
  if (safeColumns.length === 0) return [];
17932
18020
  return safeColumns.sort((a, b) => a.ColOrder - b.ColOrder).map(
17933
- (col) => buildColumn(col, fyOptions, detectedColumnTypes, aggregates)
18021
+ (col) => buildColumn(col, fyOptions, detectedColumnTypes)
17934
18022
  );
17935
18023
  }, [safeColumns, fyOptions, detectedColumnTypes, aggregates]);
17936
18024
  const columnPinning = useMemo(() => {
@@ -17979,6 +18067,7 @@ function SmartGridTable({
17979
18067
  enablePagination: !isGridDisabled && controls.pagination,
17980
18068
  enableColumnActions: !isGridDisabled && controls.columnActions,
17981
18069
  enableRowSelection: !isGridDisabled && controls.rowSelection,
18070
+ enableSelectAll: !isGridDisabled && controls.rowSelection && controls?.enableSelectAllRows,
17982
18071
  enableGrouping: !isGridDisabled && controls.grouping,
17983
18072
  enableSorting: !isGridDisabled && controls.sorting,
17984
18073
  enableEditing: !isGridDisabled && controls.editing,
@@ -18423,48 +18512,561 @@ const ExportButton = ({
18423
18512
  )
18424
18513
  ] });
18425
18514
  };
18426
- const SmartTable = ({
18427
- controls = {
18428
- columnActions: true,
18429
- dragging: false,
18430
- colPinning: true,
18431
- pagination: true,
18432
- rowSelection: false,
18433
- rowPinning: false,
18434
- grouping: false,
18435
- sorting: true,
18436
- editing: false,
18437
- resizing: true
18438
- },
18439
- topToolbar = {
18440
- enabled: true,
18441
- globalSearch: true,
18442
- columnFilters: true,
18443
- densityToggle: true,
18444
- fullscreenToggle: false,
18445
- exportBtn: true,
18446
- showHideColumnsBtn: true
18447
- },
18448
- theme = {
18449
- headerBg: "#3f5fa3",
18450
- headerText: "#ffffff",
18451
- bodyBg: "#ffffff",
18452
- border: "#cfd6e4"
18515
+ const SmartTable = (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(LocalizationProvider, { dateAdapter: AdapterDayjs, children: /* @__PURE__ */ jsxRuntimeExports.jsx(SmartGridTable, { ...props }) });
18516
+ const FinancialDateRangePicker = ({
18517
+ value = null,
18518
+ onChange = () => {
18453
18519
  },
18454
- height: height2 = "100%",
18455
- width: width2 = "100%",
18456
- columns = [],
18457
- data = [],
18458
- paginationStyle = "default",
18459
- isLoading = false,
18460
- onRowSelectionChange = () => {
18461
- }
18520
+ placeholder = "Select date range",
18521
+ className = "",
18522
+ disabled = false,
18523
+ error = "",
18524
+ label = "",
18525
+ required = false,
18526
+ defaultMode = "yearly",
18527
+ showFinancialYear = true,
18528
+ showYearly = true,
18529
+ showMonthly = true,
18530
+ showCustom = true,
18531
+ isSticky = false,
18532
+ stickyTop = 0,
18533
+ stickyRight = 0
18462
18534
  }) => {
18463
- const props = { controls, topToolbar, height: height2, width: width2, isLoading, columns, data, onRowSelectionChange, paginationStyle, theme };
18464
- return /* @__PURE__ */ jsxRuntimeExports.jsx(LocalizationProvider, { dateAdapter: AdapterDayjs, children: /* @__PURE__ */ jsxRuntimeExports.jsx(SmartGridTable, { ...props }) });
18535
+ const [isOpen, setIsOpen] = useState(false);
18536
+ const [selectionMode, setSelectionMode] = useState(defaultMode);
18537
+ const [financialYear, setFinancialYear] = useState("");
18538
+ const [yearlySubMode, setYearlySubMode] = useState("half-yearly");
18539
+ const [selectedHalfYear, setSelectedHalfYear] = useState(null);
18540
+ const [selectedQuarter, setSelectedQuarter] = useState(null);
18541
+ const [selectedMonthStart, setSelectedMonthStart] = useState(null);
18542
+ const [selectedMonthEnd, setSelectedMonthEnd] = useState(null);
18543
+ const [monthRangeSelecting, setMonthRangeSelecting] = useState(false);
18544
+ const [customStart, setCustomStart] = useState("");
18545
+ const [customEnd, setCustomEnd] = useState("");
18546
+ const [tempDateRange, setTempDateRange] = useState({ start: "", end: "" });
18547
+ const [dropdownPosition, setDropdownPosition] = useState({
18548
+ top: true,
18549
+ left: 0,
18550
+ right: "auto",
18551
+ arrowLeft: 24
18552
+ });
18553
+ const containerRef = useRef(null);
18554
+ const dropdownRef = useRef(null);
18555
+ const inputRef = useRef(null);
18556
+ const [parentWidth, setParentWidth] = useState("100%");
18557
+ useEffect(() => {
18558
+ if (containerRef.current) {
18559
+ const parent = containerRef.current.parentElement;
18560
+ const updateWidth = () => {
18561
+ setParentWidth(parent.offsetWidth);
18562
+ };
18563
+ updateWidth();
18564
+ window.addEventListener("resize", updateWidth);
18565
+ return () => window.removeEventListener("resize", updateWidth);
18566
+ }
18567
+ }, []);
18568
+ const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
18569
+ const financialYears = Array.from({ length: 5 }, (_, i) => {
18570
+ const year = currentYear - 5 + i + 1;
18571
+ return `${year}-${String(year + 1).slice(2)}`;
18572
+ });
18573
+ const halfYears = [
18574
+ { id: "H1", label: "H1 (Apr-Sep)", startMonth: 3, endMonth: 8 },
18575
+ { id: "H2", label: "H2 (Oct-Mar)", startMonth: 9, endMonth: 2 }
18576
+ ];
18577
+ const quarters = [
18578
+ { id: "Q1", label: "Q1 (Apr-Jun)", startMonth: 3, endMonth: 5 },
18579
+ { id: "Q2", label: "Q2 (Jul-Sep)", startMonth: 6, endMonth: 8 },
18580
+ { id: "Q3", label: "Q3 (Oct-Dec)", startMonth: 9, endMonth: 11 },
18581
+ { id: "Q4", label: "Q4 (Jan-Mar)", startMonth: 0, endMonth: 2 }
18582
+ ];
18583
+ const months = [
18584
+ { id: 4, label: "April", short: "Apr", index: 3 },
18585
+ { id: 5, label: "May", short: "May", index: 4 },
18586
+ { id: 6, label: "June", short: "Jun", index: 5 },
18587
+ { id: 7, label: "July", short: "Jul", index: 6 },
18588
+ { id: 8, label: "August", short: "Aug", index: 7 },
18589
+ { id: 9, label: "September", short: "Sep", index: 8 },
18590
+ { id: 10, label: "October", short: "Oct", index: 9 },
18591
+ { id: 11, label: "November", short: "Nov", index: 10 },
18592
+ { id: 12, label: "December", short: "Dec", index: 11 },
18593
+ { id: 1, label: "January", short: "Jan", index: 0 },
18594
+ { id: 2, label: "February", short: "Feb", index: 1 },
18595
+ { id: 3, label: "March", short: "Mar", index: 2 }
18596
+ ];
18597
+ useEffect(() => {
18598
+ if (isOpen && value) {
18599
+ setTempDateRange(value);
18600
+ setSelectionMode(value?.mode);
18601
+ setFinancialYear(value?.financialYear);
18602
+ if (value?.mode === "monthly") {
18603
+ setSelectedMonthStart(value?.monthStart);
18604
+ setSelectedMonthEnd(value?.monthEnd);
18605
+ }
18606
+ if (value?.mode === "yearly") {
18607
+ setYearlySubMode(value?.yearlySubMode);
18608
+ setSelectedHalfYear(value?.halfYear);
18609
+ setSelectedQuarter(value?.quarter);
18610
+ }
18611
+ if (value?.mode === "custom") {
18612
+ setCustomStart(value?.start);
18613
+ setCustomEnd(value?.end);
18614
+ }
18615
+ }
18616
+ }, [value, isOpen]);
18617
+ useEffect(() => {
18618
+ if (isOpen && containerRef.current && dropdownRef.current && inputRef.current) {
18619
+ const calculatePosition = () => {
18620
+ const container = containerRef.current.getBoundingClientRect();
18621
+ const input = inputRef.current.getBoundingClientRect();
18622
+ const dropdown = dropdownRef.current;
18623
+ const dropdownWidth = 400;
18624
+ const dropdownHeight = dropdown.scrollHeight;
18625
+ const viewportHeight = window.innerHeight;
18626
+ const viewportWidth = window.innerWidth;
18627
+ const spaceBelow = viewportHeight - container.bottom;
18628
+ const spaceAbove = container.top;
18629
+ const showBelow = spaceBelow >= dropdownHeight + 10 || spaceBelow > spaceAbove;
18630
+ let leftPos = 0;
18631
+ let rightPos = "auto";
18632
+ let arrowLeftPos = 24;
18633
+ const containerLeft = container.left;
18634
+ const containerWidth = container.width;
18635
+ const containerRight = containerLeft + containerWidth;
18636
+ const fitsOnRight = containerLeft + dropdownWidth <= viewportWidth - 16;
18637
+ const fitsOnLeft = containerRight - dropdownWidth >= 16;
18638
+ if (fitsOnRight) {
18639
+ leftPos = 0;
18640
+ rightPos = "auto";
18641
+ arrowLeftPos = 24;
18642
+ } else if (fitsOnLeft) {
18643
+ leftPos = "auto";
18644
+ rightPos = 0;
18645
+ arrowLeftPos = dropdownWidth - 40;
18646
+ } else {
18647
+ const maxLeft = viewportWidth - dropdownWidth - 16;
18648
+ const desiredLeft = Math.max(16 - containerLeft, Math.min(0, maxLeft - containerLeft));
18649
+ leftPos = desiredLeft;
18650
+ rightPos = "auto";
18651
+ const inputCenter = input.left + input.width / 2 - container.left;
18652
+ arrowLeftPos = Math.max(16, Math.min(dropdownWidth - 32, inputCenter - desiredLeft - 8));
18653
+ }
18654
+ setDropdownPosition({
18655
+ top: showBelow,
18656
+ left: leftPos,
18657
+ right: rightPos,
18658
+ arrowLeft: arrowLeftPos
18659
+ });
18660
+ };
18661
+ setTimeout(calculatePosition, 10);
18662
+ window.addEventListener("resize", calculatePosition);
18663
+ window.addEventListener("scroll", calculatePosition, true);
18664
+ return () => {
18665
+ window.removeEventListener("resize", calculatePosition);
18666
+ window.removeEventListener("scroll", calculatePosition, true);
18667
+ };
18668
+ }
18669
+ }, [isOpen]);
18670
+ useEffect(() => {
18671
+ const handleClickOutside = (e) => {
18672
+ if (containerRef.current && !containerRef.current.contains(e.target)) {
18673
+ setIsOpen(false);
18674
+ }
18675
+ };
18676
+ if (isOpen) {
18677
+ document.addEventListener("mousedown", handleClickOutside);
18678
+ }
18679
+ return () => document.removeEventListener("mousedown", handleClickOutside);
18680
+ }, [isOpen]);
18681
+ const getHalfYearDates = (fy, halfYear) => {
18682
+ const [startYear] = fy.split("-");
18683
+ const year = parseInt(startYear);
18684
+ const hy = halfYears.find((h) => h.id === halfYear);
18685
+ const startDate = new Date(
18686
+ hy.startMonth >= 3 ? year : year + 1,
18687
+ hy.startMonth,
18688
+ 1
18689
+ );
18690
+ const endDate = new Date(
18691
+ hy.endMonth >= 3 ? year : year + 1,
18692
+ hy.endMonth + 1,
18693
+ 0
18694
+ );
18695
+ return {
18696
+ start: startDate.toLocaleDateString("en-CA"),
18697
+ end: endDate.toLocaleDateString("en-CA")
18698
+ };
18699
+ };
18700
+ const getQuarterDates = (fy, quarter) => {
18701
+ const [startYear] = fy.split("-");
18702
+ const year = parseInt(startYear);
18703
+ const q = quarters.find((q2) => q2.id === quarter);
18704
+ const startDate = new Date(
18705
+ q.startMonth >= 3 ? year : year + 1,
18706
+ q.startMonth,
18707
+ 1
18708
+ );
18709
+ const endDate = new Date(
18710
+ q.endMonth >= 3 ? year : year + 1,
18711
+ q.endMonth + 1,
18712
+ 0
18713
+ );
18714
+ return {
18715
+ start: startDate.toLocaleDateString("en-CA"),
18716
+ end: endDate.toLocaleDateString("en-CA")
18717
+ };
18718
+ };
18719
+ const getMonthRangeDates = (fy, startMonthId, endMonthId) => {
18720
+ const [startYear] = fy.split("-");
18721
+ const year = parseInt(startYear);
18722
+ const startMonth = months.find((m) => m.id === startMonthId);
18723
+ const endMonth = months.find((m) => m.id === endMonthId);
18724
+ const startDate = new Date(
18725
+ startMonth.index >= 3 ? year : year + 1,
18726
+ startMonth.index,
18727
+ 1
18728
+ );
18729
+ const endDate = new Date(
18730
+ endMonth.index >= 3 ? year : year + 1,
18731
+ endMonth.index + 1,
18732
+ 0
18733
+ );
18734
+ return {
18735
+ start: startDate.toLocaleDateString("en-CA"),
18736
+ end: endDate.toLocaleDateString("en-CA")
18737
+ };
18738
+ };
18739
+ useEffect(() => {
18740
+ if (selectionMode === "yearly") {
18741
+ if (selectedHalfYear) {
18742
+ const dates = getHalfYearDates(financialYear, selectedHalfYear);
18743
+ setTempDateRange(dates);
18744
+ } else if (selectedQuarter) {
18745
+ const dates = getQuarterDates(financialYear, selectedQuarter);
18746
+ setTempDateRange(dates);
18747
+ }
18748
+ } else if (selectionMode === "monthly" && selectedMonthStart && selectedMonthEnd) {
18749
+ const dates = getMonthRangeDates(financialYear, selectedMonthStart, selectedMonthEnd);
18750
+ setTempDateRange(dates);
18751
+ } else if (selectionMode === "custom" && customStart && customEnd) {
18752
+ setTempDateRange({ start: customStart, end: customEnd });
18753
+ }
18754
+ }, [selectionMode, yearlySubMode, financialYear, selectedHalfYear, selectedQuarter, selectedMonthStart, selectedMonthEnd, customStart, customEnd]);
18755
+ const handleHalfYearSelect = (halfYearId) => {
18756
+ setSelectedHalfYear(halfYearId);
18757
+ setSelectedQuarter(null);
18758
+ };
18759
+ const handleQuarterSelect = (quarterId) => {
18760
+ setSelectedQuarter(quarterId);
18761
+ setSelectedHalfYear(null);
18762
+ };
18763
+ const handleMonthClick = (monthId) => {
18764
+ if (!monthRangeSelecting) {
18765
+ setSelectedMonthStart(monthId);
18766
+ setSelectedMonthEnd(null);
18767
+ setMonthRangeSelecting(true);
18768
+ } else {
18769
+ const startId = selectedMonthStart;
18770
+ const endId = monthId;
18771
+ const startIndex = months.findIndex((m) => m.id === startId);
18772
+ const endIndex = months.findIndex((m) => m.id === endId);
18773
+ if (startIndex <= endIndex) {
18774
+ setSelectedMonthStart(startId);
18775
+ setSelectedMonthEnd(endId);
18776
+ } else {
18777
+ setSelectedMonthStart(endId);
18778
+ setSelectedMonthEnd(startId);
18779
+ }
18780
+ setMonthRangeSelecting(false);
18781
+ }
18782
+ };
18783
+ const isMonthInRange = (monthId) => {
18784
+ if (!selectedMonthStart) return false;
18785
+ if (!selectedMonthEnd) return monthId === selectedMonthStart;
18786
+ const startIndex = months.findIndex((m) => m.id === selectedMonthStart);
18787
+ const endIndex = months.findIndex((m) => m.id === selectedMonthEnd);
18788
+ const currentIndex = months.findIndex((m) => m.id === monthId);
18789
+ const minIndex = Math.min(startIndex, endIndex);
18790
+ const maxIndex = Math.max(startIndex, endIndex);
18791
+ return currentIndex >= minIndex && currentIndex <= maxIndex;
18792
+ };
18793
+ const isMonthRangeEdge = (monthId) => {
18794
+ return monthId === selectedMonthStart || monthId === selectedMonthEnd;
18795
+ };
18796
+ const resetAllSelections = () => {
18797
+ setSelectedHalfYear(null);
18798
+ setSelectedQuarter(null);
18799
+ setSelectedMonthStart(null);
18800
+ setSelectedMonthEnd(null);
18801
+ setMonthRangeSelecting(false);
18802
+ setCustomStart("");
18803
+ setCustomEnd("");
18804
+ setTempDateRange({ start: "", end: "" });
18805
+ };
18806
+ const handleCancel = () => {
18807
+ resetAllSelections();
18808
+ setIsOpen(false);
18809
+ };
18810
+ const handleApply = () => {
18811
+ if (tempDateRange.start && tempDateRange.end) {
18812
+ onChange({
18813
+ start: tempDateRange.start,
18814
+ end: tempDateRange.end,
18815
+ financialYear,
18816
+ mode: selectionMode,
18817
+ yearlySubMode: selectionMode === "yearly" ? yearlySubMode : null,
18818
+ halfYear: selectedHalfYear,
18819
+ quarter: selectedQuarter,
18820
+ monthStart: selectedMonthStart,
18821
+ monthEnd: selectedMonthEnd
18822
+ });
18823
+ setIsOpen(false);
18824
+ }
18825
+ };
18826
+ const handleClear = () => {
18827
+ resetAllSelections();
18828
+ onChange(null);
18829
+ setFinancialYear((/* @__PURE__ */ new Date()).getFullYear() + "-" + String((/* @__PURE__ */ new Date()).getFullYear() + 1).slice(2));
18830
+ };
18831
+ const formatDate2 = (dateStr) => {
18832
+ if (!dateStr) return "";
18833
+ const date = new Date(dateStr);
18834
+ return date.toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
18835
+ };
18836
+ const getDisplayValue = () => {
18837
+ if (!value) return "";
18838
+ return `${formatDate2(value.start)} - ${formatDate2(value.end)}`;
18839
+ };
18840
+ const availableModes = [];
18841
+ if (showYearly) availableModes.push("yearly");
18842
+ if (showMonthly) availableModes.push("monthly");
18843
+ if (showCustom) availableModes.push("custom");
18844
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
18845
+ "div",
18846
+ {
18847
+ ref: containerRef,
18848
+ className: `${isSticky ? "fixed z-40 bg-white" : "relative"} ${className}`,
18849
+ style: isSticky ? {
18850
+ top: stickyTop,
18851
+ right: stickyRight || "auto",
18852
+ width: parentWidth
18853
+ // dynamic width applied here
18854
+ } : {},
18855
+ children: [
18856
+ label && /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: [
18857
+ label,
18858
+ required && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" })
18859
+ ] }),
18860
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
18861
+ "div",
18862
+ {
18863
+ ref: inputRef,
18864
+ onClick: () => !disabled && setIsOpen(!isOpen),
18865
+ className: `
18866
+ flex items-center justify-between px-3 sm:px-4 py-2 sm:py-3 border-2 rounded-lg cursor-pointer transition
18867
+ ${disabled ? "bg-gray-100 cursor-not-allowed" : "bg-white hover:border-[#3B5AA1]/70"}
18868
+ ${error ? "border-red-500" : "border-gray-300"}
18869
+ ${isOpen ? "border-[#3B5AA1]/70 ring-2 ring-[#3B5AA1]/70" : ""}
18870
+ `,
18871
+ children: [
18872
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 flex-1 min-w-0", children: [
18873
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Calendar, { className: `w-4 h-4 sm:w-5 sm:h-5 flex-shrink-0 ${disabled ? "text-gray-400" : "text-[#3B5AA1]"}` }),
18874
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-xs sm:text-sm truncate ${value ? "text-gray-900" : "text-gray-400"}`, children: getDisplayValue() || placeholder })
18875
+ ] }),
18876
+ value && !disabled && /* @__PURE__ */ jsxRuntimeExports.jsx(
18877
+ "button",
18878
+ {
18879
+ onClick: (e) => {
18880
+ e.stopPropagation();
18881
+ handleClear();
18882
+ },
18883
+ className: "p-1 hover:bg-gray-100 rounded flex-shrink-0 ml-2",
18884
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "w-3 h-3 sm:w-4 sm:h-4 text-gray-500" })
18885
+ }
18886
+ )
18887
+ ]
18888
+ }
18889
+ ),
18890
+ error && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-1 text-xs text-red-500", children: error }),
18891
+ isOpen && /* @__PURE__ */ jsxRuntimeExports.jsxs(
18892
+ "div",
18893
+ {
18894
+ ref: dropdownRef,
18895
+ style: {
18896
+ left: dropdownPosition.left !== "auto" ? `${dropdownPosition.left}px` : "auto",
18897
+ right: dropdownPosition.right !== "auto" ? `${dropdownPosition.right}px` : "auto"
18898
+ },
18899
+ className: `
18900
+ absolute z-50 w-full sm:w-[400px] bg-white rounded-xl shadow-2xl border-2 border-gray-200
18901
+ ${dropdownPosition.top ? "mt-2" : "mb-2 bottom-full"}
18902
+ `,
18903
+ children: [
18904
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
18905
+ "div",
18906
+ {
18907
+ style: { left: `${dropdownPosition.arrowLeft}px` },
18908
+ className: `
18909
+ absolute w-4 h-4 bg-white border-gray-200 transform rotate-45
18910
+ ${dropdownPosition.top ? "-top-2 border-t-2 border-l-2" : "-bottom-2 border-b-2 border-r-2"}
18911
+ `
18912
+ }
18913
+ ),
18914
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative bg-white rounded-xl p-4 sm:p-5 max-h-[70vh] overflow-y-auto", children: [
18915
+ showFinancialYear && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-4", children: [
18916
+ /* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "block text-xs sm:text-sm font-semibold text-gray-700 mb-2", children: "Financial Year" }),
18917
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
18918
+ "select",
18919
+ {
18920
+ value: financialYear,
18921
+ onChange: (e) => {
18922
+ setFinancialYear(e.target.value);
18923
+ resetAllSelections();
18924
+ },
18925
+ 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",
18926
+ children: financialYears.map((fy) => /* @__PURE__ */ jsxRuntimeExports.jsxs("option", { value: fy, children: [
18927
+ "FY ",
18928
+ fy
18929
+ ] }, fy))
18930
+ }
18931
+ )
18932
+ ] }),
18933
+ 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(
18934
+ "button",
18935
+ {
18936
+ onClick: () => {
18937
+ setSelectionMode(mode);
18938
+ resetAllSelections();
18939
+ },
18940
+ 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"}`,
18941
+ children: mode
18942
+ },
18943
+ mode
18944
+ )) }),
18945
+ selectionMode === "yearly" && showYearly && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-4", children: [
18946
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
18947
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-sm font-semibold text-gray-700 mb-3", children: "Select Half Year" }),
18948
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-2 gap-2", children: halfYears.map((halfYear) => /* @__PURE__ */ jsxRuntimeExports.jsx(
18949
+ "button",
18950
+ {
18951
+ onClick: () => handleHalfYearSelect(halfYear.id),
18952
+ 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"}`,
18953
+ children: halfYear.label
18954
+ },
18955
+ halfYear.id
18956
+ )) })
18957
+ ] }),
18958
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-3", children: [
18959
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-sm font-semibold text-gray-700 mb-3", children: "Select Quarter" }),
18960
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-2 gap-2", children: quarters.map((quarter) => /* @__PURE__ */ jsxRuntimeExports.jsx(
18961
+ "button",
18962
+ {
18963
+ onClick: () => handleQuarterSelect(quarter.id),
18964
+ 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"}`,
18965
+ children: quarter.label
18966
+ },
18967
+ quarter.id
18968
+ )) })
18969
+ ] })
18970
+ ] }),
18971
+ selectionMode === "monthly" && showMonthly && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-4", children: [
18972
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between mb-2", children: [
18973
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-sm font-semibold text-gray-700", children: "Select Month Range" }),
18974
+ monthRangeSelecting && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-[#3B5AA1] font-medium", children: "Select end →" })
18975
+ ] }),
18976
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-3 gap-2", children: months.map((month) => {
18977
+ const inRange = isMonthInRange(month.id);
18978
+ const isEdge = isMonthRangeEdge(month.id);
18979
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
18980
+ "button",
18981
+ {
18982
+ onClick: () => handleMonthClick(month.id),
18983
+ 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"}`,
18984
+ children: month.short
18985
+ },
18986
+ month.id
18987
+ );
18988
+ }) }),
18989
+ selectedMonthStart && selectedMonthEnd && /* @__PURE__ */ jsxRuntimeExports.jsx(
18990
+ "button",
18991
+ {
18992
+ onClick: () => {
18993
+ setSelectedMonthStart(null);
18994
+ setSelectedMonthEnd(null);
18995
+ setMonthRangeSelecting(false);
18996
+ },
18997
+ className: "mt-2 text-xs text-[#3B5AA1] hover:underline font-medium",
18998
+ children: "Clear Selection"
18999
+ }
19000
+ )
19001
+ ] }),
19002
+ selectionMode === "custom" && showCustom && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-4", children: [
19003
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-sm font-semibold text-gray-700 mb-3", children: "Custom Date Range" }),
19004
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-3", children: [
19005
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
19006
+ /* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "block text-xs font-medium text-gray-600 mb-1", children: "Start Date" }),
19007
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
19008
+ "input",
19009
+ {
19010
+ type: "date",
19011
+ value: customStart,
19012
+ onChange: (e) => setCustomStart(e.target.value),
19013
+ 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"
19014
+ }
19015
+ )
19016
+ ] }),
19017
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
19018
+ /* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "block text-xs font-medium text-gray-600 mb-1", children: "End Date" }),
19019
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
19020
+ "input",
19021
+ {
19022
+ type: "date",
19023
+ value: customEnd,
19024
+ onChange: (e) => setCustomEnd(e.target.value),
19025
+ min: customStart,
19026
+ 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"
19027
+ }
19028
+ )
19029
+ ] })
19030
+ ] })
19031
+ ] }),
19032
+ tempDateRange.start && tempDateRange.end && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-[#3B5AA1]/10 rounded-lg p-3 mb-4 border border-[#3B5AA1]/70", children: [
19033
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs font-medium text-gray-600 mb-1", children: "Selected Range" }),
19034
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-xs font-semibold text-[#3B5AA1] break-words", children: [
19035
+ formatDate2(tempDateRange.start),
19036
+ " - ",
19037
+ formatDate2(tempDateRange.end)
19038
+ ] })
19039
+ ] }),
19040
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2", children: [
19041
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
19042
+ "button",
19043
+ {
19044
+ onClick: handleCancel,
19045
+ 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",
19046
+ children: "Cancel"
19047
+ }
19048
+ ),
19049
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
19050
+ "button",
19051
+ {
19052
+ onClick: handleApply,
19053
+ disabled: !tempDateRange.start || !tempDateRange.end,
19054
+ 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"}`,
19055
+ children: "Apply"
19056
+ }
19057
+ )
19058
+ ] })
19059
+ ] })
19060
+ ]
19061
+ }
19062
+ )
19063
+ ]
19064
+ }
19065
+ );
18465
19066
  };
18466
19067
  export {
18467
19068
  ComboDropdown as MytekComboDropdown,
19069
+ FinancialDateRangePicker as MytekFinancialDateRangePicker,
18468
19070
  CustomInput as MytekInputField,
18469
19071
  Loader as MytekLoader,
18470
19072
  Mt_MessageBox as MytekMessageBox,