sag_components 2.0.0-beta172 → 2.0.0-beta174

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
@@ -38236,7 +38236,7 @@ const shimmerAnimation = styled.css`
38236
38236
  }
38237
38237
  `;
38238
38238
  const StyledTableBody = styled__default["default"].tbody`
38239
- background-color: white;
38239
+ background-color: ${props => props.$isRowFocused ? props.$selectedColor : "white"};
38240
38240
  font-family: "Poppins", sans-serif;
38241
38241
  position: relative;
38242
38242
  `;
@@ -38249,6 +38249,11 @@ const TableRow = styled__default["default"].tr`
38249
38249
 
38250
38250
  &:hover {
38251
38251
  background-color: #e6f0f0;
38252
+
38253
+ /* Update dropdown buttons when row is hovered */
38254
+ button {
38255
+ background-color: #e6f0f0 !important;
38256
+ }
38252
38257
  }
38253
38258
 
38254
38259
  &:last-child {
@@ -38269,7 +38274,7 @@ styled__default["default"].div`
38269
38274
  background-color: white;
38270
38275
  color: #333;
38271
38276
  padding: 10px 16px;
38272
- border-radius: 4px;
38277
+ border-radius: 0;
38273
38278
  font-family: "Poppins", sans-serif;
38274
38279
  font-size: 14px;
38275
38280
  font-weight: 400;
@@ -38325,6 +38330,12 @@ const TableCell = styled__default["default"].td`
38325
38330
  ${props => props.$fieldType === 'expand' && `
38326
38331
  padding: 12px 8px 12px 0px;
38327
38332
  `}
38333
+
38334
+ /* Special handling for dropdown cells - ensure proper overflow */
38335
+ ${props => props.$fieldType === 'dropdown' && `
38336
+ overflow: visible;
38337
+ position: relative;
38338
+ `}
38328
38339
 
38329
38340
  /* CSS-only tooltip */
38330
38341
  &[data-tooltip]:hover::before {
@@ -38731,6 +38742,124 @@ const ExpandedContent = styled__default["default"].div`
38731
38742
  box-sizing: border-box;
38732
38743
  `;
38733
38744
 
38745
+ // DROPDOWN STYLES
38746
+ styled__default["default"].div`
38747
+ position: relative;
38748
+ display: inline-block;
38749
+ width: 100%;
38750
+ font-family: "Poppins", sans-serif;
38751
+ `;
38752
+ styled__default["default"].button`
38753
+ display: flex;
38754
+ align-items: center;
38755
+ justify-content: space-between;
38756
+ width: 100%;
38757
+ min-width: 120px;
38758
+ background-color: ${props => props.$isRowFocused ? props.$selectedColor : "white"};
38759
+ border: none;
38760
+ border-radius: 0;
38761
+ font-family: "Poppins", sans-serif;
38762
+ font-size: 14px;
38763
+ font-weight: 400;
38764
+ color: #212121;
38765
+ cursor: pointer;
38766
+ transition: all 0.2s ease;
38767
+
38768
+ &:hover {
38769
+ background-color: #D1E7E7;
38770
+ }
38771
+
38772
+ &:focus {
38773
+ outline: none;
38774
+ background-color: #E6F0F0;
38775
+ }
38776
+
38777
+ span {
38778
+ overflow: hidden;
38779
+ text-overflow: ellipsis;
38780
+ white-space: nowrap;
38781
+ text-align: left;
38782
+ flex: 1;
38783
+ }
38784
+ `;
38785
+ styled__default["default"].div`
38786
+ display: flex;
38787
+ align-items: center;
38788
+ justify-content: center;
38789
+ width: 20px;
38790
+ height: 20px;
38791
+ background-color: ${props => props.$isRowFocused || props.$isRowHovered ? '#B4D1D2' : 'white'};
38792
+ border-radius: 4px;
38793
+ margin-left: 8px;
38794
+ transition: all 0.2s ease;
38795
+
38796
+ ${props => props.$isOpen && `
38797
+ transform: rotate(180deg);
38798
+ `}
38799
+ `;
38800
+ styled__default["default"].div`
38801
+ position: absolute;
38802
+ top: calc(100%);
38803
+ left: 0;
38804
+ right: 0;
38805
+ z-index: 1000;
38806
+ background-color: white;
38807
+ border: none;
38808
+ border-radius: 0;
38809
+ box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
38810
+ font-family: "Poppins", sans-serif;
38811
+ max-height: ${props => props.$maxDropdownHeight || '200px'};
38812
+ overflow-y: auto;
38813
+ padding: 16px;
38814
+
38815
+ /* Custom scrollbar */
38816
+ &::-webkit-scrollbar {
38817
+ width: 4px;
38818
+ }
38819
+
38820
+ &::-webkit-scrollbar-track {
38821
+ background: transparent;
38822
+ }
38823
+
38824
+ &::-webkit-scrollbar-thumb {
38825
+ background: #cbd5e1;
38826
+ border-radius: 2px;
38827
+ }
38828
+
38829
+ &::-webkit-scrollbar-thumb:hover {
38830
+ background: #94a3b8;
38831
+ }
38832
+ `;
38833
+ styled__default["default"].div`
38834
+ display: flex;
38835
+ align-items: center;
38836
+ justify-content: space-between;
38837
+ padding: 8px;
38838
+ font-size: 14px;
38839
+ font-weight: 400;
38840
+ color: #374151;
38841
+ cursor: pointer;
38842
+ transition: all 0.15s ease;
38843
+ border-radius: 0;
38844
+ border-left: 3px solid transparent;
38845
+ background-color: white;
38846
+
38847
+ &:hover {
38848
+ background-color: #E6F0F0;
38849
+ }
38850
+
38851
+ ${props => props.$isSelected && `
38852
+ background-color: #B4D1D2;
38853
+ color: #374151;
38854
+ font-weight: 500;
38855
+ border-left: 3px solid #066768;
38856
+
38857
+ &:hover {
38858
+ background-color: #A3C9CA;
38859
+ }
38860
+ `}
38861
+ `;
38862
+
38734
38863
  // MessageBox.styles.js
38735
38864
  const ModalOverlay = styled__default["default"].div`
38736
38865
  position: fixed;
@@ -38949,6 +39078,177 @@ const DisabledTrashIcon = ({
38949
39078
  }));
38950
39079
  };
38951
39080
 
39081
+ // DROPDOWN STYLES
39082
+ const DropdownContainer$1 = styled__default["default"].div`
39083
+ position: relative;
39084
+ display: inline-block;
39085
+ width: 100%;
39086
+ font-family: "Poppins", sans-serif;
39087
+ `;
39088
+ const DropdownButton$1 = styled__default["default"].button`
39089
+ display: flex;
39090
+ align-items: center;
39091
+ justify-content: space-between;
39092
+ width: 100%;
39093
+ min-width: 120px;
39094
+ background-color: ${props => props.$isRowFocused || props.$isRowHovered ? props.$selectedColor : "white"};
39095
+ border: none;
39096
+ border-radius: 0;
39097
+ font-family: "Poppins", sans-serif;
39098
+ font-size: 14px;
39099
+ font-weight: 400;
39100
+ color: #212121;
39101
+ cursor: pointer;
39102
+ transition: all 0.2s ease;
39103
+
39104
+ &:hover {
39105
+ background-color: #D1E7E7;
39106
+ }
39107
+
39108
+ &:focus {
39109
+ outline: none;
39110
+ background-color: #E6F0F0;
39111
+ }
39112
+
39113
+ span {
39114
+ overflow: hidden;
39115
+ text-overflow: ellipsis;
39116
+ white-space: nowrap;
39117
+ text-align: left;
39118
+ flex: 1;
39119
+ }
39120
+ `;
39121
+ const DropdownIcon = styled__default["default"].div`
39122
+ display: flex;
39123
+ align-items: center;
39124
+ justify-content: center;
39125
+ width: 20px;
39126
+ height: 20px;
39127
+ background-color: ${props => props.$isRowFocused || props.$isRowHovered ? '#B4D1D2' : 'white'};
39128
+ border-radius: 4px;
39129
+ margin-left: 8px;
39130
+ transition: all 0.2s ease;
39131
+
39132
+ ${props => props.$isOpen && `
39133
+ transform: rotate(180deg);
39134
+ `}
39135
+ `;
39136
+ const DropdownMenu = styled__default["default"].div`
39137
+ position: absolute;
39138
+ top: calc(100%);
39139
+ left: 0;
39140
+ right: 0;
39141
+ z-index: 1000;
39142
+ background-color: white;
39143
+ border: none;
39144
+ border-radius: 0;
39145
+ box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
39146
+ font-family: "Poppins", sans-serif;
39147
+ max-height: ${props => props.$maxDropdownHeight || '200px'};
39148
+ overflow-y: auto;
39149
+ padding: 16px;
39150
+
39151
+ /* Custom scrollbar */
39152
+ &::-webkit-scrollbar {
39153
+ width: 4px;
39154
+ }
39155
+
39156
+ &::-webkit-scrollbar-track {
39157
+ background: transparent;
39158
+ }
39159
+
39160
+ &::-webkit-scrollbar-thumb {
39161
+ background: #cbd5e1;
39162
+ border-radius: 2px;
39163
+ }
39164
+
39165
+ &::-webkit-scrollbar-thumb:hover {
39166
+ background: #94a3b8;
39167
+ }
39168
+ `;
39169
+ const DropdownOption = styled__default["default"].div`
39170
+ display: flex;
39171
+ align-items: center;
39172
+ justify-content: space-between;
39173
+ padding: 8px;
39174
+ font-size: 14px;
39175
+ font-weight: 400;
39176
+ color: #374151;
39177
+ cursor: pointer;
39178
+ transition: all 0.15s ease;
39179
+ border-radius: 0;
39180
+ border-left: 3px solid transparent;
39181
+ background-color: white;
39182
+
39183
+ &:hover {
39184
+ background-color: #E6F0F0;
39185
+ }
39186
+
39187
+ ${props => props.$isSelected && `
39188
+ background-color: #B4D1D2;
39189
+ color: #374151;
39190
+ font-weight: 500;
39191
+ border-left: 3px solid #066768;
39192
+
39193
+ &:hover {
39194
+ background-color: #A3C9CA;
39195
+ }
39196
+ `}
39197
+ `;
39198
+
39199
+ const Dropdown = ({
39200
+ isOpen,
39201
+ options,
39202
+ selectedValue,
39203
+ displayText,
39204
+ onToggle,
39205
+ onOptionSelect,
39206
+ maxDropdownHeight,
39207
+ isRowFocused = false,
39208
+ isRowHovered = false,
39209
+ selectedColor
39210
+ }) => {
39211
+ return /*#__PURE__*/React__default["default"].createElement(DropdownContainer$1, null, /*#__PURE__*/React__default["default"].createElement(DropdownButton$1, {
39212
+ onClick: onToggle,
39213
+ $isOpen: isOpen,
39214
+ $isRowFocused: isRowFocused,
39215
+ $selectedColor: selectedColor
39216
+ }, /*#__PURE__*/React__default["default"].createElement("span", null, displayText), /*#__PURE__*/React__default["default"].createElement(DropdownIcon, {
39217
+ $isOpen: isOpen,
39218
+ $isRowFocused: isRowFocused,
39219
+ $isRowHovered: isRowHovered
39220
+ }, /*#__PURE__*/React__default["default"].createElement(MenuItemOpenIcon, {
39221
+ width: "10",
39222
+ height: "6",
39223
+ color: "#212121"
39224
+ }))), isOpen && /*#__PURE__*/React__default["default"].createElement(DropdownMenu, {
39225
+ $maxDropdownHeight: maxDropdownHeight
39226
+ }, options.map((option, index) => /*#__PURE__*/React__default["default"].createElement(DropdownOption, {
39227
+ key: index,
39228
+ onClick: e => onOptionSelect(option, e),
39229
+ $isSelected: option.value === selectedValue
39230
+ }, /*#__PURE__*/React__default["default"].createElement("span", null, option.label), option.value === selectedValue && /*#__PURE__*/React__default["default"].createElement(OkIcon, {
39231
+ width: "24",
39232
+ height: "24",
39233
+ color: "#066768"
39234
+ })))));
39235
+ };
39236
+ Dropdown.propTypes = {
39237
+ isOpen: PropTypes.bool.isRequired,
39238
+ options: PropTypes.arrayOf(PropTypes.shape({
39239
+ value: PropTypes.string.isRequired,
39240
+ label: PropTypes.string.isRequired
39241
+ })).isRequired,
39242
+ selectedValue: PropTypes.string,
39243
+ displayText: PropTypes.string.isRequired,
39244
+ onToggle: PropTypes.func.isRequired,
39245
+ onOptionSelect: PropTypes.func.isRequired,
39246
+ maxDropdownHeight: PropTypes.string,
39247
+ isRowFocused: PropTypes.bool,
39248
+ isRowHovered: PropTypes.bool,
39249
+ selectedColor: PropTypes.string
39250
+ };
39251
+
38952
39252
  // TableBody.jsx
38953
39253
  const TableBody = ({
38954
39254
  columns,
@@ -38984,12 +39284,14 @@ const TableBody = ({
38984
39284
  onExpandRow = () => {},
38985
39285
  expandedBackgroundColor = '#E6F0F0',
38986
39286
  // New prop with default
39287
+ onDropdownSelected = () => {},
38987
39288
  ref = null
38988
39289
  }) => {
38989
39290
  const [hoveredRowIndex, setHoveredRowIndex] = React$1.useState(null);
38990
39291
  const [focusedRowIndex, setFocusedRowIndex] = React$1.useState(null);
38991
39292
  const [isCommentModalOpen, setIsCommentModalOpen] = React$1.useState(false);
38992
39293
  const [currentCommentRow, setCurrentCommentRow] = React$1.useState(null);
39294
+ const [openDropdowns, setOpenDropdowns] = React$1.useState({});
38993
39295
 
38994
39296
  // TextArea logic states
38995
39297
  const [commentText, setCommentText] = React$1.useState('');
@@ -39327,6 +39629,27 @@ const TableBody = ({
39327
39629
  }));
39328
39630
  }
39329
39631
  return null;
39632
+ case 'dropdown':
39633
+ const dropdownKey = `${rowIndex}-${column.key}`;
39634
+ const isOpen = openDropdowns[dropdownKey] || false;
39635
+ const dropdownOptions = column.dropdownOptions || [];
39636
+ const maxDropdownHeight = column.maxDropdownHeight || '200px';
39637
+
39638
+ // Find the current selected option to display its label
39639
+ const currentOption = dropdownOptions.find(option => option.value === value);
39640
+ const displayText = currentOption ? currentOption.label : value || 'Select...';
39641
+ return /*#__PURE__*/React__default["default"].createElement(Dropdown, {
39642
+ isOpen: isOpen,
39643
+ options: dropdownOptions,
39644
+ selectedValue: value,
39645
+ displayText: displayText,
39646
+ onToggle: e => handleDropdownClick(rowIndex, column.key, e),
39647
+ onOptionSelect: (option, e) => handleDropdownOptionClick(row, rowIndex, column.key, option, e),
39648
+ maxDropdownHeight: maxDropdownHeight,
39649
+ isRowFocused: focusedRowIndex === rowIndex,
39650
+ isRowHovered: hoveredRowIndex === rowIndex,
39651
+ selectedColor: selectedColor
39652
+ });
39330
39653
  default:
39331
39654
  // Treat default as text
39332
39655
  return value.toString();
@@ -39345,6 +39668,44 @@ const TableBody = ({
39345
39668
  onExpandRow(row, rowIndex, expandStatus);
39346
39669
  }
39347
39670
  };
39671
+
39672
+ // Handle dropdown click
39673
+ const handleDropdownClick = (rowIndex, columnKey, event) => {
39674
+ event.stopPropagation();
39675
+ const dropdownKey = `${rowIndex}-${columnKey}`;
39676
+ setOpenDropdowns(prev => ({
39677
+ ...prev,
39678
+ [dropdownKey]: !prev[dropdownKey]
39679
+ }));
39680
+ };
39681
+
39682
+ // Handle dropdown option selection
39683
+ const handleDropdownOptionClick = (row, rowIndex, columnKey, selectedOption, event) => {
39684
+ event.stopPropagation();
39685
+ const dropdownKey = `${rowIndex}-${columnKey}`;
39686
+
39687
+ // Close the dropdown
39688
+ setOpenDropdowns(prev => ({
39689
+ ...prev,
39690
+ [dropdownKey]: false
39691
+ }));
39692
+
39693
+ // Fire the onDropdownSelected event with columnKey instead of columnName
39694
+ if (onDropdownSelected) {
39695
+ onDropdownSelected(row, selectedOption, columnKey);
39696
+ }
39697
+ };
39698
+
39699
+ // Close all dropdowns when clicking outside
39700
+ React__default["default"].useEffect(() => {
39701
+ const handleClickOutside = () => {
39702
+ setOpenDropdowns({});
39703
+ };
39704
+ document.addEventListener('click', handleClickOutside);
39705
+ return () => {
39706
+ document.removeEventListener('click', handleClickOutside);
39707
+ };
39708
+ }, []);
39348
39709
  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
39710
  key: rowIndex
39350
39711
  }, /*#__PURE__*/React__default["default"].createElement(TableRow, {
@@ -39443,6 +39804,7 @@ TableBody.propTypes = {
39443
39804
  statuses: PropTypes.array,
39444
39805
  onCommentSave: PropTypes.func,
39445
39806
  commentTextLimit: PropTypes.number,
39807
+ onDropdownSelected: PropTypes.func,
39446
39808
  ref: PropTypes.object
39447
39809
  };
39448
39810
  TableBody.displayName = 'TableBody';
@@ -42801,6 +43163,7 @@ const Table = props => {
42801
43163
  onExpandRow = () => {},
42802
43164
  expandedBackgroundColor = '#E6F0F0',
42803
43165
  // New prop
43166
+ onDropdownSelected = () => {},
42804
43167
  // Accept ref as a regular prop
42805
43168
  ref = null
42806
43169
  } = props;
@@ -42947,7 +43310,8 @@ const Table = props => {
42947
43310
  expandedRows: expandedRows,
42948
43311
  expandedContent: expandedContent,
42949
43312
  onExpandRow: onExpandRow,
42950
- expandedBackgroundColor: expandedBackgroundColor
43313
+ expandedBackgroundColor: expandedBackgroundColor,
43314
+ onDropdownSelected: onDropdownSelected
42951
43315
  })), 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
43316
  height: "45px",
42953
43317
  leftIcon: noEventsButtonIcon,