sag_components 2.0.0-beta192 → 2.0.0-beta194

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.
package/dist/index.js CHANGED
@@ -10589,23 +10589,24 @@ const QuarterPopupPicker = ({
10589
10589
  };
10590
10590
 
10591
10591
  /* eslint-disable import/no-extraneous-dependencies */
10592
- const QuarterPicker = ({
10593
- availableQuarters,
10594
- // ["Q1-2024"]
10595
- label,
10596
- onChange,
10597
- borderRadius,
10598
- required,
10599
- width,
10600
- height,
10601
- placeholder,
10602
- disabled,
10603
- borderColor,
10604
- borderColorFocus,
10605
- textColor,
10606
- selectedValue,
10607
- startYear
10608
- }) => {
10592
+ const QuarterPicker = _ref => {
10593
+ let {
10594
+ availableQuarters,
10595
+ // ["Q1-2024"]
10596
+ label,
10597
+ onChange,
10598
+ borderRadius,
10599
+ required,
10600
+ width,
10601
+ height,
10602
+ placeholder,
10603
+ disabled,
10604
+ borderColor,
10605
+ borderColorFocus,
10606
+ textColor,
10607
+ selectedValue,
10608
+ startYear
10609
+ } = _ref;
10609
10610
  const [isFocused, setIsFocused] = React$1.useState(false);
10610
10611
  const [isOpen, setIsOpen] = React$1.useState(false);
10611
10612
  const [value, setValue] = React$1.useState('');
@@ -11047,22 +11048,23 @@ const MonthPopupPicker = ({
11047
11048
  };
11048
11049
 
11049
11050
  /* eslint-disable import/no-extraneous-dependencies */
11050
- const MonthPicker = ({
11051
- availableMonths,
11052
- label,
11053
- onChange,
11054
- borderRadius,
11055
- required,
11056
- width,
11057
- height,
11058
- placeholder,
11059
- disabled,
11060
- borderColor,
11061
- borderColorFocus,
11062
- textColor,
11063
- selectedValue,
11064
- startYear
11065
- }) => {
11051
+ const MonthPicker = _ref => {
11052
+ let {
11053
+ availableMonths,
11054
+ label,
11055
+ onChange,
11056
+ borderRadius,
11057
+ required,
11058
+ width,
11059
+ height,
11060
+ placeholder,
11061
+ disabled,
11062
+ borderColor,
11063
+ borderColorFocus,
11064
+ textColor,
11065
+ selectedValue,
11066
+ startYear
11067
+ } = _ref;
11066
11068
  const [isFocused, setIsFocused] = React$1.useState(false);
11067
11069
  const [isOpen, setIsOpen] = React$1.useState(false);
11068
11070
  const [value, setValue] = React$1.useState('');
@@ -24173,21 +24175,22 @@ const DeleteIcon = styled__default["default"].div`
24173
24175
  position: absolute;
24174
24176
  `;
24175
24177
 
24176
- const QuickFilterDropdownSingle = ({
24177
- label,
24178
- hoverColor,
24179
- options,
24180
- selectedValue,
24181
- placeHolder,
24182
- onChange,
24183
- disabled,
24184
- width,
24185
- error,
24186
- errorMessage,
24187
- xIconShow,
24188
- labelColor,
24189
- showLabelOnTop
24190
- }) => {
24178
+ const QuickFilterDropdownSingle = _ref => {
24179
+ let {
24180
+ label,
24181
+ hoverColor,
24182
+ options,
24183
+ selectedValue,
24184
+ placeHolder,
24185
+ onChange,
24186
+ disabled,
24187
+ width,
24188
+ error,
24189
+ errorMessage,
24190
+ xIconShow,
24191
+ labelColor,
24192
+ showLabelOnTop
24193
+ } = _ref;
24191
24194
  const [isFocused, setIsFocused] = React$1.useState(false);
24192
24195
  const [showOptions, setShowOptions] = React$1.useState(false);
24193
24196
  const [inputValue, setInputValue] = React$1.useState("");
@@ -24584,23 +24587,24 @@ const IconContainer$2 = styled__default["default"].div`
24584
24587
  cursor: pointer;
24585
24588
  `;
24586
24589
 
24587
- const QuickFilterDropdownMultiSelection = ({
24588
- label,
24589
- labelEmptyValue,
24590
- options,
24591
- selectedValue,
24592
- placeHolder,
24593
- onChange,
24594
- required,
24595
- disabled,
24596
- width,
24597
- error,
24598
- errorMessage,
24599
- labelColor,
24600
- xIconShow,
24601
- checkBoxColor,
24602
- showLabelOnTop
24603
- }) => {
24590
+ const QuickFilterDropdownMultiSelection = _ref => {
24591
+ let {
24592
+ label,
24593
+ labelEmptyValue,
24594
+ options,
24595
+ selectedValue,
24596
+ placeHolder,
24597
+ onChange,
24598
+ required,
24599
+ disabled,
24600
+ width,
24601
+ error,
24602
+ errorMessage,
24603
+ labelColor,
24604
+ xIconShow,
24605
+ checkBoxColor,
24606
+ showLabelOnTop
24607
+ } = _ref;
24604
24608
  const [isFocused, setIsFocused] = React$1.useState(false);
24605
24609
  const [showOptions, setShowOptions] = React$1.useState(false);
24606
24610
  const [inputValue, setInputValue] = React$1.useState('');
@@ -35931,9 +35935,9 @@ const ToggleSlider = styled__default["default"].span`
35931
35935
  }
35932
35936
  `;
35933
35937
 
35934
- /**
35935
- * ToggleSwitch component for on/off states.
35936
- * Supports small/large sizes and disabled state.
35938
+ /**
35939
+ * ToggleSwitch component for on/off states.
35940
+ * Supports small/large sizes and disabled state.
35937
35941
  */
35938
35942
  function ToggleSwitch(_ref) {
35939
35943
  let {
@@ -39932,341 +39936,423 @@ const TableBody = /*#__PURE__*/React$1.forwardRef(({
39932
39936
  return tag.replace(/-/g, " ").replace(/\b\w/g, l => l.toUpperCase());
39933
39937
  };
39934
39938
  const formatValue = (value, column, row, rowIndex) => {
39935
- if ((value === null || value === undefined) && column?.fieldType?.toLowerCase() !== "comments") {
39939
+ // Add safety checks at the start
39940
+ if (!column) {
39941
+ console.warn('formatValue called with null/undefined column');
39936
39942
  return "";
39937
39943
  }
39938
-
39939
- // Find the tooltip text for the current value - can be used for different fieldTypes
39940
- const getTooltipText = value => {
39941
- if (column?.tooltipText && Array.isArray(column.tooltipText)) {
39942
- const tooltipItem = column.tooltipText.find(item => item.value === value);
39943
- return tooltipItem ? tooltipItem.label : null;
39944
+ try {
39945
+ if ((value === null || value === undefined) && column?.fieldType?.toLowerCase() !== "comments") {
39946
+ return "";
39944
39947
  }
39945
- return null;
39946
- };
39947
- switch (column?.fieldType?.toLowerCase()) {
39948
- case "currency":
39949
- if (column.format === "$0.00") {
39950
- return `$${parseFloat(value || 0).toFixed(2)}`;
39951
- }
39952
- return value;
39953
- case "text":
39954
- return value?.toString() || "";
39955
- case "number":
39956
- if (column.format && column.format.includes(",")) {
39957
- return (value || 0).toLocaleString();
39948
+
39949
+ // Find the tooltip text for the current value - can be used for different fieldTypes
39950
+ const getTooltipText = value => {
39951
+ try {
39952
+ if (column?.tooltipText && Array.isArray(column.tooltipText)) {
39953
+ const tooltipItem = column.tooltipText.find(item => item && item.value === value);
39954
+ return tooltipItem ? tooltipItem.label : null;
39955
+ }
39956
+ return null;
39957
+ } catch (e) {
39958
+ console.warn('Error in getTooltipText:', e);
39959
+ return null;
39958
39960
  }
39959
- return value;
39960
- case "percentage":
39961
- return `${value || 0}%`;
39962
- case "date":
39963
- if (column.format === "MM/DD/YYYY" && value) {
39961
+ };
39962
+ const fieldType = column?.fieldType?.toLowerCase() || 'text';
39963
+ switch (fieldType) {
39964
+ case "currency":
39964
39965
  try {
39965
- const date = new Date(value);
39966
- return `${(date.getMonth() + 1)?.toString().padStart(2, "0")}/${date.getDate()?.toString().padStart(2, "0")}/${date.getFullYear()}`;
39966
+ if (column.format === "$0.00") {
39967
+ const numValue = parseFloat(value || 0);
39968
+ return `${isNaN(numValue) ? '0.00' : numValue.toFixed(2)}`;
39969
+ }
39970
+ return String(value || "");
39967
39971
  } catch (e) {
39968
- console.warn("Invalid date format:", value);
39969
- return value;
39972
+ console.warn('Error formatting currency:', e);
39973
+ return String(value || "");
39970
39974
  }
39971
- }
39972
- return value;
39973
- case "boolean":
39974
- return value ? "Yes" : "No";
39975
- case "array":
39976
- if (Array.isArray(value)) {
39977
- return value.join(", ");
39978
- }
39979
- return value;
39980
- case "tag":
39981
- if (!value) return "";
39982
- const tagConfig = column.tagConfig || {};
39983
- const colors = tagConfig.colors || {};
39984
- const defaultColor = tagConfig.defaultColor || {
39985
- bg: "#F3F4F6",
39986
- text: "#374151",
39987
- border: "#9CA3AF"
39988
- };
39989
- const maxDisplay = tagConfig.maxDisplay || 3;
39990
- const isMultiple = tagConfig.multiple !== false; // Default to true
39991
-
39992
- // Helper function to create a tag chip with proper tooltip
39993
- const createTagChip = (tagValue, index = 0) => {
39994
- const colorConfig = colors[tagValue] || defaultColor;
39995
- const formattedText = formatTagText(tagValue);
39996
- return /*#__PURE__*/React__default["default"].createElement(TagChip, {
39997
- key: `${tagValue}-${index}`,
39998
- $backgroundColor: colorConfig.bg,
39999
- $textColor: colorConfig.text,
40000
- $borderColor: colorConfig.border,
40001
- $interactive: false,
40002
- title: formattedText // Always show full text in tooltip
40003
- }, /*#__PURE__*/React__default["default"].createElement(TagChipTextWrapper, null, formattedText));
40004
- };
40005
-
40006
- // Handle single tag
40007
- if (typeof value === "string") {
40008
- return /*#__PURE__*/React__default["default"].createElement(TagContainer, null, createTagChip(value));
40009
- }
40010
-
40011
- // Handle multiple tags
40012
- if (Array.isArray(value) && isMultiple) {
40013
- const visibleTags = value.slice(0, maxDisplay);
40014
- const remainingCount = value.length - maxDisplay;
40015
- return /*#__PURE__*/React__default["default"].createElement(TagContainer, null, /*#__PURE__*/React__default["default"].createElement(MultiTagWrapper, null, visibleTags.map((tag, index) => createTagChip(tag, index)), remainingCount > 0 && /*#__PURE__*/React__default["default"].createElement(TagOverflow, {
40016
- title: `${remainingCount} more: ${value.slice(maxDisplay).map(tag => formatTagText(tag)).join(", ")}`
40017
- }, "+", remainingCount)));
40018
- }
40019
-
40020
- // Fallback for array treated as single tag
40021
- if (Array.isArray(value)) {
40022
- return formatValue(value[0], column, row, rowIndex);
40023
- }
40024
- return value;
40025
- case "packagestatus":
40026
- // Helper function to apply tooltip logic
40027
- const applyTooltipLogic = (element, tooltipText) => {
40028
- if (element && tooltipText && tooltipText.trim() !== "") {
40029
- try {
40030
- const rect = element.getBoundingClientRect();
40031
- const {
40032
- offset,
40033
- height
40034
- } = calculateTooltipOffset(tooltipText);
40035
- element.style.setProperty("--tooltip-top", `${rect.top}px`);
40036
- element.style.setProperty("--tooltip-left", `${rect.left}px`);
40037
- element.style.setProperty("--tooltip-width", `${rect.width}px`);
40038
- element.style.setProperty("--tooltip-offset", `${offset}px`);
40039
- element.style.setProperty("--tooltip-height", `${height}px`);
40040
- element.setAttribute("data-tooltip", tooltipText);
40041
- } catch (e) {
40042
- console.warn("Error applying tooltip:", e);
39975
+ case "text":
39976
+ return String(value || "");
39977
+ case "number":
39978
+ try {
39979
+ if (column.format && column.format.includes(",")) {
39980
+ const numValue = Number(value || 0);
39981
+ return isNaN(numValue) ? String(value || "") : numValue.toLocaleString();
40043
39982
  }
39983
+ return String(value || "");
39984
+ } catch (e) {
39985
+ console.warn('Error formatting number:', e);
39986
+ return String(value || "");
40044
39987
  }
40045
- };
40046
- const tooltipText = getTooltipText(value);
40047
- const lowerValue = value?.toLowerCase();
40048
- if (lowerValue === "empty") {
40049
- return /*#__PURE__*/React__default["default"].createElement(ButtonWrapper, {
40050
- ref: el => applyTooltipLogic(el, tooltipText)
40051
- }, /*#__PURE__*/React__default["default"].createElement(Button$1, {
40052
- leftIcon: "Fly",
40053
- text: "Send",
40054
- borderRadius: "8px",
40055
- backgroundColor: "#FFF",
40056
- textColor: "#B1B1B1",
40057
- borderColor: "#D9D9D9",
40058
- hoverTextColor: "#B1B1B1",
40059
- hoverBackgroundColor: "#E6F0F0",
40060
- hoverBorderColor: "#D9D9D9",
40061
- disabledTextColor: "#B1B1B1",
40062
- disabledBackgroundColor: focusedRowIndex === rowIndex ? "#D1E7E7" : hoveredRowIndex === rowIndex ? "#E6F0F0" : "#FFF",
40063
- disabledBorderColor: "#D9D9D9",
40064
- width: "100px",
40065
- height: "32px",
40066
- disabled: true
40067
- }));
40068
- } else if (lowerValue === "draft") {
40069
- return /*#__PURE__*/React__default["default"].createElement(ButtonWrapper, {
40070
- ref: el => applyTooltipLogic(el, tooltipText)
40071
- }, /*#__PURE__*/React__default["default"].createElement(Button$1, {
40072
- leftIcon: "Fly",
40073
- text: "Send",
40074
- borderRadius: "8px",
40075
- backgroundColor: focusedRowIndex === rowIndex ? "#D1E7E7" : hoveredRowIndex === rowIndex ? "#E6F0F0" : "#FFF",
40076
- textColor: buttonColor,
40077
- borderColor: buttonColor,
40078
- hoverTextColor: buttonColor,
40079
- hoverBorderColor: buttonColor,
40080
- hoverBackgroundColor: "#E6F0F0",
40081
- activeBackgroundColor: "#D1E7E7",
40082
- width: "100px",
40083
- height: "32px",
40084
- onClick: e => {
40085
- e.stopPropagation();
40086
- onSendClick && onSendClick(row);
40087
- }
40088
- }));
40089
- } else if (lowerValue === "sent") {
40090
- return /*#__PURE__*/React__default["default"].createElement(SentStatus, {
40091
- ref: el => applyTooltipLogic(el, tooltipText)
40092
- }, /*#__PURE__*/React__default["default"].createElement(OkIcon, {
40093
- width: "24",
40094
- height: "24",
40095
- color: "#5FCC70"
40096
- }), /*#__PURE__*/React__default["default"].createElement("span", null, "All Sent"));
40097
- }
40098
- return value;
40099
- case "status":
40100
- const statusObj = statuses.find(status => status.status === value) || {};
40101
- const [palette0, palette1] = statusObj.palette || ["#F3F4F6", "#374151"];
40102
- return /*#__PURE__*/React__default["default"].createElement(StatusCell$1, {
40103
- color: palette1
40104
- }, /*#__PURE__*/React__default["default"].createElement(StatusCellCircle, {
40105
- backgroundColor: palette0
40106
- }), /*#__PURE__*/React__default["default"].createElement("span", null, value));
40107
- case "comments":
40108
- const commentTextValue = value || "";
40109
- const hasComments = commentTextValue.trim().length > 0;
40110
-
40111
- // Truncate tooltip text if longer than 150 characters
40112
- const commentTooltipText = commentTextValue.length > 150 ? commentTextValue.substring(0, 147) + "..." : commentTextValue;
40113
- return /*#__PURE__*/React__default["default"].createElement(CommentIconWrapper, {
40114
- $buttonColor: buttonColor,
40115
- ref: el => {
40116
- if (el) {
40117
- try {
40118
- if (hasComments) {
40119
- // Add tooltip if there are comments
40120
- const rect = el.getBoundingClientRect();
40121
- const {
40122
- offset,
40123
- height
40124
- } = calculateTooltipOffset(commentTooltipText);
40125
- el.style.setProperty("--tooltip-top", `${rect.top}px`);
40126
- el.style.setProperty("--tooltip-left", `${rect.left}px`);
40127
- el.style.setProperty("--tooltip-width", `${rect.width}px`);
40128
- el.style.setProperty("--tooltip-offset", `${offset}px`);
40129
- el.style.setProperty("--tooltip-height", `${height}px`);
40130
- el.setAttribute("data-tooltip", commentTooltipText);
40131
- } else {
40132
- // Remove tooltip if there are no comments
40133
- el.removeAttribute("data-tooltip");
40134
- el.style.removeProperty("--tooltip-top");
40135
- el.style.removeProperty("--tooltip-left");
40136
- el.style.removeProperty("--tooltip-width");
40137
- el.style.removeProperty("--tooltip-offset");
40138
- el.style.removeProperty("--tooltip-height");
40139
- }
40140
- } catch (e) {
40141
- console.warn("Error handling comment tooltip:", e);
39988
+ case "percentage":
39989
+ return `${value || 0}%`;
39990
+ case "date":
39991
+ try {
39992
+ if (column.format === "MM/DD/YYYY" && value) {
39993
+ const date = new Date(value);
39994
+ if (isNaN(date.getTime())) {
39995
+ return String(value);
40142
39996
  }
39997
+ return `${(date.getMonth() + 1).toString().padStart(2, "0")}/${date.getDate().toString().padStart(2, "0")}/${date.getFullYear()}`;
40143
39998
  }
40144
- },
40145
- onClick: e => {
40146
- e.stopPropagation();
40147
- setCurrentCommentRow(rowIndex);
40148
- setIsCommentModalOpen(true);
39999
+ return String(value || "");
40000
+ } catch (e) {
40001
+ console.warn('Error formatting date:', e);
40002
+ return String(value || "");
40149
40003
  }
40150
- }, /*#__PURE__*/React__default["default"].createElement(CommentIcon, {
40151
- showCircle: hasComments,
40152
- circleColor: buttonColor
40153
- }));
40154
- case "trash":
40155
- // Only show trash icon when row is hovered
40156
- if (hoveredRowIndex !== rowIndex) {
40157
- return null;
40158
- }
40159
- const trashTooltipText = getTooltipText(value);
40160
- if (value === "ENABLED") {
40161
- return /*#__PURE__*/React__default["default"].createElement(TrashIconWrapper$1, {
40162
- $buttonColor: buttonColor,
40163
- ref: el => {
40164
- if (el && trashTooltipText) {
40004
+ case "boolean":
40005
+ return value ? "Yes" : "No";
40006
+ case "array":
40007
+ try {
40008
+ if (Array.isArray(value)) {
40009
+ return value.join(", ");
40010
+ }
40011
+ return String(value || "");
40012
+ } catch (e) {
40013
+ console.warn('Error formatting array:', e);
40014
+ return String(value || "");
40015
+ }
40016
+ case "tag":
40017
+ try {
40018
+ if (!value) return "";
40019
+ const tagConfig = column.tagConfig || {};
40020
+ const colors = tagConfig.colors || {};
40021
+ const defaultColor = tagConfig.defaultColor || {
40022
+ bg: "#F3F4F6",
40023
+ text: "#374151",
40024
+ border: "#9CA3AF"
40025
+ };
40026
+ const maxDisplay = tagConfig.maxDisplay || 3;
40027
+ const isMultiple = tagConfig.multiple !== false;
40028
+ const createTagChip = (tagValue, index = 0) => {
40029
+ const colorConfig = colors[tagValue] || defaultColor;
40030
+ const formattedText = formatTagText(tagValue);
40031
+ return /*#__PURE__*/React__default["default"].createElement(TagChip, {
40032
+ key: `${tagValue}-${index}`,
40033
+ $backgroundColor: colorConfig.bg,
40034
+ $textColor: colorConfig.text,
40035
+ $borderColor: colorConfig.border,
40036
+ $interactive: false,
40037
+ title: formattedText
40038
+ }, /*#__PURE__*/React__default["default"].createElement(TagChipTextWrapper, null, formattedText));
40039
+ };
40040
+ if (typeof value === "string") {
40041
+ return /*#__PURE__*/React__default["default"].createElement(TagContainer, null, createTagChip(value));
40042
+ }
40043
+ if (Array.isArray(value) && isMultiple) {
40044
+ const visibleTags = value.slice(0, maxDisplay);
40045
+ const remainingCount = value.length - maxDisplay;
40046
+ return /*#__PURE__*/React__default["default"].createElement(TagContainer, null, /*#__PURE__*/React__default["default"].createElement(MultiTagWrapper, null, visibleTags.map((tag, index) => createTagChip(tag, index)), remainingCount > 0 && /*#__PURE__*/React__default["default"].createElement(TagOverflow, {
40047
+ title: `${remainingCount} more: ${value.slice(maxDisplay).map(tag => formatTagText(tag)).join(", ")}`
40048
+ }, "+", remainingCount)));
40049
+ }
40050
+ if (Array.isArray(value)) {
40051
+ return formatValue(value[0], column, row, rowIndex);
40052
+ }
40053
+ return String(value || "");
40054
+ } catch (e) {
40055
+ console.warn('Error formatting tag:', e);
40056
+ return String(value || "");
40057
+ }
40058
+ case "packagestatus":
40059
+ try {
40060
+ const applyTooltipLogic = (element, tooltipText) => {
40061
+ if (element && tooltipText && tooltipText.trim() !== "") {
40165
40062
  try {
40166
- const rect = el.getBoundingClientRect();
40167
- const {
40168
- offset,
40169
- height
40170
- } = calculateTooltipOffset(trashTooltipText);
40171
- el.style.setProperty("--tooltip-top", `${rect.top}px`);
40172
- el.style.setProperty("--tooltip-left", `${rect.left}px`);
40173
- el.style.setProperty("--tooltip-width", `${rect.width}px`);
40174
- el.style.setProperty("--tooltip-offset", `${offset}px`);
40175
- el.style.setProperty("--tooltip-height", `${height}px`);
40176
- el.setAttribute("data-tooltip", trashTooltipText);
40063
+ const rect = element.getBoundingClientRect();
40064
+ if (rect.width > 0 && rect.height > 0) {
40065
+ const tooltipInfo = calculateTooltipOffset(tooltipText);
40066
+ if (tooltipInfo) {
40067
+ const {
40068
+ offset,
40069
+ height
40070
+ } = tooltipInfo;
40071
+ element.style.setProperty("--tooltip-top", `${rect.top}px`);
40072
+ element.style.setProperty("--tooltip-left", `${rect.left}px`);
40073
+ element.style.setProperty("--tooltip-width", `${rect.width}px`);
40074
+ element.style.setProperty("--tooltip-offset", `${offset}px`);
40075
+ element.style.setProperty("--tooltip-height", `${height}px`);
40076
+ element.setAttribute("data-tooltip", tooltipText);
40077
+ }
40078
+ }
40177
40079
  } catch (e) {
40178
- console.warn("Error handling trash tooltip:", e);
40080
+ console.warn("Error applying tooltip:", e);
40179
40081
  }
40180
40082
  }
40181
- },
40182
- onClick: e => {
40183
- e.stopPropagation();
40184
- onDeleteClick && onDeleteClick(row);
40083
+ };
40084
+ const tooltipText = getTooltipText(value);
40085
+ // Handle array values (like PackageStatusName)
40086
+ const processedValue = Array.isArray(value) ? value[0] : value;
40087
+ const lowerValue = String(processedValue || "").toLowerCase();
40088
+ if (lowerValue === "empty") {
40089
+ return /*#__PURE__*/React__default["default"].createElement(ButtonWrapper, {
40090
+ ref: el => applyTooltipLogic(el, tooltipText)
40091
+ }, /*#__PURE__*/React__default["default"].createElement(Button$1, {
40092
+ leftIcon: "Fly",
40093
+ text: "Send",
40094
+ borderRadius: "8px",
40095
+ backgroundColor: "#FFF",
40096
+ textColor: "#B1B1B1",
40097
+ borderColor: "#D9D9D9",
40098
+ hoverTextColor: "#B1B1B1",
40099
+ hoverBackgroundColor: "#E6F0F0",
40100
+ hoverBorderColor: "#D9D9D9",
40101
+ disabledTextColor: "#B1B1B1",
40102
+ disabledBackgroundColor: focusedRowIndex === rowIndex ? "#D1E7E7" : hoveredRowIndex === rowIndex ? "#E6F0F0" : "#FFF",
40103
+ disabledBorderColor: "#D9D9D9",
40104
+ width: "100px",
40105
+ height: "32px",
40106
+ disabled: true
40107
+ }));
40108
+ } else if (lowerValue === "draft") {
40109
+ return /*#__PURE__*/React__default["default"].createElement(ButtonWrapper, {
40110
+ ref: el => applyTooltipLogic(el, tooltipText)
40111
+ }, /*#__PURE__*/React__default["default"].createElement(Button$1, {
40112
+ leftIcon: "Fly",
40113
+ text: "Send",
40114
+ borderRadius: "8px",
40115
+ backgroundColor: focusedRowIndex === rowIndex ? "#D1E7E7" : hoveredRowIndex === rowIndex ? "#E6F0F0" : "#FFF",
40116
+ textColor: buttonColor,
40117
+ borderColor: buttonColor,
40118
+ hoverTextColor: buttonColor,
40119
+ hoverBorderColor: buttonColor,
40120
+ hoverBackgroundColor: "#E6F0F0",
40121
+ activeBackgroundColor: "#D1E7E7",
40122
+ width: "100px",
40123
+ height: "32px",
40124
+ onClick: e => {
40125
+ e.stopPropagation();
40126
+ onSendClick && onSendClick(row);
40127
+ }
40128
+ }));
40129
+ } else if (lowerValue === "sent") {
40130
+ return /*#__PURE__*/React__default["default"].createElement(SentStatus, {
40131
+ ref: el => applyTooltipLogic(el, tooltipText)
40132
+ }, /*#__PURE__*/React__default["default"].createElement(OkIcon, {
40133
+ width: "24",
40134
+ height: "24",
40135
+ color: "#5FCC70"
40136
+ }), /*#__PURE__*/React__default["default"].createElement("span", null, "All Sent"));
40185
40137
  }
40186
- }, /*#__PURE__*/React__default["default"].createElement(TrashIcon, {
40187
- width: "14",
40188
- height: "18"
40189
- }));
40190
- } else if (value === "DISABLED") {
40191
- return /*#__PURE__*/React__default["default"].createElement(DisabledTrashIconWrapper$1, {
40192
- ref: el => {
40193
- if (el && trashTooltipText) {
40194
- try {
40195
- const rect = el.getBoundingClientRect();
40196
- const {
40197
- offset,
40198
- height
40199
- } = calculateTooltipOffset(trashTooltipText);
40200
- el.style.setProperty("--tooltip-top", `${rect.top}px`);
40201
- el.style.setProperty("--tooltip-left", `${rect.left}px`);
40202
- el.style.setProperty("--tooltip-width", `${rect.width}px`);
40203
- el.style.setProperty("--tooltip-offset", `${offset}px`);
40204
- el.style.setProperty("--tooltip-height", `${height}px`);
40205
- el.setAttribute("data-tooltip", trashTooltipText);
40206
- } catch (e) {
40207
- console.warn("Error handling disabled trash tooltip:", e);
40138
+ return String(processedValue || "");
40139
+ } catch (e) {
40140
+ console.warn('Error formatting packagestatus:', e);
40141
+ return String(value || "");
40142
+ }
40143
+ case "status":
40144
+ try {
40145
+ const statusObj = statuses.find(status => status && status.status === value) || {};
40146
+ const palette = statusObj.palette || ["#F3F4F6", "#374151"];
40147
+ const [palette0, palette1] = palette;
40148
+ return /*#__PURE__*/React__default["default"].createElement(StatusCell$1, {
40149
+ color: palette1
40150
+ }, /*#__PURE__*/React__default["default"].createElement(StatusCellCircle, {
40151
+ backgroundColor: palette0
40152
+ }), /*#__PURE__*/React__default["default"].createElement("span", null, String(value || "")));
40153
+ } catch (e) {
40154
+ console.warn('Error formatting status:', e);
40155
+ return String(value || "");
40156
+ }
40157
+ case "comments":
40158
+ try {
40159
+ const commentTextValue = String(value || "");
40160
+ const hasComments = commentTextValue.trim().length > 0;
40161
+ const commentTooltipText = commentTextValue.length > 150 ? commentTextValue.substring(0, 147) + "..." : commentTextValue;
40162
+ return /*#__PURE__*/React__default["default"].createElement(CommentIconWrapper, {
40163
+ $buttonColor: buttonColor,
40164
+ ref: el => {
40165
+ if (el) {
40166
+ try {
40167
+ if (hasComments) {
40168
+ const rect = el.getBoundingClientRect();
40169
+ if (rect.width > 0 && rect.height > 0) {
40170
+ const tooltipInfo = calculateTooltipOffset(commentTooltipText);
40171
+ if (tooltipInfo) {
40172
+ const {
40173
+ offset,
40174
+ height
40175
+ } = tooltipInfo;
40176
+ el.style.setProperty("--tooltip-top", `${rect.top}px`);
40177
+ el.style.setProperty("--tooltip-left", `${rect.left}px`);
40178
+ el.style.setProperty("--tooltip-width", `${rect.width}px`);
40179
+ el.style.setProperty("--tooltip-offset", `${offset}px`);
40180
+ el.style.setProperty("--tooltip-height", `${height}px`);
40181
+ el.setAttribute("data-tooltip", commentTooltipText);
40182
+ }
40183
+ }
40184
+ } else {
40185
+ el.removeAttribute("data-tooltip");
40186
+ el.style.removeProperty("--tooltip-top");
40187
+ el.style.removeProperty("--tooltip-left");
40188
+ el.style.removeProperty("--tooltip-width");
40189
+ el.style.removeProperty("--tooltip-offset");
40190
+ el.style.removeProperty("--tooltip-height");
40191
+ }
40192
+ } catch (e) {
40193
+ console.warn("Error handling comment tooltip:", e);
40194
+ }
40208
40195
  }
40196
+ },
40197
+ onClick: e => {
40198
+ e.stopPropagation();
40199
+ setCurrentCommentRow(rowIndex);
40200
+ setIsCommentModalOpen(true);
40209
40201
  }
40202
+ }, /*#__PURE__*/React__default["default"].createElement(CommentIcon, {
40203
+ showCircle: hasComments,
40204
+ circleColor: buttonColor
40205
+ }));
40206
+ } catch (e) {
40207
+ console.warn('Error formatting comments:', e);
40208
+ return String(value || "");
40209
+ }
40210
+ case "trash":
40211
+ try {
40212
+ if (hoveredRowIndex !== rowIndex) {
40213
+ return null;
40210
40214
  }
40211
- }, /*#__PURE__*/React__default["default"].createElement(DisabledTrashIcon, {
40212
- width: "22",
40213
- height: "22"
40214
- }));
40215
- }
40216
- return null;
40217
- case "dropdown":
40218
- if (!column) return null;
40219
- const dropdownKey = `${rowIndex}-${column.key}`;
40220
- const isOpen = openDropdowns[dropdownKey] || false;
40221
- const dropdownOptions = column.dropdownOptions || [];
40222
- const maxDropdownHeight = column.maxDropdownHeight || "200px";
40223
- const dropdownOptionsWidth = column.dropdownOptionsWidth;
40224
- const dropdownOptionsAlignment = column.dropdownOptionsAlignment || "right";
40225
- const placeholder = column.placeholder || "Select...";
40226
-
40227
- // Find the current selected option to display its label
40228
- const currentOption = dropdownOptions.find(option => option.value === value);
40229
- const displayText = currentOption ? currentOption.label : value || placeholder;
40230
- return /*#__PURE__*/React__default["default"].createElement(Dropdown, {
40231
- isOpen: isOpen,
40232
- options: dropdownOptions,
40233
- selectedValue: value,
40234
- displayText: displayText,
40235
- onToggle: e => handleDropdownClick(rowIndex, column.key, e),
40236
- onOptionSelect: (option, e) => handleDropdownOptionClick(row, rowIndex, column.key, option, e),
40237
- maxDropdownHeight: maxDropdownHeight,
40238
- dropdownOptionsWidth: dropdownOptionsWidth,
40239
- dropdownOptionsAlignment: dropdownOptionsAlignment,
40240
- placeholder: placeholder,
40241
- isRowFocused: focusedRowIndex === rowIndex,
40242
- isRowHovered: hoveredRowIndex === rowIndex,
40243
- selectedColor: selectedColor
40244
- });
40245
- case "checkbox":
40246
- const isChecked = Boolean(value);
40247
- return /*#__PURE__*/React__default["default"].createElement("div", {
40248
- style: {
40249
- display: "flex",
40250
- alignItems: "center",
40251
- justifyContent: "center",
40252
- width: "100%",
40253
- height: "100%"
40215
+ const trashTooltipText = getTooltipText(value);
40216
+ const processedValue = String(value || "").toUpperCase();
40217
+ if (processedValue === "ENABLED") {
40218
+ return /*#__PURE__*/React__default["default"].createElement(TrashIconWrapper$1, {
40219
+ $buttonColor: buttonColor,
40220
+ ref: el => {
40221
+ if (el && trashTooltipText) {
40222
+ try {
40223
+ const rect = el.getBoundingClientRect();
40224
+ if (rect.width > 0 && rect.height > 0) {
40225
+ const tooltipInfo = calculateTooltipOffset(trashTooltipText);
40226
+ if (tooltipInfo) {
40227
+ const {
40228
+ offset,
40229
+ height
40230
+ } = tooltipInfo;
40231
+ el.style.setProperty("--tooltip-top", `${rect.top}px`);
40232
+ el.style.setProperty("--tooltip-left", `${rect.left}px`);
40233
+ el.style.setProperty("--tooltip-width", `${rect.width}px`);
40234
+ el.style.setProperty("--tooltip-offset", `${offset}px`);
40235
+ el.style.setProperty("--tooltip-height", `${height}px`);
40236
+ el.setAttribute("data-tooltip", trashTooltipText);
40237
+ }
40238
+ }
40239
+ } catch (e) {
40240
+ console.warn("Error handling trash tooltip:", e);
40241
+ }
40242
+ }
40243
+ },
40244
+ onClick: e => {
40245
+ e.stopPropagation();
40246
+ onDeleteClick && onDeleteClick(row);
40247
+ }
40248
+ }, /*#__PURE__*/React__default["default"].createElement(TrashIcon, {
40249
+ width: "14",
40250
+ height: "18"
40251
+ }));
40252
+ } else if (processedValue === "DISABLED") {
40253
+ return /*#__PURE__*/React__default["default"].createElement(DisabledTrashIconWrapper$1, {
40254
+ ref: el => {
40255
+ if (el && trashTooltipText) {
40256
+ try {
40257
+ const rect = el.getBoundingClientRect();
40258
+ if (rect.width > 0 && rect.height > 0) {
40259
+ const tooltipInfo = calculateTooltipOffset(trashTooltipText);
40260
+ if (tooltipInfo) {
40261
+ const {
40262
+ offset,
40263
+ height
40264
+ } = tooltipInfo;
40265
+ el.style.setProperty("--tooltip-top", `${rect.top}px`);
40266
+ el.style.setProperty("--tooltip-left", `${rect.left}px`);
40267
+ el.style.setProperty("--tooltip-width", `${rect.width}px`);
40268
+ el.style.setProperty("--tooltip-offset", `${offset}px`);
40269
+ el.style.setProperty("--tooltip-height", `${height}px`);
40270
+ el.setAttribute("data-tooltip", trashTooltipText);
40271
+ }
40272
+ }
40273
+ } catch (e) {
40274
+ console.warn("Error handling disabled trash tooltip:", e);
40275
+ }
40276
+ }
40277
+ }
40278
+ }, /*#__PURE__*/React__default["default"].createElement(DisabledTrashIcon, {
40279
+ width: "22",
40280
+ height: "22"
40281
+ }));
40282
+ }
40283
+ return null;
40284
+ } catch (e) {
40285
+ console.warn('Error formatting trash:', e);
40286
+ return null;
40254
40287
  }
40255
- }, /*#__PURE__*/React__default["default"].createElement("input", {
40256
- type: "checkbox",
40257
- checked: isChecked,
40258
- onChange: e => handleCheckboxClick(row, column.key, e),
40259
- onClick: e => e.stopPropagation(),
40260
- style: {
40261
- width: "18px",
40262
- height: "18px",
40263
- cursor: "pointer",
40264
- accentColor: buttonColor
40288
+ case "dropdown":
40289
+ try {
40290
+ if (!column) return null;
40291
+ const dropdownKey = `${rowIndex}-${column.key}`;
40292
+ const isOpen = openDropdowns[dropdownKey] || false;
40293
+ const dropdownOptions = column.dropdownOptions || [];
40294
+ const maxDropdownHeight = column.maxDropdownHeight || "200px";
40295
+ const dropdownOptionsWidth = column.dropdownOptionsWidth;
40296
+ const dropdownOptionsAlignment = column.dropdownOptionsAlignment || "right";
40297
+ const placeholder = column.placeholder || "Select...";
40298
+ const currentOption = dropdownOptions.find(option => option && option.value === value);
40299
+ const displayText = currentOption ? currentOption.label : value || placeholder;
40300
+ return /*#__PURE__*/React__default["default"].createElement(Dropdown, {
40301
+ isOpen: isOpen,
40302
+ options: dropdownOptions,
40303
+ selectedValue: value,
40304
+ displayText: displayText,
40305
+ onToggle: e => handleDropdownClick(rowIndex, column.key, e),
40306
+ onOptionSelect: (option, e) => handleDropdownOptionClick(row, rowIndex, column.key, option, e),
40307
+ maxDropdownHeight: maxDropdownHeight,
40308
+ dropdownOptionsWidth: dropdownOptionsWidth,
40309
+ dropdownOptionsAlignment: dropdownOptionsAlignment,
40310
+ placeholder: placeholder,
40311
+ isRowFocused: focusedRowIndex === rowIndex,
40312
+ isRowHovered: hoveredRowIndex === rowIndex,
40313
+ selectedColor: selectedColor
40314
+ });
40315
+ } catch (e) {
40316
+ console.warn('Error formatting dropdown:', e);
40317
+ return String(value || "");
40265
40318
  }
40266
- }));
40267
- default:
40268
- // Treat default as text
40269
- return value?.toString() ?? "";
40319
+ case "checkbox":
40320
+ try {
40321
+ const isChecked = Boolean(value);
40322
+ return /*#__PURE__*/React__default["default"].createElement("div", {
40323
+ style: {
40324
+ display: "flex",
40325
+ alignItems: "center",
40326
+ justifyContent: "center",
40327
+ width: "100%",
40328
+ height: "100%"
40329
+ }
40330
+ }, /*#__PURE__*/React__default["default"].createElement("input", {
40331
+ type: "checkbox",
40332
+ checked: isChecked,
40333
+ onChange: e => handleCheckboxClick(row, column.key, e),
40334
+ onClick: e => e.stopPropagation(),
40335
+ style: {
40336
+ width: "18px",
40337
+ height: "18px",
40338
+ cursor: "pointer",
40339
+ accentColor: buttonColor
40340
+ }
40341
+ }));
40342
+ } catch (e) {
40343
+ console.warn('Error formatting checkbox:', e);
40344
+ return String(value || "");
40345
+ }
40346
+ default:
40347
+ return String(value || "");
40348
+ }
40349
+ } catch (error) {
40350
+ console.error('Error in formatValue:', error, {
40351
+ value,
40352
+ column,
40353
+ rowIndex
40354
+ });
40355
+ return String(value || "");
40270
40356
  }
40271
40357
  };
40272
40358
  const shouldShowTooltip = (element, content) => {
@@ -40333,15 +40419,7 @@ const TableBody = /*#__PURE__*/React$1.forwardRef(({
40333
40419
  document.removeEventListener("click", handleClickOutside);
40334
40420
  };
40335
40421
  }, []);
40336
- console.log('TableBody Debug Info:', {
40337
- dataLength: data?.length,
40338
- columnsLength: columns?.length,
40339
- hasUseShimmerChromeEffect: typeof useShimmerChromeEffect,
40340
- hasChromeShimmerText: typeof ChromeShimmerText,
40341
- indexToShimmer,
40342
- sampleRow: data[0],
40343
- sampleColumn: columns[0]
40344
- });
40422
+
40345
40423
  // Return null if no data
40346
40424
  if (data.length === 0) {
40347
40425
  return /*#__PURE__*/React__default["default"].createElement(StyledTableBody, {
@@ -40390,39 +40468,57 @@ const TableBody = /*#__PURE__*/React$1.forwardRef(({
40390
40468
  }) : null, columns.map((column, columnIndex) => {
40391
40469
  if (!column || !column.key) {
40392
40470
  console.warn(`Invalid column at index ${columnIndex}:`, column);
40393
- return null;
40471
+ return /*#__PURE__*/React__default["default"].createElement(TableCell, {
40472
+ key: `invalid-${columnIndex}`
40473
+ }, "Invalid Column");
40394
40474
  }
40395
- const value = row[column.key];
40396
- const formattedValue = formatValue(value, column, row, rowIndex);
40397
-
40398
- // Use the chrome shimmer hook safely
40399
- let shimmerText = formattedValue;
40400
- let isShimmering = false;
40475
+ let value, formattedValue, shimmerText, isShimmering;
40401
40476
  try {
40402
- const shimmerResult = useShimmerChromeEffect(formattedValue, rowIndex, indexToShimmer, columnIndex, columns.length);
40403
- if (shimmerResult) {
40404
- shimmerText = shimmerResult.text || formattedValue;
40405
- isShimmering = shimmerResult.isShimmering || false;
40406
- }
40477
+ value = row[column.key];
40478
+ formattedValue = formatValue(value, column, row, rowIndex) || "";
40407
40479
  } catch (e) {
40408
- console.warn("Error with shimmer effect:", e);
40480
+ console.error("Error formatting value:", e);
40481
+ formattedValue = "";
40482
+ }
40483
+
40484
+ // Initialize shimmer defaults
40485
+ shimmerText = formattedValue;
40486
+ isShimmering = false;
40487
+
40488
+ // Only use shimmer hook for text-based fields
40489
+ const isTextBasedField = column.fieldType?.toLowerCase() === "text" || column.fieldType?.toLowerCase() === "currency" || column.fieldType?.toLowerCase() === "number" || column.fieldType?.toLowerCase() === "percentage" || column.fieldType?.toLowerCase() === "date" || !column.fieldType;
40490
+ if (isTextBasedField && typeof useShimmerChromeEffect === 'function') {
40491
+ try {
40492
+ const shimmerResult = useShimmerChromeEffect(String(formattedValue || ""), rowIndex, indexToShimmer, columnIndex, columns.length);
40493
+ if (shimmerResult && typeof shimmerResult === 'object') {
40494
+ shimmerText = shimmerResult.text || formattedValue;
40495
+ isShimmering = Boolean(shimmerResult.isShimmering);
40496
+ }
40497
+ } catch (e) {
40498
+ console.warn("Error with shimmer effect:", e);
40499
+ }
40409
40500
  }
40410
40501
  return /*#__PURE__*/React__default["default"].createElement(TableCell, {
40411
40502
  key: `${column.key}-${rowIndex}`,
40412
40503
  ref: el => {
40413
- if (el && shouldShowTooltip(el)) {
40504
+ if (el && formattedValue && shouldShowTooltip(el)) {
40414
40505
  try {
40415
40506
  const rect = el.getBoundingClientRect();
40416
- const {
40417
- offset,
40418
- height
40419
- } = calculateTooltipOffset(formattedValue.toString(), true);
40420
- el.style.setProperty("--cell-top", `${rect.top}px`);
40421
- el.style.setProperty("--cell-left", `${rect.left}px`);
40422
- el.style.setProperty("--cell-width", `${rect.width}px`);
40423
- el.style.setProperty("--cell-offset", `${offset}px`);
40424
- el.style.setProperty("--cell-height", `${height}px`);
40425
- el.setAttribute("data-tooltip", formattedValue);
40507
+ if (rect.width > 0 && rect.height > 0) {
40508
+ const tooltipInfo = calculateTooltipOffset(String(formattedValue), true);
40509
+ if (tooltipInfo) {
40510
+ const {
40511
+ offset,
40512
+ height
40513
+ } = tooltipInfo;
40514
+ el.style.setProperty("--cell-top", `${rect.top}px`);
40515
+ el.style.setProperty("--cell-left", `${rect.left}px`);
40516
+ el.style.setProperty("--cell-width", `${rect.width}px`);
40517
+ el.style.setProperty("--cell-offset", `${offset}px`);
40518
+ el.style.setProperty("--cell-height", `${height}px`);
40519
+ el.setAttribute("data-tooltip", String(formattedValue));
40520
+ }
40521
+ }
40426
40522
  } catch (e) {
40427
40523
  console.warn("Error setting cell tooltip:", e);
40428
40524
  }
@@ -40432,10 +40528,10 @@ const TableBody = /*#__PURE__*/React$1.forwardRef(({
40432
40528
  $color: column.color,
40433
40529
  $minWidth: column.minWidth,
40434
40530
  $maxWidth: column.maxWidth
40435
- }, column.fieldType?.toLowerCase() === "text" || column.fieldType?.toLowerCase() === "currency" || column.fieldType?.toLowerCase() === "number" || column.fieldType?.toLowerCase() === "percentage" || column.fieldType?.toLowerCase() === "date" || !column.fieldType ? /*#__PURE__*/React__default["default"].createElement(ChromeShimmerText, {
40436
- text: shimmerText,
40531
+ }, isTextBasedField ? typeof ChromeShimmerText === 'function' ? /*#__PURE__*/React__default["default"].createElement(ChromeShimmerText, {
40532
+ text: String(shimmerText || ""),
40437
40533
  isShimmering: isShimmering
40438
- }) : formattedValue);
40534
+ }) : String(shimmerText || "") : formattedValue || "");
40439
40535
  })), expandable && expandedRows[rowIndex] && /*#__PURE__*/React__default["default"].createElement(ExpandedRow, {
40440
40536
  $expandedBackgroundColor: expandedBackgroundColor
40441
40537
  }, /*#__PURE__*/React__default["default"].createElement(TableCell, {
@@ -54957,6 +55053,7 @@ const ToasterMessageBox = _ref => {
54957
55053
  linkText = '',
54958
55054
  duration = 5,
54959
55055
  width = '500px',
55056
+ icon = OkCircleIcon,
54960
55057
  onLinkClick = () => {},
54961
55058
  onClose = () => {}
54962
55059
  } = _ref;
@@ -54995,7 +55092,9 @@ const ToasterMessageBox = _ref => {
54995
55092
  $isClosing: isClosing
54996
55093
  }, /*#__PURE__*/React__default["default"].createElement(IconWrapper, {
54997
55094
  $color: color
54998
- }, /*#__PURE__*/React__default["default"].createElement(OkCircleIcon, {
55095
+ }, icon === 'error' ? /*#__PURE__*/React__default["default"].createElement(ErrorIcon, {
55096
+ color: "white"
55097
+ }) : /*#__PURE__*/React__default["default"].createElement(OkCircleIcon, {
54999
55098
  color: color,
55000
55099
  width: "40",
55001
55100
  height: "40"