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.esm.js CHANGED
@@ -38226,7 +38226,7 @@ const shimmerAnimation = css`
38226
38226
  }
38227
38227
  `;
38228
38228
  const StyledTableBody = styled.tbody`
38229
- background-color: white;
38229
+ background-color: ${props => props.$isRowFocused ? props.$selectedColor : "white"};
38230
38230
  font-family: "Poppins", sans-serif;
38231
38231
  position: relative;
38232
38232
  `;
@@ -38239,6 +38239,11 @@ const TableRow = styled.tr`
38239
38239
 
38240
38240
  &:hover {
38241
38241
  background-color: #e6f0f0;
38242
+
38243
+ /* Update dropdown buttons when row is hovered */
38244
+ button {
38245
+ background-color: #e6f0f0 !important;
38246
+ }
38242
38247
  }
38243
38248
 
38244
38249
  &:last-child {
@@ -38259,7 +38264,7 @@ styled.div`
38259
38264
  background-color: white;
38260
38265
  color: #333;
38261
38266
  padding: 10px 16px;
38262
- border-radius: 4px;
38267
+ border-radius: 0;
38263
38268
  font-family: "Poppins", sans-serif;
38264
38269
  font-size: 14px;
38265
38270
  font-weight: 400;
@@ -38315,6 +38320,12 @@ const TableCell = styled.td`
38315
38320
  ${props => props.$fieldType === 'expand' && `
38316
38321
  padding: 12px 8px 12px 0px;
38317
38322
  `}
38323
+
38324
+ /* Special handling for dropdown cells - ensure proper overflow */
38325
+ ${props => props.$fieldType === 'dropdown' && `
38326
+ overflow: visible;
38327
+ position: relative;
38328
+ `}
38318
38329
 
38319
38330
  /* CSS-only tooltip */
38320
38331
  &[data-tooltip]:hover::before {
@@ -38721,6 +38732,124 @@ const ExpandedContent = styled.div`
38721
38732
  box-sizing: border-box;
38722
38733
  `;
38723
38734
 
38735
+ // DROPDOWN STYLES
38736
+ styled.div`
38737
+ position: relative;
38738
+ display: inline-block;
38739
+ width: 100%;
38740
+ font-family: "Poppins", sans-serif;
38741
+ `;
38742
+ styled.button`
38743
+ display: flex;
38744
+ align-items: center;
38745
+ justify-content: space-between;
38746
+ width: 100%;
38747
+ min-width: 120px;
38748
+ background-color: ${props => props.$isRowFocused ? props.$selectedColor : "white"};
38749
+ border: none;
38750
+ border-radius: 0;
38751
+ font-family: "Poppins", sans-serif;
38752
+ font-size: 14px;
38753
+ font-weight: 400;
38754
+ color: #212121;
38755
+ cursor: pointer;
38756
+ transition: all 0.2s ease;
38757
+
38758
+ &:hover {
38759
+ background-color: #D1E7E7;
38760
+ }
38761
+
38762
+ &:focus {
38763
+ outline: none;
38764
+ background-color: #E6F0F0;
38765
+ }
38766
+
38767
+ span {
38768
+ overflow: hidden;
38769
+ text-overflow: ellipsis;
38770
+ white-space: nowrap;
38771
+ text-align: left;
38772
+ flex: 1;
38773
+ }
38774
+ `;
38775
+ styled.div`
38776
+ display: flex;
38777
+ align-items: center;
38778
+ justify-content: center;
38779
+ width: 20px;
38780
+ height: 20px;
38781
+ background-color: ${props => props.$isRowFocused || props.$isRowHovered ? '#B4D1D2' : 'white'};
38782
+ border-radius: 4px;
38783
+ margin-left: 8px;
38784
+ transition: all 0.2s ease;
38785
+
38786
+ ${props => props.$isOpen && `
38787
+ transform: rotate(180deg);
38788
+ `}
38789
+ `;
38790
+ styled.div`
38791
+ position: absolute;
38792
+ top: calc(100%);
38793
+ left: 0;
38794
+ right: 0;
38795
+ z-index: 1000;
38796
+ background-color: white;
38797
+ border: none;
38798
+ border-radius: 0;
38799
+ box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
38800
+ font-family: "Poppins", sans-serif;
38801
+ max-height: ${props => props.$maxDropdownHeight || '200px'};
38802
+ overflow-y: auto;
38803
+ padding: 16px;
38804
+
38805
+ /* Custom scrollbar */
38806
+ &::-webkit-scrollbar {
38807
+ width: 4px;
38808
+ }
38809
+
38810
+ &::-webkit-scrollbar-track {
38811
+ background: transparent;
38812
+ }
38813
+
38814
+ &::-webkit-scrollbar-thumb {
38815
+ background: #cbd5e1;
38816
+ border-radius: 2px;
38817
+ }
38818
+
38819
+ &::-webkit-scrollbar-thumb:hover {
38820
+ background: #94a3b8;
38821
+ }
38822
+ `;
38823
+ styled.div`
38824
+ display: flex;
38825
+ align-items: center;
38826
+ justify-content: space-between;
38827
+ padding: 8px;
38828
+ font-size: 14px;
38829
+ font-weight: 400;
38830
+ color: #374151;
38831
+ cursor: pointer;
38832
+ transition: all 0.15s ease;
38833
+ border-radius: 0;
38834
+ border-left: 3px solid transparent;
38835
+ background-color: white;
38836
+
38837
+ &:hover {
38838
+ background-color: #E6F0F0;
38839
+ }
38840
+
38841
+ ${props => props.$isSelected && `
38842
+ background-color: #B4D1D2;
38843
+ color: #374151;
38844
+ font-weight: 500;
38845
+ border-left: 3px solid #066768;
38846
+
38847
+ &:hover {
38848
+ background-color: #A3C9CA;
38849
+ }
38850
+ `}
38851
+ `;
38852
+
38724
38853
  // MessageBox.styles.js
38725
38854
  const ModalOverlay = styled.div`
38726
38855
  position: fixed;
@@ -38939,6 +39068,177 @@ const DisabledTrashIcon = ({
38939
39068
  }));
38940
39069
  };
38941
39070
 
39071
+ // DROPDOWN STYLES
39072
+ const DropdownContainer$1 = styled.div`
39073
+ position: relative;
39074
+ display: inline-block;
39075
+ width: 100%;
39076
+ font-family: "Poppins", sans-serif;
39077
+ `;
39078
+ const DropdownButton$1 = styled.button`
39079
+ display: flex;
39080
+ align-items: center;
39081
+ justify-content: space-between;
39082
+ width: 100%;
39083
+ min-width: 120px;
39084
+ background-color: ${props => props.$isRowFocused || props.$isRowHovered ? props.$selectedColor : "white"};
39085
+ border: none;
39086
+ border-radius: 0;
39087
+ font-family: "Poppins", sans-serif;
39088
+ font-size: 14px;
39089
+ font-weight: 400;
39090
+ color: #212121;
39091
+ cursor: pointer;
39092
+ transition: all 0.2s ease;
39093
+
39094
+ &:hover {
39095
+ background-color: #D1E7E7;
39096
+ }
39097
+
39098
+ &:focus {
39099
+ outline: none;
39100
+ background-color: #E6F0F0;
39101
+ }
39102
+
39103
+ span {
39104
+ overflow: hidden;
39105
+ text-overflow: ellipsis;
39106
+ white-space: nowrap;
39107
+ text-align: left;
39108
+ flex: 1;
39109
+ }
39110
+ `;
39111
+ const DropdownIcon = styled.div`
39112
+ display: flex;
39113
+ align-items: center;
39114
+ justify-content: center;
39115
+ width: 20px;
39116
+ height: 20px;
39117
+ background-color: ${props => props.$isRowFocused || props.$isRowHovered ? '#B4D1D2' : 'white'};
39118
+ border-radius: 4px;
39119
+ margin-left: 8px;
39120
+ transition: all 0.2s ease;
39121
+
39122
+ ${props => props.$isOpen && `
39123
+ transform: rotate(180deg);
39124
+ `}
39125
+ `;
39126
+ const DropdownMenu = styled.div`
39127
+ position: absolute;
39128
+ top: calc(100%);
39129
+ left: 0;
39130
+ right: 0;
39131
+ z-index: 1000;
39132
+ background-color: white;
39133
+ border: none;
39134
+ border-radius: 0;
39135
+ box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
39136
+ font-family: "Poppins", sans-serif;
39137
+ max-height: ${props => props.$maxDropdownHeight || '200px'};
39138
+ overflow-y: auto;
39139
+ padding: 16px;
39140
+
39141
+ /* Custom scrollbar */
39142
+ &::-webkit-scrollbar {
39143
+ width: 4px;
39144
+ }
39145
+
39146
+ &::-webkit-scrollbar-track {
39147
+ background: transparent;
39148
+ }
39149
+
39150
+ &::-webkit-scrollbar-thumb {
39151
+ background: #cbd5e1;
39152
+ border-radius: 2px;
39153
+ }
39154
+
39155
+ &::-webkit-scrollbar-thumb:hover {
39156
+ background: #94a3b8;
39157
+ }
39158
+ `;
39159
+ const DropdownOption = styled.div`
39160
+ display: flex;
39161
+ align-items: center;
39162
+ justify-content: space-between;
39163
+ padding: 8px;
39164
+ font-size: 14px;
39165
+ font-weight: 400;
39166
+ color: #374151;
39167
+ cursor: pointer;
39168
+ transition: all 0.15s ease;
39169
+ border-radius: 0;
39170
+ border-left: 3px solid transparent;
39171
+ background-color: white;
39172
+
39173
+ &:hover {
39174
+ background-color: #E6F0F0;
39175
+ }
39176
+
39177
+ ${props => props.$isSelected && `
39178
+ background-color: #B4D1D2;
39179
+ color: #374151;
39180
+ font-weight: 500;
39181
+ border-left: 3px solid #066768;
39182
+
39183
+ &:hover {
39184
+ background-color: #A3C9CA;
39185
+ }
39186
+ `}
39187
+ `;
39188
+
39189
+ const Dropdown = ({
39190
+ isOpen,
39191
+ options,
39192
+ selectedValue,
39193
+ displayText,
39194
+ onToggle,
39195
+ onOptionSelect,
39196
+ maxDropdownHeight,
39197
+ isRowFocused = false,
39198
+ isRowHovered = false,
39199
+ selectedColor
39200
+ }) => {
39201
+ return /*#__PURE__*/React$1.createElement(DropdownContainer$1, null, /*#__PURE__*/React$1.createElement(DropdownButton$1, {
39202
+ onClick: onToggle,
39203
+ $isOpen: isOpen,
39204
+ $isRowFocused: isRowFocused,
39205
+ $selectedColor: selectedColor
39206
+ }, /*#__PURE__*/React$1.createElement("span", null, displayText), /*#__PURE__*/React$1.createElement(DropdownIcon, {
39207
+ $isOpen: isOpen,
39208
+ $isRowFocused: isRowFocused,
39209
+ $isRowHovered: isRowHovered
39210
+ }, /*#__PURE__*/React$1.createElement(MenuItemOpenIcon, {
39211
+ width: "10",
39212
+ height: "6",
39213
+ color: "#212121"
39214
+ }))), isOpen && /*#__PURE__*/React$1.createElement(DropdownMenu, {
39215
+ $maxDropdownHeight: maxDropdownHeight
39216
+ }, options.map((option, index) => /*#__PURE__*/React$1.createElement(DropdownOption, {
39217
+ key: index,
39218
+ onClick: e => onOptionSelect(option, e),
39219
+ $isSelected: option.value === selectedValue
39220
+ }, /*#__PURE__*/React$1.createElement("span", null, option.label), option.value === selectedValue && /*#__PURE__*/React$1.createElement(OkIcon, {
39221
+ width: "24",
39222
+ height: "24",
39223
+ color: "#066768"
39224
+ })))));
39225
+ };
39226
+ Dropdown.propTypes = {
39227
+ isOpen: PropTypes.bool.isRequired,
39228
+ options: PropTypes.arrayOf(PropTypes.shape({
39229
+ value: PropTypes.string.isRequired,
39230
+ label: PropTypes.string.isRequired
39231
+ })).isRequired,
39232
+ selectedValue: PropTypes.string,
39233
+ displayText: PropTypes.string.isRequired,
39234
+ onToggle: PropTypes.func.isRequired,
39235
+ onOptionSelect: PropTypes.func.isRequired,
39236
+ maxDropdownHeight: PropTypes.string,
39237
+ isRowFocused: PropTypes.bool,
39238
+ isRowHovered: PropTypes.bool,
39239
+ selectedColor: PropTypes.string
39240
+ };
39241
+
38942
39242
  // TableBody.jsx
38943
39243
  const TableBody = ({
38944
39244
  columns,
@@ -38974,12 +39274,14 @@ const TableBody = ({
38974
39274
  onExpandRow = () => {},
38975
39275
  expandedBackgroundColor = '#E6F0F0',
38976
39276
  // New prop with default
39277
+ onDropdownSelected = () => {},
38977
39278
  ref = null
38978
39279
  }) => {
38979
39280
  const [hoveredRowIndex, setHoveredRowIndex] = useState(null);
38980
39281
  const [focusedRowIndex, setFocusedRowIndex] = useState(null);
38981
39282
  const [isCommentModalOpen, setIsCommentModalOpen] = useState(false);
38982
39283
  const [currentCommentRow, setCurrentCommentRow] = useState(null);
39284
+ const [openDropdowns, setOpenDropdowns] = useState({});
38983
39285
 
38984
39286
  // TextArea logic states
38985
39287
  const [commentText, setCommentText] = useState('');
@@ -39317,6 +39619,27 @@ const TableBody = ({
39317
39619
  }));
39318
39620
  }
39319
39621
  return null;
39622
+ case 'dropdown':
39623
+ const dropdownKey = `${rowIndex}-${column.key}`;
39624
+ const isOpen = openDropdowns[dropdownKey] || false;
39625
+ const dropdownOptions = column.dropdownOptions || [];
39626
+ const maxDropdownHeight = column.maxDropdownHeight || '200px';
39627
+
39628
+ // Find the current selected option to display its label
39629
+ const currentOption = dropdownOptions.find(option => option.value === value);
39630
+ const displayText = currentOption ? currentOption.label : value || 'Select...';
39631
+ return /*#__PURE__*/React$1.createElement(Dropdown, {
39632
+ isOpen: isOpen,
39633
+ options: dropdownOptions,
39634
+ selectedValue: value,
39635
+ displayText: displayText,
39636
+ onToggle: e => handleDropdownClick(rowIndex, column.key, e),
39637
+ onOptionSelect: (option, e) => handleDropdownOptionClick(row, rowIndex, column.key, option, e),
39638
+ maxDropdownHeight: maxDropdownHeight,
39639
+ isRowFocused: focusedRowIndex === rowIndex,
39640
+ isRowHovered: hoveredRowIndex === rowIndex,
39641
+ selectedColor: selectedColor
39642
+ });
39320
39643
  default:
39321
39644
  // Treat default as text
39322
39645
  return value.toString();
@@ -39335,6 +39658,44 @@ const TableBody = ({
39335
39658
  onExpandRow(row, rowIndex, expandStatus);
39336
39659
  }
39337
39660
  };
39661
+
39662
+ // Handle dropdown click
39663
+ const handleDropdownClick = (rowIndex, columnKey, event) => {
39664
+ event.stopPropagation();
39665
+ const dropdownKey = `${rowIndex}-${columnKey}`;
39666
+ setOpenDropdowns(prev => ({
39667
+ ...prev,
39668
+ [dropdownKey]: !prev[dropdownKey]
39669
+ }));
39670
+ };
39671
+
39672
+ // Handle dropdown option selection
39673
+ const handleDropdownOptionClick = (row, rowIndex, columnKey, selectedOption, event) => {
39674
+ event.stopPropagation();
39675
+ const dropdownKey = `${rowIndex}-${columnKey}`;
39676
+
39677
+ // Close the dropdown
39678
+ setOpenDropdowns(prev => ({
39679
+ ...prev,
39680
+ [dropdownKey]: false
39681
+ }));
39682
+
39683
+ // Fire the onDropdownSelected event with columnKey instead of columnName
39684
+ if (onDropdownSelected) {
39685
+ onDropdownSelected(row, selectedOption, columnKey);
39686
+ }
39687
+ };
39688
+
39689
+ // Close all dropdowns when clicking outside
39690
+ React$1.useEffect(() => {
39691
+ const handleClickOutside = () => {
39692
+ setOpenDropdowns({});
39693
+ };
39694
+ document.addEventListener('click', handleClickOutside);
39695
+ return () => {
39696
+ document.removeEventListener('click', handleClickOutside);
39697
+ };
39698
+ }, []);
39338
39699
  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
39700
  key: rowIndex
39340
39701
  }, /*#__PURE__*/React$1.createElement(TableRow, {
@@ -39433,6 +39794,7 @@ TableBody.propTypes = {
39433
39794
  statuses: PropTypes.array,
39434
39795
  onCommentSave: PropTypes.func,
39435
39796
  commentTextLimit: PropTypes.number,
39797
+ onDropdownSelected: PropTypes.func,
39436
39798
  ref: PropTypes.object
39437
39799
  };
39438
39800
  TableBody.displayName = 'TableBody';
@@ -42791,6 +43153,7 @@ const Table = props => {
42791
43153
  onExpandRow = () => {},
42792
43154
  expandedBackgroundColor = '#E6F0F0',
42793
43155
  // New prop
43156
+ onDropdownSelected = () => {},
42794
43157
  // Accept ref as a regular prop
42795
43158
  ref = null
42796
43159
  } = props;
@@ -42937,7 +43300,8 @@ const Table = props => {
42937
43300
  expandedRows: expandedRows,
42938
43301
  expandedContent: expandedContent,
42939
43302
  onExpandRow: onExpandRow,
42940
- expandedBackgroundColor: expandedBackgroundColor
43303
+ expandedBackgroundColor: expandedBackgroundColor,
43304
+ onDropdownSelected: onDropdownSelected
42941
43305
  })), 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
43306
  height: "45px",
42943
43307
  leftIcon: noEventsButtonIcon,