sag_components 2.0.0-beta171 → 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
@@ -24013,21 +24013,22 @@ const DeleteIcon = styled.div`
24013
24013
  position: absolute;
24014
24014
  `;
24015
24015
 
24016
- const QuickFilterDropdownSingle = ({
24017
- label,
24018
- hoverColor,
24019
- options,
24020
- selectedValue,
24021
- placeHolder,
24022
- onChange,
24023
- disabled,
24024
- width,
24025
- error,
24026
- errorMessage,
24027
- xIconShow,
24028
- labelColor,
24029
- showLabelOnTop
24030
- }) => {
24016
+ const QuickFilterDropdownSingle = _ref => {
24017
+ let {
24018
+ label,
24019
+ hoverColor,
24020
+ options,
24021
+ selectedValue,
24022
+ placeHolder,
24023
+ onChange,
24024
+ disabled,
24025
+ width,
24026
+ error,
24027
+ errorMessage,
24028
+ xIconShow,
24029
+ labelColor,
24030
+ showLabelOnTop
24031
+ } = _ref;
24031
24032
  const [isFocused, setIsFocused] = useState(false);
24032
24033
  const [showOptions, setShowOptions] = useState(false);
24033
24034
  const [inputValue, setInputValue] = useState("");
@@ -24424,23 +24425,24 @@ const IconContainer$2 = styled.div`
24424
24425
  cursor: pointer;
24425
24426
  `;
24426
24427
 
24427
- const QuickFilterDropdownMultiSelection = ({
24428
- label,
24429
- labelEmptyValue,
24430
- options,
24431
- selectedValue,
24432
- placeHolder,
24433
- onChange,
24434
- required,
24435
- disabled,
24436
- width,
24437
- error,
24438
- errorMessage,
24439
- labelColor,
24440
- xIconShow,
24441
- checkBoxColor,
24442
- showLabelOnTop
24443
- }) => {
24428
+ const QuickFilterDropdownMultiSelection = _ref => {
24429
+ let {
24430
+ label,
24431
+ labelEmptyValue,
24432
+ options,
24433
+ selectedValue,
24434
+ placeHolder,
24435
+ onChange,
24436
+ required,
24437
+ disabled,
24438
+ width,
24439
+ error,
24440
+ errorMessage,
24441
+ labelColor,
24442
+ xIconShow,
24443
+ checkBoxColor,
24444
+ showLabelOnTop
24445
+ } = _ref;
24444
24446
  const [isFocused, setIsFocused] = useState(false);
24445
24447
  const [showOptions, setShowOptions] = useState(false);
24446
24448
  const [inputValue, setInputValue] = useState('');
@@ -35678,9 +35680,9 @@ const ToggleSlider = styled.span`
35678
35680
  }
35679
35681
  `;
35680
35682
 
35681
- /**
35682
- * ToggleSwitch component for on/off states.
35683
- * Supports small/large sizes and disabled state.
35683
+ /**
35684
+ * ToggleSwitch component for on/off states.
35685
+ * Supports small/large sizes and disabled state.
35684
35686
  */
35685
35687
  function ToggleSwitch(_ref) {
35686
35688
  let {
@@ -38222,7 +38224,7 @@ const shimmerAnimation = css`
38222
38224
  }
38223
38225
  `;
38224
38226
  const StyledTableBody = styled.tbody`
38225
- background-color: white;
38227
+ background-color: ${props => props.$isRowFocused ? props.$selectedColor : "white"};
38226
38228
  font-family: "Poppins", sans-serif;
38227
38229
  position: relative;
38228
38230
  `;
@@ -38235,6 +38237,11 @@ const TableRow = styled.tr`
38235
38237
 
38236
38238
  &:hover {
38237
38239
  background-color: #e6f0f0;
38240
+
38241
+ /* Update dropdown buttons when row is hovered */
38242
+ button {
38243
+ background-color: #e6f0f0 !important;
38244
+ }
38238
38245
  }
38239
38246
 
38240
38247
  &:last-child {
@@ -38255,7 +38262,7 @@ styled.div`
38255
38262
  background-color: white;
38256
38263
  color: #333;
38257
38264
  padding: 10px 16px;
38258
- border-radius: 4px;
38265
+ border-radius: 0;
38259
38266
  font-family: "Poppins", sans-serif;
38260
38267
  font-size: 14px;
38261
38268
  font-weight: 400;
@@ -38311,6 +38318,12 @@ const TableCell = styled.td`
38311
38318
  ${props => props.$fieldType === 'expand' && `
38312
38319
  padding: 12px 8px 12px 0px;
38313
38320
  `}
38321
+
38322
+ /* Special handling for dropdown cells - ensure proper overflow */
38323
+ ${props => props.$fieldType === 'dropdown' && `
38324
+ overflow: visible;
38325
+ position: relative;
38326
+ `}
38314
38327
 
38315
38328
  /* CSS-only tooltip */
38316
38329
  &[data-tooltip]:hover::before {
@@ -38709,9 +38722,7 @@ const ExpandedRow = styled.tr`
38709
38722
  }
38710
38723
  `;
38711
38724
  const ExpandedContent = styled.div`
38712
- padding: 16px;
38713
38725
  background-color: ${props => props.$expandedBackgroundColor || '#E6F0F0'};
38714
- border-left: 3px solid #e0e0e0;
38715
38726
  margin: 0;
38716
38727
 
38717
38728
  /* Ensure content doesn't interfere with table layout */
@@ -38719,6 +38730,124 @@ const ExpandedContent = styled.div`
38719
38730
  box-sizing: border-box;
38720
38731
  `;
38721
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
+
38722
38851
  // MessageBox.styles.js
38723
38852
  const ModalOverlay = styled.div`
38724
38853
  position: fixed;
@@ -38972,12 +39101,14 @@ const TableBody = ({
38972
39101
  onExpandRow = () => {},
38973
39102
  expandedBackgroundColor = '#E6F0F0',
38974
39103
  // New prop with default
39104
+ onDropdownSelected = () => {},
38975
39105
  ref = null
38976
39106
  }) => {
38977
39107
  const [hoveredRowIndex, setHoveredRowIndex] = useState(null);
38978
39108
  const [focusedRowIndex, setFocusedRowIndex] = useState(null);
38979
39109
  const [isCommentModalOpen, setIsCommentModalOpen] = useState(false);
38980
39110
  const [currentCommentRow, setCurrentCommentRow] = useState(null);
39111
+ const [openDropdowns, setOpenDropdowns] = useState({});
38981
39112
 
38982
39113
  // TextArea logic states
38983
39114
  const [commentText, setCommentText] = useState('');
@@ -39315,6 +39446,39 @@ const TableBody = ({
39315
39446
  }));
39316
39447
  }
39317
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
+ })))));
39318
39482
  default:
39319
39483
  // Treat default as text
39320
39484
  return value.toString();
@@ -39333,6 +39497,44 @@ const TableBody = ({
39333
39497
  onExpandRow(row, rowIndex, expandStatus);
39334
39498
  }
39335
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
+ }, []);
39336
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, {
39337
39539
  key: rowIndex
39338
39540
  }, /*#__PURE__*/React$1.createElement(TableRow, {
@@ -39431,6 +39633,7 @@ TableBody.propTypes = {
39431
39633
  statuses: PropTypes.array,
39432
39634
  onCommentSave: PropTypes.func,
39433
39635
  commentTextLimit: PropTypes.number,
39636
+ onDropdownSelected: PropTypes.func,
39434
39637
  ref: PropTypes.object
39435
39638
  };
39436
39639
  TableBody.displayName = 'TableBody';
@@ -42789,6 +42992,7 @@ const Table = props => {
42789
42992
  onExpandRow = () => {},
42790
42993
  expandedBackgroundColor = '#E6F0F0',
42791
42994
  // New prop
42995
+ onDropdownSelected = () => {},
42792
42996
  // Accept ref as a regular prop
42793
42997
  ref = null
42794
42998
  } = props;
@@ -42935,7 +43139,8 @@ const Table = props => {
42935
43139
  expandedRows: expandedRows,
42936
43140
  expandedContent: expandedContent,
42937
43141
  onExpandRow: onExpandRow,
42938
- expandedBackgroundColor: expandedBackgroundColor
43142
+ expandedBackgroundColor: expandedBackgroundColor,
43143
+ onDropdownSelected: onDropdownSelected
42939
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, {
42940
43145
  height: "45px",
42941
43146
  leftIcon: noEventsButtonIcon,