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.js CHANGED
@@ -24324,24 +24324,23 @@ const IconContainer$2 = styled__default["default"].div`
24324
24324
  cursor: pointer;
24325
24325
  `;
24326
24326
 
24327
- const QuickFilterDropdownMultiSelection = _ref => {
24328
- let {
24329
- label,
24330
- labelEmptyValue,
24331
- options,
24332
- selectedValue,
24333
- placeHolder,
24334
- onChange,
24335
- required,
24336
- disabled,
24337
- width,
24338
- error,
24339
- errorMessage,
24340
- labelColor,
24341
- xIconShow,
24342
- checkBoxColor,
24343
- showLabelOnTop
24344
- } = _ref;
24327
+ const QuickFilterDropdownMultiSelection = ({
24328
+ label,
24329
+ labelEmptyValue,
24330
+ options,
24331
+ selectedValue,
24332
+ placeHolder,
24333
+ onChange,
24334
+ required,
24335
+ disabled,
24336
+ width,
24337
+ error,
24338
+ errorMessage,
24339
+ labelColor,
24340
+ xIconShow,
24341
+ checkBoxColor,
24342
+ showLabelOnTop
24343
+ }) => {
24345
24344
  const [isFocused, setIsFocused] = React$1.useState(false);
24346
24345
  const [showOptions, setShowOptions] = React$1.useState(false);
24347
24346
  const [inputValue, setInputValue] = React$1.useState('');
@@ -36869,7 +36868,7 @@ const TruncatedText$1 = styled__default["default"].span`
36869
36868
  text-overflow: ellipsis;
36870
36869
  font-size: 14px;
36871
36870
  `;
36872
- const Checkmark$1 = styled__default["default"].span`
36871
+ const Checkmark = styled__default["default"].span`
36873
36872
  color: ${props => props.color};
36874
36873
  margin-left: 8px;
36875
36874
  font-weight: bold;
@@ -36968,7 +36967,7 @@ const SortPop = props => {
36968
36967
  onClick: () => {
36969
36968
  handleChange(item);
36970
36969
  }
36971
- }, /*#__PURE__*/React__default["default"].createElement(TruncatedText$1, null, item.label), item.value === value && /*#__PURE__*/React__default["default"].createElement(Checkmark$1, {
36970
+ }, /*#__PURE__*/React__default["default"].createElement(TruncatedText$1, null, item.label), item.value === value && /*#__PURE__*/React__default["default"].createElement(Checkmark, {
36972
36971
  color: color
36973
36972
  }, "\u2713")))), /*#__PURE__*/React__default["default"].createElement(ButtonWrapper$1, null, /*#__PURE__*/React__default["default"].createElement(ResetButton, {
36974
36973
  onClick: handleReset,
@@ -52385,7 +52384,7 @@ const CardsContainer = styled__default["default"].div`
52385
52384
  const StatusCard = styled__default["default"].div`
52386
52385
  position: relative;
52387
52386
  background-color: white;
52388
- border-bottom: 3px solid ${props => props.isSelected ? props.borderColor : '#E0E0E0'};
52387
+ border-bottom: ${props => props.isSelected ? `3px solid ${props.borderColor}` : 'none'};
52389
52388
  border-radius: 12px;
52390
52389
  padding: 12px 16px;
52391
52390
  flex-grow: 1;
@@ -52397,6 +52396,27 @@ const CardHeader = styled__default["default"].div`
52397
52396
  align-items: center;
52398
52397
  margin-bottom: 10px;
52399
52398
  `;
52399
+ const CheckmarkContainer = styled__default["default"].div`
52400
+ width: 17px;
52401
+ height: 17px;
52402
+ border: 2px solid #212121;
52403
+ border-radius: 4px;
52404
+ display: flex;
52405
+ align-items: center;
52406
+ justify-content: center;
52407
+ margin-left: auto;
52408
+ color: white;
52409
+ transition: background-color .15s ease, border-color .15s ease;
52410
+ pointer-events: none;
52411
+
52412
+ &.checked {
52413
+ background-color: #066768;
52414
+ border-color: #066768;
52415
+ }
52416
+
52417
+ svg { display: none; }
52418
+ &.checked svg { display: block; }
52419
+ `;
52400
52420
  const Circle = styled__default["default"].div`
52401
52421
  width: 16px;
52402
52422
  height: 16px;
@@ -52408,10 +52428,8 @@ const CardTitle = styled__default["default"].h3`
52408
52428
  margin: 0;
52409
52429
  font-size: 18px;
52410
52430
  font-weight: 500;
52411
- color: ${props => props.isSelected ? props.color : '#666666'};
52412
- transition: color 0.2s ease-in-out;
52413
52431
  `;
52414
- const Checkmark = styled__default["default"].input`
52432
+ styled__default["default"].input`
52415
52433
  width: 16px;
52416
52434
  height: 16px;
52417
52435
  accent-color: #066768;
@@ -52425,102 +52443,68 @@ const CardContent = styled__default["default"].div`
52425
52443
  flex-direction: column;
52426
52444
  align-items: flex-start;
52427
52445
  `;
52428
- const StatusCount = styled__default["default"].h4`
52446
+ const StatusCount = styled__default["default"].span`
52429
52447
  font-size: 32px;
52430
52448
  font-weight: 500;
52431
- color: ${props => props.isSelected ? props.color : '#999999'};
52432
52449
  line-height: 1;
52433
- margin: 0;
52434
- transition: color 0.2s ease-in-out;
52435
52450
  `;
52436
52451
 
52437
52452
  const EventStatusCards = _ref => {
52438
52453
  let {
52439
- statusData = [],
52440
- onStatusToggle = () => {},
52441
- disabled = false,
52454
+ data = [],
52455
+ onCardToggle = () => {},
52442
52456
  width = "100%"
52443
52457
  } = _ref;
52444
- // Default data structure if no data provided
52445
- const defaultStatusData = [{
52446
- status: "Pending",
52447
- count: 0,
52448
- checked: true,
52449
- color: "#F5C9A7"
52450
- }, {
52451
- status: "Received",
52452
- count: 0,
52453
- checked: true,
52454
- color: "#B9D5D5"
52455
- }, {
52456
- status: "Approved",
52457
- count: 0,
52458
- checked: true,
52459
- color: "#BEDDC3"
52460
- }, {
52461
- status: "Cancelled",
52462
- count: 0,
52463
- checked: true,
52464
- color: "#EBA6AF"
52465
- }];
52466
- const displayData = statusData.length > 0 ? statusData : defaultStatusData;
52458
+ // local mirror so UI updates immediately even if parent is slow/not controlling
52459
+ const [items, setItems] = React$1.useState(data);
52460
+ React$1.useEffect(() => setItems(data), [data]);
52467
52461
  const handleCardClick = status => {
52468
- if (disabled) return;
52469
- const updatedData = displayData.map(item => item.status === status ? {
52470
- ...item,
52471
- checked: !item.checked
52472
- } : item);
52473
- const clickedItem = displayData.find(item => item.status === status);
52474
- onStatusToggle(updatedData, status, !clickedItem.checked);
52462
+ setItems(prev => {
52463
+ const clicked = prev.find(i => i.status === status);
52464
+ const nextChecked = clicked ? !clicked.checked : true;
52465
+ const next = prev.map(i => i.status === status ? {
52466
+ ...i,
52467
+ checked: nextChecked
52468
+ } : i);
52469
+ onCardToggle(next, status, nextChecked);
52470
+ return next;
52471
+ });
52475
52472
  };
52476
52473
  return /*#__PURE__*/React__default["default"].createElement(CardsContainer, {
52477
52474
  width: width,
52478
52475
  className: "EventStatusCardsContainer"
52479
- }, displayData.map(item => {
52480
- const {
52476
+ }, items.map(_ref2 => {
52477
+ let {
52481
52478
  status,
52482
52479
  count,
52483
52480
  checked,
52484
52481
  color
52485
- } = item;
52482
+ } = _ref2;
52486
52483
  return /*#__PURE__*/React__default["default"].createElement(StatusCard, {
52487
52484
  key: status,
52488
52485
  className: `StatusCard StatusCard-${status}`,
52489
52486
  isSelected: checked,
52490
52487
  borderColor: color,
52491
- disabled: disabled,
52492
- onClick: () => handleCardClick(status),
52493
- "data-testid": `status-card-${status.toLowerCase()}`
52488
+ onClick: () => handleCardClick(status)
52494
52489
  }, /*#__PURE__*/React__default["default"].createElement(CardHeader, null, /*#__PURE__*/React__default["default"].createElement(Circle, {
52495
52490
  color: color
52496
- }), /*#__PURE__*/React__default["default"].createElement(CardTitle, {
52497
- isSelected: checked,
52498
- color: color
52499
- }, status), /*#__PURE__*/React__default["default"].createElement(Checkmark, {
52500
- type: "checkbox",
52501
- checked: checked,
52502
- readOnly: true
52503
- })), /*#__PURE__*/React__default["default"].createElement(CardContent, null, /*#__PURE__*/React__default["default"].createElement(StatusCount, {
52491
+ }), /*#__PURE__*/React__default["default"].createElement(CardTitle, null, status), /*#__PURE__*/React__default["default"].createElement(CheckmarkContainer, {
52492
+ className: checked ? "checked" : ""
52493
+ }, checked && /*#__PURE__*/React__default["default"].createElement("svg", {
52494
+ width: "14",
52495
+ height: "14",
52496
+ viewBox: "0 0 20 20",
52497
+ fill: "currentColor"
52498
+ }, /*#__PURE__*/React__default["default"].createElement("path", {
52499
+ fillRule: "evenodd",
52500
+ 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",
52501
+ clipRule: "evenodd"
52502
+ })))), /*#__PURE__*/React__default["default"].createElement(CardContent, null, /*#__PURE__*/React__default["default"].createElement(StatusCount, {
52504
52503
  isSelected: checked,
52505
52504
  color: color
52506
52505
  }, count)));
52507
52506
  }));
52508
52507
  };
52509
- EventStatusCards.propTypes = {
52510
- /** Array of status objects with count, checked state, and color information */
52511
- statusData: PropTypes.arrayOf(PropTypes.shape({
52512
- status: PropTypes.oneOf(["Pending", "Received", "Approved", "Cancelled"]).isRequired,
52513
- count: PropTypes.number.isRequired,
52514
- checked: PropTypes.bool.isRequired,
52515
- color: PropTypes.string.isRequired
52516
- })),
52517
- /** Callback function when status selection changes */
52518
- onStatusToggle: PropTypes.func,
52519
- /** Whether the cards are disabled */
52520
- disabled: PropTypes.bool,
52521
- /** Width of the entire cards container */
52522
- width: PropTypes.string
52523
- };
52524
52508
 
52525
52509
  exports.AreaChart = AreaChart;
52526
52510
  exports.BannerEventBoxList = BannerEventBoxList;