sag_components 2.0.0-beta264 → 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.d.ts CHANGED
@@ -1574,7 +1574,7 @@ declare function ModalDrawer({ open, height, onClose, children, widthPercent }:
1574
1574
  widthPercent?: number;
1575
1575
  }): react_jsx_runtime.JSX.Element;
1576
1576
 
1577
- declare function OverlayDropdown({ data, value, onSelectClick, disabled, isDarkerBackground, required, selectedColor, hoverColor, dropdownMaxHeight, dropdownWidth, width, height, label, labelEmptyValue, showLabelOnTop, placeHolder, labelColor, placeHolderColor, textColorMenu, margin, editableDigitalCoupon, dropdownDigitalCouponTitle, className, ...props }: {
1577
+ declare function OverlayDropdown({ data, value, onSelectClick, disabled, isDarkerBackground, required, selectedColor, hoverColor, dropdownMaxHeight, width, height, label, labelEmptyValue, showLabelOnTop, placeHolder, labelColor, placeHolderColor, margin, editableDigitalCoupon, ...props }: {
1578
1578
  [x: string]: any;
1579
1579
  data?: any[];
1580
1580
  value: any;
@@ -1585,7 +1585,6 @@ declare function OverlayDropdown({ data, value, onSelectClick, disabled, isDarke
1585
1585
  selectedColor?: string;
1586
1586
  hoverColor?: string;
1587
1587
  dropdownMaxHeight?: string;
1588
- dropdownWidth?: string;
1589
1588
  width?: string;
1590
1589
  height?: string;
1591
1590
  label: any;
@@ -1594,11 +1593,8 @@ declare function OverlayDropdown({ data, value, onSelectClick, disabled, isDarke
1594
1593
  placeHolder: any;
1595
1594
  labelColor: any;
1596
1595
  placeHolderColor: any;
1597
- textColorMenu?: string;
1598
1596
  margin?: string;
1599
1597
  editableDigitalCoupon?: boolean;
1600
- dropdownDigitalCouponTitle?: string;
1601
- className?: string;
1602
1598
  }): react_jsx_runtime.JSX.Element;
1603
1599
 
1604
1600
  declare function MessageBox({ isOpen, isDisabled, onClose, onConfirm, title, primaryText, secondaryText, width, height, color, hoverColor, opacity, secondaryColor, seperateSectionBorder, children, tooltipContent, }: {
package/dist/index.esm.js CHANGED
@@ -8929,27 +8929,26 @@ const IconContainer$5 = styled.div`
8929
8929
  cursor: pointer;
8930
8930
  `;
8931
8931
 
8932
- const DropdownSingleNew = _ref => {
8933
- let {
8934
- label,
8935
- labelEmptyValue,
8936
- options,
8937
- selectedValue,
8938
- onChange,
8939
- required,
8940
- disabled,
8941
- width,
8942
- height,
8943
- withMarginBottom = true,
8944
- error,
8945
- errorMessage,
8946
- xIconShow,
8947
- labelColor,
8948
- showLabelOnTop,
8949
- orderBy,
8950
- placeHolder = "",
8951
- elementType
8952
- } = _ref;
8932
+ const DropdownSingleNew = ({
8933
+ label,
8934
+ labelEmptyValue,
8935
+ options,
8936
+ selectedValue,
8937
+ onChange,
8938
+ required,
8939
+ disabled,
8940
+ width,
8941
+ height,
8942
+ withMarginBottom = true,
8943
+ error,
8944
+ errorMessage,
8945
+ xIconShow,
8946
+ labelColor,
8947
+ showLabelOnTop,
8948
+ orderBy,
8949
+ placeHolder = "",
8950
+ elementType
8951
+ }) => {
8953
8952
  const [isFocused, setIsFocused] = useState(false);
8954
8953
  const [showOptions, setShowOptions] = useState(false);
8955
8954
  const [showAbove, setShowAbove] = useState(false);
@@ -9454,27 +9453,26 @@ const IconContainer$4 = styled.div`
9454
9453
  cursor: pointer;
9455
9454
  `;
9456
9455
 
9457
- const DropdownMultiNew = _ref => {
9458
- let {
9459
- label,
9460
- labelEmptyValue,
9461
- options,
9462
- selectedValue,
9463
- onChange,
9464
- required,
9465
- disabled,
9466
- width,
9467
- height,
9468
- withMarginBottom = true,
9469
- error,
9470
- errorMessage,
9471
- labelColor,
9472
- xIconShow,
9473
- checkBoxColor,
9474
- showLabelOnTop,
9475
- orderBy,
9476
- elementType
9477
- } = _ref;
9456
+ const DropdownMultiNew = ({
9457
+ label,
9458
+ labelEmptyValue,
9459
+ options,
9460
+ selectedValue,
9461
+ onChange,
9462
+ required,
9463
+ disabled,
9464
+ width,
9465
+ height,
9466
+ withMarginBottom = true,
9467
+ error,
9468
+ errorMessage,
9469
+ labelColor,
9470
+ xIconShow,
9471
+ checkBoxColor,
9472
+ showLabelOnTop,
9473
+ orderBy,
9474
+ elementType
9475
+ }) => {
9478
9476
  const [isFocused, setIsFocused] = useState(false);
9479
9477
  const [showOptions, setShowOptions] = useState(false);
9480
9478
  const [showAbove, setShowAbove] = useState(false);
@@ -10583,24 +10581,23 @@ const QuarterPopupPicker = ({
10583
10581
  };
10584
10582
 
10585
10583
  /* eslint-disable import/no-extraneous-dependencies */
10586
- const QuarterPicker = _ref => {
10587
- let {
10588
- availableQuarters,
10589
- // ["Q1-2024"]
10590
- label,
10591
- onChange,
10592
- borderRadius,
10593
- required,
10594
- width,
10595
- height,
10596
- placeholder,
10597
- disabled,
10598
- borderColor,
10599
- borderColorFocus,
10600
- textColor,
10601
- selectedValue,
10602
- startYear
10603
- } = _ref;
10584
+ const QuarterPicker = ({
10585
+ availableQuarters,
10586
+ // ["Q1-2024"]
10587
+ label,
10588
+ onChange,
10589
+ borderRadius,
10590
+ required,
10591
+ width,
10592
+ height,
10593
+ placeholder,
10594
+ disabled,
10595
+ borderColor,
10596
+ borderColorFocus,
10597
+ textColor,
10598
+ selectedValue,
10599
+ startYear
10600
+ }) => {
10604
10601
  const [isFocused, setIsFocused] = useState(false);
10605
10602
  const [isOpen, setIsOpen] = useState(false);
10606
10603
  const [value, setValue] = useState('');
@@ -11042,23 +11039,22 @@ const MonthPopupPicker = ({
11042
11039
  };
11043
11040
 
11044
11041
  /* eslint-disable import/no-extraneous-dependencies */
11045
- const MonthPicker = _ref => {
11046
- let {
11047
- availableMonths,
11048
- label,
11049
- onChange,
11050
- borderRadius,
11051
- required,
11052
- width,
11053
- height,
11054
- placeholder,
11055
- disabled,
11056
- borderColor,
11057
- borderColorFocus,
11058
- textColor,
11059
- selectedValue,
11060
- startYear
11061
- } = _ref;
11042
+ const MonthPicker = ({
11043
+ availableMonths,
11044
+ label,
11045
+ onChange,
11046
+ borderRadius,
11047
+ required,
11048
+ width,
11049
+ height,
11050
+ placeholder,
11051
+ disabled,
11052
+ borderColor,
11053
+ borderColorFocus,
11054
+ textColor,
11055
+ selectedValue,
11056
+ startYear
11057
+ }) => {
11062
11058
  const [isFocused, setIsFocused] = useState(false);
11063
11059
  const [isOpen, setIsOpen] = useState(false);
11064
11060
  const [value, setValue] = useState('');
@@ -24169,22 +24165,21 @@ const DeleteIcon = styled.div`
24169
24165
  position: absolute;
24170
24166
  `;
24171
24167
 
24172
- const QuickFilterDropdownSingle = _ref => {
24173
- let {
24174
- label,
24175
- hoverColor,
24176
- options,
24177
- selectedValue,
24178
- placeHolder,
24179
- onChange,
24180
- disabled,
24181
- width,
24182
- error,
24183
- errorMessage,
24184
- xIconShow,
24185
- labelColor,
24186
- showLabelOnTop
24187
- } = _ref;
24168
+ const QuickFilterDropdownSingle = ({
24169
+ label,
24170
+ hoverColor,
24171
+ options,
24172
+ selectedValue,
24173
+ placeHolder,
24174
+ onChange,
24175
+ disabled,
24176
+ width,
24177
+ error,
24178
+ errorMessage,
24179
+ xIconShow,
24180
+ labelColor,
24181
+ showLabelOnTop
24182
+ }) => {
24188
24183
  const [isFocused, setIsFocused] = useState(false);
24189
24184
  const [showOptions, setShowOptions] = useState(false);
24190
24185
  const [inputValue, setInputValue] = useState("");
@@ -24641,26 +24636,25 @@ const IconContainer$2 = styled.div`
24641
24636
  cursor: pointer;
24642
24637
  `;
24643
24638
 
24644
- const QuickFilterDropdownMultiSelection = _ref => {
24645
- let {
24646
- label,
24647
- labelEmptyValue,
24648
- options,
24649
- selectedValue,
24650
- placeHolder,
24651
- onChange,
24652
- required,
24653
- disabled,
24654
- width,
24655
- height,
24656
- error,
24657
- errorMessage,
24658
- labelColor,
24659
- xIconShow,
24660
- checkBoxColor,
24661
- showLabelOnTop,
24662
- dropdownHeight
24663
- } = _ref;
24639
+ const QuickFilterDropdownMultiSelection = ({
24640
+ label,
24641
+ labelEmptyValue,
24642
+ options,
24643
+ selectedValue,
24644
+ placeHolder,
24645
+ onChange,
24646
+ required,
24647
+ disabled,
24648
+ width,
24649
+ height,
24650
+ error,
24651
+ errorMessage,
24652
+ labelColor,
24653
+ xIconShow,
24654
+ checkBoxColor,
24655
+ showLabelOnTop,
24656
+ dropdownHeight
24657
+ }) => {
24664
24658
  const [isFocused, setIsFocused] = useState(false);
24665
24659
  const [showOptions, setShowOptions] = useState(false);
24666
24660
  const [inputValue, setInputValue] = useState('');
@@ -34973,18 +34967,17 @@ css`
34973
34967
  * • onApply(start,end) — callback, both numbers (inclusive)
34974
34968
  * • onCancel() — callback
34975
34969
  */
34976
- const WeeksCalendar = _ref => {
34977
- let {
34978
- year,
34979
- defaultStartWeek = null,
34980
- defaultEndWeek = null,
34981
- backgroundColor = "#066768",
34982
- hoverBackgroundColor = "#E6F0F0",
34983
- allowedWeekRange = null,
34984
- // New prop for range restriction
34985
- onApply,
34986
- onCancel
34987
- } = _ref;
34970
+ const WeeksCalendar = ({
34971
+ year,
34972
+ defaultStartWeek = null,
34973
+ defaultEndWeek = null,
34974
+ backgroundColor = "#066768",
34975
+ hoverBackgroundColor = "#E6F0F0",
34976
+ allowedWeekRange = null,
34977
+ // New prop for range restriction
34978
+ onApply,
34979
+ onCancel
34980
+ }) => {
34988
34981
  // state -------------------------------------------------
34989
34982
  const [startWeek, setStartWeek] = useState(defaultStartWeek);
34990
34983
  const [endWeek, setEndWeek] = useState(defaultEndWeek);
@@ -36172,9 +36165,9 @@ const ToggleSlider = styled.span`
36172
36165
  }
36173
36166
  `;
36174
36167
 
36175
- /**
36176
- * ToggleSwitch component for on/off states.
36177
- * Supports small/large sizes and disabled state.
36168
+ /**
36169
+ * ToggleSwitch component for on/off states.
36170
+ * Supports small/large sizes and disabled state.
36178
36171
  */
36179
36172
  function ToggleSwitch(_ref) {
36180
36173
  let {
@@ -57727,7 +57720,6 @@ const OverlayDropdown = _ref => {
57727
57720
  selectedColor = "#066768",
57728
57721
  hoverColor = "#E6F0F0",
57729
57722
  dropdownMaxHeight = "600px",
57730
- dropdownWidth = "100%",
57731
57723
  width = "100%",
57732
57724
  height = "auto",
57733
57725
  label,
@@ -57736,23 +57728,20 @@ const OverlayDropdown = _ref => {
57736
57728
  placeHolder,
57737
57729
  labelColor,
57738
57730
  placeHolderColor,
57739
- textColorMenu = "black",
57740
57731
  margin = "8px",
57741
57732
  editableDigitalCoupon = false,
57742
- dropdownDigitalCouponTitle = "",
57743
- className = "",
57744
57733
  ...props
57745
57734
  } = _ref;
57746
57735
  const [open, setOpen] = useState(false);
57747
57736
  const [hoveredText, setHoveredText] = useState(null);
57748
57737
  const [templateDialog, setTemplateDialog] = useState(null);
57749
57738
  const [dropdownPosition, setDropdownPosition] = useState("below");
57750
- const [selected, setSelected] = useState("");
57751
- const [hasValue, setHasValue] = useState(false);
57752
57739
  const [lastDefinedGroup, setLastDefinedGroup] = useState(data.find(group => group.overlayCode === "last_defined"));
57753
57740
  const buttonRef = useRef(null);
57754
57741
  const dropdownRef = useRef(null);
57755
57742
  const containerRef = useRef(null);
57743
+
57744
+ // Click outside to close dropdown
57756
57745
  useEffect(() => {
57757
57746
  const handleClickOutside = event => {
57758
57747
  if (containerRef.current && !containerRef.current.contains(event.target)) {
@@ -57768,13 +57757,20 @@ const OverlayDropdown = _ref => {
57768
57757
  document.removeEventListener("touchstart", handleClickOutside);
57769
57758
  };
57770
57759
  }, [open]);
57760
+
57761
+ // Calculate dropdown position when opening
57771
57762
  useEffect(() => {
57772
57763
  if (open && buttonRef.current) {
57773
57764
  const buttonRect = buttonRef.current.getBoundingClientRect();
57774
57765
  const viewportHeight = window.innerHeight;
57775
57766
  const dropdownHeight = parseInt(dropdownMaxHeight, 10);
57767
+
57768
+ // Space available below the button
57776
57769
  const spaceBelow = viewportHeight - buttonRect.bottom;
57770
+ // Space available above the button
57777
57771
  const spaceAbove = buttonRect.top;
57772
+
57773
+ // If there's not enough space below, but more space above, position above
57778
57774
  if (spaceBelow < dropdownHeight && spaceAbove > spaceBelow) {
57779
57775
  setDropdownPosition("above");
57780
57776
  } else {
@@ -57782,6 +57778,8 @@ const OverlayDropdown = _ref => {
57782
57778
  }
57783
57779
  }
57784
57780
  }, [open, dropdownMaxHeight, margin]);
57781
+
57782
+ // Combine original data with "Last defined by you" group
57785
57783
  const getDataWithLastDefined = () => {
57786
57784
  const combinedData = [...data];
57787
57785
  if (lastDefinedGroup) {
@@ -57789,26 +57787,20 @@ const OverlayDropdown = _ref => {
57789
57787
  }
57790
57788
  return combinedData;
57791
57789
  };
57790
+
57791
+ // Find selected item across all groups
57792
57792
  const findSelectedItem = () => {
57793
57793
  const allData = getDataWithLastDefined();
57794
57794
  for (const group of allData) {
57795
57795
  if (group.items) {
57796
- const found = group.items.find(item => {
57797
- const digitalCouponItem = item.value === value ? item.label : null;
57798
- if (digitalCouponItem && digitalCouponItem.includes("Digital") && editableDigitalCoupon) {
57799
- return true;
57800
- }
57801
- return item.value === value;
57802
- });
57796
+ const found = group.items.find(item => item.value === value);
57803
57797
  if (found) return found;
57804
57798
  }
57805
57799
  }
57806
57800
  return null;
57807
57801
  };
57808
- useEffect(() => {
57809
- setSelected(findSelectedItem());
57810
- setHasValue(!!findSelectedItem());
57811
- }, [value]);
57802
+ const selected = findSelectedItem();
57803
+ const hasValue = !!selected;
57812
57804
  const getTemplateParams = label => {
57813
57805
  if (!label) return [];
57814
57806
 
@@ -57941,7 +57933,6 @@ const OverlayDropdown = _ref => {
57941
57933
  return "";
57942
57934
  };
57943
57935
  return /*#__PURE__*/React$1.createElement(DropdownContainer, {
57944
- className: className,
57945
57936
  width: width,
57946
57937
  ref: containerRef
57947
57938
  }, /*#__PURE__*/React$1.createElement(Label$1, {
@@ -57963,7 +57954,7 @@ const OverlayDropdown = _ref => {
57963
57954
  onMouseEnter: () => setHoveredText(selected?.label),
57964
57955
  onMouseLeave: () => setHoveredText(null),
57965
57956
  color: !selected && open ? placeHolderColor : "inherit"
57966
- }, selected ? selected.label.includes("Digital") && editableDigitalCoupon ? dropdownDigitalCouponTitle !== "" ? dropdownDigitalCouponTitle : selected.label : selected.label : open ? placeHolder : ""), open ? /*#__PURE__*/React$1.createElement(MenuItemUpIcon, {
57957
+ }, selected ? selected.label : open ? placeHolder : ''), open ? /*#__PURE__*/React$1.createElement(MenuItemUpIcon, {
57967
57958
  width: "12px",
57968
57959
  height: "12px",
57969
57960
  color: "#B1B1B1"
@@ -57975,7 +57966,7 @@ const OverlayDropdown = _ref => {
57975
57966
  ref: dropdownRef,
57976
57967
  role: "listbox",
57977
57968
  dropdownMaxHeight: dropdownMaxHeight,
57978
- width: dropdownWidth,
57969
+ width: width,
57979
57970
  position: dropdownPosition
57980
57971
  }, dataToRender.map((group, groupIndex) => group.items?.length > 0 && /*#__PURE__*/React$1.createElement(SectionDiv, {
57981
57972
  $showBorder: group.overlayName,
@@ -58011,14 +58002,11 @@ const OverlayDropdown = _ref => {
58011
58002
  }
58012
58003
  }
58013
58004
  }, /*#__PURE__*/React$1.createElement(TruncatedText, {
58014
- onMouseEnter: () => setHoveredText(selected?.label),
58015
- onMouseLeave: () => setHoveredText(null),
58016
- color: !selected && open ? textColorMenu : "inherit"
58017
- }, group.templateType === 3 && editableDigitalCoupon ? dropdownDigitalCouponTitle !== "" ? dropdownDigitalCouponTitle : item.label : item.label), group.templateType === 2 ? /*#__PURE__*/React$1.createElement(ChervronRightIcon, {
58018
- fill: item.value === value ? "#fff" : "#212121"
58019
- }) : group.templateType === 3 && editableDigitalCoupon ? dropdownDigitalCouponTitle === "" ? /*#__PURE__*/React$1.createElement(ChervronRightIcon, {
58005
+ onMouseEnter: () => setHoveredText(item.label),
58006
+ onMouseLeave: () => setHoveredText(null)
58007
+ }, item.label), group.templateType === 2 ? /*#__PURE__*/React$1.createElement(ChervronRightIcon, {
58020
58008
  fill: item.value === value ? "#fff" : "#212121"
58021
- }) : /*#__PURE__*/React$1.createElement(PenIcon, {
58009
+ }) : group.templateType === 3 && editableDigitalCoupon ? /*#__PURE__*/React$1.createElement(PenIcon, {
58022
58010
  fill: item.value === value ? "#fff" : "#212121"
58023
58011
  }) : item.value === value && /*#__PURE__*/React$1.createElement(OkIcon, {
58024
58012
  width: "22px",