sag_components 2.0.0-beta137 → 2.0.0-beta139

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 QuickFilterCards({ 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;
@@ -1579,4 +1565,4 @@ declare namespace RangePicker {
1579
1565
  }
1580
1566
  }
1581
1567
 
1582
- export { AreaChart, BannerEventBoxList, BarChart, BarChartTwoRows, BarChartWithAreaChart, BarChartsByWeeks, BatteryChart, BreakdownPanel, BrushChart, BubbleChart, Build, Button, CollapseData, CollapseHeader, ContainerTable, DialogOverlay, DoubleBarSingleLine, DoublePanelDataRow, DownloadProgress, DropdownNew, EventDetailsCard, EventList, EventStatusCards, Execute, FilterPanel, FilterPop, Heatmap, IconButton, 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, TopToggleList, TotalDoughnutChart, TotalHorizontalCharts, Track, TwoBarCharts, WeeksPicker };
1568
+ export { AreaChart, BannerEventBoxList, BarChart, BarChartTwoRows, BarChartWithAreaChart, BarChartsByWeeks, BatteryChart, BreakdownPanel, BrushChart, BubbleChart, Build, Button, CollapseData, CollapseHeader, ContainerTable, DialogOverlay, DoubleBarSingleLine, DoublePanelDataRow, DownloadProgress, DropdownNew, EventDetailsCard, EventList, Execute, FilterPanel, FilterPop, Heatmap, IconButton, Input, InsightsCarousel, ItemManagerPanel, LinkButton, LinnerDataBox, MarketShareDescription, MenuRoute, MessageBox, ModalDrawer, ModalWithOverlay, OneColumnContainer, OverlayDropdown, PerformanceAnalyticsLegend, PieChart, PopupCharts, QuickFilter, QuickFilterCards, RangePicker, RangePop, ReportTable, SearchInput, SingleBarLineCharts, SortPop, TabMenu, Table, ToasterMessageBox, ToggleSwitch, Tooltip, TopToggleList, TotalDoughnutChart, TotalHorizontalCharts, Track, TwoBarCharts, WeeksPicker };
package/dist/index.esm.js CHANGED
@@ -8710,24 +8710,25 @@ const IconContainer$5 = styled.div`
8710
8710
  cursor: pointer;
8711
8711
  `;
8712
8712
 
8713
- const DropdownSingleNew = ({
8714
- label,
8715
- labelEmptyValue,
8716
- options,
8717
- selectedValue,
8718
- onChange,
8719
- required,
8720
- disabled,
8721
- width,
8722
- withMarginBottom = true,
8723
- error,
8724
- errorMessage,
8725
- xIconShow,
8726
- labelColor,
8727
- showLabelOnTop,
8728
- orderBy,
8729
- elementType
8730
- }) => {
8713
+ const DropdownSingleNew = _ref => {
8714
+ let {
8715
+ label,
8716
+ labelEmptyValue,
8717
+ options,
8718
+ selectedValue,
8719
+ onChange,
8720
+ required,
8721
+ disabled,
8722
+ width,
8723
+ withMarginBottom = true,
8724
+ error,
8725
+ errorMessage,
8726
+ xIconShow,
8727
+ labelColor,
8728
+ showLabelOnTop,
8729
+ orderBy,
8730
+ elementType
8731
+ } = _ref;
8731
8732
  const [isFocused, setIsFocused] = useState(false);
8732
8733
  const [showOptions, setShowOptions] = useState(false);
8733
8734
  const [showAbove, setShowAbove] = useState(false);
@@ -9199,25 +9200,26 @@ const IconContainer$4 = styled.div`
9199
9200
  cursor: pointer;
9200
9201
  `;
9201
9202
 
9202
- const DropdownMultiNew = ({
9203
- label,
9204
- labelEmptyValue,
9205
- options,
9206
- selectedValue,
9207
- onChange,
9208
- required,
9209
- disabled,
9210
- width,
9211
- withMarginBottom = true,
9212
- error,
9213
- errorMessage,
9214
- labelColor,
9215
- xIconShow,
9216
- checkBoxColor,
9217
- showLabelOnTop,
9218
- orderBy,
9219
- elementType
9220
- }) => {
9203
+ const DropdownMultiNew = _ref => {
9204
+ let {
9205
+ label,
9206
+ labelEmptyValue,
9207
+ options,
9208
+ selectedValue,
9209
+ onChange,
9210
+ required,
9211
+ disabled,
9212
+ width,
9213
+ withMarginBottom = true,
9214
+ error,
9215
+ errorMessage,
9216
+ labelColor,
9217
+ xIconShow,
9218
+ checkBoxColor,
9219
+ showLabelOnTop,
9220
+ orderBy,
9221
+ elementType
9222
+ } = _ref;
9221
9223
  const [isFocused, setIsFocused] = useState(false);
9222
9224
  const [showOptions, setShowOptions] = useState(false);
9223
9225
  const [showAbove, setShowAbove] = useState(false);
@@ -36860,7 +36862,7 @@ const TruncatedText$1 = styled.span`
36860
36862
  text-overflow: ellipsis;
36861
36863
  font-size: 14px;
36862
36864
  `;
36863
- const Checkmark$1 = styled.span`
36865
+ const Checkmark = styled.span`
36864
36866
  color: ${props => props.color};
36865
36867
  margin-left: 8px;
36866
36868
  font-weight: bold;
@@ -36959,7 +36961,7 @@ const SortPop = props => {
36959
36961
  onClick: () => {
36960
36962
  handleChange(item);
36961
36963
  }
36962
- }, /*#__PURE__*/React$1.createElement(TruncatedText$1, null, item.label), item.value === value && /*#__PURE__*/React$1.createElement(Checkmark$1, {
36964
+ }, /*#__PURE__*/React$1.createElement(TruncatedText$1, null, item.label), item.value === value && /*#__PURE__*/React$1.createElement(Checkmark, {
36963
36965
  color: color
36964
36966
  }, "\u2713")))), /*#__PURE__*/React$1.createElement(ButtonWrapper$1, null, /*#__PURE__*/React$1.createElement(ResetButton, {
36965
36967
  onClick: handleReset,
@@ -41654,7 +41656,6 @@ const VendorName$2 = styled.div`
41654
41656
  color: #212121;
41655
41657
  font-size: 16px;
41656
41658
  font-weight: 500;
41657
- text-align: left;
41658
41659
  `;
41659
41660
  styled.div`
41660
41661
  color: #b0b0b0;
@@ -51101,18 +51102,12 @@ const ItemManagerPanel = _ref => {
51101
51102
  };
51102
51103
  const hasUnisentPackages = useMemo(() => {
51103
51104
  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
51105
  if (vendor.packages === null || !Array.isArray(vendor.packages)) {
51111
51106
  return false;
51112
51107
  }
51113
51108
  return vendor.packages.some(pkg => !pkg.hasOwnProperty('status') || pkg.status == null || pkg.status === undefined || pkg.status === '');
51114
51109
  });
51115
- }, [itemAndPackage, editMode]);
51110
+ }, [itemAndPackage]);
51116
51111
  const actuallyAllFormsSent = AllFormsSent && !hasUnisentPackages;
51117
51112
  useEffect(() => {
51118
51113
  if (screen === "success" && onSendForms) {
@@ -51248,28 +51243,22 @@ const ItemManagerPanel = _ref => {
51248
51243
  }))), /*#__PURE__*/React$1.createElement(VendorListWrapper$2, {
51249
51244
  disabled: disableSection,
51250
51245
  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, {
51246
+ }, /*#__PURE__*/React$1.createElement(VendorList$2, null, itemAndPackage.filter(item => item.packages !== null).map((item, idx) => /*#__PURE__*/React$1.createElement(VendorItem$1, {
51259
51247
  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, {
51248
+ }, /*#__PURE__*/React$1.createElement(DotContainer, null, item.packages.length === 0 && /*#__PURE__*/React$1.createElement(RedDot, null)), /*#__PURE__*/React$1.createElement(LineContainer, {
51261
51249
  onClick: e => {
51262
51250
  handleVendorClick(item);
51263
51251
  }
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}`;
51252
+ }, /*#__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, (() => {
51253
+ const packagesWithStatus = item.packages.filter(pkg => pkg.hasOwnProperty('status') && pkg.status != null && pkg.status !== undefined && pkg.status !== '');
51254
+ const allHaveStatus = packagesWithStatus.length === item.packages.length;
51255
+ const noneHaveStatus = packagesWithStatus.length === 0;
51256
+ if (noneHaveStatus) {
51257
+ return `0/${item.packages.length} sent`;
51258
+ } else if (allHaveStatus) {
51259
+ return `${item.packages.length}/${item.packages.length} sent`;
51271
51260
  } else {
51272
- return `${packagesWithStatus.length}/${item.packages.length} ${string}`;
51261
+ return `${packagesWithStatus.length}/${item.packages.length} sent`;
51273
51262
  }
51274
51263
  })())), /*#__PURE__*/React$1.createElement(VendorChevron$1, null, /*#__PURE__*/React$1.createElement(ArrowRightFullIcon, null))), /*#__PURE__*/React$1.createElement(Trash$1, {
51275
51264
  className: "trash-icon",
@@ -52389,11 +52378,12 @@ const CardsContainer = styled.div`
52389
52378
  const StatusCard = styled.div`
52390
52379
  position: relative;
52391
52380
  background-color: white;
52392
- border-bottom: 3px solid ${props => props.isSelected ? props.borderColor : '#E0E0E0'};
52381
+ border-bottom: ${props => props.isSelected ? `3px solid ${props.borderColor}` : 'none'};
52393
52382
  border-radius: 12px;
52394
52383
  padding: 12px 16px;
52395
52384
  flex-grow: 1;
52396
52385
  flex-basis: 0;
52386
+ box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.10);
52397
52387
  `;
52398
52388
  const CardHeader = styled.div`
52399
52389
  display: flex;
@@ -52401,6 +52391,27 @@ const CardHeader = styled.div`
52401
52391
  align-items: center;
52402
52392
  margin-bottom: 10px;
52403
52393
  `;
52394
+ const CheckmarkContainer = styled.div`
52395
+ width: 17px;
52396
+ height: 17px;
52397
+ border: 2px solid #212121;
52398
+ border-radius: 4px;
52399
+ display: flex;
52400
+ align-items: center;
52401
+ justify-content: center;
52402
+ margin-left: auto;
52403
+ color: white;
52404
+ transition: background-color .15s ease, border-color .15s ease;
52405
+ pointer-events: none;
52406
+
52407
+ &.checked {
52408
+ background-color: #066768;
52409
+ border-color: #066768;
52410
+ }
52411
+
52412
+ svg { display: none; }
52413
+ &.checked svg { display: block; }
52414
+ `;
52404
52415
  const Circle = styled.div`
52405
52416
  width: 16px;
52406
52417
  height: 16px;
@@ -52412,10 +52423,8 @@ const CardTitle = styled.h3`
52412
52423
  margin: 0;
52413
52424
  font-size: 18px;
52414
52425
  font-weight: 500;
52415
- color: ${props => props.isSelected ? props.color : '#666666'};
52416
- transition: color 0.2s ease-in-out;
52417
52426
  `;
52418
- const Checkmark = styled.input`
52427
+ styled.input`
52419
52428
  width: 16px;
52420
52429
  height: 16px;
52421
52430
  accent-color: #066768;
@@ -52429,102 +52438,68 @@ const CardContent = styled.div`
52429
52438
  flex-direction: column;
52430
52439
  align-items: flex-start;
52431
52440
  `;
52432
- const StatusCount = styled.h4`
52441
+ const StatusCount = styled.span`
52433
52442
  font-size: 32px;
52434
52443
  font-weight: 500;
52435
- color: ${props => props.isSelected ? props.color : '#999999'};
52436
52444
  line-height: 1;
52437
- margin: 0;
52438
- transition: color 0.2s ease-in-out;
52439
52445
  `;
52440
52446
 
52441
- const EventStatusCards = _ref => {
52447
+ const QuickFilterCards = _ref => {
52442
52448
  let {
52443
- statusData = [],
52444
- onStatusToggle = () => {},
52445
- disabled = false,
52449
+ data = [],
52450
+ onCardToggle = () => {},
52446
52451
  width = "100%"
52447
52452
  } = _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;
52453
+ // local mirror so UI updates immediately even if parent is slow/not controlling
52454
+ const [items, setItems] = useState(data);
52455
+ useEffect(() => setItems(data), [data]);
52471
52456
  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);
52457
+ setItems(prev => {
52458
+ const clicked = prev.find(i => i.status === status);
52459
+ const nextChecked = clicked ? !clicked.checked : true;
52460
+ const next = prev.map(i => i.status === status ? {
52461
+ ...i,
52462
+ checked: nextChecked
52463
+ } : i);
52464
+ onCardToggle(next, status, nextChecked);
52465
+ return next;
52466
+ });
52479
52467
  };
52480
52468
  return /*#__PURE__*/React$1.createElement(CardsContainer, {
52481
52469
  width: width,
52482
- className: "EventStatusCardsContainer"
52483
- }, displayData.map(item => {
52484
- const {
52470
+ className: "QuickFilterCardsContainer"
52471
+ }, items.map(_ref2 => {
52472
+ let {
52485
52473
  status,
52486
52474
  count,
52487
52475
  checked,
52488
52476
  color
52489
- } = item;
52477
+ } = _ref2;
52490
52478
  return /*#__PURE__*/React$1.createElement(StatusCard, {
52491
52479
  key: status,
52492
52480
  className: `StatusCard StatusCard-${status}`,
52493
52481
  isSelected: checked,
52494
52482
  borderColor: color,
52495
- disabled: disabled,
52496
- onClick: () => handleCardClick(status),
52497
- "data-testid": `status-card-${status.toLowerCase()}`
52483
+ onClick: () => handleCardClick(status)
52498
52484
  }, /*#__PURE__*/React$1.createElement(CardHeader, null, /*#__PURE__*/React$1.createElement(Circle, {
52499
52485
  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, {
52486
+ }), /*#__PURE__*/React$1.createElement(CardTitle, null, status), /*#__PURE__*/React$1.createElement(CheckmarkContainer, {
52487
+ className: checked ? "checked" : ""
52488
+ }, checked && /*#__PURE__*/React$1.createElement("svg", {
52489
+ width: "14",
52490
+ height: "14",
52491
+ viewBox: "0 0 20 20",
52492
+ fill: "currentColor"
52493
+ }, /*#__PURE__*/React$1.createElement("path", {
52494
+ fillRule: "evenodd",
52495
+ 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",
52496
+ clipRule: "evenodd"
52497
+ })))), /*#__PURE__*/React$1.createElement(CardContent, null, /*#__PURE__*/React$1.createElement(StatusCount, {
52508
52498
  isSelected: checked,
52509
52499
  color: color
52510
52500
  }, count)));
52511
52501
  }));
52512
52502
  };
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
52503
 
52529
- 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 };
52504
+ 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, 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, QuickFilterCards, RangePicker, RangePop, ReportTable, SearchInput, SingleBarLineCharts, SortPop, TabMenu, Table, ToasterMessageBox, ToggleSwitch, Tooltip$2 as Tooltip, TopToggleList, TotalDoughnutChart, TotalHorizontalCharts, Track, TwoBarCharts, WeeksPicker };
52530
52505
  //# sourceMappingURL=index.esm.js.map