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.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: '',
@@ -35866,9 +35870,12 @@ const TableContainer = styled.div`
35866
35870
  ${scrollableStyles$1}
35867
35871
  `;
35868
35872
  const TableBodyScrollWrapper = styled.div`
35873
+ height: ${props => props.tableBodyHeight || '728px'};
35874
+ min-height: ${props => props.tableBodyHeight || '728px'};
35869
35875
  max-height: ${props => props.tableBodyHeight || '728px'};
35870
35876
  overflow-y: auto;
35871
35877
  overflow-x: ${props => props.showHorizontalScroll ? 'auto' : 'hidden'};
35878
+ position: relative;
35872
35879
 
35873
35880
  &::-webkit-scrollbar {
35874
35881
  height: 8px;
@@ -36347,6 +36354,7 @@ const FieldPop = props => {
36347
36354
  }, "\xD7")));
36348
36355
  };
36349
36356
 
36357
+ // FilterPop.style.js
36350
36358
  const FilterPopContainer = styled.div`
36351
36359
  font-family: 'Poppins', sans-serif;
36352
36360
  width: ${props => props.width || '300px'};
@@ -36356,6 +36364,13 @@ const FilterPopContainer = styled.div`
36356
36364
  background-color: #fff;
36357
36365
  border-radius: 4px;
36358
36366
  box-shadow: 0px 4px 20px 0px rgba(0, 0, 0, 0.10);
36367
+
36368
+ /* Add this CSS for checkbox styling */
36369
+ input[type="checkbox"] {
36370
+ accent-color: ${props => props.accentColor || '#066768'};
36371
+ width: 16px;
36372
+ height: 16px;
36373
+ }
36359
36374
  `;
36360
36375
  const Title$5 = styled.h6`
36361
36376
  font-size: 16px;
@@ -36378,6 +36393,12 @@ const CheckboxLabel = styled.label`
36378
36393
  font-size: 14px;
36379
36394
  font-weight: 400;
36380
36395
  color: #212121;
36396
+ cursor: pointer;
36397
+
36398
+ &:hover {
36399
+ background-color: #E6F0F0;
36400
+ }
36401
+
36381
36402
  > span {
36382
36403
  width: ${props => props.width};
36383
36404
  white-space: nowrap;
@@ -36397,9 +36418,11 @@ const ResetButton$1 = styled.button`
36397
36418
  cursor: pointer;
36398
36419
 
36399
36420
  &:hover {
36421
+ // color: #066768;
36400
36422
  }
36401
36423
 
36402
36424
  &:active {
36425
+ // color: #066768;
36403
36426
  }
36404
36427
  `;
36405
36428
 
@@ -36432,22 +36455,8 @@ const FilterPop = props => {
36432
36455
  return initialState;
36433
36456
  };
36434
36457
 
36435
- // Use the passed selectedAttributes from parent, fallback to initial state if empty
36436
- const [selectedAttributes, setSelectedAttributes] = useState(() => {
36437
- // If propSelectedAttributes has values, use it; otherwise use initial state
36438
- const hasValues = Object.keys(propSelectedAttributes).length > 0;
36439
- return hasValues ? propSelectedAttributes : createInitialState();
36440
- });
36441
-
36442
- // Use ref to track if we're programmatically updating to avoid loops
36443
- const isProgrammaticUpdate = useRef(false);
36444
-
36445
- // Sync with parent's selectedAttributes when they change
36446
- useEffect(() => {
36447
- if (Object.keys(propSelectedAttributes).length > 0) {
36448
- setSelectedAttributes(propSelectedAttributes);
36449
- }
36450
- }, [propSelectedAttributes]);
36458
+ // Use props directly, fallback to initial state only if props are empty
36459
+ const selectedAttributes = Object.keys(propSelectedAttributes).length > 0 ? propSelectedAttributes : createInitialState();
36451
36460
 
36452
36461
  // Helper function to get non-"All" items
36453
36462
  const getNonAllItems = () => {
@@ -36505,19 +36514,16 @@ const FilterPop = props => {
36505
36514
  }
36506
36515
  };
36507
36516
  const handleCheckboxChange = attribute => {
36508
- // console.log(`Checkbox changed: ${attribute}`);
36509
-
36510
36517
  if (attribute === 'All') {
36511
- // If "Select All" is clicked
36512
- const newState = !selectedAttributes.All;
36518
+ // If "Select All" is clicked - determine new state based on current "Select All" state
36519
+ const currentSelectAllState = selectedAttributes.All || false;
36520
+ const newState = !currentSelectAllState;
36513
36521
  const updatedAttributes = {};
36514
36522
 
36515
36523
  // Set all items to the same state as "Select All"
36516
36524
  fullList.forEach(item => {
36517
36525
  updatedAttributes[item.value] = newState;
36518
36526
  });
36519
- isProgrammaticUpdate.current = true;
36520
- setSelectedAttributes(updatedAttributes);
36521
36527
 
36522
36528
  // Call onCheck callback with new efficient structure
36523
36529
  const filterData = createFilterData(updatedAttributes);
@@ -36533,14 +36539,8 @@ const FilterPop = props => {
36533
36539
  [attribute]: !selectedAttributes[attribute]
36534
36540
  };
36535
36541
 
36536
- // Don't automatically update "Select All" here - let useEffect handle it
36537
- setSelectedAttributes(updatedAttributes);
36538
-
36539
36542
  // Call onCheck callback with new efficient structure
36540
36543
  const filterData = createFilterData(updatedAttributes);
36541
- // console.log('Just checked/unchecked:', attribute);
36542
- // console.log('Filter data:', filterData);
36543
-
36544
36544
  onCheck({
36545
36545
  changedItem: attribute,
36546
36546
  filterData: filterData,
@@ -36548,40 +36548,9 @@ const FilterPop = props => {
36548
36548
  });
36549
36549
  }
36550
36550
  };
36551
-
36552
- // Update "Select All" state based on other selections
36553
- useEffect(() => {
36554
- // Skip if this was a programmatic update
36555
- if (isProgrammaticUpdate.current) {
36556
- isProgrammaticUpdate.current = false;
36557
- return;
36558
- }
36559
- const selectAllItem = fullList.find(item => item.value === 'All');
36560
- if (!selectAllItem) return;
36561
- const allSelected = areAllNonAllItemsSelected();
36562
- const currentSelectAllState = selectedAttributes.All;
36563
-
36564
- // Only update "Select All" if its state should actually change
36565
- if (allSelected !== currentSelectAllState) {
36566
- const updatedAttributes = {
36567
- ...selectedAttributes,
36568
- [selectAllItem.value]: allSelected
36569
- };
36570
- setSelectedAttributes(updatedAttributes);
36571
-
36572
- // Also notify parent of the change with new efficient structure
36573
- const filterData = createFilterData(updatedAttributes);
36574
- onCheck({
36575
- changedItem: 'selectAll',
36576
- filterData: filterData,
36577
- allItems: updatedAttributes
36578
- });
36579
- }
36580
- }, [Object.keys(selectedAttributes).filter(key => key !== 'All').map(key => selectedAttributes[key]).join(',')]);
36581
36551
  const handleReset = () => {
36582
36552
  // Reset to the original default state (all selected)
36583
36553
  const resetState = createInitialState();
36584
- setSelectedAttributes(resetState);
36585
36554
 
36586
36555
  // Call the onReset callback
36587
36556
  onReset();
@@ -36624,7 +36593,8 @@ const FilterPop = props => {
36624
36593
  })];
36625
36594
  return /*#__PURE__*/React$1.createElement(FilterPopContainer, {
36626
36595
  width: width,
36627
- height: height
36596
+ height: height,
36597
+ accentColor: color // Pass color as prop to styled component
36628
36598
  }, /*#__PURE__*/React$1.createElement(Title$5, null, menuName), /*#__PURE__*/React$1.createElement(CheckboxGroup, {
36629
36599
  style: {
36630
36600
  display: doubleColumn ? 'grid' : 'flex',
@@ -36634,19 +36604,29 @@ const FilterPop = props => {
36634
36604
  }, sortedList.map(item => {
36635
36605
  const isSelectAll = item.value === 'All';
36636
36606
  const checkboxProps = isSelectAll ? getSelectAllCheckboxProps() : {};
36607
+ const isChecked = isSelectAll ? checkboxProps.checked : selectedAttributes[item.value] || false;
36637
36608
  return /*#__PURE__*/React$1.createElement(CheckboxLabel, {
36638
36609
  width: !doubleColumn ?? width,
36639
- key: item.value
36610
+ key: `${item.value}-${JSON.stringify(selectedAttributes)}`
36640
36611
  }, /*#__PURE__*/React$1.createElement("input", {
36641
36612
  type: "checkbox",
36642
- checked: isSelectAll ? checkboxProps.checked : selectedAttributes[item.value] || false,
36643
- style: {
36644
- accentColor: color
36613
+ checked: isChecked,
36614
+ ref: el => {
36615
+ if (el) {
36616
+ // Handle indeterminate for Select All FIRST
36617
+ if (isSelectAll) {
36618
+ el.indeterminate = checkboxProps.indeterminate;
36619
+ }
36620
+
36621
+ // FORCE DOM SYNC - manually set DOM state to match React state
36622
+ if (el.checked !== isChecked) {
36623
+ el.checked = isChecked;
36624
+ }
36625
+ }
36645
36626
  },
36646
- ref: isSelectAll ? el => {
36647
- if (el) el.indeterminate = checkboxProps.indeterminate;
36648
- } : null,
36649
- onChange: () => handleCheckboxChange(item.value)
36627
+ onChange: e => {
36628
+ handleCheckboxChange(item.value);
36629
+ }
36650
36630
  }), /*#__PURE__*/React$1.createElement("span", null, item.label));
36651
36631
  })), /*#__PURE__*/React$1.createElement(ButtonWrapper$2, null, /*#__PURE__*/React$1.createElement(ResetButton$1, {
36652
36632
  onClick: handleReset,
@@ -37240,7 +37220,9 @@ const TableHeader = ({
37240
37220
  // Remove onSort call - we only want to call it when selection is made
37241
37221
  };
37242
37222
  useEffect(() => {
37243
- onFilter(filterState);
37223
+ if (Object.keys(filterState).length > 0) {
37224
+ onFilter(filterState);
37225
+ }
37244
37226
  }, [filterState]);
37245
37227
  const handleFilter = key => {
37246
37228
  const iconElement = iconRefs.current[`filter-${key}`];
@@ -37281,25 +37263,25 @@ const TableHeader = ({
37281
37263
  }
37282
37264
  };
37283
37265
 
37284
- // Handle filter selection changes - Updated to work with new FilterPop data structure
37266
+ // Handle filter selection changes - Updated to work with stateless FilterPop
37285
37267
  const handleFilterSelectionChange = (columnKey, selectionData) => {
37286
- // Store the filter selections (keeping existing structure for UI state)
37287
- setFilterSelections(prev => ({
37288
- ...prev,
37289
- [columnKey]: selectionData.allItems
37290
- }));
37268
+ // Force immediate synchronous update using callback form
37269
+ setFilterSelections(prev => {
37270
+ const updated = {
37271
+ ...prev,
37272
+ [columnKey]: selectionData.allItems
37273
+ };
37274
+ return updated;
37275
+ });
37291
37276
 
37292
- // Update the filter state with the new efficient structure
37293
- const {
37294
- filterData
37295
- } = selectionData;
37277
+ // Also update filter state
37296
37278
  setFilterState(prev => ({
37297
37279
  ...prev,
37298
- [columnKey]: filterData
37280
+ [columnKey]: selectionData.filterData
37299
37281
  }));
37300
37282
  };
37301
37283
 
37302
- // Handle filter reset - Updated to work with new FilterPop data structure
37284
+ // Handle filter reset - Updated to work with stateless FilterPop
37303
37285
  const handleFilterReset = columnKey => {
37304
37286
  const column = columns.find(col => col.key === columnKey);
37305
37287
  if (column && column.filterOptions) {
@@ -37311,6 +37293,8 @@ const TableHeader = ({
37311
37293
  fullList.forEach(item => {
37312
37294
  resetState[item.value] = true;
37313
37295
  });
37296
+
37297
+ // Update filter selections immediately
37314
37298
  setFilterSelections(prev => ({
37315
37299
  ...prev,
37316
37300
  [columnKey]: resetState
@@ -37410,7 +37394,7 @@ const TableHeader = ({
37410
37394
  return isFocused || isActive || hasSelection;
37411
37395
  };
37412
37396
 
37413
- // Update showColumnFilter to use persistent selections
37397
+ // Update showColumnFilter to pass current filterSelections to stateless FilterPop
37414
37398
  const showColumnFilter = column => {
37415
37399
  const {
37416
37400
  key,
@@ -41366,7 +41350,7 @@ const Table = props => {
41366
41350
  return /*#__PURE__*/React$1.createElement(TableWrapper, {
41367
41351
  width: width,
41368
41352
  height: height
41369
- }, /*#__PURE__*/React$1.createElement(NoInfoFound, null, /*#__PURE__*/React$1.createElement(TableTop, null, /*#__PURE__*/React$1.createElement("div", null, /*#__PURE__*/React$1.createElement(Title$7, null, tableTitle), /*#__PURE__*/React$1.createElement(SubTitle, null, "No Events")), showSideButton && /*#__PURE__*/React$1.createElement(Button$1, {
41353
+ }, /*#__PURE__*/React$1.createElement(NoInfoFound, null, /*#__PURE__*/React$1.createElement(TableTop, null, /*#__PURE__*/React$1.createElement("div", null, /*#__PURE__*/React$1.createElement(Title$7, null, tableTitle), /*#__PURE__*/React$1.createElement(SubTitle, null, data.length === 0 ? 'No Events' : `${counter} Events`)), showSideButton && /*#__PURE__*/React$1.createElement(Button$1, {
41370
41354
  height: "45px",
41371
41355
  leftIcon: "Plus",
41372
41356
  text: "New Event",
@@ -41374,15 +41358,7 @@ const Table = props => {
41374
41358
  backgroundColor: sideButtonColor,
41375
41359
  hoverBackgroundColor: sideButtonHoverColor,
41376
41360
  onClick: onSideButtonClick
41377
- })), children, data.length === 0 ? /*#__PURE__*/React$1.createElement(NoEventsParent, null, /*#__PURE__*/React$1.createElement(NoEventsWrapper, null, showNoDataInSearch ? /*#__PURE__*/React$1.createElement(NoDataInSearchIcon, null) : /*#__PURE__*/React$1.createElement(NoEvents, null)), /*#__PURE__*/React$1.createElement(NoEventsMessage, null, showNoDataInSearch ? /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement("strong", null, noDataInSearchTitle), /*#__PURE__*/React$1.createElement("br", null), noDataInSearchMessage) : /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement("strong", null, "You haven't created any events yet"), /*#__PURE__*/React$1.createElement("br", null), "Let's get started and create your first one!")), !showNoDataInSearch && /*#__PURE__*/React$1.createElement(Button$1, {
41378
- height: "45px",
41379
- leftIcon: "Plus",
41380
- text: "New Event",
41381
- borderRadius: "12px",
41382
- backgroundColor: buttonColor,
41383
- hoverBackgroundColor: buttonHoverColor,
41384
- onClick: onButtonClick
41385
- })) : /*#__PURE__*/React$1.createElement(TableContainer, {
41361
+ })), children, /*#__PURE__*/React$1.createElement(TableContainer, {
41386
41362
  showHorizontalScroll: showHorizontalScroll
41387
41363
  }, /*#__PURE__*/React$1.createElement(TableBodyScrollWrapper, {
41388
41364
  tableBodyHeight: tableBodyHeight,
@@ -41400,6 +41376,14 @@ const Table = props => {
41400
41376
  onSendClick: onSendClick,
41401
41377
  onDeleteClick: onDeleteClick,
41402
41378
  buttonColor: buttonColor
41379
+ })), data.length === 0 && /*#__PURE__*/React$1.createElement(NoEventsParent, null, /*#__PURE__*/React$1.createElement(NoEventsWrapper, null, showNoDataInSearch ? /*#__PURE__*/React$1.createElement(NoDataInSearchIcon, null) : /*#__PURE__*/React$1.createElement(NoEvents, null)), /*#__PURE__*/React$1.createElement(NoEventsMessage, null, showNoDataInSearch ? /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement("strong", null, noDataInSearchTitle), /*#__PURE__*/React$1.createElement("br", null), noDataInSearchMessage) : /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement("strong", null, "You haven't created any events yet"), /*#__PURE__*/React$1.createElement("br", null), "Let's get started and create your first one!")), !showNoDataInSearch && /*#__PURE__*/React$1.createElement(Button$1, {
41380
+ height: "45px",
41381
+ leftIcon: "Plus",
41382
+ text: "New Event",
41383
+ borderRadius: "12px",
41384
+ backgroundColor: buttonColor,
41385
+ hoverBackgroundColor: buttonHoverColor,
41386
+ onClick: onButtonClick
41403
41387
  }))), isLoading && /*#__PURE__*/React$1.createElement(LoadingWrapper, null, /*#__PURE__*/React$1.createElement(Lottie, {
41404
41388
  style: {
41405
41389
  width: "24px",
@@ -41415,7 +41399,7 @@ const Card = styled.div`
41415
41399
  border-radius: 8px;
41416
41400
  /* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); */
41417
41401
  text-align: center;
41418
- overflow: hidden;
41402
+ /* overflow: hidden; */ // If hidden the tooltip will not be visible
41419
41403
  width: ${props => props.width || "auto"};
41420
41404
  height: ${props => props.height || "auto"};
41421
41405
  margin: 0 auto;
@@ -41434,8 +41418,9 @@ const SectionTitle$1 = styled.div`
41434
41418
  `;
41435
41419
  const SubtitleContainer = styled.div`
41436
41420
  display: flex;
41437
- align-items: flex-start;
41438
- gap: 8px;
41421
+ align-items: center;
41422
+ gap: 6px;
41423
+ color: #8B8989;
41439
41424
  `;
41440
41425
  const Subtitle$1 = styled.span`
41441
41426
  color: ${props => props.color};
@@ -41534,10 +41519,6 @@ const LineContainer = styled.div`
41534
41519
  width: 100%;
41535
41520
  `;
41536
41521
  const ButtonContainer$1 = styled.div`
41537
- display: flex;
41538
- justify-content: flex-end;
41539
- flex-direction: column;
41540
- gap: 5px;
41541
41522
  margin-top: 16px;
41542
41523
  .ButtonContainer {
41543
41524
  label {
@@ -41545,6 +41526,16 @@ const ButtonContainer$1 = styled.div`
41545
41526
  }
41546
41527
  }
41547
41528
  `;
41529
+ const CustomTooltip = styled(Tooltip$2)`
41530
+ .controls {
41531
+ padding: 12px 16px;
41532
+ font-size: 14px;
41533
+ left: 0;
41534
+ &::before {
41535
+ left: 90%;
41536
+ }
41537
+ }
41538
+ `;
41548
41539
  const Container$1 = styled.div`
41549
41540
  display: flex;
41550
41541
  align-items: center;
@@ -42096,7 +42087,7 @@ styled.div`
42096
42087
  margin-top: 24px;
42097
42088
  margin-left: 8px;
42098
42089
  `;
42099
- const Divider$1 = styled.div`
42090
+ const Divider = styled.div`
42100
42091
  height: 1px;
42101
42092
  background-color: #e2e2e2;
42102
42093
  margin: 16px 0;
@@ -42169,7 +42160,7 @@ const NewSubitem = ({
42169
42160
  type: "primary",
42170
42161
  backgroundColor: linkColor,
42171
42162
  hoverTextColor: "#212121"
42172
- })), /*#__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", {
42163
+ })), /*#__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", {
42173
42164
  style: {
42174
42165
  color: "red"
42175
42166
  }
@@ -42203,47 +42194,34 @@ const NewSubitem = ({
42203
42194
  };
42204
42195
 
42205
42196
  const Overlay$1 = styled.div`
42206
- display: flex;
42207
- flex-direction: column;
42197
+ font-family: Poppins;
42208
42198
  background: #f7f8fa;
42209
42199
  width: ${props => props.width || "100%"};
42210
42200
  height: ${props => props.height || "100%"};
42211
42201
  overflow: hidden;
42202
+ text-align: left;
42212
42203
  `;
42213
- const Dialog = styled.div`
42214
- background: #fff;
42215
- border-radius: 12px;
42216
- height: 100%;
42217
- padding: 32px 24px;
42204
+ const HeaderContainer = styled.div`
42205
+ color: #212121;
42206
+ padding: 40px 16px;
42207
+ border-bottom: 1px solid #e2e2e2;
42218
42208
  `;
42219
- const Title$1 = styled.h2`
42220
- color: var(--Text-Primary, #212121);
42221
- font-feature-settings: "liga" off;
42222
- /* Headings/H3 Medium */
42223
- font-family: Poppins;
42209
+ const Title$1 = styled.h5`
42224
42210
  font-size: 32px;
42225
- font-style: normal;
42226
42211
  font-weight: 700;
42227
- line-height: normal;
42212
+ margin: 0 0 20px;
42228
42213
  `;
42229
42214
  const Subtitle = styled.p`
42230
- color: var(--Text-Primary, #212121);
42231
- font-feature-settings: "liga" off;
42232
- /* Headings/H6 Regular */
42233
- font-family: Poppins;
42234
42215
  font-size: 18px;
42235
- font-style: normal;
42236
42216
  font-weight: 400;
42237
- line-height: normal;
42217
+ margin: 0 0 20px;
42238
42218
  `;
42239
- const VendorSection = styled.div`
42240
- margin-bottom: 20px;
42219
+ const Dialog = styled.div`
42220
+ background: #fff;
42241
42221
  `;
42242
- const Divider = styled.div`
42243
- height: 1px;
42244
- background-color: #e2e2e2;
42245
- margin: 16px 0;
42246
- width: 100%;
42222
+ const VendorSection = styled.div`
42223
+ padding: 16px;
42224
+ border-bottom: 1px solid #e2e2e2;
42247
42225
  `;
42248
42226
  const Item = styled.li`
42249
42227
  color: black; /* text color */
@@ -42264,12 +42242,8 @@ const VendorName = styled.span`
42264
42242
  margin-right: 10px;
42265
42243
  overflow: hidden;
42266
42244
  color: #000;
42267
-
42268
- font-family: Poppins;
42269
42245
  font-size: 16px;
42270
- font-style: normal;
42271
42246
  font-weight: 500;
42272
- line-height: normal;
42273
42247
  `;
42274
42248
  const NewBadge = styled.span`
42275
42249
  background: #ffe2b6;
@@ -42277,40 +42251,23 @@ const NewBadge = styled.span`
42277
42251
  border-radius: 16px;
42278
42252
  padding: 2px 10px;
42279
42253
  margin-left: 4px;
42280
- color: #000;
42281
- font-feature-settings: "liga" off;
42282
- font-family: Poppins;
42283
42254
  font-size: 14px;
42284
- font-style: normal;
42285
42255
  font-weight: 500;
42286
- line-height: normal;
42287
42256
  `;
42288
42257
  const PackageList = styled.ul`
42289
42258
  margin: 0 0 0 16px;
42290
42259
  padding: 0;
42291
42260
  gap: 30px;
42292
42261
  list-style: disc;
42293
- color: #888;
42294
- color: var(--General-Black, #212121);
42295
- font-feature-settings: "liga" off;
42296
- font-family: Poppins;
42297
42262
  font-size: 14px;
42298
- font-style: normal;
42299
42263
  font-weight: 400;
42300
- line-height: normal;
42301
42264
  `;
42302
42265
  const ButtonRow = styled.div`
42303
42266
  display: flex;
42304
- justify-content: flex-start;
42305
42267
  gap: 12px;
42306
- flex-direction: row;
42268
+ justify-content: flex-start;
42307
42269
  align-items: center;
42308
42270
  `;
42309
- const HeaderContainer = styled.div`
42310
- display: flex;
42311
- flex-direction: column;
42312
- padding: 16px;
42313
- `;
42314
42271
 
42315
42272
  const ConfirmationDialog = ({
42316
42273
  width,
@@ -42321,39 +42278,43 @@ const ConfirmationDialog = ({
42321
42278
  linkColor
42322
42279
  }) => {
42323
42280
  const totalNew = vendors.reduce((sum, v) => sum + (v.newPackages?.length || 0), 0);
42281
+ const confirmationText = `You are about to send the following
42282
+ ${totalNew} new ${totalNew === 1 ? 'package' : 'packages'} to
42283
+ ${vendors.length} ${vendors.length === 1 ? 'vendor' : 'vendors'}:`;
42324
42284
  return /*#__PURE__*/React$1.createElement(Overlay$1, {
42325
42285
  width: width,
42326
42286
  height: height
42327
- }, /*#__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, {
42287
+ }, /*#__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, {
42328
42288
  leftIcon: "none",
42329
42289
  onClick: onCancel,
42330
42290
  rightIcon: "none",
42331
- size: "small",
42291
+ size: "",
42332
42292
  text: "Cancel",
42333
42293
  type: "secondary"
42334
42294
  }), /*#__PURE__*/React$1.createElement(Button$1, {
42335
42295
  leftIcon: "none",
42336
42296
  onClick: onConfirm,
42337
42297
  rightIcon: "none",
42338
- size: "small",
42298
+ size: "",
42339
42299
  text: "Confirm & Send",
42340
42300
  type: "primary",
42301
+ borderColor: linkColor,
42341
42302
  backgroundColor: linkColor,
42342
42303
  hoverTextColor: "#212121"
42343
42304
  }))), /*#__PURE__*/React$1.createElement(Dialog, null, vendors.map((vendor, idx) => /*#__PURE__*/React$1.createElement(VendorSection, {
42344
42305
  key: vendor.name
42345
42306
  }, /*#__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, {
42346
42307
  key: i
42347
- }, pkg))), /*#__PURE__*/React$1.createElement(Divider, null)))));
42308
+ }, pkg)))))));
42348
42309
  };
42349
42310
 
42350
42311
  const SuccessScreenContainer = styled.div`
42351
- display: flex;
42352
- flex-direction: column;
42312
+ font-family: Poppins;
42353
42313
  background:rgb(255, 255, 255);
42354
42314
  width: ${props => props.width || "100%"};
42355
42315
  height: ${props => props.height || "100%"};
42356
42316
  overflow: hidden;
42317
+ text-align: left;
42357
42318
  `;
42358
42319
  const SuccessHeader = styled.div`
42359
42320
  display: flex;
@@ -42361,29 +42322,19 @@ const SuccessHeader = styled.div`
42361
42322
  align-items: center;
42362
42323
  justify-content: center;
42363
42324
  `;
42364
- const SuccessTitle = styled.h2`
42365
- color: var(--Text-Primary, #212121);
42366
- text-align: center;
42367
- font-feature-settings: 'liga' off;
42368
-
42369
- /* Headings/H3 Medium */
42370
- font-family: Poppins;
42371
- font-size: 32px;
42372
- font-style: normal;
42373
- font-weight: 700;
42374
- line-height: normal;
42325
+ const SuccessTitle = styled.h5`
42326
+ color: #212121;
42327
+ text-align: center;
42328
+ font-size: 32px;
42329
+ font-weight: 700;
42330
+ margin: 0 0 20px;
42375
42331
  `;
42376
42332
  const SuccessSubtitle = styled.p`
42377
42333
  margin-bottom: 24px;
42378
42334
  text-align: center;
42379
- color: var(--Text-Primary, #212121);
42380
- font-feature-settings: 'liga' off;
42381
- /* Content/P1 Regular */
42382
- font-family: Poppins;
42335
+ color: #212121;
42383
42336
  font-size: 16px;
42384
- font-style: normal;
42385
42337
  font-weight: 400;
42386
- line-height: normal;
42387
42338
  `;
42388
42339
  styled.div`
42389
42340
  display: flex;
@@ -50857,8 +50808,6 @@ const SuccessScreen = ({
50857
50808
  }, vendor, /*#__PURE__*/React$1.createElement("br", null)))))));
50858
50809
  };
50859
50810
 
50860
- // Removed TypeScript interface and type annotations
50861
-
50862
50811
  const ItemManagerPanel = _ref => {
50863
50812
  let {
50864
50813
  width = "100%",
@@ -50871,7 +50820,7 @@ const ItemManagerPanel = _ref => {
50871
50820
  setItemAndPackage,
50872
50821
  linkColor = "#212121",
50873
50822
  backgroundColor = 'white',
50874
- onDelete = () => {}
50823
+ buttonTooltipText = "Please fill out all forms before sending."
50875
50824
  } = _ref;
50876
50825
  const [screen, setScreen] = useState("initial");
50877
50826
  const [selectedVendor, setSelectedVendor] = useState(null);
@@ -50904,9 +50853,6 @@ const ItemManagerPanel = _ref => {
50904
50853
  });
50905
50854
  setScreen("subitem");
50906
50855
  };
50907
- const handleBackToDefault = () => {
50908
- setScreen("");
50909
- };
50910
50856
  const onDeleteVendor = vendor => {
50911
50857
  const updatedItemAndPackage = itemAndPackage.filter(item => item.name !== vendor.name);
50912
50858
  setItemAndPackage([...updatedItemAndPackage, {
@@ -50914,6 +50860,21 @@ const ItemManagerPanel = _ref => {
50914
50860
  packages: null
50915
50861
  }]);
50916
50862
  };
50863
+ const hasUnisentPackages = useMemo(() => {
50864
+ return itemAndPackage.some(vendor => {
50865
+ if (vendor.packages === null || !Array.isArray(vendor.packages)) {
50866
+ return false;
50867
+ }
50868
+ return vendor.packages.some(pkg => !pkg.hasOwnProperty('status') || pkg.status == null || pkg.status === undefined || pkg.status === '');
50869
+ });
50870
+ }, [itemAndPackage]);
50871
+ const actuallyAllFormsSent = AllFormsSent && !hasUnisentPackages;
50872
+ useEffect(() => {
50873
+ if (screen === "success" && onSendForms) {
50874
+ onSendForms();
50875
+ }
50876
+ }, [screen]); // Only run when screen changes
50877
+
50917
50878
  if (screen === "subitem") {
50918
50879
  return /*#__PURE__*/React$1.createElement(Card, {
50919
50880
  width: width,
@@ -50934,8 +50895,9 @@ const ItemManagerPanel = _ref => {
50934
50895
  return /*#__PURE__*/React$1.createElement(ConfirmationDialog, {
50935
50896
  width: width,
50936
50897
  height: height,
50937
- onCancel: () => setScreen(undefined),
50898
+ onCancel: () => setScreen("initial"),
50938
50899
  onConfirm: () => setScreen("success"),
50900
+ linkColor: linkColor,
50939
50901
  vendors: itemAndPackage.filter(item => item.packages !== null).map(item => {
50940
50902
  return {
50941
50903
  name: item.name,
@@ -50945,9 +50907,6 @@ const ItemManagerPanel = _ref => {
50945
50907
  });
50946
50908
  }
50947
50909
  if (screen === "success") {
50948
- if (onSendForms) {
50949
- onSendForms();
50950
- }
50951
50910
  return /*#__PURE__*/React$1.createElement(SuccessScreen, {
50952
50911
  width: width,
50953
50912
  height: height,
@@ -50976,7 +50935,7 @@ const ItemManagerPanel = _ref => {
50976
50935
  height: height,
50977
50936
  backgroundColor: backgroundColor
50978
50937
  }, /*#__PURE__*/React$1.createElement(NewItemList, {
50979
- onBack: handleBackToDefault,
50938
+ onBack: () => setScreen("initial"),
50980
50939
  itemAndPackage: itemAndPackage,
50981
50940
  onVendorClick: handleVendorClick
50982
50941
  }));
@@ -50986,7 +50945,12 @@ const ItemManagerPanel = _ref => {
50986
50945
  width: width,
50987
50946
  height: height,
50988
50947
  backgroundColor: backgroundColor
50989
- }, /*#__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, {
50948
+ }, /*#__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, {
50949
+ hideTooltip: !disabledSendForms,
50950
+ content: buttonTooltipText,
50951
+ topFactor: 2,
50952
+ direction: "bottom"
50953
+ }, /*#__PURE__*/React$1.createElement(Button$1, {
50990
50954
  leftIcon: "Fly",
50991
50955
  onClick: () => setScreen("confirmation"),
50992
50956
  rightIcon: "none",
@@ -50994,10 +50958,12 @@ const ItemManagerPanel = _ref => {
50994
50958
  size: "small",
50995
50959
  text: "Send Forms",
50996
50960
  type: "secondary",
50997
- borderRadius: "8px"
50998
- }), /*#__PURE__*/React$1.createElement(Subtitle$1, {
50999
- color: AllFormsSent ? "#90CE9C" : "#8b8989"
51000
- }, 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, {
50961
+ borderRadius: "8px",
50962
+ borderColor: linkColor,
50963
+ textColor: linkColor
50964
+ })), /*#__PURE__*/React$1.createElement(Subtitle$1, {
50965
+ color: actuallyAllFormsSent ? "#90CE9C" : "#8b8989"
50966
+ }, 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, {
51001
50967
  leftIcon: "Plus",
51002
50968
  onClick: () => setScreen("list"),
51003
50969
  rightIcon: "none",
@@ -51129,7 +51095,7 @@ const DropdownButton = styled.button`
51129
51095
  justify-content: space-between;
51130
51096
  ${props => props.disabled && css`
51131
51097
  color:#8B8989;
51132
- background-color: #D0D0D0;
51098
+ /* background-color: #D0D0D0; */
51133
51099
  cursor: not-allowed;
51134
51100
  `}
51135
51101
  `;