sag_components 2.0.0-beta136 → 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
@@ -24314,24 +24314,23 @@ const IconContainer$2 = styled.div`
24314
24314
  cursor: pointer;
24315
24315
  `;
24316
24316
 
24317
- const QuickFilterDropdownMultiSelection = _ref => {
24318
- let {
24319
- label,
24320
- labelEmptyValue,
24321
- options,
24322
- selectedValue,
24323
- placeHolder,
24324
- onChange,
24325
- required,
24326
- disabled,
24327
- width,
24328
- error,
24329
- errorMessage,
24330
- labelColor,
24331
- xIconShow,
24332
- checkBoxColor,
24333
- showLabelOnTop
24334
- } = _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
+ }) => {
24335
24334
  const [isFocused, setIsFocused] = useState(false);
24336
24335
  const [showOptions, setShowOptions] = useState(false);
24337
24336
  const [inputValue, setInputValue] = useState('');
@@ -36859,7 +36858,7 @@ const TruncatedText$1 = styled.span`
36859
36858
  text-overflow: ellipsis;
36860
36859
  font-size: 14px;
36861
36860
  `;
36862
- const Checkmark$1 = styled.span`
36861
+ const Checkmark = styled.span`
36863
36862
  color: ${props => props.color};
36864
36863
  margin-left: 8px;
36865
36864
  font-weight: bold;
@@ -36958,7 +36957,7 @@ const SortPop = props => {
36958
36957
  onClick: () => {
36959
36958
  handleChange(item);
36960
36959
  }
36961
- }, /*#__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, {
36962
36961
  color: color
36963
36962
  }, "\u2713")))), /*#__PURE__*/React$1.createElement(ButtonWrapper$1, null, /*#__PURE__*/React$1.createElement(ResetButton, {
36964
36963
  onClick: handleReset,
@@ -52375,7 +52374,7 @@ const CardsContainer = styled.div`
52375
52374
  const StatusCard = styled.div`
52376
52375
  position: relative;
52377
52376
  background-color: white;
52378
- border-bottom: 3px solid ${props => props.isSelected ? props.borderColor : '#E0E0E0'};
52377
+ border-bottom: ${props => props.isSelected ? `3px solid ${props.borderColor}` : 'none'};
52379
52378
  border-radius: 12px;
52380
52379
  padding: 12px 16px;
52381
52380
  flex-grow: 1;
@@ -52387,6 +52386,27 @@ const CardHeader = styled.div`
52387
52386
  align-items: center;
52388
52387
  margin-bottom: 10px;
52389
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
+ `;
52390
52410
  const Circle = styled.div`
52391
52411
  width: 16px;
52392
52412
  height: 16px;
@@ -52398,10 +52418,8 @@ const CardTitle = styled.h3`
52398
52418
  margin: 0;
52399
52419
  font-size: 18px;
52400
52420
  font-weight: 500;
52401
- color: ${props => props.isSelected ? props.color : '#666666'};
52402
- transition: color 0.2s ease-in-out;
52403
52421
  `;
52404
- const Checkmark = styled.input`
52422
+ styled.input`
52405
52423
  width: 16px;
52406
52424
  height: 16px;
52407
52425
  accent-color: #066768;
@@ -52415,102 +52433,68 @@ const CardContent = styled.div`
52415
52433
  flex-direction: column;
52416
52434
  align-items: flex-start;
52417
52435
  `;
52418
- const StatusCount = styled.h4`
52436
+ const StatusCount = styled.span`
52419
52437
  font-size: 32px;
52420
52438
  font-weight: 500;
52421
- color: ${props => props.isSelected ? props.color : '#999999'};
52422
52439
  line-height: 1;
52423
- margin: 0;
52424
- transition: color 0.2s ease-in-out;
52425
52440
  `;
52426
52441
 
52427
52442
  const EventStatusCards = _ref => {
52428
52443
  let {
52429
- statusData = [],
52430
- onStatusToggle = () => {},
52431
- disabled = false,
52444
+ data = [],
52445
+ onCardToggle = () => {},
52432
52446
  width = "100%"
52433
52447
  } = _ref;
52434
- // Default data structure if no data provided
52435
- const defaultStatusData = [{
52436
- status: "Pending",
52437
- count: 0,
52438
- checked: true,
52439
- color: "#F5C9A7"
52440
- }, {
52441
- status: "Received",
52442
- count: 0,
52443
- checked: true,
52444
- color: "#B9D5D5"
52445
- }, {
52446
- status: "Approved",
52447
- count: 0,
52448
- checked: true,
52449
- color: "#BEDDC3"
52450
- }, {
52451
- status: "Cancelled",
52452
- count: 0,
52453
- checked: true,
52454
- color: "#EBA6AF"
52455
- }];
52456
- 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]);
52457
52451
  const handleCardClick = status => {
52458
- if (disabled) return;
52459
- const updatedData = displayData.map(item => item.status === status ? {
52460
- ...item,
52461
- checked: !item.checked
52462
- } : item);
52463
- const clickedItem = displayData.find(item => item.status === status);
52464
- 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
+ });
52465
52462
  };
52466
52463
  return /*#__PURE__*/React$1.createElement(CardsContainer, {
52467
52464
  width: width,
52468
52465
  className: "EventStatusCardsContainer"
52469
- }, displayData.map(item => {
52470
- const {
52466
+ }, items.map(_ref2 => {
52467
+ let {
52471
52468
  status,
52472
52469
  count,
52473
52470
  checked,
52474
52471
  color
52475
- } = item;
52472
+ } = _ref2;
52476
52473
  return /*#__PURE__*/React$1.createElement(StatusCard, {
52477
52474
  key: status,
52478
52475
  className: `StatusCard StatusCard-${status}`,
52479
52476
  isSelected: checked,
52480
52477
  borderColor: color,
52481
- disabled: disabled,
52482
- onClick: () => handleCardClick(status),
52483
- "data-testid": `status-card-${status.toLowerCase()}`
52478
+ onClick: () => handleCardClick(status)
52484
52479
  }, /*#__PURE__*/React$1.createElement(CardHeader, null, /*#__PURE__*/React$1.createElement(Circle, {
52485
52480
  color: color
52486
- }), /*#__PURE__*/React$1.createElement(CardTitle, {
52487
- isSelected: checked,
52488
- color: color
52489
- }, status), /*#__PURE__*/React$1.createElement(Checkmark, {
52490
- type: "checkbox",
52491
- checked: checked,
52492
- readOnly: true
52493
- })), /*#__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, {
52494
52493
  isSelected: checked,
52495
52494
  color: color
52496
52495
  }, count)));
52497
52496
  }));
52498
52497
  };
52499
- EventStatusCards.propTypes = {
52500
- /** Array of status objects with count, checked state, and color information */
52501
- statusData: PropTypes.arrayOf(PropTypes.shape({
52502
- status: PropTypes.oneOf(["Pending", "Received", "Approved", "Cancelled"]).isRequired,
52503
- count: PropTypes.number.isRequired,
52504
- checked: PropTypes.bool.isRequired,
52505
- color: PropTypes.string.isRequired
52506
- })),
52507
- /** Callback function when status selection changes */
52508
- onStatusToggle: PropTypes.func,
52509
- /** Whether the cards are disabled */
52510
- disabled: PropTypes.bool,
52511
- /** Width of the entire cards container */
52512
- width: PropTypes.string
52513
- };
52514
52498
 
52515
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 };
52516
52500
  //# sourceMappingURL=index.esm.js.map