@natoora-libs/core 0.1.6 → 0.1.8

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.
@@ -4339,7 +4339,7 @@ var drawerAppList = [
4339
4339
  featureNames: [featureName_default.CUSTOMERS],
4340
4340
  pinned: "customers",
4341
4341
  icon: /* @__PURE__ */ jsx84(icons_default.SvgIconAccount, {}),
4342
- url: `/customer-list`,
4342
+ url: `/react/customers`,
4343
4343
  children: [
4344
4344
  {
4345
4345
  name: "Sites",
@@ -6114,10 +6114,11 @@ var RenderContentList = ({
6114
6114
  const sections = items.map((item) => ({
6115
6115
  id: transformNameToID(item),
6116
6116
  element: document.getElementById(transformNameToID(item))
6117
- }));
6117
+ })).filter(({ element }) => element !== null);
6118
6118
  if (observer.current) {
6119
6119
  observer.current.disconnect();
6120
6120
  }
6121
+ if (sections.length === 0) return;
6121
6122
  observer.current = new IntersectionObserver(
6122
6123
  (entries) => {
6123
6124
  const visibleSection = entries.find((entry) => entry.isIntersecting);
@@ -6149,11 +6150,18 @@ var RenderContentList = ({
6149
6150
  return /* @__PURE__ */ jsxs64(
6150
6151
  ListItemButton2,
6151
6152
  {
6152
- component: "a",
6153
- href: `#${id}`,
6154
- onClick: () => setActive(id),
6155
6153
  selected: active === id,
6156
6154
  classes: { root: classes.root, selected: classes.selected },
6155
+ onClick: () => {
6156
+ setActive(id);
6157
+ const element = document.getElementById(id);
6158
+ if (element) {
6159
+ element.scrollIntoView({
6160
+ behavior: "smooth",
6161
+ block: "start"
6162
+ });
6163
+ }
6164
+ },
6157
6165
  children: [
6158
6166
  /* @__PURE__ */ jsx98(ListItemText5, { primary: item }),
6159
6167
  warningItems?.includes(item) && /* @__PURE__ */ jsx98(Tooltip4, { title: warningMessage, children: /* @__PURE__ */ jsx98(WarningAmber, { color: "warning" }) })
@@ -7072,14 +7080,240 @@ var LabelledSwitch = withStyles6(LSwitch, (theme) => ({
7072
7080
  }));
7073
7081
  var Switch_default = memo20(LabelledSwitch);
7074
7082
 
7075
- // src/components/Table/SmartTableHeader.tsx
7076
- import { memo as memo21 } from "react";
7077
- import { TableCell, TableHead, TableRow, TableSortLabel } from "@mui/material";
7083
+ // src/components/SmartTableHeaderFilterMenu/SmartTableHeaderFilterMenu.tsx
7084
+ import React5, { useMemo as useMemo2, useState as useState15, useEffect as useEffect9 } from "react";
7085
+ import { FilterList } from "@mui/icons-material";
7086
+ import CheckIcon from "@mui/icons-material/Check";
7087
+ import {
7088
+ Box as Box28,
7089
+ Checkbox as Checkbox4,
7090
+ Chip as Chip2,
7091
+ Divider as Divider9,
7092
+ FormControlLabel as FormControlLabel3,
7093
+ IconButton as IconButton3,
7094
+ Menu as Menu4
7095
+ } from "@mui/material";
7096
+ import classNames3 from "classnames";
7078
7097
  import { makeStyles as makeStyles44 } from "tss-react/mui";
7079
- import { jsx as jsx109, jsxs as jsxs74 } from "react/jsx-runtime";
7080
- var useStyles44 = makeStyles44()(() => ({
7098
+ import { Fragment as Fragment12, jsx as jsx109, jsxs as jsxs74 } from "react/jsx-runtime";
7099
+ var useStyles44 = makeStyles44()((theme) => ({
7100
+ filterMenu: {
7101
+ display: "flex",
7102
+ flexDirection: "column",
7103
+ gap: theme.spacing(0.5)
7104
+ },
7105
+ filter: {
7106
+ display: "flex",
7107
+ alignItems: "center",
7108
+ justifyContent: "space-between",
7109
+ padding: theme.spacing(0, 3)
7110
+ },
7111
+ applyFilterButtonsContainer: {
7112
+ display: "flex",
7113
+ padding: theme.spacing(0, 1)
7114
+ },
7115
+ saveAsDefaultButton: {
7116
+ color: theme.palette.primary.main
7117
+ }
7118
+ }));
7119
+ var resolveFilterOption = (filterOption) => {
7120
+ if (typeof filterOption === "object") {
7121
+ return filterOption?.label || filterOption?.name || "";
7122
+ }
7123
+ return filterOption;
7124
+ };
7125
+ var findFilterIndex = (filters, filterOption) => filters.findIndex((item) => {
7126
+ if (typeof item === "string" && typeof filterOption === "string") {
7127
+ return item === filterOption;
7128
+ }
7129
+ if (typeof item === "object" && typeof filterOption === "object") {
7130
+ return item.id === filterOption.id;
7131
+ }
7132
+ return false;
7133
+ });
7134
+ var SmartTableHeaderFilterMenu = ({
7135
+ headCell,
7136
+ numActiveFilters,
7137
+ headerFilters,
7138
+ shouldShowCheckOnFilter,
7139
+ onApplyFilters
7140
+ }) => {
7141
+ const { classes } = useStyles44();
7142
+ const [anchorEl, setAnchorEl] = useState15(null);
7143
+ const [selectedFilters, setSelectedFilters] = useState15(
7144
+ headerFilters[headCell.id] ?? []
7145
+ );
7146
+ const filterOptions = headCell.filterOptionsQuery?.data ?? [];
7147
+ const numFilterOptions = filterOptions.length ?? 0;
7148
+ const numCurrentSelectedFilters = selectedFilters.length;
7149
+ const handleFilterMenuOpen = (event) => {
7150
+ if (!numFilterOptions) {
7151
+ headCell.filterOptionsQuery?.refetch();
7152
+ }
7153
+ setAnchorEl(event.currentTarget);
7154
+ };
7155
+ const handleFilterMenuClose = () => {
7156
+ setSelectedFilters(headerFilters[headCell.id]);
7157
+ setAnchorEl(null);
7158
+ };
7159
+ const handleFilterOptionClick = (option) => {
7160
+ const selectedIndex = findFilterIndex(selectedFilters, option);
7161
+ let newSelected;
7162
+ if (selectedIndex === -1) {
7163
+ if (typeof option === "string") {
7164
+ newSelected = [...selectedFilters, option];
7165
+ } else {
7166
+ newSelected = [...selectedFilters, option];
7167
+ }
7168
+ } else {
7169
+ newSelected = selectedFilters.filter(
7170
+ (_, index) => index !== selectedIndex
7171
+ );
7172
+ }
7173
+ setSelectedFilters(newSelected);
7174
+ };
7175
+ const handleApplyFilters = (shouldSave) => {
7176
+ const updatedFilters = {
7177
+ ...headerFilters,
7178
+ [headCell.id]: [...selectedFilters]
7179
+ };
7180
+ onApplyFilters?.(updatedFilters, shouldSave);
7181
+ setAnchorEl(null);
7182
+ };
7183
+ useEffect9(() => {
7184
+ setSelectedFilters(headerFilters[headCell.id] ?? []);
7185
+ }, [headerFilters, headCell.id]);
7186
+ const isOptionChecked = useMemo2(() => (resolvedOption) => !!selectedFilters?.some(
7187
+ (value) => resolveFilterOption(value) === resolvedOption
7188
+ ), [selectedFilters]);
7189
+ return /* @__PURE__ */ jsxs74(Fragment12, { children: [
7190
+ /* @__PURE__ */ jsx109(
7191
+ IconButton3,
7192
+ {
7193
+ disableRipple: true,
7194
+ onClick: handleFilterMenuOpen,
7195
+ "data-testid": "filter-menu-button",
7196
+ style: { padding: 0 },
7197
+ className: classNames3("filter-menu-trigger", {
7198
+ "has-active-filters": !!numActiveFilters
7199
+ }),
7200
+ children: numActiveFilters ? /* @__PURE__ */ jsx109(
7201
+ Chip2,
7202
+ {
7203
+ sx: { height: 24 },
7204
+ label: numActiveFilters,
7205
+ icon: /* @__PURE__ */ jsx109(FilterList, { style: { fontSize: 18 }, color: "primary" })
7206
+ }
7207
+ ) : /* @__PURE__ */ jsx109(FilterList, { style: { fontSize: 18 } })
7208
+ }
7209
+ ),
7210
+ /* @__PURE__ */ jsx109(
7211
+ Menu4,
7212
+ {
7213
+ open: !!anchorEl,
7214
+ onClose: handleFilterMenuClose,
7215
+ anchorEl,
7216
+ "data-testid": "filter-menu",
7217
+ anchorOrigin: { vertical: "bottom", horizontal: "right" },
7218
+ transformOrigin: { vertical: "top", horizontal: "right" },
7219
+ children: /* @__PURE__ */ jsxs74(Box28, { className: classes.filterMenu, children: [
7220
+ /* @__PURE__ */ jsx109(Box28, { px: 3, children: /* @__PURE__ */ jsx109(
7221
+ FormControlLabel3,
7222
+ {
7223
+ label: "Select All",
7224
+ control: /* @__PURE__ */ jsx109(
7225
+ Checkbox4,
7226
+ {
7227
+ disableRipple: true,
7228
+ checked: numCurrentSelectedFilters === numFilterOptions,
7229
+ indeterminate: numCurrentSelectedFilters > 0 && numCurrentSelectedFilters < numFilterOptions,
7230
+ onChange: ({ target: { checked } }) => {
7231
+ if (checked) {
7232
+ setSelectedFilters([...filterOptions]);
7233
+ } else {
7234
+ setSelectedFilters([]);
7235
+ }
7236
+ }
7237
+ }
7238
+ )
7239
+ }
7240
+ ) }),
7241
+ /* @__PURE__ */ jsx109(Divider9, {}),
7242
+ filterOptions.map(
7243
+ (option) => {
7244
+ const resolvedOption = resolveFilterOption(option);
7245
+ return /* @__PURE__ */ jsxs74(
7246
+ Box28,
7247
+ {
7248
+ className: classes.filter,
7249
+ children: [
7250
+ /* @__PURE__ */ jsx109(
7251
+ FormControlLabel3,
7252
+ {
7253
+ label: resolvedOption,
7254
+ control: /* @__PURE__ */ jsx109(
7255
+ Checkbox4,
7256
+ {
7257
+ disableRipple: true,
7258
+ onChange: () => handleFilterOptionClick(option),
7259
+ checked: isOptionChecked(resolvedOption)
7260
+ }
7261
+ )
7262
+ },
7263
+ resolvedOption
7264
+ ),
7265
+ shouldShowCheckOnFilter?.(headCell.id, option) ? /* @__PURE__ */ jsx109(CheckIcon, { fontSize: "small", color: "action" }) : null
7266
+ ]
7267
+ },
7268
+ resolvedOption
7269
+ );
7270
+ }
7271
+ ),
7272
+ /* @__PURE__ */ jsx109(Divider9, {}),
7273
+ /* @__PURE__ */ jsxs74(Box28, { className: classes.applyFilterButtonsContainer, children: [
7274
+ /* @__PURE__ */ jsx109(
7275
+ ExtendedButton_default,
7276
+ {
7277
+ copy: "Save as Default",
7278
+ buttonType: "button",
7279
+ variant: "text",
7280
+ tooltip: "Persists those filters for future visits",
7281
+ className: classes.saveAsDefaultButton,
7282
+ onClick: () => handleApplyFilters(true)
7283
+ }
7284
+ ),
7285
+ /* @__PURE__ */ jsx109(
7286
+ ExtendedButton_default,
7287
+ {
7288
+ copy: "Apply",
7289
+ color: "primary",
7290
+ buttonType: "submit",
7291
+ onClick: () => handleApplyFilters(false)
7292
+ }
7293
+ )
7294
+ ] })
7295
+ ] })
7296
+ }
7297
+ )
7298
+ ] });
7299
+ };
7300
+ var SmartTableHeaderFilterMenu_default = React5.memo(SmartTableHeaderFilterMenu);
7301
+
7302
+ // src/components/SmartTableHeader/SmartTableHeader.tsx
7303
+ import { memo as memo21 } from "react";
7304
+ import {
7305
+ Checkbox as Checkbox5,
7306
+ TableCell,
7307
+ TableHead,
7308
+ TableRow,
7309
+ TableSortLabel
7310
+ } from "@mui/material";
7311
+ import { makeStyles as makeStyles45 } from "tss-react/mui";
7312
+ import { jsx as jsx110, jsxs as jsxs75 } from "react/jsx-runtime";
7313
+ var useStyles45 = makeStyles45()((theme) => ({
7081
7314
  root: {
7082
7315
  backgroundColor: colors.neutral100,
7316
+ height: theme.spacing(6),
7083
7317
  "& .MuiTableSortLabel-root": {
7084
7318
  fontWeight: 600,
7085
7319
  fontSize: ".875rem"
@@ -7096,49 +7330,112 @@ var useStyles44 = makeStyles44()(() => ({
7096
7330
  top: 20,
7097
7331
  width: 1
7098
7332
  },
7099
- containerTh: {
7333
+ tableHeaderContent: {
7100
7334
  borderBottom: "1px solid",
7101
7335
  borderBottomColor: colors.neutral250,
7102
- backgroundColor: colors.neutral100,
7103
- outline: "1px solid",
7104
- outlineColor: colors.neutral100
7336
+ whiteSpace: "nowrap",
7337
+ "& .filter-menu-trigger": {
7338
+ visibility: "hidden",
7339
+ opacity: 0,
7340
+ transition: "visibility 0.1s, opacity 0.1s ease-in"
7341
+ },
7342
+ "&:hover .filter-menu-trigger, & .filter-menu-trigger.has-active-filters": {
7343
+ visibility: "visible",
7344
+ opacity: 1
7345
+ },
7346
+ "&:hover .MuiTableSortLabel-root": {
7347
+ "& .MuiTableSortLabel-icon": {
7348
+ opacity: 1
7349
+ }
7350
+ }
7351
+ },
7352
+ filterMenu: {
7353
+ display: "flex",
7354
+ flexDirection: "column",
7355
+ gap: theme.spacing(0.5)
7356
+ },
7357
+ filterCheckboxDropdown: {
7358
+ display: "flex",
7359
+ flexDirection: "column",
7360
+ padding: theme.spacing(0, 3)
7361
+ },
7362
+ applyFilterButtonsContainer: {
7363
+ display: "flex",
7364
+ padding: theme.spacing(0, 1)
7105
7365
  }
7106
7366
  }));
7107
- var SmartTableHeader = (props) => {
7108
- const { classes } = useStyles44();
7109
- const { order, orderBy, onRequestSort } = props;
7367
+ var SmartTableHeader = ({
7368
+ order,
7369
+ orderBy,
7370
+ headCells,
7371
+ numSelected,
7372
+ numRows,
7373
+ enableCheckboxSelection = false,
7374
+ headerFilters,
7375
+ onRequestSort,
7376
+ onSelectAllClick,
7377
+ onApplyFilters,
7378
+ shouldShowCheckOnFilter
7379
+ }) => {
7380
+ const { classes } = useStyles45();
7110
7381
  const createSortHandler = (property) => (event) => {
7111
- onRequestSort?.(event, property);
7382
+ onRequestSort(event, property);
7112
7383
  };
7113
- return /* @__PURE__ */ jsx109(TableHead, { className: classes.root, children: /* @__PURE__ */ jsx109(TableRow, { children: props.headCells.map((headCell) => /* @__PURE__ */ jsx109(
7114
- TableCell,
7115
- {
7116
- className: classes.containerTh,
7117
- align: "left",
7118
- sortDirection: orderBy === headCell.id ? order : false,
7119
- children: /* @__PURE__ */ jsxs74(
7120
- TableSortLabel,
7121
- {
7122
- active: orderBy === headCell.id,
7123
- direction: orderBy === headCell.id ? order : "asc",
7124
- onClick: createSortHandler(headCell.id),
7125
- children: [
7126
- headCell.label,
7127
- orderBy === headCell.id ? /* @__PURE__ */ jsx109("span", { className: classes.visuallyHidden, children: order === "desc" ? "sorted descending" : "sorted ascending" }) : null
7128
- ]
7129
- }
7130
- )
7131
- },
7132
- headCell.id
7133
- )) }) });
7384
+ const isSortActive = (headCellId) => orderBy === headCellId;
7385
+ return /* @__PURE__ */ jsx110(TableHead, { className: classes.root, children: /* @__PURE__ */ jsxs75(TableRow, { children: [
7386
+ enableCheckboxSelection ? /* @__PURE__ */ jsx110(TableCell, { padding: "checkbox", children: /* @__PURE__ */ jsx110(
7387
+ Checkbox5,
7388
+ {
7389
+ color: "primary",
7390
+ indeterminate: numSelected > 0 && numSelected < numRows,
7391
+ checked: numRows > 0 && numSelected === numRows,
7392
+ onChange: onSelectAllClick
7393
+ }
7394
+ ) }) : null,
7395
+ headCells.map((headCell) => /* @__PURE__ */ jsxs75(
7396
+ TableCell,
7397
+ {
7398
+ className: classes.tableHeaderContent,
7399
+ align: "left",
7400
+ sx: { width: headCell.width ?? "auto" },
7401
+ sortDirection: orderBy === headCell.id ? order : false,
7402
+ children: [
7403
+ /* @__PURE__ */ jsxs75(
7404
+ TableSortLabel,
7405
+ {
7406
+ "data-testid": "table-sort-label",
7407
+ active: isSortActive(headCell.id),
7408
+ direction: orderBy === headCell.id ? order : "asc",
7409
+ onClick: createSortHandler(headCell.id),
7410
+ children: [
7411
+ headCell.renderHeader ?? headCell.label,
7412
+ orderBy === headCell.id ? /* @__PURE__ */ jsx110("span", { className: classes.visuallyHidden, children: order === "desc" ? "sorted descending" : "sorted ascending" }) : null
7413
+ ]
7414
+ }
7415
+ ),
7416
+ headCell.filterOptionsQuery ? /* @__PURE__ */ jsx110(
7417
+ SmartTableHeaderFilterMenu_default,
7418
+ {
7419
+ headCell,
7420
+ headerFilters,
7421
+ numActiveFilters: headerFilters[headCell.id]?.length ?? 0,
7422
+ onApplyFilters,
7423
+ shouldShowCheckOnFilter
7424
+ }
7425
+ ) : null
7426
+ ]
7427
+ },
7428
+ headCell.id
7429
+ ))
7430
+ ] }) });
7134
7431
  };
7135
7432
  var SmartTableHeader_default = memo21(SmartTableHeader);
7136
7433
 
7137
7434
  // src/components/Table/Table.tsx
7138
7435
  var import_debounce = __toESM(require_debounce(), 1);
7139
- import { useLayoutEffect, useState as useState15 } from "react";
7436
+ import { useLayoutEffect, useState as useState16 } from "react";
7140
7437
  import {
7141
- Box as Box29,
7438
+ Box as Box30,
7142
7439
  Paper as Paper10,
7143
7440
  Table as MUITable,
7144
7441
  TableBody,
@@ -7148,9 +7445,28 @@ import {
7148
7445
  TableRow as TableRow2,
7149
7446
  TableSortLabel as TableSortLabel2
7150
7447
  } from "@mui/material";
7151
- import { makeStyles as makeStyles45 } from "tss-react/mui";
7448
+ import { makeStyles as makeStyles46 } from "tss-react/mui";
7152
7449
  import { v4 as uuidv4 } from "uuid";
7153
7450
 
7451
+ // src/components/TableLoading/TableLoading.tsx
7452
+ import { Box as Box29, Skeleton as Skeleton2 } from "@mui/material";
7453
+ import { jsx as jsx111 } from "react/jsx-runtime";
7454
+ var TableLoading = ({
7455
+ rowsPerPage,
7456
+ rowHeight
7457
+ }) => /* @__PURE__ */ jsx111(Box29, { children: Array.from({ length: rowsPerPage ?? 0 }).map((_, index) => /* @__PURE__ */ jsx111(
7458
+ Skeleton2,
7459
+ {
7460
+ animation: "pulse",
7461
+ "data-testid": "table-loading-skeleton",
7462
+ style: { margin: "8px", opacity: 0.4 },
7463
+ variant: "rectangular",
7464
+ height: rowHeight
7465
+ },
7466
+ index
7467
+ )) });
7468
+ var TableLoading_default = TableLoading;
7469
+
7154
7470
  // src/components/Table/helpers.tsx
7155
7471
  function stableSort(array, cmp) {
7156
7472
  const stabilizedThis = array.map((el, index) => [el, index]);
@@ -7186,24 +7502,9 @@ function calculateRowsPerPage(rowHeight) {
7186
7502
  return 1;
7187
7503
  }
7188
7504
 
7189
- // src/components/Table/TableLoading.tsx
7190
- import { Box as Box28, Skeleton as Skeleton2 } from "@mui/material";
7191
- import { jsx as jsx110 } from "react/jsx-runtime";
7192
- var TableLoading = ({ rowsPerPage = 0, rowHeight }) => /* @__PURE__ */ jsx110(Box28, { children: Array.from({ length: rowsPerPage }).map((x, i) => /* @__PURE__ */ jsx110(
7193
- Skeleton2,
7194
- {
7195
- animation: "pulse",
7196
- style: { margin: "8px", opacity: 0.4 },
7197
- variant: "rectangular",
7198
- height: rowHeight
7199
- },
7200
- i
7201
- )) });
7202
- var TableLoading_default = TableLoading;
7203
-
7204
7505
  // src/components/Table/Table.tsx
7205
- import { jsx as jsx111, jsxs as jsxs75 } from "react/jsx-runtime";
7206
- var useStyles45 = makeStyles45()(() => ({
7506
+ import { jsx as jsx112, jsxs as jsxs76 } from "react/jsx-runtime";
7507
+ var useStyles46 = makeStyles46()(() => ({
7207
7508
  root: {
7208
7509
  height: "calc(100vh - 262px)",
7209
7510
  overflow: "scroll"
@@ -7237,12 +7538,12 @@ var Table = ({
7237
7538
  serverRendered,
7238
7539
  updateSort
7239
7540
  }) => {
7240
- const [order, setOrder] = useState15(appliedFilters?.sortDir || "desc");
7241
- const [orderBy, setOrderBy] = useState15(
7541
+ const [order, setOrder] = useState16(appliedFilters?.sortDir || "desc");
7542
+ const [orderBy, setOrderBy] = useState16(
7242
7543
  appliedFilters?.sortField || "delivery_date"
7243
7544
  );
7244
- const [rowsPerPage, setRowsPerPage] = useState15(defaultRowsPerPage);
7245
- const { classes } = useStyles45();
7545
+ const [rowsPerPage, setRowsPerPage] = useState16(defaultRowsPerPage);
7546
+ const { classes } = useStyles46();
7246
7547
  const rowHeight = 56;
7247
7548
  const emptyRows = rowsPerPage - Math.min(rowsPerPage, data.length - page * rowsPerPage);
7248
7549
  const handleRequestSort = (event, property) => {
@@ -7280,24 +7581,24 @@ var Table = ({
7280
7581
  );
7281
7582
  const rowsComponents = rows.map((row) => {
7282
7583
  if (RenderItem) {
7283
- return /* @__PURE__ */ jsx111(RenderItem, { ...row }, row.id);
7584
+ return /* @__PURE__ */ jsx112(RenderItem, { ...row }, row.id);
7284
7585
  }
7285
- return /* @__PURE__ */ jsx111(TableRow2, { hover: true, onClick: () => onRowClick?.(row), children: headCells?.map((column) => /* @__PURE__ */ jsx111(TableCell2, { children: row[column.id] }, column.id)) }, row.id);
7586
+ return /* @__PURE__ */ jsx112(TableRow2, { hover: true, onClick: () => onRowClick?.(row), children: headCells?.map((column) => /* @__PURE__ */ jsx112(TableCell2, { children: row[column.id] }, column.id)) }, row.id);
7286
7587
  });
7287
7588
  if (emptyRows > 0 && rowsPerPage > emptyRows) {
7288
7589
  rowsComponents.push(
7289
- /* @__PURE__ */ jsx111(TableRow2, { style: { height: rowHeight * emptyRows }, children: /* @__PURE__ */ jsx111(TableCell2, { colSpan: 8 }) }, uuidv4())
7590
+ /* @__PURE__ */ jsx112(TableRow2, { style: { height: rowHeight * emptyRows }, children: /* @__PURE__ */ jsx112(TableCell2, { colSpan: 8 }) }, uuidv4())
7290
7591
  );
7291
7592
  }
7292
7593
  return rowsComponents;
7293
7594
  };
7294
- return /* @__PURE__ */ jsx111(Paper10, { className: classes.root, children: /* @__PURE__ */ jsx111(Box29, { className: classes.paper, children: isLoading ? /* @__PURE__ */ jsx111(TableLoading_default, { rowHeight, rowsPerPage }) : /* @__PURE__ */ jsx111(TableContainer, { className: classes.container, children: /* @__PURE__ */ jsxs75(MUITable, { size: "medium", stickyHeader: true, children: [
7295
- /* @__PURE__ */ jsx111(TableHead2, { className: classes.header, children: /* @__PURE__ */ jsx111(TableRow2, { children: headCells?.map((headCell) => /* @__PURE__ */ jsx111(
7595
+ return /* @__PURE__ */ jsx112(Paper10, { className: classes.root, children: /* @__PURE__ */ jsx112(Box30, { className: classes.paper, children: isLoading ? /* @__PURE__ */ jsx112(TableLoading_default, { rowHeight, rowsPerPage }) : /* @__PURE__ */ jsx112(TableContainer, { className: classes.container, children: /* @__PURE__ */ jsxs76(MUITable, { size: "medium", stickyHeader: true, children: [
7596
+ /* @__PURE__ */ jsx112(TableHead2, { className: classes.header, children: /* @__PURE__ */ jsx112(TableRow2, { children: headCells?.map((headCell) => /* @__PURE__ */ jsx112(
7296
7597
  TableCell2,
7297
7598
  {
7298
7599
  align: "left",
7299
7600
  sortDirection: orderBy === headCell.id ? order : void 0,
7300
- children: /* @__PURE__ */ jsx111(
7601
+ children: /* @__PURE__ */ jsx112(
7301
7602
  TableSortLabel2,
7302
7603
  {
7303
7604
  active: orderBy === headCell.id,
@@ -7309,16 +7610,20 @@ var Table = ({
7309
7610
  },
7310
7611
  headCell.id
7311
7612
  )) }) }),
7312
- /* @__PURE__ */ jsxs75(TableBody, { children: [
7613
+ /* @__PURE__ */ jsxs76(TableBody, { children: [
7313
7614
  getTableRows(),
7314
- rowsPerPage === emptyRows && /* @__PURE__ */ jsx111(TableRow2, { style: { height: rowHeight * emptyRows }, children: /* @__PURE__ */ jsx111(TableCell2, { colSpan: 8, align: "center", children: "Nothing to display" }) })
7615
+ rowsPerPage === emptyRows && /* @__PURE__ */ jsx112(TableRow2, { style: { height: rowHeight * emptyRows }, children: /* @__PURE__ */ jsx112(TableCell2, { colSpan: 8, align: "center", children: "Nothing to display" }) })
7315
7616
  ] })
7316
7617
  ] }) }) }) });
7317
7618
  };
7318
7619
  var Table_default = Table;
7319
7620
 
7320
- // src/components/Table/TableDesktop.tsx
7321
- import { useState as useState16 } from "react";
7621
+ // src/components/TableDesktop/TableDesktop.tsx
7622
+ import {
7623
+ useCallback as useCallback2,
7624
+ useMemo as useMemo3,
7625
+ useState as useState17
7626
+ } from "react";
7322
7627
  import {
7323
7628
  Paper as Paper11,
7324
7629
  Table as Table2,
@@ -7326,41 +7631,50 @@ import {
7326
7631
  TableContainer as TableContainer2,
7327
7632
  Skeleton as Skeleton3
7328
7633
  } from "@mui/material";
7329
- import { makeStyles as makeStyles47 } from "tss-react/mui";
7634
+ import { makeStyles as makeStyles48 } from "tss-react/mui";
7330
7635
  import { v4 as uuidv42 } from "uuid";
7331
7636
 
7332
- // src/components/Table/TableEmptyResult.tsx
7637
+ // src/components/TableEmptyResult/TableEmptyResult.tsx
7333
7638
  import { TableCell as TableCell3, TableRow as TableRow3, Typography as Typography25 } from "@mui/material";
7334
- import { makeStyles as makeStyles46 } from "tss-react/mui";
7335
- import { jsx as jsx112, jsxs as jsxs76 } from "react/jsx-runtime";
7336
- var useStyles46 = makeStyles46()(() => ({
7639
+ import { makeStyles as makeStyles47 } from "tss-react/mui";
7640
+ import { jsx as jsx113, jsxs as jsxs77 } from "react/jsx-runtime";
7641
+ var useStyles47 = makeStyles47()(() => ({
7337
7642
  tableCellIcon: { padding: 24, height: "calc(100vh - 320px)" },
7338
7643
  tableCellDefault: { padding: 24 }
7339
7644
  }));
7340
7645
  var TableEmptyResult = ({
7646
+ colSpan,
7341
7647
  showClearFilterButton = false,
7342
7648
  handleClickOnClearFiltersButton = () => {
7343
7649
  }
7344
7650
  }) => {
7345
- const { classes } = useStyles46();
7346
- return showClearFilterButton ? /* @__PURE__ */ jsx112(TableRow3, { children: /* @__PURE__ */ jsxs76(TableCell3, { className: classes.tableCellIcon, colSpan: 8, align: "center", children: [
7347
- /* @__PURE__ */ jsx112(EmptyGlassIcon_default, {}),
7348
- /* @__PURE__ */ jsx112(Typography25, { variant: "h6", children: "No results found." }),
7349
- /* @__PURE__ */ jsx112(Typography25, { variant: "subtitle1", children: "Search without applied filters?" }),
7350
- /* @__PURE__ */ jsx112(
7351
- FilledButton_default,
7352
- {
7353
- copy: "Search",
7354
- variant: "contained",
7355
- color: "primary",
7356
- onClick: handleClickOnClearFiltersButton
7357
- }
7358
- )
7359
- ] }) }) : /* @__PURE__ */ jsx112(TableRow3, { children: /* @__PURE__ */ jsx112(
7651
+ const { classes } = useStyles47();
7652
+ return showClearFilterButton ? /* @__PURE__ */ jsx113(TableRow3, { children: /* @__PURE__ */ jsxs77(
7653
+ TableCell3,
7654
+ {
7655
+ className: classes.tableCellIcon,
7656
+ colSpan,
7657
+ align: "center",
7658
+ children: [
7659
+ /* @__PURE__ */ jsx113(EmptyGlassIcon_default, {}),
7660
+ /* @__PURE__ */ jsx113(Typography25, { variant: "h6", children: "No results found." }),
7661
+ /* @__PURE__ */ jsx113(Typography25, { variant: "subtitle1", children: "Search without applied filters?" }),
7662
+ /* @__PURE__ */ jsx113(
7663
+ FilledButton_default,
7664
+ {
7665
+ copy: "Search",
7666
+ variant: "contained",
7667
+ color: "primary",
7668
+ onClick: handleClickOnClearFiltersButton
7669
+ }
7670
+ )
7671
+ ]
7672
+ }
7673
+ ) }) : /* @__PURE__ */ jsx113(TableRow3, { children: /* @__PURE__ */ jsx113(
7360
7674
  TableCell3,
7361
7675
  {
7362
7676
  className: classes.tableCellDefault,
7363
- colSpan: 8,
7677
+ colSpan,
7364
7678
  align: "center",
7365
7679
  children: "Nothing to display"
7366
7680
  }
@@ -7368,9 +7682,9 @@ var TableEmptyResult = ({
7368
7682
  };
7369
7683
  var TableEmptyResult_default = TableEmptyResult;
7370
7684
 
7371
- // src/components/Table/TableDesktop.tsx
7372
- import { Fragment as Fragment12, jsx as jsx113, jsxs as jsxs77 } from "react/jsx-runtime";
7373
- var useStyles47 = makeStyles47()(() => ({
7685
+ // src/components/TableDesktop/TableDesktop.tsx
7686
+ import { Fragment as Fragment13, jsx as jsx114, jsxs as jsxs78 } from "react/jsx-runtime";
7687
+ var useStyles48 = makeStyles48()((theme) => ({
7374
7688
  root: {
7375
7689
  justifyContent: "space-between",
7376
7690
  display: "flex",
@@ -7383,97 +7697,206 @@ var useStyles47 = makeStyles47()(() => ({
7383
7697
  justifyContent: "space-between"
7384
7698
  },
7385
7699
  container: {
7386
- maxHeight: "100%"
7700
+ maxHeight: "100%",
7701
+ "&::-webkit-scrollbar": {
7702
+ width: "8px",
7703
+ height: "8px"
7704
+ },
7705
+ "&::-webkit-scrollbar-track": {
7706
+ backgroundColor: theme.palette.mode === "dark" ? theme.palette.grey[800] : theme.palette.grey[100]
7707
+ },
7708
+ "&::-webkit-scrollbar-thumb": {
7709
+ backgroundColor: theme.palette.mode === "dark" ? theme.palette.grey[900] : theme.palette.grey[400],
7710
+ borderRadius: "10px"
7711
+ },
7712
+ "&::-webkit-scrollbar-thumb:hover": {
7713
+ backgroundColor: theme.palette.mode === "dark" ? theme.palette.common.black : theme.palette.grey[500]
7714
+ }
7387
7715
  }
7388
7716
  }));
7389
- var desc = (a, b, orderBy) => {
7390
- if (b[orderBy] < a[orderBy]) {
7717
+ var descendingComparator2 = (a, b, orderBy) => {
7718
+ const objA = a[orderBy];
7719
+ const objB = b[orderBy];
7720
+ const valA = typeof objA === "object" ? objA?.name : objA;
7721
+ const valB = typeof objB === "object" ? objB?.name : objB;
7722
+ if (!valA && !valB) {
7723
+ return 0;
7724
+ }
7725
+ if (valA && !valB) {
7391
7726
  return -1;
7392
7727
  }
7393
- if (b[orderBy] > a[orderBy]) {
7728
+ if (!valA && valB) {
7729
+ return 1;
7730
+ }
7731
+ if (valA > valB) {
7732
+ return -1;
7733
+ }
7734
+ if (valA < valB) {
7394
7735
  return 1;
7395
7736
  }
7396
7737
  return 0;
7397
7738
  };
7398
- var stableSort2 = (array, cmp) => array.map((el, index) => [el, index]).sort((a, b) => {
7399
- const order = cmp(a[0], b[0]);
7400
- return order !== 0 ? order : a[1] - b[1];
7401
- }).map((el) => el[0]);
7402
- var getSorting2 = (order, orderBy) => order === "desc" ? (a, b) => desc(a, b, orderBy) : (a, b) => -desc(a, b, orderBy);
7739
+ var stableSort2 = (array, cmp) => array.map((el, index) => ({ el, index })).sort((a, b) => {
7740
+ const order = cmp(a.el, b.el);
7741
+ return order !== 0 ? order : a.index - b.index;
7742
+ }).map((el) => el.el);
7743
+ var getComparator = (order, orderBy) => order === "desc" ? (a, b) => descendingComparator2(a, b, orderBy) : (a, b) => -descendingComparator2(a, b, orderBy);
7403
7744
  var TableDesktop = ({
7404
- appliedFilters,
7405
- children,
7406
7745
  data,
7407
7746
  headCells,
7747
+ RenderItem,
7748
+ appliedFilters,
7749
+ headerFilters,
7750
+ children,
7408
7751
  height,
7409
7752
  isLoading,
7410
- RenderItem,
7411
- rowsPerPage,
7753
+ rowsPerPage = 50,
7754
+ enableCheckboxSelection = false,
7755
+ disableInternalSort = false,
7412
7756
  updateSort,
7413
7757
  showClearFilterButton,
7414
7758
  handleClickOnClearFiltersButton,
7415
7759
  deleteItem,
7416
- keyField
7760
+ keyField = "id",
7761
+ tableLayout = "auto",
7762
+ onApplyFilters,
7763
+ shouldShowCheckOnFilter
7417
7764
  }) => {
7418
- const [order, setOrder] = useState16(
7419
- appliedFilters?.sortDir || "desc"
7420
- );
7421
- const [orderBy, setOrderBy] = useState16(
7765
+ const [order, setOrder] = useState17(appliedFilters?.sortDir || "desc");
7766
+ const [orderBy, setOrderBy] = useState17(
7422
7767
  appliedFilters?.sortField || "delivery_date"
7423
7768
  );
7424
- const [page] = useState16(0);
7425
- const { classes } = useStyles47();
7769
+ const [selected, setSelected] = useState17([]);
7770
+ const [page] = useState17(0);
7771
+ const { classes } = useStyles48();
7426
7772
  const rowHeight = 56;
7773
+ const emptyRows = useMemo3(
7774
+ () => rowsPerPage - data.length,
7775
+ [rowsPerPage, data]
7776
+ );
7777
+ const visibleHeadCells = useMemo3(
7778
+ () => headCells.filter((headCell) => headCell?.enabled ?? true),
7779
+ [headCells]
7780
+ );
7781
+ const handleSelectAllClick = useCallback2(
7782
+ (event) => {
7783
+ if (event.target.checked) {
7784
+ const newSelected = data.map((n) => n[keyField]);
7785
+ setSelected(newSelected);
7786
+ return;
7787
+ }
7788
+ setSelected([]);
7789
+ },
7790
+ [data, keyField]
7791
+ );
7427
7792
  const handleRequestSort = (event, property) => {
7428
7793
  const isAsc = orderBy === property && order === "asc";
7429
7794
  const orderDir = isAsc ? "desc" : "asc";
7430
7795
  setOrder(orderDir);
7431
7796
  setOrderBy(property);
7432
- updateSort(property, orderDir);
7797
+ if (updateSort) {
7798
+ updateSort(property, orderDir);
7799
+ }
7433
7800
  };
7434
- const emptyRows = rowsPerPage - data.length;
7435
- return /* @__PURE__ */ jsx113("div", { className: classes.root, style: { height }, children: /* @__PURE__ */ jsx113(Paper11, { className: classes.paper, children: isLoading ? /* @__PURE__ */ jsx113("div", { children: [...Array(Math.floor(rowsPerPage))].map(() => /* @__PURE__ */ jsx113(
7801
+ const handleRowCheckboxClick = useCallback2(
7802
+ (event, keyFieldValue) => {
7803
+ const selectedIndex = selected.indexOf(keyFieldValue);
7804
+ let newSelected = [];
7805
+ if (selectedIndex === -1) {
7806
+ newSelected = newSelected.concat(selected, keyFieldValue);
7807
+ } else if (selectedIndex === 0) {
7808
+ newSelected = newSelected.concat(selected.slice(1));
7809
+ } else if (selectedIndex === selected.length - 1) {
7810
+ newSelected = newSelected.concat(selected.slice(0, -1));
7811
+ } else if (selectedIndex > 0) {
7812
+ newSelected = newSelected.concat(
7813
+ selected.slice(0, selectedIndex),
7814
+ selected.slice(selectedIndex + 1)
7815
+ );
7816
+ }
7817
+ setSelected(newSelected);
7818
+ },
7819
+ [selected]
7820
+ );
7821
+ const renderTableRows = useMemo3(() => {
7822
+ const sortedData = disableInternalSort ? data : stableSort2(data, getComparator(order, orderBy));
7823
+ return sortedData.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage).map((row, index) => {
7824
+ const isItemSelected = selected.includes(row[keyField]);
7825
+ return /* @__PURE__ */ jsx114(
7826
+ RenderItem,
7827
+ {
7828
+ ...{
7829
+ ...row,
7830
+ index,
7831
+ deleteItem,
7832
+ isItemSelected,
7833
+ enableCheckboxSelection,
7834
+ keyFieldValue: row[keyField],
7835
+ handleRowCheckboxClick,
7836
+ visibleHeadCells
7837
+ }
7838
+ },
7839
+ row[keyField] ?? index
7840
+ );
7841
+ });
7842
+ }, [
7843
+ data,
7844
+ order,
7845
+ orderBy,
7846
+ page,
7847
+ rowsPerPage,
7848
+ selected,
7849
+ enableCheckboxSelection,
7850
+ disableInternalSort,
7851
+ deleteItem,
7852
+ keyField,
7853
+ handleRowCheckboxClick,
7854
+ visibleHeadCells,
7855
+ RenderItem
7856
+ ]);
7857
+ return /* @__PURE__ */ jsx114("div", { className: classes.root, style: { height }, children: /* @__PURE__ */ jsx114(Paper11, { className: classes.paper, children: isLoading ? /* @__PURE__ */ jsx114(Fragment13, { children: [...Array(Math.floor(rowsPerPage ?? 50))].map(() => /* @__PURE__ */ jsx114(
7436
7858
  Skeleton3,
7437
7859
  {
7438
7860
  animation: "pulse",
7439
7861
  style: { margin: "8px", opacity: 0.4 },
7440
7862
  variant: "rectangular",
7441
- height: rowHeight
7863
+ height: rowHeight,
7864
+ "data-testid": "loading-skeleton"
7442
7865
  },
7443
- Math.random()
7444
- )) }) : /* @__PURE__ */ jsxs77(Fragment12, { children: [
7445
- /* @__PURE__ */ jsx113(TableContainer2, { className: classes.container, children: /* @__PURE__ */ jsxs77(
7866
+ uuidv42()
7867
+ )) }) : /* @__PURE__ */ jsxs78(Fragment13, { children: [
7868
+ /* @__PURE__ */ jsx114(TableContainer2, { className: classes.container, children: /* @__PURE__ */ jsxs78(
7446
7869
  Table2,
7447
7870
  {
7448
7871
  "aria-labelledby": "tableTitle",
7449
7872
  "aria-label": "sticky table",
7450
7873
  stickyHeader: true,
7874
+ style: { tableLayout },
7451
7875
  children: [
7452
- /* @__PURE__ */ jsx113(
7876
+ /* @__PURE__ */ jsx114(
7453
7877
  SmartTableHeader_default,
7454
7878
  {
7455
- headCells,
7879
+ headCells: visibleHeadCells,
7456
7880
  order,
7457
7881
  orderBy,
7458
- onRequestSort: handleRequestSort
7882
+ numSelected: selected.length,
7883
+ numRows: data.length,
7884
+ enableCheckboxSelection,
7885
+ headerFilters: headerFilters ?? {},
7886
+ onRequestSort: handleRequestSort,
7887
+ onSelectAllClick: handleSelectAllClick,
7888
+ onApplyFilters,
7889
+ shouldShowCheckOnFilter
7459
7890
  }
7460
7891
  ),
7461
- /* @__PURE__ */ jsxs77(TableBody2, { children: [
7462
- stableSort2(data, getSorting2(order, orderBy)).slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage).map((item, index) => /* @__PURE__ */ jsx113(
7463
- RenderItem,
7464
- {
7465
- ...{ ...item, index, deleteItem }
7466
- },
7467
- item[keyField] || uuidv42()
7468
- )),
7469
- rowsPerPage === emptyRows && /* @__PURE__ */ jsx113(
7470
- TableEmptyResult_default,
7471
- {
7472
- showClearFilterButton,
7473
- handleClickOnClearFiltersButton
7474
- }
7475
- )
7476
- ] })
7892
+ /* @__PURE__ */ jsx114(TableBody2, { children: rowsPerPage !== emptyRows ? renderTableRows : /* @__PURE__ */ jsx114(
7893
+ TableEmptyResult_default,
7894
+ {
7895
+ colSpan: enableCheckboxSelection ? visibleHeadCells.length + 1 : visibleHeadCells.length,
7896
+ showClearFilterButton,
7897
+ handleClickOnClearFiltersButton
7898
+ }
7899
+ ) })
7477
7900
  ]
7478
7901
  }
7479
7902
  ) }),
@@ -7483,12 +7906,12 @@ var TableDesktop = ({
7483
7906
  var TableDesktop_default = TableDesktop;
7484
7907
 
7485
7908
  // src/components/TableHeader/TableHeader.tsx
7486
- import { memo as memo22, useEffect as useEffect9, useState as useState17 } from "react";
7909
+ import { memo as memo22, useEffect as useEffect10, useState as useState18 } from "react";
7487
7910
  import { ImportExport as ImportExportIcon } from "@mui/icons-material";
7488
7911
  import { TableCell as TableCell4, TableHead as TableHead3, TableRow as TableRow4, TableSortLabel as TableSortLabel3 } from "@mui/material";
7489
- import { makeStyles as makeStyles48 } from "tss-react/mui";
7490
- import { jsx as jsx114 } from "react/jsx-runtime";
7491
- var useStyles48 = makeStyles48()(() => ({
7912
+ import { makeStyles as makeStyles49 } from "tss-react/mui";
7913
+ import { jsx as jsx115 } from "react/jsx-runtime";
7914
+ var useStyles49 = makeStyles49()(() => ({
7492
7915
  sortLabel: {
7493
7916
  "& .MuiTableSortLabel-icon": {
7494
7917
  opacity: 1
@@ -7496,9 +7919,9 @@ var useStyles48 = makeStyles48()(() => ({
7496
7919
  }
7497
7920
  }));
7498
7921
  var TableHeader = ({ cells, onSort = null }) => {
7499
- const [sortableCells, setSortableCells] = useState17([]);
7500
- const { classes } = useStyles48();
7501
- useEffect9(() => {
7922
+ const [sortableCells, setSortableCells] = useState18([]);
7923
+ const { classes } = useStyles49();
7924
+ useEffect10(() => {
7502
7925
  setSortableCells(cells);
7503
7926
  }, []);
7504
7927
  const getNewSortDirection = (direction) => {
@@ -7532,7 +7955,7 @@ var TableHeader = ({ cells, onSort = null }) => {
7532
7955
  });
7533
7956
  setSortableCells(sortedCells);
7534
7957
  };
7535
- return /* @__PURE__ */ jsx114(TableHead3, { children: /* @__PURE__ */ jsx114(TableRow4, { children: sortableCells.map((cell, key) => /* @__PURE__ */ jsx114(TableCell4, { children: cell.isSortable ? /* @__PURE__ */ jsx114(
7958
+ return /* @__PURE__ */ jsx115(TableHead3, { children: /* @__PURE__ */ jsx115(TableRow4, { children: sortableCells.map((cell, key) => /* @__PURE__ */ jsx115(TableCell4, { children: cell.isSortable ? /* @__PURE__ */ jsx115(
7536
7959
  TableSortLabel3,
7537
7960
  {
7538
7961
  className: classes.sortLabel,
@@ -7546,10 +7969,10 @@ var TableHeader = ({ cells, onSort = null }) => {
7546
7969
  var TableHeader_default = memo22(TableHeader);
7547
7970
 
7548
7971
  // src/components/TextDivider/TextDivider.tsx
7549
- import { Box as Box30, Typography as Typography26, Divider as Divider9, Button as Button13 } from "@mui/material";
7550
- import { makeStyles as makeStyles49 } from "tss-react/mui";
7551
- import { jsx as jsx115, jsxs as jsxs78 } from "react/jsx-runtime";
7552
- var useStyles49 = makeStyles49()(() => ({
7972
+ import { Box as Box31, Typography as Typography26, Divider as Divider10, Button as Button13 } from "@mui/material";
7973
+ import { makeStyles as makeStyles50 } from "tss-react/mui";
7974
+ import { jsx as jsx116, jsxs as jsxs79 } from "react/jsx-runtime";
7975
+ var useStyles50 = makeStyles50()(() => ({
7553
7976
  icon: {
7554
7977
  fontSize: 20
7555
7978
  },
@@ -7583,20 +8006,20 @@ var TextDivider = ({
7583
8006
  iconPosition = "left",
7584
8007
  titleWeight = "400"
7585
8008
  }) => {
7586
- const { classes } = useStyles49();
8009
+ const { classes } = useStyles50();
7587
8010
  const iconColor = color ?? colors.neutral900;
7588
- return /* @__PURE__ */ jsxs78(
7589
- Box30,
8011
+ return /* @__PURE__ */ jsxs79(
8012
+ Box31,
7590
8013
  {
7591
8014
  display: "flex",
7592
8015
  alignItems: "center",
7593
8016
  justifyContent: "space-between",
7594
8017
  className: classes.container,
7595
8018
  children: [
7596
- /* @__PURE__ */ jsx115(Divider9, { className: classes.leftDivider }),
7597
- /* @__PURE__ */ jsx115(Button13, { onClick, disabled: !onClick, className: classes.button, children: /* @__PURE__ */ jsxs78(Box30, { className: classes.center, children: [
7598
- Icon3 && iconPosition === "left" && /* @__PURE__ */ jsx115(Icon3, { className: classes.icon, style: { color: iconColor } }),
7599
- /* @__PURE__ */ jsx115(
8019
+ /* @__PURE__ */ jsx116(Divider10, { className: classes.leftDivider }),
8020
+ /* @__PURE__ */ jsx116(Button13, { onClick, disabled: !onClick, className: classes.button, children: /* @__PURE__ */ jsxs79(Box31, { className: classes.center, children: [
8021
+ Icon3 && iconPosition === "left" && /* @__PURE__ */ jsx116(Icon3, { className: classes.icon, style: { color: iconColor } }),
8022
+ /* @__PURE__ */ jsx116(
7600
8023
  Typography26,
7601
8024
  {
7602
8025
  color: "textSecondary",
@@ -7605,9 +8028,9 @@ var TextDivider = ({
7605
8028
  children: title
7606
8029
  }
7607
8030
  ),
7608
- Icon3 && iconPosition === "right" && /* @__PURE__ */ jsx115(Icon3, { className: classes.icon, style: { color: iconColor } })
8031
+ Icon3 && iconPosition === "right" && /* @__PURE__ */ jsx116(Icon3, { className: classes.icon, style: { color: iconColor } })
7609
8032
  ] }) }),
7610
- /* @__PURE__ */ jsx115(Divider9, { className: classes.rightDivider })
8033
+ /* @__PURE__ */ jsx116(Divider10, { className: classes.rightDivider })
7611
8034
  ]
7612
8035
  }
7613
8036
  );
@@ -7616,11 +8039,11 @@ var TextDivider_default = TextDivider;
7616
8039
 
7617
8040
  // src/components/ThemedDateRangePicker/ThemedDateRangePicker.tsx
7618
8041
  import { DateRangePicker } from "react-dates";
7619
- import { makeStyles as makeStyles50 } from "tss-react/mui";
8042
+ import { makeStyles as makeStyles51 } from "tss-react/mui";
7620
8043
  import "react-dates/initialize";
7621
8044
  import "react-dates/lib/css/_datepicker.css";
7622
- import { jsx as jsx116 } from "react/jsx-runtime";
7623
- var useStyles50 = makeStyles50()((theme) => ({
8045
+ import { jsx as jsx117 } from "react/jsx-runtime";
8046
+ var useStyles51 = makeStyles51()((theme) => ({
7624
8047
  wrapper: {
7625
8048
  "& .DateRangePicker": {
7626
8049
  backgroundColor: theme.palette.mode === "dark" ? theme.palette.grey[900] : colors.neutral100,
@@ -7714,57 +8137,38 @@ var ThemedDateRangePicker = ({
7714
8137
  className,
7715
8138
  ...props
7716
8139
  }) => {
7717
- const { classes, cx } = useStyles50();
7718
- return /* @__PURE__ */ jsx116("div", { className: cx(classes.wrapper, className), children: /* @__PURE__ */ jsx116(DateRangePicker, { ...props }) });
8140
+ const { classes, cx } = useStyles51();
8141
+ return /* @__PURE__ */ jsx117("div", { className: cx(classes.wrapper, className), children: /* @__PURE__ */ jsx117(DateRangePicker, { ...props }) });
7719
8142
  };
7720
8143
  var ThemedDateRangePicker_default = ThemedDateRangePicker;
7721
8144
 
7722
8145
  // src/components/TheToolbar/TheToolbar.tsx
7723
8146
  import { memo as memo23 } from "react";
7724
- import { AppBar as AppBar2, Box as Box31, Toolbar as Toolbar2 } from "@mui/material";
7725
- import { makeStyles as makeStyles51 } from "tss-react/mui";
7726
- import { jsx as jsx117, jsxs as jsxs79 } from "react/jsx-runtime";
7727
- var useStyles51 = makeStyles51()((theme) => ({
8147
+ import { AppBar as AppBar2, Box as Box32, Toolbar as Toolbar2 } from "@mui/material";
8148
+ import { makeStyles as makeStyles52 } from "tss-react/mui";
8149
+ import { jsx as jsx118, jsxs as jsxs80 } from "react/jsx-runtime";
8150
+ var useStyles52 = makeStyles52()((theme) => ({
7728
8151
  menuButton: {
7729
8152
  color: theme.palette.primary.contrastText
7730
8153
  },
7731
- searchNatoora: {
7732
- width: "100%"
7733
- },
7734
- searchIcon: {
7735
- opacity: ".5"
7736
- },
7737
- inputRoot: {
7738
- color: "inherit"
7739
- },
7740
- inputInput: {
7741
- transition: theme.transitions.create("width"),
7742
- width: "100%"
7743
- },
7744
8154
  topBar: {
7745
8155
  display: "flex",
7746
8156
  gap: theme.spacing(1),
7747
8157
  backgroundColor: colors.topBar
7748
- },
7749
- drawer: {
7750
- backgroundColor: "black"
7751
- },
7752
- drawerItem: {
7753
- maxWidth: "300px",
7754
- width: "80vw"
7755
- },
7756
- offset: theme.mixins.toolbar
8158
+ }
7757
8159
  }));
7758
8160
  var TheToolbar = ({
7759
8161
  imageLogoDarkSmall,
7760
8162
  imageLogoLightSmall,
7761
8163
  handleOpen,
7762
- LeftDrawer: LeftDrawer2
8164
+ LeftDrawer: LeftDrawer2,
8165
+ leftSection,
8166
+ rightSection
7763
8167
  }) => {
7764
- const { classes } = useStyles51();
7765
- return /* @__PURE__ */ jsxs79(Box31, { children: [
7766
- /* @__PURE__ */ jsx117(AppBar2, { children: /* @__PURE__ */ jsxs79(Toolbar2, { className: classes.topBar, children: [
7767
- /* @__PURE__ */ jsx117(
8168
+ const { classes } = useStyles52();
8169
+ return /* @__PURE__ */ jsxs80(Box32, { children: [
8170
+ /* @__PURE__ */ jsx118(AppBar2, { children: /* @__PURE__ */ jsxs80(Toolbar2, { className: classes.topBar, children: [
8171
+ /* @__PURE__ */ jsx118(
7768
8172
  RoundButton_default,
7769
8173
  {
7770
8174
  className: classes.menuButton,
@@ -7773,7 +8177,7 @@ var TheToolbar = ({
7773
8177
  onClick: handleOpen
7774
8178
  }
7775
8179
  ),
7776
- /* @__PURE__ */ jsx117(
8180
+ /* @__PURE__ */ jsx118(
7777
8181
  CompanyLogo_default,
7778
8182
  {
7779
8183
  size: "small",
@@ -7781,9 +8185,10 @@ var TheToolbar = ({
7781
8185
  imageLogoDarkSmall,
7782
8186
  imageLogoLightSmall
7783
8187
  }
7784
- )
8188
+ ),
8189
+ /* @__PURE__ */ jsx118(Box32, { ml: 2, children: leftSection }),
8190
+ /* @__PURE__ */ jsx118(Box32, { ml: "auto", children: rightSection })
7785
8191
  ] }) }),
7786
- /* @__PURE__ */ jsx117(Box31, { className: classes.offset }),
7787
8192
  LeftDrawer2
7788
8193
  ] });
7789
8194
  };
@@ -7791,20 +8196,20 @@ var TheToolbar_default = memo23(TheToolbar);
7791
8196
 
7792
8197
  // src/components/ToastMessage/ToastMessage.tsx
7793
8198
  import { Alert as MuiAlert, Snackbar } from "@mui/material";
7794
- import { jsx as jsx118 } from "react/jsx-runtime";
8199
+ import { jsx as jsx119 } from "react/jsx-runtime";
7795
8200
  var ToastMessage = ({
7796
8201
  toastType,
7797
8202
  toastMessage,
7798
8203
  open,
7799
8204
  onClose
7800
- }) => /* @__PURE__ */ jsx118(
8205
+ }) => /* @__PURE__ */ jsx119(
7801
8206
  Snackbar,
7802
8207
  {
7803
8208
  open,
7804
8209
  autoHideDuration: 1500,
7805
8210
  onClose,
7806
8211
  anchorOrigin: { vertical: "top", horizontal: "right" },
7807
- children: /* @__PURE__ */ jsx118(
8212
+ children: /* @__PURE__ */ jsx119(
7808
8213
  MuiAlert,
7809
8214
  {
7810
8215
  elevation: 6,
@@ -7835,14 +8240,14 @@ import {
7835
8240
  Typography as Typography27,
7836
8241
  Dialog as Dialog5,
7837
8242
  Backdrop,
7838
- Box as Box32,
7839
- Divider as Divider10,
8243
+ Box as Box33,
8244
+ Divider as Divider11,
7840
8245
  Paper as Paper12,
7841
8246
  Fade as Fade2
7842
8247
  } from "@mui/material";
7843
- import { makeStyles as makeStyles52 } from "tss-react/mui";
7844
- import { jsx as jsx119, jsxs as jsxs80 } from "react/jsx-runtime";
7845
- var useStyles52 = makeStyles52()((theme) => ({
8248
+ import { makeStyles as makeStyles53 } from "tss-react/mui";
8249
+ import { jsx as jsx120, jsxs as jsxs81 } from "react/jsx-runtime";
8250
+ var useStyles53 = makeStyles53()((theme) => ({
7846
8251
  paper: {
7847
8252
  padding: theme.spacing(2)
7848
8253
  },
@@ -7870,8 +8275,8 @@ var TwoButtonDialog = ({
7870
8275
  cancelLabel = "CANCEL",
7871
8276
  cancelButton
7872
8277
  }) => {
7873
- const { classes } = useStyles52();
7874
- return /* @__PURE__ */ jsx119(
8278
+ const { classes } = useStyles53();
8279
+ return /* @__PURE__ */ jsx120(
7875
8280
  Dialog5,
7876
8281
  {
7877
8282
  open,
@@ -7881,10 +8286,10 @@ var TwoButtonDialog = ({
7881
8286
  closeAfterTransition: true,
7882
8287
  BackdropComponent: Backdrop,
7883
8288
  BackdropProps: { timeout: 500 },
7884
- children: /* @__PURE__ */ jsx119(Fade2, { in: open, children: /* @__PURE__ */ jsxs80(Paper12, { className: classes.paper, children: [
7885
- /* @__PURE__ */ jsxs80(Box32, { className: classes.mb, children: [
7886
- /* @__PURE__ */ jsx119(Typography27, { variant: "h5", component: "div", children: /* @__PURE__ */ jsx119(
7887
- Box32,
8289
+ children: /* @__PURE__ */ jsx120(Fade2, { in: open, children: /* @__PURE__ */ jsxs81(Paper12, { className: classes.paper, children: [
8290
+ /* @__PURE__ */ jsxs81(Box33, { className: classes.mb, children: [
8291
+ /* @__PURE__ */ jsx120(Typography27, { variant: "h5", component: "div", children: /* @__PURE__ */ jsx120(
8292
+ Box33,
7888
8293
  {
7889
8294
  sx: {
7890
8295
  fontWeight: 600
@@ -7892,23 +8297,23 @@ var TwoButtonDialog = ({
7892
8297
  children: title
7893
8298
  }
7894
8299
  ) }),
7895
- /* @__PURE__ */ jsxs80(
7896
- Box32,
8300
+ /* @__PURE__ */ jsxs81(
8301
+ Box33,
7897
8302
  {
7898
8303
  className: classes.mt,
7899
8304
  sx: {
7900
8305
  fontWeight: 600
7901
8306
  },
7902
8307
  children: [
7903
- subtitle1 && /* @__PURE__ */ jsx119(Typography27, { variant: "subtitle1", children: subtitle1 }),
7904
- subtitle2 && /* @__PURE__ */ jsx119(Typography27, { variant: "subtitle1", children: subtitle2 })
8308
+ subtitle1 && /* @__PURE__ */ jsx120(Typography27, { variant: "subtitle1", children: subtitle1 }),
8309
+ subtitle2 && /* @__PURE__ */ jsx120(Typography27, { variant: "subtitle1", children: subtitle2 })
7905
8310
  ]
7906
8311
  }
7907
8312
  )
7908
8313
  ] }),
7909
- /* @__PURE__ */ jsx119(Divider10, {}),
7910
- /* @__PURE__ */ jsxs80(Box32, { className: classes.buttonContainer, children: [
7911
- /* @__PURE__ */ jsx119(
8314
+ /* @__PURE__ */ jsx120(Divider11, {}),
8315
+ /* @__PURE__ */ jsxs81(Box33, { className: classes.buttonContainer, children: [
8316
+ /* @__PURE__ */ jsx120(
7912
8317
  FilledButton_default,
7913
8318
  {
7914
8319
  copy: cancelLabel,
@@ -7921,7 +8326,7 @@ var TwoButtonDialog = ({
7921
8326
  }
7922
8327
  }
7923
8328
  ),
7924
- /* @__PURE__ */ jsx119(
8329
+ /* @__PURE__ */ jsx120(
7925
8330
  FilledButton_default,
7926
8331
  {
7927
8332
  color: "primary",
@@ -7930,7 +8335,7 @@ var TwoButtonDialog = ({
7930
8335
  }
7931
8336
  )
7932
8337
  ] }),
7933
- /* @__PURE__ */ jsx119(Loading_default, { isLoading: dialogLoading })
8338
+ /* @__PURE__ */ jsx120(Loading_default, { isLoading: dialogLoading })
7934
8339
  ] }) })
7935
8340
  }
7936
8341
  );
@@ -7938,10 +8343,10 @@ var TwoButtonDialog = ({
7938
8343
  var TwoButtonDialog_default = TwoButtonDialog;
7939
8344
 
7940
8345
  // src/components/icons/IconChart.tsx
7941
- import { jsx as jsx120 } from "react/jsx-runtime";
8346
+ import { jsx as jsx121 } from "react/jsx-runtime";
7942
8347
  var SvgIconChart = (props) => {
7943
8348
  const { fill } = props;
7944
- return /* @__PURE__ */ jsx120(
8349
+ return /* @__PURE__ */ jsx121(
7945
8350
  "svg",
7946
8351
  {
7947
8352
  width: "20",
@@ -7950,7 +8355,7 @@ var SvgIconChart = (props) => {
7950
8355
  fill: "none",
7951
8356
  xmlns: "http://www.w3.org/2000/svg",
7952
8357
  ...props,
7953
- children: /* @__PURE__ */ jsx120(
8358
+ children: /* @__PURE__ */ jsx121(
7954
8359
  "path",
7955
8360
  {
7956
8361
  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",
@@ -8021,6 +8426,7 @@ export {
8021
8426
  SectionName_default as SectionName,
8022
8427
  SmartSelect_default as SmartSelect,
8023
8428
  SmartTableHeader_default as SmartTableHeader,
8429
+ SmartTableHeaderFilterMenu_default as SmartTableHeaderFilterMenu,
8024
8430
  SquareButton_default as SquareButton,
8025
8431
  SquareLabel_default as SquareLabel,
8026
8432
  Switch_default as Switch,