sag_components 2.0.0-beta264 → 2.0.0-beta266

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
@@ -8939,27 +8939,26 @@ const IconContainer$5 = styled__default["default"].div`
8939
8939
  cursor: pointer;
8940
8940
  `;
8941
8941
 
8942
- const DropdownSingleNew = _ref => {
8943
- let {
8944
- label,
8945
- labelEmptyValue,
8946
- options,
8947
- selectedValue,
8948
- onChange,
8949
- required,
8950
- disabled,
8951
- width,
8952
- height,
8953
- withMarginBottom = true,
8954
- error,
8955
- errorMessage,
8956
- xIconShow,
8957
- labelColor,
8958
- showLabelOnTop,
8959
- orderBy,
8960
- placeHolder = "",
8961
- elementType
8962
- } = _ref;
8942
+ const DropdownSingleNew = ({
8943
+ label,
8944
+ labelEmptyValue,
8945
+ options,
8946
+ selectedValue,
8947
+ onChange,
8948
+ required,
8949
+ disabled,
8950
+ width,
8951
+ height,
8952
+ withMarginBottom = true,
8953
+ error,
8954
+ errorMessage,
8955
+ xIconShow,
8956
+ labelColor,
8957
+ showLabelOnTop,
8958
+ orderBy,
8959
+ placeHolder = "",
8960
+ elementType
8961
+ }) => {
8963
8962
  const [isFocused, setIsFocused] = React$1.useState(false);
8964
8963
  const [showOptions, setShowOptions] = React$1.useState(false);
8965
8964
  const [showAbove, setShowAbove] = React$1.useState(false);
@@ -9464,27 +9463,26 @@ const IconContainer$4 = styled__default["default"].div`
9464
9463
  cursor: pointer;
9465
9464
  `;
9466
9465
 
9467
- const DropdownMultiNew = _ref => {
9468
- let {
9469
- label,
9470
- labelEmptyValue,
9471
- options,
9472
- selectedValue,
9473
- onChange,
9474
- required,
9475
- disabled,
9476
- width,
9477
- height,
9478
- withMarginBottom = true,
9479
- error,
9480
- errorMessage,
9481
- labelColor,
9482
- xIconShow,
9483
- checkBoxColor,
9484
- showLabelOnTop,
9485
- orderBy,
9486
- elementType
9487
- } = _ref;
9466
+ const DropdownMultiNew = ({
9467
+ label,
9468
+ labelEmptyValue,
9469
+ options,
9470
+ selectedValue,
9471
+ onChange,
9472
+ required,
9473
+ disabled,
9474
+ width,
9475
+ height,
9476
+ withMarginBottom = true,
9477
+ error,
9478
+ errorMessage,
9479
+ labelColor,
9480
+ xIconShow,
9481
+ checkBoxColor,
9482
+ showLabelOnTop,
9483
+ orderBy,
9484
+ elementType
9485
+ }) => {
9488
9486
  const [isFocused, setIsFocused] = React$1.useState(false);
9489
9487
  const [showOptions, setShowOptions] = React$1.useState(false);
9490
9488
  const [showAbove, setShowAbove] = React$1.useState(false);
@@ -10593,24 +10591,23 @@ const QuarterPopupPicker = ({
10593
10591
  };
10594
10592
 
10595
10593
  /* eslint-disable import/no-extraneous-dependencies */
10596
- const QuarterPicker = _ref => {
10597
- let {
10598
- availableQuarters,
10599
- // ["Q1-2024"]
10600
- label,
10601
- onChange,
10602
- borderRadius,
10603
- required,
10604
- width,
10605
- height,
10606
- placeholder,
10607
- disabled,
10608
- borderColor,
10609
- borderColorFocus,
10610
- textColor,
10611
- selectedValue,
10612
- startYear
10613
- } = _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
+ }) => {
10614
10611
  const [isFocused, setIsFocused] = React$1.useState(false);
10615
10612
  const [isOpen, setIsOpen] = React$1.useState(false);
10616
10613
  const [value, setValue] = React$1.useState('');
@@ -11052,23 +11049,22 @@ const MonthPopupPicker = ({
11052
11049
  };
11053
11050
 
11054
11051
  /* eslint-disable import/no-extraneous-dependencies */
11055
- const MonthPicker = _ref => {
11056
- let {
11057
- availableMonths,
11058
- label,
11059
- onChange,
11060
- borderRadius,
11061
- required,
11062
- width,
11063
- height,
11064
- placeholder,
11065
- disabled,
11066
- borderColor,
11067
- borderColorFocus,
11068
- textColor,
11069
- selectedValue,
11070
- startYear
11071
- } = _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
+ }) => {
11072
11068
  const [isFocused, setIsFocused] = React$1.useState(false);
11073
11069
  const [isOpen, setIsOpen] = React$1.useState(false);
11074
11070
  const [value, setValue] = React$1.useState('');
@@ -24179,22 +24175,21 @@ const DeleteIcon = styled__default["default"].div`
24179
24175
  position: absolute;
24180
24176
  `;
24181
24177
 
24182
- const QuickFilterDropdownSingle = _ref => {
24183
- let {
24184
- label,
24185
- hoverColor,
24186
- options,
24187
- selectedValue,
24188
- placeHolder,
24189
- onChange,
24190
- disabled,
24191
- width,
24192
- error,
24193
- errorMessage,
24194
- xIconShow,
24195
- labelColor,
24196
- showLabelOnTop
24197
- } = _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
+ }) => {
24198
24193
  const [isFocused, setIsFocused] = React$1.useState(false);
24199
24194
  const [showOptions, setShowOptions] = React$1.useState(false);
24200
24195
  const [inputValue, setInputValue] = React$1.useState("");
@@ -24651,26 +24646,25 @@ const IconContainer$2 = styled__default["default"].div`
24651
24646
  cursor: pointer;
24652
24647
  `;
24653
24648
 
24654
- const QuickFilterDropdownMultiSelection = _ref => {
24655
- let {
24656
- label,
24657
- labelEmptyValue,
24658
- options,
24659
- selectedValue,
24660
- placeHolder,
24661
- onChange,
24662
- required,
24663
- disabled,
24664
- width,
24665
- height,
24666
- error,
24667
- errorMessage,
24668
- labelColor,
24669
- xIconShow,
24670
- checkBoxColor,
24671
- showLabelOnTop,
24672
- dropdownHeight
24673
- } = _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
+ }) => {
24674
24668
  const [isFocused, setIsFocused] = React$1.useState(false);
24675
24669
  const [showOptions, setShowOptions] = React$1.useState(false);
24676
24670
  const [inputValue, setInputValue] = React$1.useState('');
@@ -34983,18 +34977,17 @@ styled.css`
34983
34977
  * • onApply(start,end) — callback, both numbers (inclusive)
34984
34978
  * • onCancel() — callback
34985
34979
  */
34986
- const WeeksCalendar = _ref => {
34987
- let {
34988
- year,
34989
- defaultStartWeek = null,
34990
- defaultEndWeek = null,
34991
- backgroundColor = "#066768",
34992
- hoverBackgroundColor = "#E6F0F0",
34993
- allowedWeekRange = null,
34994
- // New prop for range restriction
34995
- onApply,
34996
- onCancel
34997
- } = _ref;
34980
+ const WeeksCalendar = ({
34981
+ year,
34982
+ defaultStartWeek = null,
34983
+ defaultEndWeek = null,
34984
+ backgroundColor = "#066768",
34985
+ hoverBackgroundColor = "#E6F0F0",
34986
+ allowedWeekRange = null,
34987
+ // New prop for range restriction
34988
+ onApply,
34989
+ onCancel
34990
+ }) => {
34998
34991
  // state -------------------------------------------------
34999
34992
  const [startWeek, setStartWeek] = React$1.useState(defaultStartWeek);
35000
34993
  const [endWeek, setEndWeek] = React$1.useState(defaultEndWeek);
@@ -36182,9 +36175,9 @@ const ToggleSlider = styled__default["default"].span`
36182
36175
  }
36183
36176
  `;
36184
36177
 
36185
- /**
36186
- * ToggleSwitch component for on/off states.
36187
- * Supports small/large sizes and disabled state.
36178
+ /**
36179
+ * ToggleSwitch component for on/off states.
36180
+ * Supports small/large sizes and disabled state.
36188
36181
  */
36189
36182
  function ToggleSwitch(_ref) {
36190
36183
  let {
@@ -57737,7 +57730,6 @@ const OverlayDropdown = _ref => {
57737
57730
  selectedColor = "#066768",
57738
57731
  hoverColor = "#E6F0F0",
57739
57732
  dropdownMaxHeight = "600px",
57740
- dropdownWidth = "100%",
57741
57733
  width = "100%",
57742
57734
  height = "auto",
57743
57735
  label,
@@ -57746,23 +57738,20 @@ const OverlayDropdown = _ref => {
57746
57738
  placeHolder,
57747
57739
  labelColor,
57748
57740
  placeHolderColor,
57749
- textColorMenu = "black",
57750
57741
  margin = "8px",
57751
57742
  editableDigitalCoupon = false,
57752
- dropdownDigitalCouponTitle = "",
57753
- className = "",
57754
57743
  ...props
57755
57744
  } = _ref;
57756
57745
  const [open, setOpen] = React$1.useState(false);
57757
57746
  const [hoveredText, setHoveredText] = React$1.useState(null);
57758
57747
  const [templateDialog, setTemplateDialog] = React$1.useState(null);
57759
57748
  const [dropdownPosition, setDropdownPosition] = React$1.useState("below");
57760
- const [selected, setSelected] = React$1.useState("");
57761
- const [hasValue, setHasValue] = React$1.useState(false);
57762
57749
  const [lastDefinedGroup, setLastDefinedGroup] = React$1.useState(data.find(group => group.overlayCode === "last_defined"));
57763
57750
  const buttonRef = React$1.useRef(null);
57764
57751
  const dropdownRef = React$1.useRef(null);
57765
57752
  const containerRef = React$1.useRef(null);
57753
+
57754
+ // Click outside to close dropdown
57766
57755
  React$1.useEffect(() => {
57767
57756
  const handleClickOutside = event => {
57768
57757
  if (containerRef.current && !containerRef.current.contains(event.target)) {
@@ -57778,13 +57767,20 @@ const OverlayDropdown = _ref => {
57778
57767
  document.removeEventListener("touchstart", handleClickOutside);
57779
57768
  };
57780
57769
  }, [open]);
57770
+
57771
+ // Calculate dropdown position when opening
57781
57772
  React$1.useEffect(() => {
57782
57773
  if (open && buttonRef.current) {
57783
57774
  const buttonRect = buttonRef.current.getBoundingClientRect();
57784
57775
  const viewportHeight = window.innerHeight;
57785
57776
  const dropdownHeight = parseInt(dropdownMaxHeight, 10);
57777
+
57778
+ // Space available below the button
57786
57779
  const spaceBelow = viewportHeight - buttonRect.bottom;
57780
+ // Space available above the button
57787
57781
  const spaceAbove = buttonRect.top;
57782
+
57783
+ // If there's not enough space below, but more space above, position above
57788
57784
  if (spaceBelow < dropdownHeight && spaceAbove > spaceBelow) {
57789
57785
  setDropdownPosition("above");
57790
57786
  } else {
@@ -57792,6 +57788,8 @@ const OverlayDropdown = _ref => {
57792
57788
  }
57793
57789
  }
57794
57790
  }, [open, dropdownMaxHeight, margin]);
57791
+
57792
+ // Combine original data with "Last defined by you" group
57795
57793
  const getDataWithLastDefined = () => {
57796
57794
  const combinedData = [...data];
57797
57795
  if (lastDefinedGroup) {
@@ -57799,26 +57797,20 @@ const OverlayDropdown = _ref => {
57799
57797
  }
57800
57798
  return combinedData;
57801
57799
  };
57800
+
57801
+ // Find selected item across all groups
57802
57802
  const findSelectedItem = () => {
57803
57803
  const allData = getDataWithLastDefined();
57804
57804
  for (const group of allData) {
57805
57805
  if (group.items) {
57806
- const found = group.items.find(item => {
57807
- const digitalCouponItem = item.value === value ? item.label : null;
57808
- if (digitalCouponItem && digitalCouponItem.includes("Digital") && editableDigitalCoupon) {
57809
- return true;
57810
- }
57811
- return item.value === value;
57812
- });
57806
+ const found = group.items.find(item => item.value === value);
57813
57807
  if (found) return found;
57814
57808
  }
57815
57809
  }
57816
57810
  return null;
57817
57811
  };
57818
- React$1.useEffect(() => {
57819
- setSelected(findSelectedItem());
57820
- setHasValue(!!findSelectedItem());
57821
- }, [value]);
57812
+ const selected = findSelectedItem();
57813
+ const hasValue = !!selected;
57822
57814
  const getTemplateParams = label => {
57823
57815
  if (!label) return [];
57824
57816
 
@@ -57951,7 +57943,6 @@ const OverlayDropdown = _ref => {
57951
57943
  return "";
57952
57944
  };
57953
57945
  return /*#__PURE__*/React__default["default"].createElement(DropdownContainer, {
57954
- className: className,
57955
57946
  width: width,
57956
57947
  ref: containerRef
57957
57948
  }, /*#__PURE__*/React__default["default"].createElement(Label$1, {
@@ -57973,7 +57964,7 @@ const OverlayDropdown = _ref => {
57973
57964
  onMouseEnter: () => setHoveredText(selected?.label),
57974
57965
  onMouseLeave: () => setHoveredText(null),
57975
57966
  color: !selected && open ? placeHolderColor : "inherit"
57976
- }, 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, {
57977
57968
  width: "12px",
57978
57969
  height: "12px",
57979
57970
  color: "#B1B1B1"
@@ -57985,7 +57976,7 @@ const OverlayDropdown = _ref => {
57985
57976
  ref: dropdownRef,
57986
57977
  role: "listbox",
57987
57978
  dropdownMaxHeight: dropdownMaxHeight,
57988
- width: dropdownWidth,
57979
+ width: width,
57989
57980
  position: dropdownPosition
57990
57981
  }, dataToRender.map((group, groupIndex) => group.items?.length > 0 && /*#__PURE__*/React__default["default"].createElement(SectionDiv, {
57991
57982
  $showBorder: group.overlayName,
@@ -58021,14 +58012,11 @@ const OverlayDropdown = _ref => {
58021
58012
  }
58022
58013
  }
58023
58014
  }, /*#__PURE__*/React__default["default"].createElement(TruncatedText, {
58024
- onMouseEnter: () => setHoveredText(selected?.label),
58025
- onMouseLeave: () => setHoveredText(null),
58026
- color: !selected && open ? textColorMenu : "inherit"
58027
- }, group.templateType === 3 && editableDigitalCoupon ? dropdownDigitalCouponTitle !== "" ? dropdownDigitalCouponTitle : item.label : item.label), group.templateType === 2 ? /*#__PURE__*/React__default["default"].createElement(ChervronRightIcon, {
58028
- fill: item.value === value ? "#fff" : "#212121"
58029
- }) : 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, {
58030
58018
  fill: item.value === value ? "#fff" : "#212121"
58031
- }) : /*#__PURE__*/React__default["default"].createElement(PenIcon, {
58019
+ }) : group.templateType === 3 && editableDigitalCoupon ? /*#__PURE__*/React__default["default"].createElement(PenIcon, {
58032
58020
  fill: item.value === value ? "#fff" : "#212121"
58033
58021
  }) : item.value === value && /*#__PURE__*/React__default["default"].createElement(OkIcon, {
58034
58022
  width: "22px",