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.js CHANGED
@@ -35204,7 +35204,7 @@ const Label$2 = styled__default["default"].label`
35204
35204
  margin-right: 10px;
35205
35205
  z-index: 2;
35206
35206
  color: ${props => props.error ? 'red' : props.disabled ? '#D0D0D0' : props.labelColor};
35207
- background-color: white;
35207
+ background-color: ${props => props.disabled && props.isDarkerBackground ? '#F2F2F2' : '#fff'};
35208
35208
  position: absolute;
35209
35209
  top: ${props => props.isFocused || props.hasValue ? '0px' : props.size === 'medium' ? '27px' : '17px'};
35210
35210
  left: ${props => props.isFocused || props.hasValue ? '23px' : props.leftIcon && props.leftIcon !== 'none' ? '42px' : '16px'};
@@ -35221,28 +35221,26 @@ const Label$2 = styled__default["default"].label`
35221
35221
  }
35222
35222
  `;
35223
35223
  const InputContainer = styled__default["default"].div`
35224
-
35225
- display: flex;
35226
- flex-direction: row;
35227
- flex-wrap: nowrap;
35228
- justify-content: flex-start;
35229
- align-content: center;
35230
- white-space: pre-wrap;
35231
- align-items: center;
35232
- overflow: hidden;
35233
- padding: 0 16px;
35234
- gap: 14px;
35235
- width: 100%;
35236
- height: 100%;
35237
- box-sizing: border-box;
35238
- background-color: #fff;
35239
- border: 1px solid ${props => props.disabled ? '#D0D0D0' : props.error ? 'red' : '#B1B1B1'};
35240
- font-family: "Poppins", sans-serif;
35241
- font-weight: 400;
35242
- font-size: 14px;
35243
- border-radius: ${props => props.size === 'small' ? '8px' : '12px'};
35244
- outline: none;
35245
- color: ${props => props.disabled ? '#D0D0D0' : '#212121'};
35224
+ display: flex;
35225
+ flex-wrap: nowrap;
35226
+ justify-content: flex-start;
35227
+ align-content: center;
35228
+ white-space: pre-wrap;
35229
+ align-items: center;
35230
+ overflow: hidden;
35231
+ padding: 0 16px;
35232
+ gap: 14px;
35233
+ width: 100%;
35234
+ height: 100%;
35235
+ box-sizing: border-box;
35236
+ background-color: ${props => props.disabled && props.isDarkerBackground ? '#F2F2F2' : '#fff'};
35237
+ border: 1px solid ${props => props.disabled ? '#D0D0D0' : props.error ? 'red' : '#B1B1B1'};
35238
+ font-family: "Poppins", sans-serif;
35239
+ font-weight: 400;
35240
+ font-size: 14px;
35241
+ border-radius: ${props => props.size === 'small' ? '8px' : '12px'};
35242
+ outline: none;
35243
+ color: ${props => props.disabled ? '#D0D0D0' : '#212121'};
35246
35244
 
35247
35245
  &:hover {
35248
35246
  border: 1px solid ${props => props.disabled ? '#D0D0D0' : props.error ? 'red' : props.labelColor || '#212121'};
@@ -35254,25 +35252,24 @@ const InputContainer = styled__default["default"].div`
35254
35252
 
35255
35253
  `;
35256
35254
  const InputSubContainer = styled__default["default"].div`
35257
-
35258
- display: flex;
35259
- flex-direction: column;
35260
- flex-wrap: nowrap;
35261
- align-content: center;
35262
- align-items: flex-start;
35263
- justify-content: center;
35264
- white-space: pre-wrap;
35265
- overflow: hidden;
35266
- padding: 5px 0;
35267
- width: 100%;
35268
- height: 100%;
35269
- min-height: ${props => props.size === 'medium' ? '52px' : '32px'};
35270
- box-sizing: border-box;
35271
- background-color: #fff;
35272
- border-radius: ${props => props.size === 'small' ? '8px' : '12px'};
35273
- outline: none;
35274
- color: ${props => props.disabled ? '#D0D0D0' : '#212121'};
35275
- cursor: ${props => props.disabled ? 'not-allowed' : 'pointer'};
35255
+ display: flex;
35256
+ flex-direction: column;
35257
+ flex-wrap: nowrap;
35258
+ align-content: center;
35259
+ align-items: flex-start;
35260
+ justify-content: center;
35261
+ white-space: pre-wrap;
35262
+ overflow: hidden;
35263
+ padding: 5px 0;
35264
+ width: 100%;
35265
+ height: 100%;
35266
+ min-height: ${props => props.size === 'medium' ? '52px' : '32px'};
35267
+ box-sizing: border-box;
35268
+ background-color: ${props => props.disabled && props.isDarkerBackground ? '#F2F2F2' : '#fff'};
35269
+ border-radius: ${props => props.size === 'small' ? '8px' : '12px'};
35270
+ outline: none;
35271
+ color: ${props => props.disabled ? '#D0D0D0' : '#212121'};
35272
+ cursor: ${props => props.disabled ? 'not-allowed' : 'pointer'};
35276
35273
  `;
35277
35274
  const StyledInput = styled__default["default"].input`
35278
35275
  width: calc(100% - 10px);
@@ -35281,7 +35278,7 @@ const StyledInput = styled__default["default"].input`
35281
35278
  font-size: 14px;
35282
35279
  outline: none;
35283
35280
  color: ${props => props.disabled ? '#D0D0D0' : '#212121'};
35284
- background-color: #fff;
35281
+ background-color: ${props => props.disabled && props.isDarkerBackground ? '#F2F2F2' : '#fff'};
35285
35282
  border: none;
35286
35283
  cursor: ${props => props.disabled ? 'not-allowed' : 'pointer'};
35287
35284
  `;
@@ -35314,6 +35311,7 @@ const Input$2 = _ref => {
35314
35311
  onBlur,
35315
35312
  required,
35316
35313
  disabled,
35314
+ isDarkerBackground = false,
35317
35315
  width,
35318
35316
  error,
35319
35317
  errorMessage,
@@ -35400,11 +35398,13 @@ const Input$2 = _ref => {
35400
35398
  className: "MainContainer",
35401
35399
  width: width,
35402
35400
  size: size,
35403
- disabled: disabled
35401
+ disabled: disabled,
35402
+ isDarkerBackground: isDarkerBackground
35404
35403
  }, /*#__PURE__*/React__default["default"].createElement(InputContainer, {
35405
35404
  className: "InputContainer",
35406
35405
  labelColor: labelColor,
35407
35406
  disabled: disabled,
35407
+ isDarkerBackground: isDarkerBackground,
35408
35408
  error: error,
35409
35409
  isFocused: isFocused,
35410
35410
  size: size
@@ -35413,6 +35413,7 @@ const Input$2 = _ref => {
35413
35413
  ref: containerRef,
35414
35414
  labelColor: labelColor,
35415
35415
  disabled: disabled,
35416
+ isDarkerBackground: isDarkerBackground,
35416
35417
  error: error,
35417
35418
  onClick: handleLabelClick,
35418
35419
  size: size
@@ -35423,6 +35424,7 @@ const Input$2 = _ref => {
35423
35424
  hasValue: inputValue,
35424
35425
  leftIcon: leftIcon,
35425
35426
  disabled: disabled,
35427
+ isDarkerBackground: isDarkerBackground,
35426
35428
  error: error,
35427
35429
  errorMessage: errorMessage,
35428
35430
  onClick: handleLabelClick,
@@ -35442,6 +35444,7 @@ const Input$2 = _ref => {
35442
35444
  onFocus: handleFocus,
35443
35445
  onBlur: handleBlur,
35444
35446
  disabled: disabled,
35447
+ isDarkerBackground: isDarkerBackground,
35445
35448
  placeholder: isFocused ? placeHolder : '',
35446
35449
  error: error,
35447
35450
  isFocused: isFocused
@@ -41940,6 +41943,15 @@ const NewSubitemList = props => {
41940
41943
  } : v);
41941
41944
  setItemAndPackage(updatedItemAndPackage);
41942
41945
  };
41946
+ const handleAddNewPackage = () => {
41947
+ setSelectedPackage(null);
41948
+ handleSubitemDetail(null); // Pass null for new package
41949
+ };
41950
+ const handleEditExistingPackage = item => {
41951
+ setSelectedPackage(item);
41952
+ handleSubitemDetail(item); // Pass the package object for editing
41953
+ };
41954
+
41943
41955
  // useEffect(() => {
41944
41956
  // console.log("Vendor items updated:", vendorItems);
41945
41957
  // console.log("Props:", props);
@@ -41951,16 +41963,15 @@ const NewSubitemList = props => {
41951
41963
  textColor: linkColor,
41952
41964
  leftIcon: "Plus",
41953
41965
  rightIcon: "none",
41954
- onClick: handleSubitemDetail,
41966
+ onClick: handleAddNewPackage,
41955
41967
  size: "small",
41956
41968
  text: "Add Package",
41957
41969
  type: "primary"
41958
41970
  })), /*#__PURE__*/React__default["default"].createElement(List, null, vendorItems.map((item, idx) => /*#__PURE__*/React__default["default"].createElement(Item$1, {
41959
- key: idx
41971
+ key: `item-${idx}-${item.brands}`
41960
41972
  }, /*#__PURE__*/React__default["default"].createElement(PaperPlane, null), /*#__PURE__*/React__default["default"].createElement(Container, {
41961
41973
  onClick: e => {
41962
- setSelectedPackage(item);
41963
- handleSubitemDetail(item);
41974
+ handleEditExistingPackage(item);
41964
41975
  }
41965
41976
  }, item.brands && /*#__PURE__*/React__default["default"].createElement(Title$2, null, item.brands), item.component && /*#__PURE__*/React__default["default"].createElement(ComponentContainer, null, item.component[0]), /*#__PURE__*/React__default["default"].createElement(Chevron, null, /*#__PURE__*/React__default["default"].createElement(ArrowRightFullIcon, null))), /*#__PURE__*/React__default["default"].createElement(Trash, {
41966
41977
  className: "trash-icon",
@@ -50835,6 +50846,7 @@ const ItemManagerPanel = _ref => {
50835
50846
  const [screen, setScreen] = React$1.useState("initial");
50836
50847
  const [selectedVendor, setSelectedVendor] = React$1.useState(null);
50837
50848
  const [selectedPackage, setSelectedPackage] = React$1.useState(null);
50849
+ const [isEditingExisting, setIsEditingExisting] = React$1.useState(false);
50838
50850
  const handleVendorClick = vendor => {
50839
50851
  // console.log("Vendor clicked:", vendor);
50840
50852
  setSelectedVendor(vendor);
@@ -50863,6 +50875,30 @@ const ItemManagerPanel = _ref => {
50863
50875
  });
50864
50876
  setScreen("subitem");
50865
50877
  };
50878
+ const updateExistingPackage = (vendorName, originalPackage, updatedPackageName, updatedComponent) => {
50879
+ setItemAndPackage(prev => {
50880
+ return prev.map(vendor => {
50881
+ if (vendor.name !== vendorName) {
50882
+ return vendor;
50883
+ }
50884
+ return {
50885
+ ...vendor,
50886
+ packages: vendor.packages.map(pkg => {
50887
+ // Find the package to update by comparing with the original package
50888
+ if (pkg.brands === originalPackage.brands && JSON.stringify(pkg.component) === JSON.stringify(originalPackage.component)) {
50889
+ return {
50890
+ ...pkg,
50891
+ brands: updatedPackageName,
50892
+ component: updatedComponent
50893
+ };
50894
+ }
50895
+ return pkg;
50896
+ })
50897
+ };
50898
+ });
50899
+ });
50900
+ setScreen("subitem");
50901
+ };
50866
50902
  const onDeleteVendor = vendor => {
50867
50903
  const updatedItemAndPackage = itemAndPackage.filter(item => item.name !== vendor.name);
50868
50904
  setItemAndPackage([...updatedItemAndPackage, {
@@ -50898,7 +50934,19 @@ const ItemManagerPanel = _ref => {
50898
50934
  itemAndPackage: itemAndPackage,
50899
50935
  onBack: () => setScreen("initial"),
50900
50936
  onTrashClick: () => onDeleteInner(selectedVendor),
50901
- handleSubitemDetail: () => setScreen("subitemdetail")
50937
+ handleSubitemDetail: function () {
50938
+ let pkg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
50939
+ if (pkg) {
50940
+ // Editing existing package
50941
+ setSelectedPackage(pkg);
50942
+ setIsEditingExisting(true);
50943
+ } else {
50944
+ // Adding new package
50945
+ setSelectedPackage(null);
50946
+ setIsEditingExisting(false);
50947
+ }
50948
+ setScreen("subitemdetail");
50949
+ }
50902
50950
  }));
50903
50951
  }
50904
50952
  if (screen === "confirmation") {
@@ -50936,6 +50984,8 @@ const ItemManagerPanel = _ref => {
50936
50984
  vendor: selectedVendor,
50937
50985
  itemAndPackage: itemAndPackage,
50938
50986
  addNewPackage: addNewPackage,
50987
+ updateExistingPackage: updateExistingPackage,
50988
+ isEditingExisting: isEditingExisting,
50939
50989
  onBack: () => setScreen("subitem")
50940
50990
  }));
50941
50991
  }
@@ -51086,14 +51136,11 @@ const scrollableStyles = `
51086
51136
  const DropdownContainer = styled__default["default"].div`
51087
51137
  position: relative;
51088
51138
  width: ${props => props.width || '100%'};
51089
- /* min-width: 320px; */
51090
- max-width: 600px;
51139
+ max-width: 400px;
51091
51140
  font-family: "Poppins", sans-serif;
51092
51141
  `;
51093
51142
  const DropdownButton = styled__default["default"].button`
51094
51143
  width: 100%;
51095
- /* min-width: 320px; */
51096
- max-width: 600px;
51097
51144
  background: #fff;
51098
51145
  border: 1px solid #8B8989;
51099
51146
  border-radius: 12px;
@@ -51104,9 +51151,9 @@ const DropdownButton = styled__default["default"].button`
51104
51151
  align-items: center;
51105
51152
  justify-content: space-between;
51106
51153
  ${props => props.disabled && styled.css`
51107
- color:#8B8989;
51108
- /* background-color: #D0D0D0; */
51154
+ color: #D0D0D0;
51109
51155
  cursor: not-allowed;
51156
+ border: 1px solid #D0D0D0;
51110
51157
  `}
51111
51158
  `;
51112
51159
  const DropdownList = styled__default["default"].ul`
@@ -51149,7 +51196,7 @@ const DropdownItem = styled__default["default"].li`
51149
51196
  margin: 0 12px;
51150
51197
  background: ${props => props.selected ? props.selectedColor || '#066768' : 'transparent'};
51151
51198
  font-weight: ${props => props.selected ? '500' : '400'};
51152
- color: ${props => props.disabled ? '#bdbdbd' : props.selected ? '#fff' : '#212121'};
51199
+ color: ${props => props.disabled ? '#D0D0D0' : props.selected ? '#fff' : '#212121'};
51153
51200
  border-left: ${props => props.selected ? `3px solid ${props.selectedColor || '#066768'}` : 'none'};
51154
51201
  ${props => props.disabled && styled.css`
51155
51202
  cursor: not-allowed;