sag_components 2.0.0-beta245 → 2.0.0-beta246

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
@@ -9453,27 +9453,26 @@ const IconContainer$4 = styled.div`
9453
9453
  cursor: pointer;
9454
9454
  `;
9455
9455
 
9456
- const DropdownMultiNew = _ref => {
9457
- let {
9458
- label,
9459
- labelEmptyValue,
9460
- options,
9461
- selectedValue,
9462
- onChange,
9463
- required,
9464
- disabled,
9465
- width,
9466
- height,
9467
- withMarginBottom = true,
9468
- error,
9469
- errorMessage,
9470
- labelColor,
9471
- xIconShow,
9472
- checkBoxColor,
9473
- showLabelOnTop,
9474
- orderBy,
9475
- elementType
9476
- } = _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
+ }) => {
9477
9476
  const [isFocused, setIsFocused] = useState(false);
9478
9477
  const [showOptions, setShowOptions] = useState(false);
9479
9478
  const [showAbove, setShowAbove] = useState(false);
@@ -35323,21 +35322,26 @@ const WeeksPicker = _ref => {
35323
35322
  }
35324
35323
  }, [allowedWeekRange, restrictToRange]);
35325
35324
  useEffect(() => {
35326
- if (previousText !== text && value) {
35325
+ if (previousText !== text) {
35326
+ setPreviousText(text);
35327
+ }
35328
+ const currentValue = value || selectedValue;
35329
+ if (currentValue) {
35327
35330
  const {
35328
35331
  startWeek,
35329
35332
  endWeek
35330
- } = parseValueToWeeks(value);
35333
+ } = parseValueToWeeks(currentValue);
35331
35334
  if (startWeek && endWeek) {
35332
35335
  const newValue = endWeek === startWeek ? text === 'Week' ? `${text} ${startWeek}` : `${text}${startWeek}` : text === 'Week' ? `${text}s ${startWeek} - ${endWeek}` : `${text}${startWeek} - ${endWeek}`;
35333
- setValue(newValue);
35334
- if (onChange) {
35335
- onChange(newValue);
35336
+ if (newValue !== value) {
35337
+ setValue(newValue);
35338
+ if (onChange) {
35339
+ onChange(newValue);
35340
+ }
35336
35341
  }
35337
35342
  }
35338
- setPreviousText(text);
35339
35343
  }
35340
- }, [text, value, previousText, onChange]);
35344
+ }, [text, value, selectedValue, previousText, onChange]);
35341
35345
  const handleToggle = () => {
35342
35346
  setIsOpen(!isOpen);
35343
35347
  };
@@ -35358,11 +35362,6 @@ const WeeksPicker = _ref => {
35358
35362
  onChange(newValue);
35359
35363
  setValue(newValue);
35360
35364
  };
35361
- useEffect(() => {
35362
- if (selectedValue !== undefined) {
35363
- setValue(selectedValue);
35364
- }
35365
- }, [selectedValue]);
35366
35365
  const handleApply = () => {
35367
35366
  setIsOpen(false);
35368
35367
  };
@@ -36113,15 +36112,19 @@ const ToggleInput = styled.input`
36113
36112
  const ToggleSlider = styled.span`
36114
36113
  display: block;
36115
36114
  position: relative;
36116
- background: ${({
36117
- checked,
36118
- disabled
36119
- }) => checked ? "#006d6a" : disabled ? "#B1B1B1" : "#D0D0D0"};
36115
+ background: ${_ref => {
36116
+ let {
36117
+ checked,
36118
+ disabled
36119
+ } = _ref;
36120
+ return checked ? "#006d6a" : disabled ? "#B1B1B1" : "#D0D0D0";
36121
+ }};
36120
36122
  border-radius: 999px;
36121
36123
  transition: background 0.2s;
36122
- ${({
36123
- size
36124
- }) => {
36124
+ ${_ref2 => {
36125
+ let {
36126
+ size
36127
+ } = _ref2;
36125
36128
  switch (size) {
36126
36129
  case "s":
36127
36130
  return css`width: 40px; height: 20px;`;
@@ -36137,14 +36140,18 @@ const ToggleSlider = styled.span`
36137
36140
  left: 3px;
36138
36141
  top: 50%;
36139
36142
  transform: translateY(-50%);
36140
- background: ${({
36141
- disabled
36142
- }) => disabled ? "#D0D0D0" : "#fff"};
36143
+ background: ${_ref3 => {
36144
+ let {
36145
+ disabled
36146
+ } = _ref3;
36147
+ return disabled ? "#D0D0D0" : "#fff";
36148
+ }};
36143
36149
  border-radius: 50%;
36144
36150
  transition: left 0.2s, width 0.2s, height 0.2s;
36145
- ${({
36146
- size
36147
- }) => {
36151
+ ${_ref4 => {
36152
+ let {
36153
+ size
36154
+ } = _ref4;
36148
36155
  switch (size) {
36149
36156
  case "s":
36150
36157
  return css`width: 14px; height: 14px;`;
@@ -36154,10 +36161,11 @@ const ToggleSlider = styled.span`
36154
36161
  return css`width: 20px; height: 20px;`;
36155
36162
  }
36156
36163
  }}
36157
- left: ${({
36158
- checked,
36159
- size
36160
- }) => {
36164
+ left: ${_ref5 => {
36165
+ let {
36166
+ checked,
36167
+ size
36168
+ } = _ref5;
36161
36169
  if (!checked) return "3px";
36162
36170
  switch (size) {
36163
36171
  case "s":
@@ -48205,8 +48213,8 @@ const NewSubitem = ({
48205
48213
  }, [packageObject]);
48206
48214
  useEffect(() => {
48207
48215
  if (packageObject && packageObject.brands === negotiatedBrands) return;
48208
- setIsPackageDuplicated(vendor.packages.some(pkg => pkg.brands === negotiatedBrands));
48209
- setIsApplyEnabled(negotiatedBrands.trim().length > 2 && vendor.packages.some(pkg => pkg.brands === negotiatedBrands) === false);
48216
+ setIsPackageDuplicated(itemAndPackage.some(obj => obj.name === vendor.name && obj.packages?.some(pkg => pkg.brands === negotiatedBrands)));
48217
+ setIsApplyEnabled(negotiatedBrands.trim().length > 2 && !itemAndPackage.some(obj => obj.name === vendor.name && obj.packages?.some(pkg => pkg.brands === negotiatedBrands)));
48210
48218
  }, [negotiatedBrands]);
48211
48219
  return /*#__PURE__*/React$1.createElement(NewSubitemContainer, null, /*#__PURE__*/React$1.createElement(Header, null, /*#__PURE__*/React$1.createElement(BackButton, {
48212
48220
  onClick: onBack