@natoora-libs/core 0.1.11 → 0.1.13

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.
@@ -617,7 +617,7 @@ var ExtendedButton = ({
617
617
  buttonType = "button",
618
618
  color = "noOutline",
619
619
  disabled = false,
620
- href,
620
+ href = "",
621
621
  tooltip = "",
622
622
  component = "button",
623
623
  type,
@@ -654,7 +654,7 @@ var ExtendedButton = ({
654
654
  component,
655
655
  "data-testid": copy ? `extended-button-${copy.toLowerCase()}` : "extended-button",
656
656
  disabled,
657
- href: href ? href : void 0,
657
+ href,
658
658
  onClick,
659
659
  type: buttonType,
660
660
  variant,
@@ -2781,7 +2781,7 @@ var RoundButton = ({
2781
2781
  onClick(e);
2782
2782
  }
2783
2783
  };
2784
- const Button14 = /* @__PURE__ */ jsx63(
2784
+ const Button15 = /* @__PURE__ */ jsx63(
2785
2785
  Fab,
2786
2786
  {
2787
2787
  className: cx(
@@ -2805,7 +2805,7 @@ var RoundButton = ({
2805
2805
  children: icon ? iconComponentMap[icon] : children || ""
2806
2806
  }
2807
2807
  );
2808
- return tooltip ? /* @__PURE__ */ jsx63(Tooltip2, { title: tooltip, children: Button14 }) : Button14;
2808
+ return tooltip ? /* @__PURE__ */ jsx63(Tooltip2, { title: tooltip, children: Button15 }) : Button15;
2809
2809
  };
2810
2810
  var RoundButton_default = RoundButton;
2811
2811
 
@@ -6216,11 +6216,60 @@ var SearchAndFilterHeaderForTable = (props) => {
6216
6216
  };
6217
6217
  var SearchAndFilterHeaderForTable_default = React4.memo(SearchAndFilterHeaderForTable);
6218
6218
 
6219
+ // src/components/SearchFieldDebounced/SearchFieldDebounced.tsx
6220
+ import { useState as useState13, useRef as useRef4, useEffect as useEffect8 } from "react";
6221
+ import { TextField as TextField7, InputAdornment as InputAdornment3, Box as Box26 } from "@mui/material";
6222
+ import Search2 from "@mui/icons-material/Search";
6223
+ import { jsx as jsx103 } from "react/jsx-runtime";
6224
+ var SearchFieldDebounced = ({
6225
+ onSearch,
6226
+ initialValue = "",
6227
+ debounceDelay = 500
6228
+ }) => {
6229
+ const [value, setValue] = useState13(initialValue);
6230
+ const debounceRef = useRef4(null);
6231
+ const handleChange = (e) => {
6232
+ setValue(e.target.value);
6233
+ if (debounceRef.current) {
6234
+ clearTimeout(debounceRef.current);
6235
+ }
6236
+ ;
6237
+ debounceRef.current = window.setTimeout(() => {
6238
+ onSearch(e.target.value);
6239
+ }, debounceDelay);
6240
+ };
6241
+ useEffect8(() => {
6242
+ return () => {
6243
+ if (debounceRef.current) clearTimeout(debounceRef.current);
6244
+ };
6245
+ }, []);
6246
+ return /* @__PURE__ */ jsx103(Box26, { width: 285, children: /* @__PURE__ */ jsx103(
6247
+ TextField7,
6248
+ {
6249
+ fullWidth: true,
6250
+ variant: "outlined",
6251
+ placeholder: "Search",
6252
+ value,
6253
+ onChange: handleChange,
6254
+ slotProps: {
6255
+ input: {
6256
+ sx: {
6257
+ maxHeight: 5,
6258
+ px: 2,
6259
+ py: 2.5
6260
+ },
6261
+ startAdornment: /* @__PURE__ */ jsx103(InputAdornment3, { position: "start", children: /* @__PURE__ */ jsx103(Search2, { fontSize: "small" }) })
6262
+ }
6263
+ }
6264
+ }
6265
+ ) });
6266
+ };
6267
+
6219
6268
  // src/components/SectionName/SectionName.tsx
6220
6269
  import { History as History2, Info as InfoIcon } from "@mui/icons-material";
6221
- import { Box as Box26, Divider as Divider8, IconButton as IconButton3, Tooltip as Tooltip5, Typography as Typography23 } from "@mui/material";
6270
+ import { Box as Box27, Divider as Divider8, IconButton as IconButton3, Tooltip as Tooltip5, Typography as Typography23 } from "@mui/material";
6222
6271
  import { makeStyles as makeStyles42 } from "tss-react/mui";
6223
- import { jsx as jsx103, jsxs as jsxs70 } from "react/jsx-runtime";
6272
+ import { jsx as jsx104, jsxs as jsxs70 } from "react/jsx-runtime";
6224
6273
  var useStyles42 = makeStyles42()((theme) => ({
6225
6274
  container: {
6226
6275
  display: "flex",
@@ -6263,9 +6312,9 @@ var SectionName = ({
6263
6312
  openHistoryLog
6264
6313
  }) => {
6265
6314
  const { classes } = useStyles42();
6266
- return /* @__PURE__ */ jsxs70(Box26, { className: classes.container, children: [
6267
- /* @__PURE__ */ jsxs70(Box26, { className: classes.titleContainer, children: [
6268
- /* @__PURE__ */ jsx103(
6315
+ return /* @__PURE__ */ jsxs70(Box27, { className: classes.container, children: [
6316
+ /* @__PURE__ */ jsxs70(Box27, { className: classes.titleContainer, children: [
6317
+ /* @__PURE__ */ jsx104(
6269
6318
  Typography23,
6270
6319
  {
6271
6320
  variant: "h5",
@@ -6275,7 +6324,7 @@ var SectionName = ({
6275
6324
  children: name
6276
6325
  }
6277
6326
  ),
6278
- tooltipDescription ? /* @__PURE__ */ jsx103(Tooltip5, { title: tooltipDescription, placement: "right", children: /* @__PURE__ */ jsx103(
6327
+ tooltipDescription ? /* @__PURE__ */ jsx104(Tooltip5, { title: tooltipDescription, placement: "right", children: /* @__PURE__ */ jsx104(
6279
6328
  InfoIcon,
6280
6329
  {
6281
6330
  fontSize: "small",
@@ -6284,8 +6333,8 @@ var SectionName = ({
6284
6333
  }
6285
6334
  ) }) : null
6286
6335
  ] }),
6287
- /* @__PURE__ */ jsxs70(Box26, { className: classes.actionButtons, children: [
6288
- buttonText ? /* @__PURE__ */ jsx103(
6336
+ /* @__PURE__ */ jsxs70(Box27, { className: classes.actionButtons, children: [
6337
+ buttonText ? /* @__PURE__ */ jsx104(
6289
6338
  ExtendedButton_default,
6290
6339
  {
6291
6340
  type: buttonType,
@@ -6298,15 +6347,15 @@ var SectionName = ({
6298
6347
  variant: "text"
6299
6348
  }
6300
6349
  ) : null,
6301
- openHistoryLog && buttonText && /* @__PURE__ */ jsx103(Divider8, { orientation: "vertical", sx: { height: "24px" } }),
6302
- openHistoryLog && /* @__PURE__ */ jsx103(IconButton3, { size: "small", onClick: () => openHistoryLog(), children: /* @__PURE__ */ jsx103(History2, {}) })
6350
+ openHistoryLog && buttonText && /* @__PURE__ */ jsx104(Divider8, { orientation: "vertical", sx: { height: "24px" } }),
6351
+ openHistoryLog && /* @__PURE__ */ jsx104(IconButton3, { size: "small", onClick: () => openHistoryLog(), children: /* @__PURE__ */ jsx104(History2, {}) })
6303
6352
  ] })
6304
6353
  ] });
6305
6354
  };
6306
6355
  var SectionName_default = SectionName;
6307
6356
 
6308
6357
  // src/components/SmartSelect/SmartSelect.tsx
6309
- import { forwardRef as forwardRef2, useState as useState13, useEffect as useEffect8 } from "react";
6358
+ import { forwardRef as forwardRef2, useState as useState14, useEffect as useEffect9 } from "react";
6310
6359
  import {
6311
6360
  CircularProgress as CircularProgress4,
6312
6361
  FormControl as FormControl4,
@@ -6316,7 +6365,7 @@ import {
6316
6365
  Select as Select3
6317
6366
  } from "@mui/material";
6318
6367
  import { makeStyles as makeStyles43 } from "tss-react/mui";
6319
- import { jsx as jsx104, jsxs as jsxs71 } from "react/jsx-runtime";
6368
+ import { jsx as jsx105, jsxs as jsxs71 } from "react/jsx-runtime";
6320
6369
  var useStyles43 = makeStyles43()(() => ({
6321
6370
  container: {
6322
6371
  display: "flex",
@@ -6342,9 +6391,9 @@ var SmartSelect = forwardRef2(
6342
6391
  menuProps
6343
6392
  }, ref) => {
6344
6393
  const { classes } = useStyles43();
6345
- const [open, setOpen] = useState13(false);
6346
- const [localOptions, setLocalOptions] = useState13(options || []);
6347
- useEffect8(() => {
6394
+ const [open, setOpen] = useState14(false);
6395
+ const [localOptions, setLocalOptions] = useState14(options || []);
6396
+ useEffect9(() => {
6348
6397
  if (options) {
6349
6398
  setLocalOptions(options);
6350
6399
  }
@@ -6393,7 +6442,7 @@ var SmartSelect = forwardRef2(
6393
6442
  "data-testid": dataTestId,
6394
6443
  disabled,
6395
6444
  children: [
6396
- inputLabel && /* @__PURE__ */ jsx104(
6445
+ inputLabel && /* @__PURE__ */ jsx105(
6397
6446
  InputLabel4,
6398
6447
  {
6399
6448
  id: "smart-select-label",
@@ -6407,7 +6456,7 @@ var SmartSelect = forwardRef2(
6407
6456
  ref,
6408
6457
  disabled,
6409
6458
  labelId: "smart-select-label",
6410
- value,
6459
+ value: value ?? "",
6411
6460
  onChange: handleChange,
6412
6461
  onOpen: handleOpen,
6413
6462
  error,
@@ -6418,17 +6467,17 @@ var SmartSelect = forwardRef2(
6418
6467
  MenuProps: menuProps,
6419
6468
  label: inputLabel,
6420
6469
  children: [
6421
- isFetching && /* @__PURE__ */ jsx104(
6470
+ isFetching && /* @__PURE__ */ jsx105(
6422
6471
  MenuItem3,
6423
6472
  {
6424
6473
  disabled: true,
6425
6474
  "data-testid": `${dataTestId}-loading`,
6426
6475
  id: `${dataTestId}-loading`,
6427
- children: /* @__PURE__ */ jsx104(CircularProgress4, { size: 24 })
6476
+ children: /* @__PURE__ */ jsx105(CircularProgress4, { size: 24 })
6428
6477
  }
6429
6478
  ),
6430
- (defaultOption === null || !defaultOptionLabelIsValid || !defaultOptionValueIsValid) && !isFetching && options?.length === 0 && /* @__PURE__ */ jsx104(MenuItem3, { disabled: true, "data-testid": `${dataTestId}-empty-message`, children: emptyMessage }),
6431
- localOptions.length === 0 && !isFetching && options?.length !== 0 && defaultOptionLabelIsValid && defaultOptionValueIsValid && /* @__PURE__ */ jsx104(
6479
+ (defaultOption === null || !defaultOptionLabelIsValid || !defaultOptionValueIsValid) && !isFetching && options?.length === 0 && /* @__PURE__ */ jsx105(MenuItem3, { disabled: true, "data-testid": `${dataTestId}-empty-message`, children: emptyMessage }),
6480
+ localOptions.length === 0 && !isFetching && options?.length !== 0 && defaultOptionLabelIsValid && defaultOptionValueIsValid && /* @__PURE__ */ jsx105(
6432
6481
  MenuItem3,
6433
6482
  {
6434
6483
  value: defaultOption?.value,
@@ -6436,7 +6485,7 @@ var SmartSelect = forwardRef2(
6436
6485
  children: defaultOption?.label
6437
6486
  }
6438
6487
  ),
6439
- !isFetching && combinedOptions.length > 0 && combinedOptions.map((option) => /* @__PURE__ */ jsx104(
6488
+ !isFetching && combinedOptions.length > 0 && combinedOptions.map((option) => /* @__PURE__ */ jsx105(
6440
6489
  MenuItem3,
6441
6490
  {
6442
6491
  value: option?.value,
@@ -6449,7 +6498,7 @@ var SmartSelect = forwardRef2(
6449
6498
  ]
6450
6499
  }
6451
6500
  ),
6452
- helperText && /* @__PURE__ */ jsx104(FormHelperText3, { "data-testid": `${dataTestId}-helper-text`, children: helperText })
6501
+ helperText && /* @__PURE__ */ jsx105(FormHelperText3, { "data-testid": `${dataTestId}-helper-text`, children: helperText })
6453
6502
  ]
6454
6503
  }
6455
6504
  );
@@ -6462,7 +6511,7 @@ import { memo as memo18 } from "react";
6462
6511
  import { Typography as Typography24 } from "@mui/material";
6463
6512
  import red2 from "@mui/material/colors/red";
6464
6513
  import { makeStyles as makeStyles44 } from "tss-react/mui";
6465
- import { jsx as jsx105 } from "react/jsx-runtime";
6514
+ import { jsx as jsx106 } from "react/jsx-runtime";
6466
6515
  var useStyles44 = makeStyles44()((theme) => ({
6467
6516
  red: {
6468
6517
  backgroundColor: red2["50"],
@@ -6477,7 +6526,7 @@ var useStyles44 = makeStyles44()((theme) => ({
6477
6526
  }));
6478
6527
  var SquareLabel = ({ color, copy }) => {
6479
6528
  const { classes } = useStyles44();
6480
- return /* @__PURE__ */ jsx105(Typography24, { className: classes[color], children: copy });
6529
+ return /* @__PURE__ */ jsx106(Typography24, { className: classes[color], children: copy });
6481
6530
  };
6482
6531
  var SquareLabel_default = memo18(SquareLabel);
6483
6532
 
@@ -6485,7 +6534,7 @@ var SquareLabel_default = memo18(SquareLabel);
6485
6534
  import { memo as memo19 } from "react";
6486
6535
  import { Grid2, Switch } from "@mui/material";
6487
6536
  import { withStyles as withStyles6 } from "tss-react/mui";
6488
- import { jsx as jsx106, jsxs as jsxs72 } from "react/jsx-runtime";
6537
+ import { jsx as jsx107, jsxs as jsxs72 } from "react/jsx-runtime";
6489
6538
  var LSwitch = ({
6490
6539
  checked,
6491
6540
  labelOn,
@@ -6493,7 +6542,7 @@ var LSwitch = ({
6493
6542
  handleChange,
6494
6543
  classes,
6495
6544
  disabled
6496
- }) => /* @__PURE__ */ jsx106("div", { className: classes.c_switch, children: /* @__PURE__ */ jsxs72(
6545
+ }) => /* @__PURE__ */ jsx107("div", { className: classes.c_switch, children: /* @__PURE__ */ jsxs72(
6497
6546
  Grid2,
6498
6547
  {
6499
6548
  component: "label",
@@ -6503,8 +6552,8 @@ var LSwitch = ({
6503
6552
  alignItems: "center"
6504
6553
  },
6505
6554
  children: [
6506
- labelOff && /* @__PURE__ */ jsx106(Grid2, { children: labelOff }),
6507
- /* @__PURE__ */ jsx106(Grid2, { children: /* @__PURE__ */ jsx106(
6555
+ labelOff && /* @__PURE__ */ jsx107(Grid2, { children: labelOff }),
6556
+ /* @__PURE__ */ jsx107(Grid2, { children: /* @__PURE__ */ jsx107(
6508
6557
  Switch,
6509
6558
  {
6510
6559
  checked,
@@ -6513,7 +6562,7 @@ var LSwitch = ({
6513
6562
  disabled
6514
6563
  }
6515
6564
  ) }),
6516
- labelOn && /* @__PURE__ */ jsx106(Grid2, { children: labelOn })
6565
+ labelOn && /* @__PURE__ */ jsx107(Grid2, { children: labelOn })
6517
6566
  ]
6518
6567
  }
6519
6568
  ) });
@@ -6538,256 +6587,52 @@ var LabelledSwitch = withStyles6(LSwitch, (theme) => ({
6538
6587
  var Switch_default = memo19(LabelledSwitch);
6539
6588
 
6540
6589
  // src/components/SmartTableHeaderFilterMenu/SmartTableHeaderFilterMenu.tsx
6541
- import { useMemo as useMemo2, useState as useState14, useEffect as useEffect9, memo as memo20 } from "react";
6590
+ import { useMemo as useMemo3, useState as useState16, useEffect as useEffect11, memo as memo21 } from "react";
6542
6591
  import CheckIcon from "@mui/icons-material/Check";
6543
6592
  import {
6544
- Box as Box27,
6545
- Checkbox as Checkbox4,
6593
+ Box as Box29,
6594
+ Checkbox as Checkbox5,
6546
6595
  Divider as Divider9,
6547
6596
  FormControlLabel as FormControlLabel3,
6548
6597
  Menu as Menu4,
6549
- Skeleton as Skeleton2,
6598
+ Skeleton as Skeleton3,
6550
6599
  Tooltip as Tooltip6
6551
6600
  } from "@mui/material";
6552
6601
  import classNames3 from "classnames";
6553
- import { makeStyles as makeStyles45 } from "tss-react/mui";
6554
- import { Fragment as Fragment11, jsx as jsx107, jsxs as jsxs73 } from "react/jsx-runtime";
6555
- var useStyles45 = makeStyles45()((theme) => ({
6556
- filterMenu: {
6557
- display: "flex",
6558
- flexDirection: "column"
6559
- },
6560
- filterOptions: {
6561
- maxHeight: theme.spacing(62),
6562
- overflowY: "auto",
6563
- "&::-webkit-scrollbar": {
6564
- width: "8px",
6565
- height: "8px"
6566
- },
6567
- "&::-webkit-scrollbar-track": {
6568
- backgroundColor: theme.palette.mode === "dark" ? theme.palette.grey[800] : theme.palette.grey[100]
6569
- },
6570
- "&::-webkit-scrollbar-thumb": {
6571
- backgroundColor: theme.palette.mode === "dark" ? theme.palette.grey[900] : theme.palette.grey[400],
6572
- borderRadius: "10px"
6573
- },
6574
- "&::-webkit-scrollbar-thumb:hover": {
6575
- backgroundColor: theme.palette.mode === "dark" ? theme.palette.common.black : theme.palette.grey[500]
6576
- }
6577
- },
6578
- filter: {
6579
- display: "flex",
6580
- alignItems: "center",
6581
- justifyContent: "space-between",
6582
- padding: theme.spacing(0, 3)
6583
- },
6584
- applyFilterButtonsContainer: {
6585
- display: "flex",
6586
- padding: theme.spacing(0, 1)
6587
- },
6588
- saveAsDefaultButton: {
6589
- color: theme.palette.primary.main
6590
- },
6591
- skeleton: {
6592
- height: theme.spacing(3),
6593
- margin: theme.spacing(1)
6594
- }
6595
- }));
6596
- var resolveFilterOption = (filterOption) => {
6597
- if (typeof filterOption === "object") {
6598
- return filterOption?.label || filterOption?.name || "";
6599
- }
6600
- return filterOption;
6601
- };
6602
- var findFilterIndex = (filters, filterOption) => filters.findIndex((item) => {
6603
- if (typeof item === "string" && typeof filterOption === "string") {
6604
- return item === filterOption;
6605
- }
6606
- if (typeof item === "object" && typeof filterOption === "object") {
6607
- return item.id === filterOption.id;
6608
- }
6609
- return false;
6610
- });
6611
- var SmartTableHeaderFilterMenu = ({
6612
- headCell,
6613
- numActiveFilters,
6614
- headerFilters,
6615
- shouldShowCheckOnFilter,
6616
- onApplyFilters
6617
- }) => {
6618
- const { classes } = useStyles45();
6619
- const [anchorEl, setAnchorEl] = useState14(null);
6620
- const [selectedFilters, setSelectedFilters] = useState14(
6621
- headerFilters[headCell.id] ?? []
6622
- );
6623
- const filterOptions = headCell.filterOptionsQuery?.data ?? [];
6624
- const numFilterOptions = filterOptions.length ?? 0;
6625
- const numCurrentSelectedFilters = selectedFilters.length;
6626
- const handleFilterMenuOpen = (event) => {
6627
- if (!numFilterOptions) {
6628
- headCell.filterOptionsQuery?.refetch();
6629
- }
6630
- setAnchorEl(event.currentTarget);
6631
- };
6632
- const handleFilterMenuClose = () => {
6633
- setSelectedFilters(headerFilters[headCell.id]);
6634
- setAnchorEl(null);
6635
- };
6636
- const handleFilterOptionClick = (option) => {
6637
- const selectedIndex = findFilterIndex(selectedFilters, option);
6638
- let newSelected;
6639
- if (selectedIndex === -1) {
6640
- if (typeof option === "string") {
6641
- newSelected = [...selectedFilters, option];
6642
- } else {
6643
- newSelected = [...selectedFilters, option];
6644
- }
6645
- } else {
6646
- newSelected = selectedFilters.filter(
6647
- (_, index) => index !== selectedIndex
6648
- );
6649
- }
6650
- setSelectedFilters(newSelected);
6651
- };
6652
- const handleApplyFilters = (shouldSave) => {
6653
- const updatedFilters = {
6654
- ...headerFilters,
6655
- [headCell.id]: [...selectedFilters]
6656
- };
6657
- onApplyFilters?.(updatedFilters, shouldSave);
6658
- setAnchorEl(null);
6659
- };
6660
- useEffect9(() => {
6661
- setSelectedFilters(headerFilters[headCell.id] ?? []);
6662
- }, [headerFilters, headCell.id]);
6663
- const isOptionChecked = useMemo2(() => (resolvedOption) => !!selectedFilters?.some(
6664
- (value) => resolveFilterOption(value) === resolvedOption
6665
- ), [selectedFilters]);
6666
- const loadingSkeletons = /* @__PURE__ */ jsxs73(Box27, { "data-testid": "loading-skeletons", width: 272, children: [
6667
- /* @__PURE__ */ jsx107(Skeleton2, { variant: "rounded", className: classes.skeleton }),
6668
- /* @__PURE__ */ jsx107(Divider9, {}),
6669
- /* @__PURE__ */ jsx107(Skeleton2, { variant: "rounded", className: classes.skeleton }),
6670
- /* @__PURE__ */ jsx107(Skeleton2, { variant: "rounded", className: classes.skeleton }),
6671
- /* @__PURE__ */ jsx107(Skeleton2, { variant: "rounded", className: classes.skeleton }),
6672
- /* @__PURE__ */ jsx107(Skeleton2, { variant: "rounded", className: classes.skeleton }),
6673
- /* @__PURE__ */ jsx107(Divider9, {}),
6674
- /* @__PURE__ */ jsx107(Skeleton2, { variant: "rounded", className: classes.skeleton })
6675
- ] });
6676
- return /* @__PURE__ */ jsxs73(Fragment11, { children: [
6677
- /* @__PURE__ */ jsx107(
6678
- ActiveFiltersIconButton_default,
6679
- {
6680
- numActiveFilters,
6681
- handleClick: handleFilterMenuOpen,
6682
- className: classNames3("filter-menu-trigger", {
6683
- "has-active-filters": !!numActiveFilters || !!anchorEl
6684
- })
6685
- }
6686
- ),
6687
- /* @__PURE__ */ jsx107(
6688
- Menu4,
6689
- {
6690
- open: !!anchorEl,
6691
- onClose: handleFilterMenuClose,
6692
- anchorEl,
6693
- "data-testid": "filter-menu",
6694
- anchorOrigin: { vertical: "bottom", horizontal: "right" },
6695
- transformOrigin: { vertical: "top", horizontal: "right" },
6696
- children: headCell.filterOptionsQuery?.isFetching ? loadingSkeletons : /* @__PURE__ */ jsxs73(Box27, { className: classes.filterMenu, children: [
6697
- /* @__PURE__ */ jsx107(Box27, { px: 3, mb: 0.5, children: /* @__PURE__ */ jsx107(
6698
- FormControlLabel3,
6699
- {
6700
- label: "Select All",
6701
- control: /* @__PURE__ */ jsx107(
6702
- Checkbox4,
6703
- {
6704
- disableRipple: true,
6705
- checked: numCurrentSelectedFilters === numFilterOptions,
6706
- indeterminate: numCurrentSelectedFilters > 0 && numCurrentSelectedFilters < numFilterOptions,
6707
- onChange: ({ target: { checked } }) => {
6708
- if (checked) {
6709
- setSelectedFilters([...filterOptions]);
6710
- } else {
6711
- setSelectedFilters([]);
6712
- }
6713
- }
6714
- }
6715
- )
6716
- }
6717
- ) }),
6718
- /* @__PURE__ */ jsx107(Divider9, { sx: { mb: 0.5 } }),
6719
- /* @__PURE__ */ jsx107(Box27, { className: classes.filterOptions, children: filterOptions.map(
6720
- (option) => {
6721
- const resolvedOption = resolveFilterOption(option);
6722
- return /* @__PURE__ */ jsxs73(
6723
- Box27,
6724
- {
6725
- className: classes.filter,
6726
- children: [
6727
- /* @__PURE__ */ jsx107(
6728
- FormControlLabel3,
6729
- {
6730
- label: resolvedOption,
6731
- control: /* @__PURE__ */ jsx107(
6732
- Checkbox4,
6733
- {
6734
- disableRipple: true,
6735
- onChange: () => handleFilterOptionClick(option),
6736
- checked: isOptionChecked(resolvedOption)
6737
- }
6738
- )
6739
- },
6740
- resolvedOption
6741
- ),
6742
- shouldShowCheckOnFilter?.(headCell.id, option) ? /* @__PURE__ */ jsx107(Tooltip6, { title: "This filter is saved as default", children: /* @__PURE__ */ jsx107(CheckIcon, { fontSize: "small", color: "action" }) }) : null
6743
- ]
6744
- },
6745
- resolvedOption
6746
- );
6747
- }
6748
- ) }),
6749
- /* @__PURE__ */ jsx107(Divider9, { sx: { mb: 0.5 } }),
6750
- /* @__PURE__ */ jsxs73(Box27, { className: classes.applyFilterButtonsContainer, children: [
6751
- /* @__PURE__ */ jsx107(
6752
- ExtendedButton_default,
6753
- {
6754
- copy: "Save as Default",
6755
- buttonType: "button",
6756
- variant: "text",
6757
- tooltip: "Persists those filters for future visits",
6758
- className: classes.saveAsDefaultButton,
6759
- onClick: () => handleApplyFilters(true)
6760
- }
6761
- ),
6762
- /* @__PURE__ */ jsx107(
6763
- ExtendedButton_default,
6764
- {
6765
- copy: "Apply",
6766
- color: "primary",
6767
- buttonType: "submit",
6768
- onClick: () => handleApplyFilters(false)
6769
- }
6770
- )
6771
- ] })
6772
- ] })
6773
- }
6774
- )
6775
- ] });
6776
- };
6777
- var SmartTableHeaderFilterMenu_default = memo20(SmartTableHeaderFilterMenu);
6602
+ import { makeStyles as makeStyles48 } from "tss-react/mui";
6603
+
6604
+ // src/components/TableDesktop/TableDesktop.tsx
6605
+ import {
6606
+ useCallback as useCallback2,
6607
+ useMemo as useMemo2,
6608
+ useState as useState15,
6609
+ useEffect as useEffect10
6610
+ } from "react";
6611
+ import {
6612
+ Paper as Paper10,
6613
+ Table,
6614
+ TableBody,
6615
+ TableContainer,
6616
+ Skeleton as Skeleton2,
6617
+ TableRow as TableRow3,
6618
+ TableCell as TableCell3
6619
+ } from "@mui/material";
6620
+ import { makeStyles as makeStyles47 } from "tss-react/mui";
6778
6621
 
6779
6622
  // src/components/SmartTableHeader/SmartTableHeader.tsx
6780
- import { memo as memo21 } from "react";
6623
+ import { memo as memo20 } from "react";
6781
6624
  import {
6782
- Checkbox as Checkbox5,
6625
+ Box as Box28,
6626
+ Checkbox as Checkbox4,
6783
6627
  TableCell,
6784
6628
  TableHead,
6785
6629
  TableRow,
6786
- TableSortLabel
6630
+ TableSortLabel,
6631
+ Typography as Typography25
6787
6632
  } from "@mui/material";
6788
- import { makeStyles as makeStyles46 } from "tss-react/mui";
6789
- import { jsx as jsx108, jsxs as jsxs74 } from "react/jsx-runtime";
6790
- var useStyles46 = makeStyles46()((theme) => ({
6633
+ import { makeStyles as makeStyles45 } from "tss-react/mui";
6634
+ import { jsx as jsx108, jsxs as jsxs73 } from "react/jsx-runtime";
6635
+ var useStyles45 = makeStyles45()((theme) => ({
6791
6636
  root: {
6792
6637
  backgroundColor: colors.neutral100,
6793
6638
  height: theme.spacing(6),
@@ -6809,7 +6654,7 @@ var useStyles46 = makeStyles46()((theme) => ({
6809
6654
  },
6810
6655
  tableHeaderContent: {
6811
6656
  borderBottom: "1px solid",
6812
- borderBottomColor: colors.neutral250,
6657
+ borderBottomColor: colors.neutral300,
6813
6658
  whiteSpace: "nowrap",
6814
6659
  "& .filter-menu-trigger": {
6815
6660
  visibility: "hidden",
@@ -6854,268 +6699,74 @@ var SmartTableHeader = ({
6854
6699
  onApplyFilters,
6855
6700
  shouldShowCheckOnFilter
6856
6701
  }) => {
6857
- const { classes } = useStyles46();
6702
+ const { classes } = useStyles45();
6858
6703
  const createSortHandler = (property) => (event) => {
6859
6704
  onRequestSort(event, property);
6860
6705
  };
6861
6706
  const isSortActive = (headCellId) => orderBy === headCellId;
6862
- return /* @__PURE__ */ jsx108(TableHead, { className: classes.root, children: /* @__PURE__ */ jsxs74(TableRow, { children: [
6707
+ return /* @__PURE__ */ jsx108(TableHead, { className: classes.root, children: /* @__PURE__ */ jsxs73(TableRow, { children: [
6863
6708
  enableCheckboxSelection ? /* @__PURE__ */ jsx108(TableCell, { padding: "checkbox", children: /* @__PURE__ */ jsx108(
6864
- Checkbox5,
6709
+ Checkbox4,
6865
6710
  {
6866
6711
  color: "primary",
6712
+ disableRipple: true,
6867
6713
  indeterminate: numSelected > 0 && numSelected < numRows,
6868
6714
  checked: numRows > 0 && numSelected === numRows,
6869
6715
  onChange: onSelectAllClick
6870
6716
  }
6871
6717
  ) }) : null,
6872
- headCells.map((headCell) => /* @__PURE__ */ jsxs74(
6718
+ headCells.map((headCell) => /* @__PURE__ */ jsx108(
6873
6719
  TableCell,
6874
6720
  {
6875
6721
  className: classes.tableHeaderContent,
6876
6722
  align: "left",
6877
- sx: { width: headCell.width ?? "auto" },
6723
+ width: headCell.width ?? "auto",
6878
6724
  sortDirection: orderBy === headCell.id ? order : false,
6879
- children: [
6880
- /* @__PURE__ */ jsxs74(
6881
- TableSortLabel,
6882
- {
6883
- "data-testid": "table-sort-label",
6884
- active: isSortActive(headCell.id),
6885
- direction: orderBy === headCell.id ? order : "asc",
6886
- onClick: createSortHandler(headCell.id),
6887
- children: [
6888
- headCell.renderHeader ?? headCell.label,
6889
- orderBy === headCell.id ? /* @__PURE__ */ jsx108("span", { className: classes.visuallyHidden, children: order === "desc" ? "sorted descending" : "sorted ascending" }) : null
6890
- ]
6891
- }
6892
- ),
6893
- headCell.filterOptionsQuery ? /* @__PURE__ */ jsx108(
6894
- SmartTableHeaderFilterMenu_default,
6895
- {
6896
- headCell,
6897
- headerFilters,
6898
- numActiveFilters: headerFilters[headCell.id]?.length ?? 0,
6899
- onApplyFilters,
6900
- shouldShowCheckOnFilter
6901
- }
6902
- ) : null
6903
- ]
6725
+ children: /* @__PURE__ */ jsxs73(
6726
+ Box28,
6727
+ {
6728
+ display: "flex",
6729
+ flexDirection: "row",
6730
+ gap: headCell.disableSort ? 1 : 0,
6731
+ children: [
6732
+ headCell.disableSort ? /* @__PURE__ */ jsx108(Typography25, { variant: "subtitle2", mt: 0.25, fontWeight: 600, children: headCell.label }) : /* @__PURE__ */ jsxs73(
6733
+ TableSortLabel,
6734
+ {
6735
+ "data-testid": "table-sort-label",
6736
+ active: isSortActive(headCell.id),
6737
+ direction: orderBy === headCell.id ? order : "asc",
6738
+ onClick: createSortHandler(headCell.id),
6739
+ children: [
6740
+ headCell.RenderHeader ?? headCell.label,
6741
+ orderBy === headCell.id ? /* @__PURE__ */ jsx108("span", { className: classes.visuallyHidden, children: order === "desc" ? "sorted descending" : "sorted ascending" }) : null
6742
+ ]
6743
+ }
6744
+ ),
6745
+ headCell.refetchFilterOptions ? /* @__PURE__ */ jsx108(
6746
+ SmartTableHeaderFilterMenu_default,
6747
+ {
6748
+ headCell,
6749
+ headerFilters,
6750
+ numActiveFilters: headerFilters[headCell.id]?.length ?? 0,
6751
+ onApplyFilters,
6752
+ shouldShowCheckOnFilter
6753
+ }
6754
+ ) : null
6755
+ ]
6756
+ }
6757
+ )
6904
6758
  },
6905
6759
  headCell.id
6906
6760
  ))
6907
6761
  ] }) });
6908
6762
  };
6909
- var SmartTableHeader_default = memo21(SmartTableHeader);
6910
-
6911
- // src/components/Table/Table.tsx
6912
- var import_debounce = __toESM(require_debounce(), 1);
6913
- import { useLayoutEffect, useState as useState15 } from "react";
6914
- import {
6915
- Box as Box29,
6916
- Paper as Paper10,
6917
- Table as MUITable,
6918
- TableBody,
6919
- TableCell as TableCell2,
6920
- TableContainer,
6921
- TableHead as TableHead2,
6922
- TableRow as TableRow2,
6923
- TableSortLabel as TableSortLabel2
6924
- } from "@mui/material";
6925
- import { makeStyles as makeStyles47 } from "tss-react/mui";
6926
- import { v4 as uuidv4 } from "uuid";
6927
-
6928
- // src/components/TableLoading/TableLoading.tsx
6929
- import { Box as Box28, Skeleton as Skeleton3 } from "@mui/material";
6930
- import { jsx as jsx109 } from "react/jsx-runtime";
6931
- var TableLoading = ({
6932
- rowsPerPage,
6933
- rowHeight
6934
- }) => /* @__PURE__ */ jsx109(Box28, { children: Array.from({ length: rowsPerPage ?? 0 }).map((_, index) => /* @__PURE__ */ jsx109(
6935
- Skeleton3,
6936
- {
6937
- animation: "pulse",
6938
- "data-testid": "table-loading-skeleton",
6939
- style: { margin: "8px", opacity: 0.4 },
6940
- variant: "rectangular",
6941
- height: rowHeight
6942
- },
6943
- index
6944
- )) });
6945
- var TableLoading_default = TableLoading;
6946
-
6947
- // src/components/Table/helpers.tsx
6948
- function stableSort(array, cmp) {
6949
- const stabilizedThis = array.map((el, index) => [el, index]);
6950
- stabilizedThis.sort((a, b) => {
6951
- const order = cmp(a[0], b[0]);
6952
- if (order !== 0) {
6953
- return order;
6954
- }
6955
- return a[1] - b[1];
6956
- });
6957
- return stabilizedThis.map((el) => el[0]);
6958
- }
6959
- function descendingComparator(a, b, orderBy) {
6960
- if (b[orderBy] < a[orderBy]) {
6961
- return -1;
6962
- }
6963
- if (b[orderBy] > a[orderBy]) {
6964
- return 1;
6965
- }
6966
- return 0;
6967
- }
6968
- function getSorting(order, orderBy) {
6969
- return order === "desc" ? (a, b) => descendingComparator(a, b, orderBy) : (a, b) => -descendingComparator(a, b, orderBy);
6970
- }
6971
- function calculateRowsPerPage(rowHeight) {
6972
- const appContainerDom = document.getElementById("mainContainer");
6973
- const headerDom = document.getElementById("aboveTableHeader");
6974
- if (appContainerDom && headerDom) {
6975
- return Math.floor(
6976
- (appContainerDom.clientHeight - headerDom.clientHeight - 24) / rowHeight - 2
6977
- );
6978
- }
6979
- return 1;
6980
- }
6981
-
6982
- // src/components/Table/Table.tsx
6983
- import { jsx as jsx110, jsxs as jsxs75 } from "react/jsx-runtime";
6984
- var useStyles47 = makeStyles47()(() => ({
6985
- root: {
6986
- height: "calc(100vh - 262px)",
6987
- overflow: "scroll"
6988
- },
6989
- paper: {
6990
- width: "100%",
6991
- display: "flex",
6992
- flexDirection: "column",
6993
- justifyContent: "space-between"
6994
- },
6995
- header: {
6996
- "& .MuiTableSortLabel-root": {
6997
- fontWeight: 600,
6998
- fontSize: ".875rem"
6999
- }
7000
- },
7001
- container: {
7002
- maxHeight: "calc(100% - 0)"
7003
- }
7004
- }));
7005
- var Table = ({
7006
- appliedFilters,
7007
- data,
7008
- doNotCalculateRows,
7009
- headCells,
7010
- isLoading,
7011
- onRowClick,
7012
- page = 0,
7013
- RenderItem = null,
7014
- rowsPerPage: defaultRowsPerPage = 10,
7015
- serverRendered,
7016
- updateSort
7017
- }) => {
7018
- const [order, setOrder] = useState15(appliedFilters?.sortDir || "desc");
7019
- const [orderBy, setOrderBy] = useState15(
7020
- appliedFilters?.sortField || "delivery_date"
7021
- );
7022
- const [rowsPerPage, setRowsPerPage] = useState15(defaultRowsPerPage);
7023
- const { classes } = useStyles47();
7024
- const rowHeight = 56;
7025
- const emptyRows = rowsPerPage - Math.min(rowsPerPage, data.length - page * rowsPerPage);
7026
- const handleRequestSort = (event, property) => {
7027
- const isAsc = orderBy === property && order === "asc";
7028
- const orderDir = isAsc ? "desc" : "asc";
7029
- setOrder(orderDir);
7030
- setOrderBy(property);
7031
- if (updateSort) {
7032
- updateSort(property, orderDir);
7033
- }
7034
- };
7035
- useLayoutEffect(() => {
7036
- if (!doNotCalculateRows) {
7037
- return;
7038
- }
7039
- function updateRowsPerPage() {
7040
- const newRowsPerPage = calculateRowsPerPage(rowHeight);
7041
- setRowsPerPage(newRowsPerPage);
7042
- }
7043
- updateRowsPerPage();
7044
- const debounced = (0, import_debounce.default)(updateRowsPerPage, 150);
7045
- window.addEventListener("resize", debounced);
7046
- return () => {
7047
- window.removeEventListener("resize", debounced);
7048
- };
7049
- }, [doNotCalculateRows]);
7050
- const createSortHandler = (property) => (event) => {
7051
- handleRequestSort(event, property);
7052
- };
7053
- const getTableRows = () => {
7054
- const index = page;
7055
- const rows = serverRendered ? data : stableSort(data, getSorting(order, orderBy)).slice(
7056
- index * rowsPerPage,
7057
- index * rowsPerPage + rowsPerPage
7058
- );
7059
- const rowsComponents = rows.map((row) => {
7060
- if (RenderItem) {
7061
- return /* @__PURE__ */ jsx110(RenderItem, { ...row }, row.id);
7062
- }
7063
- return /* @__PURE__ */ jsx110(TableRow2, { hover: true, onClick: () => onRowClick?.(row), children: headCells?.map((column) => /* @__PURE__ */ jsx110(TableCell2, { children: row[column.id] }, column.id)) }, row.id);
7064
- });
7065
- if (emptyRows > 0 && rowsPerPage > emptyRows) {
7066
- rowsComponents.push(
7067
- /* @__PURE__ */ jsx110(TableRow2, { style: { height: rowHeight * emptyRows }, children: /* @__PURE__ */ jsx110(TableCell2, { colSpan: 8 }) }, uuidv4())
7068
- );
7069
- }
7070
- return rowsComponents;
7071
- };
7072
- return /* @__PURE__ */ jsx110(Paper10, { className: classes.root, children: /* @__PURE__ */ jsx110(Box29, { className: classes.paper, children: isLoading ? /* @__PURE__ */ jsx110(TableLoading_default, { rowHeight, rowsPerPage }) : /* @__PURE__ */ jsx110(TableContainer, { className: classes.container, children: /* @__PURE__ */ jsxs75(MUITable, { size: "medium", stickyHeader: true, children: [
7073
- /* @__PURE__ */ jsx110(TableHead2, { className: classes.header, children: /* @__PURE__ */ jsx110(TableRow2, { children: headCells?.map((headCell) => /* @__PURE__ */ jsx110(
7074
- TableCell2,
7075
- {
7076
- align: "left",
7077
- sortDirection: orderBy === headCell.id ? order : void 0,
7078
- children: /* @__PURE__ */ jsx110(
7079
- TableSortLabel2,
7080
- {
7081
- active: orderBy === headCell.id,
7082
- direction: orderBy === headCell.id ? order : "asc",
7083
- onClick: createSortHandler(headCell.id),
7084
- children: headCell.label
7085
- }
7086
- )
7087
- },
7088
- headCell.id
7089
- )) }) }),
7090
- /* @__PURE__ */ jsxs75(TableBody, { children: [
7091
- getTableRows(),
7092
- rowsPerPage === emptyRows && /* @__PURE__ */ jsx110(TableRow2, { style: { height: rowHeight * emptyRows }, children: /* @__PURE__ */ jsx110(TableCell2, { colSpan: 8, align: "center", children: "Nothing to display" }) })
7093
- ] })
7094
- ] }) }) }) });
7095
- };
7096
- var Table_default = Table;
7097
-
7098
- // src/components/TableDesktop/TableDesktop.tsx
7099
- import {
7100
- useCallback as useCallback2,
7101
- useMemo as useMemo3,
7102
- useState as useState16
7103
- } from "react";
7104
- import {
7105
- Paper as Paper11,
7106
- Table as Table2,
7107
- TableBody as TableBody2,
7108
- TableContainer as TableContainer2,
7109
- Skeleton as Skeleton4,
7110
- Box as Box30
7111
- } from "@mui/material";
7112
- import { makeStyles as makeStyles49 } from "tss-react/mui";
6763
+ var SmartTableHeader_default = memo20(SmartTableHeader);
7113
6764
 
7114
6765
  // src/components/TableEmptyResult/TableEmptyResult.tsx
7115
- import { TableCell as TableCell3, TableRow as TableRow3, Typography as Typography25 } from "@mui/material";
7116
- import { makeStyles as makeStyles48 } from "tss-react/mui";
7117
- import { jsx as jsx111, jsxs as jsxs76 } from "react/jsx-runtime";
7118
- var useStyles48 = makeStyles48()(() => ({
6766
+ import { TableCell as TableCell2, TableRow as TableRow2, Typography as Typography26 } from "@mui/material";
6767
+ import { makeStyles as makeStyles46 } from "tss-react/mui";
6768
+ import { jsx as jsx109, jsxs as jsxs74 } from "react/jsx-runtime";
6769
+ var useStyles46 = makeStyles46()(() => ({
7119
6770
  tableCellIcon: { padding: 24, height: "calc(100vh - 320px)" },
7120
6771
  tableCellDefault: { padding: 24 }
7121
6772
  }));
@@ -7125,18 +6776,18 @@ var TableEmptyResult = ({
7125
6776
  handleClickOnClearFiltersButton = () => {
7126
6777
  }
7127
6778
  }) => {
7128
- const { classes } = useStyles48();
7129
- return showClearFilterButton ? /* @__PURE__ */ jsx111(TableRow3, { children: /* @__PURE__ */ jsxs76(
7130
- TableCell3,
6779
+ const { classes } = useStyles46();
6780
+ return showClearFilterButton ? /* @__PURE__ */ jsx109(TableRow2, { children: /* @__PURE__ */ jsxs74(
6781
+ TableCell2,
7131
6782
  {
7132
6783
  className: classes.tableCellIcon,
7133
6784
  colSpan,
7134
6785
  align: "center",
7135
6786
  children: [
7136
- /* @__PURE__ */ jsx111(EmptyGlassIcon_default, {}),
7137
- /* @__PURE__ */ jsx111(Typography25, { variant: "h6", children: "No results found." }),
7138
- /* @__PURE__ */ jsx111(Typography25, { variant: "subtitle1", children: "Search without applied filters?" }),
7139
- /* @__PURE__ */ jsx111(
6787
+ /* @__PURE__ */ jsx109(EmptyGlassIcon_default, {}),
6788
+ /* @__PURE__ */ jsx109(Typography26, { variant: "h6", children: "No results found." }),
6789
+ /* @__PURE__ */ jsx109(Typography26, { variant: "subtitle1", children: "Search without applied filters?" }),
6790
+ /* @__PURE__ */ jsx109(
7140
6791
  FilledButton_default,
7141
6792
  {
7142
6793
  copy: "Search",
@@ -7147,8 +6798,8 @@ var TableEmptyResult = ({
7147
6798
  )
7148
6799
  ]
7149
6800
  }
7150
- ) }) : /* @__PURE__ */ jsx111(TableRow3, { children: /* @__PURE__ */ jsx111(
7151
- TableCell3,
6801
+ ) }) : /* @__PURE__ */ jsx109(TableRow2, { children: /* @__PURE__ */ jsx109(
6802
+ TableCell2,
7152
6803
  {
7153
6804
  className: classes.tableCellDefault,
7154
6805
  colSpan,
@@ -7160,8 +6811,9 @@ var TableEmptyResult = ({
7160
6811
  var TableEmptyResult_default = TableEmptyResult;
7161
6812
 
7162
6813
  // src/components/TableDesktop/TableDesktop.tsx
7163
- import { jsx as jsx112, jsxs as jsxs77 } from "react/jsx-runtime";
7164
- var useStyles49 = makeStyles49()((theme) => ({
6814
+ import { jsx as jsx110, jsxs as jsxs75 } from "react/jsx-runtime";
6815
+ var ROW_HEIGHT = 56;
6816
+ var useStyles47 = makeStyles47()((theme) => ({
7165
6817
  root: {
7166
6818
  justifyContent: "space-between",
7167
6819
  display: "flex",
@@ -7191,7 +6843,7 @@ var useStyles49 = makeStyles49()((theme) => ({
7191
6843
  }
7192
6844
  }
7193
6845
  }));
7194
- var descendingComparator2 = (a, b, orderBy) => {
6846
+ var descendingComparator = (a, b, orderBy) => {
7195
6847
  const objA = a[orderBy];
7196
6848
  const objB = b[orderBy];
7197
6849
  const valA = typeof objA === "object" ? objA?.name : objA;
@@ -7213,11 +6865,17 @@ var descendingComparator2 = (a, b, orderBy) => {
7213
6865
  }
7214
6866
  return 0;
7215
6867
  };
7216
- var stableSort2 = (array, cmp) => array.map((el, index) => ({ el, index })).sort((a, b) => {
6868
+ var stableSort = (array, cmp) => array.map((el, index) => ({ el, index })).sort((a, b) => {
7217
6869
  const order = cmp(a.el, b.el);
7218
6870
  return order !== 0 ? order : a.index - b.index;
7219
6871
  }).map((el) => el.el);
7220
- var getComparator = (order, orderBy) => order === "desc" ? (a, b) => descendingComparator2(a, b, orderBy) : (a, b) => -descendingComparator2(a, b, orderBy);
6872
+ var getComparator = (order, orderBy) => order === "desc" ? (a, b) => descendingComparator(a, b, orderBy) : (a, b) => -descendingComparator(a, b, orderBy);
6873
+ var resolveOptionType = (option, fieldName) => {
6874
+ if (!option || typeof option !== "object") {
6875
+ return option;
6876
+ }
6877
+ return option[fieldName] || "";
6878
+ };
7221
6879
  var TableDesktop = ({
7222
6880
  data,
7223
6881
  headCells,
@@ -7239,33 +6897,495 @@ var TableDesktop = ({
7239
6897
  onApplyFilters,
7240
6898
  shouldShowCheckOnFilter
7241
6899
  }) => {
7242
- const [order, setOrder] = useState16(appliedFilters?.sortDir || "desc");
7243
- const [orderBy, setOrderBy] = useState16(
6900
+ const { classes } = useStyles47();
6901
+ const [order, setOrder] = useState15(appliedFilters?.sortDir || "desc");
6902
+ const [orderBy, setOrderBy] = useState15(
6903
+ appliedFilters?.sortField || "delivery_date"
6904
+ );
6905
+ const [selected, setSelected] = useState15(/* @__PURE__ */ new Set());
6906
+ const [page] = useState15(0);
6907
+ const numRows = data.length;
6908
+ const emptyRows = useMemo2(
6909
+ () => rowsPerPage - data.length,
6910
+ [rowsPerPage, data]
6911
+ );
6912
+ const visibleHeadCells = useMemo2(
6913
+ () => headCells.filter((headCell) => headCell?.enabled ?? true),
6914
+ [headCells]
6915
+ );
6916
+ const handleSelectAllClick = useCallback2(
6917
+ (event) => {
6918
+ if (event.target.checked) {
6919
+ const allItems = new Set(data.map((n) => n[keyField]));
6920
+ setSelected(allItems);
6921
+ } else {
6922
+ setSelected(/* @__PURE__ */ new Set());
6923
+ }
6924
+ },
6925
+ [data, keyField]
6926
+ );
6927
+ const handleRequestSort = (event, property) => {
6928
+ const isAsc = orderBy === property && order === "asc";
6929
+ const orderDir = isAsc ? "desc" : "asc";
6930
+ setOrder(orderDir);
6931
+ setOrderBy(property);
6932
+ if (updateSort) {
6933
+ updateSort(property, orderDir);
6934
+ }
6935
+ };
6936
+ const handleRowCheckboxChange = useCallback2(
6937
+ (event, keyFieldValue) => {
6938
+ event.stopPropagation();
6939
+ setSelected((prev) => {
6940
+ const newSelected = new Set(prev);
6941
+ if (newSelected.has(keyFieldValue)) {
6942
+ newSelected.delete(keyFieldValue);
6943
+ } else {
6944
+ newSelected.add(keyFieldValue);
6945
+ }
6946
+ return newSelected;
6947
+ });
6948
+ },
6949
+ []
6950
+ );
6951
+ const renderTableRows = useMemo2(() => {
6952
+ if (isLoading) {
6953
+ return [...Array(Math.min(numRows, rowsPerPage))].map((_, rowIndex) => /* @__PURE__ */ jsx110(TableRow3, { children: [...Array(visibleHeadCells.length)].map((_2, cellIndex) => /* @__PURE__ */ jsx110(TableCell3, { children: /* @__PURE__ */ jsx110(
6954
+ Skeleton2,
6955
+ {
6956
+ animation: "pulse",
6957
+ variant: "rounded",
6958
+ height: ROW_HEIGHT - 33,
6959
+ sx: { bgcolor: colors.neutral100 },
6960
+ "data-testid": "loading-skeleton"
6961
+ }
6962
+ ) }, cellIndex)) }, rowIndex));
6963
+ }
6964
+ const sortedData = disableInternalSort ? data : stableSort(data, getComparator(order, orderBy));
6965
+ return sortedData.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage).map((row, index) => {
6966
+ const isItemSelected = selected.has(row[keyField]);
6967
+ return /* @__PURE__ */ jsx110(
6968
+ RenderItem,
6969
+ {
6970
+ ...{
6971
+ ...row,
6972
+ index,
6973
+ deleteItem,
6974
+ isItemSelected,
6975
+ enableCheckboxSelection,
6976
+ rowHeight: ROW_HEIGHT,
6977
+ rowId: row[keyField],
6978
+ handleRowCheckboxChange,
6979
+ visibleHeadCells
6980
+ }
6981
+ },
6982
+ row[keyField] ?? index
6983
+ );
6984
+ });
6985
+ }, [
6986
+ data,
6987
+ order,
6988
+ orderBy,
6989
+ page,
6990
+ rowsPerPage,
6991
+ selected,
6992
+ isLoading,
6993
+ numRows,
6994
+ enableCheckboxSelection,
6995
+ disableInternalSort,
6996
+ deleteItem,
6997
+ keyField,
6998
+ handleRowCheckboxChange,
6999
+ visibleHeadCells,
7000
+ RenderItem
7001
+ ]);
7002
+ useEffect10(() => {
7003
+ if (!enableCheckboxSelection) {
7004
+ setSelected(/* @__PURE__ */ new Set());
7005
+ }
7006
+ }, [enableCheckboxSelection]);
7007
+ return /* @__PURE__ */ jsx110("div", { className: classes.root, style: { height }, children: /* @__PURE__ */ jsxs75(Paper10, { className: classes.paper, children: [
7008
+ /* @__PURE__ */ jsx110(TableContainer, { className: classes.container, children: /* @__PURE__ */ jsxs75(
7009
+ Table,
7010
+ {
7011
+ stickyHeader: true,
7012
+ "aria-labelledby": "tableTitle",
7013
+ "aria-label": "sticky table",
7014
+ style: { tableLayout },
7015
+ children: [
7016
+ /* @__PURE__ */ jsx110(
7017
+ SmartTableHeader_default,
7018
+ {
7019
+ headCells: visibleHeadCells,
7020
+ order,
7021
+ orderBy,
7022
+ numSelected: selected.size,
7023
+ numRows,
7024
+ enableCheckboxSelection,
7025
+ headerFilters: headerFilters ?? {},
7026
+ onRequestSort: handleRequestSort,
7027
+ onSelectAllClick: handleSelectAllClick,
7028
+ onApplyFilters,
7029
+ shouldShowCheckOnFilter
7030
+ }
7031
+ ),
7032
+ /* @__PURE__ */ jsx110(TableBody, { children: rowsPerPage !== emptyRows ? renderTableRows : /* @__PURE__ */ jsx110(
7033
+ TableEmptyResult_default,
7034
+ {
7035
+ colSpan: enableCheckboxSelection ? visibleHeadCells.length + 1 : visibleHeadCells.length,
7036
+ showClearFilterButton,
7037
+ handleClickOnClearFiltersButton
7038
+ }
7039
+ ) })
7040
+ ]
7041
+ }
7042
+ ) }),
7043
+ children
7044
+ ] }) });
7045
+ };
7046
+ var TableDesktop_default = TableDesktop;
7047
+
7048
+ // src/components/SmartTableHeaderFilterMenu/SmartTableHeaderFilterMenu.tsx
7049
+ import { Fragment as Fragment11, jsx as jsx111, jsxs as jsxs76 } from "react/jsx-runtime";
7050
+ var useStyles48 = makeStyles48()((theme) => ({
7051
+ filterMenu: {
7052
+ display: "flex",
7053
+ flexDirection: "column"
7054
+ },
7055
+ filterOptions: {
7056
+ maxHeight: theme.spacing(62),
7057
+ overflowY: "auto",
7058
+ "&::-webkit-scrollbar": {
7059
+ width: "8px",
7060
+ height: "8px"
7061
+ },
7062
+ "&::-webkit-scrollbar-track": {
7063
+ backgroundColor: theme.palette.mode === "dark" ? theme.palette.grey[800] : theme.palette.grey[100]
7064
+ },
7065
+ "&::-webkit-scrollbar-thumb": {
7066
+ backgroundColor: theme.palette.mode === "dark" ? theme.palette.grey[900] : theme.palette.grey[400],
7067
+ borderRadius: "10px"
7068
+ },
7069
+ "&::-webkit-scrollbar-thumb:hover": {
7070
+ backgroundColor: theme.palette.mode === "dark" ? theme.palette.common.black : theme.palette.grey[500]
7071
+ }
7072
+ },
7073
+ filter: {
7074
+ display: "flex",
7075
+ alignItems: "center",
7076
+ justifyContent: "space-between",
7077
+ padding: theme.spacing(0, 3)
7078
+ },
7079
+ applyFilterButtonsContainer: {
7080
+ display: "flex",
7081
+ padding: theme.spacing(0, 1),
7082
+ justifyContent: "space-between"
7083
+ },
7084
+ saveAsDefaultButton: {
7085
+ color: theme.palette.primary.main
7086
+ },
7087
+ skeleton: {
7088
+ height: theme.spacing(3),
7089
+ margin: theme.spacing(1)
7090
+ }
7091
+ }));
7092
+ var findFilterIndex = (filters, filterOption) => filters.findIndex((item) => {
7093
+ if (typeof item === "string" && typeof filterOption === "string") {
7094
+ return item === filterOption;
7095
+ }
7096
+ if (typeof item === "object" && typeof filterOption === "object") {
7097
+ return item.id === filterOption.id;
7098
+ }
7099
+ return false;
7100
+ });
7101
+ var SmartTableHeaderFilterMenu = ({
7102
+ headCell,
7103
+ numActiveFilters,
7104
+ headerFilters,
7105
+ shouldShowCheckOnFilter,
7106
+ onApplyFilters
7107
+ }) => {
7108
+ const { classes } = useStyles48();
7109
+ const [anchorEl, setAnchorEl] = useState16(null);
7110
+ const [filterOptionsData, setFilterOptionsData] = useState16();
7111
+ const [selectedFilters, setSelectedFilters] = useState16(
7112
+ headerFilters[headCell.id] ?? []
7113
+ );
7114
+ useEffect11(() => {
7115
+ if (headCell.filterOptions) {
7116
+ setFilterOptionsData(headCell.filterOptions);
7117
+ }
7118
+ }, [headCell.filterOptions]);
7119
+ const numFilterOptions = useMemo3(() => filterOptionsData?.length ?? 0, [filterOptionsData?.length]);
7120
+ const numCurrentSelectedFilters = selectedFilters.length;
7121
+ const handleFilterMenuOpen = (event) => {
7122
+ if (!numFilterOptions) {
7123
+ headCell.refetchFilterOptions?.();
7124
+ }
7125
+ setAnchorEl(event.currentTarget);
7126
+ };
7127
+ const handleFilterMenuClose = () => {
7128
+ setSelectedFilters(headerFilters[headCell.id]);
7129
+ setAnchorEl(null);
7130
+ };
7131
+ const handleFilterOptionClick = (option) => {
7132
+ const selectedIndex = findFilterIndex(selectedFilters, option);
7133
+ let newSelected;
7134
+ if (selectedIndex === -1) {
7135
+ if (typeof option === "string") {
7136
+ newSelected = [...selectedFilters, option];
7137
+ } else {
7138
+ newSelected = [...selectedFilters, option];
7139
+ }
7140
+ } else {
7141
+ newSelected = selectedFilters.filter(
7142
+ (_, index) => index !== selectedIndex
7143
+ );
7144
+ }
7145
+ setSelectedFilters(newSelected);
7146
+ };
7147
+ const handleApplyFilters = (shouldSave) => {
7148
+ const updatedFilters = {
7149
+ ...headerFilters,
7150
+ [headCell.id]: [...selectedFilters]
7151
+ };
7152
+ onApplyFilters?.(updatedFilters, shouldSave);
7153
+ setAnchorEl(null);
7154
+ };
7155
+ useEffect11(() => {
7156
+ setSelectedFilters(headerFilters[headCell.id] ?? []);
7157
+ }, [headerFilters, headCell.id]);
7158
+ const isOptionChecked = useMemo3(() => (resolvedOption) => !!selectedFilters?.some(
7159
+ (value) => resolveOptionType(value, headCell.fieldName ?? "") === resolvedOption
7160
+ ), [selectedFilters]);
7161
+ const loadingSkeletons = /* @__PURE__ */ jsxs76(Box29, { "data-testid": "loading-skeletons", width: 272, children: [
7162
+ /* @__PURE__ */ jsx111(Skeleton3, { variant: "rounded", className: classes.skeleton }),
7163
+ /* @__PURE__ */ jsx111(Divider9, {}),
7164
+ /* @__PURE__ */ jsx111(Skeleton3, { variant: "rounded", className: classes.skeleton }),
7165
+ /* @__PURE__ */ jsx111(Skeleton3, { variant: "rounded", className: classes.skeleton }),
7166
+ /* @__PURE__ */ jsx111(Skeleton3, { variant: "rounded", className: classes.skeleton }),
7167
+ /* @__PURE__ */ jsx111(Skeleton3, { variant: "rounded", className: classes.skeleton }),
7168
+ /* @__PURE__ */ jsx111(Divider9, {}),
7169
+ /* @__PURE__ */ jsx111(Skeleton3, { variant: "rounded", className: classes.skeleton })
7170
+ ] });
7171
+ return /* @__PURE__ */ jsxs76(Fragment11, { children: [
7172
+ /* @__PURE__ */ jsx111(
7173
+ ActiveFiltersIconButton_default,
7174
+ {
7175
+ numActiveFilters,
7176
+ handleClick: handleFilterMenuOpen,
7177
+ className: classNames3("filter-menu-trigger", {
7178
+ "has-active-filters": !!numActiveFilters || !!anchorEl
7179
+ })
7180
+ }
7181
+ ),
7182
+ /* @__PURE__ */ jsx111(
7183
+ Menu4,
7184
+ {
7185
+ open: !!anchorEl,
7186
+ onClose: handleFilterMenuClose,
7187
+ anchorEl,
7188
+ "data-testid": "filter-menu",
7189
+ anchorOrigin: { vertical: "bottom", horizontal: "right" },
7190
+ transformOrigin: { vertical: "top", horizontal: "right" },
7191
+ children: headCell.isFetchingFilterOptions ? loadingSkeletons : /* @__PURE__ */ jsxs76(Box29, { className: classes.filterMenu, children: [
7192
+ /* @__PURE__ */ jsx111(Box29, { px: 3, mb: 0.5, children: /* @__PURE__ */ jsx111(
7193
+ FormControlLabel3,
7194
+ {
7195
+ label: "Select All",
7196
+ control: /* @__PURE__ */ jsx111(
7197
+ Checkbox5,
7198
+ {
7199
+ disableRipple: true,
7200
+ checked: numCurrentSelectedFilters === numFilterOptions,
7201
+ indeterminate: numCurrentSelectedFilters > 0 && numCurrentSelectedFilters < numFilterOptions,
7202
+ onChange: ({ target: { checked } }) => {
7203
+ if (checked) {
7204
+ setSelectedFilters([...filterOptionsData]);
7205
+ } else {
7206
+ setSelectedFilters([]);
7207
+ }
7208
+ }
7209
+ }
7210
+ )
7211
+ }
7212
+ ) }),
7213
+ /* @__PURE__ */ jsx111(Divider9, { sx: { mb: 0.5 } }),
7214
+ /* @__PURE__ */ jsx111(Box29, { className: classes.filterOptions, children: filterOptionsData?.map(
7215
+ (option) => {
7216
+ const resolvedOption = resolveOptionType(option, headCell.fieldName ?? "");
7217
+ return /* @__PURE__ */ jsxs76(
7218
+ Box29,
7219
+ {
7220
+ className: classes.filter,
7221
+ children: [
7222
+ /* @__PURE__ */ jsx111(
7223
+ FormControlLabel3,
7224
+ {
7225
+ label: resolvedOption,
7226
+ control: /* @__PURE__ */ jsx111(
7227
+ Checkbox5,
7228
+ {
7229
+ disableRipple: true,
7230
+ onChange: () => handleFilterOptionClick(option),
7231
+ checked: isOptionChecked(resolvedOption)
7232
+ }
7233
+ )
7234
+ },
7235
+ resolvedOption
7236
+ ),
7237
+ shouldShowCheckOnFilter?.(headCell.id, option) ? /* @__PURE__ */ jsx111(Tooltip6, { title: "This filter is saved as default", children: /* @__PURE__ */ jsx111(CheckIcon, { fontSize: "small", color: "action" }) }) : null
7238
+ ]
7239
+ },
7240
+ resolvedOption
7241
+ );
7242
+ }
7243
+ ) }),
7244
+ /* @__PURE__ */ jsx111(Divider9, { sx: { mb: 0.5 } }),
7245
+ /* @__PURE__ */ jsxs76(Box29, { className: classes.applyFilterButtonsContainer, children: [
7246
+ /* @__PURE__ */ jsx111(
7247
+ ExtendedButton_default,
7248
+ {
7249
+ copy: "Save as Default",
7250
+ buttonType: "button",
7251
+ variant: "text",
7252
+ tooltip: "Persists those filters for future visits",
7253
+ className: classes.saveAsDefaultButton,
7254
+ onClick: () => handleApplyFilters(true)
7255
+ }
7256
+ ),
7257
+ /* @__PURE__ */ jsx111(
7258
+ ExtendedButton_default,
7259
+ {
7260
+ copy: "Apply",
7261
+ color: "primary",
7262
+ buttonType: "submit",
7263
+ onClick: () => handleApplyFilters(false)
7264
+ }
7265
+ )
7266
+ ] })
7267
+ ] })
7268
+ }
7269
+ )
7270
+ ] });
7271
+ };
7272
+ var SmartTableHeaderFilterMenu_default = memo21(SmartTableHeaderFilterMenu);
7273
+
7274
+ // src/components/Table/Table.tsx
7275
+ var import_debounce = __toESM(require_debounce(), 1);
7276
+ import { useLayoutEffect, useState as useState17 } from "react";
7277
+ import {
7278
+ Box as Box31,
7279
+ Paper as Paper11,
7280
+ Table as MUITable,
7281
+ TableBody as TableBody2,
7282
+ TableCell as TableCell4,
7283
+ TableContainer as TableContainer2,
7284
+ TableHead as TableHead2,
7285
+ TableRow as TableRow4,
7286
+ TableSortLabel as TableSortLabel2
7287
+ } from "@mui/material";
7288
+ import { makeStyles as makeStyles49 } from "tss-react/mui";
7289
+ import { v4 as uuidv4 } from "uuid";
7290
+
7291
+ // src/components/TableLoading/TableLoading.tsx
7292
+ import { Box as Box30, Skeleton as Skeleton4 } from "@mui/material";
7293
+ import { jsx as jsx112 } from "react/jsx-runtime";
7294
+ var TableLoading = ({
7295
+ rowsPerPage,
7296
+ rowHeight
7297
+ }) => /* @__PURE__ */ jsx112(Box30, { children: Array.from({ length: rowsPerPage ?? 0 }).map((_, index) => /* @__PURE__ */ jsx112(
7298
+ Skeleton4,
7299
+ {
7300
+ animation: "pulse",
7301
+ "data-testid": "table-loading-skeleton",
7302
+ style: { margin: "8px", opacity: 0.4 },
7303
+ variant: "rectangular",
7304
+ height: rowHeight
7305
+ },
7306
+ index
7307
+ )) });
7308
+ var TableLoading_default = TableLoading;
7309
+
7310
+ // src/components/Table/helpers.tsx
7311
+ function stableSort2(array, cmp) {
7312
+ const stabilizedThis = array.map((el, index) => [el, index]);
7313
+ stabilizedThis.sort((a, b) => {
7314
+ const order = cmp(a[0], b[0]);
7315
+ if (order !== 0) {
7316
+ return order;
7317
+ }
7318
+ return a[1] - b[1];
7319
+ });
7320
+ return stabilizedThis.map((el) => el[0]);
7321
+ }
7322
+ function descendingComparator2(a, b, orderBy) {
7323
+ if (b[orderBy] < a[orderBy]) {
7324
+ return -1;
7325
+ }
7326
+ if (b[orderBy] > a[orderBy]) {
7327
+ return 1;
7328
+ }
7329
+ return 0;
7330
+ }
7331
+ function getSorting(order, orderBy) {
7332
+ return order === "desc" ? (a, b) => descendingComparator2(a, b, orderBy) : (a, b) => -descendingComparator2(a, b, orderBy);
7333
+ }
7334
+ function calculateRowsPerPage(rowHeight) {
7335
+ const appContainerDom = document.getElementById("mainContainer");
7336
+ const headerDom = document.getElementById("aboveTableHeader");
7337
+ if (appContainerDom && headerDom) {
7338
+ return Math.floor(
7339
+ (appContainerDom.clientHeight - headerDom.clientHeight - 24) / rowHeight - 2
7340
+ );
7341
+ }
7342
+ return 1;
7343
+ }
7344
+
7345
+ // src/components/Table/Table.tsx
7346
+ import { jsx as jsx113, jsxs as jsxs77 } from "react/jsx-runtime";
7347
+ var useStyles49 = makeStyles49()(() => ({
7348
+ root: {
7349
+ height: "calc(100vh - 262px)",
7350
+ overflow: "scroll"
7351
+ },
7352
+ paper: {
7353
+ width: "100%",
7354
+ display: "flex",
7355
+ flexDirection: "column",
7356
+ justifyContent: "space-between"
7357
+ },
7358
+ header: {
7359
+ "& .MuiTableSortLabel-root": {
7360
+ fontWeight: 600,
7361
+ fontSize: ".875rem"
7362
+ }
7363
+ },
7364
+ container: {
7365
+ maxHeight: "calc(100% - 0)"
7366
+ }
7367
+ }));
7368
+ var Table2 = ({
7369
+ appliedFilters,
7370
+ data,
7371
+ doNotCalculateRows,
7372
+ headCells,
7373
+ isLoading,
7374
+ onRowClick,
7375
+ page = 0,
7376
+ RenderItem = null,
7377
+ rowsPerPage: defaultRowsPerPage = 10,
7378
+ serverRendered,
7379
+ updateSort
7380
+ }) => {
7381
+ const [order, setOrder] = useState17(appliedFilters?.sortDir || "desc");
7382
+ const [orderBy, setOrderBy] = useState17(
7244
7383
  appliedFilters?.sortField || "delivery_date"
7245
7384
  );
7246
- const [selected, setSelected] = useState16([]);
7247
- const [page] = useState16(0);
7385
+ const [rowsPerPage, setRowsPerPage] = useState17(defaultRowsPerPage);
7248
7386
  const { classes } = useStyles49();
7249
7387
  const rowHeight = 56;
7250
- const emptyRows = useMemo3(
7251
- () => rowsPerPage - data.length,
7252
- [rowsPerPage, data]
7253
- );
7254
- const visibleHeadCells = useMemo3(
7255
- () => headCells.filter((headCell) => headCell?.enabled ?? true),
7256
- [headCells]
7257
- );
7258
- const handleSelectAllClick = useCallback2(
7259
- (event) => {
7260
- if (event.target.checked) {
7261
- const newSelected = data.map((n) => n[keyField]);
7262
- setSelected(newSelected);
7263
- return;
7264
- }
7265
- setSelected([]);
7266
- },
7267
- [data, keyField]
7268
- );
7388
+ const emptyRows = rowsPerPage - Math.min(rowsPerPage, data.length - page * rowsPerPage);
7269
7389
  const handleRequestSort = (event, property) => {
7270
7390
  const isAsc = orderBy === property && order === "asc";
7271
7391
  const orderDir = isAsc ? "desc" : "asc";
@@ -7275,119 +7395,419 @@ var TableDesktop = ({
7275
7395
  updateSort(property, orderDir);
7276
7396
  }
7277
7397
  };
7278
- const handleRowCheckboxClick = useCallback2(
7279
- (event, keyFieldValue) => {
7280
- const selectedIndex = selected.indexOf(keyFieldValue);
7281
- let newSelected = [];
7282
- if (selectedIndex === -1) {
7283
- newSelected = newSelected.concat(selected, keyFieldValue);
7284
- } else if (selectedIndex === 0) {
7285
- newSelected = newSelected.concat(selected.slice(1));
7286
- } else if (selectedIndex === selected.length - 1) {
7287
- newSelected = newSelected.concat(selected.slice(0, -1));
7288
- } else if (selectedIndex > 0) {
7289
- newSelected = newSelected.concat(
7290
- selected.slice(0, selectedIndex),
7291
- selected.slice(selectedIndex + 1)
7292
- );
7398
+ useLayoutEffect(() => {
7399
+ if (!doNotCalculateRows) {
7400
+ return;
7401
+ }
7402
+ function updateRowsPerPage() {
7403
+ const newRowsPerPage = calculateRowsPerPage(rowHeight);
7404
+ setRowsPerPage(newRowsPerPage);
7405
+ }
7406
+ updateRowsPerPage();
7407
+ const debounced = (0, import_debounce.default)(updateRowsPerPage, 150);
7408
+ window.addEventListener("resize", debounced);
7409
+ return () => {
7410
+ window.removeEventListener("resize", debounced);
7411
+ };
7412
+ }, [doNotCalculateRows]);
7413
+ const createSortHandler = (property) => (event) => {
7414
+ handleRequestSort(event, property);
7415
+ };
7416
+ const getTableRows = () => {
7417
+ const index = page;
7418
+ const rows = serverRendered ? data : stableSort2(data, getSorting(order, orderBy)).slice(
7419
+ index * rowsPerPage,
7420
+ index * rowsPerPage + rowsPerPage
7421
+ );
7422
+ const rowsComponents = rows.map((row) => {
7423
+ if (RenderItem) {
7424
+ return /* @__PURE__ */ jsx113(RenderItem, { ...row }, row.id);
7293
7425
  }
7294
- setSelected(newSelected);
7295
- },
7296
- [selected]
7297
- );
7298
- const renderTableRows = useMemo3(() => {
7299
- const sortedData = disableInternalSort ? data : stableSort2(data, getComparator(order, orderBy));
7300
- return sortedData.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage).map((row, index) => {
7301
- const isItemSelected = selected.includes(row[keyField]);
7302
- return /* @__PURE__ */ jsx112(
7303
- RenderItem,
7304
- {
7305
- ...{
7306
- ...row,
7307
- index,
7308
- deleteItem,
7309
- isItemSelected,
7310
- enableCheckboxSelection,
7311
- keyFieldValue: row[keyField],
7312
- handleRowCheckboxClick,
7313
- visibleHeadCells
7314
- }
7315
- },
7316
- row[keyField] ?? index
7317
- );
7426
+ return /* @__PURE__ */ jsx113(TableRow4, { hover: true, onClick: () => onRowClick?.(row), children: headCells?.map((column) => /* @__PURE__ */ jsx113(TableCell4, { children: row[column.id] }, column.id)) }, row.id);
7318
7427
  });
7319
- }, [
7320
- data,
7321
- order,
7322
- orderBy,
7323
- page,
7324
- rowsPerPage,
7325
- selected,
7326
- enableCheckboxSelection,
7327
- disableInternalSort,
7328
- deleteItem,
7329
- keyField,
7330
- handleRowCheckboxClick,
7331
- visibleHeadCells,
7332
- RenderItem
7333
- ]);
7334
- return /* @__PURE__ */ jsx112("div", { className: classes.root, style: { height }, children: /* @__PURE__ */ jsxs77(Paper11, { className: classes.paper, children: [
7335
- isLoading ? /* @__PURE__ */ jsx112(Box30, { width: "100%", overflow: "hidden", children: [...Array(Math.floor(rowsPerPage ?? 50))].map((_, index) => /* @__PURE__ */ jsx112(
7336
- Skeleton4,
7428
+ if (emptyRows > 0 && rowsPerPage > emptyRows) {
7429
+ rowsComponents.push(
7430
+ /* @__PURE__ */ jsx113(TableRow4, { style: { height: rowHeight * emptyRows }, children: /* @__PURE__ */ jsx113(TableCell4, { colSpan: 8 }) }, uuidv4())
7431
+ );
7432
+ }
7433
+ return rowsComponents;
7434
+ };
7435
+ return /* @__PURE__ */ jsx113(Paper11, { className: classes.root, children: /* @__PURE__ */ jsx113(Box31, { className: classes.paper, children: isLoading ? /* @__PURE__ */ jsx113(TableLoading_default, { rowHeight, rowsPerPage }) : /* @__PURE__ */ jsx113(TableContainer2, { className: classes.container, children: /* @__PURE__ */ jsxs77(MUITable, { size: "medium", stickyHeader: true, children: [
7436
+ /* @__PURE__ */ jsx113(TableHead2, { className: classes.header, children: /* @__PURE__ */ jsx113(TableRow4, { children: headCells?.map((headCell) => /* @__PURE__ */ jsx113(
7437
+ TableCell4,
7337
7438
  {
7338
- animation: "pulse",
7339
- variant: "rounded",
7340
- sx: { margin: 1 },
7341
- height: rowHeight,
7342
- "data-testid": "loading-skeleton"
7439
+ align: "left",
7440
+ sortDirection: orderBy === headCell.id ? order : void 0,
7441
+ children: /* @__PURE__ */ jsx113(
7442
+ TableSortLabel2,
7443
+ {
7444
+ active: orderBy === headCell.id,
7445
+ direction: orderBy === headCell.id ? order : "asc",
7446
+ onClick: createSortHandler(headCell.id),
7447
+ children: headCell.label
7448
+ }
7449
+ )
7343
7450
  },
7344
- index
7345
- )) }) : /* @__PURE__ */ jsx112(TableContainer2, { className: classes.container, children: /* @__PURE__ */ jsxs77(
7346
- Table2,
7347
- {
7348
- "aria-labelledby": "tableTitle",
7349
- "aria-label": "sticky table",
7350
- stickyHeader: true,
7351
- style: { tableLayout },
7352
- children: [
7353
- /* @__PURE__ */ jsx112(
7354
- SmartTableHeader_default,
7355
- {
7356
- headCells: visibleHeadCells,
7357
- order,
7358
- orderBy,
7359
- numSelected: selected.length,
7360
- numRows: data.length,
7361
- enableCheckboxSelection,
7362
- headerFilters: headerFilters ?? {},
7363
- onRequestSort: handleRequestSort,
7364
- onSelectAllClick: handleSelectAllClick,
7365
- onApplyFilters,
7366
- shouldShowCheckOnFilter
7367
- }
7368
- ),
7369
- /* @__PURE__ */ jsx112(TableBody2, { children: rowsPerPage !== emptyRows ? renderTableRows : /* @__PURE__ */ jsx112(
7370
- TableEmptyResult_default,
7451
+ headCell.id
7452
+ )) }) }),
7453
+ /* @__PURE__ */ jsxs77(TableBody2, { children: [
7454
+ getTableRows(),
7455
+ rowsPerPage === emptyRows && /* @__PURE__ */ jsx113(TableRow4, { style: { height: rowHeight * emptyRows }, children: /* @__PURE__ */ jsx113(TableCell4, { colSpan: 8, align: "center", children: "Nothing to display" }) })
7456
+ ] })
7457
+ ] }) }) }) });
7458
+ };
7459
+ var Table_default = Table2;
7460
+
7461
+ // src/components/TableDesktopFooter/TableDesktopFooter.tsx
7462
+ import Refresh3 from "@mui/icons-material/Refresh";
7463
+ import { Box as Box32, Button as Button13, MenuItem as MenuItem4, Pagination as Pagination2, Select as Select4, Stack, Typography as Typography27 } from "@mui/material";
7464
+ import { jsx as jsx114, jsxs as jsxs78 } from "react/jsx-runtime";
7465
+ var TableDesktopFooter = ({
7466
+ numPages,
7467
+ page,
7468
+ pageSize,
7469
+ pageSizeOptions,
7470
+ handlePageChange,
7471
+ handlePageSizeChange,
7472
+ refetch,
7473
+ isFetching
7474
+ }) => {
7475
+ return /* @__PURE__ */ jsxs78(
7476
+ Box32,
7477
+ {
7478
+ py: 1,
7479
+ gap: 2,
7480
+ display: "flex",
7481
+ justifyContent: "space-between",
7482
+ alignItems: "center",
7483
+ borderTop: `1px solid ${colors.neutral300}`,
7484
+ bgcolor: (theme) => theme.palette.background.default,
7485
+ children: [
7486
+ /* @__PURE__ */ jsxs78(
7487
+ Button13,
7488
+ {
7489
+ disableRipple: true,
7490
+ variant: "outlined",
7491
+ onClick: () => refetch(),
7492
+ disabled: isFetching,
7493
+ sx: {
7494
+ ml: 1,
7495
+ gap: 1,
7496
+ borderRadius: 25,
7497
+ color: colors.neutral800,
7498
+ borderColor: colors.neutral600
7499
+ },
7500
+ children: [
7501
+ /* @__PURE__ */ jsx114(
7502
+ Refresh3,
7503
+ {
7504
+ fontSize: "small",
7505
+ color: isFetching ? "disabled" : "primary"
7506
+ }
7507
+ ),
7508
+ "REFRESH"
7509
+ ]
7510
+ }
7511
+ ),
7512
+ /* @__PURE__ */ jsxs78(Box32, { display: "flex", children: [
7513
+ /* @__PURE__ */ jsxs78(Stack, { direction: "row", spacing: 2, alignItems: "center", children: [
7514
+ /* @__PURE__ */ jsx114(Typography27, { children: "Rows per page:" }),
7515
+ /* @__PURE__ */ jsx114(
7516
+ Select4,
7517
+ {
7518
+ value: pageSize,
7519
+ onChange: handlePageSizeChange,
7520
+ size: "small",
7521
+ variant: "standard",
7522
+ children: pageSizeOptions.map((size) => /* @__PURE__ */ jsx114(MenuItem4, { value: size, children: size }, size))
7523
+ }
7524
+ )
7525
+ ] }),
7526
+ /* @__PURE__ */ jsx114(
7527
+ Pagination2,
7371
7528
  {
7372
- colSpan: enableCheckboxSelection ? visibleHeadCells.length + 1 : visibleHeadCells.length,
7373
- showClearFilterButton,
7374
- handleClickOnClearFiltersButton
7529
+ color: "standard",
7530
+ count: numPages,
7531
+ page,
7532
+ onChange: handlePageChange
7375
7533
  }
7376
- ) })
7377
- ]
7534
+ )
7535
+ ] })
7536
+ ]
7537
+ }
7538
+ );
7539
+ };
7540
+
7541
+ // src/components/TableDesktopRowCell/TableDesktopRowCell.tsx
7542
+ import { useEffect as useEffect13, useRef as useRef5, useState as useState20 } from "react";
7543
+ import { Box as Box33, Checkbox as Checkbox6, IconButton as IconButton4, TableCell as TableCell5, TextField as TextField9, Tooltip as Tooltip7 } from "@mui/material";
7544
+
7545
+ // src/components/TableDesktopRowCell/TableDesktopSmartSelect.tsx
7546
+ import { useState as useState18, memo as memo22, useEffect as useEffect12 } from "react";
7547
+ import { jsx as jsx115 } from "react/jsx-runtime";
7548
+ var resolveValue = (value) => {
7549
+ if (typeof value === "string") {
7550
+ return value;
7551
+ }
7552
+ return value?.id;
7553
+ };
7554
+ var TableDesktopSmartSelect = memo22(({
7555
+ ref,
7556
+ initialValue,
7557
+ inputLabel,
7558
+ fieldName,
7559
+ rowId,
7560
+ disabled,
7561
+ filterOptions,
7562
+ refetchFilterOptions,
7563
+ isFetchingFilterOptions,
7564
+ onUpdateEditableCell
7565
+ }) => {
7566
+ const [value, setValue] = useState18(initialValue);
7567
+ const [options, setOptions] = useState18();
7568
+ const valueId = resolveValue(value);
7569
+ const valueLabel = resolveOptionType(value, fieldName);
7570
+ useEffect12(() => {
7571
+ if (filterOptions) {
7572
+ const parsedOptions = filterOptions?.map((option) => ({
7573
+ value: resolveValue(option),
7574
+ label: String(resolveOptionType(option, fieldName))
7575
+ }));
7576
+ setOptions(parsedOptions);
7577
+ }
7578
+ }, [filterOptions]);
7579
+ return /* @__PURE__ */ jsx115(
7580
+ SmartSelect_default,
7581
+ {
7582
+ ref,
7583
+ value: valueId,
7584
+ inputLabel,
7585
+ options,
7586
+ disabled,
7587
+ refetch: refetchFilterOptions,
7588
+ isFetching: isFetchingFilterOptions,
7589
+ defaultOption: {
7590
+ value: valueId ?? "",
7591
+ label: String(valueLabel ?? "")
7592
+ },
7593
+ onChange: ({ value: value2, label }) => {
7594
+ setValue({ id: value2 ?? "", name: label ?? "" });
7595
+ onUpdateEditableCell?.(rowId, value2 ?? "");
7378
7596
  }
7379
- ) }),
7380
- children
7381
- ] }) });
7597
+ }
7598
+ );
7599
+ });
7600
+
7601
+ // src/components/TableDesktopRowCell/TableDesktopRowCell.tsx
7602
+ import CheckIcon2 from "@mui/icons-material/Check";
7603
+
7604
+ // src/components/TableDesktopRowCell/TableDesktopTextField.tsx
7605
+ import TextField8 from "@mui/material/TextField";
7606
+ import { useMemo as useMemo4, useState as useState19 } from "react";
7607
+ import { jsx as jsx116 } from "react/jsx-runtime";
7608
+ var TableDesktopTextField = ({
7609
+ rowId,
7610
+ editInitialValue,
7611
+ inputLabel,
7612
+ disabled,
7613
+ validateInput,
7614
+ onUpdateEditableCell
7615
+ }) => {
7616
+ const [value, setValue] = useState19(editInitialValue);
7617
+ const hasError = useMemo4(() => !validateInput?.(value), [value, validateInput]);
7618
+ return /* @__PURE__ */ jsx116(
7619
+ TextField8,
7620
+ {
7621
+ fullWidth: true,
7622
+ variant: "standard",
7623
+ defaultValue: value,
7624
+ label: inputLabel,
7625
+ error: hasError,
7626
+ disabled,
7627
+ onChange: ({ target: { value: value2 } }) => {
7628
+ setValue(value2);
7629
+ },
7630
+ onBlur: ({ target: { value: value2 } }) => {
7631
+ if (hasError) {
7632
+ return;
7633
+ }
7634
+ onUpdateEditableCell?.(rowId, value2);
7635
+ }
7636
+ }
7637
+ );
7638
+ };
7639
+
7640
+ // src/components/TableDesktopRowCell/TableDesktopRowCell.tsx
7641
+ import Close2 from "@mui/icons-material/Close";
7642
+ import Edit3 from "@mui/icons-material/Edit";
7643
+ import { jsx as jsx117, jsxs as jsxs79 } from "react/jsx-runtime";
7644
+ var TableDesktopRowCell = ({
7645
+ inputLabel,
7646
+ editInitialValue,
7647
+ rowId,
7648
+ fieldName,
7649
+ width,
7650
+ disabled,
7651
+ readOnlyValue,
7652
+ editableCellType,
7653
+ filterOptions,
7654
+ refetchFilterOptions,
7655
+ isFetchingFilterOptions,
7656
+ validateInput,
7657
+ onUpdateEditableCell,
7658
+ onCellClick
7659
+ }) => {
7660
+ const cellRef = useRef5(null);
7661
+ const [isOverflowed, setIsOverflowed] = useState20(false);
7662
+ const [isCellHovered, setIsCellHovered] = useState20(false);
7663
+ const [isEditMode, setIsEditMode] = useState20(false);
7664
+ useEffect13(() => {
7665
+ const ref = cellRef.current;
7666
+ if (ref) {
7667
+ setIsOverflowed(ref.scrollWidth > ref.clientWidth);
7668
+ }
7669
+ }, [readOnlyValue, width]);
7670
+ useEffect13(() => {
7671
+ const handleKeyDown = (e) => {
7672
+ if (e.key === "Escape") {
7673
+ setIsEditMode(false);
7674
+ }
7675
+ };
7676
+ if (isEditMode) {
7677
+ window.addEventListener("keydown", handleKeyDown);
7678
+ }
7679
+ return () => {
7680
+ window.removeEventListener("keydown", handleKeyDown);
7681
+ };
7682
+ }, [isEditMode]);
7683
+ const editableComponents = {
7684
+ "select": /* @__PURE__ */ jsx117(
7685
+ TableDesktopSmartSelect,
7686
+ {
7687
+ rowId,
7688
+ fieldName,
7689
+ disabled,
7690
+ initialValue: editInitialValue,
7691
+ inputLabel: inputLabel ?? "",
7692
+ filterOptions,
7693
+ refetchFilterOptions,
7694
+ isFetchingFilterOptions,
7695
+ onUpdateEditableCell
7696
+ }
7697
+ ),
7698
+ "checkbox": /* @__PURE__ */ jsx117(
7699
+ Checkbox6,
7700
+ {
7701
+ disableRipple: true,
7702
+ disabled,
7703
+ defaultChecked: editInitialValue,
7704
+ onChange: ({ target: { checked } }) => {
7705
+ onUpdateEditableCell?.(rowId, checked);
7706
+ }
7707
+ }
7708
+ ),
7709
+ "text": /* @__PURE__ */ jsx117(
7710
+ TableDesktopTextField,
7711
+ {
7712
+ rowId,
7713
+ disabled,
7714
+ editInitialValue,
7715
+ inputLabel: inputLabel ?? "",
7716
+ validateInput,
7717
+ onUpdateEditableCell
7718
+ }
7719
+ ),
7720
+ "numeric": /* @__PURE__ */ jsx117(
7721
+ TextField9,
7722
+ {
7723
+ fullWidth: true,
7724
+ variant: "standard",
7725
+ disabled,
7726
+ defaultValue: editInitialValue,
7727
+ label: inputLabel,
7728
+ onChange: (e) => {
7729
+ e.target.value = e.target.value.replace(/\D/g, "");
7730
+ },
7731
+ onBlur: ({ target: { value } }) => {
7732
+ onUpdateEditableCell?.(rowId, value);
7733
+ },
7734
+ slotProps: {
7735
+ input: {
7736
+ inputMode: "numeric"
7737
+ }
7738
+ }
7739
+ }
7740
+ )
7741
+ };
7742
+ const getReadOnlyBooleanIcon = (value) => {
7743
+ if (value) {
7744
+ return /* @__PURE__ */ jsx117(CheckIcon2, { sx: { fontSize: 16 } });
7745
+ }
7746
+ return "-";
7747
+ };
7748
+ const handleEditClick = (e) => {
7749
+ e.stopPropagation();
7750
+ setIsEditMode((prev) => !prev);
7751
+ };
7752
+ return /* @__PURE__ */ jsx117(Tooltip7, { title: isOverflowed ? String(readOnlyValue) : "", arrow: true, children: /* @__PURE__ */ jsx117(
7753
+ TableCell5,
7754
+ {
7755
+ align: "left",
7756
+ onMouseEnter: () => editableCellType && !disabled && setIsCellHovered(true),
7757
+ onMouseLeave: () => editableCellType && !disabled && setIsCellHovered(false),
7758
+ onClick: (event) => !disabled && onCellClick?.(event, isEditMode),
7759
+ sx: {
7760
+ padding: 1,
7761
+ width: width ?? "auto",
7762
+ position: "relative",
7763
+ cursor: disabled ? "default" : "pointer",
7764
+ opacity: disabled ? 0.2 : 1,
7765
+ ":hover": editableCellType && {
7766
+ background: isEditMode ? colors.lightBlueBackground : colors.neutral100
7767
+ },
7768
+ background: isEditMode ? colors.lightBlueBackground : (theme) => theme.palette.background.default
7769
+ },
7770
+ children: /* @__PURE__ */ jsxs79(
7771
+ Box33,
7772
+ {
7773
+ p: 1,
7774
+ ref: cellRef,
7775
+ overflow: "hidden",
7776
+ textOverflow: "ellipsis",
7777
+ whiteSpace: "nowrap",
7778
+ children: [
7779
+ isCellHovered ? /* @__PURE__ */ jsx117(Tooltip7, { title: isEditMode ? "" : "Toggle Edit Mode", children: /* @__PURE__ */ jsx117(
7780
+ IconButton4,
7781
+ {
7782
+ onClick: handleEditClick,
7783
+ sx: {
7784
+ top: 0,
7785
+ right: 0,
7786
+ zIndex: 1,
7787
+ borderRadius: 0,
7788
+ position: "absolute",
7789
+ background: isEditMode ? colors.lightBlueBackground : colors.neutral100,
7790
+ "&:hover": {
7791
+ backgroundColor: isEditMode ? colors.lightBlueBackground : colors.neutral150
7792
+ }
7793
+ },
7794
+ children: isEditMode ? /* @__PURE__ */ jsx117(Close2, { fontSize: "small", color: "error" }) : /* @__PURE__ */ jsx117(Edit3, { fontSize: "small" })
7795
+ }
7796
+ ) }) : null,
7797
+ isEditMode && editableCellType ? editableComponents[editableCellType] : typeof readOnlyValue === "boolean" ? getReadOnlyBooleanIcon(readOnlyValue) : readOnlyValue
7798
+ ]
7799
+ }
7800
+ )
7801
+ }
7802
+ ) });
7382
7803
  };
7383
- var TableDesktop_default = TableDesktop;
7384
7804
 
7385
7805
  // src/components/TableHeader/TableHeader.tsx
7386
- import { memo as memo22, useEffect as useEffect10, useState as useState17 } from "react";
7806
+ import { memo as memo23, useEffect as useEffect14, useState as useState21 } from "react";
7387
7807
  import { ImportExport as ImportExportIcon } from "@mui/icons-material";
7388
- import { TableCell as TableCell4, TableHead as TableHead3, TableRow as TableRow4, TableSortLabel as TableSortLabel3 } from "@mui/material";
7808
+ import { TableCell as TableCell6, TableHead as TableHead3, TableRow as TableRow5, TableSortLabel as TableSortLabel3 } from "@mui/material";
7389
7809
  import { makeStyles as makeStyles50 } from "tss-react/mui";
7390
- import { jsx as jsx113 } from "react/jsx-runtime";
7810
+ import { jsx as jsx118 } from "react/jsx-runtime";
7391
7811
  var useStyles50 = makeStyles50()(() => ({
7392
7812
  sortLabel: {
7393
7813
  "& .MuiTableSortLabel-icon": {
@@ -7396,9 +7816,9 @@ var useStyles50 = makeStyles50()(() => ({
7396
7816
  }
7397
7817
  }));
7398
7818
  var TableHeader = ({ cells, onSort = null }) => {
7399
- const [sortableCells, setSortableCells] = useState17([]);
7819
+ const [sortableCells, setSortableCells] = useState21([]);
7400
7820
  const { classes } = useStyles50();
7401
- useEffect10(() => {
7821
+ useEffect14(() => {
7402
7822
  setSortableCells(cells);
7403
7823
  }, []);
7404
7824
  const getNewSortDirection = (direction) => {
@@ -7432,7 +7852,7 @@ var TableHeader = ({ cells, onSort = null }) => {
7432
7852
  });
7433
7853
  setSortableCells(sortedCells);
7434
7854
  };
7435
- return /* @__PURE__ */ jsx113(TableHead3, { children: /* @__PURE__ */ jsx113(TableRow4, { children: sortableCells.map((cell, key) => /* @__PURE__ */ jsx113(TableCell4, { children: cell.isSortable ? /* @__PURE__ */ jsx113(
7855
+ return /* @__PURE__ */ jsx118(TableHead3, { children: /* @__PURE__ */ jsx118(TableRow5, { children: sortableCells.map((cell, key) => /* @__PURE__ */ jsx118(TableCell6, { children: cell.isSortable ? /* @__PURE__ */ jsx118(
7436
7856
  TableSortLabel3,
7437
7857
  {
7438
7858
  className: classes.sortLabel,
@@ -7443,12 +7863,12 @@ var TableHeader = ({ cells, onSort = null }) => {
7443
7863
  }
7444
7864
  ) : cell.label }, cell.label || key)) }) });
7445
7865
  };
7446
- var TableHeader_default = memo22(TableHeader);
7866
+ var TableHeader_default = memo23(TableHeader);
7447
7867
 
7448
7868
  // src/components/TextDivider/TextDivider.tsx
7449
- import { Box as Box31, Typography as Typography26, Divider as Divider10, Button as Button13 } from "@mui/material";
7869
+ import { Box as Box34, Typography as Typography28, Divider as Divider10, Button as Button14 } from "@mui/material";
7450
7870
  import { makeStyles as makeStyles51 } from "tss-react/mui";
7451
- import { jsx as jsx114, jsxs as jsxs78 } from "react/jsx-runtime";
7871
+ import { jsx as jsx119, jsxs as jsxs80 } from "react/jsx-runtime";
7452
7872
  var useStyles51 = makeStyles51()(() => ({
7453
7873
  icon: {
7454
7874
  fontSize: 20
@@ -7485,19 +7905,19 @@ var TextDivider = ({
7485
7905
  }) => {
7486
7906
  const { classes } = useStyles51();
7487
7907
  const iconColor = color ?? colors.neutral900;
7488
- return /* @__PURE__ */ jsxs78(
7489
- Box31,
7908
+ return /* @__PURE__ */ jsxs80(
7909
+ Box34,
7490
7910
  {
7491
7911
  display: "flex",
7492
7912
  alignItems: "center",
7493
7913
  justifyContent: "space-between",
7494
7914
  className: classes.container,
7495
7915
  children: [
7496
- /* @__PURE__ */ jsx114(Divider10, { className: classes.leftDivider }),
7497
- /* @__PURE__ */ jsx114(Button13, { onClick, disabled: !onClick, className: classes.button, children: /* @__PURE__ */ jsxs78(Box31, { className: classes.center, children: [
7498
- Icon2 && iconPosition === "left" && /* @__PURE__ */ jsx114(Icon2, { className: classes.icon, style: { color: iconColor } }),
7499
- /* @__PURE__ */ jsx114(
7500
- Typography26,
7916
+ /* @__PURE__ */ jsx119(Divider10, { className: classes.leftDivider }),
7917
+ /* @__PURE__ */ jsx119(Button14, { onClick, disabled: !onClick, className: classes.button, children: /* @__PURE__ */ jsxs80(Box34, { className: classes.center, children: [
7918
+ Icon2 && iconPosition === "left" && /* @__PURE__ */ jsx119(Icon2, { className: classes.icon, style: { color: iconColor } }),
7919
+ /* @__PURE__ */ jsx119(
7920
+ Typography28,
7501
7921
  {
7502
7922
  color: "textSecondary",
7503
7923
  className: classes.title,
@@ -7505,9 +7925,9 @@ var TextDivider = ({
7505
7925
  children: title
7506
7926
  }
7507
7927
  ),
7508
- Icon2 && iconPosition === "right" && /* @__PURE__ */ jsx114(Icon2, { className: classes.icon, style: { color: iconColor } })
7928
+ Icon2 && iconPosition === "right" && /* @__PURE__ */ jsx119(Icon2, { className: classes.icon, style: { color: iconColor } })
7509
7929
  ] }) }),
7510
- /* @__PURE__ */ jsx114(Divider10, { className: classes.rightDivider })
7930
+ /* @__PURE__ */ jsx119(Divider10, { className: classes.rightDivider })
7511
7931
  ]
7512
7932
  }
7513
7933
  );
@@ -7519,7 +7939,7 @@ import { DateRangePicker } from "react-dates";
7519
7939
  import { makeStyles as makeStyles52 } from "tss-react/mui";
7520
7940
  import "react-dates/initialize";
7521
7941
  import "react-dates/lib/css/_datepicker.css";
7522
- import { jsx as jsx115 } from "react/jsx-runtime";
7942
+ import { jsx as jsx120 } from "react/jsx-runtime";
7523
7943
  var useStyles52 = makeStyles52()((theme) => ({
7524
7944
  wrapper: {
7525
7945
  "& .DateRangePicker": {
@@ -7615,15 +8035,15 @@ var ThemedDateRangePicker = ({
7615
8035
  ...props
7616
8036
  }) => {
7617
8037
  const { classes, cx } = useStyles52();
7618
- return /* @__PURE__ */ jsx115("div", { className: cx(classes.wrapper, className), children: /* @__PURE__ */ jsx115(DateRangePicker, { ...props }) });
8038
+ return /* @__PURE__ */ jsx120("div", { className: cx(classes.wrapper, className), children: /* @__PURE__ */ jsx120(DateRangePicker, { ...props }) });
7619
8039
  };
7620
8040
  var ThemedDateRangePicker_default = ThemedDateRangePicker;
7621
8041
 
7622
8042
  // src/components/TheToolbar/TheToolbar.tsx
7623
- import { memo as memo23 } from "react";
7624
- import { AppBar, Box as Box32, Toolbar } from "@mui/material";
8043
+ import { memo as memo24 } from "react";
8044
+ import { AppBar, Box as Box35, Toolbar } from "@mui/material";
7625
8045
  import { makeStyles as makeStyles53 } from "tss-react/mui";
7626
- import { jsx as jsx116, jsxs as jsxs79 } from "react/jsx-runtime";
8046
+ import { jsx as jsx121, jsxs as jsxs81 } from "react/jsx-runtime";
7627
8047
  var useStyles53 = makeStyles53()((theme) => ({
7628
8048
  menuButton: {
7629
8049
  color: theme.palette.primary.contrastText
@@ -7643,9 +8063,9 @@ var TheToolbar = ({
7643
8063
  rightSection
7644
8064
  }) => {
7645
8065
  const { classes } = useStyles53();
7646
- return /* @__PURE__ */ jsxs79(Box32, { children: [
7647
- /* @__PURE__ */ jsx116(AppBar, { children: /* @__PURE__ */ jsxs79(Toolbar, { className: classes.topBar, children: [
7648
- /* @__PURE__ */ jsx116(
8066
+ return /* @__PURE__ */ jsxs81(Box35, { children: [
8067
+ /* @__PURE__ */ jsx121(AppBar, { children: /* @__PURE__ */ jsxs81(Toolbar, { className: classes.topBar, children: [
8068
+ /* @__PURE__ */ jsx121(
7649
8069
  RoundButton_default,
7650
8070
  {
7651
8071
  className: classes.menuButton,
@@ -7654,7 +8074,7 @@ var TheToolbar = ({
7654
8074
  onClick: handleOpen
7655
8075
  }
7656
8076
  ),
7657
- /* @__PURE__ */ jsx116(
8077
+ /* @__PURE__ */ jsx121(
7658
8078
  CompanyLogo_default,
7659
8079
  {
7660
8080
  size: "small",
@@ -7663,30 +8083,30 @@ var TheToolbar = ({
7663
8083
  imageLogoLightSmall
7664
8084
  }
7665
8085
  ),
7666
- /* @__PURE__ */ jsx116(Box32, { ml: 2, children: leftSection }),
7667
- /* @__PURE__ */ jsx116(Box32, { ml: "auto", children: rightSection })
8086
+ /* @__PURE__ */ jsx121(Box35, { ml: 2, children: leftSection }),
8087
+ /* @__PURE__ */ jsx121(Box35, { ml: "auto", children: rightSection })
7668
8088
  ] }) }),
7669
8089
  LeftDrawer
7670
8090
  ] });
7671
8091
  };
7672
- var TheToolbar_default = memo23(TheToolbar);
8092
+ var TheToolbar_default = memo24(TheToolbar);
7673
8093
 
7674
8094
  // src/components/ToastMessage/ToastMessage.tsx
7675
8095
  import { Alert as MuiAlert, Snackbar } from "@mui/material";
7676
- import { jsx as jsx117 } from "react/jsx-runtime";
8096
+ import { jsx as jsx122 } from "react/jsx-runtime";
7677
8097
  var ToastMessage = ({
7678
8098
  toastType,
7679
8099
  toastMessage,
7680
8100
  open,
7681
8101
  onClose
7682
- }) => /* @__PURE__ */ jsx117(
8102
+ }) => /* @__PURE__ */ jsx122(
7683
8103
  Snackbar,
7684
8104
  {
7685
8105
  open,
7686
8106
  autoHideDuration: 1500,
7687
8107
  onClose,
7688
8108
  anchorOrigin: { vertical: "top", horizontal: "right" },
7689
- children: /* @__PURE__ */ jsx117(
8109
+ children: /* @__PURE__ */ jsx122(
7690
8110
  MuiAlert,
7691
8111
  {
7692
8112
  elevation: 6,
@@ -7714,16 +8134,16 @@ var ToastMessage_default = ToastMessage;
7714
8134
 
7715
8135
  // src/components/TwoButtonDialog/TwoButtonDialog.tsx
7716
8136
  import {
7717
- Typography as Typography27,
8137
+ Typography as Typography29,
7718
8138
  Dialog as Dialog5,
7719
8139
  Backdrop,
7720
- Box as Box33,
8140
+ Box as Box36,
7721
8141
  Divider as Divider11,
7722
8142
  Paper as Paper12,
7723
8143
  Fade as Fade2
7724
8144
  } from "@mui/material";
7725
8145
  import { makeStyles as makeStyles54 } from "tss-react/mui";
7726
- import { jsx as jsx118, jsxs as jsxs80 } from "react/jsx-runtime";
8146
+ import { jsx as jsx123, jsxs as jsxs82 } from "react/jsx-runtime";
7727
8147
  var useStyles54 = makeStyles54()((theme) => ({
7728
8148
  paper: {
7729
8149
  padding: theme.spacing(2)
@@ -7753,7 +8173,7 @@ var TwoButtonDialog = ({
7753
8173
  cancelButton
7754
8174
  }) => {
7755
8175
  const { classes } = useStyles54();
7756
- return /* @__PURE__ */ jsx118(
8176
+ return /* @__PURE__ */ jsx123(
7757
8177
  Dialog5,
7758
8178
  {
7759
8179
  open,
@@ -7763,10 +8183,10 @@ var TwoButtonDialog = ({
7763
8183
  closeAfterTransition: true,
7764
8184
  BackdropComponent: Backdrop,
7765
8185
  BackdropProps: { timeout: 500 },
7766
- children: /* @__PURE__ */ jsx118(Fade2, { in: open, children: /* @__PURE__ */ jsxs80(Paper12, { className: classes.paper, children: [
7767
- /* @__PURE__ */ jsxs80(Box33, { className: classes.mb, children: [
7768
- /* @__PURE__ */ jsx118(Typography27, { variant: "h5", component: "div", children: /* @__PURE__ */ jsx118(
7769
- Box33,
8186
+ children: /* @__PURE__ */ jsx123(Fade2, { in: open, children: /* @__PURE__ */ jsxs82(Paper12, { className: classes.paper, children: [
8187
+ /* @__PURE__ */ jsxs82(Box36, { className: classes.mb, children: [
8188
+ /* @__PURE__ */ jsx123(Typography29, { variant: "h5", component: "div", children: /* @__PURE__ */ jsx123(
8189
+ Box36,
7770
8190
  {
7771
8191
  sx: {
7772
8192
  fontWeight: 600
@@ -7774,23 +8194,23 @@ var TwoButtonDialog = ({
7774
8194
  children: title
7775
8195
  }
7776
8196
  ) }),
7777
- /* @__PURE__ */ jsxs80(
7778
- Box33,
8197
+ /* @__PURE__ */ jsxs82(
8198
+ Box36,
7779
8199
  {
7780
8200
  className: classes.mt,
7781
8201
  sx: {
7782
8202
  fontWeight: 600
7783
8203
  },
7784
8204
  children: [
7785
- subtitle1 && /* @__PURE__ */ jsx118(Typography27, { variant: "subtitle1", children: subtitle1 }),
7786
- subtitle2 && /* @__PURE__ */ jsx118(Typography27, { variant: "subtitle1", children: subtitle2 })
8205
+ subtitle1 && /* @__PURE__ */ jsx123(Typography29, { variant: "subtitle1", children: subtitle1 }),
8206
+ subtitle2 && /* @__PURE__ */ jsx123(Typography29, { variant: "subtitle1", children: subtitle2 })
7787
8207
  ]
7788
8208
  }
7789
8209
  )
7790
8210
  ] }),
7791
- /* @__PURE__ */ jsx118(Divider11, {}),
7792
- /* @__PURE__ */ jsxs80(Box33, { className: classes.buttonContainer, children: [
7793
- /* @__PURE__ */ jsx118(
8211
+ /* @__PURE__ */ jsx123(Divider11, {}),
8212
+ /* @__PURE__ */ jsxs82(Box36, { className: classes.buttonContainer, children: [
8213
+ /* @__PURE__ */ jsx123(
7794
8214
  FilledButton_default,
7795
8215
  {
7796
8216
  copy: cancelLabel,
@@ -7803,7 +8223,7 @@ var TwoButtonDialog = ({
7803
8223
  }
7804
8224
  }
7805
8225
  ),
7806
- /* @__PURE__ */ jsx118(
8226
+ /* @__PURE__ */ jsx123(
7807
8227
  FilledButton_default,
7808
8228
  {
7809
8229
  color: "primary",
@@ -7812,7 +8232,7 @@ var TwoButtonDialog = ({
7812
8232
  }
7813
8233
  )
7814
8234
  ] }),
7815
- /* @__PURE__ */ jsx118(Loading_default, { isLoading: dialogLoading })
8235
+ /* @__PURE__ */ jsx123(Loading_default, { isLoading: dialogLoading })
7816
8236
  ] }) })
7817
8237
  }
7818
8238
  );
@@ -7820,11 +8240,11 @@ var TwoButtonDialog = ({
7820
8240
  var TwoButtonDialog_default = TwoButtonDialog;
7821
8241
 
7822
8242
  // src/components/UserBust/UserBust.tsx
7823
- import { memo as memo24 } from "react";
7824
- import { Avatar as Avatar2, Typography as Typography28 } from "@mui/material";
7825
- import { jsx as jsx119, jsxs as jsxs81 } from "react/jsx-runtime";
7826
- var UserBust = ({ user, avatarProps, typographyProps }) => /* @__PURE__ */ jsxs81("div", { children: [
7827
- /* @__PURE__ */ jsx119(
8243
+ import { memo as memo25 } from "react";
8244
+ import { Avatar as Avatar2, Typography as Typography30 } from "@mui/material";
8245
+ import { jsx as jsx124, jsxs as jsxs83 } from "react/jsx-runtime";
8246
+ var UserBust = ({ user, avatarProps, typographyProps }) => /* @__PURE__ */ jsxs83("div", { children: [
8247
+ /* @__PURE__ */ jsx124(
7828
8248
  Avatar2,
7829
8249
  {
7830
8250
  src: user.profile_picture,
@@ -7832,18 +8252,18 @@ var UserBust = ({ user, avatarProps, typographyProps }) => /* @__PURE__ */ jsxs8
7832
8252
  style: { width: avatarProps.width, height: avatarProps.height }
7833
8253
  }
7834
8254
  ),
7835
- /* @__PURE__ */ jsxs81("div", { style: { paddingTop: 16 }, children: [
7836
- /* @__PURE__ */ jsx119(Typography28, { ...typographyProps.name, children: `${user.first_name} ${user.last_name}` }),
7837
- /* @__PURE__ */ jsx119(Typography28, { ...typographyProps.username, children: user.username })
8255
+ /* @__PURE__ */ jsxs83("div", { style: { paddingTop: 16 }, children: [
8256
+ /* @__PURE__ */ jsx124(Typography30, { ...typographyProps.name, children: `${user.first_name} ${user.last_name}` }),
8257
+ /* @__PURE__ */ jsx124(Typography30, { ...typographyProps.username, children: user.username })
7838
8258
  ] })
7839
8259
  ] });
7840
- var UserBust_default = memo24(UserBust);
8260
+ var UserBust_default = memo25(UserBust);
7841
8261
 
7842
8262
  // src/components/icons/IconChart.tsx
7843
- import { jsx as jsx120 } from "react/jsx-runtime";
8263
+ import { jsx as jsx125 } from "react/jsx-runtime";
7844
8264
  var SvgIconChart = (props) => {
7845
8265
  const { fill } = props;
7846
- return /* @__PURE__ */ jsx120(
8266
+ return /* @__PURE__ */ jsx125(
7847
8267
  "svg",
7848
8268
  {
7849
8269
  width: "20",
@@ -7852,7 +8272,7 @@ var SvgIconChart = (props) => {
7852
8272
  fill: "none",
7853
8273
  xmlns: "http://www.w3.org/2000/svg",
7854
8274
  ...props,
7855
- children: /* @__PURE__ */ jsx120(
8275
+ children: /* @__PURE__ */ jsx125(
7856
8276
  "path",
7857
8277
  {
7858
8278
  d: "M2.49967 11.6667L2.91634 11.725L6.72467 7.91667C6.57467 7.375 6.71634 6.75833 7.15801 6.325C7.80801 5.66667 8.85801 5.66667 9.50801 6.325C9.94967 6.75833 10.0913 7.375 9.94134 7.91667L12.083 10.0583L12.4997 10C12.6497 10 12.7913 10 12.9163 10.0583L15.8913 7.08333C15.833 6.95833 15.833 6.81667 15.833 6.66667C15.833 6.22464 16.0086 5.80072 16.3212 5.48816C16.6337 5.17559 17.0576 5 17.4997 5C17.9417 5 18.3656 5.17559 18.6782 5.48816C18.9907 5.80072 19.1663 6.22464 19.1663 6.66667C19.1663 7.10869 18.9907 7.53262 18.6782 7.84518C18.3656 8.15774 17.9417 8.33333 17.4997 8.33333C17.3497 8.33333 17.208 8.33333 17.083 8.275L14.108 11.25C14.1663 11.375 14.1663 11.5167 14.1663 11.6667C14.1663 12.1087 13.9907 12.5326 13.6782 12.8452C13.3656 13.1577 12.9417 13.3333 12.4997 13.3333C12.0576 13.3333 11.6337 13.1577 11.3212 12.8452C11.0086 12.5326 10.833 12.1087 10.833 11.6667L10.8913 11.25L8.74967 9.10833C8.48301 9.16667 8.18301 9.16667 7.91634 9.10833L4.10801 12.9167L4.16634 13.3333C4.16634 13.7754 3.99075 14.1993 3.67819 14.5118C3.36563 14.8244 2.9417 15 2.49967 15C2.05765 15 1.63372 14.8244 1.32116 14.5118C1.0086 14.1993 0.833008 13.7754 0.833008 13.3333C0.833008 12.8913 1.0086 12.4674 1.32116 12.1548C1.63372 11.8423 2.05765 11.6667 2.49967 11.6667Z",
@@ -7918,6 +8338,7 @@ export {
7918
8338
  ScrollableDialog_default as ScrollableDialog,
7919
8339
  SearchAndFilterHeader_default as SearchAndFilterHeader,
7920
8340
  SearchAndFilterHeaderForTable_default as SearchAndFilterHeaderForTable,
8341
+ SearchFieldDebounced,
7921
8342
  SearchWithFilters_default as SearchWithFilters,
7922
8343
  SearchWithFiltersForTable_default as SearchWithFiltersForTable,
7923
8344
  SectionName_default as SectionName,
@@ -7929,6 +8350,9 @@ export {
7929
8350
  Switch_default as Switch,
7930
8351
  Table_default as Table,
7931
8352
  TableDesktop_default as TableDesktop,
8353
+ TableDesktopFooter,
8354
+ TableDesktopRowCell,
8355
+ TableDesktopSmartSelect,
7932
8356
  TableEmptyResult_default as TableEmptyResult,
7933
8357
  TableHeader_default as TableHeader,
7934
8358
  TableLoading_default as TableLoading,