sag_components 2.0.0-beta177 → 2.0.0-beta179

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