sag_components 2.0.0-beta222 → 2.0.0-beta224

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
@@ -9289,7 +9289,7 @@ const Label$7 = styled.label`
9289
9289
  position: absolute;
9290
9290
  top: ${props => {
9291
9291
  const height = parseInt(props.height.replace('px', ''), 10);
9292
- return props.isFocused || props.hasValue ? '0px' : `${height / 2}px`;
9292
+ return props.isFocused || props.hasValue ? '0px' : `${height / 2 - 4}px`;
9293
9293
  }};
9294
9294
  left: ${props => props.isFocused || props.hasValue ? '23px' : '10px'};
9295
9295
  font-family: Poppins;
@@ -39627,6 +39627,22 @@ const HeroButton = styled.button`
39627
39627
  pointer-events: none;
39628
39628
  }
39629
39629
  `;
39630
+ const EditableCell = styled.div`
39631
+ display: flex;
39632
+ gap: 10px;
39633
+ align-items: center;
39634
+ `;
39635
+ const PencilButton = styled.button`
39636
+ display: flex;
39637
+ align-items: center;
39638
+ justify-content: center;
39639
+ cursor: pointer;
39640
+ background-color: transparent;
39641
+ border: none;
39642
+ > svg {
39643
+ pointer-events: none;
39644
+ }
39645
+ `;
39630
39646
 
39631
39647
  // MessageBox.styles.js
39632
39648
  const ModalOverlay = styled.div`
@@ -40122,6 +40138,21 @@ const HeroIcon = ({
40122
40138
  fill: "white"
40123
40139
  }))));
40124
40140
 
40141
+ const PencilIcon = ({
40142
+ width = "15",
40143
+ height = "15",
40144
+ fill = "#B1B1B1"
40145
+ }) => /*#__PURE__*/React$1.createElement("svg", {
40146
+ width: width,
40147
+ height: height,
40148
+ viewBox: "0 0 15 15",
40149
+ fill: "none",
40150
+ xmlns: "http://www.w3.org/2000/svg"
40151
+ }, /*#__PURE__*/React$1.createElement("path", {
40152
+ d: "M1.78316 10.0243C1.89427 9.63542 2.11649 9.27426 2.39427 8.99648L10.8387 0.552084C11.5331 -0.142361 12.6721 -0.142361 13.3665 0.552084L14.4498 1.63542C14.5331 1.71875 14.6165 1.82986 14.6721 1.9132C15.1442 2.60764 15.0609 3.55208 14.4498 4.1632L6.00538 12.6076C5.9776 12.6354 5.92204 12.6632 5.89427 12.7187C5.61649 12.9409 5.31093 13.1076 4.9776 13.2187L2.81093 13.8576L1.61649 14.2187C1.39427 14.2743 1.14427 14.2187 0.9776 14.0243C0.78316 13.8576 0.727604 13.6076 0.810938 13.3854L1.14427 12.191L1.78316 10.0243ZM3.06093 10.4132L2.86649 11.052L2.42204 12.5799L3.94982 12.1354L4.58871 11.9409C4.78316 11.8854 4.92204 11.8021 5.06093 11.6632L11.422 5.30208L9.69979 3.57986L3.33871 9.94093C3.31093 9.94093 3.31093 9.96875 3.28316 9.99648C3.17204 10.1076 3.11649 10.2465 3.06093 10.4132Z",
40153
+ fill: fill
40154
+ }));
40155
+
40125
40156
  // combinedShimmerHooks.js - Chrome shimmer effect integrated with your hooks
40126
40157
 
40127
40158
  // Chrome Shimmer Component
@@ -40222,7 +40253,8 @@ const TableBody = /*#__PURE__*/forwardRef(({
40222
40253
  onDropdownSelected = () => {},
40223
40254
  onCheckboxClick = () => {},
40224
40255
  onHeaderCheckboxClick = () => {},
40225
- onHeroClick = () => {}
40256
+ onHeroClick = () => {},
40257
+ onEditableClick = () => {}
40226
40258
  }, ref) => {
40227
40259
  // MOVE ALL VALIDATION TO THE VERY TOP BEFORE ANY HOOKS
40228
40260
  if (!Array.isArray(data) || !Array.isArray(columns)) {
@@ -40302,6 +40334,26 @@ const TableBody = /*#__PURE__*/forwardRef(({
40302
40334
  }
40303
40335
  }, [changeFocusIndex]);
40304
40336
 
40337
+ // Close all dropdowns when clicking outside
40338
+ useEffect(() => {
40339
+ const handleClickOutside = () => {
40340
+ setOpenDropdowns({});
40341
+ };
40342
+ document.addEventListener("click", handleClickOutside);
40343
+ return () => {
40344
+ document.removeEventListener("click", handleClickOutside);
40345
+ };
40346
+ }, []);
40347
+
40348
+ // HANDLE SPECIAL CASE: EMPTY DATA AFTER ALL HOOKS
40349
+ if (data.length === 0) {
40350
+ return /*#__PURE__*/React$1.createElement(StyledTableBody, {
40351
+ ref: ref
40352
+ }, /*#__PURE__*/React$1.createElement(TableRow, null, /*#__PURE__*/React$1.createElement(TableCell, {
40353
+ colSpan: columns.length
40354
+ }, "No data available")));
40355
+ }
40356
+
40305
40357
  // Handle row click for focus state
40306
40358
  const handleRowClick = (row, rowIndex) => {
40307
40359
  setFocusedRowIndex(rowIndex);
@@ -40359,7 +40411,7 @@ const TableBody = /*#__PURE__*/forwardRef(({
40359
40411
  return "";
40360
40412
  }
40361
40413
  try {
40362
- if ((value === null || value === undefined) && column?.fieldType?.toLowerCase() !== "comments") {
40414
+ if ((value === null || value === undefined) && column?.fieldType?.toLowerCase() !== "comments" && column?.fieldType?.toLowerCase() !== "editable") {
40363
40415
  return "";
40364
40416
  }
40365
40417
 
@@ -40490,6 +40542,23 @@ const TableBody = /*#__PURE__*/forwardRef(({
40490
40542
  console.warn('Error formatting dotIndicator:', e);
40491
40543
  return null;
40492
40544
  }
40545
+ case "editable":
40546
+ try {
40547
+ const isDefine = value === null || value === undefined;
40548
+ return /*#__PURE__*/React$1.createElement(EditableCell, null, /*#__PURE__*/React$1.createElement("span", {
40549
+ style: {
40550
+ color: isDefine ? "#8B8989" : "inherit"
40551
+ }
40552
+ }, value ?? "Define"), /*#__PURE__*/React$1.createElement(PencilButton, {
40553
+ onClick: e => {
40554
+ e.stopPropagation();
40555
+ handleEditableClick(row, column.key, value, rowIndex);
40556
+ }
40557
+ }, /*#__PURE__*/React$1.createElement(PencilIcon, null)));
40558
+ } catch (e) {
40559
+ console.warn('Error formatting editable:', e);
40560
+ return null;
40561
+ }
40493
40562
  case "packagestatus":
40494
40563
  try {
40495
40564
  const applyTooltipLogic = (element, tooltipText) => {
@@ -40783,7 +40852,7 @@ const TableBody = /*#__PURE__*/forwardRef(({
40783
40852
  if (value === null || value === undefined) return null;
40784
40853
  return /*#__PURE__*/React$1.createElement(HeroButton, {
40785
40854
  onClick: e => {
40786
- // e.stopPropagation();
40855
+ e.stopPropagation();
40787
40856
  if (onHeroClick) {
40788
40857
  onHeroClick(row, !value);
40789
40858
  }
@@ -40860,26 +40929,17 @@ const TableBody = /*#__PURE__*/forwardRef(({
40860
40929
  onDropdownSelected(row, selectedOption, columnKey);
40861
40930
  }
40862
40931
  };
40863
-
40864
- // Close all dropdowns when clicking outside
40865
- React$1.useEffect(() => {
40866
- const handleClickOutside = () => {
40867
- setOpenDropdowns({});
40868
- };
40869
- document.addEventListener("click", handleClickOutside);
40870
- return () => {
40871
- document.removeEventListener("click", handleClickOutside);
40872
- };
40873
- }, []);
40874
-
40875
- // HANDLE SPECIAL CASE: EMPTY DATA AFTER ALL HOOKS
40876
- if (data.length === 0) {
40877
- return /*#__PURE__*/React$1.createElement(StyledTableBody, {
40878
- ref: ref
40879
- }, /*#__PURE__*/React$1.createElement(TableRow, null, /*#__PURE__*/React$1.createElement(TableCell, {
40880
- colSpan: columns.length
40881
- }, "No data available")));
40882
- }
40932
+ const handleEditableClick = (row, columnKey, currentValue, rowIndex) => {
40933
+ if (onEditableClick) {
40934
+ onEditableClick({
40935
+ fullRow: row,
40936
+ columnName: columnKey,
40937
+ currentValue: currentValue,
40938
+ rowIndex: rowIndex
40939
+ });
40940
+ }
40941
+ console.log('handler--------', row, columnKey, currentValue, rowIndex);
40942
+ };
40883
40943
  return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement(StyledTableBody, {
40884
40944
  ref: ref
40885
40945
  }, data.map((row, rowIndex) => {
@@ -41029,7 +41089,8 @@ TableBody.propTypes = {
41029
41089
  onDropdownSelected: PropTypes.func,
41030
41090
  onCheckboxClick: PropTypes.func,
41031
41091
  onHeaderCheckboxClick: PropTypes.func,
41032
- onHeroClick: PropTypes.func
41092
+ onHeroClick: PropTypes.func,
41093
+ onEditableClick: PropTypes.func
41033
41094
  };
41034
41095
  TableBody.displayName = "TableBody";
41035
41096
 
@@ -44394,6 +44455,7 @@ const Table = props => {
44394
44455
  headerCheckboxStates = {},
44395
44456
  onHeroClick = () => {},
44396
44457
  dotIndicatorColor = '#34D399',
44458
+ onEditableClick = () => {},
44397
44459
  // Accept ref as a regular prop
44398
44460
  ref = null
44399
44461
  } = props;
@@ -44547,7 +44609,8 @@ const Table = props => {
44547
44609
  onDropdownSelected: onDropdownSelected,
44548
44610
  onCheckboxClick: onCheckboxClick,
44549
44611
  onHeaderCheckboxClick: onHeaderCheckboxClick,
44550
- onHeroClick: onHeroClick
44612
+ onHeroClick: onHeroClick,
44613
+ onEditableClick: onEditableClick
44551
44614
  })), data.length === 0 && /*#__PURE__*/React$1.createElement(NoEventsParent, null, /*#__PURE__*/React$1.createElement(NoEventsWrapper, null, showNoDataInSearch ? getNoDataSearchIcon(noDataSearchIcon) : getNoDataIcon(noDataIcon)), /*#__PURE__*/React$1.createElement(NoEventsMessage, null, showNoDataInSearch ? /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement("strong", null, noDataInSearchTitle), /*#__PURE__*/React$1.createElement("br", null), noDataInSearchMessage) : /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement("strong", null, noEventsTitle), /*#__PURE__*/React$1.createElement("br", null), noEventsSubtitle)), !showNoDataInSearch && showNoEventsButton && /*#__PURE__*/React$1.createElement(Button$1, {
44552
44615
  height: "45px",
44553
44616
  leftIcon: noEventsButtonIcon,