sag_components 2.0.0-beta113 → 2.0.0-beta115

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