sag_components 2.0.0-beta318 → 2.0.0-beta319

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
@@ -42307,6 +42307,24 @@ styled.div`
42307
42307
  }
42308
42308
  `}
42309
42309
  `;
42310
+ const CheckboxWrapper = styled.div`
42311
+ display: flex;
42312
+ align-items: center;
42313
+ position: relative;
42314
+ width: 100%;
42315
+ height: 100%;
42316
+
42317
+ ${tooltipStyles$1}
42318
+ `;
42319
+ const CellContentWrapper = styled.div`
42320
+ display: flex;
42321
+ align-items: center;
42322
+ width: 100%;
42323
+ height: 100%;
42324
+ position: relative;
42325
+
42326
+ ${tooltipStyles$1}
42327
+ `;
42310
42328
  const CheckboxInput = styled.input`
42311
42329
  width: 18px;
42312
42330
  height: 18px;
@@ -43089,7 +43107,6 @@ const TableBody = /*#__PURE__*/forwardRef(({
43089
43107
  onDropdownSelected = () => {},
43090
43108
  onCheckboxClick = () => {},
43091
43109
  onHeaderCheckboxClick = () => {},
43092
- disableCheckboxTooltipText = "",
43093
43110
  onHeroClick = () => {},
43094
43111
  onEditableClick = () => {},
43095
43112
  isEditMode = false,
@@ -43223,6 +43240,29 @@ const TableBody = /*#__PURE__*/forwardRef(({
43223
43240
  if (typeof tag !== "string") return String(tag || "");
43224
43241
  return tag.replace(/-/g, " ").replace(/\b\w/g, l => l.toUpperCase());
43225
43242
  };
43243
+ const applyTooltip = (element, tooltipText) => {
43244
+ if (!element || !tooltipText || tooltipText.trim() === "") return;
43245
+ try {
43246
+ const rect = element.getBoundingClientRect();
43247
+ if (rect.width > 0 && rect.height > 0) {
43248
+ const tooltipInfo = calculateTooltipOffset(tooltipText);
43249
+ if (tooltipInfo) {
43250
+ const {
43251
+ offset,
43252
+ height
43253
+ } = tooltipInfo;
43254
+ element.style.setProperty("--tooltip-top", `${rect.top}px`);
43255
+ element.style.setProperty("--tooltip-left", `${rect.left}px`);
43256
+ element.style.setProperty("--tooltip-width", `${rect.width}px`);
43257
+ element.style.setProperty("--tooltip-offset", `${offset}px`);
43258
+ element.style.setProperty("--tooltip-height", `${height}px`);
43259
+ element.setAttribute("data-tooltip", tooltipText);
43260
+ }
43261
+ }
43262
+ } catch (e) {
43263
+ console.warn("Error applying tooltip:", e);
43264
+ }
43265
+ };
43226
43266
  const formatValue = (value, column, row, rowIndex) => {
43227
43267
  if (!column) {
43228
43268
  console.warn('formatValue called with null/undefined column');
@@ -43691,12 +43731,7 @@ const TableBody = /*#__PURE__*/forwardRef(({
43691
43731
  try {
43692
43732
  const isChecked = Boolean(value);
43693
43733
  const isDisabled = row[`checkboxDisabled_${column.key}`] === true || column.key && row[`checkboxDisabled_${column.key}`] === true;
43694
- return /*#__PURE__*/React$1.createElement("div", {
43695
- style: {
43696
- display: "flex",
43697
- alignItems: "center"
43698
- }
43699
- }, /*#__PURE__*/React$1.createElement(CheckboxInput, {
43734
+ return /*#__PURE__*/React$1.createElement(CheckboxWrapper, null, /*#__PURE__*/React$1.createElement(CheckboxInput, {
43700
43735
  type: "checkbox",
43701
43736
  checked: isChecked,
43702
43737
  disabled: isDisabled,
@@ -43742,6 +43777,15 @@ const TableBody = /*#__PURE__*/forwardRef(({
43742
43777
  const shouldShowTooltip = (element, content) => {
43743
43778
  return element && element.scrollWidth > element.clientWidth;
43744
43779
  };
43780
+ const renderCellContent = (formattedValue, isTextBasedField, shouldShimmer) => {
43781
+ if (isTextBasedField && shouldShimmer) {
43782
+ return typeof ChromeShimmerText === 'function' ? /*#__PURE__*/React$1.createElement(ChromeShimmerText, {
43783
+ text: String(formattedValue || ""),
43784
+ isShimmering: true
43785
+ }) : String(formattedValue || "");
43786
+ }
43787
+ return formattedValue || "";
43788
+ };
43745
43789
  const handleExpandClick = (row, rowIndex, event) => {
43746
43790
  event.stopPropagation();
43747
43791
  if (onExpandRow) {
@@ -43902,20 +43946,25 @@ const TableBody = /*#__PURE__*/forwardRef(({
43902
43946
  key: `invalid-${columnIndex}`
43903
43947
  }, "Invalid Column");
43904
43948
  }
43905
- let value, formattedValue;
43949
+ let value, formattedValue, fieldTooltip;
43906
43950
  try {
43907
43951
  value = column.key.includes('.') ? getNestedValue(row, column.key) : row[column.key];
43952
+ fieldTooltip = null;
43953
+ if (row.tooltips && row.tooltips[column.key]) {
43954
+ fieldTooltip = row.tooltips[column.key];
43955
+ }
43908
43956
  formattedValue = formatValue(value, column, row, rowIndex) || "";
43909
43957
  } catch (e) {
43910
43958
  console.error("Error formatting value:", e);
43911
43959
  formattedValue = "";
43912
43960
  }
43913
- const isTextBasedField = column.fieldType?.toLowerCase() === "text" || column.fieldType?.toLowerCase() === "currency" || column.fieldType?.toLowerCase() === "number" || column.fieldType?.toLowerCase() === "percentage" || column.fieldType?.toLowerCase() === "date" || !column.fieldType;
43961
+ const fieldType = column.fieldType?.toLowerCase();
43962
+ const isTextBasedField = fieldType === "text" || fieldType === "currency" || fieldType === "number" || fieldType === "percentage" || fieldType === "date" || fieldType === "array" || fieldType === "boolean" || !fieldType;
43914
43963
  const shouldShimmer = isTextBasedField && rowIndex === shimmerRowIndex && shimmerStartTime !== null;
43915
43964
  return /*#__PURE__*/React$1.createElement(TableCell, {
43916
43965
  key: `${column.key}-${rowIndex}`,
43917
43966
  ref: el => {
43918
- if (el && formattedValue && shouldShowTooltip(el)) {
43967
+ if (!fieldTooltip && isTextBasedField && el && formattedValue && shouldShowTooltip(el)) {
43919
43968
  try {
43920
43969
  const rect = el.getBoundingClientRect();
43921
43970
  if (rect.width > 0 && rect.height > 0) {
@@ -43938,14 +43987,13 @@ const TableBody = /*#__PURE__*/forwardRef(({
43938
43987
  }
43939
43988
  }
43940
43989
  },
43941
- $fieldType: column.fieldType?.toLowerCase(),
43990
+ $fieldType: fieldType,
43942
43991
  $color: column.color,
43943
43992
  $minWidth: column.minWidth,
43944
43993
  $maxWidth: column.maxWidth
43945
- }, isTextBasedField && shouldShimmer ? typeof ChromeShimmerText === 'function' ? /*#__PURE__*/React$1.createElement(ChromeShimmerText, {
43946
- text: String(formattedValue || ""),
43947
- isShimmering: true
43948
- }) : String(formattedValue || "") : formattedValue || "");
43994
+ }, fieldTooltip ? /*#__PURE__*/React$1.createElement(CellContentWrapper, {
43995
+ ref: el => applyTooltip(el, fieldTooltip)
43996
+ }, renderCellContent(formattedValue, isTextBasedField, shouldShimmer)) : renderCellContent(formattedValue, isTextBasedField, shouldShimmer));
43949
43997
  })), expandable && expandedRows[rowIndex] && /*#__PURE__*/React$1.createElement(ExpandedRow, {
43950
43998
  $expandedBackgroundColor: expandedBackgroundColor
43951
43999
  }, /*#__PURE__*/React$1.createElement(TableCell, {