sag_components 2.0.0-beta192 → 2.0.0-beta193

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
@@ -39932,341 +39932,423 @@ const TableBody = /*#__PURE__*/React$1.forwardRef(({
39932
39932
  return tag.replace(/-/g, " ").replace(/\b\w/g, l => l.toUpperCase());
39933
39933
  };
39934
39934
  const formatValue = (value, column, row, rowIndex) => {
39935
- if ((value === null || value === undefined) && column?.fieldType?.toLowerCase() !== "comments") {
39935
+ // Add safety checks at the start
39936
+ if (!column) {
39937
+ console.warn('formatValue called with null/undefined column');
39936
39938
  return "";
39937
39939
  }
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;
39940
+ try {
39941
+ if ((value === null || value === undefined) && column?.fieldType?.toLowerCase() !== "comments") {
39942
+ return "";
39944
39943
  }
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();
39944
+
39945
+ // Find the tooltip text for the current value - can be used for different fieldTypes
39946
+ const getTooltipText = value => {
39947
+ try {
39948
+ if (column?.tooltipText && Array.isArray(column.tooltipText)) {
39949
+ const tooltipItem = column.tooltipText.find(item => item && item.value === value);
39950
+ return tooltipItem ? tooltipItem.label : null;
39951
+ }
39952
+ return null;
39953
+ } catch (e) {
39954
+ console.warn('Error in getTooltipText:', e);
39955
+ return null;
39958
39956
  }
39959
- return value;
39960
- case "percentage":
39961
- return `${value || 0}%`;
39962
- case "date":
39963
- if (column.format === "MM/DD/YYYY" && value) {
39957
+ };
39958
+ const fieldType = column?.fieldType?.toLowerCase() || 'text';
39959
+ switch (fieldType) {
39960
+ case "currency":
39964
39961
  try {
39965
- const date = new Date(value);
39966
- return `${(date.getMonth() + 1)?.toString().padStart(2, "0")}/${date.getDate()?.toString().padStart(2, "0")}/${date.getFullYear()}`;
39962
+ if (column.format === "$0.00") {
39963
+ const numValue = parseFloat(value || 0);
39964
+ return `${isNaN(numValue) ? '0.00' : numValue.toFixed(2)}`;
39965
+ }
39966
+ return String(value || "");
39967
39967
  } catch (e) {
39968
- console.warn("Invalid date format:", value);
39969
- return value;
39968
+ console.warn('Error formatting currency:', e);
39969
+ return String(value || "");
39970
39970
  }
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);
39971
+ case "text":
39972
+ return String(value || "");
39973
+ case "number":
39974
+ try {
39975
+ if (column.format && column.format.includes(",")) {
39976
+ const numValue = Number(value || 0);
39977
+ return isNaN(numValue) ? String(value || "") : numValue.toLocaleString();
39978
+ }
39979
+ return String(value || "");
39980
+ } catch (e) {
39981
+ console.warn('Error formatting number:', e);
39982
+ return String(value || "");
39983
+ }
39984
+ case "percentage":
39985
+ return `${value || 0}%`;
39986
+ case "date":
39987
+ try {
39988
+ if (column.format === "MM/DD/YYYY" && value) {
39989
+ const date = new Date(value);
39990
+ if (isNaN(date.getTime())) {
39991
+ return String(value);
39992
+ }
39993
+ return `${(date.getMonth() + 1).toString().padStart(2, "0")}/${date.getDate().toString().padStart(2, "0")}/${date.getFullYear()}`;
40043
39994
  }
39995
+ return String(value || "");
39996
+ } catch (e) {
39997
+ console.warn('Error formatting date:', e);
39998
+ return String(value || "");
40044
39999
  }
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);
40000
+ case "boolean":
40001
+ return value ? "Yes" : "No";
40002
+ case "array":
40003
+ try {
40004
+ if (Array.isArray(value)) {
40005
+ return value.join(", ");
40087
40006
  }
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);
40142
- }
40007
+ return String(value || "");
40008
+ } catch (e) {
40009
+ console.warn('Error formatting array:', e);
40010
+ return String(value || "");
40011
+ }
40012
+ case "tag":
40013
+ try {
40014
+ if (!value) return "";
40015
+ const tagConfig = column.tagConfig || {};
40016
+ const colors = tagConfig.colors || {};
40017
+ const defaultColor = tagConfig.defaultColor || {
40018
+ bg: "#F3F4F6",
40019
+ text: "#374151",
40020
+ border: "#9CA3AF"
40021
+ };
40022
+ const maxDisplay = tagConfig.maxDisplay || 3;
40023
+ const isMultiple = tagConfig.multiple !== false;
40024
+ const createTagChip = (tagValue, index = 0) => {
40025
+ const colorConfig = colors[tagValue] || defaultColor;
40026
+ const formattedText = formatTagText(tagValue);
40027
+ return /*#__PURE__*/React__default["default"].createElement(TagChip, {
40028
+ key: `${tagValue}-${index}`,
40029
+ $backgroundColor: colorConfig.bg,
40030
+ $textColor: colorConfig.text,
40031
+ $borderColor: colorConfig.border,
40032
+ $interactive: false,
40033
+ title: formattedText
40034
+ }, /*#__PURE__*/React__default["default"].createElement(TagChipTextWrapper, null, formattedText));
40035
+ };
40036
+ if (typeof value === "string") {
40037
+ return /*#__PURE__*/React__default["default"].createElement(TagContainer, null, createTagChip(value));
40143
40038
  }
40144
- },
40145
- onClick: e => {
40146
- e.stopPropagation();
40147
- setCurrentCommentRow(rowIndex);
40148
- setIsCommentModalOpen(true);
40039
+ if (Array.isArray(value) && isMultiple) {
40040
+ const visibleTags = value.slice(0, maxDisplay);
40041
+ const remainingCount = value.length - maxDisplay;
40042
+ 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, {
40043
+ title: `${remainingCount} more: ${value.slice(maxDisplay).map(tag => formatTagText(tag)).join(", ")}`
40044
+ }, "+", remainingCount)));
40045
+ }
40046
+ if (Array.isArray(value)) {
40047
+ return formatValue(value[0], column, row, rowIndex);
40048
+ }
40049
+ return String(value || "");
40050
+ } catch (e) {
40051
+ console.warn('Error formatting tag:', e);
40052
+ return String(value || "");
40149
40053
  }
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) {
40054
+ case "packagestatus":
40055
+ try {
40056
+ const applyTooltipLogic = (element, tooltipText) => {
40057
+ if (element && tooltipText && tooltipText.trim() !== "") {
40165
40058
  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);
40059
+ const rect = element.getBoundingClientRect();
40060
+ if (rect.width > 0 && rect.height > 0) {
40061
+ const tooltipInfo = calculateTooltipOffset(tooltipText);
40062
+ if (tooltipInfo) {
40063
+ const {
40064
+ offset,
40065
+ height
40066
+ } = tooltipInfo;
40067
+ element.style.setProperty("--tooltip-top", `${rect.top}px`);
40068
+ element.style.setProperty("--tooltip-left", `${rect.left}px`);
40069
+ element.style.setProperty("--tooltip-width", `${rect.width}px`);
40070
+ element.style.setProperty("--tooltip-offset", `${offset}px`);
40071
+ element.style.setProperty("--tooltip-height", `${height}px`);
40072
+ element.setAttribute("data-tooltip", tooltipText);
40073
+ }
40074
+ }
40177
40075
  } catch (e) {
40178
- console.warn("Error handling trash tooltip:", e);
40076
+ console.warn("Error applying tooltip:", e);
40179
40077
  }
40180
40078
  }
40181
- },
40182
- onClick: e => {
40183
- e.stopPropagation();
40184
- onDeleteClick && onDeleteClick(row);
40079
+ };
40080
+ const tooltipText = getTooltipText(value);
40081
+ // Handle array values (like PackageStatusName)
40082
+ const processedValue = Array.isArray(value) ? value[0] : value;
40083
+ const lowerValue = String(processedValue || "").toLowerCase();
40084
+ if (lowerValue === "empty") {
40085
+ return /*#__PURE__*/React__default["default"].createElement(ButtonWrapper, {
40086
+ ref: el => applyTooltipLogic(el, tooltipText)
40087
+ }, /*#__PURE__*/React__default["default"].createElement(Button$1, {
40088
+ leftIcon: "Fly",
40089
+ text: "Send",
40090
+ borderRadius: "8px",
40091
+ backgroundColor: "#FFF",
40092
+ textColor: "#B1B1B1",
40093
+ borderColor: "#D9D9D9",
40094
+ hoverTextColor: "#B1B1B1",
40095
+ hoverBackgroundColor: "#E6F0F0",
40096
+ hoverBorderColor: "#D9D9D9",
40097
+ disabledTextColor: "#B1B1B1",
40098
+ disabledBackgroundColor: focusedRowIndex === rowIndex ? "#D1E7E7" : hoveredRowIndex === rowIndex ? "#E6F0F0" : "#FFF",
40099
+ disabledBorderColor: "#D9D9D9",
40100
+ width: "100px",
40101
+ height: "32px",
40102
+ disabled: true
40103
+ }));
40104
+ } else if (lowerValue === "draft") {
40105
+ return /*#__PURE__*/React__default["default"].createElement(ButtonWrapper, {
40106
+ ref: el => applyTooltipLogic(el, tooltipText)
40107
+ }, /*#__PURE__*/React__default["default"].createElement(Button$1, {
40108
+ leftIcon: "Fly",
40109
+ text: "Send",
40110
+ borderRadius: "8px",
40111
+ backgroundColor: focusedRowIndex === rowIndex ? "#D1E7E7" : hoveredRowIndex === rowIndex ? "#E6F0F0" : "#FFF",
40112
+ textColor: buttonColor,
40113
+ borderColor: buttonColor,
40114
+ hoverTextColor: buttonColor,
40115
+ hoverBorderColor: buttonColor,
40116
+ hoverBackgroundColor: "#E6F0F0",
40117
+ activeBackgroundColor: "#D1E7E7",
40118
+ width: "100px",
40119
+ height: "32px",
40120
+ onClick: e => {
40121
+ e.stopPropagation();
40122
+ onSendClick && onSendClick(row);
40123
+ }
40124
+ }));
40125
+ } else if (lowerValue === "sent") {
40126
+ return /*#__PURE__*/React__default["default"].createElement(SentStatus, {
40127
+ ref: el => applyTooltipLogic(el, tooltipText)
40128
+ }, /*#__PURE__*/React__default["default"].createElement(OkIcon, {
40129
+ width: "24",
40130
+ height: "24",
40131
+ color: "#5FCC70"
40132
+ }), /*#__PURE__*/React__default["default"].createElement("span", null, "All Sent"));
40185
40133
  }
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);
40134
+ return String(processedValue || "");
40135
+ } catch (e) {
40136
+ console.warn('Error formatting packagestatus:', e);
40137
+ return String(value || "");
40138
+ }
40139
+ case "status":
40140
+ try {
40141
+ const statusObj = statuses.find(status => status && status.status === value) || {};
40142
+ const palette = statusObj.palette || ["#F3F4F6", "#374151"];
40143
+ const [palette0, palette1] = palette;
40144
+ return /*#__PURE__*/React__default["default"].createElement(StatusCell$1, {
40145
+ color: palette1
40146
+ }, /*#__PURE__*/React__default["default"].createElement(StatusCellCircle, {
40147
+ backgroundColor: palette0
40148
+ }), /*#__PURE__*/React__default["default"].createElement("span", null, String(value || "")));
40149
+ } catch (e) {
40150
+ console.warn('Error formatting status:', e);
40151
+ return String(value || "");
40152
+ }
40153
+ case "comments":
40154
+ try {
40155
+ const commentTextValue = String(value || "");
40156
+ const hasComments = commentTextValue.trim().length > 0;
40157
+ const commentTooltipText = commentTextValue.length > 150 ? commentTextValue.substring(0, 147) + "..." : commentTextValue;
40158
+ return /*#__PURE__*/React__default["default"].createElement(CommentIconWrapper, {
40159
+ $buttonColor: buttonColor,
40160
+ ref: el => {
40161
+ if (el) {
40162
+ try {
40163
+ if (hasComments) {
40164
+ const rect = el.getBoundingClientRect();
40165
+ if (rect.width > 0 && rect.height > 0) {
40166
+ const tooltipInfo = calculateTooltipOffset(commentTooltipText);
40167
+ if (tooltipInfo) {
40168
+ const {
40169
+ offset,
40170
+ height
40171
+ } = tooltipInfo;
40172
+ el.style.setProperty("--tooltip-top", `${rect.top}px`);
40173
+ el.style.setProperty("--tooltip-left", `${rect.left}px`);
40174
+ el.style.setProperty("--tooltip-width", `${rect.width}px`);
40175
+ el.style.setProperty("--tooltip-offset", `${offset}px`);
40176
+ el.style.setProperty("--tooltip-height", `${height}px`);
40177
+ el.setAttribute("data-tooltip", commentTooltipText);
40178
+ }
40179
+ }
40180
+ } else {
40181
+ el.removeAttribute("data-tooltip");
40182
+ el.style.removeProperty("--tooltip-top");
40183
+ el.style.removeProperty("--tooltip-left");
40184
+ el.style.removeProperty("--tooltip-width");
40185
+ el.style.removeProperty("--tooltip-offset");
40186
+ el.style.removeProperty("--tooltip-height");
40187
+ }
40188
+ } catch (e) {
40189
+ console.warn("Error handling comment tooltip:", e);
40190
+ }
40208
40191
  }
40192
+ },
40193
+ onClick: e => {
40194
+ e.stopPropagation();
40195
+ setCurrentCommentRow(rowIndex);
40196
+ setIsCommentModalOpen(true);
40209
40197
  }
40198
+ }, /*#__PURE__*/React__default["default"].createElement(CommentIcon, {
40199
+ showCircle: hasComments,
40200
+ circleColor: buttonColor
40201
+ }));
40202
+ } catch (e) {
40203
+ console.warn('Error formatting comments:', e);
40204
+ return String(value || "");
40205
+ }
40206
+ case "trash":
40207
+ try {
40208
+ if (hoveredRowIndex !== rowIndex) {
40209
+ return null;
40210
40210
  }
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%"
40211
+ const trashTooltipText = getTooltipText(value);
40212
+ const processedValue = String(value || "").toUpperCase();
40213
+ if (processedValue === "ENABLED") {
40214
+ return /*#__PURE__*/React__default["default"].createElement(TrashIconWrapper$1, {
40215
+ $buttonColor: buttonColor,
40216
+ ref: el => {
40217
+ if (el && trashTooltipText) {
40218
+ try {
40219
+ const rect = el.getBoundingClientRect();
40220
+ if (rect.width > 0 && rect.height > 0) {
40221
+ const tooltipInfo = calculateTooltipOffset(trashTooltipText);
40222
+ if (tooltipInfo) {
40223
+ const {
40224
+ offset,
40225
+ height
40226
+ } = tooltipInfo;
40227
+ el.style.setProperty("--tooltip-top", `${rect.top}px`);
40228
+ el.style.setProperty("--tooltip-left", `${rect.left}px`);
40229
+ el.style.setProperty("--tooltip-width", `${rect.width}px`);
40230
+ el.style.setProperty("--tooltip-offset", `${offset}px`);
40231
+ el.style.setProperty("--tooltip-height", `${height}px`);
40232
+ el.setAttribute("data-tooltip", trashTooltipText);
40233
+ }
40234
+ }
40235
+ } catch (e) {
40236
+ console.warn("Error handling trash tooltip:", e);
40237
+ }
40238
+ }
40239
+ },
40240
+ onClick: e => {
40241
+ e.stopPropagation();
40242
+ onDeleteClick && onDeleteClick(row);
40243
+ }
40244
+ }, /*#__PURE__*/React__default["default"].createElement(TrashIcon, {
40245
+ width: "14",
40246
+ height: "18"
40247
+ }));
40248
+ } else if (processedValue === "DISABLED") {
40249
+ return /*#__PURE__*/React__default["default"].createElement(DisabledTrashIconWrapper$1, {
40250
+ ref: el => {
40251
+ if (el && trashTooltipText) {
40252
+ try {
40253
+ const rect = el.getBoundingClientRect();
40254
+ if (rect.width > 0 && rect.height > 0) {
40255
+ const tooltipInfo = calculateTooltipOffset(trashTooltipText);
40256
+ if (tooltipInfo) {
40257
+ const {
40258
+ offset,
40259
+ height
40260
+ } = tooltipInfo;
40261
+ el.style.setProperty("--tooltip-top", `${rect.top}px`);
40262
+ el.style.setProperty("--tooltip-left", `${rect.left}px`);
40263
+ el.style.setProperty("--tooltip-width", `${rect.width}px`);
40264
+ el.style.setProperty("--tooltip-offset", `${offset}px`);
40265
+ el.style.setProperty("--tooltip-height", `${height}px`);
40266
+ el.setAttribute("data-tooltip", trashTooltipText);
40267
+ }
40268
+ }
40269
+ } catch (e) {
40270
+ console.warn("Error handling disabled trash tooltip:", e);
40271
+ }
40272
+ }
40273
+ }
40274
+ }, /*#__PURE__*/React__default["default"].createElement(DisabledTrashIcon, {
40275
+ width: "22",
40276
+ height: "22"
40277
+ }));
40278
+ }
40279
+ return null;
40280
+ } catch (e) {
40281
+ console.warn('Error formatting trash:', e);
40282
+ return null;
40254
40283
  }
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
40284
+ case "dropdown":
40285
+ try {
40286
+ if (!column) return null;
40287
+ const dropdownKey = `${rowIndex}-${column.key}`;
40288
+ const isOpen = openDropdowns[dropdownKey] || false;
40289
+ const dropdownOptions = column.dropdownOptions || [];
40290
+ const maxDropdownHeight = column.maxDropdownHeight || "200px";
40291
+ const dropdownOptionsWidth = column.dropdownOptionsWidth;
40292
+ const dropdownOptionsAlignment = column.dropdownOptionsAlignment || "right";
40293
+ const placeholder = column.placeholder || "Select...";
40294
+ const currentOption = dropdownOptions.find(option => option && option.value === value);
40295
+ const displayText = currentOption ? currentOption.label : value || placeholder;
40296
+ return /*#__PURE__*/React__default["default"].createElement(Dropdown, {
40297
+ isOpen: isOpen,
40298
+ options: dropdownOptions,
40299
+ selectedValue: value,
40300
+ displayText: displayText,
40301
+ onToggle: e => handleDropdownClick(rowIndex, column.key, e),
40302
+ onOptionSelect: (option, e) => handleDropdownOptionClick(row, rowIndex, column.key, option, e),
40303
+ maxDropdownHeight: maxDropdownHeight,
40304
+ dropdownOptionsWidth: dropdownOptionsWidth,
40305
+ dropdownOptionsAlignment: dropdownOptionsAlignment,
40306
+ placeholder: placeholder,
40307
+ isRowFocused: focusedRowIndex === rowIndex,
40308
+ isRowHovered: hoveredRowIndex === rowIndex,
40309
+ selectedColor: selectedColor
40310
+ });
40311
+ } catch (e) {
40312
+ console.warn('Error formatting dropdown:', e);
40313
+ return String(value || "");
40265
40314
  }
40266
- }));
40267
- default:
40268
- // Treat default as text
40269
- return value?.toString() ?? "";
40315
+ case "checkbox":
40316
+ try {
40317
+ const isChecked = Boolean(value);
40318
+ return /*#__PURE__*/React__default["default"].createElement("div", {
40319
+ style: {
40320
+ display: "flex",
40321
+ alignItems: "center",
40322
+ justifyContent: "center",
40323
+ width: "100%",
40324
+ height: "100%"
40325
+ }
40326
+ }, /*#__PURE__*/React__default["default"].createElement("input", {
40327
+ type: "checkbox",
40328
+ checked: isChecked,
40329
+ onChange: e => handleCheckboxClick(row, column.key, e),
40330
+ onClick: e => e.stopPropagation(),
40331
+ style: {
40332
+ width: "18px",
40333
+ height: "18px",
40334
+ cursor: "pointer",
40335
+ accentColor: buttonColor
40336
+ }
40337
+ }));
40338
+ } catch (e) {
40339
+ console.warn('Error formatting checkbox:', e);
40340
+ return String(value || "");
40341
+ }
40342
+ default:
40343
+ return String(value || "");
40344
+ }
40345
+ } catch (error) {
40346
+ console.error('Error in formatValue:', error, {
40347
+ value,
40348
+ column,
40349
+ rowIndex
40350
+ });
40351
+ return String(value || "");
40270
40352
  }
40271
40353
  };
40272
40354
  const shouldShowTooltip = (element, content) => {
@@ -40333,15 +40415,7 @@ const TableBody = /*#__PURE__*/React$1.forwardRef(({
40333
40415
  document.removeEventListener("click", handleClickOutside);
40334
40416
  };
40335
40417
  }, []);
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
- });
40418
+
40345
40419
  // Return null if no data
40346
40420
  if (data.length === 0) {
40347
40421
  return /*#__PURE__*/React__default["default"].createElement(StyledTableBody, {
@@ -40390,39 +40464,57 @@ const TableBody = /*#__PURE__*/React$1.forwardRef(({
40390
40464
  }) : null, columns.map((column, columnIndex) => {
40391
40465
  if (!column || !column.key) {
40392
40466
  console.warn(`Invalid column at index ${columnIndex}:`, column);
40393
- return null;
40467
+ return /*#__PURE__*/React__default["default"].createElement(TableCell, {
40468
+ key: `invalid-${columnIndex}`
40469
+ }, "Invalid Column");
40394
40470
  }
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;
40471
+ let value, formattedValue, shimmerText, isShimmering;
40401
40472
  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
- }
40473
+ value = row[column.key];
40474
+ formattedValue = formatValue(value, column, row, rowIndex) || "";
40407
40475
  } catch (e) {
40408
- console.warn("Error with shimmer effect:", e);
40476
+ console.error("Error formatting value:", e);
40477
+ formattedValue = "";
40478
+ }
40479
+
40480
+ // Initialize shimmer defaults
40481
+ shimmerText = formattedValue;
40482
+ isShimmering = false;
40483
+
40484
+ // Only use shimmer hook for text-based fields
40485
+ const isTextBasedField = column.fieldType?.toLowerCase() === "text" || column.fieldType?.toLowerCase() === "currency" || column.fieldType?.toLowerCase() === "number" || column.fieldType?.toLowerCase() === "percentage" || column.fieldType?.toLowerCase() === "date" || !column.fieldType;
40486
+ if (isTextBasedField && typeof useShimmerChromeEffect === 'function') {
40487
+ try {
40488
+ const shimmerResult = useShimmerChromeEffect(String(formattedValue || ""), rowIndex, indexToShimmer, columnIndex, columns.length);
40489
+ if (shimmerResult && typeof shimmerResult === 'object') {
40490
+ shimmerText = shimmerResult.text || formattedValue;
40491
+ isShimmering = Boolean(shimmerResult.isShimmering);
40492
+ }
40493
+ } catch (e) {
40494
+ console.warn("Error with shimmer effect:", e);
40495
+ }
40409
40496
  }
40410
40497
  return /*#__PURE__*/React__default["default"].createElement(TableCell, {
40411
40498
  key: `${column.key}-${rowIndex}`,
40412
40499
  ref: el => {
40413
- if (el && shouldShowTooltip(el)) {
40500
+ if (el && formattedValue && shouldShowTooltip(el)) {
40414
40501
  try {
40415
40502
  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);
40503
+ if (rect.width > 0 && rect.height > 0) {
40504
+ const tooltipInfo = calculateTooltipOffset(String(formattedValue), true);
40505
+ if (tooltipInfo) {
40506
+ const {
40507
+ offset,
40508
+ height
40509
+ } = tooltipInfo;
40510
+ el.style.setProperty("--cell-top", `${rect.top}px`);
40511
+ el.style.setProperty("--cell-left", `${rect.left}px`);
40512
+ el.style.setProperty("--cell-width", `${rect.width}px`);
40513
+ el.style.setProperty("--cell-offset", `${offset}px`);
40514
+ el.style.setProperty("--cell-height", `${height}px`);
40515
+ el.setAttribute("data-tooltip", String(formattedValue));
40516
+ }
40517
+ }
40426
40518
  } catch (e) {
40427
40519
  console.warn("Error setting cell tooltip:", e);
40428
40520
  }
@@ -40432,10 +40524,10 @@ const TableBody = /*#__PURE__*/React$1.forwardRef(({
40432
40524
  $color: column.color,
40433
40525
  $minWidth: column.minWidth,
40434
40526
  $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,
40527
+ }, isTextBasedField ? typeof ChromeShimmerText === 'function' ? /*#__PURE__*/React__default["default"].createElement(ChromeShimmerText, {
40528
+ text: String(shimmerText || ""),
40437
40529
  isShimmering: isShimmering
40438
- }) : formattedValue);
40530
+ }) : String(shimmerText || "") : formattedValue || "");
40439
40531
  })), expandable && expandedRows[rowIndex] && /*#__PURE__*/React__default["default"].createElement(ExpandedRow, {
40440
40532
  $expandedBackgroundColor: expandedBackgroundColor
40441
40533
  }, /*#__PURE__*/React__default["default"].createElement(TableCell, {