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