@natoora-libs/core 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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: `/react/customers`,
4342
+ url: `/customer-list`,
4343
4343
  children: [
4344
4344
  {
4345
4345
  name: "Sites",
@@ -6114,11 +6114,10 @@ var RenderContentList = ({
6114
6114
  const sections = items.map((item) => ({
6115
6115
  id: transformNameToID(item),
6116
6116
  element: document.getElementById(transformNameToID(item))
6117
- })).filter(({ element }) => element !== null);
6117
+ }));
6118
6118
  if (observer.current) {
6119
6119
  observer.current.disconnect();
6120
6120
  }
6121
- if (sections.length === 0) return;
6122
6121
  observer.current = new IntersectionObserver(
6123
6122
  (entries) => {
6124
6123
  const visibleSection = entries.find((entry) => entry.isIntersecting);
@@ -6150,18 +6149,11 @@ var RenderContentList = ({
6150
6149
  return /* @__PURE__ */ jsxs64(
6151
6150
  ListItemButton2,
6152
6151
  {
6152
+ component: "a",
6153
+ href: `#${id}`,
6154
+ onClick: () => setActive(id),
6153
6155
  selected: active === id,
6154
6156
  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
- },
6165
6157
  children: [
6166
6158
  /* @__PURE__ */ jsx98(ListItemText5, { primary: item }),
6167
6159
  warningItems?.includes(item) && /* @__PURE__ */ jsx98(Tooltip4, { title: warningMessage, children: /* @__PURE__ */ jsx98(WarningAmber, { color: "warning" }) })
@@ -6275,7 +6267,7 @@ var RowProductCard = ({
6275
6267
  var RowProductCard_default = RowProductCard;
6276
6268
 
6277
6269
  // src/components/ScrollableDialog/ScrollableDialog.tsx
6278
- import { useEffect as useEffect6, useState as useState11 } from "react";
6270
+ import { useEffect as useEffect6, useRef as useRef3, useState as useState11 } from "react";
6279
6271
  import { Box as Box23, Dialog as Dialog4, Divider as Divider5, Fade, Paper as Paper6, Typography as Typography22 } from "@mui/material";
6280
6272
  import { makeStyles as makeStyles36 } from "tss-react/mui";
6281
6273
  import { jsx as jsx100, jsxs as jsxs66 } from "react/jsx-runtime";
@@ -6323,94 +6315,87 @@ var ScrollableDialog = ({
6323
6315
  const [bodyHeight, setBodyHeight] = useState11(0);
6324
6316
  const [hasScrollBar, setHasScrollBar] = useState11(false);
6325
6317
  const [maxDialogHeight, setMaxDialogHeight] = useState11(0);
6326
- const [screenHeight, setScreenHeight] = useState11(0);
6327
6318
  const { classes, cx } = useStyles36();
6328
- const setDialogBodyMaxHeight = () => {
6329
- const titleHeight = document.querySelector("#dialog-title")?.clientHeight || 0;
6330
- const headerHeight = document.querySelector("#dialog-header")?.clientHeight || 0;
6331
- const footerHeight2 = document.querySelector("#dialog-footer")?.clientHeight || 0;
6332
- const titleMargin = 48;
6333
- setBodyHeight(
6334
- maxDialogHeight - headerHeight - titleHeight - titleMargin - footerHeight2
6335
- );
6336
- };
6319
+ const headerRef = useRef3(null);
6320
+ const footerRef = useRef3(null);
6321
+ const titleRef = useRef3(null);
6322
+ const bodyRef = useRef3(null);
6323
+ const DIALOG_MARGIN = 65;
6324
+ const DEFAULT_MAX_HEIGHT = 728;
6325
+ const TITLE_MARGIN = 48;
6337
6326
  useEffect6(() => {
6338
- setScreenHeight(window.innerHeight);
6327
+ const handleResize = () => {
6328
+ const screenHeight = window.innerHeight;
6329
+ const newMaxHeight = screenHeight < DEFAULT_MAX_HEIGHT + DIALOG_MARGIN ? screenHeight - DIALOG_MARGIN : DEFAULT_MAX_HEIGHT;
6330
+ setMaxDialogHeight(newMaxHeight);
6331
+ };
6332
+ handleResize();
6333
+ window.addEventListener("resize", handleResize);
6334
+ return () => window.removeEventListener("resize", handleResize);
6339
6335
  }, []);
6336
+ const measureHeights = () => {
6337
+ const titleHeight = titleRef.current?.clientHeight || 0;
6338
+ const headerHeight = headerRef.current?.clientHeight || 0;
6339
+ const footerHeight2 = footerRef.current?.clientHeight || 0;
6340
+ const contentHeight = maxDialogHeight - titleHeight - headerHeight - footerHeight2 - TITLE_MARGIN;
6341
+ setBodyHeight(contentHeight);
6342
+ const scrollHeight = bodyRef.current?.scrollHeight || 0;
6343
+ setHasScrollBar(scrollHeight > contentHeight);
6344
+ };
6340
6345
  useEffect6(() => {
6341
- if (!header) {
6342
- return;
6343
- }
6344
- setDialogBodyMaxHeight();
6345
- }, [header]);
6346
- useEffect6(() => {
6347
- if (!body) {
6348
- return;
6349
- }
6350
- const bodyScrollBarHeight = document.querySelector("#dialog-body")?.scrollHeight || 0;
6351
- setHasScrollBar(bodyScrollBarHeight > bodyHeight);
6352
- }, [body]);
6353
- useEffect6(() => {
6354
- if (!isOpen) {
6355
- setBodyHeight(0);
6346
+ if (isOpen) {
6347
+ requestAnimationFrame(measureHeights);
6356
6348
  }
6357
- }, [isOpen]);
6358
- useEffect6(() => {
6359
- if (!screenHeight) {
6360
- return;
6349
+ }, [isOpen, header, footer, title, maxDialogHeight]);
6350
+ return /* @__PURE__ */ jsx100(Dialog4, { className: classes.dialog, fullWidth: true, maxWidth: false, open: isOpen, children: /* @__PURE__ */ jsx100(
6351
+ Fade,
6352
+ {
6353
+ in: isOpen,
6354
+ onEntered: () => {
6355
+ requestAnimationFrame(measureHeights);
6356
+ },
6357
+ children: /* @__PURE__ */ jsxs66(Paper6, { className: classes.wrapper, children: [
6358
+ header ? /* @__PURE__ */ jsx100("div", { className: classes.header, id: "dialog-header", children: header }) : null,
6359
+ /* @__PURE__ */ jsxs66("div", { className: classes.body, children: [
6360
+ /* @__PURE__ */ jsx100(
6361
+ Typography22,
6362
+ {
6363
+ className: classes.title,
6364
+ id: "dialog-title",
6365
+ variant: "h6",
6366
+ children: title
6367
+ }
6368
+ ),
6369
+ /* @__PURE__ */ jsx100(
6370
+ "div",
6371
+ {
6372
+ className: cx(classes.scrollableContainer, {
6373
+ [classes.smallContainer]: !hasScrollBar
6374
+ }),
6375
+ id: "dialog-body",
6376
+ style: {
6377
+ maxHeight: bodyHeight
6378
+ },
6379
+ children: body
6380
+ }
6381
+ )
6382
+ ] }),
6383
+ /* @__PURE__ */ jsx100(Divider5, {}),
6384
+ footer ? /* @__PURE__ */ jsx100(
6385
+ Box23,
6386
+ {
6387
+ className: classes.footer,
6388
+ id: "dialog-footer",
6389
+ sx: {
6390
+ display: "flex",
6391
+ justifyContent: "center"
6392
+ },
6393
+ children: footer
6394
+ }
6395
+ ) : null
6396
+ ] })
6361
6397
  }
6362
- const dialogMargin = 65;
6363
- const defaultDialogMaxHeight = 728;
6364
- const necessaryHeight = defaultDialogMaxHeight + dialogMargin;
6365
- setMaxDialogHeight(
6366
- screenHeight < necessaryHeight ? screenHeight - dialogMargin : defaultDialogMaxHeight
6367
- );
6368
- }, [screenHeight]);
6369
- useEffect6(() => {
6370
- if (isOpen && maxDialogHeight) {
6371
- setDialogBodyMaxHeight();
6372
- }
6373
- }, [isOpen, maxDialogHeight, header]);
6374
- return /* @__PURE__ */ jsx100(Dialog4, { className: classes.dialog, fullWidth: true, maxWidth: false, open: isOpen, children: /* @__PURE__ */ jsx100(Fade, { in: isOpen, children: /* @__PURE__ */ jsxs66(Paper6, { className: classes.wrapper, children: [
6375
- header ? /* @__PURE__ */ jsx100("div", { className: classes.header, id: "dialog-header", children: header }) : null,
6376
- /* @__PURE__ */ jsxs66("div", { className: classes.body, children: [
6377
- /* @__PURE__ */ jsx100(
6378
- Typography22,
6379
- {
6380
- className: classes.title,
6381
- id: "dialog-title",
6382
- variant: "h6",
6383
- children: title
6384
- }
6385
- ),
6386
- /* @__PURE__ */ jsx100(
6387
- "div",
6388
- {
6389
- className: cx(classes.scrollableContainer, {
6390
- [classes.smallContainer]: !hasScrollBar
6391
- }),
6392
- id: "dialog-body",
6393
- style: {
6394
- maxHeight: bodyHeight
6395
- },
6396
- children: body
6397
- }
6398
- )
6399
- ] }),
6400
- /* @__PURE__ */ jsx100(Divider5, {}),
6401
- footer ? /* @__PURE__ */ jsx100(
6402
- Box23,
6403
- {
6404
- className: classes.footer,
6405
- id: "dialog-footer",
6406
- sx: {
6407
- display: "flex",
6408
- justifyContent: "center"
6409
- },
6410
- children: footer
6411
- }
6412
- ) : null
6413
- ] }) }) });
6398
+ ) });
6414
6399
  };
6415
6400
  var ScrollableDialog_default = ScrollableDialog;
6416
6401
 
@@ -6420,7 +6405,7 @@ import { makeStyles as makeStyles38 } from "tss-react/mui";
6420
6405
 
6421
6406
  // src/components/SearchWithFilters/SearchWithFilters.tsx
6422
6407
  import { useState as useState12, useEffect as useEffect7 } from "react";
6423
- import * as React2 from "react";
6408
+ import * as React3 from "react";
6424
6409
  import {
6425
6410
  ArrowDropDown as ArrowDropDownIcon,
6426
6411
  ArrowDropUp as ArrowDropUpIcon,
@@ -6517,7 +6502,7 @@ var SearchWithFilters = ({
6517
6502
  )
6518
6503
  ] });
6519
6504
  };
6520
- var SearchWithFilters_default = React2.memo(SearchWithFilters);
6505
+ var SearchWithFilters_default = React3.memo(SearchWithFilters);
6521
6506
 
6522
6507
  // src/components/SearchAndFilterHeader/SearchAndFilterHeader.tsx
6523
6508
  import { jsx as jsx102, jsxs as jsxs68 } from "react/jsx-runtime";
@@ -6580,7 +6565,7 @@ var SearchAndFilterHeader = ({
6580
6565
  var SearchAndFilterHeader_default = SearchAndFilterHeader;
6581
6566
 
6582
6567
  // src/components/SearchAndFilterHeader/SearchAndFilterHeaderForTable.tsx
6583
- import * as React3 from "react";
6568
+ import * as React4 from "react";
6584
6569
  import { Box as Box26 } from "@mui/material";
6585
6570
  import { makeStyles as makeStyles40 } from "tss-react/mui";
6586
6571
 
@@ -6764,7 +6749,7 @@ var SearchAndFilterHeaderForTable = (props) => {
6764
6749
  /* @__PURE__ */ jsx104(Box26, { children: button })
6765
6750
  ] });
6766
6751
  };
6767
- var SearchAndFilterHeaderForTable_default = React3.memo(SearchAndFilterHeaderForTable);
6752
+ var SearchAndFilterHeaderForTable_default = React4.memo(SearchAndFilterHeaderForTable);
6768
6753
 
6769
6754
  // src/components/SectionName/SectionName.tsx
6770
6755
  import { History as History2, Info as InfoIcon } from "@mui/icons-material";
@@ -7087,221 +7072,14 @@ var LabelledSwitch = withStyles6(LSwitch, (theme) => ({
7087
7072
  }));
7088
7073
  var Switch_default = memo20(LabelledSwitch);
7089
7074
 
7090
- // src/components/SmartTableHeaderFilterMenu/SmartTableHeaderFilterMenu.tsx
7091
- import React4, { useState as useState15 } from "react";
7092
- import { FilterList } from "@mui/icons-material";
7093
- import {
7094
- Box as Box28,
7095
- Checkbox as Checkbox4,
7096
- Chip as Chip2,
7097
- Divider as Divider9,
7098
- FormControl as FormControl5,
7099
- FormControlLabel as FormControlLabel3,
7100
- FormHelperText as FormHelperText4,
7101
- IconButton as IconButton3,
7102
- Menu as Menu4
7103
- } from "@mui/material";
7104
- import classNames3 from "classnames";
7105
- import { makeStyles as makeStyles44 } from "tss-react/mui";
7106
- import { Fragment as Fragment12, jsx as jsx109, jsxs as jsxs74 } from "react/jsx-runtime";
7107
- var useStyles44 = makeStyles44()((theme) => ({
7108
- filterMenu: {
7109
- display: "flex",
7110
- flexDirection: "column",
7111
- gap: theme.spacing(0.5)
7112
- },
7113
- filterCheckboxDropdown: {
7114
- display: "flex",
7115
- flexDirection: "column",
7116
- padding: theme.spacing(0, 3)
7117
- },
7118
- applyFilterButtonsContainer: {
7119
- display: "flex",
7120
- padding: theme.spacing(0, 1)
7121
- }
7122
- }));
7123
- var resolveFilterOption = (filterOption) => {
7124
- if (typeof filterOption === "object") {
7125
- return filterOption?.label || filterOption?.name || "";
7126
- }
7127
- return filterOption;
7128
- };
7129
- var findFilterIndex = (filters, filterOption) => filters.findIndex((item) => {
7130
- if (typeof item === "string" && typeof filterOption === "string") {
7131
- return item === filterOption;
7132
- }
7133
- if (typeof item === "object" && typeof filterOption === "object") {
7134
- return item.id === filterOption.id;
7135
- }
7136
- return false;
7137
- });
7138
- var SmartTableHeaderFilterMenu = ({
7139
- headCell,
7140
- hasActiveFilters,
7141
- headerFilters,
7142
- onApplyFilters
7143
- }) => {
7144
- const { classes } = useStyles44();
7145
- const [anchorEl, setAnchorEl] = useState15(null);
7146
- const [shouldSave, setShouldSave] = useState15(false);
7147
- const [selectedFilters, setSelectedFilters] = useState15(
7148
- headerFilters[headCell.id] ?? []
7149
- );
7150
- const handleFilterMenuOpen = (event) => {
7151
- if (!headCell.filterOptionsQuery?.data?.length) {
7152
- headCell.filterOptionsQuery?.refetch();
7153
- }
7154
- setAnchorEl(event.currentTarget);
7155
- };
7156
- const handleFilterMenuClose = () => {
7157
- setSelectedFilters(headerFilters[headCell.id]);
7158
- setAnchorEl(null);
7159
- setShouldSave(false);
7160
- };
7161
- const handleFilterOptionClick = (option) => {
7162
- const selectedIndex = findFilterIndex(selectedFilters, option);
7163
- let newSelected;
7164
- if (selectedIndex === -1) {
7165
- if (typeof option === "string") {
7166
- newSelected = [...selectedFilters, option];
7167
- } else {
7168
- newSelected = [...selectedFilters, option];
7169
- }
7170
- } else {
7171
- newSelected = selectedFilters.filter(
7172
- (_, index) => index !== selectedIndex
7173
- );
7174
- }
7175
- setSelectedFilters(newSelected);
7176
- };
7177
- return /* @__PURE__ */ jsxs74(Fragment12, { children: [
7178
- /* @__PURE__ */ jsx109(
7179
- IconButton3,
7180
- {
7181
- disableRipple: true,
7182
- onClick: handleFilterMenuOpen,
7183
- "data-testid": "filter-menu-button",
7184
- style: { padding: 0 },
7185
- className: classNames3("filter-menu-trigger", {
7186
- "has-active-filters": hasActiveFilters
7187
- }),
7188
- children: hasActiveFilters ? /* @__PURE__ */ jsx109(
7189
- Chip2,
7190
- {
7191
- sx: { height: 24 },
7192
- label: headerFilters[headCell.id]?.length,
7193
- icon: /* @__PURE__ */ jsx109(FilterList, { style: { fontSize: 18 }, color: "primary" })
7194
- }
7195
- ) : /* @__PURE__ */ jsx109(FilterList, { style: { fontSize: 18 } })
7196
- }
7197
- ),
7198
- /* @__PURE__ */ jsx109(
7199
- Menu4,
7200
- {
7201
- open: !!anchorEl,
7202
- onClose: handleFilterMenuClose,
7203
- anchorEl,
7204
- "data-testid": "filter-menu",
7205
- anchorOrigin: { vertical: "bottom", horizontal: "right" },
7206
- transformOrigin: { vertical: "top", horizontal: "right" },
7207
- children: /* @__PURE__ */ jsxs74(Box28, { className: classes.filterMenu, children: [
7208
- headCell.filterOptionsQuery?.data?.map(
7209
- (option) => {
7210
- const resolvedOption = resolveFilterOption(option);
7211
- return /* @__PURE__ */ jsx109(
7212
- FormControl5,
7213
- {
7214
- className: classes.filterCheckboxDropdown,
7215
- children: /* @__PURE__ */ jsx109(
7216
- FormControlLabel3,
7217
- {
7218
- label: resolvedOption,
7219
- control: /* @__PURE__ */ jsx109(
7220
- Checkbox4,
7221
- {
7222
- disableRipple: true,
7223
- onChange: () => handleFilterOptionClick(option),
7224
- checked: selectedFilters?.some(
7225
- (value) => resolveFilterOption(value) === resolvedOption
7226
- ) ?? false
7227
- }
7228
- )
7229
- }
7230
- )
7231
- },
7232
- resolvedOption
7233
- );
7234
- }
7235
- ),
7236
- /* @__PURE__ */ jsx109(Divider9, {}),
7237
- /* @__PURE__ */ jsxs74(FormControl5, { className: classes.filterCheckboxDropdown, children: [
7238
- /* @__PURE__ */ jsx109(
7239
- FormControlLabel3,
7240
- {
7241
- label: "Save Filters",
7242
- control: /* @__PURE__ */ jsx109(
7243
- Checkbox4,
7244
- {
7245
- disableRipple: true,
7246
- checked: shouldSave,
7247
- onChange: (e) => setShouldSave(e.target.checked)
7248
- }
7249
- )
7250
- }
7251
- ),
7252
- /* @__PURE__ */ jsx109(FormHelperText4, { sx: { margin: 0 }, children: "Filters auto-apply on return." })
7253
- ] }),
7254
- /* @__PURE__ */ jsx109(Divider9, {}),
7255
- /* @__PURE__ */ jsxs74(Box28, { className: classes.applyFilterButtonsContainer, children: [
7256
- /* @__PURE__ */ jsx109(
7257
- ExtendedButton_default,
7258
- {
7259
- buttonType: "button",
7260
- copy: "Deselect All",
7261
- variant: "text",
7262
- onClick: () => setSelectedFilters([])
7263
- }
7264
- ),
7265
- /* @__PURE__ */ jsx109(
7266
- ExtendedButton_default,
7267
- {
7268
- copy: "Apply",
7269
- color: "primary",
7270
- buttonType: "submit",
7271
- onClick: () => {
7272
- const updatedFilters = {
7273
- ...headerFilters,
7274
- [headCell.id]: [...selectedFilters]
7275
- };
7276
- onApplyFilters?.(updatedFilters, shouldSave);
7277
- setAnchorEl(null);
7278
- setShouldSave(false);
7279
- }
7280
- }
7281
- )
7282
- ] })
7283
- ] })
7284
- }
7285
- )
7286
- ] });
7287
- };
7288
- var SmartTableHeaderFilterMenu_default = React4.memo(SmartTableHeaderFilterMenu);
7289
-
7290
- // src/components/SmartTableHeader/SmartTableHeader.tsx
7075
+ // src/components/Table/SmartTableHeader.tsx
7291
7076
  import { memo as memo21 } from "react";
7292
- import {
7293
- Checkbox as Checkbox5,
7294
- TableCell,
7295
- TableHead,
7296
- TableRow,
7297
- TableSortLabel
7298
- } from "@mui/material";
7299
- import { makeStyles as makeStyles45 } from "tss-react/mui";
7300
- import { jsx as jsx110, jsxs as jsxs75 } from "react/jsx-runtime";
7301
- var useStyles45 = makeStyles45()((theme) => ({
7077
+ import { TableCell, TableHead, TableRow, TableSortLabel } from "@mui/material";
7078
+ import { makeStyles as makeStyles44 } from "tss-react/mui";
7079
+ import { jsx as jsx109, jsxs as jsxs74 } from "react/jsx-runtime";
7080
+ var useStyles44 = makeStyles44()(() => ({
7302
7081
  root: {
7303
7082
  backgroundColor: colors.neutral100,
7304
- height: theme.spacing(6),
7305
7083
  "& .MuiTableSortLabel-root": {
7306
7084
  fontWeight: 600,
7307
7085
  fontSize: ".875rem"
@@ -7318,109 +7096,49 @@ var useStyles45 = makeStyles45()((theme) => ({
7318
7096
  top: 20,
7319
7097
  width: 1
7320
7098
  },
7321
- tableHeaderContent: {
7099
+ containerTh: {
7322
7100
  borderBottom: "1px solid",
7323
7101
  borderBottomColor: colors.neutral250,
7324
- whiteSpace: "nowrap",
7325
- "& .filter-menu-trigger": {
7326
- visibility: "hidden",
7327
- opacity: 0,
7328
- transition: "visibility 0.1s, opacity 0.1s ease-in"
7329
- },
7330
- "&:hover .filter-menu-trigger, & .filter-menu-trigger.has-active-filters": {
7331
- visibility: "visible",
7332
- opacity: 1
7333
- },
7334
- "&:hover .MuiTableSortLabel-root": {
7335
- "& .MuiTableSortLabel-icon": {
7336
- opacity: 1
7337
- }
7338
- }
7339
- },
7340
- filterMenu: {
7341
- display: "flex",
7342
- flexDirection: "column",
7343
- gap: theme.spacing(0.5)
7344
- },
7345
- filterCheckboxDropdown: {
7346
- display: "flex",
7347
- flexDirection: "column",
7348
- padding: theme.spacing(0, 3)
7349
- },
7350
- applyFilterButtonsContainer: {
7351
- display: "flex",
7352
- padding: theme.spacing(0, 1)
7102
+ backgroundColor: colors.neutral100,
7103
+ outline: "1px solid",
7104
+ outlineColor: colors.neutral100
7353
7105
  }
7354
7106
  }));
7355
- var SmartTableHeader = ({
7356
- order,
7357
- orderBy,
7358
- headCells,
7359
- numSelected,
7360
- numRows,
7361
- enableCheckboxSelection = false,
7362
- headerFilters,
7363
- onRequestSort,
7364
- onSelectAllClick,
7365
- onApplyFilters
7366
- }) => {
7367
- const { classes } = useStyles45();
7107
+ var SmartTableHeader = (props) => {
7108
+ const { classes } = useStyles44();
7109
+ const { order, orderBy, onRequestSort } = props;
7368
7110
  const createSortHandler = (property) => (event) => {
7369
- onRequestSort(event, property);
7111
+ onRequestSort?.(event, property);
7370
7112
  };
7371
- const isSortActive = (headCellId) => orderBy === headCellId;
7372
- return /* @__PURE__ */ jsx110(TableHead, { className: classes.root, children: /* @__PURE__ */ jsxs75(TableRow, { children: [
7373
- enableCheckboxSelection ? /* @__PURE__ */ jsx110(TableCell, { padding: "checkbox", children: /* @__PURE__ */ jsx110(
7374
- Checkbox5,
7375
- {
7376
- color: "primary",
7377
- indeterminate: numSelected > 0 && numSelected < numRows,
7378
- checked: numRows > 0 && numSelected === numRows,
7379
- onChange: onSelectAllClick
7380
- }
7381
- ) }) : null,
7382
- headCells.map((headCell) => /* @__PURE__ */ jsxs75(
7383
- TableCell,
7384
- {
7385
- className: classes.tableHeaderContent,
7386
- align: "left",
7387
- sortDirection: orderBy === headCell.id ? order : false,
7388
- children: [
7389
- /* @__PURE__ */ jsxs75(
7390
- TableSortLabel,
7391
- {
7392
- "data-testid": "table-sort-label",
7393
- active: isSortActive(headCell.id),
7394
- direction: orderBy === headCell.id ? order : "asc",
7395
- onClick: createSortHandler(headCell.id),
7396
- children: [
7397
- headCell.renderHeader ?? headCell.label,
7398
- orderBy === headCell.id ? /* @__PURE__ */ jsx110("span", { className: classes.visuallyHidden, children: order === "desc" ? "sorted descending" : "sorted ascending" }) : null
7399
- ]
7400
- }
7401
- ),
7402
- headCell.filterOptionsQuery ? /* @__PURE__ */ jsx110(
7403
- SmartTableHeaderFilterMenu_default,
7404
- {
7405
- headCell,
7406
- headerFilters,
7407
- hasActiveFilters: !!headerFilters[headCell.id]?.length,
7408
- onApplyFilters
7409
- }
7410
- ) : null
7411
- ]
7412
- },
7413
- headCell.id
7414
- ))
7415
- ] }) });
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
+ )) }) });
7416
7134
  };
7417
7135
  var SmartTableHeader_default = memo21(SmartTableHeader);
7418
7136
 
7419
7137
  // src/components/Table/Table.tsx
7420
7138
  var import_debounce = __toESM(require_debounce(), 1);
7421
- import { useLayoutEffect, useState as useState16 } from "react";
7139
+ import { useLayoutEffect, useState as useState15 } from "react";
7422
7140
  import {
7423
- Box as Box30,
7141
+ Box as Box29,
7424
7142
  Paper as Paper10,
7425
7143
  Table as MUITable,
7426
7144
  TableBody,
@@ -7430,28 +7148,9 @@ import {
7430
7148
  TableRow as TableRow2,
7431
7149
  TableSortLabel as TableSortLabel2
7432
7150
  } from "@mui/material";
7433
- import { makeStyles as makeStyles46 } from "tss-react/mui";
7151
+ import { makeStyles as makeStyles45 } from "tss-react/mui";
7434
7152
  import { v4 as uuidv4 } from "uuid";
7435
7153
 
7436
- // src/components/TableLoading/TableLoading.tsx
7437
- import { Box as Box29, Skeleton as Skeleton2 } from "@mui/material";
7438
- import { jsx as jsx111 } from "react/jsx-runtime";
7439
- var TableLoading = ({
7440
- rowsPerPage,
7441
- rowHeight
7442
- }) => /* @__PURE__ */ jsx111(Box29, { children: Array.from({ length: rowsPerPage ?? 0 }).map((_, index) => /* @__PURE__ */ jsx111(
7443
- Skeleton2,
7444
- {
7445
- animation: "pulse",
7446
- "data-testid": "table-loading-skeleton",
7447
- style: { margin: "8px", opacity: 0.4 },
7448
- variant: "rectangular",
7449
- height: rowHeight
7450
- },
7451
- index
7452
- )) });
7453
- var TableLoading_default = TableLoading;
7454
-
7455
7154
  // src/components/Table/helpers.tsx
7456
7155
  function stableSort(array, cmp) {
7457
7156
  const stabilizedThis = array.map((el, index) => [el, index]);
@@ -7487,9 +7186,24 @@ function calculateRowsPerPage(rowHeight) {
7487
7186
  return 1;
7488
7187
  }
7489
7188
 
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
+
7490
7204
  // src/components/Table/Table.tsx
7491
- import { jsx as jsx112, jsxs as jsxs76 } from "react/jsx-runtime";
7492
- var useStyles46 = makeStyles46()(() => ({
7205
+ import { jsx as jsx111, jsxs as jsxs75 } from "react/jsx-runtime";
7206
+ var useStyles45 = makeStyles45()(() => ({
7493
7207
  root: {
7494
7208
  height: "calc(100vh - 262px)",
7495
7209
  overflow: "scroll"
@@ -7523,12 +7237,12 @@ var Table = ({
7523
7237
  serverRendered,
7524
7238
  updateSort
7525
7239
  }) => {
7526
- const [order, setOrder] = useState16(appliedFilters?.sortDir || "desc");
7527
- const [orderBy, setOrderBy] = useState16(
7240
+ const [order, setOrder] = useState15(appliedFilters?.sortDir || "desc");
7241
+ const [orderBy, setOrderBy] = useState15(
7528
7242
  appliedFilters?.sortField || "delivery_date"
7529
7243
  );
7530
- const [rowsPerPage, setRowsPerPage] = useState16(defaultRowsPerPage);
7531
- const { classes } = useStyles46();
7244
+ const [rowsPerPage, setRowsPerPage] = useState15(defaultRowsPerPage);
7245
+ const { classes } = useStyles45();
7532
7246
  const rowHeight = 56;
7533
7247
  const emptyRows = rowsPerPage - Math.min(rowsPerPage, data.length - page * rowsPerPage);
7534
7248
  const handleRequestSort = (event, property) => {
@@ -7566,24 +7280,24 @@ var Table = ({
7566
7280
  );
7567
7281
  const rowsComponents = rows.map((row) => {
7568
7282
  if (RenderItem) {
7569
- return /* @__PURE__ */ jsx112(RenderItem, { ...row }, row.id);
7283
+ return /* @__PURE__ */ jsx111(RenderItem, { ...row }, row.id);
7570
7284
  }
7571
- return /* @__PURE__ */ jsx112(TableRow2, { hover: true, onClick: () => onRowClick?.(row), children: headCells?.map((column) => /* @__PURE__ */ jsx112(TableCell2, { children: row[column.id] }, column.id)) }, row.id);
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);
7572
7286
  });
7573
7287
  if (emptyRows > 0 && rowsPerPage > emptyRows) {
7574
7288
  rowsComponents.push(
7575
- /* @__PURE__ */ jsx112(TableRow2, { style: { height: rowHeight * emptyRows }, children: /* @__PURE__ */ jsx112(TableCell2, { colSpan: 8 }) }, uuidv4())
7289
+ /* @__PURE__ */ jsx111(TableRow2, { style: { height: rowHeight * emptyRows }, children: /* @__PURE__ */ jsx111(TableCell2, { colSpan: 8 }) }, uuidv4())
7576
7290
  );
7577
7291
  }
7578
7292
  return rowsComponents;
7579
7293
  };
7580
- 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: [
7581
- /* @__PURE__ */ jsx112(TableHead2, { className: classes.header, children: /* @__PURE__ */ jsx112(TableRow2, { children: headCells?.map((headCell) => /* @__PURE__ */ jsx112(
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(
7582
7296
  TableCell2,
7583
7297
  {
7584
7298
  align: "left",
7585
7299
  sortDirection: orderBy === headCell.id ? order : void 0,
7586
- children: /* @__PURE__ */ jsx112(
7300
+ children: /* @__PURE__ */ jsx111(
7587
7301
  TableSortLabel2,
7588
7302
  {
7589
7303
  active: orderBy === headCell.id,
@@ -7595,20 +7309,16 @@ var Table = ({
7595
7309
  },
7596
7310
  headCell.id
7597
7311
  )) }) }),
7598
- /* @__PURE__ */ jsxs76(TableBody, { children: [
7312
+ /* @__PURE__ */ jsxs75(TableBody, { children: [
7599
7313
  getTableRows(),
7600
- rowsPerPage === emptyRows && /* @__PURE__ */ jsx112(TableRow2, { style: { height: rowHeight * emptyRows }, children: /* @__PURE__ */ jsx112(TableCell2, { colSpan: 8, align: "center", children: "Nothing to display" }) })
7314
+ rowsPerPage === emptyRows && /* @__PURE__ */ jsx111(TableRow2, { style: { height: rowHeight * emptyRows }, children: /* @__PURE__ */ jsx111(TableCell2, { colSpan: 8, align: "center", children: "Nothing to display" }) })
7601
7315
  ] })
7602
7316
  ] }) }) }) });
7603
7317
  };
7604
7318
  var Table_default = Table;
7605
7319
 
7606
- // src/components/TableDesktop/TableDesktop.tsx
7607
- import {
7608
- useCallback as useCallback2,
7609
- useMemo as useMemo2,
7610
- useState as useState17
7611
- } from "react";
7320
+ // src/components/Table/TableDesktop.tsx
7321
+ import { useState as useState16 } from "react";
7612
7322
  import {
7613
7323
  Paper as Paper11,
7614
7324
  Table as Table2,
@@ -7616,50 +7326,41 @@ import {
7616
7326
  TableContainer as TableContainer2,
7617
7327
  Skeleton as Skeleton3
7618
7328
  } from "@mui/material";
7619
- import { makeStyles as makeStyles48 } from "tss-react/mui";
7329
+ import { makeStyles as makeStyles47 } from "tss-react/mui";
7620
7330
  import { v4 as uuidv42 } from "uuid";
7621
7331
 
7622
- // src/components/TableEmptyResult/TableEmptyResult.tsx
7332
+ // src/components/Table/TableEmptyResult.tsx
7623
7333
  import { TableCell as TableCell3, TableRow as TableRow3, Typography as Typography25 } from "@mui/material";
7624
- import { makeStyles as makeStyles47 } from "tss-react/mui";
7625
- import { jsx as jsx113, jsxs as jsxs77 } from "react/jsx-runtime";
7626
- var useStyles47 = makeStyles47()(() => ({
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()(() => ({
7627
7337
  tableCellIcon: { padding: 24, height: "calc(100vh - 320px)" },
7628
7338
  tableCellDefault: { padding: 24 }
7629
7339
  }));
7630
7340
  var TableEmptyResult = ({
7631
- colSpan,
7632
7341
  showClearFilterButton = false,
7633
7342
  handleClickOnClearFiltersButton = () => {
7634
7343
  }
7635
7344
  }) => {
7636
- const { classes } = useStyles47();
7637
- return showClearFilterButton ? /* @__PURE__ */ jsx113(TableRow3, { children: /* @__PURE__ */ jsxs77(
7638
- TableCell3,
7639
- {
7640
- className: classes.tableCellIcon,
7641
- colSpan,
7642
- align: "center",
7643
- children: [
7644
- /* @__PURE__ */ jsx113(EmptyGlassIcon_default, {}),
7645
- /* @__PURE__ */ jsx113(Typography25, { variant: "h6", children: "No results found." }),
7646
- /* @__PURE__ */ jsx113(Typography25, { variant: "subtitle1", children: "Search without applied filters?" }),
7647
- /* @__PURE__ */ jsx113(
7648
- FilledButton_default,
7649
- {
7650
- copy: "Search",
7651
- variant: "contained",
7652
- color: "primary",
7653
- onClick: handleClickOnClearFiltersButton
7654
- }
7655
- )
7656
- ]
7657
- }
7658
- ) }) : /* @__PURE__ */ jsx113(TableRow3, { children: /* @__PURE__ */ jsx113(
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(
7659
7360
  TableCell3,
7660
7361
  {
7661
7362
  className: classes.tableCellDefault,
7662
- colSpan,
7363
+ colSpan: 8,
7663
7364
  align: "center",
7664
7365
  children: "Nothing to display"
7665
7366
  }
@@ -7667,9 +7368,9 @@ var TableEmptyResult = ({
7667
7368
  };
7668
7369
  var TableEmptyResult_default = TableEmptyResult;
7669
7370
 
7670
- // src/components/TableDesktop/TableDesktop.tsx
7671
- import { Fragment as Fragment13, jsx as jsx114, jsxs as jsxs78 } from "react/jsx-runtime";
7672
- var useStyles48 = makeStyles48()((theme) => ({
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()(() => ({
7673
7374
  root: {
7674
7375
  justifyContent: "space-between",
7675
7376
  display: "flex",
@@ -7682,202 +7383,97 @@ var useStyles48 = makeStyles48()((theme) => ({
7682
7383
  justifyContent: "space-between"
7683
7384
  },
7684
7385
  container: {
7685
- maxHeight: "100%",
7686
- "&::-webkit-scrollbar": {
7687
- width: "8px",
7688
- height: "8px"
7689
- },
7690
- "&::-webkit-scrollbar-track": {
7691
- backgroundColor: theme.palette.mode === "dark" ? theme.palette.grey[800] : theme.palette.grey[100]
7692
- },
7693
- "&::-webkit-scrollbar-thumb": {
7694
- backgroundColor: theme.palette.mode === "dark" ? theme.palette.grey[900] : theme.palette.grey[400],
7695
- borderRadius: "10px"
7696
- },
7697
- "&::-webkit-scrollbar-thumb:hover": {
7698
- backgroundColor: theme.palette.mode === "dark" ? theme.palette.common.black : theme.palette.grey[500]
7699
- }
7386
+ maxHeight: "100%"
7700
7387
  }
7701
7388
  }));
7702
- var descendingComparator2 = (a, b, orderBy) => {
7703
- const objA = a[orderBy];
7704
- const objB = b[orderBy];
7705
- const valA = typeof objA === "object" ? objA?.name : objA;
7706
- const valB = typeof objB === "object" ? objB?.name : objB;
7707
- if (!valA && !valB) {
7708
- return 0;
7709
- }
7710
- if (valA && !valB) {
7711
- return -1;
7712
- }
7713
- if (!valA && valB) {
7714
- return 1;
7715
- }
7716
- if (valA > valB) {
7389
+ var desc = (a, b, orderBy) => {
7390
+ if (b[orderBy] < a[orderBy]) {
7717
7391
  return -1;
7718
7392
  }
7719
- if (valA < valB) {
7393
+ if (b[orderBy] > a[orderBy]) {
7720
7394
  return 1;
7721
7395
  }
7722
7396
  return 0;
7723
7397
  };
7724
- var stableSort2 = (array, cmp) => array.map((el, index) => ({ el, index })).sort((a, b) => {
7725
- const order = cmp(a.el, b.el);
7726
- return order !== 0 ? order : a.index - b.index;
7727
- }).map((el) => el.el);
7728
- var getComparator = (order, orderBy) => order === "desc" ? (a, b) => descendingComparator2(a, b, orderBy) : (a, b) => -descendingComparator2(a, b, orderBy);
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);
7729
7403
  var TableDesktop = ({
7730
- data,
7731
- headCells,
7732
- RenderItem,
7733
7404
  appliedFilters,
7734
- headerFilters,
7735
7405
  children,
7406
+ data,
7407
+ headCells,
7736
7408
  height,
7737
7409
  isLoading,
7738
- rowsPerPage = 50,
7739
- enableCheckboxSelection = false,
7740
- disableInternalSort = false,
7410
+ RenderItem,
7411
+ rowsPerPage,
7741
7412
  updateSort,
7742
7413
  showClearFilterButton,
7743
7414
  handleClickOnClearFiltersButton,
7744
7415
  deleteItem,
7745
- keyField = "id",
7746
- onApplyFilters
7416
+ keyField
7747
7417
  }) => {
7748
- const [order, setOrder] = useState17(appliedFilters?.sortDir || "desc");
7749
- const [orderBy, setOrderBy] = useState17(
7418
+ const [order, setOrder] = useState16(
7419
+ appliedFilters?.sortDir || "desc"
7420
+ );
7421
+ const [orderBy, setOrderBy] = useState16(
7750
7422
  appliedFilters?.sortField || "delivery_date"
7751
7423
  );
7752
- const [selected, setSelected] = useState17([]);
7753
- const [page] = useState17(0);
7754
- const { classes } = useStyles48();
7424
+ const [page] = useState16(0);
7425
+ const { classes } = useStyles47();
7755
7426
  const rowHeight = 56;
7756
- const emptyRows = useMemo2(
7757
- () => rowsPerPage - data.length,
7758
- [rowsPerPage, data]
7759
- );
7760
- const visibleHeadCells = useMemo2(
7761
- () => headCells.filter((headCell) => headCell?.enabled ?? true),
7762
- [headCells]
7763
- );
7764
- const handleSelectAllClick = useCallback2(
7765
- (event) => {
7766
- if (event.target.checked) {
7767
- const newSelected = data.map((n) => n[keyField]);
7768
- setSelected(newSelected);
7769
- return;
7770
- }
7771
- setSelected([]);
7772
- },
7773
- [data, keyField]
7774
- );
7775
7427
  const handleRequestSort = (event, property) => {
7776
7428
  const isAsc = orderBy === property && order === "asc";
7777
7429
  const orderDir = isAsc ? "desc" : "asc";
7778
7430
  setOrder(orderDir);
7779
7431
  setOrderBy(property);
7780
- if (updateSort) {
7781
- updateSort(property, orderDir);
7782
- }
7432
+ updateSort(property, orderDir);
7783
7433
  };
7784
- const handleRowCheckboxClick = useCallback2(
7785
- (event, keyFieldValue) => {
7786
- const selectedIndex = selected.indexOf(keyFieldValue);
7787
- let newSelected = [];
7788
- if (selectedIndex === -1) {
7789
- newSelected = newSelected.concat(selected, keyFieldValue);
7790
- } else if (selectedIndex === 0) {
7791
- newSelected = newSelected.concat(selected.slice(1));
7792
- } else if (selectedIndex === selected.length - 1) {
7793
- newSelected = newSelected.concat(selected.slice(0, -1));
7794
- } else if (selectedIndex > 0) {
7795
- newSelected = newSelected.concat(
7796
- selected.slice(0, selectedIndex),
7797
- selected.slice(selectedIndex + 1)
7798
- );
7799
- }
7800
- setSelected(newSelected);
7801
- },
7802
- [selected]
7803
- );
7804
- const renderTableRows = useMemo2(() => {
7805
- const sortedData = disableInternalSort ? data : stableSort2(data, getComparator(order, orderBy));
7806
- return sortedData.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage).map((row, index) => {
7807
- const isItemSelected = selected.includes(row[keyField]);
7808
- return /* @__PURE__ */ jsx114(
7809
- RenderItem,
7810
- {
7811
- ...{
7812
- ...row,
7813
- index,
7814
- deleteItem,
7815
- isItemSelected,
7816
- enableCheckboxSelection,
7817
- keyFieldValue: row[keyField],
7818
- handleRowCheckboxClick,
7819
- visibleHeadCells
7820
- }
7821
- },
7822
- row[keyField] ?? index
7823
- );
7824
- });
7825
- }, [
7826
- data,
7827
- order,
7828
- orderBy,
7829
- page,
7830
- rowsPerPage,
7831
- selected,
7832
- enableCheckboxSelection,
7833
- disableInternalSort,
7834
- deleteItem,
7835
- keyField,
7836
- handleRowCheckboxClick,
7837
- visibleHeadCells,
7838
- RenderItem
7839
- ]);
7840
- 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(
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(
7841
7436
  Skeleton3,
7842
7437
  {
7843
7438
  animation: "pulse",
7844
7439
  style: { margin: "8px", opacity: 0.4 },
7845
7440
  variant: "rectangular",
7846
- height: rowHeight,
7847
- "data-testid": "loading-skeleton"
7441
+ height: rowHeight
7848
7442
  },
7849
- uuidv42()
7850
- )) }) : /* @__PURE__ */ jsxs78(Fragment13, { children: [
7851
- /* @__PURE__ */ jsx114(TableContainer2, { className: classes.container, children: /* @__PURE__ */ jsxs78(
7443
+ Math.random()
7444
+ )) }) : /* @__PURE__ */ jsxs77(Fragment12, { children: [
7445
+ /* @__PURE__ */ jsx113(TableContainer2, { className: classes.container, children: /* @__PURE__ */ jsxs77(
7852
7446
  Table2,
7853
7447
  {
7854
7448
  "aria-labelledby": "tableTitle",
7855
7449
  "aria-label": "sticky table",
7856
7450
  stickyHeader: true,
7857
7451
  children: [
7858
- /* @__PURE__ */ jsx114(
7452
+ /* @__PURE__ */ jsx113(
7859
7453
  SmartTableHeader_default,
7860
7454
  {
7861
- headCells: visibleHeadCells,
7455
+ headCells,
7862
7456
  order,
7863
7457
  orderBy,
7864
- numSelected: selected.length,
7865
- numRows: data.length,
7866
- enableCheckboxSelection,
7867
- headerFilters: headerFilters ?? {},
7868
- onRequestSort: handleRequestSort,
7869
- onSelectAllClick: handleSelectAllClick,
7870
- onApplyFilters
7458
+ onRequestSort: handleRequestSort
7871
7459
  }
7872
7460
  ),
7873
- /* @__PURE__ */ jsx114(TableBody2, { children: rowsPerPage !== emptyRows ? renderTableRows : /* @__PURE__ */ jsx114(
7874
- TableEmptyResult_default,
7875
- {
7876
- colSpan: enableCheckboxSelection ? visibleHeadCells.length + 1 : visibleHeadCells.length,
7877
- showClearFilterButton,
7878
- handleClickOnClearFiltersButton
7879
- }
7880
- ) })
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
+ ] })
7881
7477
  ]
7882
7478
  }
7883
7479
  ) }),
@@ -7887,12 +7483,12 @@ var TableDesktop = ({
7887
7483
  var TableDesktop_default = TableDesktop;
7888
7484
 
7889
7485
  // src/components/TableHeader/TableHeader.tsx
7890
- import { memo as memo22, useEffect as useEffect9, useState as useState18 } from "react";
7486
+ import { memo as memo22, useEffect as useEffect9, useState as useState17 } from "react";
7891
7487
  import { ImportExport as ImportExportIcon } from "@mui/icons-material";
7892
7488
  import { TableCell as TableCell4, TableHead as TableHead3, TableRow as TableRow4, TableSortLabel as TableSortLabel3 } from "@mui/material";
7893
- import { makeStyles as makeStyles49 } from "tss-react/mui";
7894
- import { jsx as jsx115 } from "react/jsx-runtime";
7895
- var useStyles49 = makeStyles49()(() => ({
7489
+ import { makeStyles as makeStyles48 } from "tss-react/mui";
7490
+ import { jsx as jsx114 } from "react/jsx-runtime";
7491
+ var useStyles48 = makeStyles48()(() => ({
7896
7492
  sortLabel: {
7897
7493
  "& .MuiTableSortLabel-icon": {
7898
7494
  opacity: 1
@@ -7900,8 +7496,8 @@ var useStyles49 = makeStyles49()(() => ({
7900
7496
  }
7901
7497
  }));
7902
7498
  var TableHeader = ({ cells, onSort = null }) => {
7903
- const [sortableCells, setSortableCells] = useState18([]);
7904
- const { classes } = useStyles49();
7499
+ const [sortableCells, setSortableCells] = useState17([]);
7500
+ const { classes } = useStyles48();
7905
7501
  useEffect9(() => {
7906
7502
  setSortableCells(cells);
7907
7503
  }, []);
@@ -7936,7 +7532,7 @@ var TableHeader = ({ cells, onSort = null }) => {
7936
7532
  });
7937
7533
  setSortableCells(sortedCells);
7938
7534
  };
7939
- return /* @__PURE__ */ jsx115(TableHead3, { children: /* @__PURE__ */ jsx115(TableRow4, { children: sortableCells.map((cell, key) => /* @__PURE__ */ jsx115(TableCell4, { children: cell.isSortable ? /* @__PURE__ */ jsx115(
7535
+ return /* @__PURE__ */ jsx114(TableHead3, { children: /* @__PURE__ */ jsx114(TableRow4, { children: sortableCells.map((cell, key) => /* @__PURE__ */ jsx114(TableCell4, { children: cell.isSortable ? /* @__PURE__ */ jsx114(
7940
7536
  TableSortLabel3,
7941
7537
  {
7942
7538
  className: classes.sortLabel,
@@ -7950,10 +7546,10 @@ var TableHeader = ({ cells, onSort = null }) => {
7950
7546
  var TableHeader_default = memo22(TableHeader);
7951
7547
 
7952
7548
  // src/components/TextDivider/TextDivider.tsx
7953
- import { Box as Box31, Typography as Typography26, Divider as Divider10, Button as Button13 } from "@mui/material";
7954
- import { makeStyles as makeStyles50 } from "tss-react/mui";
7955
- import { jsx as jsx116, jsxs as jsxs79 } from "react/jsx-runtime";
7956
- var useStyles50 = makeStyles50()(() => ({
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()(() => ({
7957
7553
  icon: {
7958
7554
  fontSize: 20
7959
7555
  },
@@ -7987,20 +7583,20 @@ var TextDivider = ({
7987
7583
  iconPosition = "left",
7988
7584
  titleWeight = "400"
7989
7585
  }) => {
7990
- const { classes } = useStyles50();
7586
+ const { classes } = useStyles49();
7991
7587
  const iconColor = color ?? colors.neutral900;
7992
- return /* @__PURE__ */ jsxs79(
7993
- Box31,
7588
+ return /* @__PURE__ */ jsxs78(
7589
+ Box30,
7994
7590
  {
7995
7591
  display: "flex",
7996
7592
  alignItems: "center",
7997
7593
  justifyContent: "space-between",
7998
7594
  className: classes.container,
7999
7595
  children: [
8000
- /* @__PURE__ */ jsx116(Divider10, { className: classes.leftDivider }),
8001
- /* @__PURE__ */ jsx116(Button13, { onClick, disabled: !onClick, className: classes.button, children: /* @__PURE__ */ jsxs79(Box31, { className: classes.center, children: [
8002
- Icon3 && iconPosition === "left" && /* @__PURE__ */ jsx116(Icon3, { className: classes.icon, style: { color: iconColor } }),
8003
- /* @__PURE__ */ jsx116(
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(
8004
7600
  Typography26,
8005
7601
  {
8006
7602
  color: "textSecondary",
@@ -8009,9 +7605,9 @@ var TextDivider = ({
8009
7605
  children: title
8010
7606
  }
8011
7607
  ),
8012
- Icon3 && iconPosition === "right" && /* @__PURE__ */ jsx116(Icon3, { className: classes.icon, style: { color: iconColor } })
7608
+ Icon3 && iconPosition === "right" && /* @__PURE__ */ jsx115(Icon3, { className: classes.icon, style: { color: iconColor } })
8013
7609
  ] }) }),
8014
- /* @__PURE__ */ jsx116(Divider10, { className: classes.rightDivider })
7610
+ /* @__PURE__ */ jsx115(Divider9, { className: classes.rightDivider })
8015
7611
  ]
8016
7612
  }
8017
7613
  );
@@ -8020,11 +7616,11 @@ var TextDivider_default = TextDivider;
8020
7616
 
8021
7617
  // src/components/ThemedDateRangePicker/ThemedDateRangePicker.tsx
8022
7618
  import { DateRangePicker } from "react-dates";
8023
- import { makeStyles as makeStyles51 } from "tss-react/mui";
7619
+ import { makeStyles as makeStyles50 } from "tss-react/mui";
8024
7620
  import "react-dates/initialize";
8025
7621
  import "react-dates/lib/css/_datepicker.css";
8026
- import { jsx as jsx117 } from "react/jsx-runtime";
8027
- var useStyles51 = makeStyles51()((theme) => ({
7622
+ import { jsx as jsx116 } from "react/jsx-runtime";
7623
+ var useStyles50 = makeStyles50()((theme) => ({
8028
7624
  wrapper: {
8029
7625
  "& .DateRangePicker": {
8030
7626
  backgroundColor: theme.palette.mode === "dark" ? theme.palette.grey[900] : colors.neutral100,
@@ -8118,17 +7714,17 @@ var ThemedDateRangePicker = ({
8118
7714
  className,
8119
7715
  ...props
8120
7716
  }) => {
8121
- const { classes, cx } = useStyles51();
8122
- return /* @__PURE__ */ jsx117("div", { className: cx(classes.wrapper, className), children: /* @__PURE__ */ jsx117(DateRangePicker, { ...props }) });
7717
+ const { classes, cx } = useStyles50();
7718
+ return /* @__PURE__ */ jsx116("div", { className: cx(classes.wrapper, className), children: /* @__PURE__ */ jsx116(DateRangePicker, { ...props }) });
8123
7719
  };
8124
7720
  var ThemedDateRangePicker_default = ThemedDateRangePicker;
8125
7721
 
8126
7722
  // src/components/TheToolbar/TheToolbar.tsx
8127
7723
  import { memo as memo23 } from "react";
8128
- import { AppBar as AppBar2, Box as Box32, Toolbar as Toolbar2 } from "@mui/material";
8129
- import { makeStyles as makeStyles52 } from "tss-react/mui";
8130
- import { jsx as jsx118, jsxs as jsxs80 } from "react/jsx-runtime";
8131
- var useStyles52 = makeStyles52()((theme) => ({
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) => ({
8132
7728
  menuButton: {
8133
7729
  color: theme.palette.primary.contrastText
8134
7730
  },
@@ -8165,10 +7761,10 @@ var TheToolbar = ({
8165
7761
  handleOpen,
8166
7762
  LeftDrawer: LeftDrawer2
8167
7763
  }) => {
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(
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(
8172
7768
  RoundButton_default,
8173
7769
  {
8174
7770
  className: classes.menuButton,
@@ -8177,7 +7773,7 @@ var TheToolbar = ({
8177
7773
  onClick: handleOpen
8178
7774
  }
8179
7775
  ),
8180
- /* @__PURE__ */ jsx118(
7776
+ /* @__PURE__ */ jsx117(
8181
7777
  CompanyLogo_default,
8182
7778
  {
8183
7779
  size: "small",
@@ -8187,7 +7783,7 @@ var TheToolbar = ({
8187
7783
  }
8188
7784
  )
8189
7785
  ] }) }),
8190
- /* @__PURE__ */ jsx118(Box32, { className: classes.offset }),
7786
+ /* @__PURE__ */ jsx117(Box31, { className: classes.offset }),
8191
7787
  LeftDrawer2
8192
7788
  ] });
8193
7789
  };
@@ -8195,20 +7791,20 @@ var TheToolbar_default = memo23(TheToolbar);
8195
7791
 
8196
7792
  // src/components/ToastMessage/ToastMessage.tsx
8197
7793
  import { Alert as MuiAlert, Snackbar } from "@mui/material";
8198
- import { jsx as jsx119 } from "react/jsx-runtime";
7794
+ import { jsx as jsx118 } from "react/jsx-runtime";
8199
7795
  var ToastMessage = ({
8200
7796
  toastType,
8201
7797
  toastMessage,
8202
7798
  open,
8203
7799
  onClose
8204
- }) => /* @__PURE__ */ jsx119(
7800
+ }) => /* @__PURE__ */ jsx118(
8205
7801
  Snackbar,
8206
7802
  {
8207
7803
  open,
8208
7804
  autoHideDuration: 1500,
8209
7805
  onClose,
8210
7806
  anchorOrigin: { vertical: "top", horizontal: "right" },
8211
- children: /* @__PURE__ */ jsx119(
7807
+ children: /* @__PURE__ */ jsx118(
8212
7808
  MuiAlert,
8213
7809
  {
8214
7810
  elevation: 6,
@@ -8239,14 +7835,14 @@ import {
8239
7835
  Typography as Typography27,
8240
7836
  Dialog as Dialog5,
8241
7837
  Backdrop,
8242
- Box as Box33,
8243
- Divider as Divider11,
7838
+ Box as Box32,
7839
+ Divider as Divider10,
8244
7840
  Paper as Paper12,
8245
7841
  Fade as Fade2
8246
7842
  } from "@mui/material";
8247
- import { makeStyles as makeStyles53 } from "tss-react/mui";
8248
- import { jsx as jsx120, jsxs as jsxs81 } from "react/jsx-runtime";
8249
- var useStyles53 = makeStyles53()((theme) => ({
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) => ({
8250
7846
  paper: {
8251
7847
  padding: theme.spacing(2)
8252
7848
  },
@@ -8274,8 +7870,8 @@ var TwoButtonDialog = ({
8274
7870
  cancelLabel = "CANCEL",
8275
7871
  cancelButton
8276
7872
  }) => {
8277
- const { classes } = useStyles53();
8278
- return /* @__PURE__ */ jsx120(
7873
+ const { classes } = useStyles52();
7874
+ return /* @__PURE__ */ jsx119(
8279
7875
  Dialog5,
8280
7876
  {
8281
7877
  open,
@@ -8284,13 +7880,11 @@ var TwoButtonDialog = ({
8284
7880
  fullWidth: true,
8285
7881
  closeAfterTransition: true,
8286
7882
  BackdropComponent: Backdrop,
8287
- BackdropProps: {
8288
- timeout: 500
8289
- },
8290
- children: /* @__PURE__ */ jsx120(Fade2, { in: open, children: /* @__PURE__ */ jsxs81(Paper12, { className: classes.paper, children: [
8291
- /* @__PURE__ */ jsxs81(Box33, { className: classes.mb, children: [
8292
- /* @__PURE__ */ jsx120(Typography27, { variant: "h5", component: "div", children: /* @__PURE__ */ jsx120(
8293
- Box33,
7883
+ 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,
8294
7888
  {
8295
7889
  sx: {
8296
7890
  fontWeight: 600
@@ -8298,23 +7892,23 @@ var TwoButtonDialog = ({
8298
7892
  children: title
8299
7893
  }
8300
7894
  ) }),
8301
- /* @__PURE__ */ jsxs81(
8302
- Box33,
7895
+ /* @__PURE__ */ jsxs80(
7896
+ Box32,
8303
7897
  {
8304
7898
  className: classes.mt,
8305
7899
  sx: {
8306
7900
  fontWeight: 600
8307
7901
  },
8308
7902
  children: [
8309
- subtitle1 && /* @__PURE__ */ jsx120(Typography27, { variant: "subtitle1", children: subtitle1 }),
8310
- subtitle2 && /* @__PURE__ */ jsx120(Typography27, { variant: "subtitle1", children: subtitle2 })
7903
+ subtitle1 && /* @__PURE__ */ jsx119(Typography27, { variant: "subtitle1", children: subtitle1 }),
7904
+ subtitle2 && /* @__PURE__ */ jsx119(Typography27, { variant: "subtitle1", children: subtitle2 })
8311
7905
  ]
8312
7906
  }
8313
7907
  )
8314
7908
  ] }),
8315
- /* @__PURE__ */ jsx120(Divider11, {}),
8316
- /* @__PURE__ */ jsxs81(Box33, { className: classes.buttonContainer, children: [
8317
- /* @__PURE__ */ jsx120(
7909
+ /* @__PURE__ */ jsx119(Divider10, {}),
7910
+ /* @__PURE__ */ jsxs80(Box32, { className: classes.buttonContainer, children: [
7911
+ /* @__PURE__ */ jsx119(
8318
7912
  FilledButton_default,
8319
7913
  {
8320
7914
  copy: cancelLabel,
@@ -8327,7 +7921,7 @@ var TwoButtonDialog = ({
8327
7921
  }
8328
7922
  }
8329
7923
  ),
8330
- /* @__PURE__ */ jsx120(
7924
+ /* @__PURE__ */ jsx119(
8331
7925
  FilledButton_default,
8332
7926
  {
8333
7927
  color: "primary",
@@ -8336,7 +7930,7 @@ var TwoButtonDialog = ({
8336
7930
  }
8337
7931
  )
8338
7932
  ] }),
8339
- /* @__PURE__ */ jsx120(Loading_default, { isLoading: dialogLoading })
7933
+ /* @__PURE__ */ jsx119(Loading_default, { isLoading: dialogLoading })
8340
7934
  ] }) })
8341
7935
  }
8342
7936
  );
@@ -8344,10 +7938,10 @@ var TwoButtonDialog = ({
8344
7938
  var TwoButtonDialog_default = TwoButtonDialog;
8345
7939
 
8346
7940
  // src/components/icons/IconChart.tsx
8347
- import { jsx as jsx121 } from "react/jsx-runtime";
7941
+ import { jsx as jsx120 } from "react/jsx-runtime";
8348
7942
  var SvgIconChart = (props) => {
8349
7943
  const { fill } = props;
8350
- return /* @__PURE__ */ jsx121(
7944
+ return /* @__PURE__ */ jsx120(
8351
7945
  "svg",
8352
7946
  {
8353
7947
  width: "20",
@@ -8356,7 +7950,7 @@ var SvgIconChart = (props) => {
8356
7950
  fill: "none",
8357
7951
  xmlns: "http://www.w3.org/2000/svg",
8358
7952
  ...props,
8359
- children: /* @__PURE__ */ jsx121(
7953
+ children: /* @__PURE__ */ jsx120(
8360
7954
  "path",
8361
7955
  {
8362
7956
  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",
@@ -8427,7 +8021,6 @@ export {
8427
8021
  SectionName_default as SectionName,
8428
8022
  SmartSelect_default as SmartSelect,
8429
8023
  SmartTableHeader_default as SmartTableHeader,
8430
- SmartTableHeaderFilterMenu_default as SmartTableHeaderFilterMenu,
8431
8024
  SquareButton_default as SquareButton,
8432
8025
  SquareLabel_default as SquareLabel,
8433
8026
  Switch_default as Switch,