@natoora-libs/core 0.1.18-dev-doug-1 → 0.1.18-dev-doug-3

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.
@@ -741,8 +741,18 @@ var AppLabel = ({ appName }) => {
741
741
  var AppLabel_default = AppLabel;
742
742
 
743
743
  // src/components/AutocompleteFilterMenuContent/AutocompleteFilterMenuContent.tsx
744
+ var import_Check2 = __toESM(require("@mui/icons-material/Check"), 1);
744
745
  var import_material9 = require("@mui/material");
745
746
 
747
+ // src/utils/resolveObjectType.ts
748
+ var resolveObjectType = (object, fieldName) => {
749
+ if (!object || typeof object !== "object") {
750
+ return object;
751
+ }
752
+ ;
753
+ return object[fieldName] ?? "";
754
+ };
755
+
746
756
  // src/components/Buttons/ExtendedButton/ExtendedButton.tsx
747
757
  var import_react2 = require("react");
748
758
  var import_icons_material2 = require("@mui/icons-material");
@@ -911,15 +921,6 @@ var ExtendedButton_default = (0, import_react2.memo)(ExtendedButton);
911
921
  var import_Check = __toESM(require("@mui/icons-material/Check"), 1);
912
922
  var import_material7 = require("@mui/material");
913
923
 
914
- // src/utils/resolveObjectType.ts
915
- var resolveObjectType = (object, fieldName) => {
916
- if (!object || typeof object !== "object") {
917
- return object;
918
- }
919
- ;
920
- return object[fieldName] ?? "";
921
- };
922
-
923
924
  // src/components/DynamicOverflowTooltip/DynamicOverflowTooltip.tsx
924
925
  var import_react4 = require("react");
925
926
  var import_material6 = require("@mui/material");
@@ -944,6 +945,7 @@ var useCheckOverflow = ({
944
945
  var import_jsx_runtime7 = require("react/jsx-runtime");
945
946
  var DynamicOverflowTooltip = ({
946
947
  arrow = false,
948
+ maxWidth = "auto",
947
949
  children,
948
950
  tooltipDescription
949
951
  }) => {
@@ -959,6 +961,7 @@ var DynamicOverflowTooltip = ({
959
961
  {
960
962
  ref,
961
963
  sx: {
964
+ maxWidth,
962
965
  overflowX: "hidden",
963
966
  whiteSpace: "nowrap",
964
967
  textOverflow: "ellipsis"
@@ -1008,11 +1011,12 @@ var FilterOptionsCheckboxes = ({
1008
1011
  import_material7.Box,
1009
1012
  {
1010
1013
  sx: {
1014
+ maxWidth,
1015
+ gap: 2,
1016
+ flexGrow: 1,
1011
1017
  display: "flex",
1012
1018
  alignItems: "center",
1013
- justifyContent: "space-between",
1014
- maxWidth,
1015
- flexGrow: 1
1019
+ justifyContent: "space-between"
1016
1020
  },
1017
1021
  children: [
1018
1022
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DynamicOverflowTooltip, { tooltipDescription: String(filterLabel), arrow: true, children: filterLabel }),
@@ -1053,10 +1057,11 @@ var SearchFieldDebounced = ({
1053
1057
  }
1054
1058
  ;
1055
1059
  debounceRef.current = window.setTimeout(() => {
1056
- if (input.length < minCharacters) {
1060
+ const trimmedInput = input.trim();
1061
+ if (trimmedInput.length < minCharacters) {
1057
1062
  return;
1058
1063
  }
1059
- onSearch(input);
1064
+ onSearch(trimmedInput);
1060
1065
  }, debounceDelay);
1061
1066
  };
1062
1067
  (0, import_react5.useEffect)(() => {
@@ -1093,19 +1098,40 @@ var SearchFieldDebounced = ({
1093
1098
 
1094
1099
  // src/components/AutocompleteFilterMenuContent/AutocompleteFilterMenuContent.tsx
1095
1100
  var import_jsx_runtime10 = require("react/jsx-runtime");
1096
- var MAX_HEIGHT = 500;
1097
1101
  var AutocompleteFilterMenuContent = ({
1102
+ columnId,
1103
+ labelFieldName,
1098
1104
  selectedFilterOptions,
1105
+ isLoading = false,
1106
+ maxWidth = 208,
1107
+ maxHeight = 500,
1099
1108
  onFilterOptionChange,
1100
1109
  onApplyFiltersClick,
1101
1110
  shouldShowCheckOnFilter,
1102
- headCell: {
1103
- onAutocompleteFilterChange,
1104
- filterOptions,
1105
- fieldName: labelFieldName = "",
1106
- id: columnId
1107
- }
1111
+ onAutocompleteFilterChange,
1112
+ filterOptions
1108
1113
  }) => {
1114
+ const renderLoading = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_material9.Skeleton, { variant: "rounded", height: 26, sx: { m: 1 } });
1115
+ const renderOptions = () => filterOptions?.length ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1116
+ FilterOptionsCheckboxes,
1117
+ {
1118
+ columnId,
1119
+ maxWidth,
1120
+ labelFieldName,
1121
+ filterOptions,
1122
+ selectedFilterOptions,
1123
+ onFilterOptionChange,
1124
+ shouldShowCheckOnFilter
1125
+ }
1126
+ ) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1127
+ import_material9.Typography,
1128
+ {
1129
+ variant: "body2",
1130
+ color: "textSecondary",
1131
+ sx: { p: 1, maxWidth: 260 },
1132
+ children: "Start searching (minimum 3 characters) to view the results."
1133
+ }
1134
+ );
1109
1135
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_material9.Box, { sx: { display: "flex", flexDirection: "column" }, children: [
1110
1136
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1111
1137
  SearchFieldDebounced,
@@ -1123,9 +1149,9 @@ var AutocompleteFilterMenuContent = ({
1123
1149
  import_material9.Box,
1124
1150
  {
1125
1151
  sx: {
1152
+ maxHeight,
1126
1153
  display: "flex",
1127
1154
  flexDirection: "column",
1128
- maxHeight: MAX_HEIGHT,
1129
1155
  overflowX: "hidden",
1130
1156
  "&::-webkit-scrollbar": {
1131
1157
  width: "8px",
@@ -1144,38 +1170,51 @@ var AutocompleteFilterMenuContent = ({
1144
1170
  },
1145
1171
  children: [
1146
1172
  selectedFilterOptions.length ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1147
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_material9.Box, { sx: { px: 1, pt: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1148
- FilterOptionsCheckboxes,
1173
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1174
+ import_material9.Box,
1149
1175
  {
1150
- columnId,
1151
- labelFieldName,
1152
- filterOptions: selectedFilterOptions,
1153
- selectedFilterOptions,
1154
- onFilterOptionChange,
1155
- shouldShowCheckOnFilter
1176
+ sx: {
1177
+ px: 1,
1178
+ pt: 1,
1179
+ pb: 0.5,
1180
+ gap: 1,
1181
+ display: "flex",
1182
+ flexDirection: "column"
1183
+ },
1184
+ children: selectedFilterOptions?.map((option) => {
1185
+ const filterId = resolveObjectType(option, "id");
1186
+ const filterLabel = resolveObjectType(option, labelFieldName);
1187
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1188
+ import_material9.Box,
1189
+ {
1190
+ sx: {
1191
+ pl: 1,
1192
+ pr: 1.25,
1193
+ flexGrow: 1,
1194
+ display: "flex",
1195
+ alignItems: "center",
1196
+ justifyContent: "space-between"
1197
+ },
1198
+ children: [
1199
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_material9.Box, { sx: { maxWidth }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1200
+ import_material9.Chip,
1201
+ {
1202
+ size: "small",
1203
+ label: filterLabel,
1204
+ onDelete: () => onFilterOptionChange(option)
1205
+ }
1206
+ ) }),
1207
+ shouldShowCheckOnFilter?.(columnId, option) ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_material9.Tooltip, { title: "This filter is saved as default", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_Check2.default, { fontSize: "small", color: "action" }) }) : null
1208
+ ]
1209
+ },
1210
+ filterId
1211
+ );
1212
+ })
1156
1213
  }
1157
- ) }),
1214
+ ),
1158
1215
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_material9.Divider, { sx: { my: 0.5 } })
1159
1216
  ] }) : null,
1160
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_material9.Box, { sx: { p: 1 }, children: !filterOptions?.length ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1161
- import_material9.Typography,
1162
- {
1163
- variant: "body2",
1164
- color: "textSecondary",
1165
- sx: { p: 1, maxWidth: 260 },
1166
- children: "Start searching (minimum 3 characters) to view the results."
1167
- }
1168
- ) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1169
- FilterOptionsCheckboxes,
1170
- {
1171
- columnId,
1172
- labelFieldName,
1173
- filterOptions,
1174
- selectedFilterOptions,
1175
- onFilterOptionChange,
1176
- shouldShowCheckOnFilter
1177
- }
1178
- ) })
1217
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_material9.Box, { sx: { p: 1 }, children: isLoading ? renderLoading() : renderOptions() })
1179
1218
  ]
1180
1219
  }
1181
1220
  ),
@@ -3416,20 +3455,30 @@ function ActionButton(props) {
3416
3455
  // src/components/CheckboxFilterMenuContent/CheckboxFilterMenuContent.tsx
3417
3456
  var import_material22 = require("@mui/material");
3418
3457
  var import_jsx_runtime71 = require("react/jsx-runtime");
3419
- var MAX_HEIGHT2 = 500;
3420
3458
  var CheckboxFilterMenuContent = ({
3459
+ columnId,
3460
+ labelFieldName,
3461
+ isLoading = false,
3421
3462
  selectedFilterOptions,
3422
3463
  filterOptions,
3464
+ maxHeight = 500,
3465
+ width = 276,
3423
3466
  shouldShowCheckOnFilter,
3424
3467
  onSelectAllChange,
3425
3468
  onFilterOptionChange,
3426
- onApplyFiltersClick,
3427
- headCell: {
3428
- id: columnId,
3429
- fieldName: labelFieldName = ""
3430
- }
3469
+ onApplyFiltersClick
3431
3470
  }) => {
3432
- return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_material22.Box, { sx: { display: "flex", flexDirection: "column" }, children: [
3471
+ const renderLoading = () => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_material22.Box, { "data-testid": "loading-skeletons", sx: { width }, children: [
3472
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_material22.Skeleton, { variant: "rounded", height: 24, sx: { m: 1 } }),
3473
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_material22.Divider, {}),
3474
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_material22.Skeleton, { variant: "rounded", height: 24, sx: { m: 1 } }),
3475
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_material22.Skeleton, { variant: "rounded", height: 24, sx: { m: 1 } }),
3476
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_material22.Skeleton, { variant: "rounded", height: 24, sx: { m: 1 } }),
3477
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_material22.Skeleton, { variant: "rounded", height: 24, sx: { m: 1 } }),
3478
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_material22.Divider, {}),
3479
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_material22.Skeleton, { variant: "rounded", height: 24, sx: { m: 1 } })
3480
+ ] });
3481
+ const renderContent = () => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_material22.Box, { sx: { display: "flex", flexDirection: "column" }, children: [
3433
3482
  /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_material22.Box, { sx: { px: 2, pt: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
3434
3483
  import_material22.FormControlLabel,
3435
3484
  {
@@ -3474,17 +3523,9 @@ var CheckboxFilterMenuContent = ({
3474
3523
  sx: {
3475
3524
  pl: 0.5,
3476
3525
  pr: 2,
3477
- maxHeight: MAX_HEIGHT2
3526
+ maxHeight
3478
3527
  },
3479
- children: !filterOptions?.length ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
3480
- import_material22.Typography,
3481
- {
3482
- variant: "body2",
3483
- color: "textSecondary",
3484
- sx: { py: 1, px: 2 },
3485
- children: "No options available."
3486
- }
3487
- ) : /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
3528
+ children: filterOptions?.length ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
3488
3529
  FilterOptionsCheckboxes,
3489
3530
  {
3490
3531
  columnId,
@@ -3494,6 +3535,14 @@ var CheckboxFilterMenuContent = ({
3494
3535
  onFilterOptionChange,
3495
3536
  shouldShowCheckOnFilter
3496
3537
  }
3538
+ ) : /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
3539
+ import_material22.Typography,
3540
+ {
3541
+ variant: "body2",
3542
+ color: "textSecondary",
3543
+ sx: { py: 1, px: 2 },
3544
+ children: "No options available."
3545
+ }
3497
3546
  )
3498
3547
  }
3499
3548
  )
@@ -3534,6 +3583,10 @@ var CheckboxFilterMenuContent = ({
3534
3583
  }
3535
3584
  )
3536
3585
  ] });
3586
+ if (isLoading) {
3587
+ return renderLoading();
3588
+ }
3589
+ return renderContent();
3537
3590
  };
3538
3591
 
3539
3592
  // src/components/CompanyLogo/CompanyLogo.tsx
@@ -7207,7 +7260,7 @@ var import_react34 = require("react");
7207
7260
  var import_material62 = require("@mui/material");
7208
7261
  var import_classnames3 = __toESM(require("classnames"), 1);
7209
7262
  var import_jsx_runtime114 = require("react/jsx-runtime");
7210
- var MAX_WIDTH = 272;
7263
+ var MAX_WIDTH = 276;
7211
7264
  var findFilterIndex = (filters, filterOption) => filters.findIndex((item) => {
7212
7265
  if (typeof item === "string" && typeof filterOption === "string") {
7213
7266
  return item === filterOption;
@@ -7279,50 +7332,6 @@ var SmartTableHeaderFilterMenu = (0, import_react34.memo)(({
7279
7332
  (0, import_react34.useEffect)(() => {
7280
7333
  setSelectedFilterOptions(headerFilters[headCell.id] ?? []);
7281
7334
  }, [headerFilters, headCell.id]);
7282
- const renderLoadingSkeletons = /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)(import_material62.Box, { "data-testid": "loading-skeletons", sx: { width: MAX_WIDTH }, children: [
7283
- /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(import_material62.Skeleton, { variant: "rounded", height: 24, sx: { m: 1 } }),
7284
- /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(import_material62.Divider, {}),
7285
- /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(import_material62.Skeleton, { variant: "rounded", height: 24, sx: { m: 1 } }),
7286
- /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(import_material62.Skeleton, { variant: "rounded", height: 24, sx: { m: 1 } }),
7287
- /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(import_material62.Skeleton, { variant: "rounded", height: 24, sx: { m: 1 } }),
7288
- /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(import_material62.Skeleton, { variant: "rounded", height: 24, sx: { m: 1 } }),
7289
- /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(import_material62.Divider, {}),
7290
- /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(import_material62.Skeleton, { variant: "rounded", height: 24, sx: { m: 1 } })
7291
- ] });
7292
- const renderMenuContent = (0, import_react34.useMemo)(() => {
7293
- if (headCell.isAutocompleteFilterMenu) {
7294
- return /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
7295
- AutocompleteFilterMenuContent,
7296
- {
7297
- headCell,
7298
- selectedFilterOptions,
7299
- onFilterOptionChange: handleFilterOptionChange,
7300
- onApplyFiltersClick: handleApplyFiltersClick,
7301
- shouldShowCheckOnFilter
7302
- }
7303
- );
7304
- }
7305
- return /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
7306
- CheckboxFilterMenuContent,
7307
- {
7308
- headCell,
7309
- selectedFilterOptions,
7310
- filterOptions: filterOptionsData ?? [],
7311
- onSelectAllChange: handleSelectAllChange,
7312
- onFilterOptionChange: handleFilterOptionChange,
7313
- onApplyFiltersClick: handleApplyFiltersClick,
7314
- shouldShowCheckOnFilter
7315
- }
7316
- );
7317
- }, [
7318
- headCell,
7319
- selectedFilterOptions,
7320
- handleFilterOptionChange,
7321
- handleApplyFiltersClick,
7322
- shouldShowCheckOnFilter,
7323
- filterOptionsData,
7324
- handleSelectAllChange
7325
- ]);
7326
7335
  return /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)(import_jsx_runtime114.Fragment, { children: [
7327
7336
  /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
7328
7337
  ActiveFiltersIconButton,
@@ -7348,7 +7357,33 @@ var SmartTableHeaderFilterMenu = (0, import_react34.memo)(({
7348
7357
  },
7349
7358
  anchorOrigin: { vertical: "bottom", horizontal: "right" },
7350
7359
  transformOrigin: { vertical: "top", horizontal: "right" },
7351
- children: headCell.isFetchingFilterOptions ? renderLoadingSkeletons : renderMenuContent
7360
+ children: headCell.isAutocompleteFilterMenu ? /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
7361
+ AutocompleteFilterMenuContent,
7362
+ {
7363
+ columnId: headCell.id,
7364
+ labelFieldName: headCell.fieldName ?? "",
7365
+ isLoading: headCell.isFetchingFilterOptions,
7366
+ filterOptions: headCell.filterOptions,
7367
+ onAutocompleteFilterChange: headCell.onAutocompleteFilterChange,
7368
+ selectedFilterOptions,
7369
+ onFilterOptionChange: handleFilterOptionChange,
7370
+ onApplyFiltersClick: handleApplyFiltersClick,
7371
+ shouldShowCheckOnFilter
7372
+ }
7373
+ ) : /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
7374
+ CheckboxFilterMenuContent,
7375
+ {
7376
+ columnId: headCell.id,
7377
+ labelFieldName: headCell.fieldName ?? "",
7378
+ isLoading: headCell.isFetchingFilterOptions,
7379
+ selectedFilterOptions,
7380
+ filterOptions: filterOptionsData ?? [],
7381
+ onSelectAllChange: handleSelectAllChange,
7382
+ onFilterOptionChange: handleFilterOptionChange,
7383
+ onApplyFiltersClick: handleApplyFiltersClick,
7384
+ shouldShowCheckOnFilter
7385
+ }
7386
+ )
7352
7387
  }
7353
7388
  )
7354
7389
  ] });
@@ -8551,14 +8586,14 @@ var TableDesktopEditableField = (0, import_react41.memo)(TableDesktopEditableFie
8551
8586
 
8552
8587
  // src/components/TableDesktopCell/TableDesktopCell.tsx
8553
8588
  var import_react42 = require("react");
8554
- var import_Check2 = __toESM(require("@mui/icons-material/Check"), 1);
8589
+ var import_Check3 = __toESM(require("@mui/icons-material/Check"), 1);
8555
8590
  var import_Close = __toESM(require("@mui/icons-material/Close"), 1);
8556
8591
  var import_Edit = __toESM(require("@mui/icons-material/Edit"), 1);
8557
8592
  var import_material75 = require("@mui/material");
8558
8593
  var import_jsx_runtime130 = require("react/jsx-runtime");
8559
8594
  var getReadOnlyBooleanIcon = (value) => {
8560
8595
  if (value) {
8561
- return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(import_Check2.default, { sx: { fontSize: 16 } });
8596
+ return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(import_Check3.default, { sx: { fontSize: 16 } });
8562
8597
  }
8563
8598
  return "-";
8564
8599
  };