sag_components 2.0.0-beta240 → 2.0.0-beta242

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
@@ -34981,17 +34981,18 @@ styled.css`
34981
34981
  * • onApply(start,end) — callback, both numbers (inclusive)
34982
34982
  * • onCancel() — callback
34983
34983
  */
34984
- const WeeksCalendar = ({
34985
- year,
34986
- defaultStartWeek = null,
34987
- defaultEndWeek = null,
34988
- backgroundColor = "#066768",
34989
- hoverBackgroundColor = "#E6F0F0",
34990
- allowedWeekRange = null,
34991
- // New prop for range restriction
34992
- onApply,
34993
- onCancel
34994
- }) => {
34984
+ const WeeksCalendar = _ref => {
34985
+ let {
34986
+ year,
34987
+ defaultStartWeek = null,
34988
+ defaultEndWeek = null,
34989
+ backgroundColor = "#066768",
34990
+ hoverBackgroundColor = "#E6F0F0",
34991
+ allowedWeekRange = null,
34992
+ // New prop for range restriction
34993
+ onApply,
34994
+ onCancel
34995
+ } = _ref;
34995
34996
  // state -------------------------------------------------
34996
34997
  const [startWeek, setStartWeek] = React$1.useState(defaultStartWeek);
34997
34998
  const [endWeek, setEndWeek] = React$1.useState(defaultEndWeek);
@@ -35209,6 +35210,7 @@ const WeeksPicker = _ref => {
35209
35210
  borderColor,
35210
35211
  borderColorFocus,
35211
35212
  textColor,
35213
+ text = 'Week',
35212
35214
  hoverColor,
35213
35215
  required,
35214
35216
  placeholder,
@@ -35441,7 +35443,7 @@ const WeeksPicker = _ref => {
35441
35443
  console.warn('Selected weeks are outside the allowed range');
35442
35444
  return;
35443
35445
  }
35444
- const tempValue = end === start ? `Week ${start}` : `Weeks ${start} - ${end}`;
35446
+ const tempValue = end === start ? text === 'Week' ? `${text} ${start}` : `${text}${start}` : text === 'Week' ? `${text}s ${start} - ${end}` : `${text}${start} - ${end}`;
35445
35447
  onChange(tempValue);
35446
35448
  setValue(tempValue);
35447
35449
  handleApply();
@@ -42703,7 +42705,9 @@ const TableBody = /*#__PURE__*/React$1.forwardRef(({
42703
42705
  onCheckboxClick = () => {},
42704
42706
  onHeaderCheckboxClick = () => {},
42705
42707
  onHeroClick = () => {},
42706
- onEditableClick = () => {}
42708
+ onEditableClick = () => {},
42709
+ isEditMode = false,
42710
+ editRowIndex = -1
42707
42711
  }, ref) => {
42708
42712
  // MOVE ALL VALIDATION TO THE VERY TOP BEFORE ANY HOOKS
42709
42713
  if (!Array.isArray(data) || !Array.isArray(columns)) {
@@ -42805,9 +42809,12 @@ const TableBody = /*#__PURE__*/React$1.forwardRef(({
42805
42809
 
42806
42810
  // Handle row click for focus state
42807
42811
  const handleRowClick = (row, rowIndex) => {
42812
+ if (isEditMode && editRowIndex !== -1) {
42813
+ return;
42814
+ }
42808
42815
  setFocusedRowIndex(rowIndex);
42809
42816
  if (onRowClick) {
42810
- onRowClick(row);
42817
+ onRowClick(row, rowIndex);
42811
42818
  }
42812
42819
  };
42813
42820
 
@@ -43428,15 +43435,16 @@ const TableBody = /*#__PURE__*/React$1.forwardRef(({
43428
43435
  console.warn(`Invalid row at index ${rowIndex}:`, row);
43429
43436
  return null;
43430
43437
  }
43438
+ const shouldBeFocused = isEditMode ? rowIndex === editRowIndex : focusedRowIndex === rowIndex;
43431
43439
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, {
43432
43440
  key: row.id || `row-${rowIndex}`
43433
43441
  }, /*#__PURE__*/React__default["default"].createElement(TableRow, {
43434
43442
  "data-row-index": rowIndex,
43435
43443
  className: shimmerRowIndex === rowIndex ? "shimmer-row" : "",
43436
- isFocused: focusedRowIndex === rowIndex,
43444
+ isFocused: shouldBeFocused,
43437
43445
  selectedColor: selectedColor,
43438
- onMouseEnter: () => setHoveredRowIndex(rowIndex),
43439
- onMouseLeave: () => setHoveredRowIndex(null),
43446
+ onMouseEnter: () => !isEditMode && setHoveredRowIndex(rowIndex),
43447
+ onMouseLeave: () => !isEditMode && setHoveredRowIndex(null),
43440
43448
  onClick: () => handleRowClick(row, rowIndex)
43441
43449
  }, expandable && expandedContent[rowIndex] !== undefined && expandedContent[rowIndex] !== null ? /*#__PURE__*/React__default["default"].createElement(TableCell, {
43442
43450
  $fieldType: "expand",
@@ -43570,7 +43578,9 @@ TableBody.propTypes = {
43570
43578
  onCheckboxClick: PropTypes.func,
43571
43579
  onHeaderCheckboxClick: PropTypes.func,
43572
43580
  onHeroClick: PropTypes.func,
43573
- onEditableClick: PropTypes.func
43581
+ onEditableClick: PropTypes.func,
43582
+ isEditMode: PropTypes.bool,
43583
+ editRowIndex: PropTypes.number
43574
43584
  };
43575
43585
  TableBody.displayName = "TableBody";
43576
43586
 
@@ -47091,7 +47101,9 @@ const Table = props => {
47091
47101
  onCheckboxClick: onCheckboxClick,
47092
47102
  onHeaderCheckboxClick: onHeaderCheckboxClick,
47093
47103
  onHeroClick: onHeroClick,
47094
- onEditableClick: onEditableClick
47104
+ onEditableClick: onEditableClick,
47105
+ isEditMode: isEditMode,
47106
+ editRowIndex: editRowIndex
47095
47107
  })), 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, {
47096
47108
  height: "45px",
47097
47109
  leftIcon: noEventsButtonIcon,
@@ -57735,6 +57747,7 @@ const OverlayDropdown = _ref => {
57735
57747
  placeHolderColor,
57736
57748
  margin = "8px",
57737
57749
  editableDigitalCoupon = false,
57750
+ dropdownDigitalCouponTitle = "",
57738
57751
  ...props
57739
57752
  } = _ref;
57740
57753
  const [open, setOpen] = React$1.useState(false);
@@ -57745,8 +57758,6 @@ const OverlayDropdown = _ref => {
57745
57758
  const buttonRef = React$1.useRef(null);
57746
57759
  const dropdownRef = React$1.useRef(null);
57747
57760
  const containerRef = React$1.useRef(null);
57748
-
57749
- // Click outside to close dropdown
57750
57761
  React$1.useEffect(() => {
57751
57762
  const handleClickOutside = event => {
57752
57763
  if (containerRef.current && !containerRef.current.contains(event.target)) {
@@ -57762,20 +57773,13 @@ const OverlayDropdown = _ref => {
57762
57773
  document.removeEventListener("touchstart", handleClickOutside);
57763
57774
  };
57764
57775
  }, [open]);
57765
-
57766
- // Calculate dropdown position when opening
57767
57776
  React$1.useEffect(() => {
57768
57777
  if (open && buttonRef.current) {
57769
57778
  const buttonRect = buttonRef.current.getBoundingClientRect();
57770
57779
  const viewportHeight = window.innerHeight;
57771
57780
  const dropdownHeight = parseInt(dropdownMaxHeight, 10);
57772
-
57773
- // Space available below the button
57774
57781
  const spaceBelow = viewportHeight - buttonRect.bottom;
57775
- // Space available above the button
57776
57782
  const spaceAbove = buttonRect.top;
57777
-
57778
- // If there's not enough space below, but more space above, position above
57779
57783
  if (spaceBelow < dropdownHeight && spaceAbove > spaceBelow) {
57780
57784
  setDropdownPosition("above");
57781
57785
  } else {
@@ -57783,8 +57787,6 @@ const OverlayDropdown = _ref => {
57783
57787
  }
57784
57788
  }
57785
57789
  }, [open, dropdownMaxHeight, margin]);
57786
-
57787
- // Combine original data with "Last defined by you" group
57788
57790
  const getDataWithLastDefined = () => {
57789
57791
  const combinedData = [...data];
57790
57792
  if (lastDefinedGroup) {
@@ -57792,8 +57794,6 @@ const OverlayDropdown = _ref => {
57792
57794
  }
57793
57795
  return combinedData;
57794
57796
  };
57795
-
57796
- // Find selected item across all groups
57797
57797
  const findSelectedItem = () => {
57798
57798
  const allData = getDataWithLastDefined();
57799
57799
  for (const group of allData) {
@@ -57959,7 +57959,7 @@ const OverlayDropdown = _ref => {
57959
57959
  onMouseEnter: () => setHoveredText(selected?.label),
57960
57960
  onMouseLeave: () => setHoveredText(null),
57961
57961
  color: !selected && open ? placeHolderColor : "inherit"
57962
- }, selected ? selected.label : open ? placeHolder : ''), open ? /*#__PURE__*/React__default["default"].createElement(MenuItemUpIcon, {
57962
+ }, selected ? selected.label.includes("Digital") && editableDigitalCoupon ? dropdownDigitalCouponTitle !== "" ? dropdownDigitalCouponTitle : selected.label : selected.label : open ? placeHolder : ""), open ? /*#__PURE__*/React__default["default"].createElement(MenuItemUpIcon, {
57963
57963
  width: "12px",
57964
57964
  height: "12px",
57965
57965
  color: "#B1B1B1"
@@ -58007,9 +58007,10 @@ const OverlayDropdown = _ref => {
58007
58007
  }
58008
58008
  }
58009
58009
  }, /*#__PURE__*/React__default["default"].createElement(TruncatedText, {
58010
- onMouseEnter: () => setHoveredText(item.label),
58011
- onMouseLeave: () => setHoveredText(null)
58012
- }, item.label), group.templateType === 2 ? /*#__PURE__*/React__default["default"].createElement(ChervronRightIcon, {
58010
+ onMouseEnter: () => setHoveredText(selected?.label),
58011
+ onMouseLeave: () => setHoveredText(null),
58012
+ color: !selected && open ? placeHolderColor : "inherit"
58013
+ }, group.templateType === 3 && editableDigitalCoupon ? dropdownDigitalCouponTitle !== "" ? dropdownDigitalCouponTitle : item.label : item.label), group.templateType === 2 ? /*#__PURE__*/React__default["default"].createElement(ChervronRightIcon, {
58013
58014
  fill: item.value === value ? "#fff" : "#212121"
58014
58015
  }) : group.templateType === 3 && editableDigitalCoupon ? /*#__PURE__*/React__default["default"].createElement(PenIcon, {
58015
58016
  fill: item.value === value ? "#fff" : "#212121"