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.esm.js CHANGED
@@ -2216,7 +2216,11 @@ const Tooltip$2 = props => {
2216
2216
  }, children, active && !hideTooltip && /*#__PURE__*/React$1.createElement(TooltipTip$1, {
2217
2217
  className: `controls ${direction || 'top'}`,
2218
2218
  topFactor: topFactor
2219
- }, content)));
2219
+ }, typeof content === 'string' ? /*#__PURE__*/React$1.createElement("span", {
2220
+ dangerouslySetInnerHTML: {
2221
+ __html: content
2222
+ }
2223
+ }) : content)));
2220
2224
  };
2221
2225
 
2222
2226
  /* Benchmark */
@@ -3058,7 +3062,7 @@ const LinkButton = _ref => {
3058
3062
  height = '',
3059
3063
  width = '',
3060
3064
  disabled = false,
3061
- textColor = '',
3065
+ textColor = '#229E38',
3062
3066
  onClick,
3063
3067
  leftIcon = 'none',
3064
3068
  rightIcon = 'none'
@@ -3088,7 +3092,7 @@ const LinkButton = _ref => {
3088
3092
  const getIcon = icon => {
3089
3093
  const iconHeight = size === 'small' ? '12px' : '13px';
3090
3094
  const iconWidth = size === 'small' ? '12px' : '13px';
3091
- const newTextColor = textColor || (type === 'secondary' ? '#212121' : '#229E38');
3095
+ const newTextColor = type === 'secondary' ? '#212121' : textColor;
3092
3096
  const color = disabled ? '#B1B1B1' : newTextColor;
3093
3097
  switch (icon.toLowerCase()) {
3094
3098
  case 'filter':
@@ -26095,7 +26099,7 @@ const TotalDoughnutChart = props => {
26095
26099
  key: `cell-${row.name}`,
26096
26100
  fill: row.color
26097
26101
  }))), /*#__PURE__*/React$1.createElement(Tooltip$3, {
26098
- content: /*#__PURE__*/React$1.createElement(CustomTooltip, {
26102
+ content: /*#__PURE__*/React$1.createElement(CustomTooltip$1, {
26099
26103
  value: value,
26100
26104
  isPercent: isPercent
26101
26105
  })
@@ -26164,7 +26168,7 @@ TotalDoughnutChart.defaultProps = {
26164
26168
  noDataText: 'No Data',
26165
26169
  textAfterValue: ''
26166
26170
  };
26167
- function CustomTooltip(_ref) {
26171
+ function CustomTooltip$1(_ref) {
26168
26172
  let {
26169
26173
  active,
26170
26174
  payload,
@@ -26177,7 +26181,7 @@ function CustomTooltip(_ref) {
26177
26181
  return /*#__PURE__*/React$1.createElement(TooltipDiv$6, null, /*#__PURE__*/React$1.createElement(TooltipLabel$6, null, `${payload[0].name} ${percent}%`));
26178
26182
  }
26179
26183
  }
26180
- CustomTooltip.propTypes = {
26184
+ CustomTooltip$1.propTypes = {
26181
26185
  // eslint-disable-next-line react/forbid-prop-types
26182
26186
  active: PropTypes.any,
26183
26187
  // eslint-disable-next-line react/forbid-prop-types
@@ -26187,7 +26191,7 @@ CustomTooltip.propTypes = {
26187
26191
  // eslint-disable-next-line react/forbid-prop-types
26188
26192
  isPercent: PropTypes.any
26189
26193
  };
26190
- CustomTooltip.defaultProps = {
26194
+ CustomTooltip$1.defaultProps = {
26191
26195
  active: '',
26192
26196
  payload: '',
26193
26197
  value: '',
@@ -35190,7 +35194,7 @@ const Label$2 = styled.label`
35190
35194
  margin-right: 10px;
35191
35195
  z-index: 2;
35192
35196
  color: ${props => props.error ? 'red' : props.disabled ? '#D0D0D0' : props.labelColor};
35193
- background-color: white;
35197
+ background-color: ${props => props.disabled && props.isDarkerBackground ? '#F2F2F2' : '#fff'};
35194
35198
  position: absolute;
35195
35199
  top: ${props => props.isFocused || props.hasValue ? '0px' : props.size === 'medium' ? '27px' : '17px'};
35196
35200
  left: ${props => props.isFocused || props.hasValue ? '23px' : props.leftIcon && props.leftIcon !== 'none' ? '42px' : '16px'};
@@ -35207,28 +35211,26 @@ const Label$2 = styled.label`
35207
35211
  }
35208
35212
  `;
35209
35213
  const InputContainer = styled.div`
35210
-
35211
- display: flex;
35212
- flex-direction: row;
35213
- flex-wrap: nowrap;
35214
- justify-content: flex-start;
35215
- align-content: center;
35216
- white-space: pre-wrap;
35217
- align-items: center;
35218
- overflow: hidden;
35219
- padding: 0 16px;
35220
- gap: 14px;
35221
- width: 100%;
35222
- height: 100%;
35223
- box-sizing: border-box;
35224
- background-color: #fff;
35225
- border: 1px solid ${props => props.disabled ? '#D0D0D0' : props.error ? 'red' : '#B1B1B1'};
35226
- font-family: "Poppins", sans-serif;
35227
- font-weight: 400;
35228
- font-size: 14px;
35229
- border-radius: ${props => props.size === 'small' ? '8px' : '12px'};
35230
- outline: none;
35231
- 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'};
35232
35234
 
35233
35235
  &:hover {
35234
35236
  border: 1px solid ${props => props.disabled ? '#D0D0D0' : props.error ? 'red' : props.labelColor || '#212121'};
@@ -35240,25 +35242,24 @@ const InputContainer = styled.div`
35240
35242
 
35241
35243
  `;
35242
35244
  const InputSubContainer = styled.div`
35243
-
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: #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'};
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'};
35262
35263
  `;
35263
35264
  const StyledInput = styled.input`
35264
35265
  width: calc(100% - 10px);
@@ -35267,7 +35268,7 @@ const StyledInput = styled.input`
35267
35268
  font-size: 14px;
35268
35269
  outline: none;
35269
35270
  color: ${props => props.disabled ? '#D0D0D0' : '#212121'};
35270
- background-color: #fff;
35271
+ background-color: ${props => props.disabled && props.isDarkerBackground ? '#F2F2F2' : '#fff'};
35271
35272
  border: none;
35272
35273
  cursor: ${props => props.disabled ? 'not-allowed' : 'pointer'};
35273
35274
  `;
@@ -35300,6 +35301,7 @@ const Input$2 = _ref => {
35300
35301
  onBlur,
35301
35302
  required,
35302
35303
  disabled,
35304
+ isDarkerBackground = false,
35303
35305
  width,
35304
35306
  error,
35305
35307
  errorMessage,
@@ -35386,11 +35388,13 @@ const Input$2 = _ref => {
35386
35388
  className: "MainContainer",
35387
35389
  width: width,
35388
35390
  size: size,
35389
- disabled: disabled
35391
+ disabled: disabled,
35392
+ isDarkerBackground: isDarkerBackground
35390
35393
  }, /*#__PURE__*/React$1.createElement(InputContainer, {
35391
35394
  className: "InputContainer",
35392
35395
  labelColor: labelColor,
35393
35396
  disabled: disabled,
35397
+ isDarkerBackground: isDarkerBackground,
35394
35398
  error: error,
35395
35399
  isFocused: isFocused,
35396
35400
  size: size
@@ -35399,6 +35403,7 @@ const Input$2 = _ref => {
35399
35403
  ref: containerRef,
35400
35404
  labelColor: labelColor,
35401
35405
  disabled: disabled,
35406
+ isDarkerBackground: isDarkerBackground,
35402
35407
  error: error,
35403
35408
  onClick: handleLabelClick,
35404
35409
  size: size
@@ -35409,6 +35414,7 @@ const Input$2 = _ref => {
35409
35414
  hasValue: inputValue,
35410
35415
  leftIcon: leftIcon,
35411
35416
  disabled: disabled,
35417
+ isDarkerBackground: isDarkerBackground,
35412
35418
  error: error,
35413
35419
  errorMessage: errorMessage,
35414
35420
  onClick: handleLabelClick,
@@ -35428,6 +35434,7 @@ const Input$2 = _ref => {
35428
35434
  onFocus: handleFocus,
35429
35435
  onBlur: handleBlur,
35430
35436
  disabled: disabled,
35437
+ isDarkerBackground: isDarkerBackground,
35431
35438
  placeholder: isFocused ? placeHolder : '',
35432
35439
  error: error,
35433
35440
  isFocused: isFocused
@@ -41395,7 +41402,7 @@ const Card = styled.div`
41395
41402
  border-radius: 8px;
41396
41403
  /* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); */
41397
41404
  text-align: center;
41398
- overflow: hidden;
41405
+ /* overflow: hidden; */ // If hidden the tooltip will not be visible
41399
41406
  width: ${props => props.width || "auto"};
41400
41407
  height: ${props => props.height || "auto"};
41401
41408
  margin: 0 auto;
@@ -41414,8 +41421,9 @@ const SectionTitle$1 = styled.div`
41414
41421
  `;
41415
41422
  const SubtitleContainer = styled.div`
41416
41423
  display: flex;
41417
- align-items: flex-start;
41418
- gap: 8px;
41424
+ align-items: center;
41425
+ gap: 6px;
41426
+ color: #8B8989;
41419
41427
  `;
41420
41428
  const Subtitle$1 = styled.span`
41421
41429
  color: ${props => props.color};
@@ -41514,10 +41522,6 @@ const LineContainer = styled.div`
41514
41522
  width: 100%;
41515
41523
  `;
41516
41524
  const ButtonContainer$1 = styled.div`
41517
- display: flex;
41518
- justify-content: flex-end;
41519
- flex-direction: column;
41520
- gap: 5px;
41521
41525
  margin-top: 16px;
41522
41526
  .ButtonContainer {
41523
41527
  label {
@@ -41525,6 +41529,16 @@ const ButtonContainer$1 = styled.div`
41525
41529
  }
41526
41530
  }
41527
41531
  `;
41532
+ const CustomTooltip = styled(Tooltip$2)`
41533
+ .controls {
41534
+ padding: 12px 16px;
41535
+ font-size: 14px;
41536
+ left: 0;
41537
+ &::before {
41538
+ left: 90%;
41539
+ }
41540
+ }
41541
+ `;
41528
41542
  const Container$1 = styled.div`
41529
41543
  display: flex;
41530
41544
  align-items: center;
@@ -41919,6 +41933,15 @@ const NewSubitemList = props => {
41919
41933
  } : v);
41920
41934
  setItemAndPackage(updatedItemAndPackage);
41921
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
+
41922
41945
  // useEffect(() => {
41923
41946
  // console.log("Vendor items updated:", vendorItems);
41924
41947
  // console.log("Props:", props);
@@ -41930,16 +41953,15 @@ const NewSubitemList = props => {
41930
41953
  textColor: linkColor,
41931
41954
  leftIcon: "Plus",
41932
41955
  rightIcon: "none",
41933
- onClick: handleSubitemDetail,
41956
+ onClick: handleAddNewPackage,
41934
41957
  size: "small",
41935
41958
  text: "Add Package",
41936
41959
  type: "primary"
41937
41960
  })), /*#__PURE__*/React$1.createElement(List, null, vendorItems.map((item, idx) => /*#__PURE__*/React$1.createElement(Item$1, {
41938
- key: idx
41961
+ key: `item-${idx}-${item.brands}`
41939
41962
  }, /*#__PURE__*/React$1.createElement(PaperPlane, null), /*#__PURE__*/React$1.createElement(Container, {
41940
41963
  onClick: e => {
41941
- setSelectedPackage(item);
41942
- handleSubitemDetail(item);
41964
+ handleEditExistingPackage(item);
41943
41965
  }
41944
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, {
41945
41967
  className: "trash-icon",
@@ -42076,7 +42098,7 @@ styled.div`
42076
42098
  margin-top: 24px;
42077
42099
  margin-left: 8px;
42078
42100
  `;
42079
- const Divider$1 = styled.div`
42101
+ const Divider = styled.div`
42080
42102
  height: 1px;
42081
42103
  background-color: #e2e2e2;
42082
42104
  margin: 16px 0;
@@ -42149,7 +42171,7 @@ const NewSubitem = ({
42149
42171
  type: "primary",
42150
42172
  backgroundColor: linkColor,
42151
42173
  hoverTextColor: "#212121"
42152
- })), /*#__PURE__*/React$1.createElement(Divider$1, null), /*#__PURE__*/React$1.createElement("form", null, /*#__PURE__*/React$1.createElement(NegotiatedContainer, null, /*#__PURE__*/React$1.createElement(AddNegotiatedBrand, null, "Add Negotiated Brand/s ", /*#__PURE__*/React$1.createElement("span", {
42174
+ })), /*#__PURE__*/React$1.createElement(Divider, null), /*#__PURE__*/React$1.createElement("form", null, /*#__PURE__*/React$1.createElement(NegotiatedContainer, null, /*#__PURE__*/React$1.createElement(AddNegotiatedBrand, null, "Add Negotiated Brand/s ", /*#__PURE__*/React$1.createElement("span", {
42153
42175
  style: {
42154
42176
  color: "red"
42155
42177
  }
@@ -42183,47 +42205,34 @@ const NewSubitem = ({
42183
42205
  };
42184
42206
 
42185
42207
  const Overlay$1 = styled.div`
42186
- display: flex;
42187
- flex-direction: column;
42208
+ font-family: Poppins;
42188
42209
  background: #f7f8fa;
42189
42210
  width: ${props => props.width || "100%"};
42190
42211
  height: ${props => props.height || "100%"};
42191
42212
  overflow: hidden;
42213
+ text-align: left;
42192
42214
  `;
42193
- const Dialog = styled.div`
42194
- background: #fff;
42195
- border-radius: 12px;
42196
- height: 100%;
42197
- padding: 32px 24px;
42215
+ const HeaderContainer = styled.div`
42216
+ color: #212121;
42217
+ padding: 40px 16px;
42218
+ border-bottom: 1px solid #e2e2e2;
42198
42219
  `;
42199
- const Title$1 = styled.h2`
42200
- color: var(--Text-Primary, #212121);
42201
- font-feature-settings: "liga" off;
42202
- /* Headings/H3 Medium */
42203
- font-family: Poppins;
42220
+ const Title$1 = styled.h5`
42204
42221
  font-size: 32px;
42205
- font-style: normal;
42206
42222
  font-weight: 700;
42207
- line-height: normal;
42223
+ margin: 0 0 20px;
42208
42224
  `;
42209
42225
  const Subtitle = styled.p`
42210
- color: var(--Text-Primary, #212121);
42211
- font-feature-settings: "liga" off;
42212
- /* Headings/H6 Regular */
42213
- font-family: Poppins;
42214
42226
  font-size: 18px;
42215
- font-style: normal;
42216
42227
  font-weight: 400;
42217
- line-height: normal;
42228
+ margin: 0 0 20px;
42218
42229
  `;
42219
- const VendorSection = styled.div`
42220
- margin-bottom: 20px;
42230
+ const Dialog = styled.div`
42231
+ background: #fff;
42221
42232
  `;
42222
- const Divider = styled.div`
42223
- height: 1px;
42224
- background-color: #e2e2e2;
42225
- margin: 16px 0;
42226
- width: 100%;
42233
+ const VendorSection = styled.div`
42234
+ padding: 16px;
42235
+ border-bottom: 1px solid #e2e2e2;
42227
42236
  `;
42228
42237
  const Item = styled.li`
42229
42238
  color: black; /* text color */
@@ -42244,12 +42253,8 @@ const VendorName = styled.span`
42244
42253
  margin-right: 10px;
42245
42254
  overflow: hidden;
42246
42255
  color: #000;
42247
-
42248
- font-family: Poppins;
42249
42256
  font-size: 16px;
42250
- font-style: normal;
42251
42257
  font-weight: 500;
42252
- line-height: normal;
42253
42258
  `;
42254
42259
  const NewBadge = styled.span`
42255
42260
  background: #ffe2b6;
@@ -42257,40 +42262,23 @@ const NewBadge = styled.span`
42257
42262
  border-radius: 16px;
42258
42263
  padding: 2px 10px;
42259
42264
  margin-left: 4px;
42260
- color: #000;
42261
- font-feature-settings: "liga" off;
42262
- font-family: Poppins;
42263
42265
  font-size: 14px;
42264
- font-style: normal;
42265
42266
  font-weight: 500;
42266
- line-height: normal;
42267
42267
  `;
42268
42268
  const PackageList = styled.ul`
42269
42269
  margin: 0 0 0 16px;
42270
42270
  padding: 0;
42271
42271
  gap: 30px;
42272
42272
  list-style: disc;
42273
- color: #888;
42274
- color: var(--General-Black, #212121);
42275
- font-feature-settings: "liga" off;
42276
- font-family: Poppins;
42277
42273
  font-size: 14px;
42278
- font-style: normal;
42279
42274
  font-weight: 400;
42280
- line-height: normal;
42281
42275
  `;
42282
42276
  const ButtonRow = styled.div`
42283
42277
  display: flex;
42284
- justify-content: flex-start;
42285
42278
  gap: 12px;
42286
- flex-direction: row;
42279
+ justify-content: flex-start;
42287
42280
  align-items: center;
42288
42281
  `;
42289
- const HeaderContainer = styled.div`
42290
- display: flex;
42291
- flex-direction: column;
42292
- padding: 16px;
42293
- `;
42294
42282
 
42295
42283
  const ConfirmationDialog = ({
42296
42284
  width,
@@ -42301,39 +42289,43 @@ const ConfirmationDialog = ({
42301
42289
  linkColor
42302
42290
  }) => {
42303
42291
  const totalNew = vendors.reduce((sum, v) => sum + (v.newPackages?.length || 0), 0);
42292
+ const confirmationText = `You are about to send the following
42293
+ ${totalNew} new ${totalNew === 1 ? 'package' : 'packages'} to
42294
+ ${vendors.length} ${vendors.length === 1 ? 'vendor' : 'vendors'}:`;
42304
42295
  return /*#__PURE__*/React$1.createElement(Overlay$1, {
42305
42296
  width: width,
42306
42297
  height: height
42307
- }, /*#__PURE__*/React$1.createElement(HeaderContainer, null, /*#__PURE__*/React$1.createElement(Title$1, null, "Confirmation"), /*#__PURE__*/React$1.createElement(Subtitle, null, "You are about to send the following ", totalNew, " new packages to these ", vendors.length, " vendors:"), /*#__PURE__*/React$1.createElement(ButtonRow, null, /*#__PURE__*/React$1.createElement(Button$1, {
42298
+ }, /*#__PURE__*/React$1.createElement(HeaderContainer, null, /*#__PURE__*/React$1.createElement(Title$1, null, "Confirmation"), /*#__PURE__*/React$1.createElement(Subtitle, null, confirmationText), /*#__PURE__*/React$1.createElement(ButtonRow, null, /*#__PURE__*/React$1.createElement(Button$1, {
42308
42299
  leftIcon: "none",
42309
42300
  onClick: onCancel,
42310
42301
  rightIcon: "none",
42311
- size: "small",
42302
+ size: "",
42312
42303
  text: "Cancel",
42313
42304
  type: "secondary"
42314
42305
  }), /*#__PURE__*/React$1.createElement(Button$1, {
42315
42306
  leftIcon: "none",
42316
42307
  onClick: onConfirm,
42317
42308
  rightIcon: "none",
42318
- size: "small",
42309
+ size: "",
42319
42310
  text: "Confirm & Send",
42320
42311
  type: "primary",
42312
+ borderColor: linkColor,
42321
42313
  backgroundColor: linkColor,
42322
42314
  hoverTextColor: "#212121"
42323
42315
  }))), /*#__PURE__*/React$1.createElement(Dialog, null, vendors.map((vendor, idx) => /*#__PURE__*/React$1.createElement(VendorSection, {
42324
42316
  key: vendor.name
42325
42317
  }, /*#__PURE__*/React$1.createElement(VendorHeader, null, /*#__PURE__*/React$1.createElement(VendorName, null, vendor.name), /*#__PURE__*/React$1.createElement(NewBadge, null, vendor.newPackages.length, " New")), /*#__PURE__*/React$1.createElement(PackageList, null, vendor.newPackages.map((pkg, i) => /*#__PURE__*/React$1.createElement(Item, {
42326
42318
  key: i
42327
- }, pkg))), /*#__PURE__*/React$1.createElement(Divider, null)))));
42319
+ }, pkg)))))));
42328
42320
  };
42329
42321
 
42330
42322
  const SuccessScreenContainer = styled.div`
42331
- display: flex;
42332
- flex-direction: column;
42323
+ font-family: Poppins;
42333
42324
  background:rgb(255, 255, 255);
42334
42325
  width: ${props => props.width || "100%"};
42335
42326
  height: ${props => props.height || "100%"};
42336
42327
  overflow: hidden;
42328
+ text-align: left;
42337
42329
  `;
42338
42330
  const SuccessHeader = styled.div`
42339
42331
  display: flex;
@@ -42341,29 +42333,19 @@ const SuccessHeader = styled.div`
42341
42333
  align-items: center;
42342
42334
  justify-content: center;
42343
42335
  `;
42344
- const SuccessTitle = styled.h2`
42345
- color: var(--Text-Primary, #212121);
42346
- text-align: center;
42347
- font-feature-settings: 'liga' off;
42348
-
42349
- /* Headings/H3 Medium */
42350
- font-family: Poppins;
42351
- font-size: 32px;
42352
- font-style: normal;
42353
- font-weight: 700;
42354
- line-height: normal;
42336
+ const SuccessTitle = styled.h5`
42337
+ color: #212121;
42338
+ text-align: center;
42339
+ font-size: 32px;
42340
+ font-weight: 700;
42341
+ margin: 0 0 20px;
42355
42342
  `;
42356
42343
  const SuccessSubtitle = styled.p`
42357
42344
  margin-bottom: 24px;
42358
42345
  text-align: center;
42359
- color: var(--Text-Primary, #212121);
42360
- font-feature-settings: 'liga' off;
42361
- /* Content/P1 Regular */
42362
- font-family: Poppins;
42346
+ color: #212121;
42363
42347
  font-size: 16px;
42364
- font-style: normal;
42365
42348
  font-weight: 400;
42366
- line-height: normal;
42367
42349
  `;
42368
42350
  styled.div`
42369
42351
  display: flex;
@@ -50837,8 +50819,6 @@ const SuccessScreen = ({
50837
50819
  }, vendor, /*#__PURE__*/React$1.createElement("br", null)))))));
50838
50820
  };
50839
50821
 
50840
- // Removed TypeScript interface and type annotations
50841
-
50842
50822
  const ItemManagerPanel = _ref => {
50843
50823
  let {
50844
50824
  width = "100%",
@@ -50851,11 +50831,12 @@ const ItemManagerPanel = _ref => {
50851
50831
  setItemAndPackage,
50852
50832
  linkColor = "#212121",
50853
50833
  backgroundColor = 'white',
50854
- onDelete = () => {}
50834
+ buttonTooltipText = "Please fill out all forms before sending."
50855
50835
  } = _ref;
50856
50836
  const [screen, setScreen] = useState("initial");
50857
50837
  const [selectedVendor, setSelectedVendor] = useState(null);
50858
50838
  const [selectedPackage, setSelectedPackage] = useState(null);
50839
+ const [isEditingExisting, setIsEditingExisting] = useState(false);
50859
50840
  const handleVendorClick = vendor => {
50860
50841
  // console.log("Vendor clicked:", vendor);
50861
50842
  setSelectedVendor(vendor);
@@ -50884,8 +50865,29 @@ const ItemManagerPanel = _ref => {
50884
50865
  });
50885
50866
  setScreen("subitem");
50886
50867
  };
50887
- const handleBackToDefault = () => {
50888
- setScreen("");
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");
50889
50891
  };
50890
50892
  const onDeleteVendor = vendor => {
50891
50893
  const updatedItemAndPackage = itemAndPackage.filter(item => item.name !== vendor.name);
@@ -50894,6 +50896,21 @@ const ItemManagerPanel = _ref => {
50894
50896
  packages: null
50895
50897
  }]);
50896
50898
  };
50899
+ const hasUnisentPackages = useMemo(() => {
50900
+ return itemAndPackage.some(vendor => {
50901
+ if (vendor.packages === null || !Array.isArray(vendor.packages)) {
50902
+ return false;
50903
+ }
50904
+ return vendor.packages.some(pkg => !pkg.hasOwnProperty('status') || pkg.status == null || pkg.status === undefined || pkg.status === '');
50905
+ });
50906
+ }, [itemAndPackage]);
50907
+ const actuallyAllFormsSent = AllFormsSent && !hasUnisentPackages;
50908
+ useEffect(() => {
50909
+ if (screen === "success" && onSendForms) {
50910
+ onSendForms();
50911
+ }
50912
+ }, [screen]); // Only run when screen changes
50913
+
50897
50914
  if (screen === "subitem") {
50898
50915
  return /*#__PURE__*/React$1.createElement(Card, {
50899
50916
  width: width,
@@ -50907,15 +50924,28 @@ const ItemManagerPanel = _ref => {
50907
50924
  itemAndPackage: itemAndPackage,
50908
50925
  onBack: () => setScreen("initial"),
50909
50926
  onTrashClick: () => onDeleteInner(selectedVendor),
50910
- 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
+ }
50911
50940
  }));
50912
50941
  }
50913
50942
  if (screen === "confirmation") {
50914
50943
  return /*#__PURE__*/React$1.createElement(ConfirmationDialog, {
50915
50944
  width: width,
50916
50945
  height: height,
50917
- onCancel: () => setScreen(undefined),
50946
+ onCancel: () => setScreen("initial"),
50918
50947
  onConfirm: () => setScreen("success"),
50948
+ linkColor: linkColor,
50919
50949
  vendors: itemAndPackage.filter(item => item.packages !== null).map(item => {
50920
50950
  return {
50921
50951
  name: item.name,
@@ -50925,9 +50955,6 @@ const ItemManagerPanel = _ref => {
50925
50955
  });
50926
50956
  }
50927
50957
  if (screen === "success") {
50928
- if (onSendForms) {
50929
- onSendForms();
50930
- }
50931
50958
  return /*#__PURE__*/React$1.createElement(SuccessScreen, {
50932
50959
  width: width,
50933
50960
  height: height,
@@ -50947,6 +50974,8 @@ const ItemManagerPanel = _ref => {
50947
50974
  vendor: selectedVendor,
50948
50975
  itemAndPackage: itemAndPackage,
50949
50976
  addNewPackage: addNewPackage,
50977
+ updateExistingPackage: updateExistingPackage,
50978
+ isEditingExisting: isEditingExisting,
50950
50979
  onBack: () => setScreen("subitem")
50951
50980
  }));
50952
50981
  }
@@ -50956,7 +50985,7 @@ const ItemManagerPanel = _ref => {
50956
50985
  height: height,
50957
50986
  backgroundColor: backgroundColor
50958
50987
  }, /*#__PURE__*/React$1.createElement(NewItemList, {
50959
- onBack: handleBackToDefault,
50988
+ onBack: () => setScreen("initial"),
50960
50989
  itemAndPackage: itemAndPackage,
50961
50990
  onVendorClick: handleVendorClick
50962
50991
  }));
@@ -50966,7 +50995,12 @@ const ItemManagerPanel = _ref => {
50966
50995
  width: width,
50967
50996
  height: height,
50968
50997
  backgroundColor: backgroundColor
50969
- }, /*#__PURE__*/React$1.createElement(Container$1, null, /*#__PURE__*/React$1.createElement(TitleContainer, null, /*#__PURE__*/React$1.createElement(SectionTitle$1, null, "Vendors"), /*#__PURE__*/React$1.createElement(SubtitleContainer, null, /*#__PURE__*/React$1.createElement(Subtitle$1, null, itemAndPackage.filter(item => item.packages !== null).length.toString(), " ", "Vendors", " "), /*#__PURE__*/React$1.createElement("span", null, "\xB7"), /*#__PURE__*/React$1.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$1.createElement(ButtonContainer$1, null, /*#__PURE__*/React$1.createElement(Button$1, {
50998
+ }, /*#__PURE__*/React$1.createElement(Container$1, null, /*#__PURE__*/React$1.createElement(TitleContainer, null, /*#__PURE__*/React$1.createElement(SectionTitle$1, null, "Vendors"), /*#__PURE__*/React$1.createElement(SubtitleContainer, null, /*#__PURE__*/React$1.createElement(Subtitle$1, null, itemAndPackage.filter(item => item.packages !== null).length.toString(), " ", "Vendors", " "), /*#__PURE__*/React$1.createElement("span", null, "\xB7"), /*#__PURE__*/React$1.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$1.createElement(ButtonContainer$1, null, /*#__PURE__*/React$1.createElement(CustomTooltip, {
50999
+ hideTooltip: !disabledSendForms,
51000
+ content: buttonTooltipText,
51001
+ topFactor: 2,
51002
+ direction: "bottom"
51003
+ }, /*#__PURE__*/React$1.createElement(Button$1, {
50970
51004
  leftIcon: "Fly",
50971
51005
  onClick: () => setScreen("confirmation"),
50972
51006
  rightIcon: "none",
@@ -50974,10 +51008,12 @@ const ItemManagerPanel = _ref => {
50974
51008
  size: "small",
50975
51009
  text: "Send Forms",
50976
51010
  type: "secondary",
50977
- borderRadius: "8px"
50978
- }), /*#__PURE__*/React$1.createElement(Subtitle$1, {
50979
- color: AllFormsSent ? "#90CE9C" : "#8b8989"
50980
- }, AllFormsSent ? '✔ All Forms Sent' : `${itemAndPackage.filter(item => item.packages !== null).length.toString()} Vendors `))), /*#__PURE__*/React$1.createElement(AddButtonContainer$1, null, /*#__PURE__*/React$1.createElement(LinkButton, {
51011
+ borderRadius: "8px",
51012
+ borderColor: linkColor,
51013
+ textColor: linkColor
51014
+ })), /*#__PURE__*/React$1.createElement(Subtitle$1, {
51015
+ color: actuallyAllFormsSent ? "#90CE9C" : "#8b8989"
51016
+ }, actuallyAllFormsSent ? '✔ All Forms Sent' : itemAndPackage.filter(item => item.packages !== null).length > 0 ? `${itemAndPackage.filter(item => item.packages !== null).length.toString()} New Forms` : ''))), /*#__PURE__*/React$1.createElement(AddButtonContainer$1, null, /*#__PURE__*/React$1.createElement(LinkButton, {
50981
51017
  leftIcon: "Plus",
50982
51018
  onClick: () => setScreen("list"),
50983
51019
  rightIcon: "none",
@@ -51090,14 +51126,11 @@ const scrollableStyles = `
51090
51126
  const DropdownContainer = styled.div`
51091
51127
  position: relative;
51092
51128
  width: ${props => props.width || '100%'};
51093
- /* min-width: 320px; */
51094
- max-width: 600px;
51129
+ max-width: 400px;
51095
51130
  font-family: "Poppins", sans-serif;
51096
51131
  `;
51097
51132
  const DropdownButton = styled.button`
51098
51133
  width: 100%;
51099
- /* min-width: 320px; */
51100
- max-width: 600px;
51101
51134
  background: #fff;
51102
51135
  border: 1px solid #8B8989;
51103
51136
  border-radius: 12px;
@@ -51108,9 +51141,9 @@ const DropdownButton = styled.button`
51108
51141
  align-items: center;
51109
51142
  justify-content: space-between;
51110
51143
  ${props => props.disabled && css`
51111
- color:#8B8989;
51112
- background-color: #D0D0D0;
51144
+ color: #D0D0D0;
51113
51145
  cursor: not-allowed;
51146
+ border: 1px solid #D0D0D0;
51114
51147
  `}
51115
51148
  `;
51116
51149
  const DropdownList = styled.ul`
@@ -51153,7 +51186,7 @@ const DropdownItem = styled.li`
51153
51186
  margin: 0 12px;
51154
51187
  background: ${props => props.selected ? props.selectedColor || '#066768' : 'transparent'};
51155
51188
  font-weight: ${props => props.selected ? '500' : '400'};
51156
- color: ${props => props.disabled ? '#bdbdbd' : props.selected ? '#fff' : '#212121'};
51189
+ color: ${props => props.disabled ? '#D0D0D0' : props.selected ? '#fff' : '#212121'};
51157
51190
  border-left: ${props => props.selected ? `3px solid ${props.selectedColor || '#066768'}` : 'none'};
51158
51191
  ${props => props.disabled && css`
51159
51192
  cursor: not-allowed;