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.js CHANGED
@@ -9299,7 +9299,7 @@ const Label$7 = styled__default["default"].label`
9299
9299
  position: absolute;
9300
9300
  top: ${props => {
9301
9301
  const height = parseInt(props.height.replace('px', ''), 10);
9302
- return props.isFocused || props.hasValue ? '0px' : `${height / 2}px`;
9302
+ return props.isFocused || props.hasValue ? '0px' : `${height / 2 - 4}px`;
9303
9303
  }};
9304
9304
  left: ${props => props.isFocused || props.hasValue ? '23px' : '10px'};
9305
9305
  font-family: Poppins;
@@ -39637,6 +39637,22 @@ const HeroButton = styled__default["default"].button`
39637
39637
  pointer-events: none;
39638
39638
  }
39639
39639
  `;
39640
+ const EditableCell = styled__default["default"].div`
39641
+ display: flex;
39642
+ gap: 10px;
39643
+ align-items: center;
39644
+ `;
39645
+ const PencilButton = styled__default["default"].button`
39646
+ display: flex;
39647
+ align-items: center;
39648
+ justify-content: center;
39649
+ cursor: pointer;
39650
+ background-color: transparent;
39651
+ border: none;
39652
+ > svg {
39653
+ pointer-events: none;
39654
+ }
39655
+ `;
39640
39656
 
39641
39657
  // MessageBox.styles.js
39642
39658
  const ModalOverlay = styled__default["default"].div`
@@ -40132,6 +40148,21 @@ const HeroIcon = ({
40132
40148
  fill: "white"
40133
40149
  }))));
40134
40150
 
40151
+ const PencilIcon = ({
40152
+ width = "15",
40153
+ height = "15",
40154
+ fill = "#B1B1B1"
40155
+ }) => /*#__PURE__*/React__default["default"].createElement("svg", {
40156
+ width: width,
40157
+ height: height,
40158
+ viewBox: "0 0 15 15",
40159
+ fill: "none",
40160
+ xmlns: "http://www.w3.org/2000/svg"
40161
+ }, /*#__PURE__*/React__default["default"].createElement("path", {
40162
+ 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",
40163
+ fill: fill
40164
+ }));
40165
+
40135
40166
  // combinedShimmerHooks.js - Chrome shimmer effect integrated with your hooks
40136
40167
 
40137
40168
  // Chrome Shimmer Component
@@ -40232,7 +40263,8 @@ const TableBody = /*#__PURE__*/React$1.forwardRef(({
40232
40263
  onDropdownSelected = () => {},
40233
40264
  onCheckboxClick = () => {},
40234
40265
  onHeaderCheckboxClick = () => {},
40235
- onHeroClick = () => {}
40266
+ onHeroClick = () => {},
40267
+ onEditableClick = () => {}
40236
40268
  }, ref) => {
40237
40269
  // MOVE ALL VALIDATION TO THE VERY TOP BEFORE ANY HOOKS
40238
40270
  if (!Array.isArray(data) || !Array.isArray(columns)) {
@@ -40312,6 +40344,26 @@ const TableBody = /*#__PURE__*/React$1.forwardRef(({
40312
40344
  }
40313
40345
  }, [changeFocusIndex]);
40314
40346
 
40347
+ // Close all dropdowns when clicking outside
40348
+ React$1.useEffect(() => {
40349
+ const handleClickOutside = () => {
40350
+ setOpenDropdowns({});
40351
+ };
40352
+ document.addEventListener("click", handleClickOutside);
40353
+ return () => {
40354
+ document.removeEventListener("click", handleClickOutside);
40355
+ };
40356
+ }, []);
40357
+
40358
+ // HANDLE SPECIAL CASE: EMPTY DATA AFTER ALL HOOKS
40359
+ if (data.length === 0) {
40360
+ return /*#__PURE__*/React__default["default"].createElement(StyledTableBody, {
40361
+ ref: ref
40362
+ }, /*#__PURE__*/React__default["default"].createElement(TableRow, null, /*#__PURE__*/React__default["default"].createElement(TableCell, {
40363
+ colSpan: columns.length
40364
+ }, "No data available")));
40365
+ }
40366
+
40315
40367
  // Handle row click for focus state
40316
40368
  const handleRowClick = (row, rowIndex) => {
40317
40369
  setFocusedRowIndex(rowIndex);
@@ -40369,7 +40421,7 @@ const TableBody = /*#__PURE__*/React$1.forwardRef(({
40369
40421
  return "";
40370
40422
  }
40371
40423
  try {
40372
- if ((value === null || value === undefined) && column?.fieldType?.toLowerCase() !== "comments") {
40424
+ if ((value === null || value === undefined) && column?.fieldType?.toLowerCase() !== "comments" && column?.fieldType?.toLowerCase() !== "editable") {
40373
40425
  return "";
40374
40426
  }
40375
40427
 
@@ -40500,6 +40552,23 @@ const TableBody = /*#__PURE__*/React$1.forwardRef(({
40500
40552
  console.warn('Error formatting dotIndicator:', e);
40501
40553
  return null;
40502
40554
  }
40555
+ case "editable":
40556
+ try {
40557
+ const isDefine = value === null || value === undefined;
40558
+ return /*#__PURE__*/React__default["default"].createElement(EditableCell, null, /*#__PURE__*/React__default["default"].createElement("span", {
40559
+ style: {
40560
+ color: isDefine ? "#8B8989" : "inherit"
40561
+ }
40562
+ }, value ?? "Define"), /*#__PURE__*/React__default["default"].createElement(PencilButton, {
40563
+ onClick: e => {
40564
+ e.stopPropagation();
40565
+ handleEditableClick(row, column.key, value, rowIndex);
40566
+ }
40567
+ }, /*#__PURE__*/React__default["default"].createElement(PencilIcon, null)));
40568
+ } catch (e) {
40569
+ console.warn('Error formatting editable:', e);
40570
+ return null;
40571
+ }
40503
40572
  case "packagestatus":
40504
40573
  try {
40505
40574
  const applyTooltipLogic = (element, tooltipText) => {
@@ -40793,7 +40862,7 @@ const TableBody = /*#__PURE__*/React$1.forwardRef(({
40793
40862
  if (value === null || value === undefined) return null;
40794
40863
  return /*#__PURE__*/React__default["default"].createElement(HeroButton, {
40795
40864
  onClick: e => {
40796
- // e.stopPropagation();
40865
+ e.stopPropagation();
40797
40866
  if (onHeroClick) {
40798
40867
  onHeroClick(row, !value);
40799
40868
  }
@@ -40870,26 +40939,17 @@ const TableBody = /*#__PURE__*/React$1.forwardRef(({
40870
40939
  onDropdownSelected(row, selectedOption, columnKey);
40871
40940
  }
40872
40941
  };
40873
-
40874
- // Close all dropdowns when clicking outside
40875
- React__default["default"].useEffect(() => {
40876
- const handleClickOutside = () => {
40877
- setOpenDropdowns({});
40878
- };
40879
- document.addEventListener("click", handleClickOutside);
40880
- return () => {
40881
- document.removeEventListener("click", handleClickOutside);
40882
- };
40883
- }, []);
40884
-
40885
- // HANDLE SPECIAL CASE: EMPTY DATA AFTER ALL HOOKS
40886
- if (data.length === 0) {
40887
- return /*#__PURE__*/React__default["default"].createElement(StyledTableBody, {
40888
- ref: ref
40889
- }, /*#__PURE__*/React__default["default"].createElement(TableRow, null, /*#__PURE__*/React__default["default"].createElement(TableCell, {
40890
- colSpan: columns.length
40891
- }, "No data available")));
40892
- }
40942
+ const handleEditableClick = (row, columnKey, currentValue, rowIndex) => {
40943
+ if (onEditableClick) {
40944
+ onEditableClick({
40945
+ fullRow: row,
40946
+ columnName: columnKey,
40947
+ currentValue: currentValue,
40948
+ rowIndex: rowIndex
40949
+ });
40950
+ }
40951
+ console.log('handler--------', row, columnKey, currentValue, rowIndex);
40952
+ };
40893
40953
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(StyledTableBody, {
40894
40954
  ref: ref
40895
40955
  }, data.map((row, rowIndex) => {
@@ -41039,7 +41099,8 @@ TableBody.propTypes = {
41039
41099
  onDropdownSelected: PropTypes.func,
41040
41100
  onCheckboxClick: PropTypes.func,
41041
41101
  onHeaderCheckboxClick: PropTypes.func,
41042
- onHeroClick: PropTypes.func
41102
+ onHeroClick: PropTypes.func,
41103
+ onEditableClick: PropTypes.func
41043
41104
  };
41044
41105
  TableBody.displayName = "TableBody";
41045
41106
 
@@ -44404,6 +44465,7 @@ const Table = props => {
44404
44465
  headerCheckboxStates = {},
44405
44466
  onHeroClick = () => {},
44406
44467
  dotIndicatorColor = '#34D399',
44468
+ onEditableClick = () => {},
44407
44469
  // Accept ref as a regular prop
44408
44470
  ref = null
44409
44471
  } = props;
@@ -44557,7 +44619,8 @@ const Table = props => {
44557
44619
  onDropdownSelected: onDropdownSelected,
44558
44620
  onCheckboxClick: onCheckboxClick,
44559
44621
  onHeaderCheckboxClick: onHeaderCheckboxClick,
44560
- onHeroClick: onHeroClick
44622
+ onHeroClick: onHeroClick,
44623
+ onEditableClick: onEditableClick
44561
44624
  })), data.length === 0 && /*#__PURE__*/React__default["default"].createElement(NoEventsParent, null, /*#__PURE__*/React__default["default"].createElement(NoEventsWrapper, null, showNoDataInSearch ? getNoDataSearchIcon(noDataSearchIcon) : getNoDataIcon(noDataIcon)), /*#__PURE__*/React__default["default"].createElement(NoEventsMessage, null, showNoDataInSearch ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("strong", null, noDataInSearchTitle), /*#__PURE__*/React__default["default"].createElement("br", null), noDataInSearchMessage) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("strong", null, noEventsTitle), /*#__PURE__*/React__default["default"].createElement("br", null), noEventsSubtitle)), !showNoDataInSearch && showNoEventsButton && /*#__PURE__*/React__default["default"].createElement(Button$1, {
44562
44625
  height: "45px",
44563
44626
  leftIcon: noEventsButtonIcon,