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.esm.js CHANGED
@@ -10579,23 +10579,24 @@ const QuarterPopupPicker = ({
10579
10579
  };
10580
10580
 
10581
10581
  /* eslint-disable import/no-extraneous-dependencies */
10582
- const QuarterPicker = ({
10583
- availableQuarters,
10584
- // ["Q1-2024"]
10585
- label,
10586
- onChange,
10587
- borderRadius,
10588
- required,
10589
- width,
10590
- height,
10591
- placeholder,
10592
- disabled,
10593
- borderColor,
10594
- borderColorFocus,
10595
- textColor,
10596
- selectedValue,
10597
- startYear
10598
- }) => {
10582
+ const QuarterPicker = _ref => {
10583
+ let {
10584
+ availableQuarters,
10585
+ // ["Q1-2024"]
10586
+ label,
10587
+ onChange,
10588
+ borderRadius,
10589
+ required,
10590
+ width,
10591
+ height,
10592
+ placeholder,
10593
+ disabled,
10594
+ borderColor,
10595
+ borderColorFocus,
10596
+ textColor,
10597
+ selectedValue,
10598
+ startYear
10599
+ } = _ref;
10599
10600
  const [isFocused, setIsFocused] = useState(false);
10600
10601
  const [isOpen, setIsOpen] = useState(false);
10601
10602
  const [value, setValue] = useState('');
@@ -11037,22 +11038,23 @@ const MonthPopupPicker = ({
11037
11038
  };
11038
11039
 
11039
11040
  /* eslint-disable import/no-extraneous-dependencies */
11040
- const MonthPicker = ({
11041
- availableMonths,
11042
- label,
11043
- onChange,
11044
- borderRadius,
11045
- required,
11046
- width,
11047
- height,
11048
- placeholder,
11049
- disabled,
11050
- borderColor,
11051
- borderColorFocus,
11052
- textColor,
11053
- selectedValue,
11054
- startYear
11055
- }) => {
11041
+ const MonthPicker = _ref => {
11042
+ let {
11043
+ availableMonths,
11044
+ label,
11045
+ onChange,
11046
+ borderRadius,
11047
+ required,
11048
+ width,
11049
+ height,
11050
+ placeholder,
11051
+ disabled,
11052
+ borderColor,
11053
+ borderColorFocus,
11054
+ textColor,
11055
+ selectedValue,
11056
+ startYear
11057
+ } = _ref;
11056
11058
  const [isFocused, setIsFocused] = useState(false);
11057
11059
  const [isOpen, setIsOpen] = useState(false);
11058
11060
  const [value, setValue] = useState('');
@@ -24163,21 +24165,22 @@ const DeleteIcon = styled.div`
24163
24165
  position: absolute;
24164
24166
  `;
24165
24167
 
24166
- const QuickFilterDropdownSingle = ({
24167
- label,
24168
- hoverColor,
24169
- options,
24170
- selectedValue,
24171
- placeHolder,
24172
- onChange,
24173
- disabled,
24174
- width,
24175
- error,
24176
- errorMessage,
24177
- xIconShow,
24178
- labelColor,
24179
- showLabelOnTop
24180
- }) => {
24168
+ const QuickFilterDropdownSingle = _ref => {
24169
+ let {
24170
+ label,
24171
+ hoverColor,
24172
+ options,
24173
+ selectedValue,
24174
+ placeHolder,
24175
+ onChange,
24176
+ disabled,
24177
+ width,
24178
+ error,
24179
+ errorMessage,
24180
+ xIconShow,
24181
+ labelColor,
24182
+ showLabelOnTop
24183
+ } = _ref;
24181
24184
  const [isFocused, setIsFocused] = useState(false);
24182
24185
  const [showOptions, setShowOptions] = useState(false);
24183
24186
  const [inputValue, setInputValue] = useState("");
@@ -24574,23 +24577,24 @@ const IconContainer$2 = styled.div`
24574
24577
  cursor: pointer;
24575
24578
  `;
24576
24579
 
24577
- const QuickFilterDropdownMultiSelection = ({
24578
- label,
24579
- labelEmptyValue,
24580
- options,
24581
- selectedValue,
24582
- placeHolder,
24583
- onChange,
24584
- required,
24585
- disabled,
24586
- width,
24587
- error,
24588
- errorMessage,
24589
- labelColor,
24590
- xIconShow,
24591
- checkBoxColor,
24592
- showLabelOnTop
24593
- }) => {
24580
+ const QuickFilterDropdownMultiSelection = _ref => {
24581
+ let {
24582
+ label,
24583
+ labelEmptyValue,
24584
+ options,
24585
+ selectedValue,
24586
+ placeHolder,
24587
+ onChange,
24588
+ required,
24589
+ disabled,
24590
+ width,
24591
+ error,
24592
+ errorMessage,
24593
+ labelColor,
24594
+ xIconShow,
24595
+ checkBoxColor,
24596
+ showLabelOnTop
24597
+ } = _ref;
24594
24598
  const [isFocused, setIsFocused] = useState(false);
24595
24599
  const [showOptions, setShowOptions] = useState(false);
24596
24600
  const [inputValue, setInputValue] = useState('');
@@ -35921,9 +35925,9 @@ const ToggleSlider = styled.span`
35921
35925
  }
35922
35926
  `;
35923
35927
 
35924
- /**
35925
- * ToggleSwitch component for on/off states.
35926
- * Supports small/large sizes and disabled state.
35928
+ /**
35929
+ * ToggleSwitch component for on/off states.
35930
+ * Supports small/large sizes and disabled state.
35927
35931
  */
35928
35932
  function ToggleSwitch(_ref) {
35929
35933
  let {
@@ -39922,341 +39926,423 @@ const TableBody = /*#__PURE__*/forwardRef(({
39922
39926
  return tag.replace(/-/g, " ").replace(/\b\w/g, l => l.toUpperCase());
39923
39927
  };
39924
39928
  const formatValue = (value, column, row, rowIndex) => {
39925
- if ((value === null || value === undefined) && column?.fieldType?.toLowerCase() !== "comments") {
39929
+ // Add safety checks at the start
39930
+ if (!column) {
39931
+ console.warn('formatValue called with null/undefined column');
39926
39932
  return "";
39927
39933
  }
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;
39934
+ try {
39935
+ if ((value === null || value === undefined) && column?.fieldType?.toLowerCase() !== "comments") {
39936
+ return "";
39934
39937
  }
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();
39938
+
39939
+ // Find the tooltip text for the current value - can be used for different fieldTypes
39940
+ const getTooltipText = value => {
39941
+ try {
39942
+ if (column?.tooltipText && Array.isArray(column.tooltipText)) {
39943
+ const tooltipItem = column.tooltipText.find(item => item && item.value === value);
39944
+ return tooltipItem ? tooltipItem.label : null;
39945
+ }
39946
+ return null;
39947
+ } catch (e) {
39948
+ console.warn('Error in getTooltipText:', e);
39949
+ return null;
39948
39950
  }
39949
- return value;
39950
- case "percentage":
39951
- return `${value || 0}%`;
39952
- case "date":
39953
- if (column.format === "MM/DD/YYYY" && value) {
39951
+ };
39952
+ const fieldType = column?.fieldType?.toLowerCase() || 'text';
39953
+ switch (fieldType) {
39954
+ case "currency":
39954
39955
  try {
39955
- const date = new Date(value);
39956
- return `${(date.getMonth() + 1)?.toString().padStart(2, "0")}/${date.getDate()?.toString().padStart(2, "0")}/${date.getFullYear()}`;
39956
+ if (column.format === "$0.00") {
39957
+ const numValue = parseFloat(value || 0);
39958
+ return `${isNaN(numValue) ? '0.00' : numValue.toFixed(2)}`;
39959
+ }
39960
+ return String(value || "");
39957
39961
  } catch (e) {
39958
- console.warn("Invalid date format:", value);
39959
- return value;
39962
+ console.warn('Error formatting currency:', e);
39963
+ return String(value || "");
39960
39964
  }
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);
39965
+ case "text":
39966
+ return String(value || "");
39967
+ case "number":
39968
+ try {
39969
+ if (column.format && column.format.includes(",")) {
39970
+ const numValue = Number(value || 0);
39971
+ return isNaN(numValue) ? String(value || "") : numValue.toLocaleString();
40033
39972
  }
39973
+ return String(value || "");
39974
+ } catch (e) {
39975
+ console.warn('Error formatting number:', e);
39976
+ return String(value || "");
40034
39977
  }
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);
40077
- }
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);
39978
+ case "percentage":
39979
+ return `${value || 0}%`;
39980
+ case "date":
39981
+ try {
39982
+ if (column.format === "MM/DD/YYYY" && value) {
39983
+ const date = new Date(value);
39984
+ if (isNaN(date.getTime())) {
39985
+ return String(value);
40132
39986
  }
39987
+ return `${(date.getMonth() + 1).toString().padStart(2, "0")}/${date.getDate().toString().padStart(2, "0")}/${date.getFullYear()}`;
40133
39988
  }
40134
- },
40135
- onClick: e => {
40136
- e.stopPropagation();
40137
- setCurrentCommentRow(rowIndex);
40138
- setIsCommentModalOpen(true);
39989
+ return String(value || "");
39990
+ } catch (e) {
39991
+ console.warn('Error formatting date:', e);
39992
+ return String(value || "");
40139
39993
  }
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) {
39994
+ case "boolean":
39995
+ return value ? "Yes" : "No";
39996
+ case "array":
39997
+ try {
39998
+ if (Array.isArray(value)) {
39999
+ return value.join(", ");
40000
+ }
40001
+ return String(value || "");
40002
+ } catch (e) {
40003
+ console.warn('Error formatting array:', e);
40004
+ return String(value || "");
40005
+ }
40006
+ case "tag":
40007
+ try {
40008
+ if (!value) return "";
40009
+ const tagConfig = column.tagConfig || {};
40010
+ const colors = tagConfig.colors || {};
40011
+ const defaultColor = tagConfig.defaultColor || {
40012
+ bg: "#F3F4F6",
40013
+ text: "#374151",
40014
+ border: "#9CA3AF"
40015
+ };
40016
+ const maxDisplay = tagConfig.maxDisplay || 3;
40017
+ const isMultiple = tagConfig.multiple !== false;
40018
+ const createTagChip = (tagValue, index = 0) => {
40019
+ const colorConfig = colors[tagValue] || defaultColor;
40020
+ const formattedText = formatTagText(tagValue);
40021
+ return /*#__PURE__*/React$1.createElement(TagChip, {
40022
+ key: `${tagValue}-${index}`,
40023
+ $backgroundColor: colorConfig.bg,
40024
+ $textColor: colorConfig.text,
40025
+ $borderColor: colorConfig.border,
40026
+ $interactive: false,
40027
+ title: formattedText
40028
+ }, /*#__PURE__*/React$1.createElement(TagChipTextWrapper, null, formattedText));
40029
+ };
40030
+ if (typeof value === "string") {
40031
+ return /*#__PURE__*/React$1.createElement(TagContainer, null, createTagChip(value));
40032
+ }
40033
+ if (Array.isArray(value) && isMultiple) {
40034
+ const visibleTags = value.slice(0, maxDisplay);
40035
+ const remainingCount = value.length - maxDisplay;
40036
+ 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, {
40037
+ title: `${remainingCount} more: ${value.slice(maxDisplay).map(tag => formatTagText(tag)).join(", ")}`
40038
+ }, "+", remainingCount)));
40039
+ }
40040
+ if (Array.isArray(value)) {
40041
+ return formatValue(value[0], column, row, rowIndex);
40042
+ }
40043
+ return String(value || "");
40044
+ } catch (e) {
40045
+ console.warn('Error formatting tag:', e);
40046
+ return String(value || "");
40047
+ }
40048
+ case "packagestatus":
40049
+ try {
40050
+ const applyTooltipLogic = (element, tooltipText) => {
40051
+ if (element && tooltipText && tooltipText.trim() !== "") {
40155
40052
  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);
40053
+ const rect = element.getBoundingClientRect();
40054
+ if (rect.width > 0 && rect.height > 0) {
40055
+ const tooltipInfo = calculateTooltipOffset(tooltipText);
40056
+ if (tooltipInfo) {
40057
+ const {
40058
+ offset,
40059
+ height
40060
+ } = tooltipInfo;
40061
+ element.style.setProperty("--tooltip-top", `${rect.top}px`);
40062
+ element.style.setProperty("--tooltip-left", `${rect.left}px`);
40063
+ element.style.setProperty("--tooltip-width", `${rect.width}px`);
40064
+ element.style.setProperty("--tooltip-offset", `${offset}px`);
40065
+ element.style.setProperty("--tooltip-height", `${height}px`);
40066
+ element.setAttribute("data-tooltip", tooltipText);
40067
+ }
40068
+ }
40167
40069
  } catch (e) {
40168
- console.warn("Error handling trash tooltip:", e);
40070
+ console.warn("Error applying tooltip:", e);
40169
40071
  }
40170
40072
  }
40171
- },
40172
- onClick: e => {
40173
- e.stopPropagation();
40174
- onDeleteClick && onDeleteClick(row);
40073
+ };
40074
+ const tooltipText = getTooltipText(value);
40075
+ // Handle array values (like PackageStatusName)
40076
+ const processedValue = Array.isArray(value) ? value[0] : value;
40077
+ const lowerValue = String(processedValue || "").toLowerCase();
40078
+ if (lowerValue === "empty") {
40079
+ return /*#__PURE__*/React$1.createElement(ButtonWrapper, {
40080
+ ref: el => applyTooltipLogic(el, tooltipText)
40081
+ }, /*#__PURE__*/React$1.createElement(Button$1, {
40082
+ leftIcon: "Fly",
40083
+ text: "Send",
40084
+ borderRadius: "8px",
40085
+ backgroundColor: "#FFF",
40086
+ textColor: "#B1B1B1",
40087
+ borderColor: "#D9D9D9",
40088
+ hoverTextColor: "#B1B1B1",
40089
+ hoverBackgroundColor: "#E6F0F0",
40090
+ hoverBorderColor: "#D9D9D9",
40091
+ disabledTextColor: "#B1B1B1",
40092
+ disabledBackgroundColor: focusedRowIndex === rowIndex ? "#D1E7E7" : hoveredRowIndex === rowIndex ? "#E6F0F0" : "#FFF",
40093
+ disabledBorderColor: "#D9D9D9",
40094
+ width: "100px",
40095
+ height: "32px",
40096
+ disabled: true
40097
+ }));
40098
+ } else if (lowerValue === "draft") {
40099
+ return /*#__PURE__*/React$1.createElement(ButtonWrapper, {
40100
+ ref: el => applyTooltipLogic(el, tooltipText)
40101
+ }, /*#__PURE__*/React$1.createElement(Button$1, {
40102
+ leftIcon: "Fly",
40103
+ text: "Send",
40104
+ borderRadius: "8px",
40105
+ backgroundColor: focusedRowIndex === rowIndex ? "#D1E7E7" : hoveredRowIndex === rowIndex ? "#E6F0F0" : "#FFF",
40106
+ textColor: buttonColor,
40107
+ borderColor: buttonColor,
40108
+ hoverTextColor: buttonColor,
40109
+ hoverBorderColor: buttonColor,
40110
+ hoverBackgroundColor: "#E6F0F0",
40111
+ activeBackgroundColor: "#D1E7E7",
40112
+ width: "100px",
40113
+ height: "32px",
40114
+ onClick: e => {
40115
+ e.stopPropagation();
40116
+ onSendClick && onSendClick(row);
40117
+ }
40118
+ }));
40119
+ } else if (lowerValue === "sent") {
40120
+ return /*#__PURE__*/React$1.createElement(SentStatus, {
40121
+ ref: el => applyTooltipLogic(el, tooltipText)
40122
+ }, /*#__PURE__*/React$1.createElement(OkIcon, {
40123
+ width: "24",
40124
+ height: "24",
40125
+ color: "#5FCC70"
40126
+ }), /*#__PURE__*/React$1.createElement("span", null, "All Sent"));
40175
40127
  }
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);
40128
+ return String(processedValue || "");
40129
+ } catch (e) {
40130
+ console.warn('Error formatting packagestatus:', e);
40131
+ return String(value || "");
40132
+ }
40133
+ case "status":
40134
+ try {
40135
+ const statusObj = statuses.find(status => status && status.status === value) || {};
40136
+ const palette = statusObj.palette || ["#F3F4F6", "#374151"];
40137
+ const [palette0, palette1] = palette;
40138
+ return /*#__PURE__*/React$1.createElement(StatusCell$1, {
40139
+ color: palette1
40140
+ }, /*#__PURE__*/React$1.createElement(StatusCellCircle, {
40141
+ backgroundColor: palette0
40142
+ }), /*#__PURE__*/React$1.createElement("span", null, String(value || "")));
40143
+ } catch (e) {
40144
+ console.warn('Error formatting status:', e);
40145
+ return String(value || "");
40146
+ }
40147
+ case "comments":
40148
+ try {
40149
+ const commentTextValue = String(value || "");
40150
+ const hasComments = commentTextValue.trim().length > 0;
40151
+ const commentTooltipText = commentTextValue.length > 150 ? commentTextValue.substring(0, 147) + "..." : commentTextValue;
40152
+ return /*#__PURE__*/React$1.createElement(CommentIconWrapper, {
40153
+ $buttonColor: buttonColor,
40154
+ ref: el => {
40155
+ if (el) {
40156
+ try {
40157
+ if (hasComments) {
40158
+ const rect = el.getBoundingClientRect();
40159
+ if (rect.width > 0 && rect.height > 0) {
40160
+ const tooltipInfo = calculateTooltipOffset(commentTooltipText);
40161
+ if (tooltipInfo) {
40162
+ const {
40163
+ offset,
40164
+ height
40165
+ } = tooltipInfo;
40166
+ el.style.setProperty("--tooltip-top", `${rect.top}px`);
40167
+ el.style.setProperty("--tooltip-left", `${rect.left}px`);
40168
+ el.style.setProperty("--tooltip-width", `${rect.width}px`);
40169
+ el.style.setProperty("--tooltip-offset", `${offset}px`);
40170
+ el.style.setProperty("--tooltip-height", `${height}px`);
40171
+ el.setAttribute("data-tooltip", commentTooltipText);
40172
+ }
40173
+ }
40174
+ } else {
40175
+ el.removeAttribute("data-tooltip");
40176
+ el.style.removeProperty("--tooltip-top");
40177
+ el.style.removeProperty("--tooltip-left");
40178
+ el.style.removeProperty("--tooltip-width");
40179
+ el.style.removeProperty("--tooltip-offset");
40180
+ el.style.removeProperty("--tooltip-height");
40181
+ }
40182
+ } catch (e) {
40183
+ console.warn("Error handling comment tooltip:", e);
40184
+ }
40198
40185
  }
40186
+ },
40187
+ onClick: e => {
40188
+ e.stopPropagation();
40189
+ setCurrentCommentRow(rowIndex);
40190
+ setIsCommentModalOpen(true);
40199
40191
  }
40192
+ }, /*#__PURE__*/React$1.createElement(CommentIcon, {
40193
+ showCircle: hasComments,
40194
+ circleColor: buttonColor
40195
+ }));
40196
+ } catch (e) {
40197
+ console.warn('Error formatting comments:', e);
40198
+ return String(value || "");
40199
+ }
40200
+ case "trash":
40201
+ try {
40202
+ if (hoveredRowIndex !== rowIndex) {
40203
+ return null;
40200
40204
  }
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%"
40205
+ const trashTooltipText = getTooltipText(value);
40206
+ const processedValue = String(value || "").toUpperCase();
40207
+ if (processedValue === "ENABLED") {
40208
+ return /*#__PURE__*/React$1.createElement(TrashIconWrapper$1, {
40209
+ $buttonColor: buttonColor,
40210
+ ref: el => {
40211
+ if (el && trashTooltipText) {
40212
+ try {
40213
+ const rect = el.getBoundingClientRect();
40214
+ if (rect.width > 0 && rect.height > 0) {
40215
+ const tooltipInfo = calculateTooltipOffset(trashTooltipText);
40216
+ if (tooltipInfo) {
40217
+ const {
40218
+ offset,
40219
+ height
40220
+ } = tooltipInfo;
40221
+ el.style.setProperty("--tooltip-top", `${rect.top}px`);
40222
+ el.style.setProperty("--tooltip-left", `${rect.left}px`);
40223
+ el.style.setProperty("--tooltip-width", `${rect.width}px`);
40224
+ el.style.setProperty("--tooltip-offset", `${offset}px`);
40225
+ el.style.setProperty("--tooltip-height", `${height}px`);
40226
+ el.setAttribute("data-tooltip", trashTooltipText);
40227
+ }
40228
+ }
40229
+ } catch (e) {
40230
+ console.warn("Error handling trash tooltip:", e);
40231
+ }
40232
+ }
40233
+ },
40234
+ onClick: e => {
40235
+ e.stopPropagation();
40236
+ onDeleteClick && onDeleteClick(row);
40237
+ }
40238
+ }, /*#__PURE__*/React$1.createElement(TrashIcon, {
40239
+ width: "14",
40240
+ height: "18"
40241
+ }));
40242
+ } else if (processedValue === "DISABLED") {
40243
+ return /*#__PURE__*/React$1.createElement(DisabledTrashIconWrapper$1, {
40244
+ ref: el => {
40245
+ if (el && trashTooltipText) {
40246
+ try {
40247
+ const rect = el.getBoundingClientRect();
40248
+ if (rect.width > 0 && rect.height > 0) {
40249
+ const tooltipInfo = calculateTooltipOffset(trashTooltipText);
40250
+ if (tooltipInfo) {
40251
+ const {
40252
+ offset,
40253
+ height
40254
+ } = tooltipInfo;
40255
+ el.style.setProperty("--tooltip-top", `${rect.top}px`);
40256
+ el.style.setProperty("--tooltip-left", `${rect.left}px`);
40257
+ el.style.setProperty("--tooltip-width", `${rect.width}px`);
40258
+ el.style.setProperty("--tooltip-offset", `${offset}px`);
40259
+ el.style.setProperty("--tooltip-height", `${height}px`);
40260
+ el.setAttribute("data-tooltip", trashTooltipText);
40261
+ }
40262
+ }
40263
+ } catch (e) {
40264
+ console.warn("Error handling disabled trash tooltip:", e);
40265
+ }
40266
+ }
40267
+ }
40268
+ }, /*#__PURE__*/React$1.createElement(DisabledTrashIcon, {
40269
+ width: "22",
40270
+ height: "22"
40271
+ }));
40272
+ }
40273
+ return null;
40274
+ } catch (e) {
40275
+ console.warn('Error formatting trash:', e);
40276
+ return null;
40244
40277
  }
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
40278
+ case "dropdown":
40279
+ try {
40280
+ if (!column) return null;
40281
+ const dropdownKey = `${rowIndex}-${column.key}`;
40282
+ const isOpen = openDropdowns[dropdownKey] || false;
40283
+ const dropdownOptions = column.dropdownOptions || [];
40284
+ const maxDropdownHeight = column.maxDropdownHeight || "200px";
40285
+ const dropdownOptionsWidth = column.dropdownOptionsWidth;
40286
+ const dropdownOptionsAlignment = column.dropdownOptionsAlignment || "right";
40287
+ const placeholder = column.placeholder || "Select...";
40288
+ const currentOption = dropdownOptions.find(option => option && option.value === value);
40289
+ const displayText = currentOption ? currentOption.label : value || placeholder;
40290
+ return /*#__PURE__*/React$1.createElement(Dropdown, {
40291
+ isOpen: isOpen,
40292
+ options: dropdownOptions,
40293
+ selectedValue: value,
40294
+ displayText: displayText,
40295
+ onToggle: e => handleDropdownClick(rowIndex, column.key, e),
40296
+ onOptionSelect: (option, e) => handleDropdownOptionClick(row, rowIndex, column.key, option, e),
40297
+ maxDropdownHeight: maxDropdownHeight,
40298
+ dropdownOptionsWidth: dropdownOptionsWidth,
40299
+ dropdownOptionsAlignment: dropdownOptionsAlignment,
40300
+ placeholder: placeholder,
40301
+ isRowFocused: focusedRowIndex === rowIndex,
40302
+ isRowHovered: hoveredRowIndex === rowIndex,
40303
+ selectedColor: selectedColor
40304
+ });
40305
+ } catch (e) {
40306
+ console.warn('Error formatting dropdown:', e);
40307
+ return String(value || "");
40255
40308
  }
40256
- }));
40257
- default:
40258
- // Treat default as text
40259
- return value?.toString() ?? "";
40309
+ case "checkbox":
40310
+ try {
40311
+ const isChecked = Boolean(value);
40312
+ return /*#__PURE__*/React$1.createElement("div", {
40313
+ style: {
40314
+ display: "flex",
40315
+ alignItems: "center",
40316
+ justifyContent: "center",
40317
+ width: "100%",
40318
+ height: "100%"
40319
+ }
40320
+ }, /*#__PURE__*/React$1.createElement("input", {
40321
+ type: "checkbox",
40322
+ checked: isChecked,
40323
+ onChange: e => handleCheckboxClick(row, column.key, e),
40324
+ onClick: e => e.stopPropagation(),
40325
+ style: {
40326
+ width: "18px",
40327
+ height: "18px",
40328
+ cursor: "pointer",
40329
+ accentColor: buttonColor
40330
+ }
40331
+ }));
40332
+ } catch (e) {
40333
+ console.warn('Error formatting checkbox:', e);
40334
+ return String(value || "");
40335
+ }
40336
+ default:
40337
+ return String(value || "");
40338
+ }
40339
+ } catch (error) {
40340
+ console.error('Error in formatValue:', error, {
40341
+ value,
40342
+ column,
40343
+ rowIndex
40344
+ });
40345
+ return String(value || "");
40260
40346
  }
40261
40347
  };
40262
40348
  const shouldShowTooltip = (element, content) => {
@@ -40323,15 +40409,7 @@ const TableBody = /*#__PURE__*/forwardRef(({
40323
40409
  document.removeEventListener("click", handleClickOutside);
40324
40410
  };
40325
40411
  }, []);
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
- });
40412
+
40335
40413
  // Return null if no data
40336
40414
  if (data.length === 0) {
40337
40415
  return /*#__PURE__*/React$1.createElement(StyledTableBody, {
@@ -40380,39 +40458,57 @@ const TableBody = /*#__PURE__*/forwardRef(({
40380
40458
  }) : null, columns.map((column, columnIndex) => {
40381
40459
  if (!column || !column.key) {
40382
40460
  console.warn(`Invalid column at index ${columnIndex}:`, column);
40383
- return null;
40461
+ return /*#__PURE__*/React$1.createElement(TableCell, {
40462
+ key: `invalid-${columnIndex}`
40463
+ }, "Invalid Column");
40384
40464
  }
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;
40465
+ let value, formattedValue, shimmerText, isShimmering;
40391
40466
  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
- }
40467
+ value = row[column.key];
40468
+ formattedValue = formatValue(value, column, row, rowIndex) || "";
40397
40469
  } catch (e) {
40398
- console.warn("Error with shimmer effect:", e);
40470
+ console.error("Error formatting value:", e);
40471
+ formattedValue = "";
40472
+ }
40473
+
40474
+ // Initialize shimmer defaults
40475
+ shimmerText = formattedValue;
40476
+ isShimmering = false;
40477
+
40478
+ // Only use shimmer hook for text-based fields
40479
+ const isTextBasedField = column.fieldType?.toLowerCase() === "text" || column.fieldType?.toLowerCase() === "currency" || column.fieldType?.toLowerCase() === "number" || column.fieldType?.toLowerCase() === "percentage" || column.fieldType?.toLowerCase() === "date" || !column.fieldType;
40480
+ if (isTextBasedField && typeof useShimmerChromeEffect === 'function') {
40481
+ try {
40482
+ const shimmerResult = useShimmerChromeEffect(String(formattedValue || ""), rowIndex, indexToShimmer, columnIndex, columns.length);
40483
+ if (shimmerResult && typeof shimmerResult === 'object') {
40484
+ shimmerText = shimmerResult.text || formattedValue;
40485
+ isShimmering = Boolean(shimmerResult.isShimmering);
40486
+ }
40487
+ } catch (e) {
40488
+ console.warn("Error with shimmer effect:", e);
40489
+ }
40399
40490
  }
40400
40491
  return /*#__PURE__*/React$1.createElement(TableCell, {
40401
40492
  key: `${column.key}-${rowIndex}`,
40402
40493
  ref: el => {
40403
- if (el && shouldShowTooltip(el)) {
40494
+ if (el && formattedValue && shouldShowTooltip(el)) {
40404
40495
  try {
40405
40496
  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);
40497
+ if (rect.width > 0 && rect.height > 0) {
40498
+ const tooltipInfo = calculateTooltipOffset(String(formattedValue), true);
40499
+ if (tooltipInfo) {
40500
+ const {
40501
+ offset,
40502
+ height
40503
+ } = tooltipInfo;
40504
+ el.style.setProperty("--cell-top", `${rect.top}px`);
40505
+ el.style.setProperty("--cell-left", `${rect.left}px`);
40506
+ el.style.setProperty("--cell-width", `${rect.width}px`);
40507
+ el.style.setProperty("--cell-offset", `${offset}px`);
40508
+ el.style.setProperty("--cell-height", `${height}px`);
40509
+ el.setAttribute("data-tooltip", String(formattedValue));
40510
+ }
40511
+ }
40416
40512
  } catch (e) {
40417
40513
  console.warn("Error setting cell tooltip:", e);
40418
40514
  }
@@ -40422,10 +40518,10 @@ const TableBody = /*#__PURE__*/forwardRef(({
40422
40518
  $color: column.color,
40423
40519
  $minWidth: column.minWidth,
40424
40520
  $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,
40521
+ }, isTextBasedField ? typeof ChromeShimmerText === 'function' ? /*#__PURE__*/React$1.createElement(ChromeShimmerText, {
40522
+ text: String(shimmerText || ""),
40427
40523
  isShimmering: isShimmering
40428
- }) : formattedValue);
40524
+ }) : String(shimmerText || "") : formattedValue || "");
40429
40525
  })), expandable && expandedRows[rowIndex] && /*#__PURE__*/React$1.createElement(ExpandedRow, {
40430
40526
  $expandedBackgroundColor: expandedBackgroundColor
40431
40527
  }, /*#__PURE__*/React$1.createElement(TableCell, {
@@ -54947,6 +55043,7 @@ const ToasterMessageBox = _ref => {
54947
55043
  linkText = '',
54948
55044
  duration = 5,
54949
55045
  width = '500px',
55046
+ icon = OkCircleIcon,
54950
55047
  onLinkClick = () => {},
54951
55048
  onClose = () => {}
54952
55049
  } = _ref;
@@ -54985,7 +55082,9 @@ const ToasterMessageBox = _ref => {
54985
55082
  $isClosing: isClosing
54986
55083
  }, /*#__PURE__*/React$1.createElement(IconWrapper, {
54987
55084
  $color: color
54988
- }, /*#__PURE__*/React$1.createElement(OkCircleIcon, {
55085
+ }, icon === 'error' ? /*#__PURE__*/React$1.createElement(ErrorIcon, {
55086
+ color: "white"
55087
+ }) : /*#__PURE__*/React$1.createElement(OkCircleIcon, {
54989
55088
  color: color,
54990
55089
  width: "40",
54991
55090
  height: "40"