@megha-ui/react 1.3.123 → 1.3.125

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.
@@ -18,7 +18,7 @@ import { getTotalPages } from "./utils/pagination";
18
18
  import { useSort } from "./hooks/useSort";
19
19
  import { usePagination } from "./hooks/usePagination";
20
20
  import { useBulkSelect } from "./hooks/useBulkSelect";
21
- import { createRegexFromWildcard, isValidDateFormat, matchSqlLikePattern, } from "./utils/regexUtils";
21
+ import { createRegexFromWildcard, isValidDateFormat, matchSqlLikePattern, matchSqlComparisonPattern, } from "./utils/regexUtils";
22
22
  import { FiEye, FiShare, FiChevronsLeft, FiChevronsRight, } from "react-icons/fi";
23
23
  import { MdFilterAltOff, MdGroupOff, MdSave, MdLayers, MdLayersClear, } from "react-icons/md";
24
24
  import GlobalSearchChiProps from "./utils/globalSearchChips";
@@ -189,6 +189,9 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
189
189
  if (query.includes("%") || query.includes("_")) {
190
190
  return matchSqlLikePattern(query, value);
191
191
  }
192
+ if (/^\s*(>=|<=|!=|>|<|=)/.test(query)) {
193
+ return matchSqlComparisonPattern(query, value);
194
+ }
192
195
  switch ((_c = searchQueries[column.key]) === null || _c === void 0 ? void 0 : _c.type) {
193
196
  case "contains":
194
197
  return value.toLowerCase().includes(query.toLowerCase());
@@ -270,6 +273,9 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
270
273
  if (query.includes("%") || query.includes("_")) {
271
274
  return matchSqlLikePattern(query, value);
272
275
  }
276
+ if (/^\s*(>=|<=|!=|>|<|=)/.test(query)) {
277
+ return matchSqlComparisonPattern(query, value);
278
+ }
273
279
  switch ((_c = searchQueries[column.key]) === null || _c === void 0 ? void 0 : _c.type) {
274
280
  case "contains":
275
281
  return value.toLowerCase().includes(query.toLowerCase());
@@ -135,6 +135,69 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
135
135
  setSearchOpsPosition({ top, left });
136
136
  toggleDropdown(columnKey);
137
137
  };
138
+ const handleSearchInputChange = (e, columnKey) => {
139
+ var _a;
140
+ const input = e.target.value;
141
+ const toParts = input
142
+ .split("to")
143
+ .map((part) => part.trim())
144
+ .filter((part) => part !== "");
145
+ const dashParts = input
146
+ .split("-")
147
+ .map((part) => part.trim())
148
+ .filter((part) => part !== "");
149
+ const isNumericRange = (parts) => parts.length === 2 &&
150
+ parts.every((part) => !Number.isNaN(parseFloat(part)));
151
+ let searchType = ((_a = searchQueries[columnKey]) === null || _a === void 0 ? void 0 : _a.type) || defaultSearchOperation || "contains";
152
+ if (isNumericRange(toParts) || isNumericRange(dashParts)) {
153
+ searchType = "between";
154
+ }
155
+ else if (searchType === "between") {
156
+ searchType = "contains";
157
+ }
158
+ else if (input.includes("%")) {
159
+ const startsWithPercent = input.startsWith("%");
160
+ const endsWithPercent = input.endsWith("%");
161
+ if (startsWithPercent && endsWithPercent && input.length > 2) {
162
+ searchType = "contains";
163
+ }
164
+ else if (!startsWithPercent && endsWithPercent) {
165
+ searchType = "startsWith";
166
+ }
167
+ else if (startsWithPercent && !endsWithPercent) {
168
+ searchType = "endsWith";
169
+ }
170
+ }
171
+ onSearch(columnKey, input, searchType);
172
+ };
173
+ const handleSearchInputBlur = (e, columnKey) => {
174
+ var _a;
175
+ const currentKey = columnKey || "";
176
+ const input = e.target.value.replace(/\?/g, "%");
177
+ const searchType = ((_a = searchQueries[currentKey]) === null || _a === void 0 ? void 0 : _a.type) || defaultSearchOperation || "contains";
178
+ let query = input;
179
+ const dashParts = query
180
+ .split("-")
181
+ .map((part) => part.trim())
182
+ .filter((part) => part !== "");
183
+ const isNumericRange = dashParts.length === 2 &&
184
+ dashParts.every((part) => !Number.isNaN(parseFloat(part)));
185
+ if (isNumericRange) {
186
+ query = `${dashParts[0]}to${dashParts[1]}`;
187
+ }
188
+ if (query && !query.includes("%") && !query.includes("_")) {
189
+ if (searchType === "contains") {
190
+ query = `%${query}%`;
191
+ }
192
+ else if (searchType === "startsWith") {
193
+ query = `${query}%`;
194
+ }
195
+ else if (searchType === "endsWith") {
196
+ query = `%${query}`;
197
+ }
198
+ }
199
+ onSearch(currentKey, query, searchType);
200
+ };
138
201
  const handleSelect = (value, columnKey, columnData) => {
139
202
  var _a;
140
203
  let _uniqueSeach = {};
@@ -345,7 +408,6 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
345
408
  display: "flex",
346
409
  alignItems: "center",
347
410
  padding: "0 0.3rem",
348
- justifyContent: "space-between",
349
411
  cursor: ((_d = headerColumns.find((column) => column.key === _groupBy)) === null || _d === void 0 ? void 0 : _d.sortable)
350
412
  ? "pointer"
351
413
  : "",
@@ -404,58 +466,11 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
404
466
  var _a;
405
467
  return setActiveSearchColumn(((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "");
406
468
  }, onChange: (e) => {
407
- var _a, _b;
408
- const currentKey = ((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "";
409
- const input = e.target.value;
410
- let searchType = ((_b = searchQueries[currentKey]) === null || _b === void 0 ? void 0 : _b.type) ||
411
- defaultSearchOperation ||
412
- "contains";
413
- if (input.includes("to")) {
414
- searchType = "between";
415
- }
416
- else if (searchType === "between") {
417
- searchType = "contains";
418
- }
419
- else if (input.includes("%")) {
420
- const startsWithPercent = input.startsWith("%");
421
- const endsWithPercent = input.endsWith("%");
422
- if (startsWithPercent &&
423
- endsWithPercent &&
424
- input.length > 2) {
425
- searchType = "contains";
426
- }
427
- else if (!startsWithPercent &&
428
- endsWithPercent) {
429
- searchType = "startsWith";
430
- }
431
- else if (startsWithPercent &&
432
- !endsWithPercent) {
433
- searchType = "endsWith";
434
- }
435
- }
436
- onSearch(currentKey, input, searchType);
469
+ var _a;
470
+ return handleSearchInputChange(e, ((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "");
437
471
  }, onBlur: (e) => {
438
- var _a, _b;
439
- const currentKey = ((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "";
440
- const input = e.target.value.replace(/\?/g, "%");
441
- const searchType = ((_b = searchQueries[currentKey]) === null || _b === void 0 ? void 0 : _b.type) ||
442
- defaultSearchOperation ||
443
- "contains";
444
- let query = input;
445
- if (query &&
446
- !query.includes("%") &&
447
- !query.includes("_")) {
448
- if (searchType === "contains") {
449
- query = `%${query}%`;
450
- }
451
- else if (searchType === "startsWith") {
452
- query = `${query}%`;
453
- }
454
- else if (searchType === "endsWith") {
455
- query = `%${query}`;
456
- }
457
- }
458
- onSearch(currentKey, query, searchType);
472
+ var _a;
473
+ return handleSearchInputBlur(e, ((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "");
459
474
  }, placeholder: "Search", extraWrapperStyle: {
460
475
  background: ((_r = headerColumns.find((column) => column.key === _groupBy)) === null || _r === void 0 ? void 0 : _r.search)
461
476
  ? "var(--background)"
@@ -571,58 +586,11 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
571
586
  var _a;
572
587
  return setActiveSearchColumn(((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "");
573
588
  }, onChange: (e) => {
574
- var _a, _b;
575
- const currentKey = ((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "";
576
- const input = e.target.value;
577
- let searchType = ((_b = searchQueries[currentKey]) === null || _b === void 0 ? void 0 : _b.type) ||
578
- defaultSearchOperation ||
579
- "contains";
580
- if (input.includes("to")) {
581
- searchType = "between";
582
- }
583
- else if (searchType === "between") {
584
- searchType = "contains";
585
- }
586
- else if (input.includes("%")) {
587
- const startsWithPercent = input.startsWith("%");
588
- const endsWithPercent = input.endsWith("%");
589
- if (startsWithPercent &&
590
- endsWithPercent &&
591
- input.length > 2) {
592
- searchType = "contains";
593
- }
594
- else if (!startsWithPercent &&
595
- endsWithPercent) {
596
- searchType = "startsWith";
597
- }
598
- else if (startsWithPercent &&
599
- !endsWithPercent) {
600
- searchType = "endsWith";
601
- }
602
- }
603
- onSearch(currentKey, input, searchType);
589
+ var _a;
590
+ return handleSearchInputChange(e, ((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "");
604
591
  }, onBlur: (e) => {
605
- var _a, _b;
606
- const currentKey = ((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "";
607
- const input = e.target.value.replace(/\?/g, "%");
608
- const searchType = ((_b = searchQueries[currentKey]) === null || _b === void 0 ? void 0 : _b.type) ||
609
- defaultSearchOperation ||
610
- "contains";
611
- let query = input;
612
- if (query &&
613
- !query.includes("%") &&
614
- !query.includes("_")) {
615
- if (searchType === "contains") {
616
- query = `%${query}%`;
617
- }
618
- else if (searchType === "startsWith") {
619
- query = `${query}%`;
620
- }
621
- else if (searchType === "endsWith") {
622
- query = `%${query}`;
623
- }
624
- }
625
- onSearch(currentKey, query, searchType);
592
+ var _a;
593
+ return handleSearchInputBlur(e, ((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "");
626
594
  }, placeholder: "Search", extraWrapperStyle: {
627
595
  background: ((_24 = headerColumns.find((column) => column.key === _groupBy)) === null || _24 === void 0 ? void 0 : _24.search)
628
596
  ? "var(--background)"
@@ -738,56 +706,11 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
738
706
  var _a;
739
707
  return setActiveSearchColumn(((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "");
740
708
  }, onChange: (e) => {
741
- var _a, _b;
742
- const currentKey = ((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "";
743
- const input = e.target.value;
744
- let searchType = ((_b = searchQueries[currentKey]) === null || _b === void 0 ? void 0 : _b.type) ||
745
- defaultSearchOperation ||
746
- "contains";
747
- if (input.includes("to")) {
748
- searchType = "between";
749
- }
750
- else if (searchType === "between") {
751
- searchType = "contains";
752
- }
753
- else if (input.includes("%")) {
754
- const startsWithPercent = input.startsWith("%");
755
- const endsWithPercent = input.endsWith("%");
756
- if (startsWithPercent &&
757
- endsWithPercent &&
758
- input.length > 2) {
759
- searchType = "contains";
760
- }
761
- else if (!startsWithPercent && endsWithPercent) {
762
- searchType = "startsWith";
763
- }
764
- else if (startsWithPercent && !endsWithPercent) {
765
- searchType = "endsWith";
766
- }
767
- }
768
- onSearch(currentKey, input, searchType);
709
+ var _a;
710
+ return handleSearchInputChange(e, ((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "");
769
711
  }, onBlur: (e) => {
770
- var _a, _b;
771
- const currentKey = ((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "";
772
- const input = e.target.value.replace(/\?/g, "%");
773
- const searchType = ((_b = searchQueries[currentKey]) === null || _b === void 0 ? void 0 : _b.type) ||
774
- defaultSearchOperation ||
775
- "contains";
776
- let query = input;
777
- if (query &&
778
- !query.includes("%") &&
779
- !query.includes("_")) {
780
- if (searchType === "contains") {
781
- query = `%${query}%`;
782
- }
783
- else if (searchType === "startsWith") {
784
- query = `${query}%`;
785
- }
786
- else if (searchType === "endsWith") {
787
- query = `%${query}`;
788
- }
789
- }
790
- onSearch(currentKey, query, searchType);
712
+ var _a;
713
+ return handleSearchInputBlur(e, ((_a = headerColumns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.key) || "");
791
714
  }, placeholder: "Search", extraWrapperStyle: {
792
715
  background: ((_57 = headerColumns.find((column) => column.key === _groupBy)) === null || _57 === void 0 ? void 0 : _57.search)
793
716
  ? "var(--background)"
@@ -893,7 +816,6 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
893
816
  display: "flex",
894
817
  alignItems: "center",
895
818
  padding: "0 0.25rem",
896
- justifyContent: "space-between",
897
819
  cursor: column.sortable ? "pointer" : "",
898
820
  }, onClick: () => column.sortable && onSort(column), children: [_jsxs("div", { style: {
899
821
  display: "flex",
@@ -940,59 +862,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
940
862
  }, children: _jsxs("div", { style: {
941
863
  display: "flex",
942
864
  alignItems: "center",
943
- }, children: [_jsx(TextInput, { onFocus: () => setActiveSearchColumn(column.key), onChange: (e) => {
944
- var _a;
945
- const input = e.target.value;
946
- let searchType = ((_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.type) ||
947
- defaultSearchOperation ||
948
- "contains";
949
- if (input.includes("to")) {
950
- searchType = "between";
951
- }
952
- else if (searchType === "between") {
953
- searchType = "contains";
954
- }
955
- else if (input.includes("%")) {
956
- const startsWithPercent = input.startsWith("%");
957
- const endsWithPercent = input.endsWith("%");
958
- if (startsWithPercent &&
959
- endsWithPercent &&
960
- input.length > 2) {
961
- searchType = "contains";
962
- }
963
- else if (!startsWithPercent &&
964
- endsWithPercent) {
965
- searchType = "startsWith";
966
- }
967
- else if (startsWithPercent &&
968
- !endsWithPercent) {
969
- searchType = "endsWith";
970
- }
971
- }
972
- onSearch(column.key, input, searchType);
973
- }, onBlur: (e) => {
974
- var _a;
975
- const currentKey = (column === null || column === void 0 ? void 0 : column.key) || "";
976
- const input = e.target.value.replace(/\?/g, "%");
977
- const searchType = ((_a = searchQueries[currentKey]) === null || _a === void 0 ? void 0 : _a.type) ||
978
- defaultSearchOperation ||
979
- "contains";
980
- let query = input;
981
- if (query &&
982
- !query.includes("%") &&
983
- !query.includes("_")) {
984
- if (searchType === "contains") {
985
- query = `%${query}%`;
986
- }
987
- else if (searchType === "startsWith") {
988
- query = `${query}%`;
989
- }
990
- else if (searchType === "endsWith") {
991
- query = `%${query}`;
992
- }
993
- }
994
- onSearch(currentKey, query, searchType);
995
- }, placeholder: "Search", extraWrapperStyle: {
865
+ }, children: [_jsx(TextInput, { onFocus: () => setActiveSearchColumn(column.key), onChange: (e) => handleSearchInputChange(e, column.key), onBlur: (e) => handleSearchInputBlur(e, (column === null || column === void 0 ? void 0 : column.key) || ""), placeholder: "Search", extraWrapperStyle: {
996
866
  background: column.search
997
867
  ? "var(--background)"
998
868
  : "var(--disabled-bg)",
@@ -1068,59 +938,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
1068
938
  }, children: _jsxs("div", { style: {
1069
939
  display: "flex",
1070
940
  alignItems: "center",
1071
- }, children: [_jsx(TextInput, { onFocus: () => setActiveSearchColumn(column.key), onChange: (e) => {
1072
- var _a;
1073
- const input = e.target.value;
1074
- let searchType = ((_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.type) ||
1075
- defaultSearchOperation ||
1076
- "contains";
1077
- if (input.includes("to")) {
1078
- searchType = "between";
1079
- }
1080
- else if (searchType === "between") {
1081
- searchType = "contains";
1082
- }
1083
- else if (input.includes("%")) {
1084
- const startsWithPercent = input.startsWith("%");
1085
- const endsWithPercent = input.endsWith("%");
1086
- if (startsWithPercent &&
1087
- endsWithPercent &&
1088
- input.length > 2) {
1089
- searchType = "contains";
1090
- }
1091
- else if (!startsWithPercent &&
1092
- endsWithPercent) {
1093
- searchType = "startsWith";
1094
- }
1095
- else if (startsWithPercent &&
1096
- !endsWithPercent) {
1097
- searchType = "endsWith";
1098
- }
1099
- }
1100
- onSearch(column.key, input, searchType);
1101
- }, onBlur: (e) => {
1102
- var _a;
1103
- const currentKey = (column === null || column === void 0 ? void 0 : column.key) || "";
1104
- const input = e.target.value.replace(/\?/g, "%");
1105
- const searchType = ((_a = searchQueries[currentKey]) === null || _a === void 0 ? void 0 : _a.type) ||
1106
- defaultSearchOperation ||
1107
- "contains";
1108
- let query = input;
1109
- if (query &&
1110
- !query.includes("%") &&
1111
- !query.includes("_")) {
1112
- if (searchType === "contains") {
1113
- query = `%${query}%`;
1114
- }
1115
- else if (searchType === "startsWith") {
1116
- query = `${query}%`;
1117
- }
1118
- else if (searchType === "endsWith") {
1119
- query = `%${query}`;
1120
- }
1121
- }
1122
- onSearch(currentKey, query, searchType);
1123
- }, placeholder: "Search", extraWrapperStyle: {
941
+ }, children: [_jsx(TextInput, { onFocus: () => setActiveSearchColumn(column.key), onChange: (e) => handleSearchInputChange(e, column.key), onBlur: (e) => handleSearchInputBlur(e, (column === null || column === void 0 ? void 0 : column.key) || ""), placeholder: "Search", extraWrapperStyle: {
1124
942
  background: column.search
1125
943
  ? "var(--background)"
1126
944
  : "var(--disabled-bg)",
@@ -1194,59 +1012,7 @@ const GridHeader = ({ columns, onSearch, searchQueries, sortable, search, resiza
1194
1012
  }, children: _jsxs("div", { style: {
1195
1013
  display: "flex",
1196
1014
  alignItems: "center",
1197
- }, children: [_jsx(TextInput, { onFocus: () => setActiveSearchColumn(column.key), onChange: (e) => {
1198
- var _a;
1199
- const input = e.target.value;
1200
- let searchType = ((_a = searchQueries[column.key]) === null || _a === void 0 ? void 0 : _a.type) ||
1201
- defaultSearchOperation ||
1202
- "contains";
1203
- if (input.includes("to")) {
1204
- searchType = "between";
1205
- }
1206
- else if (searchType === "between") {
1207
- searchType = "contains";
1208
- }
1209
- else if (input.includes("%")) {
1210
- const startsWithPercent = input.startsWith("%");
1211
- const endsWithPercent = input.endsWith("%");
1212
- if (startsWithPercent &&
1213
- endsWithPercent &&
1214
- input.length > 2) {
1215
- searchType = "contains";
1216
- }
1217
- else if (!startsWithPercent &&
1218
- endsWithPercent) {
1219
- searchType = "startsWith";
1220
- }
1221
- else if (startsWithPercent &&
1222
- !endsWithPercent) {
1223
- searchType = "endsWith";
1224
- }
1225
- }
1226
- onSearch(column.key, input, searchType);
1227
- }, onBlur: (e) => {
1228
- var _a;
1229
- const currentKey = (column === null || column === void 0 ? void 0 : column.key) || "";
1230
- const input = e.target.value.replace(/\?/g, "%");
1231
- const searchType = ((_a = searchQueries[currentKey]) === null || _a === void 0 ? void 0 : _a.type) ||
1232
- defaultSearchOperation ||
1233
- "contains";
1234
- let query = input;
1235
- if (query &&
1236
- !query.includes("%") &&
1237
- !query.includes("_")) {
1238
- if (searchType === "contains") {
1239
- query = `%${query}%`;
1240
- }
1241
- else if (searchType === "startsWith") {
1242
- query = `${query}%`;
1243
- }
1244
- else if (searchType === "endsWith") {
1245
- query = `%${query}`;
1246
- }
1247
- }
1248
- onSearch(currentKey, query, searchType);
1249
- }, placeholder: "Search", extraWrapperStyle: {
1015
+ }, children: [_jsx(TextInput, { onFocus: () => setActiveSearchColumn(column.key), onChange: (e) => handleSearchInputChange(e, column.key), onBlur: (e) => handleSearchInputBlur(e, (column === null || column === void 0 ? void 0 : column.key) || ""), placeholder: "Search", extraWrapperStyle: {
1250
1016
  background: column.search
1251
1017
  ? "var(--background)"
1252
1018
  : "var(--disabled-bg)",
@@ -1,3 +1,4 @@
1
1
  export declare const createRegexFromWildcard: (query: string) => RegExp;
2
2
  export declare const matchSqlLikePattern: (pattern: string, value: string) => boolean;
3
+ export declare const matchSqlComparisonPattern: (pattern: string, value: string) => boolean;
3
4
  export declare function isValidDateFormat(dateStr: string): boolean;
@@ -34,6 +34,42 @@ export const matchSqlLikePattern = (pattern, value) => {
34
34
  // Default: simple contains
35
35
  return v.includes(p);
36
36
  };
37
+ // SQL-style comparison pattern matcher.
38
+ // Supports numeric patterns like:
39
+ // >5, >= 10, <3.5, <= -2, =4, != 0
40
+ // If the pattern does not start with a comparison operator
41
+ // or the value/query are not numeric, this returns false.
42
+ export const matchSqlComparisonPattern = (pattern, value) => {
43
+ if (!value)
44
+ return false;
45
+ const trimmed = pattern.trim();
46
+ const comparisonRegex = /^\s*(>=|<=|!=|>|<|=)\s*(-?\d+(\.\d+)?)\s*$/;
47
+ const match = trimmed.match(comparisonRegex);
48
+ if (!match)
49
+ return false;
50
+ const operator = match[1];
51
+ const queryNumber = parseFloat(match[2]);
52
+ const valueNumber = parseFloat(value);
53
+ if (Number.isNaN(queryNumber) || Number.isNaN(valueNumber)) {
54
+ return false;
55
+ }
56
+ switch (operator) {
57
+ case ">":
58
+ return valueNumber > queryNumber;
59
+ case ">=":
60
+ return valueNumber >= queryNumber;
61
+ case "<":
62
+ return valueNumber < queryNumber;
63
+ case "<=":
64
+ return valueNumber <= queryNumber;
65
+ case "=":
66
+ return valueNumber === queryNumber;
67
+ case "!=":
68
+ return valueNumber !== queryNumber;
69
+ default:
70
+ return false;
71
+ }
72
+ };
37
73
  export function isValidDateFormat(dateStr) {
38
74
  if (!dateStr || typeof dateStr !== "string")
39
75
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megha-ui/react",
3
- "version": "1.3.123",
3
+ "version": "1.3.125",
4
4
  "description": "A collection of reusable UI components for React applications, built with TypeScript.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",