sag_components 2.0.0-beta177 → 2.0.0-beta178

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
@@ -11003,22 +11003,23 @@ const MonthPopupPicker = ({
11003
11003
  };
11004
11004
 
11005
11005
  /* eslint-disable import/no-extraneous-dependencies */
11006
- const MonthPicker = ({
11007
- availableMonths,
11008
- label,
11009
- onChange,
11010
- borderRadius,
11011
- required,
11012
- width,
11013
- height,
11014
- placeholder,
11015
- disabled,
11016
- borderColor,
11017
- borderColorFocus,
11018
- textColor,
11019
- selectedValue,
11020
- startYear
11021
- }) => {
11006
+ const MonthPicker = _ref => {
11007
+ let {
11008
+ availableMonths,
11009
+ label,
11010
+ onChange,
11011
+ borderRadius,
11012
+ required,
11013
+ width,
11014
+ height,
11015
+ placeholder,
11016
+ disabled,
11017
+ borderColor,
11018
+ borderColorFocus,
11019
+ textColor,
11020
+ selectedValue,
11021
+ startYear
11022
+ } = _ref;
11022
11023
  const [isFocused, setIsFocused] = useState(false);
11023
11024
  const [isOpen, setIsOpen] = useState(false);
11024
11025
  const [value, setValue] = useState('');
@@ -24129,21 +24130,22 @@ const DeleteIcon = styled.div`
24129
24130
  position: absolute;
24130
24131
  `;
24131
24132
 
24132
- const QuickFilterDropdownSingle = ({
24133
- label,
24134
- hoverColor,
24135
- options,
24136
- selectedValue,
24137
- placeHolder,
24138
- onChange,
24139
- disabled,
24140
- width,
24141
- error,
24142
- errorMessage,
24143
- xIconShow,
24144
- labelColor,
24145
- showLabelOnTop
24146
- }) => {
24133
+ const QuickFilterDropdownSingle = _ref => {
24134
+ let {
24135
+ label,
24136
+ hoverColor,
24137
+ options,
24138
+ selectedValue,
24139
+ placeHolder,
24140
+ onChange,
24141
+ disabled,
24142
+ width,
24143
+ error,
24144
+ errorMessage,
24145
+ xIconShow,
24146
+ labelColor,
24147
+ showLabelOnTop
24148
+ } = _ref;
24147
24149
  const [isFocused, setIsFocused] = useState(false);
24148
24150
  const [showOptions, setShowOptions] = useState(false);
24149
24151
  const [inputValue, setInputValue] = useState("");
@@ -24540,23 +24542,24 @@ const IconContainer$2 = styled.div`
24540
24542
  cursor: pointer;
24541
24543
  `;
24542
24544
 
24543
- const QuickFilterDropdownMultiSelection = ({
24544
- label,
24545
- labelEmptyValue,
24546
- options,
24547
- selectedValue,
24548
- placeHolder,
24549
- onChange,
24550
- required,
24551
- disabled,
24552
- width,
24553
- error,
24554
- errorMessage,
24555
- labelColor,
24556
- xIconShow,
24557
- checkBoxColor,
24558
- showLabelOnTop
24559
- }) => {
24545
+ const QuickFilterDropdownMultiSelection = _ref => {
24546
+ let {
24547
+ label,
24548
+ labelEmptyValue,
24549
+ options,
24550
+ selectedValue,
24551
+ placeHolder,
24552
+ onChange,
24553
+ required,
24554
+ disabled,
24555
+ width,
24556
+ error,
24557
+ errorMessage,
24558
+ labelColor,
24559
+ xIconShow,
24560
+ checkBoxColor,
24561
+ showLabelOnTop
24562
+ } = _ref;
24560
24563
  const [isFocused, setIsFocused] = useState(false);
24561
24564
  const [showOptions, setShowOptions] = useState(false);
24562
24565
  const [inputValue, setInputValue] = useState('');
@@ -35872,9 +35875,9 @@ const ToggleSlider = styled.span`
35872
35875
  }
35873
35876
  `;
35874
35877
 
35875
- /**
35876
- * ToggleSwitch component for on/off states.
35877
- * Supports small/large sizes and disabled state.
35878
+ /**
35879
+ * ToggleSwitch component for on/off states.
35880
+ * Supports small/large sizes and disabled state.
35878
35881
  */
35879
35882
  function ToggleSwitch(_ref) {
35880
35883
  let {
@@ -37841,7 +37844,9 @@ const TableHeader = ({
37841
37844
  onSelectAll,
37842
37845
  activeFilters = [],
37843
37846
  activeSorts = [],
37844
- expandable = false
37847
+ expandable = false,
37848
+ onHeaderCheckboxClick = () => {},
37849
+ headerCheckboxStates = {}
37845
37850
  }) => {
37846
37851
  const [focusedFilter, setFocusedFilter] = useState(null);
37847
37852
  const [focusedSort, setFocusedSort] = useState(null);
@@ -38191,6 +38196,20 @@ const TableHeader = ({
38191
38196
  return isFocused || isActive || hasSelection;
38192
38197
  };
38193
38198
 
38199
+ // Handle header checkbox click
38200
+ const handleHeaderCheckboxClick = (columnKey, event) => {
38201
+ // Don't prevent the default checkbox behavior
38202
+ const newValue = event.target.checked;
38203
+
38204
+ // Fire the callback with column info and new value - let parent handle state
38205
+ if (onHeaderCheckboxClick) {
38206
+ onHeaderCheckboxClick({
38207
+ columnName: columnKey,
38208
+ checked: newValue
38209
+ });
38210
+ }
38211
+ };
38212
+
38194
38213
  // Update showColumnFilter to pass current filterSelections to stateless FilterPop
38195
38214
  const showColumnFilter = column => {
38196
38215
  const {
@@ -38294,7 +38313,24 @@ const TableHeader = ({
38294
38313
  type: "checkbox",
38295
38314
  onChange: e => handleCheckboxChange(column.key, e.target.checked),
38296
38315
  "data-column": column.key
38297
- }), /*#__PURE__*/React$1.createElement(ColumnLabel, null, column.title), (column.filter || column.sort) && /*#__PURE__*/React$1.createElement(ColumnActions, null, column.sort && /*#__PURE__*/React$1.createElement(IconButton, {
38316
+ }), column.fieldType?.toLowerCase() === 'checkbox' && column.showCheckboxInTitle !== false && /*#__PURE__*/React$1.createElement(ColumnCheckbox, {
38317
+ type: "checkbox",
38318
+ checked: headerCheckboxStates[column.key] || false,
38319
+ onChange: e => handleHeaderCheckboxClick(column.key, e),
38320
+ "data-column": column.key,
38321
+ style: {
38322
+ width: '18px',
38323
+ height: '18px',
38324
+ marginLeft: '10px',
38325
+ // Moved 5px more to the right (was 5px)
38326
+ cursor: 'pointer',
38327
+ accentColor: '#066768',
38328
+ // Use the same green color as row checkboxes
38329
+ display: 'flex',
38330
+ alignItems: 'center',
38331
+ justifyContent: 'center'
38332
+ }
38333
+ }), column.fieldType?.toLowerCase() !== 'checkbox' && /*#__PURE__*/React$1.createElement(ColumnLabel, null, column.title), (column.filter || column.sort) && /*#__PURE__*/React$1.createElement(ColumnActions, null, column.sort && /*#__PURE__*/React$1.createElement(IconButton, {
38298
38334
  ref: el => iconRefs.current[`sort-${column.key}`] = el,
38299
38335
  onClick: () => handleSort(column.key),
38300
38336
  onMouseEnter: () => setFocusedSort(column.key),
@@ -39270,8 +39306,19 @@ const DropdownButton$1 = styled.button`
39270
39306
  align-items: center;
39271
39307
  justify-content: space-between;
39272
39308
  width: 100%;
39273
- min-width: 120px;
39274
- background-color: ${props => props.$isRowFocused || props.$isRowHovered ? props.$selectedColor : "white"};
39309
+ min-width: 120px;
39310
+ background-color: ${props => {
39311
+ // When row is being hovered (regardless of focus state), use hover color
39312
+ if (props.$isRowHovered) {
39313
+ return props.$selectedColor; // Use selected color for row hover
39314
+ }
39315
+ // Row focused/selected state (only when NOT hovering the row) - should use selected color
39316
+ if (props.$isRowFocused) {
39317
+ return props.$selectedColor; // Use selected color when row is focused/selected
39318
+ }
39319
+ // Default
39320
+ return 'white';
39321
+ }};
39275
39322
  border: none;
39276
39323
  border-radius: 0;
39277
39324
  font-family: "Poppins", sans-serif;
@@ -39304,7 +39351,22 @@ const DropdownIcon = styled.div`
39304
39351
  justify-content: center;
39305
39352
  width: 20px;
39306
39353
  height: 20px;
39307
- background-color: ${props => props.$isRowFocused || props.$isRowHovered ? '#B4D1D2' : 'white'};
39354
+ background-color: ${props => {
39355
+ // Highest Priority: dropdown-specific hover takes precedence over everything
39356
+ if (props.$isDropdownHovered) {
39357
+ return '#B4D1D2'; // Green color when specifically hovering this dropdown
39358
+ }
39359
+ // When row is being hovered (regardless of focus state), other dropdowns should use hover color
39360
+ if (props.$isRowHovered) {
39361
+ return '#E6F0F0'; // Light gray when row is hovered but not this specific dropdown
39362
+ }
39363
+ // Row focused/selected state (only when NOT hovering the row) - should use green color
39364
+ if (props.$isRowFocused) {
39365
+ return '#B4D1D2'; // Green color when row is focused/selected but not being hovered
39366
+ }
39367
+ // Default
39368
+ return 'white';
39369
+ }};
39308
39370
  border-radius: 4px;
39309
39371
  margin-left: 8px;
39310
39372
  transition: all 0.2s ease;
@@ -39316,8 +39378,14 @@ const DropdownIcon = styled.div`
39316
39378
  const DropdownMenu = styled.div`
39317
39379
  position: absolute;
39318
39380
  top: calc(100%);
39319
- left: 0;
39320
- right: 0;
39381
+ ${props => {
39382
+ if (props.$dropdownOptionsAlignment === 'left') {
39383
+ return props.$dropdownOptionsWidth ? `left: 0; width: ${props.$dropdownOptionsWidth};` : 'left: 0; right: 0;';
39384
+ } else {
39385
+ // Default: right alignment
39386
+ return props.$dropdownOptionsWidth ? `right: 0; width: ${props.$dropdownOptionsWidth};` : 'left: 0; right: 0;';
39387
+ }
39388
+ }}
39321
39389
  z-index: 1000;
39322
39390
  background-color: white;
39323
39391
  border: none;
@@ -39386,23 +39454,41 @@ const Dropdown = ({
39386
39454
  maxDropdownHeight,
39387
39455
  isRowFocused = false,
39388
39456
  isRowHovered = false,
39389
- selectedColor
39457
+ selectedColor,
39458
+ dropdownOptionsWidth,
39459
+ dropdownOptionsAlignment = 'right',
39460
+ placeholder = 'Select...'
39390
39461
  }) => {
39391
- return /*#__PURE__*/React$1.createElement(DropdownContainer$1, null, /*#__PURE__*/React$1.createElement(DropdownButton$1, {
39462
+ const [isDropdownHovered, setIsDropdownHovered] = useState(false);
39463
+
39464
+ // Reset dropdown hover state when dropdown closes
39465
+ useEffect(() => {
39466
+ if (!isOpen) {
39467
+ setIsDropdownHovered(false);
39468
+ }
39469
+ }, [isOpen]);
39470
+ return /*#__PURE__*/React$1.createElement(DropdownContainer$1, {
39471
+ onMouseEnter: () => setIsDropdownHovered(true),
39472
+ onMouseLeave: () => setIsDropdownHovered(false)
39473
+ }, /*#__PURE__*/React$1.createElement(DropdownButton$1, {
39392
39474
  onClick: onToggle,
39393
39475
  $isOpen: isOpen,
39394
39476
  $isRowFocused: isRowFocused,
39477
+ $isRowHovered: isRowHovered,
39395
39478
  $selectedColor: selectedColor
39396
39479
  }, /*#__PURE__*/React$1.createElement("span", null, displayText), /*#__PURE__*/React$1.createElement(DropdownIcon, {
39397
39480
  $isOpen: isOpen,
39398
39481
  $isRowFocused: isRowFocused,
39399
- $isRowHovered: isRowHovered
39482
+ $isRowHovered: isRowHovered,
39483
+ $isDropdownHovered: isDropdownHovered
39400
39484
  }, /*#__PURE__*/React$1.createElement(MenuItemOpenIcon, {
39401
39485
  width: "10",
39402
39486
  height: "6",
39403
39487
  color: "#212121"
39404
39488
  }))), isOpen && /*#__PURE__*/React$1.createElement(DropdownMenu, {
39405
- $maxDropdownHeight: maxDropdownHeight
39489
+ $maxDropdownHeight: maxDropdownHeight,
39490
+ $dropdownOptionsWidth: dropdownOptionsWidth,
39491
+ $dropdownOptionsAlignment: dropdownOptionsAlignment
39406
39492
  }, options.map((option, index) => /*#__PURE__*/React$1.createElement(DropdownOption, {
39407
39493
  key: index,
39408
39494
  onClick: e => onOptionSelect(option, e),
@@ -39426,7 +39512,10 @@ Dropdown.propTypes = {
39426
39512
  maxDropdownHeight: PropTypes.string,
39427
39513
  isRowFocused: PropTypes.bool,
39428
39514
  isRowHovered: PropTypes.bool,
39429
- selectedColor: PropTypes.string
39515
+ selectedColor: PropTypes.string,
39516
+ dropdownOptionsWidth: PropTypes.string,
39517
+ dropdownOptionsAlignment: PropTypes.oneOf(['left', 'right']),
39518
+ placeholder: PropTypes.string
39430
39519
  };
39431
39520
 
39432
39521
  // TableBody.jsx
@@ -39465,6 +39554,8 @@ const TableBody = ({
39465
39554
  expandedBackgroundColor = '#E6F0F0',
39466
39555
  // New prop with default
39467
39556
  onDropdownSelected = () => {},
39557
+ onCheckboxClick = () => {},
39558
+ onHeaderCheckboxClick = () => {},
39468
39559
  ref = null
39469
39560
  }) => {
39470
39561
  const [hoveredRowIndex, setHoveredRowIndex] = useState(null);
@@ -39814,10 +39905,13 @@ const TableBody = ({
39814
39905
  const isOpen = openDropdowns[dropdownKey] || false;
39815
39906
  const dropdownOptions = column.dropdownOptions || [];
39816
39907
  const maxDropdownHeight = column.maxDropdownHeight || '200px';
39908
+ const dropdownOptionsWidth = column.dropdownOptionsWidth; // Get from column config
39909
+ const dropdownOptionsAlignment = column.dropdownOptionsAlignment || 'right'; // Get from column config, default to 'right'
39910
+ const placeholder = column.placeholder || 'Select...'; // Get from column config, default to 'Select...'
39817
39911
 
39818
39912
  // Find the current selected option to display its label
39819
39913
  const currentOption = dropdownOptions.find(option => option.value === value);
39820
- const displayText = currentOption ? currentOption.label : value || 'Select...';
39914
+ const displayText = currentOption ? currentOption.label : value || placeholder;
39821
39915
  return /*#__PURE__*/React$1.createElement(Dropdown, {
39822
39916
  isOpen: isOpen,
39823
39917
  options: dropdownOptions,
@@ -39826,10 +39920,37 @@ const TableBody = ({
39826
39920
  onToggle: e => handleDropdownClick(rowIndex, column.key, e),
39827
39921
  onOptionSelect: (option, e) => handleDropdownOptionClick(row, rowIndex, column.key, option, e),
39828
39922
  maxDropdownHeight: maxDropdownHeight,
39923
+ dropdownOptionsWidth: dropdownOptionsWidth,
39924
+ dropdownOptionsAlignment: dropdownOptionsAlignment,
39925
+ placeholder: placeholder,
39829
39926
  isRowFocused: focusedRowIndex === rowIndex,
39830
39927
  isRowHovered: hoveredRowIndex === rowIndex,
39831
39928
  selectedColor: selectedColor
39832
39929
  });
39930
+ case 'checkbox':
39931
+ const isChecked = Boolean(value); // Convert to boolean
39932
+
39933
+ return /*#__PURE__*/React$1.createElement("div", {
39934
+ style: {
39935
+ display: 'flex',
39936
+ alignItems: 'center',
39937
+ justifyContent: 'center',
39938
+ width: '100%',
39939
+ height: '100%'
39940
+ }
39941
+ }, /*#__PURE__*/React$1.createElement("input", {
39942
+ type: "checkbox",
39943
+ checked: isChecked,
39944
+ onChange: e => handleCheckboxClick(row, column.key, e),
39945
+ onClick: e => e.stopPropagation() // Prevent row click on checkbox click
39946
+ ,
39947
+ style: {
39948
+ width: '18px',
39949
+ height: '18px',
39950
+ cursor: 'pointer',
39951
+ accentColor: buttonColor // Use the theme color for checkbox
39952
+ }
39953
+ }));
39833
39954
  default:
39834
39955
  // Treat default as text
39835
39956
  return value.toString();
@@ -39849,6 +39970,28 @@ const TableBody = ({
39849
39970
  }
39850
39971
  };
39851
39972
 
39973
+ // Handle checkbox click
39974
+ const handleCheckboxClick = (row, columnKey, event) => {
39975
+ event.stopPropagation();
39976
+ const currentValue = row[columnKey];
39977
+ const newValue = !currentValue; // Toggle the value
39978
+
39979
+ // Create updated row with new checkbox value
39980
+ const updatedRow = {
39981
+ ...row,
39982
+ [columnKey]: newValue
39983
+ };
39984
+
39985
+ // Fire the onCheckboxClick event with updated row
39986
+ if (onCheckboxClick) {
39987
+ onCheckboxClick({
39988
+ fullRow: updatedRow,
39989
+ columnName: columnKey,
39990
+ checked: newValue
39991
+ });
39992
+ }
39993
+ };
39994
+
39852
39995
  // Handle dropdown click
39853
39996
  const handleDropdownClick = (rowIndex, columnKey, event) => {
39854
39997
  event.stopPropagation();
@@ -39985,6 +40128,8 @@ TableBody.propTypes = {
39985
40128
  onCommentSave: PropTypes.func,
39986
40129
  commentTextLimit: PropTypes.number,
39987
40130
  onDropdownSelected: PropTypes.func,
40131
+ onCheckboxClick: PropTypes.func,
40132
+ onHeaderCheckboxClick: PropTypes.func,
39988
40133
  ref: PropTypes.object
39989
40134
  };
39990
40135
  TableBody.displayName = 'TableBody';
@@ -43344,6 +43489,9 @@ const Table = props => {
43344
43489
  expandedBackgroundColor = '#E6F0F0',
43345
43490
  // New prop
43346
43491
  onDropdownSelected = () => {},
43492
+ onCheckboxClick = () => {},
43493
+ onHeaderCheckboxClick = () => {},
43494
+ headerCheckboxStates = {},
43347
43495
  // Accept ref as a regular prop
43348
43496
  ref = null
43349
43497
  } = props;
@@ -43470,7 +43618,9 @@ const Table = props => {
43470
43618
  onSort: onSort,
43471
43619
  onFilter: onFilter,
43472
43620
  onSelectAll: onSelectAll,
43473
- expandable: expandable
43621
+ expandable: expandable,
43622
+ onHeaderCheckboxClick: onHeaderCheckboxClick,
43623
+ headerCheckboxStates: headerCheckboxStates
43474
43624
  }), columns.length > 0 && data.length > 0 && /*#__PURE__*/React$1.createElement(TableBody, {
43475
43625
  ref: tableBodyRef,
43476
43626
  columns: columns,
@@ -43491,7 +43641,9 @@ const Table = props => {
43491
43641
  expandedContent: expandedContent,
43492
43642
  onExpandRow: onExpandRow,
43493
43643
  expandedBackgroundColor: expandedBackgroundColor,
43494
- onDropdownSelected: onDropdownSelected
43644
+ onDropdownSelected: onDropdownSelected,
43645
+ onCheckboxClick: onCheckboxClick,
43646
+ onHeaderCheckboxClick: onHeaderCheckboxClick
43495
43647
  })), 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, {
43496
43648
  height: "45px",
43497
43649
  leftIcon: noEventsButtonIcon,