sag_components 2.0.0-beta111 → 2.0.0-beta113

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: '',
@@ -35876,9 +35880,12 @@ const TableContainer = styled__default["default"].div`
35876
35880
  ${scrollableStyles$1}
35877
35881
  `;
35878
35882
  const TableBodyScrollWrapper = styled__default["default"].div`
35883
+ height: ${props => props.tableBodyHeight || '728px'};
35884
+ min-height: ${props => props.tableBodyHeight || '728px'};
35879
35885
  max-height: ${props => props.tableBodyHeight || '728px'};
35880
35886
  overflow-y: auto;
35881
35887
  overflow-x: ${props => props.showHorizontalScroll ? 'auto' : 'hidden'};
35888
+ position: relative;
35882
35889
 
35883
35890
  &::-webkit-scrollbar {
35884
35891
  height: 8px;
@@ -36357,6 +36364,7 @@ const FieldPop = props => {
36357
36364
  }, "\xD7")));
36358
36365
  };
36359
36366
 
36367
+ // FilterPop.style.js
36360
36368
  const FilterPopContainer = styled__default["default"].div`
36361
36369
  font-family: 'Poppins', sans-serif;
36362
36370
  width: ${props => props.width || '300px'};
@@ -36366,6 +36374,13 @@ const FilterPopContainer = styled__default["default"].div`
36366
36374
  background-color: #fff;
36367
36375
  border-radius: 4px;
36368
36376
  box-shadow: 0px 4px 20px 0px rgba(0, 0, 0, 0.10);
36377
+
36378
+ /* Add this CSS for checkbox styling */
36379
+ input[type="checkbox"] {
36380
+ accent-color: ${props => props.accentColor || '#066768'};
36381
+ width: 16px;
36382
+ height: 16px;
36383
+ }
36369
36384
  `;
36370
36385
  const Title$5 = styled__default["default"].h6`
36371
36386
  font-size: 16px;
@@ -36388,6 +36403,12 @@ const CheckboxLabel = styled__default["default"].label`
36388
36403
  font-size: 14px;
36389
36404
  font-weight: 400;
36390
36405
  color: #212121;
36406
+ cursor: pointer;
36407
+
36408
+ &:hover {
36409
+ background-color: #E6F0F0;
36410
+ }
36411
+
36391
36412
  > span {
36392
36413
  width: ${props => props.width};
36393
36414
  white-space: nowrap;
@@ -36407,9 +36428,11 @@ const ResetButton$1 = styled__default["default"].button`
36407
36428
  cursor: pointer;
36408
36429
 
36409
36430
  &:hover {
36431
+ // color: #066768;
36410
36432
  }
36411
36433
 
36412
36434
  &:active {
36435
+ // color: #066768;
36413
36436
  }
36414
36437
  `;
36415
36438
 
@@ -36442,22 +36465,8 @@ const FilterPop = props => {
36442
36465
  return initialState;
36443
36466
  };
36444
36467
 
36445
- // Use the passed selectedAttributes from parent, fallback to initial state if empty
36446
- const [selectedAttributes, setSelectedAttributes] = React$1.useState(() => {
36447
- // If propSelectedAttributes has values, use it; otherwise use initial state
36448
- const hasValues = Object.keys(propSelectedAttributes).length > 0;
36449
- return hasValues ? propSelectedAttributes : createInitialState();
36450
- });
36451
-
36452
- // Use ref to track if we're programmatically updating to avoid loops
36453
- const isProgrammaticUpdate = React$1.useRef(false);
36454
-
36455
- // Sync with parent's selectedAttributes when they change
36456
- React$1.useEffect(() => {
36457
- if (Object.keys(propSelectedAttributes).length > 0) {
36458
- setSelectedAttributes(propSelectedAttributes);
36459
- }
36460
- }, [propSelectedAttributes]);
36468
+ // Use props directly, fallback to initial state only if props are empty
36469
+ const selectedAttributes = Object.keys(propSelectedAttributes).length > 0 ? propSelectedAttributes : createInitialState();
36461
36470
 
36462
36471
  // Helper function to get non-"All" items
36463
36472
  const getNonAllItems = () => {
@@ -36515,19 +36524,16 @@ const FilterPop = props => {
36515
36524
  }
36516
36525
  };
36517
36526
  const handleCheckboxChange = attribute => {
36518
- // console.log(`Checkbox changed: ${attribute}`);
36519
-
36520
36527
  if (attribute === 'All') {
36521
- // If "Select All" is clicked
36522
- const newState = !selectedAttributes.All;
36528
+ // If "Select All" is clicked - determine new state based on current "Select All" state
36529
+ const currentSelectAllState = selectedAttributes.All || false;
36530
+ const newState = !currentSelectAllState;
36523
36531
  const updatedAttributes = {};
36524
36532
 
36525
36533
  // Set all items to the same state as "Select All"
36526
36534
  fullList.forEach(item => {
36527
36535
  updatedAttributes[item.value] = newState;
36528
36536
  });
36529
- isProgrammaticUpdate.current = true;
36530
- setSelectedAttributes(updatedAttributes);
36531
36537
 
36532
36538
  // Call onCheck callback with new efficient structure
36533
36539
  const filterData = createFilterData(updatedAttributes);
@@ -36543,14 +36549,8 @@ const FilterPop = props => {
36543
36549
  [attribute]: !selectedAttributes[attribute]
36544
36550
  };
36545
36551
 
36546
- // Don't automatically update "Select All" here - let useEffect handle it
36547
- setSelectedAttributes(updatedAttributes);
36548
-
36549
36552
  // Call onCheck callback with new efficient structure
36550
36553
  const filterData = createFilterData(updatedAttributes);
36551
- // console.log('Just checked/unchecked:', attribute);
36552
- // console.log('Filter data:', filterData);
36553
-
36554
36554
  onCheck({
36555
36555
  changedItem: attribute,
36556
36556
  filterData: filterData,
@@ -36558,40 +36558,9 @@ const FilterPop = props => {
36558
36558
  });
36559
36559
  }
36560
36560
  };
36561
-
36562
- // Update "Select All" state based on other selections
36563
- React$1.useEffect(() => {
36564
- // Skip if this was a programmatic update
36565
- if (isProgrammaticUpdate.current) {
36566
- isProgrammaticUpdate.current = false;
36567
- return;
36568
- }
36569
- const selectAllItem = fullList.find(item => item.value === 'All');
36570
- if (!selectAllItem) return;
36571
- const allSelected = areAllNonAllItemsSelected();
36572
- const currentSelectAllState = selectedAttributes.All;
36573
-
36574
- // Only update "Select All" if its state should actually change
36575
- if (allSelected !== currentSelectAllState) {
36576
- const updatedAttributes = {
36577
- ...selectedAttributes,
36578
- [selectAllItem.value]: allSelected
36579
- };
36580
- setSelectedAttributes(updatedAttributes);
36581
-
36582
- // Also notify parent of the change with new efficient structure
36583
- const filterData = createFilterData(updatedAttributes);
36584
- onCheck({
36585
- changedItem: 'selectAll',
36586
- filterData: filterData,
36587
- allItems: updatedAttributes
36588
- });
36589
- }
36590
- }, [Object.keys(selectedAttributes).filter(key => key !== 'All').map(key => selectedAttributes[key]).join(',')]);
36591
36561
  const handleReset = () => {
36592
36562
  // Reset to the original default state (all selected)
36593
36563
  const resetState = createInitialState();
36594
- setSelectedAttributes(resetState);
36595
36564
 
36596
36565
  // Call the onReset callback
36597
36566
  onReset();
@@ -36634,7 +36603,8 @@ const FilterPop = props => {
36634
36603
  })];
36635
36604
  return /*#__PURE__*/React__default["default"].createElement(FilterPopContainer, {
36636
36605
  width: width,
36637
- height: height
36606
+ height: height,
36607
+ accentColor: color // Pass color as prop to styled component
36638
36608
  }, /*#__PURE__*/React__default["default"].createElement(Title$5, null, menuName), /*#__PURE__*/React__default["default"].createElement(CheckboxGroup, {
36639
36609
  style: {
36640
36610
  display: doubleColumn ? 'grid' : 'flex',
@@ -36644,19 +36614,29 @@ const FilterPop = props => {
36644
36614
  }, sortedList.map(item => {
36645
36615
  const isSelectAll = item.value === 'All';
36646
36616
  const checkboxProps = isSelectAll ? getSelectAllCheckboxProps() : {};
36617
+ const isChecked = isSelectAll ? checkboxProps.checked : selectedAttributes[item.value] || false;
36647
36618
  return /*#__PURE__*/React__default["default"].createElement(CheckboxLabel, {
36648
36619
  width: !doubleColumn ?? width,
36649
- key: item.value
36620
+ key: `${item.value}-${JSON.stringify(selectedAttributes)}`
36650
36621
  }, /*#__PURE__*/React__default["default"].createElement("input", {
36651
36622
  type: "checkbox",
36652
- checked: isSelectAll ? checkboxProps.checked : selectedAttributes[item.value] || false,
36653
- style: {
36654
- accentColor: color
36623
+ checked: isChecked,
36624
+ ref: el => {
36625
+ if (el) {
36626
+ // Handle indeterminate for Select All FIRST
36627
+ if (isSelectAll) {
36628
+ el.indeterminate = checkboxProps.indeterminate;
36629
+ }
36630
+
36631
+ // FORCE DOM SYNC - manually set DOM state to match React state
36632
+ if (el.checked !== isChecked) {
36633
+ el.checked = isChecked;
36634
+ }
36635
+ }
36655
36636
  },
36656
- ref: isSelectAll ? el => {
36657
- if (el) el.indeterminate = checkboxProps.indeterminate;
36658
- } : null,
36659
- onChange: () => handleCheckboxChange(item.value)
36637
+ onChange: e => {
36638
+ handleCheckboxChange(item.value);
36639
+ }
36660
36640
  }), /*#__PURE__*/React__default["default"].createElement("span", null, item.label));
36661
36641
  })), /*#__PURE__*/React__default["default"].createElement(ButtonWrapper$2, null, /*#__PURE__*/React__default["default"].createElement(ResetButton$1, {
36662
36642
  onClick: handleReset,
@@ -37250,7 +37230,9 @@ const TableHeader = ({
37250
37230
  // Remove onSort call - we only want to call it when selection is made
37251
37231
  };
37252
37232
  React$1.useEffect(() => {
37253
- onFilter(filterState);
37233
+ if (Object.keys(filterState).length > 0) {
37234
+ onFilter(filterState);
37235
+ }
37254
37236
  }, [filterState]);
37255
37237
  const handleFilter = key => {
37256
37238
  const iconElement = iconRefs.current[`filter-${key}`];
@@ -37291,25 +37273,25 @@ const TableHeader = ({
37291
37273
  }
37292
37274
  };
37293
37275
 
37294
- // Handle filter selection changes - Updated to work with new FilterPop data structure
37276
+ // Handle filter selection changes - Updated to work with stateless FilterPop
37295
37277
  const handleFilterSelectionChange = (columnKey, selectionData) => {
37296
- // Store the filter selections (keeping existing structure for UI state)
37297
- setFilterSelections(prev => ({
37298
- ...prev,
37299
- [columnKey]: selectionData.allItems
37300
- }));
37278
+ // Force immediate synchronous update using callback form
37279
+ setFilterSelections(prev => {
37280
+ const updated = {
37281
+ ...prev,
37282
+ [columnKey]: selectionData.allItems
37283
+ };
37284
+ return updated;
37285
+ });
37301
37286
 
37302
- // Update the filter state with the new efficient structure
37303
- const {
37304
- filterData
37305
- } = selectionData;
37287
+ // Also update filter state
37306
37288
  setFilterState(prev => ({
37307
37289
  ...prev,
37308
- [columnKey]: filterData
37290
+ [columnKey]: selectionData.filterData
37309
37291
  }));
37310
37292
  };
37311
37293
 
37312
- // Handle filter reset - Updated to work with new FilterPop data structure
37294
+ // Handle filter reset - Updated to work with stateless FilterPop
37313
37295
  const handleFilterReset = columnKey => {
37314
37296
  const column = columns.find(col => col.key === columnKey);
37315
37297
  if (column && column.filterOptions) {
@@ -37321,6 +37303,8 @@ const TableHeader = ({
37321
37303
  fullList.forEach(item => {
37322
37304
  resetState[item.value] = true;
37323
37305
  });
37306
+
37307
+ // Update filter selections immediately
37324
37308
  setFilterSelections(prev => ({
37325
37309
  ...prev,
37326
37310
  [columnKey]: resetState
@@ -37420,7 +37404,7 @@ const TableHeader = ({
37420
37404
  return isFocused || isActive || hasSelection;
37421
37405
  };
37422
37406
 
37423
- // Update showColumnFilter to use persistent selections
37407
+ // Update showColumnFilter to pass current filterSelections to stateless FilterPop
37424
37408
  const showColumnFilter = column => {
37425
37409
  const {
37426
37410
  key,
@@ -41376,7 +41360,7 @@ const Table = props => {
41376
41360
  return /*#__PURE__*/React__default["default"].createElement(TableWrapper, {
41377
41361
  width: width,
41378
41362
  height: height
41379
- }, /*#__PURE__*/React__default["default"].createElement(NoInfoFound, null, /*#__PURE__*/React__default["default"].createElement(TableTop, null, /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement(Title$7, null, tableTitle), /*#__PURE__*/React__default["default"].createElement(SubTitle, null, "No Events")), showSideButton && /*#__PURE__*/React__default["default"].createElement(Button$1, {
41363
+ }, /*#__PURE__*/React__default["default"].createElement(NoInfoFound, null, /*#__PURE__*/React__default["default"].createElement(TableTop, null, /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement(Title$7, null, tableTitle), /*#__PURE__*/React__default["default"].createElement(SubTitle, null, data.length === 0 ? 'No Events' : `${counter} Events`)), showSideButton && /*#__PURE__*/React__default["default"].createElement(Button$1, {
41380
41364
  height: "45px",
41381
41365
  leftIcon: "Plus",
41382
41366
  text: "New Event",
@@ -41384,15 +41368,7 @@ const Table = props => {
41384
41368
  backgroundColor: sideButtonColor,
41385
41369
  hoverBackgroundColor: sideButtonHoverColor,
41386
41370
  onClick: onSideButtonClick
41387
- })), children, data.length === 0 ? /*#__PURE__*/React__default["default"].createElement(NoEventsParent, null, /*#__PURE__*/React__default["default"].createElement(NoEventsWrapper, null, showNoDataInSearch ? /*#__PURE__*/React__default["default"].createElement(NoDataInSearchIcon, null) : /*#__PURE__*/React__default["default"].createElement(NoEvents, null)), /*#__PURE__*/React__default["default"].createElement(NoEventsMessage, null, showNoDataInSearch ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("strong", null, noDataInSearchTitle), /*#__PURE__*/React__default["default"].createElement("br", null), noDataInSearchMessage) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("strong", null, "You haven't created any events yet"), /*#__PURE__*/React__default["default"].createElement("br", null), "Let's get started and create your first one!")), !showNoDataInSearch && /*#__PURE__*/React__default["default"].createElement(Button$1, {
41388
- height: "45px",
41389
- leftIcon: "Plus",
41390
- text: "New Event",
41391
- borderRadius: "12px",
41392
- backgroundColor: buttonColor,
41393
- hoverBackgroundColor: buttonHoverColor,
41394
- onClick: onButtonClick
41395
- })) : /*#__PURE__*/React__default["default"].createElement(TableContainer, {
41371
+ })), children, /*#__PURE__*/React__default["default"].createElement(TableContainer, {
41396
41372
  showHorizontalScroll: showHorizontalScroll
41397
41373
  }, /*#__PURE__*/React__default["default"].createElement(TableBodyScrollWrapper, {
41398
41374
  tableBodyHeight: tableBodyHeight,
@@ -41410,6 +41386,14 @@ const Table = props => {
41410
41386
  onSendClick: onSendClick,
41411
41387
  onDeleteClick: onDeleteClick,
41412
41388
  buttonColor: buttonColor
41389
+ })), data.length === 0 && /*#__PURE__*/React__default["default"].createElement(NoEventsParent, null, /*#__PURE__*/React__default["default"].createElement(NoEventsWrapper, null, showNoDataInSearch ? /*#__PURE__*/React__default["default"].createElement(NoDataInSearchIcon, null) : /*#__PURE__*/React__default["default"].createElement(NoEvents, null)), /*#__PURE__*/React__default["default"].createElement(NoEventsMessage, null, showNoDataInSearch ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("strong", null, noDataInSearchTitle), /*#__PURE__*/React__default["default"].createElement("br", null), noDataInSearchMessage) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("strong", null, "You haven't created any events yet"), /*#__PURE__*/React__default["default"].createElement("br", null), "Let's get started and create your first one!")), !showNoDataInSearch && /*#__PURE__*/React__default["default"].createElement(Button$1, {
41390
+ height: "45px",
41391
+ leftIcon: "Plus",
41392
+ text: "New Event",
41393
+ borderRadius: "12px",
41394
+ backgroundColor: buttonColor,
41395
+ hoverBackgroundColor: buttonHoverColor,
41396
+ onClick: onButtonClick
41413
41397
  }))), isLoading && /*#__PURE__*/React__default["default"].createElement(LoadingWrapper, null, /*#__PURE__*/React__default["default"].createElement(Lottie, {
41414
41398
  style: {
41415
41399
  width: "24px",
@@ -41425,7 +41409,7 @@ const Card = styled__default["default"].div`
41425
41409
  border-radius: 8px;
41426
41410
  /* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); */
41427
41411
  text-align: center;
41428
- overflow: hidden;
41412
+ /* overflow: hidden; */ // If hidden the tooltip will not be visible
41429
41413
  width: ${props => props.width || "auto"};
41430
41414
  height: ${props => props.height || "auto"};
41431
41415
  margin: 0 auto;
@@ -41444,8 +41428,9 @@ const SectionTitle$1 = styled__default["default"].div`
41444
41428
  `;
41445
41429
  const SubtitleContainer = styled__default["default"].div`
41446
41430
  display: flex;
41447
- align-items: flex-start;
41448
- gap: 8px;
41431
+ align-items: center;
41432
+ gap: 6px;
41433
+ color: #8B8989;
41449
41434
  `;
41450
41435
  const Subtitle$1 = styled__default["default"].span`
41451
41436
  color: ${props => props.color};
@@ -41544,10 +41529,6 @@ const LineContainer = styled__default["default"].div`
41544
41529
  width: 100%;
41545
41530
  `;
41546
41531
  const ButtonContainer$1 = styled__default["default"].div`
41547
- display: flex;
41548
- justify-content: flex-end;
41549
- flex-direction: column;
41550
- gap: 5px;
41551
41532
  margin-top: 16px;
41552
41533
  .ButtonContainer {
41553
41534
  label {
@@ -41555,6 +41536,16 @@ const ButtonContainer$1 = styled__default["default"].div`
41555
41536
  }
41556
41537
  }
41557
41538
  `;
41539
+ const CustomTooltip = styled__default["default"](Tooltip$2)`
41540
+ .controls {
41541
+ padding: 12px 16px;
41542
+ font-size: 14px;
41543
+ left: 0;
41544
+ &::before {
41545
+ left: 90%;
41546
+ }
41547
+ }
41548
+ `;
41558
41549
  const Container$1 = styled__default["default"].div`
41559
41550
  display: flex;
41560
41551
  align-items: center;
@@ -42106,7 +42097,7 @@ styled__default["default"].div`
42106
42097
  margin-top: 24px;
42107
42098
  margin-left: 8px;
42108
42099
  `;
42109
- const Divider$1 = styled__default["default"].div`
42100
+ const Divider = styled__default["default"].div`
42110
42101
  height: 1px;
42111
42102
  background-color: #e2e2e2;
42112
42103
  margin: 16px 0;
@@ -42179,7 +42170,7 @@ const NewSubitem = ({
42179
42170
  type: "primary",
42180
42171
  backgroundColor: linkColor,
42181
42172
  hoverTextColor: "#212121"
42182
- })), /*#__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", {
42173
+ })), /*#__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", {
42183
42174
  style: {
42184
42175
  color: "red"
42185
42176
  }
@@ -42213,47 +42204,34 @@ const NewSubitem = ({
42213
42204
  };
42214
42205
 
42215
42206
  const Overlay$1 = styled__default["default"].div`
42216
- display: flex;
42217
- flex-direction: column;
42207
+ font-family: Poppins;
42218
42208
  background: #f7f8fa;
42219
42209
  width: ${props => props.width || "100%"};
42220
42210
  height: ${props => props.height || "100%"};
42221
42211
  overflow: hidden;
42212
+ text-align: left;
42222
42213
  `;
42223
- const Dialog = styled__default["default"].div`
42224
- background: #fff;
42225
- border-radius: 12px;
42226
- height: 100%;
42227
- padding: 32px 24px;
42214
+ const HeaderContainer = styled__default["default"].div`
42215
+ color: #212121;
42216
+ padding: 40px 16px;
42217
+ border-bottom: 1px solid #e2e2e2;
42228
42218
  `;
42229
- const Title$1 = styled__default["default"].h2`
42230
- color: var(--Text-Primary, #212121);
42231
- font-feature-settings: "liga" off;
42232
- /* Headings/H3 Medium */
42233
- font-family: Poppins;
42219
+ const Title$1 = styled__default["default"].h5`
42234
42220
  font-size: 32px;
42235
- font-style: normal;
42236
42221
  font-weight: 700;
42237
- line-height: normal;
42222
+ margin: 0 0 20px;
42238
42223
  `;
42239
42224
  const Subtitle = styled__default["default"].p`
42240
- color: var(--Text-Primary, #212121);
42241
- font-feature-settings: "liga" off;
42242
- /* Headings/H6 Regular */
42243
- font-family: Poppins;
42244
42225
  font-size: 18px;
42245
- font-style: normal;
42246
42226
  font-weight: 400;
42247
- line-height: normal;
42227
+ margin: 0 0 20px;
42248
42228
  `;
42249
- const VendorSection = styled__default["default"].div`
42250
- margin-bottom: 20px;
42229
+ const Dialog = styled__default["default"].div`
42230
+ background: #fff;
42251
42231
  `;
42252
- const Divider = styled__default["default"].div`
42253
- height: 1px;
42254
- background-color: #e2e2e2;
42255
- margin: 16px 0;
42256
- width: 100%;
42232
+ const VendorSection = styled__default["default"].div`
42233
+ padding: 16px;
42234
+ border-bottom: 1px solid #e2e2e2;
42257
42235
  `;
42258
42236
  const Item = styled__default["default"].li`
42259
42237
  color: black; /* text color */
@@ -42274,12 +42252,8 @@ const VendorName = styled__default["default"].span`
42274
42252
  margin-right: 10px;
42275
42253
  overflow: hidden;
42276
42254
  color: #000;
42277
-
42278
- font-family: Poppins;
42279
42255
  font-size: 16px;
42280
- font-style: normal;
42281
42256
  font-weight: 500;
42282
- line-height: normal;
42283
42257
  `;
42284
42258
  const NewBadge = styled__default["default"].span`
42285
42259
  background: #ffe2b6;
@@ -42287,40 +42261,23 @@ const NewBadge = styled__default["default"].span`
42287
42261
  border-radius: 16px;
42288
42262
  padding: 2px 10px;
42289
42263
  margin-left: 4px;
42290
- color: #000;
42291
- font-feature-settings: "liga" off;
42292
- font-family: Poppins;
42293
42264
  font-size: 14px;
42294
- font-style: normal;
42295
42265
  font-weight: 500;
42296
- line-height: normal;
42297
42266
  `;
42298
42267
  const PackageList = styled__default["default"].ul`
42299
42268
  margin: 0 0 0 16px;
42300
42269
  padding: 0;
42301
42270
  gap: 30px;
42302
42271
  list-style: disc;
42303
- color: #888;
42304
- color: var(--General-Black, #212121);
42305
- font-feature-settings: "liga" off;
42306
- font-family: Poppins;
42307
42272
  font-size: 14px;
42308
- font-style: normal;
42309
42273
  font-weight: 400;
42310
- line-height: normal;
42311
42274
  `;
42312
42275
  const ButtonRow = styled__default["default"].div`
42313
42276
  display: flex;
42314
- justify-content: flex-start;
42315
42277
  gap: 12px;
42316
- flex-direction: row;
42278
+ justify-content: flex-start;
42317
42279
  align-items: center;
42318
42280
  `;
42319
- const HeaderContainer = styled__default["default"].div`
42320
- display: flex;
42321
- flex-direction: column;
42322
- padding: 16px;
42323
- `;
42324
42281
 
42325
42282
  const ConfirmationDialog = ({
42326
42283
  width,
@@ -42331,39 +42288,43 @@ const ConfirmationDialog = ({
42331
42288
  linkColor
42332
42289
  }) => {
42333
42290
  const totalNew = vendors.reduce((sum, v) => sum + (v.newPackages?.length || 0), 0);
42291
+ const confirmationText = `You are about to send the following
42292
+ ${totalNew} new ${totalNew === 1 ? 'package' : 'packages'} to
42293
+ ${vendors.length} ${vendors.length === 1 ? 'vendor' : 'vendors'}:`;
42334
42294
  return /*#__PURE__*/React__default["default"].createElement(Overlay$1, {
42335
42295
  width: width,
42336
42296
  height: height
42337
- }, /*#__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, {
42297
+ }, /*#__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, {
42338
42298
  leftIcon: "none",
42339
42299
  onClick: onCancel,
42340
42300
  rightIcon: "none",
42341
- size: "small",
42301
+ size: "",
42342
42302
  text: "Cancel",
42343
42303
  type: "secondary"
42344
42304
  }), /*#__PURE__*/React__default["default"].createElement(Button$1, {
42345
42305
  leftIcon: "none",
42346
42306
  onClick: onConfirm,
42347
42307
  rightIcon: "none",
42348
- size: "small",
42308
+ size: "",
42349
42309
  text: "Confirm & Send",
42350
42310
  type: "primary",
42311
+ borderColor: linkColor,
42351
42312
  backgroundColor: linkColor,
42352
42313
  hoverTextColor: "#212121"
42353
42314
  }))), /*#__PURE__*/React__default["default"].createElement(Dialog, null, vendors.map((vendor, idx) => /*#__PURE__*/React__default["default"].createElement(VendorSection, {
42354
42315
  key: vendor.name
42355
42316
  }, /*#__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, {
42356
42317
  key: i
42357
- }, pkg))), /*#__PURE__*/React__default["default"].createElement(Divider, null)))));
42318
+ }, pkg)))))));
42358
42319
  };
42359
42320
 
42360
42321
  const SuccessScreenContainer = styled__default["default"].div`
42361
- display: flex;
42362
- flex-direction: column;
42322
+ font-family: Poppins;
42363
42323
  background:rgb(255, 255, 255);
42364
42324
  width: ${props => props.width || "100%"};
42365
42325
  height: ${props => props.height || "100%"};
42366
42326
  overflow: hidden;
42327
+ text-align: left;
42367
42328
  `;
42368
42329
  const SuccessHeader = styled__default["default"].div`
42369
42330
  display: flex;
@@ -42371,29 +42332,19 @@ const SuccessHeader = styled__default["default"].div`
42371
42332
  align-items: center;
42372
42333
  justify-content: center;
42373
42334
  `;
42374
- const SuccessTitle = styled__default["default"].h2`
42375
- color: var(--Text-Primary, #212121);
42376
- text-align: center;
42377
- font-feature-settings: 'liga' off;
42378
-
42379
- /* Headings/H3 Medium */
42380
- font-family: Poppins;
42381
- font-size: 32px;
42382
- font-style: normal;
42383
- font-weight: 700;
42384
- line-height: normal;
42335
+ const SuccessTitle = styled__default["default"].h5`
42336
+ color: #212121;
42337
+ text-align: center;
42338
+ font-size: 32px;
42339
+ font-weight: 700;
42340
+ margin: 0 0 20px;
42385
42341
  `;
42386
42342
  const SuccessSubtitle = styled__default["default"].p`
42387
42343
  margin-bottom: 24px;
42388
42344
  text-align: center;
42389
- color: var(--Text-Primary, #212121);
42390
- font-feature-settings: 'liga' off;
42391
- /* Content/P1 Regular */
42392
- font-family: Poppins;
42345
+ color: #212121;
42393
42346
  font-size: 16px;
42394
- font-style: normal;
42395
42347
  font-weight: 400;
42396
- line-height: normal;
42397
42348
  `;
42398
42349
  styled__default["default"].div`
42399
42350
  display: flex;
@@ -50867,8 +50818,6 @@ const SuccessScreen = ({
50867
50818
  }, vendor, /*#__PURE__*/React__default["default"].createElement("br", null)))))));
50868
50819
  };
50869
50820
 
50870
- // Removed TypeScript interface and type annotations
50871
-
50872
50821
  const ItemManagerPanel = _ref => {
50873
50822
  let {
50874
50823
  width = "100%",
@@ -50881,7 +50830,7 @@ const ItemManagerPanel = _ref => {
50881
50830
  setItemAndPackage,
50882
50831
  linkColor = "#212121",
50883
50832
  backgroundColor = 'white',
50884
- onDelete = () => {}
50833
+ buttonTooltipText = "Please fill out all forms before sending."
50885
50834
  } = _ref;
50886
50835
  const [screen, setScreen] = React$1.useState("initial");
50887
50836
  const [selectedVendor, setSelectedVendor] = React$1.useState(null);
@@ -50914,9 +50863,6 @@ const ItemManagerPanel = _ref => {
50914
50863
  });
50915
50864
  setScreen("subitem");
50916
50865
  };
50917
- const handleBackToDefault = () => {
50918
- setScreen("");
50919
- };
50920
50866
  const onDeleteVendor = vendor => {
50921
50867
  const updatedItemAndPackage = itemAndPackage.filter(item => item.name !== vendor.name);
50922
50868
  setItemAndPackage([...updatedItemAndPackage, {
@@ -50924,6 +50870,21 @@ const ItemManagerPanel = _ref => {
50924
50870
  packages: null
50925
50871
  }]);
50926
50872
  };
50873
+ const hasUnisentPackages = React$1.useMemo(() => {
50874
+ return itemAndPackage.some(vendor => {
50875
+ if (vendor.packages === null || !Array.isArray(vendor.packages)) {
50876
+ return false;
50877
+ }
50878
+ return vendor.packages.some(pkg => !pkg.hasOwnProperty('status') || pkg.status == null || pkg.status === undefined || pkg.status === '');
50879
+ });
50880
+ }, [itemAndPackage]);
50881
+ const actuallyAllFormsSent = AllFormsSent && !hasUnisentPackages;
50882
+ React$1.useEffect(() => {
50883
+ if (screen === "success" && onSendForms) {
50884
+ onSendForms();
50885
+ }
50886
+ }, [screen]); // Only run when screen changes
50887
+
50927
50888
  if (screen === "subitem") {
50928
50889
  return /*#__PURE__*/React__default["default"].createElement(Card, {
50929
50890
  width: width,
@@ -50944,8 +50905,9 @@ const ItemManagerPanel = _ref => {
50944
50905
  return /*#__PURE__*/React__default["default"].createElement(ConfirmationDialog, {
50945
50906
  width: width,
50946
50907
  height: height,
50947
- onCancel: () => setScreen(undefined),
50908
+ onCancel: () => setScreen("initial"),
50948
50909
  onConfirm: () => setScreen("success"),
50910
+ linkColor: linkColor,
50949
50911
  vendors: itemAndPackage.filter(item => item.packages !== null).map(item => {
50950
50912
  return {
50951
50913
  name: item.name,
@@ -50955,9 +50917,6 @@ const ItemManagerPanel = _ref => {
50955
50917
  });
50956
50918
  }
50957
50919
  if (screen === "success") {
50958
- if (onSendForms) {
50959
- onSendForms();
50960
- }
50961
50920
  return /*#__PURE__*/React__default["default"].createElement(SuccessScreen, {
50962
50921
  width: width,
50963
50922
  height: height,
@@ -50986,7 +50945,7 @@ const ItemManagerPanel = _ref => {
50986
50945
  height: height,
50987
50946
  backgroundColor: backgroundColor
50988
50947
  }, /*#__PURE__*/React__default["default"].createElement(NewItemList, {
50989
- onBack: handleBackToDefault,
50948
+ onBack: () => setScreen("initial"),
50990
50949
  itemAndPackage: itemAndPackage,
50991
50950
  onVendorClick: handleVendorClick
50992
50951
  }));
@@ -50996,7 +50955,12 @@ const ItemManagerPanel = _ref => {
50996
50955
  width: width,
50997
50956
  height: height,
50998
50957
  backgroundColor: backgroundColor
50999
- }, /*#__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, {
50958
+ }, /*#__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, {
50959
+ hideTooltip: !disabledSendForms,
50960
+ content: buttonTooltipText,
50961
+ topFactor: 2,
50962
+ direction: "bottom"
50963
+ }, /*#__PURE__*/React__default["default"].createElement(Button$1, {
51000
50964
  leftIcon: "Fly",
51001
50965
  onClick: () => setScreen("confirmation"),
51002
50966
  rightIcon: "none",
@@ -51004,10 +50968,12 @@ const ItemManagerPanel = _ref => {
51004
50968
  size: "small",
51005
50969
  text: "Send Forms",
51006
50970
  type: "secondary",
51007
- borderRadius: "8px"
51008
- }), /*#__PURE__*/React__default["default"].createElement(Subtitle$1, {
51009
- color: AllFormsSent ? "#90CE9C" : "#8b8989"
51010
- }, 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, {
50971
+ borderRadius: "8px",
50972
+ borderColor: linkColor,
50973
+ textColor: linkColor
50974
+ })), /*#__PURE__*/React__default["default"].createElement(Subtitle$1, {
50975
+ color: actuallyAllFormsSent ? "#90CE9C" : "#8b8989"
50976
+ }, 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, {
51011
50977
  leftIcon: "Plus",
51012
50978
  onClick: () => setScreen("list"),
51013
50979
  rightIcon: "none",
@@ -51139,7 +51105,7 @@ const DropdownButton = styled__default["default"].button`
51139
51105
  justify-content: space-between;
51140
51106
  ${props => props.disabled && styled.css`
51141
51107
  color:#8B8989;
51142
- background-color: #D0D0D0;
51108
+ /* background-color: #D0D0D0; */
51143
51109
  cursor: not-allowed;
51144
51110
  `}
51145
51111
  `;