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.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, 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;
@@ -1593,11 +1593,8 @@ declare function OverlayDropdown({ data, value, onSelectClick, disabled, isDarke
1593
1593
  placeHolder: any;
1594
1594
  labelColor: any;
1595
1595
  placeHolderColor: any;
1596
- textColorMenu?: string;
1597
1596
  margin?: string;
1598
1597
  editableDigitalCoupon?: boolean;
1599
- dropdownDigitalCouponTitle?: string;
1600
- className?: string;
1601
1598
  }): react_jsx_runtime.JSX.Element;
1602
1599
 
1603
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
@@ -10581,24 +10581,23 @@ const QuarterPopupPicker = ({
10581
10581
  };
10582
10582
 
10583
10583
  /* eslint-disable import/no-extraneous-dependencies */
10584
- const QuarterPicker = _ref => {
10585
- let {
10586
- availableQuarters,
10587
- // ["Q1-2024"]
10588
- label,
10589
- onChange,
10590
- borderRadius,
10591
- required,
10592
- width,
10593
- height,
10594
- placeholder,
10595
- disabled,
10596
- borderColor,
10597
- borderColorFocus,
10598
- textColor,
10599
- selectedValue,
10600
- startYear
10601
- } = _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
+ }) => {
10602
10601
  const [isFocused, setIsFocused] = useState(false);
10603
10602
  const [isOpen, setIsOpen] = useState(false);
10604
10603
  const [value, setValue] = useState('');
@@ -11040,23 +11039,22 @@ const MonthPopupPicker = ({
11040
11039
  };
11041
11040
 
11042
11041
  /* eslint-disable import/no-extraneous-dependencies */
11043
- const MonthPicker = _ref => {
11044
- let {
11045
- availableMonths,
11046
- label,
11047
- onChange,
11048
- borderRadius,
11049
- required,
11050
- width,
11051
- height,
11052
- placeholder,
11053
- disabled,
11054
- borderColor,
11055
- borderColorFocus,
11056
- textColor,
11057
- selectedValue,
11058
- startYear
11059
- } = _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
+ }) => {
11060
11058
  const [isFocused, setIsFocused] = useState(false);
11061
11059
  const [isOpen, setIsOpen] = useState(false);
11062
11060
  const [value, setValue] = useState('');
@@ -24167,22 +24165,21 @@ const DeleteIcon = styled.div`
24167
24165
  position: absolute;
24168
24166
  `;
24169
24167
 
24170
- const QuickFilterDropdownSingle = _ref => {
24171
- let {
24172
- label,
24173
- hoverColor,
24174
- options,
24175
- selectedValue,
24176
- placeHolder,
24177
- onChange,
24178
- disabled,
24179
- width,
24180
- error,
24181
- errorMessage,
24182
- xIconShow,
24183
- labelColor,
24184
- showLabelOnTop
24185
- } = _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
+ }) => {
24186
24183
  const [isFocused, setIsFocused] = useState(false);
24187
24184
  const [showOptions, setShowOptions] = useState(false);
24188
24185
  const [inputValue, setInputValue] = useState("");
@@ -24639,26 +24636,25 @@ const IconContainer$2 = styled.div`
24639
24636
  cursor: pointer;
24640
24637
  `;
24641
24638
 
24642
- const QuickFilterDropdownMultiSelection = _ref => {
24643
- let {
24644
- label,
24645
- labelEmptyValue,
24646
- options,
24647
- selectedValue,
24648
- placeHolder,
24649
- onChange,
24650
- required,
24651
- disabled,
24652
- width,
24653
- height,
24654
- error,
24655
- errorMessage,
24656
- labelColor,
24657
- xIconShow,
24658
- checkBoxColor,
24659
- showLabelOnTop,
24660
- dropdownHeight
24661
- } = _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
+ }) => {
24662
24658
  const [isFocused, setIsFocused] = useState(false);
24663
24659
  const [showOptions, setShowOptions] = useState(false);
24664
24660
  const [inputValue, setInputValue] = useState('');
@@ -36169,9 +36165,9 @@ const ToggleSlider = styled.span`
36169
36165
  }
36170
36166
  `;
36171
36167
 
36172
- /**
36173
- * ToggleSwitch component for on/off states.
36174
- * Supports small/large sizes and disabled state.
36168
+ /**
36169
+ * ToggleSwitch component for on/off states.
36170
+ * Supports small/large sizes and disabled state.
36175
36171
  */
36176
36172
  function ToggleSwitch(_ref) {
36177
36173
  let {
@@ -57732,23 +57728,20 @@ const OverlayDropdown = _ref => {
57732
57728
  placeHolder,
57733
57729
  labelColor,
57734
57730
  placeHolderColor,
57735
- textColorMenu = "black",
57736
57731
  margin = "8px",
57737
57732
  editableDigitalCoupon = false,
57738
- dropdownDigitalCouponTitle = "",
57739
- className = "",
57740
57733
  ...props
57741
57734
  } = _ref;
57742
57735
  const [open, setOpen] = useState(false);
57743
57736
  const [hoveredText, setHoveredText] = useState(null);
57744
57737
  const [templateDialog, setTemplateDialog] = useState(null);
57745
57738
  const [dropdownPosition, setDropdownPosition] = useState("below");
57746
- const [selected, setSelected] = useState("");
57747
- const [hasValue, setHasValue] = useState(false);
57748
57739
  const [lastDefinedGroup, setLastDefinedGroup] = useState(data.find(group => group.overlayCode === "last_defined"));
57749
57740
  const buttonRef = useRef(null);
57750
57741
  const dropdownRef = useRef(null);
57751
57742
  const containerRef = useRef(null);
57743
+
57744
+ // Click outside to close dropdown
57752
57745
  useEffect(() => {
57753
57746
  const handleClickOutside = event => {
57754
57747
  if (containerRef.current && !containerRef.current.contains(event.target)) {
@@ -57764,13 +57757,20 @@ const OverlayDropdown = _ref => {
57764
57757
  document.removeEventListener("touchstart", handleClickOutside);
57765
57758
  };
57766
57759
  }, [open]);
57760
+
57761
+ // Calculate dropdown position when opening
57767
57762
  useEffect(() => {
57768
57763
  if (open && buttonRef.current) {
57769
57764
  const buttonRect = buttonRef.current.getBoundingClientRect();
57770
57765
  const viewportHeight = window.innerHeight;
57771
57766
  const dropdownHeight = parseInt(dropdownMaxHeight, 10);
57767
+
57768
+ // Space available below the button
57772
57769
  const spaceBelow = viewportHeight - buttonRect.bottom;
57770
+ // Space available above the button
57773
57771
  const spaceAbove = buttonRect.top;
57772
+
57773
+ // If there's not enough space below, but more space above, position above
57774
57774
  if (spaceBelow < dropdownHeight && spaceAbove > spaceBelow) {
57775
57775
  setDropdownPosition("above");
57776
57776
  } else {
@@ -57778,6 +57778,8 @@ const OverlayDropdown = _ref => {
57778
57778
  }
57779
57779
  }
57780
57780
  }, [open, dropdownMaxHeight, margin]);
57781
+
57782
+ // Combine original data with "Last defined by you" group
57781
57783
  const getDataWithLastDefined = () => {
57782
57784
  const combinedData = [...data];
57783
57785
  if (lastDefinedGroup) {
@@ -57785,26 +57787,20 @@ const OverlayDropdown = _ref => {
57785
57787
  }
57786
57788
  return combinedData;
57787
57789
  };
57790
+
57791
+ // Find selected item across all groups
57788
57792
  const findSelectedItem = () => {
57789
57793
  const allData = getDataWithLastDefined();
57790
57794
  for (const group of allData) {
57791
57795
  if (group.items) {
57792
- const found = group.items.find(item => {
57793
- const digitalCouponItem = item.value === value ? item.label : null;
57794
- if (digitalCouponItem && digitalCouponItem.includes("Digital") && editableDigitalCoupon) {
57795
- return true;
57796
- }
57797
- return item.value === value;
57798
- });
57796
+ const found = group.items.find(item => item.value === value);
57799
57797
  if (found) return found;
57800
57798
  }
57801
57799
  }
57802
57800
  return null;
57803
57801
  };
57804
- useEffect(() => {
57805
- setSelected(findSelectedItem());
57806
- setHasValue(!!findSelectedItem());
57807
- }, [value]);
57802
+ const selected = findSelectedItem();
57803
+ const hasValue = !!selected;
57808
57804
  const getTemplateParams = label => {
57809
57805
  if (!label) return [];
57810
57806
 
@@ -57937,7 +57933,6 @@ const OverlayDropdown = _ref => {
57937
57933
  return "";
57938
57934
  };
57939
57935
  return /*#__PURE__*/React$1.createElement(DropdownContainer, {
57940
- className: className,
57941
57936
  width: width,
57942
57937
  ref: containerRef
57943
57938
  }, /*#__PURE__*/React$1.createElement(Label$1, {
@@ -57959,7 +57954,7 @@ const OverlayDropdown = _ref => {
57959
57954
  onMouseEnter: () => setHoveredText(selected?.label),
57960
57955
  onMouseLeave: () => setHoveredText(null),
57961
57956
  color: !selected && open ? placeHolderColor : "inherit"
57962
- }, 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, {
57963
57958
  width: "12px",
57964
57959
  height: "12px",
57965
57960
  color: "#B1B1B1"
@@ -58007,14 +58002,11 @@ const OverlayDropdown = _ref => {
58007
58002
  }
58008
58003
  }
58009
58004
  }, /*#__PURE__*/React$1.createElement(TruncatedText, {
58010
- onMouseEnter: () => setHoveredText(selected?.label),
58011
- onMouseLeave: () => setHoveredText(null),
58012
- color: !selected && open ? textColorMenu : "inherit"
58013
- }, group.templateType === 3 && editableDigitalCoupon ? dropdownDigitalCouponTitle !== "" ? dropdownDigitalCouponTitle : item.label : item.label), group.templateType === 2 ? /*#__PURE__*/React$1.createElement(ChervronRightIcon, {
58014
- fill: item.value === value ? "#fff" : "#212121"
58015
- }) : 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, {
58016
58008
  fill: item.value === value ? "#fff" : "#212121"
58017
- }) : /*#__PURE__*/React$1.createElement(PenIcon, {
58009
+ }) : group.templateType === 3 && editableDigitalCoupon ? /*#__PURE__*/React$1.createElement(PenIcon, {
58018
58010
  fill: item.value === value ? "#fff" : "#212121"
58019
58011
  }) : item.value === value && /*#__PURE__*/React$1.createElement(OkIcon, {
58020
58012
  width: "22px",