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.js CHANGED
@@ -10439,24 +10439,23 @@ const QuarterPopupPicker = ({
10439
10439
  };
10440
10440
 
10441
10441
  /* eslint-disable import/no-extraneous-dependencies */
10442
- const QuarterPicker = _ref => {
10443
- let {
10444
- availableQuarters,
10445
- // ["Q1-2024"]
10446
- label,
10447
- onChange,
10448
- borderRadius,
10449
- required,
10450
- width,
10451
- height,
10452
- placeholder,
10453
- disabled,
10454
- borderColor,
10455
- borderColorFocus,
10456
- textColor,
10457
- selectedValue,
10458
- startYear
10459
- } = _ref;
10442
+ const QuarterPicker = ({
10443
+ availableQuarters,
10444
+ // ["Q1-2024"]
10445
+ label,
10446
+ onChange,
10447
+ borderRadius,
10448
+ required,
10449
+ width,
10450
+ height,
10451
+ placeholder,
10452
+ disabled,
10453
+ borderColor,
10454
+ borderColorFocus,
10455
+ textColor,
10456
+ selectedValue,
10457
+ startYear
10458
+ }) => {
10460
10459
  const [isFocused, setIsFocused] = React$1.useState(false);
10461
10460
  const [isOpen, setIsOpen] = React$1.useState(false);
10462
10461
  const [value, setValue] = React$1.useState('');
@@ -10898,23 +10897,22 @@ const MonthPopupPicker = ({
10898
10897
  };
10899
10898
 
10900
10899
  /* eslint-disable import/no-extraneous-dependencies */
10901
- const MonthPicker = _ref => {
10902
- let {
10903
- availableMonths,
10904
- label,
10905
- onChange,
10906
- borderRadius,
10907
- required,
10908
- width,
10909
- height,
10910
- placeholder,
10911
- disabled,
10912
- borderColor,
10913
- borderColorFocus,
10914
- textColor,
10915
- selectedValue,
10916
- startYear
10917
- } = _ref;
10900
+ const MonthPicker = ({
10901
+ availableMonths,
10902
+ label,
10903
+ onChange,
10904
+ borderRadius,
10905
+ required,
10906
+ width,
10907
+ height,
10908
+ placeholder,
10909
+ disabled,
10910
+ borderColor,
10911
+ borderColorFocus,
10912
+ textColor,
10913
+ selectedValue,
10914
+ startYear
10915
+ }) => {
10918
10916
  const [isFocused, setIsFocused] = React$1.useState(false);
10919
10917
  const [isOpen, setIsOpen] = React$1.useState(false);
10920
10918
  const [value, setValue] = React$1.useState('');
@@ -38236,7 +38234,7 @@ const shimmerAnimation = styled.css`
38236
38234
  }
38237
38235
  `;
38238
38236
  const StyledTableBody = styled__default["default"].tbody`
38239
- background-color: white;
38237
+ background-color: ${props => props.$isRowFocused ? props.$selectedColor : "white"};
38240
38238
  font-family: "Poppins", sans-serif;
38241
38239
  position: relative;
38242
38240
  `;
@@ -38249,6 +38247,11 @@ const TableRow = styled__default["default"].tr`
38249
38247
 
38250
38248
  &:hover {
38251
38249
  background-color: #e6f0f0;
38250
+
38251
+ /* Update dropdown buttons when row is hovered */
38252
+ button {
38253
+ background-color: #e6f0f0 !important;
38254
+ }
38252
38255
  }
38253
38256
 
38254
38257
  &:last-child {
@@ -38269,7 +38272,7 @@ styled__default["default"].div`
38269
38272
  background-color: white;
38270
38273
  color: #333;
38271
38274
  padding: 10px 16px;
38272
- border-radius: 4px;
38275
+ border-radius: 0;
38273
38276
  font-family: "Poppins", sans-serif;
38274
38277
  font-size: 14px;
38275
38278
  font-weight: 400;
@@ -38325,6 +38328,12 @@ const TableCell = styled__default["default"].td`
38325
38328
  ${props => props.$fieldType === 'expand' && `
38326
38329
  padding: 12px 8px 12px 0px;
38327
38330
  `}
38331
+
38332
+ /* Special handling for dropdown cells - ensure proper overflow */
38333
+ ${props => props.$fieldType === 'dropdown' && `
38334
+ overflow: visible;
38335
+ position: relative;
38336
+ `}
38328
38337
 
38329
38338
  /* CSS-only tooltip */
38330
38339
  &[data-tooltip]:hover::before {
@@ -38731,6 +38740,124 @@ const ExpandedContent = styled__default["default"].div`
38731
38740
  box-sizing: border-box;
38732
38741
  `;
38733
38742
 
38743
+ // DROPDOWN STYLES
38744
+ const DropdownContainer$1 = styled__default["default"].div`
38745
+ position: relative;
38746
+ display: inline-block;
38747
+ width: 100%;
38748
+ font-family: "Poppins", sans-serif;
38749
+ `;
38750
+ const DropdownButton$1 = styled__default["default"].button`
38751
+ display: flex;
38752
+ align-items: center;
38753
+ justify-content: space-between;
38754
+ width: 100%;
38755
+ min-width: 120px;
38756
+ background-color: ${props => props.$isRowFocused ? props.$selectedColor : "white"};
38757
+ border: none;
38758
+ border-radius: 0;
38759
+ font-family: "Poppins", sans-serif;
38760
+ font-size: 14px;
38761
+ font-weight: 400;
38762
+ color: #212121;
38763
+ cursor: pointer;
38764
+ transition: all 0.2s ease;
38765
+
38766
+ &:hover {
38767
+ background-color: #D1E7E7;
38768
+ }
38769
+
38770
+ &:focus {
38771
+ outline: none;
38772
+ background-color: #E6F0F0;
38773
+ }
38774
+
38775
+ span {
38776
+ overflow: hidden;
38777
+ text-overflow: ellipsis;
38778
+ white-space: nowrap;
38779
+ text-align: left;
38780
+ flex: 1;
38781
+ }
38782
+ `;
38783
+ const DropdownIcon = styled__default["default"].div`
38784
+ display: flex;
38785
+ align-items: center;
38786
+ justify-content: center;
38787
+ width: 20px;
38788
+ height: 20px;
38789
+ background-color: ${props => props.$isRowFocused || props.$isRowHovered ? '#B4D1D2' : 'white'};
38790
+ border-radius: 4px;
38791
+ margin-left: 8px;
38792
+ transition: all 0.2s ease;
38793
+
38794
+ ${props => props.$isOpen && `
38795
+ transform: rotate(180deg);
38796
+ `}
38797
+ `;
38798
+ const DropdownMenu = styled__default["default"].div`
38799
+ position: absolute;
38800
+ top: calc(100%);
38801
+ left: 0;
38802
+ right: 0;
38803
+ z-index: 1000;
38804
+ background-color: white;
38805
+ border: none;
38806
+ border-radius: 0;
38807
+ box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
38808
+ font-family: "Poppins", sans-serif;
38809
+ max-height: ${props => props.$maxDropdownHeight || '200px'};
38810
+ overflow-y: auto;
38811
+ padding: 16px;
38812
+
38813
+ /* Custom scrollbar */
38814
+ &::-webkit-scrollbar {
38815
+ width: 4px;
38816
+ }
38817
+
38818
+ &::-webkit-scrollbar-track {
38819
+ background: transparent;
38820
+ }
38821
+
38822
+ &::-webkit-scrollbar-thumb {
38823
+ background: #cbd5e1;
38824
+ border-radius: 2px;
38825
+ }
38826
+
38827
+ &::-webkit-scrollbar-thumb:hover {
38828
+ background: #94a3b8;
38829
+ }
38830
+ `;
38831
+ const DropdownOption = styled__default["default"].div`
38832
+ display: flex;
38833
+ align-items: center;
38834
+ justify-content: space-between;
38835
+ padding: 8px;
38836
+ font-size: 14px;
38837
+ font-weight: 400;
38838
+ color: #374151;
38839
+ cursor: pointer;
38840
+ transition: all 0.15s ease;
38841
+ border-radius: 0;
38842
+ border-left: 3px solid transparent;
38843
+ background-color: white;
38844
+
38845
+ &:hover {
38846
+ background-color: #E6F0F0;
38847
+ }
38848
+
38849
+ ${props => props.$isSelected && `
38850
+ background-color: #B4D1D2;
38851
+ color: #374151;
38852
+ font-weight: 500;
38853
+ border-left: 3px solid #066768;
38854
+
38855
+ &:hover {
38856
+ background-color: #A3C9CA;
38857
+ }
38858
+ `}
38859
+ `;
38860
+
38734
38861
  // MessageBox.styles.js
38735
38862
  const ModalOverlay = styled__default["default"].div`
38736
38863
  position: fixed;
@@ -38984,12 +39111,14 @@ const TableBody = ({
38984
39111
  onExpandRow = () => {},
38985
39112
  expandedBackgroundColor = '#E6F0F0',
38986
39113
  // New prop with default
39114
+ onDropdownSelected = () => {},
38987
39115
  ref = null
38988
39116
  }) => {
38989
39117
  const [hoveredRowIndex, setHoveredRowIndex] = React$1.useState(null);
38990
39118
  const [focusedRowIndex, setFocusedRowIndex] = React$1.useState(null);
38991
39119
  const [isCommentModalOpen, setIsCommentModalOpen] = React$1.useState(false);
38992
39120
  const [currentCommentRow, setCurrentCommentRow] = React$1.useState(null);
39121
+ const [openDropdowns, setOpenDropdowns] = React$1.useState({});
38993
39122
 
38994
39123
  // TextArea logic states
38995
39124
  const [commentText, setCommentText] = React$1.useState('');
@@ -39327,6 +39456,39 @@ const TableBody = ({
39327
39456
  }));
39328
39457
  }
39329
39458
  return null;
39459
+ case 'dropdown':
39460
+ const dropdownKey = `${rowIndex}-${column.key}`;
39461
+ const isOpen = openDropdowns[dropdownKey] || false;
39462
+ const dropdownOptions = column.dropdownOptions || [];
39463
+ const maxDropdownHeight = column.maxDropdownHeight || '200px';
39464
+
39465
+ // Find the current selected option to display its label
39466
+ const currentOption = dropdownOptions.find(option => option.value === value);
39467
+ const displayText = currentOption ? currentOption.label : value || 'Select...';
39468
+ return /*#__PURE__*/React__default["default"].createElement(DropdownContainer$1, null, /*#__PURE__*/React__default["default"].createElement(DropdownButton$1, {
39469
+ onClick: e => handleDropdownClick(rowIndex, column.key, e),
39470
+ $isOpen: isOpen,
39471
+ $isRowFocused: focusedRowIndex === rowIndex,
39472
+ $selectedColor: selectedColor
39473
+ }, /*#__PURE__*/React__default["default"].createElement("span", null, displayText), /*#__PURE__*/React__default["default"].createElement(DropdownIcon, {
39474
+ $isOpen: isOpen,
39475
+ $isRowFocused: focusedRowIndex === rowIndex,
39476
+ $isRowHovered: hoveredRowIndex === rowIndex
39477
+ }, /*#__PURE__*/React__default["default"].createElement(MenuItemOpenIcon, {
39478
+ width: "10",
39479
+ height: "6",
39480
+ color: "#212121"
39481
+ }))), isOpen && /*#__PURE__*/React__default["default"].createElement(DropdownMenu, {
39482
+ $maxDropdownHeight: maxDropdownHeight
39483
+ }, dropdownOptions.map((option, index) => /*#__PURE__*/React__default["default"].createElement(DropdownOption, {
39484
+ key: index,
39485
+ onClick: e => handleDropdownOptionClick(row, rowIndex, column.key, option, e),
39486
+ $isSelected: option.value === value
39487
+ }, /*#__PURE__*/React__default["default"].createElement("span", null, option.label), option.value === value && /*#__PURE__*/React__default["default"].createElement(OkIcon, {
39488
+ width: "24",
39489
+ height: "24",
39490
+ color: "#066768"
39491
+ })))));
39330
39492
  default:
39331
39493
  // Treat default as text
39332
39494
  return value.toString();
@@ -39345,6 +39507,44 @@ const TableBody = ({
39345
39507
  onExpandRow(row, rowIndex, expandStatus);
39346
39508
  }
39347
39509
  };
39510
+
39511
+ // Handle dropdown click
39512
+ const handleDropdownClick = (rowIndex, columnKey, event) => {
39513
+ event.stopPropagation();
39514
+ const dropdownKey = `${rowIndex}-${columnKey}`;
39515
+ setOpenDropdowns(prev => ({
39516
+ ...prev,
39517
+ [dropdownKey]: !prev[dropdownKey]
39518
+ }));
39519
+ };
39520
+
39521
+ // Handle dropdown option selection
39522
+ const handleDropdownOptionClick = (row, rowIndex, columnKey, selectedOption, event) => {
39523
+ event.stopPropagation();
39524
+ const dropdownKey = `${rowIndex}-${columnKey}`;
39525
+
39526
+ // Close the dropdown
39527
+ setOpenDropdowns(prev => ({
39528
+ ...prev,
39529
+ [dropdownKey]: false
39530
+ }));
39531
+
39532
+ // Fire the onDropdownSelected event
39533
+ if (onDropdownSelected) {
39534
+ onDropdownSelected(row, selectedOption);
39535
+ }
39536
+ };
39537
+
39538
+ // Close all dropdowns when clicking outside
39539
+ React__default["default"].useEffect(() => {
39540
+ const handleClickOutside = () => {
39541
+ setOpenDropdowns({});
39542
+ };
39543
+ document.addEventListener('click', handleClickOutside);
39544
+ return () => {
39545
+ document.removeEventListener('click', handleClickOutside);
39546
+ };
39547
+ }, []);
39348
39548
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(StyledTableBody, null, data.map((row, rowIndex) => /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, {
39349
39549
  key: rowIndex
39350
39550
  }, /*#__PURE__*/React__default["default"].createElement(TableRow, {
@@ -39443,6 +39643,7 @@ TableBody.propTypes = {
39443
39643
  statuses: PropTypes.array,
39444
39644
  onCommentSave: PropTypes.func,
39445
39645
  commentTextLimit: PropTypes.number,
39646
+ onDropdownSelected: PropTypes.func,
39446
39647
  ref: PropTypes.object
39447
39648
  };
39448
39649
  TableBody.displayName = 'TableBody';
@@ -42801,6 +43002,7 @@ const Table = props => {
42801
43002
  onExpandRow = () => {},
42802
43003
  expandedBackgroundColor = '#E6F0F0',
42803
43004
  // New prop
43005
+ onDropdownSelected = () => {},
42804
43006
  // Accept ref as a regular prop
42805
43007
  ref = null
42806
43008
  } = props;
@@ -42947,7 +43149,8 @@ const Table = props => {
42947
43149
  expandedRows: expandedRows,
42948
43150
  expandedContent: expandedContent,
42949
43151
  onExpandRow: onExpandRow,
42950
- expandedBackgroundColor: expandedBackgroundColor
43152
+ expandedBackgroundColor: expandedBackgroundColor,
43153
+ onDropdownSelected: onDropdownSelected
42951
43154
  })), data.length === 0 && /*#__PURE__*/React__default["default"].createElement(NoEventsParent, null, /*#__PURE__*/React__default["default"].createElement(NoEventsWrapper, null, showNoDataInSearch ? getNoDataSearchIcon(noDataSearchIcon) : getNoDataIcon(noDataIcon)), /*#__PURE__*/React__default["default"].createElement(NoEventsMessage, null, showNoDataInSearch ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("strong", null, noDataInSearchTitle), /*#__PURE__*/React__default["default"].createElement("br", null), noDataInSearchMessage) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("strong", null, noEventsTitle), /*#__PURE__*/React__default["default"].createElement("br", null), noEventsSubtitle)), !showNoDataInSearch && showNoEventsButton && /*#__PURE__*/React__default["default"].createElement(Button$1, {
42952
43155
  height: "45px",
42953
43156
  leftIcon: noEventsButtonIcon,