sag_components 2.0.0-beta137 → 2.0.0-beta138

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1508,25 +1508,11 @@ declare function ToasterMessageBox({ color, messageText, linkText, duration, wid
1508
1508
  onClose?: () => void;
1509
1509
  }): react_jsx_runtime.JSX.Element;
1510
1510
 
1511
- declare function EventStatusCards({ statusData, onStatusToggle, disabled, width, }: {
1512
- statusData?: any[];
1513
- onStatusToggle?: () => void;
1514
- disabled?: boolean;
1511
+ declare function EventStatusCards({ data, onCardToggle, width, }: {
1512
+ data?: any[];
1513
+ onCardToggle?: () => void;
1515
1514
  width?: string;
1516
- }): react_jsx_runtime.JSX.Element;
1517
- declare namespace EventStatusCards {
1518
- namespace propTypes {
1519
- const statusData: PropTypes.Requireable<PropTypes.InferProps<{
1520
- status: PropTypes.Validator<string>;
1521
- count: PropTypes.Validator<number>;
1522
- checked: PropTypes.Validator<boolean>;
1523
- color: PropTypes.Validator<string>;
1524
- }>[]>;
1525
- const onStatusToggle: PropTypes.Requireable<(...args: any[]) => any>;
1526
- const disabled: PropTypes.Requireable<boolean>;
1527
- const width: PropTypes.Requireable<string>;
1528
- }
1529
- }
1515
+ }): react_jsx_runtime.JSX.Element;
1530
1516
 
1531
1517
  declare function RangePicker({ label, onChange, borderRadius, required, width, height, placeholder, disabled, borderColor, borderColorFocus, textColor, selectedValue, }: {
1532
1518
  label: any;
package/dist/index.esm.js CHANGED
@@ -23903,22 +23903,21 @@ const DeleteIcon = styled.div`
23903
23903
  position: absolute;
23904
23904
  `;
23905
23905
 
23906
- const QuickFilterDropdownSingle = _ref => {
23907
- let {
23908
- label,
23909
- hoverColor,
23910
- options,
23911
- selectedValue,
23912
- placeHolder,
23913
- onChange,
23914
- disabled,
23915
- width,
23916
- error,
23917
- errorMessage,
23918
- xIconShow,
23919
- labelColor,
23920
- showLabelOnTop
23921
- } = _ref;
23906
+ const QuickFilterDropdownSingle = ({
23907
+ label,
23908
+ hoverColor,
23909
+ options,
23910
+ selectedValue,
23911
+ placeHolder,
23912
+ onChange,
23913
+ disabled,
23914
+ width,
23915
+ error,
23916
+ errorMessage,
23917
+ xIconShow,
23918
+ labelColor,
23919
+ showLabelOnTop
23920
+ }) => {
23922
23921
  const [isFocused, setIsFocused] = useState(false);
23923
23922
  const [showOptions, setShowOptions] = useState(false);
23924
23923
  const [inputValue, setInputValue] = useState("");
@@ -24315,24 +24314,23 @@ const IconContainer$2 = styled.div`
24315
24314
  cursor: pointer;
24316
24315
  `;
24317
24316
 
24318
- const QuickFilterDropdownMultiSelection = _ref => {
24319
- let {
24320
- label,
24321
- labelEmptyValue,
24322
- options,
24323
- selectedValue,
24324
- placeHolder,
24325
- onChange,
24326
- required,
24327
- disabled,
24328
- width,
24329
- error,
24330
- errorMessage,
24331
- labelColor,
24332
- xIconShow,
24333
- checkBoxColor,
24334
- showLabelOnTop
24335
- } = _ref;
24317
+ const QuickFilterDropdownMultiSelection = ({
24318
+ label,
24319
+ labelEmptyValue,
24320
+ options,
24321
+ selectedValue,
24322
+ placeHolder,
24323
+ onChange,
24324
+ required,
24325
+ disabled,
24326
+ width,
24327
+ error,
24328
+ errorMessage,
24329
+ labelColor,
24330
+ xIconShow,
24331
+ checkBoxColor,
24332
+ showLabelOnTop
24333
+ }) => {
24336
24334
  const [isFocused, setIsFocused] = useState(false);
24337
24335
  const [showOptions, setShowOptions] = useState(false);
24338
24336
  const [inputValue, setInputValue] = useState('');
@@ -36860,7 +36858,7 @@ const TruncatedText$1 = styled.span`
36860
36858
  text-overflow: ellipsis;
36861
36859
  font-size: 14px;
36862
36860
  `;
36863
- const Checkmark$1 = styled.span`
36861
+ const Checkmark = styled.span`
36864
36862
  color: ${props => props.color};
36865
36863
  margin-left: 8px;
36866
36864
  font-weight: bold;
@@ -36959,7 +36957,7 @@ const SortPop = props => {
36959
36957
  onClick: () => {
36960
36958
  handleChange(item);
36961
36959
  }
36962
- }, /*#__PURE__*/React$1.createElement(TruncatedText$1, null, item.label), item.value === value && /*#__PURE__*/React$1.createElement(Checkmark$1, {
36960
+ }, /*#__PURE__*/React$1.createElement(TruncatedText$1, null, item.label), item.value === value && /*#__PURE__*/React$1.createElement(Checkmark, {
36963
36961
  color: color
36964
36962
  }, "\u2713")))), /*#__PURE__*/React$1.createElement(ButtonWrapper$1, null, /*#__PURE__*/React$1.createElement(ResetButton, {
36965
36963
  onClick: handleReset,
@@ -41654,7 +41652,6 @@ const VendorName$2 = styled.div`
41654
41652
  color: #212121;
41655
41653
  font-size: 16px;
41656
41654
  font-weight: 500;
41657
- text-align: left;
41658
41655
  `;
41659
41656
  styled.div`
41660
41657
  color: #b0b0b0;
@@ -51101,18 +51098,12 @@ const ItemManagerPanel = _ref => {
51101
51098
  };
51102
51099
  const hasUnisentPackages = useMemo(() => {
51103
51100
  return itemAndPackage.some(vendor => {
51104
- // In edit mode, treat packages: null as unsent
51105
- if (editMode && vendor.packages === null) {
51106
- return true; // This vendor has unsent items
51107
- }
51108
-
51109
- // Original logic for other cases
51110
51101
  if (vendor.packages === null || !Array.isArray(vendor.packages)) {
51111
51102
  return false;
51112
51103
  }
51113
51104
  return vendor.packages.some(pkg => !pkg.hasOwnProperty('status') || pkg.status == null || pkg.status === undefined || pkg.status === '');
51114
51105
  });
51115
- }, [itemAndPackage, editMode]);
51106
+ }, [itemAndPackage]);
51116
51107
  const actuallyAllFormsSent = AllFormsSent && !hasUnisentPackages;
51117
51108
  useEffect(() => {
51118
51109
  if (screen === "success" && onSendForms) {
@@ -51248,28 +51239,22 @@ const ItemManagerPanel = _ref => {
51248
51239
  }))), /*#__PURE__*/React$1.createElement(VendorListWrapper$2, {
51249
51240
  disabled: disableSection,
51250
51241
  headerHeight: headerHeight
51251
- }, /*#__PURE__*/React$1.createElement(VendorList$2, null, itemAndPackage.filter(item => {
51252
- // In edit mode, show vendors with packages: null as well
51253
- if (editMode && item.packages === null) {
51254
- return true;
51255
- }
51256
- // Original logic: show only vendors with packages !== null
51257
- return item.packages !== null;
51258
- }).map((item, idx) => /*#__PURE__*/React$1.createElement(VendorItem$1, {
51242
+ }, /*#__PURE__*/React$1.createElement(VendorList$2, null, itemAndPackage.filter(item => item.packages !== null).map((item, idx) => /*#__PURE__*/React$1.createElement(VendorItem$1, {
51259
51243
  key: idx
51260
- }, /*#__PURE__*/React$1.createElement(DotContainer, null, item.packages === null && editMode || Array.isArray(item.packages) && item.packages.length === 0 ? /*#__PURE__*/React$1.createElement(RedDot, null) : null), /*#__PURE__*/React$1.createElement(LineContainer, {
51244
+ }, /*#__PURE__*/React$1.createElement(DotContainer, null, item.packages.length === 0 && /*#__PURE__*/React$1.createElement(RedDot, null)), /*#__PURE__*/React$1.createElement(LineContainer, {
51261
51245
  onClick: e => {
51262
51246
  handleVendorClick(item);
51263
51247
  }
51264
- }, /*#__PURE__*/React$1.createElement(VendorNameAndPackagesContainer$1, null, /*#__PURE__*/React$1.createElement(VendorName$2, null, item.name), editMode && item.packages === null && /*#__PURE__*/React$1.createElement(Subtitle$1, null, "Not configured"), Array.isArray(item.packages) && item.packages.length === 0 && /*#__PURE__*/React$1.createElement(Subtitle$1, null, "No Packages"), Array.isArray(item.packages) && item.packages.length > 0 && /*#__PURE__*/React$1.createElement(Subtitle$1, null, (() => {
51265
- const packagesWithStatus = item.packages.filter(pkg => pkg.hasOwnProperty('status') && pkg.status != null && pkg.status !== undefined && pkg.status !== '' && pkg.status !== 1);
51266
- const string = `Package${item.packages.length > 1 ? 's' : ''} sent`;
51267
- if (packagesWithStatus.length === 0) {
51268
- return `0/${item.packages.length} ${string}`;
51269
- } else if (packagesWithStatus.length === item.packages.length) {
51270
- return `${item.packages.length}/${item.packages.length} ${string}`;
51248
+ }, /*#__PURE__*/React$1.createElement(VendorNameAndPackagesContainer$1, null, /*#__PURE__*/React$1.createElement(VendorName$2, null, item.name), item.packages.length === 0 && /*#__PURE__*/React$1.createElement(Subtitle$1, null, "No Packages"), item.packages.length > 0 && /*#__PURE__*/React$1.createElement(Subtitle$1, null, (() => {
51249
+ const packagesWithStatus = item.packages.filter(pkg => pkg.hasOwnProperty('status') && pkg.status != null && pkg.status !== undefined && pkg.status !== '');
51250
+ const allHaveStatus = packagesWithStatus.length === item.packages.length;
51251
+ const noneHaveStatus = packagesWithStatus.length === 0;
51252
+ if (noneHaveStatus) {
51253
+ return `0/${item.packages.length} sent`;
51254
+ } else if (allHaveStatus) {
51255
+ return `${item.packages.length}/${item.packages.length} sent`;
51271
51256
  } else {
51272
- return `${packagesWithStatus.length}/${item.packages.length} ${string}`;
51257
+ return `${packagesWithStatus.length}/${item.packages.length} sent`;
51273
51258
  }
51274
51259
  })())), /*#__PURE__*/React$1.createElement(VendorChevron$1, null, /*#__PURE__*/React$1.createElement(ArrowRightFullIcon, null))), /*#__PURE__*/React$1.createElement(Trash$1, {
51275
51260
  className: "trash-icon",
@@ -52389,7 +52374,7 @@ const CardsContainer = styled.div`
52389
52374
  const StatusCard = styled.div`
52390
52375
  position: relative;
52391
52376
  background-color: white;
52392
- border-bottom: 3px solid ${props => props.isSelected ? props.borderColor : '#E0E0E0'};
52377
+ border-bottom: ${props => props.isSelected ? `3px solid ${props.borderColor}` : 'none'};
52393
52378
  border-radius: 12px;
52394
52379
  padding: 12px 16px;
52395
52380
  flex-grow: 1;
@@ -52401,6 +52386,27 @@ const CardHeader = styled.div`
52401
52386
  align-items: center;
52402
52387
  margin-bottom: 10px;
52403
52388
  `;
52389
+ const CheckmarkContainer = styled.div`
52390
+ width: 17px;
52391
+ height: 17px;
52392
+ border: 2px solid #212121;
52393
+ border-radius: 4px;
52394
+ display: flex;
52395
+ align-items: center;
52396
+ justify-content: center;
52397
+ margin-left: auto;
52398
+ color: white;
52399
+ transition: background-color .15s ease, border-color .15s ease;
52400
+ pointer-events: none;
52401
+
52402
+ &.checked {
52403
+ background-color: #066768;
52404
+ border-color: #066768;
52405
+ }
52406
+
52407
+ svg { display: none; }
52408
+ &.checked svg { display: block; }
52409
+ `;
52404
52410
  const Circle = styled.div`
52405
52411
  width: 16px;
52406
52412
  height: 16px;
@@ -52412,10 +52418,8 @@ const CardTitle = styled.h3`
52412
52418
  margin: 0;
52413
52419
  font-size: 18px;
52414
52420
  font-weight: 500;
52415
- color: ${props => props.isSelected ? props.color : '#666666'};
52416
- transition: color 0.2s ease-in-out;
52417
52421
  `;
52418
- const Checkmark = styled.input`
52422
+ styled.input`
52419
52423
  width: 16px;
52420
52424
  height: 16px;
52421
52425
  accent-color: #066768;
@@ -52429,102 +52433,68 @@ const CardContent = styled.div`
52429
52433
  flex-direction: column;
52430
52434
  align-items: flex-start;
52431
52435
  `;
52432
- const StatusCount = styled.h4`
52436
+ const StatusCount = styled.span`
52433
52437
  font-size: 32px;
52434
52438
  font-weight: 500;
52435
- color: ${props => props.isSelected ? props.color : '#999999'};
52436
52439
  line-height: 1;
52437
- margin: 0;
52438
- transition: color 0.2s ease-in-out;
52439
52440
  `;
52440
52441
 
52441
52442
  const EventStatusCards = _ref => {
52442
52443
  let {
52443
- statusData = [],
52444
- onStatusToggle = () => {},
52445
- disabled = false,
52444
+ data = [],
52445
+ onCardToggle = () => {},
52446
52446
  width = "100%"
52447
52447
  } = _ref;
52448
- // Default data structure if no data provided
52449
- const defaultStatusData = [{
52450
- status: "Pending",
52451
- count: 0,
52452
- checked: true,
52453
- color: "#F5C9A7"
52454
- }, {
52455
- status: "Received",
52456
- count: 0,
52457
- checked: true,
52458
- color: "#B9D5D5"
52459
- }, {
52460
- status: "Approved",
52461
- count: 0,
52462
- checked: true,
52463
- color: "#BEDDC3"
52464
- }, {
52465
- status: "Cancelled",
52466
- count: 0,
52467
- checked: true,
52468
- color: "#EBA6AF"
52469
- }];
52470
- const displayData = statusData.length > 0 ? statusData : defaultStatusData;
52448
+ // local mirror so UI updates immediately even if parent is slow/not controlling
52449
+ const [items, setItems] = useState(data);
52450
+ useEffect(() => setItems(data), [data]);
52471
52451
  const handleCardClick = status => {
52472
- if (disabled) return;
52473
- const updatedData = displayData.map(item => item.status === status ? {
52474
- ...item,
52475
- checked: !item.checked
52476
- } : item);
52477
- const clickedItem = displayData.find(item => item.status === status);
52478
- onStatusToggle(updatedData, status, !clickedItem.checked);
52452
+ setItems(prev => {
52453
+ const clicked = prev.find(i => i.status === status);
52454
+ const nextChecked = clicked ? !clicked.checked : true;
52455
+ const next = prev.map(i => i.status === status ? {
52456
+ ...i,
52457
+ checked: nextChecked
52458
+ } : i);
52459
+ onCardToggle(next, status, nextChecked);
52460
+ return next;
52461
+ });
52479
52462
  };
52480
52463
  return /*#__PURE__*/React$1.createElement(CardsContainer, {
52481
52464
  width: width,
52482
52465
  className: "EventStatusCardsContainer"
52483
- }, displayData.map(item => {
52484
- const {
52466
+ }, items.map(_ref2 => {
52467
+ let {
52485
52468
  status,
52486
52469
  count,
52487
52470
  checked,
52488
52471
  color
52489
- } = item;
52472
+ } = _ref2;
52490
52473
  return /*#__PURE__*/React$1.createElement(StatusCard, {
52491
52474
  key: status,
52492
52475
  className: `StatusCard StatusCard-${status}`,
52493
52476
  isSelected: checked,
52494
52477
  borderColor: color,
52495
- disabled: disabled,
52496
- onClick: () => handleCardClick(status),
52497
- "data-testid": `status-card-${status.toLowerCase()}`
52478
+ onClick: () => handleCardClick(status)
52498
52479
  }, /*#__PURE__*/React$1.createElement(CardHeader, null, /*#__PURE__*/React$1.createElement(Circle, {
52499
52480
  color: color
52500
- }), /*#__PURE__*/React$1.createElement(CardTitle, {
52501
- isSelected: checked,
52502
- color: color
52503
- }, status), /*#__PURE__*/React$1.createElement(Checkmark, {
52504
- type: "checkbox",
52505
- checked: checked,
52506
- readOnly: true
52507
- })), /*#__PURE__*/React$1.createElement(CardContent, null, /*#__PURE__*/React$1.createElement(StatusCount, {
52481
+ }), /*#__PURE__*/React$1.createElement(CardTitle, null, status), /*#__PURE__*/React$1.createElement(CheckmarkContainer, {
52482
+ className: checked ? "checked" : ""
52483
+ }, checked && /*#__PURE__*/React$1.createElement("svg", {
52484
+ width: "14",
52485
+ height: "14",
52486
+ viewBox: "0 0 20 20",
52487
+ fill: "currentColor"
52488
+ }, /*#__PURE__*/React$1.createElement("path", {
52489
+ fillRule: "evenodd",
52490
+ d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",
52491
+ clipRule: "evenodd"
52492
+ })))), /*#__PURE__*/React$1.createElement(CardContent, null, /*#__PURE__*/React$1.createElement(StatusCount, {
52508
52493
  isSelected: checked,
52509
52494
  color: color
52510
52495
  }, count)));
52511
52496
  }));
52512
52497
  };
52513
- EventStatusCards.propTypes = {
52514
- /** Array of status objects with count, checked state, and color information */
52515
- statusData: PropTypes.arrayOf(PropTypes.shape({
52516
- status: PropTypes.oneOf(["Pending", "Received", "Approved", "Cancelled"]).isRequired,
52517
- count: PropTypes.number.isRequired,
52518
- checked: PropTypes.bool.isRequired,
52519
- color: PropTypes.string.isRequired
52520
- })),
52521
- /** Callback function when status selection changes */
52522
- onStatusToggle: PropTypes.func,
52523
- /** Whether the cards are disabled */
52524
- disabled: PropTypes.bool,
52525
- /** Width of the entire cards container */
52526
- width: PropTypes.string
52527
- };
52528
52498
 
52529
52499
  export { AreaChart, BannerEventBoxList, BarChart, BarChartTwoRows, BarChartWithAreaChart, BarChartsByWeeks, BatteryChart, BreakdownPanel, BrushChart, BubbleChart, Build, Button$1 as Button, CollapseData, CollapseHeader, ContainerTable, DialogOverlay$1 as DialogOverlay, DoubleBarSingleLine, DoublePanelDataRow, DownloadProgress, DropdownNew, EventDetailsCard, EventList, EventStatusCards, Execute, FilterPanel, FilterPop, Heatmap, IconButton$1 as IconButton, Input$2 as Input, InsightsCarousel, ItemManagerPanel, LinkButton, LinnerDataBox, MarketShareDescription, MenuRoute, MessageBox, ModalDrawer, ModalWithOverlay, OneColumnContainer, OverlayDropdown, PerformanceAnalyticsLegend, PieChart, PopupCharts, QuickFilter, RangePicker, RangePop, ReportTable, SearchInput, SingleBarLineCharts, SortPop, TabMenu, Table, ToasterMessageBox, ToggleSwitch, Tooltip$2 as Tooltip, TopToggleList, TotalDoughnutChart, TotalHorizontalCharts, Track, TwoBarCharts, WeeksPicker };
52530
52500
  //# sourceMappingURL=index.esm.js.map