sag_components 2.0.0-beta172 → 2.0.0-beta173

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
@@ -10429,24 +10429,23 @@ const QuarterPopupPicker = ({
10429
10429
  };
10430
10430
 
10431
10431
  /* eslint-disable import/no-extraneous-dependencies */
10432
- const QuarterPicker = _ref => {
10433
- let {
10434
- availableQuarters,
10435
- // ["Q1-2024"]
10436
- label,
10437
- onChange,
10438
- borderRadius,
10439
- required,
10440
- width,
10441
- height,
10442
- placeholder,
10443
- disabled,
10444
- borderColor,
10445
- borderColorFocus,
10446
- textColor,
10447
- selectedValue,
10448
- startYear
10449
- } = _ref;
10432
+ const QuarterPicker = ({
10433
+ availableQuarters,
10434
+ // ["Q1-2024"]
10435
+ label,
10436
+ onChange,
10437
+ borderRadius,
10438
+ required,
10439
+ width,
10440
+ height,
10441
+ placeholder,
10442
+ disabled,
10443
+ borderColor,
10444
+ borderColorFocus,
10445
+ textColor,
10446
+ selectedValue,
10447
+ startYear
10448
+ }) => {
10450
10449
  const [isFocused, setIsFocused] = useState(false);
10451
10450
  const [isOpen, setIsOpen] = useState(false);
10452
10451
  const [value, setValue] = useState('');
@@ -10888,23 +10887,22 @@ const MonthPopupPicker = ({
10888
10887
  };
10889
10888
 
10890
10889
  /* eslint-disable import/no-extraneous-dependencies */
10891
- const MonthPicker = _ref => {
10892
- let {
10893
- availableMonths,
10894
- label,
10895
- onChange,
10896
- borderRadius,
10897
- required,
10898
- width,
10899
- height,
10900
- placeholder,
10901
- disabled,
10902
- borderColor,
10903
- borderColorFocus,
10904
- textColor,
10905
- selectedValue,
10906
- startYear
10907
- } = _ref;
10890
+ const MonthPicker = ({
10891
+ availableMonths,
10892
+ label,
10893
+ onChange,
10894
+ borderRadius,
10895
+ required,
10896
+ width,
10897
+ height,
10898
+ placeholder,
10899
+ disabled,
10900
+ borderColor,
10901
+ borderColorFocus,
10902
+ textColor,
10903
+ selectedValue,
10904
+ startYear
10905
+ }) => {
10908
10906
  const [isFocused, setIsFocused] = useState(false);
10909
10907
  const [isOpen, setIsOpen] = useState(false);
10910
10908
  const [value, setValue] = useState('');
@@ -38226,7 +38224,7 @@ const shimmerAnimation = css`
38226
38224
  }
38227
38225
  `;
38228
38226
  const StyledTableBody = styled.tbody`
38229
- background-color: white;
38227
+ background-color: ${props => props.$isRowFocused ? props.$selectedColor : "white"};
38230
38228
  font-family: "Poppins", sans-serif;
38231
38229
  position: relative;
38232
38230
  `;
@@ -38239,6 +38237,11 @@ const TableRow = styled.tr`
38239
38237
 
38240
38238
  &:hover {
38241
38239
  background-color: #e6f0f0;
38240
+
38241
+ /* Update dropdown buttons when row is hovered */
38242
+ button {
38243
+ background-color: #e6f0f0 !important;
38244
+ }
38242
38245
  }
38243
38246
 
38244
38247
  &:last-child {
@@ -38259,7 +38262,7 @@ styled.div`
38259
38262
  background-color: white;
38260
38263
  color: #333;
38261
38264
  padding: 10px 16px;
38262
- border-radius: 4px;
38265
+ border-radius: 0;
38263
38266
  font-family: "Poppins", sans-serif;
38264
38267
  font-size: 14px;
38265
38268
  font-weight: 400;
@@ -38315,6 +38318,12 @@ const TableCell = styled.td`
38315
38318
  ${props => props.$fieldType === 'expand' && `
38316
38319
  padding: 12px 8px 12px 0px;
38317
38320
  `}
38321
+
38322
+ /* Special handling for dropdown cells - ensure proper overflow */
38323
+ ${props => props.$fieldType === 'dropdown' && `
38324
+ overflow: visible;
38325
+ position: relative;
38326
+ `}
38318
38327
 
38319
38328
  /* CSS-only tooltip */
38320
38329
  &[data-tooltip]:hover::before {
@@ -38721,6 +38730,124 @@ const ExpandedContent = styled.div`
38721
38730
  box-sizing: border-box;
38722
38731
  `;
38723
38732
 
38733
+ // DROPDOWN STYLES
38734
+ const DropdownContainer$1 = styled.div`
38735
+ position: relative;
38736
+ display: inline-block;
38737
+ width: 100%;
38738
+ font-family: "Poppins", sans-serif;
38739
+ `;
38740
+ const DropdownButton$1 = styled.button`
38741
+ display: flex;
38742
+ align-items: center;
38743
+ justify-content: space-between;
38744
+ width: 100%;
38745
+ min-width: 120px;
38746
+ background-color: ${props => props.$isRowFocused ? props.$selectedColor : "white"};
38747
+ border: none;
38748
+ border-radius: 0;
38749
+ font-family: "Poppins", sans-serif;
38750
+ font-size: 14px;
38751
+ font-weight: 400;
38752
+ color: #212121;
38753
+ cursor: pointer;
38754
+ transition: all 0.2s ease;
38755
+
38756
+ &:hover {
38757
+ background-color: #D1E7E7;
38758
+ }
38759
+
38760
+ &:focus {
38761
+ outline: none;
38762
+ background-color: #E6F0F0;
38763
+ }
38764
+
38765
+ span {
38766
+ overflow: hidden;
38767
+ text-overflow: ellipsis;
38768
+ white-space: nowrap;
38769
+ text-align: left;
38770
+ flex: 1;
38771
+ }
38772
+ `;
38773
+ const DropdownIcon = styled.div`
38774
+ display: flex;
38775
+ align-items: center;
38776
+ justify-content: center;
38777
+ width: 20px;
38778
+ height: 20px;
38779
+ background-color: ${props => props.$isRowFocused || props.$isRowHovered ? '#B4D1D2' : 'white'};
38780
+ border-radius: 4px;
38781
+ margin-left: 8px;
38782
+ transition: all 0.2s ease;
38783
+
38784
+ ${props => props.$isOpen && `
38785
+ transform: rotate(180deg);
38786
+ `}
38787
+ `;
38788
+ const DropdownMenu = styled.div`
38789
+ position: absolute;
38790
+ top: calc(100%);
38791
+ left: 0;
38792
+ right: 0;
38793
+ z-index: 1000;
38794
+ background-color: white;
38795
+ border: none;
38796
+ border-radius: 0;
38797
+ box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
38798
+ font-family: "Poppins", sans-serif;
38799
+ max-height: ${props => props.$maxDropdownHeight || '200px'};
38800
+ overflow-y: auto;
38801
+ padding: 16px;
38802
+
38803
+ /* Custom scrollbar */
38804
+ &::-webkit-scrollbar {
38805
+ width: 4px;
38806
+ }
38807
+
38808
+ &::-webkit-scrollbar-track {
38809
+ background: transparent;
38810
+ }
38811
+
38812
+ &::-webkit-scrollbar-thumb {
38813
+ background: #cbd5e1;
38814
+ border-radius: 2px;
38815
+ }
38816
+
38817
+ &::-webkit-scrollbar-thumb:hover {
38818
+ background: #94a3b8;
38819
+ }
38820
+ `;
38821
+ const DropdownOption = styled.div`
38822
+ display: flex;
38823
+ align-items: center;
38824
+ justify-content: space-between;
38825
+ padding: 8px;
38826
+ font-size: 14px;
38827
+ font-weight: 400;
38828
+ color: #374151;
38829
+ cursor: pointer;
38830
+ transition: all 0.15s ease;
38831
+ border-radius: 0;
38832
+ border-left: 3px solid transparent;
38833
+ background-color: white;
38834
+
38835
+ &:hover {
38836
+ background-color: #E6F0F0;
38837
+ }
38838
+
38839
+ ${props => props.$isSelected && `
38840
+ background-color: #B4D1D2;
38841
+ color: #374151;
38842
+ font-weight: 500;
38843
+ border-left: 3px solid #066768;
38844
+
38845
+ &:hover {
38846
+ background-color: #A3C9CA;
38847
+ }
38848
+ `}
38849
+ `;
38850
+
38724
38851
  // MessageBox.styles.js
38725
38852
  const ModalOverlay = styled.div`
38726
38853
  position: fixed;
@@ -38974,12 +39101,14 @@ const TableBody = ({
38974
39101
  onExpandRow = () => {},
38975
39102
  expandedBackgroundColor = '#E6F0F0',
38976
39103
  // New prop with default
39104
+ onDropdownSelected = () => {},
38977
39105
  ref = null
38978
39106
  }) => {
38979
39107
  const [hoveredRowIndex, setHoveredRowIndex] = useState(null);
38980
39108
  const [focusedRowIndex, setFocusedRowIndex] = useState(null);
38981
39109
  const [isCommentModalOpen, setIsCommentModalOpen] = useState(false);
38982
39110
  const [currentCommentRow, setCurrentCommentRow] = useState(null);
39111
+ const [openDropdowns, setOpenDropdowns] = useState({});
38983
39112
 
38984
39113
  // TextArea logic states
38985
39114
  const [commentText, setCommentText] = useState('');
@@ -39317,6 +39446,39 @@ const TableBody = ({
39317
39446
  }));
39318
39447
  }
39319
39448
  return null;
39449
+ case 'dropdown':
39450
+ const dropdownKey = `${rowIndex}-${column.key}`;
39451
+ const isOpen = openDropdowns[dropdownKey] || false;
39452
+ const dropdownOptions = column.dropdownOptions || [];
39453
+ const maxDropdownHeight = column.maxDropdownHeight || '200px';
39454
+
39455
+ // Find the current selected option to display its label
39456
+ const currentOption = dropdownOptions.find(option => option.value === value);
39457
+ const displayText = currentOption ? currentOption.label : value || 'Select...';
39458
+ return /*#__PURE__*/React$1.createElement(DropdownContainer$1, null, /*#__PURE__*/React$1.createElement(DropdownButton$1, {
39459
+ onClick: e => handleDropdownClick(rowIndex, column.key, e),
39460
+ $isOpen: isOpen,
39461
+ $isRowFocused: focusedRowIndex === rowIndex,
39462
+ $selectedColor: selectedColor
39463
+ }, /*#__PURE__*/React$1.createElement("span", null, displayText), /*#__PURE__*/React$1.createElement(DropdownIcon, {
39464
+ $isOpen: isOpen,
39465
+ $isRowFocused: focusedRowIndex === rowIndex,
39466
+ $isRowHovered: hoveredRowIndex === rowIndex
39467
+ }, /*#__PURE__*/React$1.createElement(MenuItemOpenIcon, {
39468
+ width: "10",
39469
+ height: "6",
39470
+ color: "#212121"
39471
+ }))), isOpen && /*#__PURE__*/React$1.createElement(DropdownMenu, {
39472
+ $maxDropdownHeight: maxDropdownHeight
39473
+ }, dropdownOptions.map((option, index) => /*#__PURE__*/React$1.createElement(DropdownOption, {
39474
+ key: index,
39475
+ onClick: e => handleDropdownOptionClick(row, rowIndex, column.key, option, e),
39476
+ $isSelected: option.value === value
39477
+ }, /*#__PURE__*/React$1.createElement("span", null, option.label), option.value === value && /*#__PURE__*/React$1.createElement(OkIcon, {
39478
+ width: "24",
39479
+ height: "24",
39480
+ color: "#066768"
39481
+ })))));
39320
39482
  default:
39321
39483
  // Treat default as text
39322
39484
  return value.toString();
@@ -39335,6 +39497,44 @@ const TableBody = ({
39335
39497
  onExpandRow(row, rowIndex, expandStatus);
39336
39498
  }
39337
39499
  };
39500
+
39501
+ // Handle dropdown click
39502
+ const handleDropdownClick = (rowIndex, columnKey, event) => {
39503
+ event.stopPropagation();
39504
+ const dropdownKey = `${rowIndex}-${columnKey}`;
39505
+ setOpenDropdowns(prev => ({
39506
+ ...prev,
39507
+ [dropdownKey]: !prev[dropdownKey]
39508
+ }));
39509
+ };
39510
+
39511
+ // Handle dropdown option selection
39512
+ const handleDropdownOptionClick = (row, rowIndex, columnKey, selectedOption, event) => {
39513
+ event.stopPropagation();
39514
+ const dropdownKey = `${rowIndex}-${columnKey}`;
39515
+
39516
+ // Close the dropdown
39517
+ setOpenDropdowns(prev => ({
39518
+ ...prev,
39519
+ [dropdownKey]: false
39520
+ }));
39521
+
39522
+ // Fire the onDropdownSelected event
39523
+ if (onDropdownSelected) {
39524
+ onDropdownSelected(row, selectedOption);
39525
+ }
39526
+ };
39527
+
39528
+ // Close all dropdowns when clicking outside
39529
+ React$1.useEffect(() => {
39530
+ const handleClickOutside = () => {
39531
+ setOpenDropdowns({});
39532
+ };
39533
+ document.addEventListener('click', handleClickOutside);
39534
+ return () => {
39535
+ document.removeEventListener('click', handleClickOutside);
39536
+ };
39537
+ }, []);
39338
39538
  return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement(StyledTableBody, null, data.map((row, rowIndex) => /*#__PURE__*/React$1.createElement(React$1.Fragment, {
39339
39539
  key: rowIndex
39340
39540
  }, /*#__PURE__*/React$1.createElement(TableRow, {
@@ -39433,6 +39633,7 @@ TableBody.propTypes = {
39433
39633
  statuses: PropTypes.array,
39434
39634
  onCommentSave: PropTypes.func,
39435
39635
  commentTextLimit: PropTypes.number,
39636
+ onDropdownSelected: PropTypes.func,
39436
39637
  ref: PropTypes.object
39437
39638
  };
39438
39639
  TableBody.displayName = 'TableBody';
@@ -42791,6 +42992,7 @@ const Table = props => {
42791
42992
  onExpandRow = () => {},
42792
42993
  expandedBackgroundColor = '#E6F0F0',
42793
42994
  // New prop
42995
+ onDropdownSelected = () => {},
42794
42996
  // Accept ref as a regular prop
42795
42997
  ref = null
42796
42998
  } = props;
@@ -42937,7 +43139,8 @@ const Table = props => {
42937
43139
  expandedRows: expandedRows,
42938
43140
  expandedContent: expandedContent,
42939
43141
  onExpandRow: onExpandRow,
42940
- expandedBackgroundColor: expandedBackgroundColor
43142
+ expandedBackgroundColor: expandedBackgroundColor,
43143
+ onDropdownSelected: onDropdownSelected
42941
43144
  })), data.length === 0 && /*#__PURE__*/React$1.createElement(NoEventsParent, null, /*#__PURE__*/React$1.createElement(NoEventsWrapper, null, showNoDataInSearch ? getNoDataSearchIcon(noDataSearchIcon) : getNoDataIcon(noDataIcon)), /*#__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, noEventsTitle), /*#__PURE__*/React$1.createElement("br", null), noEventsSubtitle)), !showNoDataInSearch && showNoEventsButton && /*#__PURE__*/React$1.createElement(Button$1, {
42942
43145
  height: "45px",
42943
43146
  leftIcon: noEventsButtonIcon,