sag_components 2.0.0-beta113 → 2.0.0-beta114

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
@@ -1300,7 +1300,7 @@ declare function WeeksPicker({ label, disabled, borderColor, borderColorFocus, t
1300
1300
  selectedValue: any;
1301
1301
  }): react_jsx_runtime.JSX.Element;
1302
1302
 
1303
- declare function Input({ label, labelEmptyValue, size, selectedValue, placeHolder, onChange, onBlur, required, disabled, width, error, errorMessage, labelColor, leftIcon, rightIcon, password, leftIconOnClick, rightIconOnClick, }: {
1303
+ declare function Input({ label, labelEmptyValue, size, selectedValue, placeHolder, onChange, onBlur, required, disabled, isDarkerBackground, width, error, errorMessage, labelColor, leftIcon, rightIcon, password, leftIconOnClick, rightIconOnClick, }: {
1304
1304
  label: any;
1305
1305
  labelEmptyValue: any;
1306
1306
  size: any;
@@ -1310,6 +1310,7 @@ declare function Input({ label, labelEmptyValue, size, selectedValue, placeHolde
1310
1310
  onBlur: any;
1311
1311
  required: any;
1312
1312
  disabled: any;
1313
+ isDarkerBackground?: boolean;
1313
1314
  width: any;
1314
1315
  error: any;
1315
1316
  errorMessage: any;
package/dist/index.esm.js CHANGED
@@ -35194,7 +35194,7 @@ const Label$2 = styled.label`
35194
35194
  margin-right: 10px;
35195
35195
  z-index: 2;
35196
35196
  color: ${props => props.error ? 'red' : props.disabled ? '#D0D0D0' : props.labelColor};
35197
- background-color: white;
35197
+ background-color: ${props => props.disabled && props.isDarkerBackground ? '#F2F2F2' : '#fff'};
35198
35198
  position: absolute;
35199
35199
  top: ${props => props.isFocused || props.hasValue ? '0px' : props.size === 'medium' ? '27px' : '17px'};
35200
35200
  left: ${props => props.isFocused || props.hasValue ? '23px' : props.leftIcon && props.leftIcon !== 'none' ? '42px' : '16px'};
@@ -35211,28 +35211,26 @@ const Label$2 = styled.label`
35211
35211
  }
35212
35212
  `;
35213
35213
  const InputContainer = styled.div`
35214
-
35215
- display: flex;
35216
- flex-direction: row;
35217
- flex-wrap: nowrap;
35218
- justify-content: flex-start;
35219
- align-content: center;
35220
- white-space: pre-wrap;
35221
- align-items: center;
35222
- overflow: hidden;
35223
- padding: 0 16px;
35224
- gap: 14px;
35225
- width: 100%;
35226
- height: 100%;
35227
- box-sizing: border-box;
35228
- background-color: #fff;
35229
- border: 1px solid ${props => props.disabled ? '#D0D0D0' : props.error ? 'red' : '#B1B1B1'};
35230
- font-family: "Poppins", sans-serif;
35231
- font-weight: 400;
35232
- font-size: 14px;
35233
- border-radius: ${props => props.size === 'small' ? '8px' : '12px'};
35234
- outline: none;
35235
- color: ${props => props.disabled ? '#D0D0D0' : '#212121'};
35214
+ display: flex;
35215
+ flex-wrap: nowrap;
35216
+ justify-content: flex-start;
35217
+ align-content: center;
35218
+ white-space: pre-wrap;
35219
+ align-items: center;
35220
+ overflow: hidden;
35221
+ padding: 0 16px;
35222
+ gap: 14px;
35223
+ width: 100%;
35224
+ height: 100%;
35225
+ box-sizing: border-box;
35226
+ background-color: ${props => props.disabled && props.isDarkerBackground ? '#F2F2F2' : '#fff'};
35227
+ border: 1px solid ${props => props.disabled ? '#D0D0D0' : props.error ? 'red' : '#B1B1B1'};
35228
+ font-family: "Poppins", sans-serif;
35229
+ font-weight: 400;
35230
+ font-size: 14px;
35231
+ border-radius: ${props => props.size === 'small' ? '8px' : '12px'};
35232
+ outline: none;
35233
+ color: ${props => props.disabled ? '#D0D0D0' : '#212121'};
35236
35234
 
35237
35235
  &:hover {
35238
35236
  border: 1px solid ${props => props.disabled ? '#D0D0D0' : props.error ? 'red' : props.labelColor || '#212121'};
@@ -35244,25 +35242,24 @@ const InputContainer = styled.div`
35244
35242
 
35245
35243
  `;
35246
35244
  const InputSubContainer = styled.div`
35247
-
35248
- display: flex;
35249
- flex-direction: column;
35250
- flex-wrap: nowrap;
35251
- align-content: center;
35252
- align-items: flex-start;
35253
- justify-content: center;
35254
- white-space: pre-wrap;
35255
- overflow: hidden;
35256
- padding: 5px 0;
35257
- width: 100%;
35258
- height: 100%;
35259
- min-height: ${props => props.size === 'medium' ? '52px' : '32px'};
35260
- box-sizing: border-box;
35261
- background-color: #fff;
35262
- border-radius: ${props => props.size === 'small' ? '8px' : '12px'};
35263
- outline: none;
35264
- color: ${props => props.disabled ? '#D0D0D0' : '#212121'};
35265
- cursor: ${props => props.disabled ? 'not-allowed' : 'pointer'};
35245
+ display: flex;
35246
+ flex-direction: column;
35247
+ flex-wrap: nowrap;
35248
+ align-content: center;
35249
+ align-items: flex-start;
35250
+ justify-content: center;
35251
+ white-space: pre-wrap;
35252
+ overflow: hidden;
35253
+ padding: 5px 0;
35254
+ width: 100%;
35255
+ height: 100%;
35256
+ min-height: ${props => props.size === 'medium' ? '52px' : '32px'};
35257
+ box-sizing: border-box;
35258
+ background-color: ${props => props.disabled && props.isDarkerBackground ? '#F2F2F2' : '#fff'};
35259
+ border-radius: ${props => props.size === 'small' ? '8px' : '12px'};
35260
+ outline: none;
35261
+ color: ${props => props.disabled ? '#D0D0D0' : '#212121'};
35262
+ cursor: ${props => props.disabled ? 'not-allowed' : 'pointer'};
35266
35263
  `;
35267
35264
  const StyledInput = styled.input`
35268
35265
  width: calc(100% - 10px);
@@ -35271,7 +35268,7 @@ const StyledInput = styled.input`
35271
35268
  font-size: 14px;
35272
35269
  outline: none;
35273
35270
  color: ${props => props.disabled ? '#D0D0D0' : '#212121'};
35274
- background-color: #fff;
35271
+ background-color: ${props => props.disabled && props.isDarkerBackground ? '#F2F2F2' : '#fff'};
35275
35272
  border: none;
35276
35273
  cursor: ${props => props.disabled ? 'not-allowed' : 'pointer'};
35277
35274
  `;
@@ -35304,6 +35301,7 @@ const Input$2 = _ref => {
35304
35301
  onBlur,
35305
35302
  required,
35306
35303
  disabled,
35304
+ isDarkerBackground = false,
35307
35305
  width,
35308
35306
  error,
35309
35307
  errorMessage,
@@ -35390,11 +35388,13 @@ const Input$2 = _ref => {
35390
35388
  className: "MainContainer",
35391
35389
  width: width,
35392
35390
  size: size,
35393
- disabled: disabled
35391
+ disabled: disabled,
35392
+ isDarkerBackground: isDarkerBackground
35394
35393
  }, /*#__PURE__*/React$1.createElement(InputContainer, {
35395
35394
  className: "InputContainer",
35396
35395
  labelColor: labelColor,
35397
35396
  disabled: disabled,
35397
+ isDarkerBackground: isDarkerBackground,
35398
35398
  error: error,
35399
35399
  isFocused: isFocused,
35400
35400
  size: size
@@ -35403,6 +35403,7 @@ const Input$2 = _ref => {
35403
35403
  ref: containerRef,
35404
35404
  labelColor: labelColor,
35405
35405
  disabled: disabled,
35406
+ isDarkerBackground: isDarkerBackground,
35406
35407
  error: error,
35407
35408
  onClick: handleLabelClick,
35408
35409
  size: size
@@ -35413,6 +35414,7 @@ const Input$2 = _ref => {
35413
35414
  hasValue: inputValue,
35414
35415
  leftIcon: leftIcon,
35415
35416
  disabled: disabled,
35417
+ isDarkerBackground: isDarkerBackground,
35416
35418
  error: error,
35417
35419
  errorMessage: errorMessage,
35418
35420
  onClick: handleLabelClick,
@@ -35432,6 +35434,7 @@ const Input$2 = _ref => {
35432
35434
  onFocus: handleFocus,
35433
35435
  onBlur: handleBlur,
35434
35436
  disabled: disabled,
35437
+ isDarkerBackground: isDarkerBackground,
35435
35438
  placeholder: isFocused ? placeHolder : '',
35436
35439
  error: error,
35437
35440
  isFocused: isFocused
@@ -41930,6 +41933,15 @@ const NewSubitemList = props => {
41930
41933
  } : v);
41931
41934
  setItemAndPackage(updatedItemAndPackage);
41932
41935
  };
41936
+ const handleAddNewPackage = () => {
41937
+ setSelectedPackage(null);
41938
+ handleSubitemDetail(null); // Pass null for new package
41939
+ };
41940
+ const handleEditExistingPackage = item => {
41941
+ setSelectedPackage(item);
41942
+ handleSubitemDetail(item); // Pass the package object for editing
41943
+ };
41944
+
41933
41945
  // useEffect(() => {
41934
41946
  // console.log("Vendor items updated:", vendorItems);
41935
41947
  // console.log("Props:", props);
@@ -41941,16 +41953,15 @@ const NewSubitemList = props => {
41941
41953
  textColor: linkColor,
41942
41954
  leftIcon: "Plus",
41943
41955
  rightIcon: "none",
41944
- onClick: handleSubitemDetail,
41956
+ onClick: handleAddNewPackage,
41945
41957
  size: "small",
41946
41958
  text: "Add Package",
41947
41959
  type: "primary"
41948
41960
  })), /*#__PURE__*/React$1.createElement(List, null, vendorItems.map((item, idx) => /*#__PURE__*/React$1.createElement(Item$1, {
41949
- key: idx
41961
+ key: `item-${idx}-${item.brands}`
41950
41962
  }, /*#__PURE__*/React$1.createElement(PaperPlane, null), /*#__PURE__*/React$1.createElement(Container, {
41951
41963
  onClick: e => {
41952
- setSelectedPackage(item);
41953
- handleSubitemDetail(item);
41964
+ handleEditExistingPackage(item);
41954
41965
  }
41955
41966
  }, item.brands && /*#__PURE__*/React$1.createElement(Title$2, null, item.brands), item.component && /*#__PURE__*/React$1.createElement(ComponentContainer, null, item.component[0]), /*#__PURE__*/React$1.createElement(Chevron, null, /*#__PURE__*/React$1.createElement(ArrowRightFullIcon, null))), /*#__PURE__*/React$1.createElement(Trash, {
41956
41967
  className: "trash-icon",
@@ -50825,6 +50836,7 @@ const ItemManagerPanel = _ref => {
50825
50836
  const [screen, setScreen] = useState("initial");
50826
50837
  const [selectedVendor, setSelectedVendor] = useState(null);
50827
50838
  const [selectedPackage, setSelectedPackage] = useState(null);
50839
+ const [isEditingExisting, setIsEditingExisting] = useState(false);
50828
50840
  const handleVendorClick = vendor => {
50829
50841
  // console.log("Vendor clicked:", vendor);
50830
50842
  setSelectedVendor(vendor);
@@ -50853,6 +50865,30 @@ const ItemManagerPanel = _ref => {
50853
50865
  });
50854
50866
  setScreen("subitem");
50855
50867
  };
50868
+ const updateExistingPackage = (vendorName, originalPackage, updatedPackageName, updatedComponent) => {
50869
+ setItemAndPackage(prev => {
50870
+ return prev.map(vendor => {
50871
+ if (vendor.name !== vendorName) {
50872
+ return vendor;
50873
+ }
50874
+ return {
50875
+ ...vendor,
50876
+ packages: vendor.packages.map(pkg => {
50877
+ // Find the package to update by comparing with the original package
50878
+ if (pkg.brands === originalPackage.brands && JSON.stringify(pkg.component) === JSON.stringify(originalPackage.component)) {
50879
+ return {
50880
+ ...pkg,
50881
+ brands: updatedPackageName,
50882
+ component: updatedComponent
50883
+ };
50884
+ }
50885
+ return pkg;
50886
+ })
50887
+ };
50888
+ });
50889
+ });
50890
+ setScreen("subitem");
50891
+ };
50856
50892
  const onDeleteVendor = vendor => {
50857
50893
  const updatedItemAndPackage = itemAndPackage.filter(item => item.name !== vendor.name);
50858
50894
  setItemAndPackage([...updatedItemAndPackage, {
@@ -50888,7 +50924,19 @@ const ItemManagerPanel = _ref => {
50888
50924
  itemAndPackage: itemAndPackage,
50889
50925
  onBack: () => setScreen("initial"),
50890
50926
  onTrashClick: () => onDeleteInner(selectedVendor),
50891
- handleSubitemDetail: () => setScreen("subitemdetail")
50927
+ handleSubitemDetail: function () {
50928
+ let pkg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
50929
+ if (pkg) {
50930
+ // Editing existing package
50931
+ setSelectedPackage(pkg);
50932
+ setIsEditingExisting(true);
50933
+ } else {
50934
+ // Adding new package
50935
+ setSelectedPackage(null);
50936
+ setIsEditingExisting(false);
50937
+ }
50938
+ setScreen("subitemdetail");
50939
+ }
50892
50940
  }));
50893
50941
  }
50894
50942
  if (screen === "confirmation") {
@@ -50926,6 +50974,8 @@ const ItemManagerPanel = _ref => {
50926
50974
  vendor: selectedVendor,
50927
50975
  itemAndPackage: itemAndPackage,
50928
50976
  addNewPackage: addNewPackage,
50977
+ updateExistingPackage: updateExistingPackage,
50978
+ isEditingExisting: isEditingExisting,
50929
50979
  onBack: () => setScreen("subitem")
50930
50980
  }));
50931
50981
  }
@@ -51076,14 +51126,11 @@ const scrollableStyles = `
51076
51126
  const DropdownContainer = styled.div`
51077
51127
  position: relative;
51078
51128
  width: ${props => props.width || '100%'};
51079
- /* min-width: 320px; */
51080
- max-width: 600px;
51129
+ max-width: 400px;
51081
51130
  font-family: "Poppins", sans-serif;
51082
51131
  `;
51083
51132
  const DropdownButton = styled.button`
51084
51133
  width: 100%;
51085
- /* min-width: 320px; */
51086
- max-width: 600px;
51087
51134
  background: #fff;
51088
51135
  border: 1px solid #8B8989;
51089
51136
  border-radius: 12px;
@@ -51094,9 +51141,9 @@ const DropdownButton = styled.button`
51094
51141
  align-items: center;
51095
51142
  justify-content: space-between;
51096
51143
  ${props => props.disabled && css`
51097
- color:#8B8989;
51098
- /* background-color: #D0D0D0; */
51144
+ color: #D0D0D0;
51099
51145
  cursor: not-allowed;
51146
+ border: 1px solid #D0D0D0;
51100
51147
  `}
51101
51148
  `;
51102
51149
  const DropdownList = styled.ul`
@@ -51139,7 +51186,7 @@ const DropdownItem = styled.li`
51139
51186
  margin: 0 12px;
51140
51187
  background: ${props => props.selected ? props.selectedColor || '#066768' : 'transparent'};
51141
51188
  font-weight: ${props => props.selected ? '500' : '400'};
51142
- color: ${props => props.disabled ? '#bdbdbd' : props.selected ? '#fff' : '#212121'};
51189
+ color: ${props => props.disabled ? '#D0D0D0' : props.selected ? '#fff' : '#212121'};
51143
51190
  border-left: ${props => props.selected ? `3px solid ${props.selectedColor || '#066768'}` : 'none'};
51144
51191
  ${props => props.disabled && css`
51145
51192
  cursor: not-allowed;