sag_components 2.0.0-beta112 → 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
@@ -2226,7 +2226,11 @@ const Tooltip$2 = props => {
2226
2226
  }, children, active && !hideTooltip && /*#__PURE__*/React__default["default"].createElement(TooltipTip$1, {
2227
2227
  className: `controls ${direction || 'top'}`,
2228
2228
  topFactor: topFactor
2229
- }, content)));
2229
+ }, typeof content === 'string' ? /*#__PURE__*/React__default["default"].createElement("span", {
2230
+ dangerouslySetInnerHTML: {
2231
+ __html: content
2232
+ }
2233
+ }) : content)));
2230
2234
  };
2231
2235
 
2232
2236
  /* Benchmark */
@@ -3068,7 +3072,7 @@ const LinkButton = _ref => {
3068
3072
  height = '',
3069
3073
  width = '',
3070
3074
  disabled = false,
3071
- textColor = '',
3075
+ textColor = '#229E38',
3072
3076
  onClick,
3073
3077
  leftIcon = 'none',
3074
3078
  rightIcon = 'none'
@@ -3098,7 +3102,7 @@ const LinkButton = _ref => {
3098
3102
  const getIcon = icon => {
3099
3103
  const iconHeight = size === 'small' ? '12px' : '13px';
3100
3104
  const iconWidth = size === 'small' ? '12px' : '13px';
3101
- const newTextColor = textColor || (type === 'secondary' ? '#212121' : '#229E38');
3105
+ const newTextColor = type === 'secondary' ? '#212121' : textColor;
3102
3106
  const color = disabled ? '#B1B1B1' : newTextColor;
3103
3107
  switch (icon.toLowerCase()) {
3104
3108
  case 'filter':
@@ -26105,7 +26109,7 @@ const TotalDoughnutChart = props => {
26105
26109
  key: `cell-${row.name}`,
26106
26110
  fill: row.color
26107
26111
  }))), /*#__PURE__*/React__default["default"].createElement(recharts.Tooltip, {
26108
- content: /*#__PURE__*/React__default["default"].createElement(CustomTooltip, {
26112
+ content: /*#__PURE__*/React__default["default"].createElement(CustomTooltip$1, {
26109
26113
  value: value,
26110
26114
  isPercent: isPercent
26111
26115
  })
@@ -26174,7 +26178,7 @@ TotalDoughnutChart.defaultProps = {
26174
26178
  noDataText: 'No Data',
26175
26179
  textAfterValue: ''
26176
26180
  };
26177
- function CustomTooltip(_ref) {
26181
+ function CustomTooltip$1(_ref) {
26178
26182
  let {
26179
26183
  active,
26180
26184
  payload,
@@ -26187,7 +26191,7 @@ function CustomTooltip(_ref) {
26187
26191
  return /*#__PURE__*/React__default["default"].createElement(TooltipDiv$6, null, /*#__PURE__*/React__default["default"].createElement(TooltipLabel$6, null, `${payload[0].name} ${percent}%`));
26188
26192
  }
26189
26193
  }
26190
- CustomTooltip.propTypes = {
26194
+ CustomTooltip$1.propTypes = {
26191
26195
  // eslint-disable-next-line react/forbid-prop-types
26192
26196
  active: PropTypes.any,
26193
26197
  // eslint-disable-next-line react/forbid-prop-types
@@ -26197,7 +26201,7 @@ CustomTooltip.propTypes = {
26197
26201
  // eslint-disable-next-line react/forbid-prop-types
26198
26202
  isPercent: PropTypes.any
26199
26203
  };
26200
- CustomTooltip.defaultProps = {
26204
+ CustomTooltip$1.defaultProps = {
26201
26205
  active: '',
26202
26206
  payload: '',
26203
26207
  value: '',
@@ -35200,7 +35204,7 @@ const Label$2 = styled__default["default"].label`
35200
35204
  margin-right: 10px;
35201
35205
  z-index: 2;
35202
35206
  color: ${props => props.error ? 'red' : props.disabled ? '#D0D0D0' : props.labelColor};
35203
- background-color: white;
35207
+ background-color: ${props => props.disabled && props.isDarkerBackground ? '#F2F2F2' : '#fff'};
35204
35208
  position: absolute;
35205
35209
  top: ${props => props.isFocused || props.hasValue ? '0px' : props.size === 'medium' ? '27px' : '17px'};
35206
35210
  left: ${props => props.isFocused || props.hasValue ? '23px' : props.leftIcon && props.leftIcon !== 'none' ? '42px' : '16px'};
@@ -35217,28 +35221,26 @@ const Label$2 = styled__default["default"].label`
35217
35221
  }
35218
35222
  `;
35219
35223
  const InputContainer = styled__default["default"].div`
35220
-
35221
- display: flex;
35222
- flex-direction: row;
35223
- flex-wrap: nowrap;
35224
- justify-content: flex-start;
35225
- align-content: center;
35226
- white-space: pre-wrap;
35227
- align-items: center;
35228
- overflow: hidden;
35229
- padding: 0 16px;
35230
- gap: 14px;
35231
- width: 100%;
35232
- height: 100%;
35233
- box-sizing: border-box;
35234
- background-color: #fff;
35235
- border: 1px solid ${props => props.disabled ? '#D0D0D0' : props.error ? 'red' : '#B1B1B1'};
35236
- font-family: "Poppins", sans-serif;
35237
- font-weight: 400;
35238
- font-size: 14px;
35239
- border-radius: ${props => props.size === 'small' ? '8px' : '12px'};
35240
- outline: none;
35241
- 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'};
35242
35244
 
35243
35245
  &:hover {
35244
35246
  border: 1px solid ${props => props.disabled ? '#D0D0D0' : props.error ? 'red' : props.labelColor || '#212121'};
@@ -35250,25 +35252,24 @@ const InputContainer = styled__default["default"].div`
35250
35252
 
35251
35253
  `;
35252
35254
  const InputSubContainer = styled__default["default"].div`
35253
-
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: #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'};
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'};
35272
35273
  `;
35273
35274
  const StyledInput = styled__default["default"].input`
35274
35275
  width: calc(100% - 10px);
@@ -35277,7 +35278,7 @@ const StyledInput = styled__default["default"].input`
35277
35278
  font-size: 14px;
35278
35279
  outline: none;
35279
35280
  color: ${props => props.disabled ? '#D0D0D0' : '#212121'};
35280
- background-color: #fff;
35281
+ background-color: ${props => props.disabled && props.isDarkerBackground ? '#F2F2F2' : '#fff'};
35281
35282
  border: none;
35282
35283
  cursor: ${props => props.disabled ? 'not-allowed' : 'pointer'};
35283
35284
  `;
@@ -35310,6 +35311,7 @@ const Input$2 = _ref => {
35310
35311
  onBlur,
35311
35312
  required,
35312
35313
  disabled,
35314
+ isDarkerBackground = false,
35313
35315
  width,
35314
35316
  error,
35315
35317
  errorMessage,
@@ -35396,11 +35398,13 @@ const Input$2 = _ref => {
35396
35398
  className: "MainContainer",
35397
35399
  width: width,
35398
35400
  size: size,
35399
- disabled: disabled
35401
+ disabled: disabled,
35402
+ isDarkerBackground: isDarkerBackground
35400
35403
  }, /*#__PURE__*/React__default["default"].createElement(InputContainer, {
35401
35404
  className: "InputContainer",
35402
35405
  labelColor: labelColor,
35403
35406
  disabled: disabled,
35407
+ isDarkerBackground: isDarkerBackground,
35404
35408
  error: error,
35405
35409
  isFocused: isFocused,
35406
35410
  size: size
@@ -35409,6 +35413,7 @@ const Input$2 = _ref => {
35409
35413
  ref: containerRef,
35410
35414
  labelColor: labelColor,
35411
35415
  disabled: disabled,
35416
+ isDarkerBackground: isDarkerBackground,
35412
35417
  error: error,
35413
35418
  onClick: handleLabelClick,
35414
35419
  size: size
@@ -35419,6 +35424,7 @@ const Input$2 = _ref => {
35419
35424
  hasValue: inputValue,
35420
35425
  leftIcon: leftIcon,
35421
35426
  disabled: disabled,
35427
+ isDarkerBackground: isDarkerBackground,
35422
35428
  error: error,
35423
35429
  errorMessage: errorMessage,
35424
35430
  onClick: handleLabelClick,
@@ -35438,6 +35444,7 @@ const Input$2 = _ref => {
35438
35444
  onFocus: handleFocus,
35439
35445
  onBlur: handleBlur,
35440
35446
  disabled: disabled,
35447
+ isDarkerBackground: isDarkerBackground,
35441
35448
  placeholder: isFocused ? placeHolder : '',
35442
35449
  error: error,
35443
35450
  isFocused: isFocused
@@ -41405,7 +41412,7 @@ const Card = styled__default["default"].div`
41405
41412
  border-radius: 8px;
41406
41413
  /* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); */
41407
41414
  text-align: center;
41408
- overflow: hidden;
41415
+ /* overflow: hidden; */ // If hidden the tooltip will not be visible
41409
41416
  width: ${props => props.width || "auto"};
41410
41417
  height: ${props => props.height || "auto"};
41411
41418
  margin: 0 auto;
@@ -41424,8 +41431,9 @@ const SectionTitle$1 = styled__default["default"].div`
41424
41431
  `;
41425
41432
  const SubtitleContainer = styled__default["default"].div`
41426
41433
  display: flex;
41427
- align-items: flex-start;
41428
- gap: 8px;
41434
+ align-items: center;
41435
+ gap: 6px;
41436
+ color: #8B8989;
41429
41437
  `;
41430
41438
  const Subtitle$1 = styled__default["default"].span`
41431
41439
  color: ${props => props.color};
@@ -41524,10 +41532,6 @@ const LineContainer = styled__default["default"].div`
41524
41532
  width: 100%;
41525
41533
  `;
41526
41534
  const ButtonContainer$1 = styled__default["default"].div`
41527
- display: flex;
41528
- justify-content: flex-end;
41529
- flex-direction: column;
41530
- gap: 5px;
41531
41535
  margin-top: 16px;
41532
41536
  .ButtonContainer {
41533
41537
  label {
@@ -41535,6 +41539,16 @@ const ButtonContainer$1 = styled__default["default"].div`
41535
41539
  }
41536
41540
  }
41537
41541
  `;
41542
+ const CustomTooltip = styled__default["default"](Tooltip$2)`
41543
+ .controls {
41544
+ padding: 12px 16px;
41545
+ font-size: 14px;
41546
+ left: 0;
41547
+ &::before {
41548
+ left: 90%;
41549
+ }
41550
+ }
41551
+ `;
41538
41552
  const Container$1 = styled__default["default"].div`
41539
41553
  display: flex;
41540
41554
  align-items: center;
@@ -41929,6 +41943,15 @@ const NewSubitemList = props => {
41929
41943
  } : v);
41930
41944
  setItemAndPackage(updatedItemAndPackage);
41931
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
+
41932
41955
  // useEffect(() => {
41933
41956
  // console.log("Vendor items updated:", vendorItems);
41934
41957
  // console.log("Props:", props);
@@ -41940,16 +41963,15 @@ const NewSubitemList = props => {
41940
41963
  textColor: linkColor,
41941
41964
  leftIcon: "Plus",
41942
41965
  rightIcon: "none",
41943
- onClick: handleSubitemDetail,
41966
+ onClick: handleAddNewPackage,
41944
41967
  size: "small",
41945
41968
  text: "Add Package",
41946
41969
  type: "primary"
41947
41970
  })), /*#__PURE__*/React__default["default"].createElement(List, null, vendorItems.map((item, idx) => /*#__PURE__*/React__default["default"].createElement(Item$1, {
41948
- key: idx
41971
+ key: `item-${idx}-${item.brands}`
41949
41972
  }, /*#__PURE__*/React__default["default"].createElement(PaperPlane, null), /*#__PURE__*/React__default["default"].createElement(Container, {
41950
41973
  onClick: e => {
41951
- setSelectedPackage(item);
41952
- handleSubitemDetail(item);
41974
+ handleEditExistingPackage(item);
41953
41975
  }
41954
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, {
41955
41977
  className: "trash-icon",
@@ -42086,7 +42108,7 @@ styled__default["default"].div`
42086
42108
  margin-top: 24px;
42087
42109
  margin-left: 8px;
42088
42110
  `;
42089
- const Divider$1 = styled__default["default"].div`
42111
+ const Divider = styled__default["default"].div`
42090
42112
  height: 1px;
42091
42113
  background-color: #e2e2e2;
42092
42114
  margin: 16px 0;
@@ -42159,7 +42181,7 @@ const NewSubitem = ({
42159
42181
  type: "primary",
42160
42182
  backgroundColor: linkColor,
42161
42183
  hoverTextColor: "#212121"
42162
- })), /*#__PURE__*/React__default["default"].createElement(Divider$1, null), /*#__PURE__*/React__default["default"].createElement("form", null, /*#__PURE__*/React__default["default"].createElement(NegotiatedContainer, null, /*#__PURE__*/React__default["default"].createElement(AddNegotiatedBrand, null, "Add Negotiated Brand/s ", /*#__PURE__*/React__default["default"].createElement("span", {
42184
+ })), /*#__PURE__*/React__default["default"].createElement(Divider, null), /*#__PURE__*/React__default["default"].createElement("form", null, /*#__PURE__*/React__default["default"].createElement(NegotiatedContainer, null, /*#__PURE__*/React__default["default"].createElement(AddNegotiatedBrand, null, "Add Negotiated Brand/s ", /*#__PURE__*/React__default["default"].createElement("span", {
42163
42185
  style: {
42164
42186
  color: "red"
42165
42187
  }
@@ -42193,47 +42215,34 @@ const NewSubitem = ({
42193
42215
  };
42194
42216
 
42195
42217
  const Overlay$1 = styled__default["default"].div`
42196
- display: flex;
42197
- flex-direction: column;
42218
+ font-family: Poppins;
42198
42219
  background: #f7f8fa;
42199
42220
  width: ${props => props.width || "100%"};
42200
42221
  height: ${props => props.height || "100%"};
42201
42222
  overflow: hidden;
42223
+ text-align: left;
42202
42224
  `;
42203
- const Dialog = styled__default["default"].div`
42204
- background: #fff;
42205
- border-radius: 12px;
42206
- height: 100%;
42207
- padding: 32px 24px;
42225
+ const HeaderContainer = styled__default["default"].div`
42226
+ color: #212121;
42227
+ padding: 40px 16px;
42228
+ border-bottom: 1px solid #e2e2e2;
42208
42229
  `;
42209
- const Title$1 = styled__default["default"].h2`
42210
- color: var(--Text-Primary, #212121);
42211
- font-feature-settings: "liga" off;
42212
- /* Headings/H3 Medium */
42213
- font-family: Poppins;
42230
+ const Title$1 = styled__default["default"].h5`
42214
42231
  font-size: 32px;
42215
- font-style: normal;
42216
42232
  font-weight: 700;
42217
- line-height: normal;
42233
+ margin: 0 0 20px;
42218
42234
  `;
42219
42235
  const Subtitle = styled__default["default"].p`
42220
- color: var(--Text-Primary, #212121);
42221
- font-feature-settings: "liga" off;
42222
- /* Headings/H6 Regular */
42223
- font-family: Poppins;
42224
42236
  font-size: 18px;
42225
- font-style: normal;
42226
42237
  font-weight: 400;
42227
- line-height: normal;
42238
+ margin: 0 0 20px;
42228
42239
  `;
42229
- const VendorSection = styled__default["default"].div`
42230
- margin-bottom: 20px;
42240
+ const Dialog = styled__default["default"].div`
42241
+ background: #fff;
42231
42242
  `;
42232
- const Divider = styled__default["default"].div`
42233
- height: 1px;
42234
- background-color: #e2e2e2;
42235
- margin: 16px 0;
42236
- width: 100%;
42243
+ const VendorSection = styled__default["default"].div`
42244
+ padding: 16px;
42245
+ border-bottom: 1px solid #e2e2e2;
42237
42246
  `;
42238
42247
  const Item = styled__default["default"].li`
42239
42248
  color: black; /* text color */
@@ -42254,12 +42263,8 @@ const VendorName = styled__default["default"].span`
42254
42263
  margin-right: 10px;
42255
42264
  overflow: hidden;
42256
42265
  color: #000;
42257
-
42258
- font-family: Poppins;
42259
42266
  font-size: 16px;
42260
- font-style: normal;
42261
42267
  font-weight: 500;
42262
- line-height: normal;
42263
42268
  `;
42264
42269
  const NewBadge = styled__default["default"].span`
42265
42270
  background: #ffe2b6;
@@ -42267,40 +42272,23 @@ const NewBadge = styled__default["default"].span`
42267
42272
  border-radius: 16px;
42268
42273
  padding: 2px 10px;
42269
42274
  margin-left: 4px;
42270
- color: #000;
42271
- font-feature-settings: "liga" off;
42272
- font-family: Poppins;
42273
42275
  font-size: 14px;
42274
- font-style: normal;
42275
42276
  font-weight: 500;
42276
- line-height: normal;
42277
42277
  `;
42278
42278
  const PackageList = styled__default["default"].ul`
42279
42279
  margin: 0 0 0 16px;
42280
42280
  padding: 0;
42281
42281
  gap: 30px;
42282
42282
  list-style: disc;
42283
- color: #888;
42284
- color: var(--General-Black, #212121);
42285
- font-feature-settings: "liga" off;
42286
- font-family: Poppins;
42287
42283
  font-size: 14px;
42288
- font-style: normal;
42289
42284
  font-weight: 400;
42290
- line-height: normal;
42291
42285
  `;
42292
42286
  const ButtonRow = styled__default["default"].div`
42293
42287
  display: flex;
42294
- justify-content: flex-start;
42295
42288
  gap: 12px;
42296
- flex-direction: row;
42289
+ justify-content: flex-start;
42297
42290
  align-items: center;
42298
42291
  `;
42299
- const HeaderContainer = styled__default["default"].div`
42300
- display: flex;
42301
- flex-direction: column;
42302
- padding: 16px;
42303
- `;
42304
42292
 
42305
42293
  const ConfirmationDialog = ({
42306
42294
  width,
@@ -42311,39 +42299,43 @@ const ConfirmationDialog = ({
42311
42299
  linkColor
42312
42300
  }) => {
42313
42301
  const totalNew = vendors.reduce((sum, v) => sum + (v.newPackages?.length || 0), 0);
42302
+ const confirmationText = `You are about to send the following
42303
+ ${totalNew} new ${totalNew === 1 ? 'package' : 'packages'} to
42304
+ ${vendors.length} ${vendors.length === 1 ? 'vendor' : 'vendors'}:`;
42314
42305
  return /*#__PURE__*/React__default["default"].createElement(Overlay$1, {
42315
42306
  width: width,
42316
42307
  height: height
42317
- }, /*#__PURE__*/React__default["default"].createElement(HeaderContainer, null, /*#__PURE__*/React__default["default"].createElement(Title$1, null, "Confirmation"), /*#__PURE__*/React__default["default"].createElement(Subtitle, null, "You are about to send the following ", totalNew, " new packages to these ", vendors.length, " vendors:"), /*#__PURE__*/React__default["default"].createElement(ButtonRow, null, /*#__PURE__*/React__default["default"].createElement(Button$1, {
42308
+ }, /*#__PURE__*/React__default["default"].createElement(HeaderContainer, null, /*#__PURE__*/React__default["default"].createElement(Title$1, null, "Confirmation"), /*#__PURE__*/React__default["default"].createElement(Subtitle, null, confirmationText), /*#__PURE__*/React__default["default"].createElement(ButtonRow, null, /*#__PURE__*/React__default["default"].createElement(Button$1, {
42318
42309
  leftIcon: "none",
42319
42310
  onClick: onCancel,
42320
42311
  rightIcon: "none",
42321
- size: "small",
42312
+ size: "",
42322
42313
  text: "Cancel",
42323
42314
  type: "secondary"
42324
42315
  }), /*#__PURE__*/React__default["default"].createElement(Button$1, {
42325
42316
  leftIcon: "none",
42326
42317
  onClick: onConfirm,
42327
42318
  rightIcon: "none",
42328
- size: "small",
42319
+ size: "",
42329
42320
  text: "Confirm & Send",
42330
42321
  type: "primary",
42322
+ borderColor: linkColor,
42331
42323
  backgroundColor: linkColor,
42332
42324
  hoverTextColor: "#212121"
42333
42325
  }))), /*#__PURE__*/React__default["default"].createElement(Dialog, null, vendors.map((vendor, idx) => /*#__PURE__*/React__default["default"].createElement(VendorSection, {
42334
42326
  key: vendor.name
42335
42327
  }, /*#__PURE__*/React__default["default"].createElement(VendorHeader, null, /*#__PURE__*/React__default["default"].createElement(VendorName, null, vendor.name), /*#__PURE__*/React__default["default"].createElement(NewBadge, null, vendor.newPackages.length, " New")), /*#__PURE__*/React__default["default"].createElement(PackageList, null, vendor.newPackages.map((pkg, i) => /*#__PURE__*/React__default["default"].createElement(Item, {
42336
42328
  key: i
42337
- }, pkg))), /*#__PURE__*/React__default["default"].createElement(Divider, null)))));
42329
+ }, pkg)))))));
42338
42330
  };
42339
42331
 
42340
42332
  const SuccessScreenContainer = styled__default["default"].div`
42341
- display: flex;
42342
- flex-direction: column;
42333
+ font-family: Poppins;
42343
42334
  background:rgb(255, 255, 255);
42344
42335
  width: ${props => props.width || "100%"};
42345
42336
  height: ${props => props.height || "100%"};
42346
42337
  overflow: hidden;
42338
+ text-align: left;
42347
42339
  `;
42348
42340
  const SuccessHeader = styled__default["default"].div`
42349
42341
  display: flex;
@@ -42351,29 +42343,19 @@ const SuccessHeader = styled__default["default"].div`
42351
42343
  align-items: center;
42352
42344
  justify-content: center;
42353
42345
  `;
42354
- const SuccessTitle = styled__default["default"].h2`
42355
- color: var(--Text-Primary, #212121);
42356
- text-align: center;
42357
- font-feature-settings: 'liga' off;
42358
-
42359
- /* Headings/H3 Medium */
42360
- font-family: Poppins;
42361
- font-size: 32px;
42362
- font-style: normal;
42363
- font-weight: 700;
42364
- line-height: normal;
42346
+ const SuccessTitle = styled__default["default"].h5`
42347
+ color: #212121;
42348
+ text-align: center;
42349
+ font-size: 32px;
42350
+ font-weight: 700;
42351
+ margin: 0 0 20px;
42365
42352
  `;
42366
42353
  const SuccessSubtitle = styled__default["default"].p`
42367
42354
  margin-bottom: 24px;
42368
42355
  text-align: center;
42369
- color: var(--Text-Primary, #212121);
42370
- font-feature-settings: 'liga' off;
42371
- /* Content/P1 Regular */
42372
- font-family: Poppins;
42356
+ color: #212121;
42373
42357
  font-size: 16px;
42374
- font-style: normal;
42375
42358
  font-weight: 400;
42376
- line-height: normal;
42377
42359
  `;
42378
42360
  styled__default["default"].div`
42379
42361
  display: flex;
@@ -50847,8 +50829,6 @@ const SuccessScreen = ({
50847
50829
  }, vendor, /*#__PURE__*/React__default["default"].createElement("br", null)))))));
50848
50830
  };
50849
50831
 
50850
- // Removed TypeScript interface and type annotations
50851
-
50852
50832
  const ItemManagerPanel = _ref => {
50853
50833
  let {
50854
50834
  width = "100%",
@@ -50861,11 +50841,12 @@ const ItemManagerPanel = _ref => {
50861
50841
  setItemAndPackage,
50862
50842
  linkColor = "#212121",
50863
50843
  backgroundColor = 'white',
50864
- onDelete = () => {}
50844
+ buttonTooltipText = "Please fill out all forms before sending."
50865
50845
  } = _ref;
50866
50846
  const [screen, setScreen] = React$1.useState("initial");
50867
50847
  const [selectedVendor, setSelectedVendor] = React$1.useState(null);
50868
50848
  const [selectedPackage, setSelectedPackage] = React$1.useState(null);
50849
+ const [isEditingExisting, setIsEditingExisting] = React$1.useState(false);
50869
50850
  const handleVendorClick = vendor => {
50870
50851
  // console.log("Vendor clicked:", vendor);
50871
50852
  setSelectedVendor(vendor);
@@ -50894,8 +50875,29 @@ const ItemManagerPanel = _ref => {
50894
50875
  });
50895
50876
  setScreen("subitem");
50896
50877
  };
50897
- const handleBackToDefault = () => {
50898
- setScreen("");
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");
50899
50901
  };
50900
50902
  const onDeleteVendor = vendor => {
50901
50903
  const updatedItemAndPackage = itemAndPackage.filter(item => item.name !== vendor.name);
@@ -50904,6 +50906,21 @@ const ItemManagerPanel = _ref => {
50904
50906
  packages: null
50905
50907
  }]);
50906
50908
  };
50909
+ const hasUnisentPackages = React$1.useMemo(() => {
50910
+ return itemAndPackage.some(vendor => {
50911
+ if (vendor.packages === null || !Array.isArray(vendor.packages)) {
50912
+ return false;
50913
+ }
50914
+ return vendor.packages.some(pkg => !pkg.hasOwnProperty('status') || pkg.status == null || pkg.status === undefined || pkg.status === '');
50915
+ });
50916
+ }, [itemAndPackage]);
50917
+ const actuallyAllFormsSent = AllFormsSent && !hasUnisentPackages;
50918
+ React$1.useEffect(() => {
50919
+ if (screen === "success" && onSendForms) {
50920
+ onSendForms();
50921
+ }
50922
+ }, [screen]); // Only run when screen changes
50923
+
50907
50924
  if (screen === "subitem") {
50908
50925
  return /*#__PURE__*/React__default["default"].createElement(Card, {
50909
50926
  width: width,
@@ -50917,15 +50934,28 @@ const ItemManagerPanel = _ref => {
50917
50934
  itemAndPackage: itemAndPackage,
50918
50935
  onBack: () => setScreen("initial"),
50919
50936
  onTrashClick: () => onDeleteInner(selectedVendor),
50920
- 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
+ }
50921
50950
  }));
50922
50951
  }
50923
50952
  if (screen === "confirmation") {
50924
50953
  return /*#__PURE__*/React__default["default"].createElement(ConfirmationDialog, {
50925
50954
  width: width,
50926
50955
  height: height,
50927
- onCancel: () => setScreen(undefined),
50956
+ onCancel: () => setScreen("initial"),
50928
50957
  onConfirm: () => setScreen("success"),
50958
+ linkColor: linkColor,
50929
50959
  vendors: itemAndPackage.filter(item => item.packages !== null).map(item => {
50930
50960
  return {
50931
50961
  name: item.name,
@@ -50935,9 +50965,6 @@ const ItemManagerPanel = _ref => {
50935
50965
  });
50936
50966
  }
50937
50967
  if (screen === "success") {
50938
- if (onSendForms) {
50939
- onSendForms();
50940
- }
50941
50968
  return /*#__PURE__*/React__default["default"].createElement(SuccessScreen, {
50942
50969
  width: width,
50943
50970
  height: height,
@@ -50957,6 +50984,8 @@ const ItemManagerPanel = _ref => {
50957
50984
  vendor: selectedVendor,
50958
50985
  itemAndPackage: itemAndPackage,
50959
50986
  addNewPackage: addNewPackage,
50987
+ updateExistingPackage: updateExistingPackage,
50988
+ isEditingExisting: isEditingExisting,
50960
50989
  onBack: () => setScreen("subitem")
50961
50990
  }));
50962
50991
  }
@@ -50966,7 +50995,7 @@ const ItemManagerPanel = _ref => {
50966
50995
  height: height,
50967
50996
  backgroundColor: backgroundColor
50968
50997
  }, /*#__PURE__*/React__default["default"].createElement(NewItemList, {
50969
- onBack: handleBackToDefault,
50998
+ onBack: () => setScreen("initial"),
50970
50999
  itemAndPackage: itemAndPackage,
50971
51000
  onVendorClick: handleVendorClick
50972
51001
  }));
@@ -50976,7 +51005,12 @@ const ItemManagerPanel = _ref => {
50976
51005
  width: width,
50977
51006
  height: height,
50978
51007
  backgroundColor: backgroundColor
50979
- }, /*#__PURE__*/React__default["default"].createElement(Container$1, null, /*#__PURE__*/React__default["default"].createElement(TitleContainer, null, /*#__PURE__*/React__default["default"].createElement(SectionTitle$1, null, "Vendors"), /*#__PURE__*/React__default["default"].createElement(SubtitleContainer, null, /*#__PURE__*/React__default["default"].createElement(Subtitle$1, null, itemAndPackage.filter(item => item.packages !== null).length.toString(), " ", "Vendors", " "), /*#__PURE__*/React__default["default"].createElement("span", null, "\xB7"), /*#__PURE__*/React__default["default"].createElement(Subtitle$1, null, itemAndPackage.filter(item => item.packages !== null).reduce((acc, item) => acc + (item.packages ? item.packages.length : 0), 0), " ", "Packages"))), editMode && /*#__PURE__*/React__default["default"].createElement(ButtonContainer$1, null, /*#__PURE__*/React__default["default"].createElement(Button$1, {
51008
+ }, /*#__PURE__*/React__default["default"].createElement(Container$1, null, /*#__PURE__*/React__default["default"].createElement(TitleContainer, null, /*#__PURE__*/React__default["default"].createElement(SectionTitle$1, null, "Vendors"), /*#__PURE__*/React__default["default"].createElement(SubtitleContainer, null, /*#__PURE__*/React__default["default"].createElement(Subtitle$1, null, itemAndPackage.filter(item => item.packages !== null).length.toString(), " ", "Vendors", " "), /*#__PURE__*/React__default["default"].createElement("span", null, "\xB7"), /*#__PURE__*/React__default["default"].createElement(Subtitle$1, null, itemAndPackage.filter(item => item.packages !== null).reduce((acc, item) => acc + (item.packages ? item.packages.length : 0), 0), " ", "Packages"))), editMode && /*#__PURE__*/React__default["default"].createElement(ButtonContainer$1, null, /*#__PURE__*/React__default["default"].createElement(CustomTooltip, {
51009
+ hideTooltip: !disabledSendForms,
51010
+ content: buttonTooltipText,
51011
+ topFactor: 2,
51012
+ direction: "bottom"
51013
+ }, /*#__PURE__*/React__default["default"].createElement(Button$1, {
50980
51014
  leftIcon: "Fly",
50981
51015
  onClick: () => setScreen("confirmation"),
50982
51016
  rightIcon: "none",
@@ -50984,10 +51018,12 @@ const ItemManagerPanel = _ref => {
50984
51018
  size: "small",
50985
51019
  text: "Send Forms",
50986
51020
  type: "secondary",
50987
- borderRadius: "8px"
50988
- }), /*#__PURE__*/React__default["default"].createElement(Subtitle$1, {
50989
- color: AllFormsSent ? "#90CE9C" : "#8b8989"
50990
- }, AllFormsSent ? '✔ All Forms Sent' : `${itemAndPackage.filter(item => item.packages !== null).length.toString()} Vendors `))), /*#__PURE__*/React__default["default"].createElement(AddButtonContainer$1, null, /*#__PURE__*/React__default["default"].createElement(LinkButton, {
51021
+ borderRadius: "8px",
51022
+ borderColor: linkColor,
51023
+ textColor: linkColor
51024
+ })), /*#__PURE__*/React__default["default"].createElement(Subtitle$1, {
51025
+ color: actuallyAllFormsSent ? "#90CE9C" : "#8b8989"
51026
+ }, actuallyAllFormsSent ? '✔ All Forms Sent' : itemAndPackage.filter(item => item.packages !== null).length > 0 ? `${itemAndPackage.filter(item => item.packages !== null).length.toString()} New Forms` : ''))), /*#__PURE__*/React__default["default"].createElement(AddButtonContainer$1, null, /*#__PURE__*/React__default["default"].createElement(LinkButton, {
50991
51027
  leftIcon: "Plus",
50992
51028
  onClick: () => setScreen("list"),
50993
51029
  rightIcon: "none",
@@ -51100,14 +51136,11 @@ const scrollableStyles = `
51100
51136
  const DropdownContainer = styled__default["default"].div`
51101
51137
  position: relative;
51102
51138
  width: ${props => props.width || '100%'};
51103
- /* min-width: 320px; */
51104
- max-width: 600px;
51139
+ max-width: 400px;
51105
51140
  font-family: "Poppins", sans-serif;
51106
51141
  `;
51107
51142
  const DropdownButton = styled__default["default"].button`
51108
51143
  width: 100%;
51109
- /* min-width: 320px; */
51110
- max-width: 600px;
51111
51144
  background: #fff;
51112
51145
  border: 1px solid #8B8989;
51113
51146
  border-radius: 12px;
@@ -51118,9 +51151,9 @@ const DropdownButton = styled__default["default"].button`
51118
51151
  align-items: center;
51119
51152
  justify-content: space-between;
51120
51153
  ${props => props.disabled && styled.css`
51121
- color:#8B8989;
51122
- background-color: #D0D0D0;
51154
+ color: #D0D0D0;
51123
51155
  cursor: not-allowed;
51156
+ border: 1px solid #D0D0D0;
51124
51157
  `}
51125
51158
  `;
51126
51159
  const DropdownList = styled__default["default"].ul`
@@ -51163,7 +51196,7 @@ const DropdownItem = styled__default["default"].li`
51163
51196
  margin: 0 12px;
51164
51197
  background: ${props => props.selected ? props.selectedColor || '#066768' : 'transparent'};
51165
51198
  font-weight: ${props => props.selected ? '500' : '400'};
51166
- color: ${props => props.disabled ? '#bdbdbd' : props.selected ? '#fff' : '#212121'};
51199
+ color: ${props => props.disabled ? '#D0D0D0' : props.selected ? '#fff' : '#212121'};
51167
51200
  border-left: ${props => props.selected ? `3px solid ${props.selectedColor || '#066768'}` : 'none'};
51168
51201
  ${props => props.disabled && styled.css`
51169
51202
  cursor: not-allowed;