sag_components 2.0.0-beta263 → 2.0.0-beta265

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
@@ -10591,24 +10591,23 @@ const QuarterPopupPicker = ({
10591
10591
  };
10592
10592
 
10593
10593
  /* eslint-disable import/no-extraneous-dependencies */
10594
- const QuarterPicker = _ref => {
10595
- let {
10596
- availableQuarters,
10597
- // ["Q1-2024"]
10598
- label,
10599
- onChange,
10600
- borderRadius,
10601
- required,
10602
- width,
10603
- height,
10604
- placeholder,
10605
- disabled,
10606
- borderColor,
10607
- borderColorFocus,
10608
- textColor,
10609
- selectedValue,
10610
- startYear
10611
- } = _ref;
10594
+ const QuarterPicker = ({
10595
+ availableQuarters,
10596
+ // ["Q1-2024"]
10597
+ label,
10598
+ onChange,
10599
+ borderRadius,
10600
+ required,
10601
+ width,
10602
+ height,
10603
+ placeholder,
10604
+ disabled,
10605
+ borderColor,
10606
+ borderColorFocus,
10607
+ textColor,
10608
+ selectedValue,
10609
+ startYear
10610
+ }) => {
10612
10611
  const [isFocused, setIsFocused] = React$1.useState(false);
10613
10612
  const [isOpen, setIsOpen] = React$1.useState(false);
10614
10613
  const [value, setValue] = React$1.useState('');
@@ -11050,23 +11049,22 @@ const MonthPopupPicker = ({
11050
11049
  };
11051
11050
 
11052
11051
  /* eslint-disable import/no-extraneous-dependencies */
11053
- const MonthPicker = _ref => {
11054
- let {
11055
- availableMonths,
11056
- label,
11057
- onChange,
11058
- borderRadius,
11059
- required,
11060
- width,
11061
- height,
11062
- placeholder,
11063
- disabled,
11064
- borderColor,
11065
- borderColorFocus,
11066
- textColor,
11067
- selectedValue,
11068
- startYear
11069
- } = _ref;
11052
+ const MonthPicker = ({
11053
+ availableMonths,
11054
+ label,
11055
+ onChange,
11056
+ borderRadius,
11057
+ required,
11058
+ width,
11059
+ height,
11060
+ placeholder,
11061
+ disabled,
11062
+ borderColor,
11063
+ borderColorFocus,
11064
+ textColor,
11065
+ selectedValue,
11066
+ startYear
11067
+ }) => {
11070
11068
  const [isFocused, setIsFocused] = React$1.useState(false);
11071
11069
  const [isOpen, setIsOpen] = React$1.useState(false);
11072
11070
  const [value, setValue] = React$1.useState('');
@@ -24177,22 +24175,21 @@ const DeleteIcon = styled__default["default"].div`
24177
24175
  position: absolute;
24178
24176
  `;
24179
24177
 
24180
- const QuickFilterDropdownSingle = _ref => {
24181
- let {
24182
- label,
24183
- hoverColor,
24184
- options,
24185
- selectedValue,
24186
- placeHolder,
24187
- onChange,
24188
- disabled,
24189
- width,
24190
- error,
24191
- errorMessage,
24192
- xIconShow,
24193
- labelColor,
24194
- showLabelOnTop
24195
- } = _ref;
24178
+ const QuickFilterDropdownSingle = ({
24179
+ label,
24180
+ hoverColor,
24181
+ options,
24182
+ selectedValue,
24183
+ placeHolder,
24184
+ onChange,
24185
+ disabled,
24186
+ width,
24187
+ error,
24188
+ errorMessage,
24189
+ xIconShow,
24190
+ labelColor,
24191
+ showLabelOnTop
24192
+ }) => {
24196
24193
  const [isFocused, setIsFocused] = React$1.useState(false);
24197
24194
  const [showOptions, setShowOptions] = React$1.useState(false);
24198
24195
  const [inputValue, setInputValue] = React$1.useState("");
@@ -24649,26 +24646,25 @@ const IconContainer$2 = styled__default["default"].div`
24649
24646
  cursor: pointer;
24650
24647
  `;
24651
24648
 
24652
- const QuickFilterDropdownMultiSelection = _ref => {
24653
- let {
24654
- label,
24655
- labelEmptyValue,
24656
- options,
24657
- selectedValue,
24658
- placeHolder,
24659
- onChange,
24660
- required,
24661
- disabled,
24662
- width,
24663
- height,
24664
- error,
24665
- errorMessage,
24666
- labelColor,
24667
- xIconShow,
24668
- checkBoxColor,
24669
- showLabelOnTop,
24670
- dropdownHeight
24671
- } = _ref;
24649
+ const QuickFilterDropdownMultiSelection = ({
24650
+ label,
24651
+ labelEmptyValue,
24652
+ options,
24653
+ selectedValue,
24654
+ placeHolder,
24655
+ onChange,
24656
+ required,
24657
+ disabled,
24658
+ width,
24659
+ height,
24660
+ error,
24661
+ errorMessage,
24662
+ labelColor,
24663
+ xIconShow,
24664
+ checkBoxColor,
24665
+ showLabelOnTop,
24666
+ dropdownHeight
24667
+ }) => {
24672
24668
  const [isFocused, setIsFocused] = React$1.useState(false);
24673
24669
  const [showOptions, setShowOptions] = React$1.useState(false);
24674
24670
  const [inputValue, setInputValue] = React$1.useState('');
@@ -36179,9 +36175,9 @@ const ToggleSlider = styled__default["default"].span`
36179
36175
  }
36180
36176
  `;
36181
36177
 
36182
- /**
36183
- * ToggleSwitch component for on/off states.
36184
- * Supports small/large sizes and disabled state.
36178
+ /**
36179
+ * ToggleSwitch component for on/off states.
36180
+ * Supports small/large sizes and disabled state.
36185
36181
  */
36186
36182
  function ToggleSwitch(_ref) {
36187
36183
  let {
@@ -57742,23 +57738,20 @@ const OverlayDropdown = _ref => {
57742
57738
  placeHolder,
57743
57739
  labelColor,
57744
57740
  placeHolderColor,
57745
- textColorMenu = "black",
57746
57741
  margin = "8px",
57747
57742
  editableDigitalCoupon = false,
57748
- dropdownDigitalCouponTitle = "",
57749
- className = "",
57750
57743
  ...props
57751
57744
  } = _ref;
57752
57745
  const [open, setOpen] = React$1.useState(false);
57753
57746
  const [hoveredText, setHoveredText] = React$1.useState(null);
57754
57747
  const [templateDialog, setTemplateDialog] = React$1.useState(null);
57755
57748
  const [dropdownPosition, setDropdownPosition] = React$1.useState("below");
57756
- const [selected, setSelected] = React$1.useState("");
57757
- const [hasValue, setHasValue] = React$1.useState(false);
57758
57749
  const [lastDefinedGroup, setLastDefinedGroup] = React$1.useState(data.find(group => group.overlayCode === "last_defined"));
57759
57750
  const buttonRef = React$1.useRef(null);
57760
57751
  const dropdownRef = React$1.useRef(null);
57761
57752
  const containerRef = React$1.useRef(null);
57753
+
57754
+ // Click outside to close dropdown
57762
57755
  React$1.useEffect(() => {
57763
57756
  const handleClickOutside = event => {
57764
57757
  if (containerRef.current && !containerRef.current.contains(event.target)) {
@@ -57774,13 +57767,20 @@ const OverlayDropdown = _ref => {
57774
57767
  document.removeEventListener("touchstart", handleClickOutside);
57775
57768
  };
57776
57769
  }, [open]);
57770
+
57771
+ // Calculate dropdown position when opening
57777
57772
  React$1.useEffect(() => {
57778
57773
  if (open && buttonRef.current) {
57779
57774
  const buttonRect = buttonRef.current.getBoundingClientRect();
57780
57775
  const viewportHeight = window.innerHeight;
57781
57776
  const dropdownHeight = parseInt(dropdownMaxHeight, 10);
57777
+
57778
+ // Space available below the button
57782
57779
  const spaceBelow = viewportHeight - buttonRect.bottom;
57780
+ // Space available above the button
57783
57781
  const spaceAbove = buttonRect.top;
57782
+
57783
+ // If there's not enough space below, but more space above, position above
57784
57784
  if (spaceBelow < dropdownHeight && spaceAbove > spaceBelow) {
57785
57785
  setDropdownPosition("above");
57786
57786
  } else {
@@ -57788,6 +57788,8 @@ const OverlayDropdown = _ref => {
57788
57788
  }
57789
57789
  }
57790
57790
  }, [open, dropdownMaxHeight, margin]);
57791
+
57792
+ // Combine original data with "Last defined by you" group
57791
57793
  const getDataWithLastDefined = () => {
57792
57794
  const combinedData = [...data];
57793
57795
  if (lastDefinedGroup) {
@@ -57795,26 +57797,20 @@ const OverlayDropdown = _ref => {
57795
57797
  }
57796
57798
  return combinedData;
57797
57799
  };
57800
+
57801
+ // Find selected item across all groups
57798
57802
  const findSelectedItem = () => {
57799
57803
  const allData = getDataWithLastDefined();
57800
57804
  for (const group of allData) {
57801
57805
  if (group.items) {
57802
- const found = group.items.find(item => {
57803
- const digitalCouponItem = item.value === value ? item.label : null;
57804
- if (digitalCouponItem && digitalCouponItem.includes("Digital") && editableDigitalCoupon) {
57805
- return true;
57806
- }
57807
- return item.value === value;
57808
- });
57806
+ const found = group.items.find(item => item.value === value);
57809
57807
  if (found) return found;
57810
57808
  }
57811
57809
  }
57812
57810
  return null;
57813
57811
  };
57814
- React$1.useEffect(() => {
57815
- setSelected(findSelectedItem());
57816
- setHasValue(!!findSelectedItem());
57817
- }, [value]);
57812
+ const selected = findSelectedItem();
57813
+ const hasValue = !!selected;
57818
57814
  const getTemplateParams = label => {
57819
57815
  if (!label) return [];
57820
57816
 
@@ -57947,7 +57943,6 @@ const OverlayDropdown = _ref => {
57947
57943
  return "";
57948
57944
  };
57949
57945
  return /*#__PURE__*/React__default["default"].createElement(DropdownContainer, {
57950
- className: className,
57951
57946
  width: width,
57952
57947
  ref: containerRef
57953
57948
  }, /*#__PURE__*/React__default["default"].createElement(Label$1, {
@@ -57969,7 +57964,7 @@ const OverlayDropdown = _ref => {
57969
57964
  onMouseEnter: () => setHoveredText(selected?.label),
57970
57965
  onMouseLeave: () => setHoveredText(null),
57971
57966
  color: !selected && open ? placeHolderColor : "inherit"
57972
- }, selected ? selected.label.includes("Digital") && editableDigitalCoupon ? dropdownDigitalCouponTitle !== "" ? dropdownDigitalCouponTitle : selected.label : selected.label : open ? placeHolder : ""), open ? /*#__PURE__*/React__default["default"].createElement(MenuItemUpIcon, {
57967
+ }, selected ? selected.label : open ? placeHolder : ''), open ? /*#__PURE__*/React__default["default"].createElement(MenuItemUpIcon, {
57973
57968
  width: "12px",
57974
57969
  height: "12px",
57975
57970
  color: "#B1B1B1"
@@ -58017,14 +58012,11 @@ const OverlayDropdown = _ref => {
58017
58012
  }
58018
58013
  }
58019
58014
  }, /*#__PURE__*/React__default["default"].createElement(TruncatedText, {
58020
- onMouseEnter: () => setHoveredText(selected?.label),
58021
- onMouseLeave: () => setHoveredText(null),
58022
- color: !selected && open ? textColorMenu : "inherit"
58023
- }, group.templateType === 3 && editableDigitalCoupon ? dropdownDigitalCouponTitle !== "" ? dropdownDigitalCouponTitle : item.label : item.label), group.templateType === 2 ? /*#__PURE__*/React__default["default"].createElement(ChervronRightIcon, {
58024
- fill: item.value === value ? "#fff" : "#212121"
58025
- }) : group.templateType === 3 && editableDigitalCoupon ? dropdownDigitalCouponTitle === "" ? /*#__PURE__*/React__default["default"].createElement(ChervronRightIcon, {
58015
+ onMouseEnter: () => setHoveredText(item.label),
58016
+ onMouseLeave: () => setHoveredText(null)
58017
+ }, item.label), group.templateType === 2 ? /*#__PURE__*/React__default["default"].createElement(ChervronRightIcon, {
58026
58018
  fill: item.value === value ? "#fff" : "#212121"
58027
- }) : /*#__PURE__*/React__default["default"].createElement(PenIcon, {
58019
+ }) : group.templateType === 3 && editableDigitalCoupon ? /*#__PURE__*/React__default["default"].createElement(PenIcon, {
58028
58020
  fill: item.value === value ? "#fff" : "#212121"
58029
58021
  }) : item.value === value && /*#__PURE__*/React__default["default"].createElement(OkIcon, {
58030
58022
  width: "22px",