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.js CHANGED
@@ -42317,6 +42317,24 @@ styled__default["default"].div`
42317
42317
  }
42318
42318
  `}
42319
42319
  `;
42320
+ const CheckboxWrapper = styled__default["default"].div`
42321
+ display: flex;
42322
+ align-items: center;
42323
+ position: relative;
42324
+ width: 100%;
42325
+ height: 100%;
42326
+
42327
+ ${tooltipStyles$1}
42328
+ `;
42329
+ const CellContentWrapper = styled__default["default"].div`
42330
+ display: flex;
42331
+ align-items: center;
42332
+ width: 100%;
42333
+ height: 100%;
42334
+ position: relative;
42335
+
42336
+ ${tooltipStyles$1}
42337
+ `;
42320
42338
  const CheckboxInput = styled__default["default"].input`
42321
42339
  width: 18px;
42322
42340
  height: 18px;
@@ -43099,7 +43117,6 @@ const TableBody = /*#__PURE__*/React$1.forwardRef(({
43099
43117
  onDropdownSelected = () => {},
43100
43118
  onCheckboxClick = () => {},
43101
43119
  onHeaderCheckboxClick = () => {},
43102
- disableCheckboxTooltipText = "",
43103
43120
  onHeroClick = () => {},
43104
43121
  onEditableClick = () => {},
43105
43122
  isEditMode = false,
@@ -43233,6 +43250,29 @@ const TableBody = /*#__PURE__*/React$1.forwardRef(({
43233
43250
  if (typeof tag !== "string") return String(tag || "");
43234
43251
  return tag.replace(/-/g, " ").replace(/\b\w/g, l => l.toUpperCase());
43235
43252
  };
43253
+ const applyTooltip = (element, tooltipText) => {
43254
+ if (!element || !tooltipText || tooltipText.trim() === "") return;
43255
+ try {
43256
+ const rect = element.getBoundingClientRect();
43257
+ if (rect.width > 0 && rect.height > 0) {
43258
+ const tooltipInfo = calculateTooltipOffset(tooltipText);
43259
+ if (tooltipInfo) {
43260
+ const {
43261
+ offset,
43262
+ height
43263
+ } = tooltipInfo;
43264
+ element.style.setProperty("--tooltip-top", `${rect.top}px`);
43265
+ element.style.setProperty("--tooltip-left", `${rect.left}px`);
43266
+ element.style.setProperty("--tooltip-width", `${rect.width}px`);
43267
+ element.style.setProperty("--tooltip-offset", `${offset}px`);
43268
+ element.style.setProperty("--tooltip-height", `${height}px`);
43269
+ element.setAttribute("data-tooltip", tooltipText);
43270
+ }
43271
+ }
43272
+ } catch (e) {
43273
+ console.warn("Error applying tooltip:", e);
43274
+ }
43275
+ };
43236
43276
  const formatValue = (value, column, row, rowIndex) => {
43237
43277
  if (!column) {
43238
43278
  console.warn('formatValue called with null/undefined column');
@@ -43701,12 +43741,7 @@ const TableBody = /*#__PURE__*/React$1.forwardRef(({
43701
43741
  try {
43702
43742
  const isChecked = Boolean(value);
43703
43743
  const isDisabled = row[`checkboxDisabled_${column.key}`] === true || column.key && row[`checkboxDisabled_${column.key}`] === true;
43704
- return /*#__PURE__*/React__default["default"].createElement("div", {
43705
- style: {
43706
- display: "flex",
43707
- alignItems: "center"
43708
- }
43709
- }, /*#__PURE__*/React__default["default"].createElement(CheckboxInput, {
43744
+ return /*#__PURE__*/React__default["default"].createElement(CheckboxWrapper, null, /*#__PURE__*/React__default["default"].createElement(CheckboxInput, {
43710
43745
  type: "checkbox",
43711
43746
  checked: isChecked,
43712
43747
  disabled: isDisabled,
@@ -43752,6 +43787,15 @@ const TableBody = /*#__PURE__*/React$1.forwardRef(({
43752
43787
  const shouldShowTooltip = (element, content) => {
43753
43788
  return element && element.scrollWidth > element.clientWidth;
43754
43789
  };
43790
+ const renderCellContent = (formattedValue, isTextBasedField, shouldShimmer) => {
43791
+ if (isTextBasedField && shouldShimmer) {
43792
+ return typeof ChromeShimmerText === 'function' ? /*#__PURE__*/React__default["default"].createElement(ChromeShimmerText, {
43793
+ text: String(formattedValue || ""),
43794
+ isShimmering: true
43795
+ }) : String(formattedValue || "");
43796
+ }
43797
+ return formattedValue || "";
43798
+ };
43755
43799
  const handleExpandClick = (row, rowIndex, event) => {
43756
43800
  event.stopPropagation();
43757
43801
  if (onExpandRow) {
@@ -43912,20 +43956,25 @@ const TableBody = /*#__PURE__*/React$1.forwardRef(({
43912
43956
  key: `invalid-${columnIndex}`
43913
43957
  }, "Invalid Column");
43914
43958
  }
43915
- let value, formattedValue;
43959
+ let value, formattedValue, fieldTooltip;
43916
43960
  try {
43917
43961
  value = column.key.includes('.') ? getNestedValue(row, column.key) : row[column.key];
43962
+ fieldTooltip = null;
43963
+ if (row.tooltips && row.tooltips[column.key]) {
43964
+ fieldTooltip = row.tooltips[column.key];
43965
+ }
43918
43966
  formattedValue = formatValue(value, column, row, rowIndex) || "";
43919
43967
  } catch (e) {
43920
43968
  console.error("Error formatting value:", e);
43921
43969
  formattedValue = "";
43922
43970
  }
43923
- const isTextBasedField = column.fieldType?.toLowerCase() === "text" || column.fieldType?.toLowerCase() === "currency" || column.fieldType?.toLowerCase() === "number" || column.fieldType?.toLowerCase() === "percentage" || column.fieldType?.toLowerCase() === "date" || !column.fieldType;
43971
+ const fieldType = column.fieldType?.toLowerCase();
43972
+ const isTextBasedField = fieldType === "text" || fieldType === "currency" || fieldType === "number" || fieldType === "percentage" || fieldType === "date" || fieldType === "array" || fieldType === "boolean" || !fieldType;
43924
43973
  const shouldShimmer = isTextBasedField && rowIndex === shimmerRowIndex && shimmerStartTime !== null;
43925
43974
  return /*#__PURE__*/React__default["default"].createElement(TableCell, {
43926
43975
  key: `${column.key}-${rowIndex}`,
43927
43976
  ref: el => {
43928
- if (el && formattedValue && shouldShowTooltip(el)) {
43977
+ if (!fieldTooltip && isTextBasedField && el && formattedValue && shouldShowTooltip(el)) {
43929
43978
  try {
43930
43979
  const rect = el.getBoundingClientRect();
43931
43980
  if (rect.width > 0 && rect.height > 0) {
@@ -43948,14 +43997,13 @@ const TableBody = /*#__PURE__*/React$1.forwardRef(({
43948
43997
  }
43949
43998
  }
43950
43999
  },
43951
- $fieldType: column.fieldType?.toLowerCase(),
44000
+ $fieldType: fieldType,
43952
44001
  $color: column.color,
43953
44002
  $minWidth: column.minWidth,
43954
44003
  $maxWidth: column.maxWidth
43955
- }, isTextBasedField && shouldShimmer ? typeof ChromeShimmerText === 'function' ? /*#__PURE__*/React__default["default"].createElement(ChromeShimmerText, {
43956
- text: String(formattedValue || ""),
43957
- isShimmering: true
43958
- }) : String(formattedValue || "") : formattedValue || "");
44004
+ }, fieldTooltip ? /*#__PURE__*/React__default["default"].createElement(CellContentWrapper, {
44005
+ ref: el => applyTooltip(el, fieldTooltip)
44006
+ }, renderCellContent(formattedValue, isTextBasedField, shouldShimmer)) : renderCellContent(formattedValue, isTextBasedField, shouldShimmer));
43959
44007
  })), expandable && expandedRows[rowIndex] && /*#__PURE__*/React__default["default"].createElement(ExpandedRow, {
43960
44008
  $expandedBackgroundColor: expandedBackgroundColor
43961
44009
  }, /*#__PURE__*/React__default["default"].createElement(TableCell, {