sag_components 2.0.0-beta288 → 2.0.0-beta289

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.esm.js CHANGED
@@ -10590,24 +10590,23 @@ const QuarterPopupPicker = ({
10590
10590
  };
10591
10591
 
10592
10592
  /* eslint-disable import/no-extraneous-dependencies */
10593
- const QuarterPicker = _ref => {
10594
- let {
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
- } = _ref;
10593
+ const QuarterPicker = ({
10594
+ availableQuarters,
10595
+ // ["Q1-2024"]
10596
+ label,
10597
+ onChange,
10598
+ borderRadius,
10599
+ required,
10600
+ width,
10601
+ height,
10602
+ placeholder,
10603
+ disabled,
10604
+ borderColor,
10605
+ borderColorFocus,
10606
+ textColor,
10607
+ selectedValue,
10608
+ startYear
10609
+ }) => {
10611
10610
  const [isFocused, setIsFocused] = useState(false);
10612
10611
  const [isOpen, setIsOpen] = useState(false);
10613
10612
  const [value, setValue] = useState('');
@@ -11049,23 +11048,22 @@ const MonthPopupPicker = ({
11049
11048
  };
11050
11049
 
11051
11050
  /* eslint-disable import/no-extraneous-dependencies */
11052
- const MonthPicker = _ref => {
11053
- let {
11054
- availableMonths,
11055
- label,
11056
- onChange,
11057
- borderRadius,
11058
- required,
11059
- width,
11060
- height,
11061
- placeholder,
11062
- disabled,
11063
- borderColor,
11064
- borderColorFocus,
11065
- textColor,
11066
- selectedValue,
11067
- startYear
11068
- } = _ref;
11051
+ const MonthPicker = ({
11052
+ availableMonths,
11053
+ label,
11054
+ onChange,
11055
+ borderRadius,
11056
+ required,
11057
+ width,
11058
+ height,
11059
+ placeholder,
11060
+ disabled,
11061
+ borderColor,
11062
+ borderColorFocus,
11063
+ textColor,
11064
+ selectedValue,
11065
+ startYear
11066
+ }) => {
11069
11067
  const [isFocused, setIsFocused] = useState(false);
11070
11068
  const [isOpen, setIsOpen] = useState(false);
11071
11069
  const [value, setValue] = useState('');
@@ -24176,22 +24174,21 @@ const DeleteIcon = styled.div`
24176
24174
  position: absolute;
24177
24175
  `;
24178
24176
 
24179
- const QuickFilterDropdownSingle = _ref => {
24180
- let {
24181
- label,
24182
- hoverColor,
24183
- options,
24184
- selectedValue,
24185
- placeHolder,
24186
- onChange,
24187
- disabled,
24188
- width,
24189
- error,
24190
- errorMessage,
24191
- xIconShow,
24192
- labelColor,
24193
- showLabelOnTop
24194
- } = _ref;
24177
+ const QuickFilterDropdownSingle = ({
24178
+ label,
24179
+ hoverColor,
24180
+ options,
24181
+ selectedValue,
24182
+ placeHolder,
24183
+ onChange,
24184
+ disabled,
24185
+ width,
24186
+ error,
24187
+ errorMessage,
24188
+ xIconShow,
24189
+ labelColor,
24190
+ showLabelOnTop
24191
+ }) => {
24195
24192
  const [isFocused, setIsFocused] = useState(false);
24196
24193
  const [showOptions, setShowOptions] = useState(false);
24197
24194
  const [inputValue, setInputValue] = useState("");
@@ -24643,26 +24640,25 @@ const IconContainer$2 = styled.div`
24643
24640
  cursor: pointer;
24644
24641
  `;
24645
24642
 
24646
- const QuickFilterDropdownMultiSelection = _ref => {
24647
- let {
24648
- label,
24649
- labelEmptyValue,
24650
- options,
24651
- selectedValue,
24652
- placeHolder,
24653
- onChange,
24654
- required,
24655
- disabled,
24656
- width,
24657
- height,
24658
- error,
24659
- errorMessage,
24660
- labelColor,
24661
- xIconShow,
24662
- checkBoxColor,
24663
- showLabelOnTop,
24664
- dropdownHeight
24665
- } = _ref;
24643
+ const QuickFilterDropdownMultiSelection = ({
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
+ }) => {
24666
24662
  const [isFocused, setIsFocused] = useState(false);
24667
24663
  const [showOptions, setShowOptions] = useState(false);
24668
24664
  const [inputValue, setInputValue] = useState('');
@@ -36202,9 +36198,9 @@ const ToggleSlider = styled.span`
36202
36198
  }
36203
36199
  `;
36204
36200
 
36205
- /**
36206
- * ToggleSwitch component for on/off states.
36207
- * Supports small/large sizes and disabled state.
36201
+ /**
36202
+ * ToggleSwitch component for on/off states.
36203
+ * Supports small/large sizes and disabled state.
36208
36204
  */
36209
36205
  function ToggleSwitch(_ref) {
36210
36206
  let {
@@ -57883,26 +57879,21 @@ OverlayTemplateDialog.propTypes = {
57883
57879
  // OverlayDropdown.jsx
57884
57880
  const OverlayDropdown = _ref => {
57885
57881
  let {
57886
- // Data / selection
57887
57882
  data = [],
57888
57883
  value,
57889
57884
  onSelectClick,
57890
- // Label / placeholder
57891
57885
  label,
57892
57886
  labelEmptyValue,
57893
57887
  showLabelOnTop,
57894
57888
  labelColor,
57895
57889
  placeHolder,
57896
57890
  placeHolderColor,
57897
- // Behavior
57898
57891
  required = false,
57899
57892
  disabled = false,
57900
57893
  isDarkerBackground = false,
57901
57894
  editableDigitalCoupon = false,
57902
- // Appearance
57903
57895
  selectedColor = "#066768",
57904
57896
  hoverColor = "#E6F0F0",
57905
- // Sizing
57906
57897
  width = "100%",
57907
57898
  minWidth = "unset",
57908
57899
  dropdownWidth = "100%",
@@ -57919,8 +57910,6 @@ const OverlayDropdown = _ref => {
57919
57910
  const buttonRef = useRef(null);
57920
57911
  const dropdownRef = useRef(null);
57921
57912
  const containerRef = useRef(null);
57922
-
57923
- // Click outside to close dropdown
57924
57913
  useEffect(() => {
57925
57914
  const handleClickOutside = event => {
57926
57915
  if (containerRef.current && !containerRef.current.contains(event.target)) {
@@ -57936,20 +57925,13 @@ const OverlayDropdown = _ref => {
57936
57925
  document.removeEventListener("touchstart", handleClickOutside);
57937
57926
  };
57938
57927
  }, [open]);
57939
-
57940
- // Calculate dropdown position when opening
57941
57928
  useEffect(() => {
57942
57929
  if (open && buttonRef.current) {
57943
57930
  const buttonRect = buttonRef.current.getBoundingClientRect();
57944
57931
  const viewportHeight = window.innerHeight;
57945
57932
  const dropdownHeight = parseInt(dropdownMaxHeight, 10);
57946
-
57947
- // Space available below the button
57948
57933
  const spaceBelow = viewportHeight - buttonRect.bottom;
57949
- // Space available above the button
57950
57934
  const spaceAbove = buttonRect.top;
57951
-
57952
- // If there's not enough space below, but more space above, position above
57953
57935
  if (spaceBelow < dropdownHeight && spaceAbove > spaceBelow) {
57954
57936
  setDropdownPosition("above");
57955
57937
  } else {
@@ -57957,8 +57939,6 @@ const OverlayDropdown = _ref => {
57957
57939
  }
57958
57940
  }
57959
57941
  }, [open, dropdownMaxHeight, margin]);
57960
-
57961
- // Combine original data with "Last defined by you" group
57962
57942
  const getDataWithLastDefined = () => {
57963
57943
  const combinedData = [...data];
57964
57944
  if (lastDefinedGroup) {
@@ -57966,8 +57946,6 @@ const OverlayDropdown = _ref => {
57966
57946
  }
57967
57947
  return combinedData;
57968
57948
  };
57969
-
57970
- // Find selected item across all groups
57971
57949
  const findSelectedItem = () => {
57972
57950
  const allData = getDataWithLastDefined();
57973
57951
  for (const group of allData) {
@@ -57982,40 +57960,30 @@ const OverlayDropdown = _ref => {
57982
57960
  const hasValue = !!selected;
57983
57961
  const getTemplateParams = label => {
57984
57962
  if (!label) return [];
57985
-
57986
- // Pattern 1: "Buy X & Get Y% Off" - X and Y must be standalone capital letters
57987
- // Using word boundaries for better browser compatibility
57988
57963
  const buyGetOffPattern = /^(.*?)\bX\b(.*?)\bY\b(.*)$/;
57989
57964
  const buyGetOffMatch = label.match(buyGetOffPattern);
57990
57965
  if (buyGetOffMatch) {
57991
57966
  const [, beforeX, betweenXY, afterY] = buyGetOffMatch;
57992
57967
  return [{
57993
57968
  label: beforeX.trim(),
57994
- // "Buy "
57995
57969
  type: "number",
57996
57970
  suffix: ""
57997
57971
  }, {
57998
57972
  label: betweenXY.trim(),
57999
- // " & Get "
58000
57973
  type: "number",
58001
- suffix: afterY.trim() // " % Off"
57974
+ suffix: afterY.trim()
58002
57975
  }];
58003
57976
  }
58004
-
58005
- // Pattern 2: Single variable patterns - X or Y must be standalone capital letters
58006
57977
  const singleVariablePattern = /^(.*?)\b([XY])\b(.*)$/;
58007
57978
  const singleVariableMatch = label.match(singleVariablePattern);
58008
57979
  if (singleVariableMatch) {
58009
57980
  const [, beforeVar, variable, afterVar] = singleVariableMatch;
58010
57981
  return [{
58011
57982
  label: beforeVar.trim(),
58012
- // "Buy "
58013
57983
  type: "number",
58014
- suffix: afterVar.trim() // " of item(s), Get Free Item"
57984
+ suffix: afterVar.trim()
58015
57985
  }];
58016
57986
  }
58017
-
58018
- // Fallback: if no pattern matches, treat as single input
58019
57987
  return [{
58020
57988
  label: "Value",
58021
57989
  type: "number",
@@ -58024,51 +57992,38 @@ const OverlayDropdown = _ref => {
58024
57992
  };
58025
57993
  const generateFinalSentence = (template, values) => {
58026
57994
  let sentence = template.label;
58027
-
58028
- // Pattern 1: "Buy X & Get Y% Off" - X and Y must be standalone capital letters
58029
57995
  const buyGetOffPattern = /^(.*?)\bX\b(.*?)\bY\b(.*)$/;
58030
57996
  const buyGetOffMatch = sentence.match(buyGetOffPattern);
58031
57997
  if (buyGetOffMatch && values.length >= 2) {
58032
57998
  const [, beforeX, betweenXY, afterY] = buyGetOffMatch;
58033
57999
  return beforeX + values[0] + betweenXY + values[1] + afterY;
58034
58000
  }
58035
-
58036
- // Pattern 2: Single variable patterns - X or Y must be standalone capital letters
58037
58001
  const singleVariablePattern = /^(.*?)\b([XY])\b(.*)$/;
58038
58002
  const singleVariableMatch = sentence.match(singleVariablePattern);
58039
58003
  if (singleVariableMatch && values.length >= 1) {
58040
58004
  const [, beforeVar, variable, afterVar] = singleVariableMatch;
58041
58005
  return beforeVar + values[0] + afterVar;
58042
58006
  }
58043
-
58044
- // Fallback
58045
58007
  return sentence;
58046
58008
  };
58047
58009
  const handleTemplateApply = fields => {
58048
58010
  if (templateDialog && onSelectClick) {
58049
58011
  const finalSentence = generateFinalSentence(templateDialog.item, fields);
58050
-
58051
- // Create new item for "Last defined by you" group
58052
58012
  const newItem = {
58053
58013
  ...templateDialog.item,
58054
58014
  label: finalSentence,
58055
58015
  value: templateDialog.item.value,
58056
- // Unique value
58057
58016
  overlayCode: templateDialog.group.overlayCode,
58058
58017
  overlayName: templateDialog.group.overlayName,
58059
58018
  templateType: templateDialog.group.templateType,
58060
58019
  appliedValues: fields
58061
58020
  };
58062
-
58063
- // Update "Last defined by you" group - add to existing or create new
58064
58021
  if (lastDefinedGroup) {
58065
- // Add to existing group
58066
58022
  setLastDefinedGroup({
58067
58023
  ...lastDefinedGroup,
58068
- items: [newItem, ...lastDefinedGroup.items] // Add new item at the beginning
58024
+ items: [newItem, ...lastDefinedGroup.items]
58069
58025
  });
58070
58026
  } else {
58071
- // Create new group
58072
58027
  setLastDefinedGroup({
58073
58028
  overlayCode: "last_defined",
58074
58029
  overlayName: "Last defined by you",
@@ -58077,8 +58032,6 @@ const OverlayDropdown = _ref => {
58077
58032
  });
58078
58033
  }
58079
58034
  setTemplateDialog(null);
58080
-
58081
- // Select the new item
58082
58035
  onSelectClick(newItem);
58083
58036
  }
58084
58037
  };
@@ -58135,6 +58088,7 @@ const OverlayDropdown = _ref => {
58135
58088
  content: selected?.label,
58136
58089
  showTooltip: !!selected
58137
58090
  }, /*#__PURE__*/React$1.createElement(Wrapper, null, /*#__PURE__*/React$1.createElement(TruncatedText, {
58091
+ className: "selected",
58138
58092
  onMouseEnter: () => setHoveredText(selected?.label),
58139
58093
  onMouseLeave: () => setHoveredText(null),
58140
58094
  color: !selected && open ? placeHolderColor : "inherit"
@@ -58164,24 +58118,29 @@ const OverlayDropdown = _ref => {
58164
58118
  onClick: () => {
58165
58119
  if (onSelectClick && !disabled) {
58166
58120
  setOpen(false);
58167
- if (group.templateType === 2) {
58168
- // Open template dialog
58121
+ if (group.templateType === 3 && editableDigitalCoupon) {
58122
+ const result = {
58123
+ ...item,
58124
+ overlayCode: group.overlayCode,
58125
+ overlayName: group.overlayName,
58126
+ templateType: group.templateType,
58127
+ isEditableDigitalCoupon: true
58128
+ };
58129
+ onSelectClick(result);
58130
+ } else if (group.templateType === 2) {
58169
58131
  setTemplateDialog({
58170
58132
  item,
58171
58133
  group,
58172
58134
  params: getTemplateParams(item.label)
58173
58135
  });
58174
58136
  } else {
58175
- // Regular selection
58176
- if (onSelectClick) {
58177
- const result = {
58178
- ...item,
58179
- overlayCode: group.overlayCode,
58180
- overlayName: group.overlayName,
58181
- templateType: group.templateType
58182
- };
58183
- onSelectClick(result);
58184
- }
58137
+ const result = {
58138
+ ...item,
58139
+ overlayCode: group.overlayCode,
58140
+ overlayName: group.overlayName,
58141
+ templateType: group.templateType
58142
+ };
58143
+ onSelectClick(result);
58185
58144
  }
58186
58145
  }
58187
58146
  }