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