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.js CHANGED
@@ -10555,23 +10555,24 @@ const QuarterPopupPicker = ({
10555
10555
  };
10556
10556
 
10557
10557
  /* eslint-disable import/no-extraneous-dependencies */
10558
- const QuarterPicker = ({
10559
- availableQuarters,
10560
- // ["Q1-2024"]
10561
- label,
10562
- onChange,
10563
- borderRadius,
10564
- required,
10565
- width,
10566
- height,
10567
- placeholder,
10568
- disabled,
10569
- borderColor,
10570
- borderColorFocus,
10571
- textColor,
10572
- selectedValue,
10573
- startYear
10574
- }) => {
10558
+ const QuarterPicker = _ref => {
10559
+ let {
10560
+ availableQuarters,
10561
+ // ["Q1-2024"]
10562
+ label,
10563
+ onChange,
10564
+ borderRadius,
10565
+ required,
10566
+ width,
10567
+ height,
10568
+ placeholder,
10569
+ disabled,
10570
+ borderColor,
10571
+ borderColorFocus,
10572
+ textColor,
10573
+ selectedValue,
10574
+ startYear
10575
+ } = _ref;
10575
10576
  const [isFocused, setIsFocused] = React$1.useState(false);
10576
10577
  const [isOpen, setIsOpen] = React$1.useState(false);
10577
10578
  const [value, setValue] = React$1.useState('');
@@ -11013,22 +11014,23 @@ const MonthPopupPicker = ({
11013
11014
  };
11014
11015
 
11015
11016
  /* eslint-disable import/no-extraneous-dependencies */
11016
- const MonthPicker = ({
11017
- availableMonths,
11018
- label,
11019
- onChange,
11020
- borderRadius,
11021
- required,
11022
- width,
11023
- height,
11024
- placeholder,
11025
- disabled,
11026
- borderColor,
11027
- borderColorFocus,
11028
- textColor,
11029
- selectedValue,
11030
- startYear
11031
- }) => {
11017
+ const MonthPicker = _ref => {
11018
+ let {
11019
+ availableMonths,
11020
+ label,
11021
+ onChange,
11022
+ borderRadius,
11023
+ required,
11024
+ width,
11025
+ height,
11026
+ placeholder,
11027
+ disabled,
11028
+ borderColor,
11029
+ borderColorFocus,
11030
+ textColor,
11031
+ selectedValue,
11032
+ startYear
11033
+ } = _ref;
11032
11034
  const [isFocused, setIsFocused] = React$1.useState(false);
11033
11035
  const [isOpen, setIsOpen] = React$1.useState(false);
11034
11036
  const [value, setValue] = React$1.useState('');
@@ -24139,21 +24141,22 @@ const DeleteIcon = styled__default["default"].div`
24139
24141
  position: absolute;
24140
24142
  `;
24141
24143
 
24142
- const QuickFilterDropdownSingle = ({
24143
- label,
24144
- hoverColor,
24145
- options,
24146
- selectedValue,
24147
- placeHolder,
24148
- onChange,
24149
- disabled,
24150
- width,
24151
- error,
24152
- errorMessage,
24153
- xIconShow,
24154
- labelColor,
24155
- showLabelOnTop
24156
- }) => {
24144
+ const QuickFilterDropdownSingle = _ref => {
24145
+ let {
24146
+ label,
24147
+ hoverColor,
24148
+ options,
24149
+ selectedValue,
24150
+ placeHolder,
24151
+ onChange,
24152
+ disabled,
24153
+ width,
24154
+ error,
24155
+ errorMessage,
24156
+ xIconShow,
24157
+ labelColor,
24158
+ showLabelOnTop
24159
+ } = _ref;
24157
24160
  const [isFocused, setIsFocused] = React$1.useState(false);
24158
24161
  const [showOptions, setShowOptions] = React$1.useState(false);
24159
24162
  const [inputValue, setInputValue] = React$1.useState("");
@@ -24550,23 +24553,24 @@ const IconContainer$2 = styled__default["default"].div`
24550
24553
  cursor: pointer;
24551
24554
  `;
24552
24555
 
24553
- const QuickFilterDropdownMultiSelection = ({
24554
- label,
24555
- labelEmptyValue,
24556
- options,
24557
- selectedValue,
24558
- placeHolder,
24559
- onChange,
24560
- required,
24561
- disabled,
24562
- width,
24563
- error,
24564
- errorMessage,
24565
- labelColor,
24566
- xIconShow,
24567
- checkBoxColor,
24568
- showLabelOnTop
24569
- }) => {
24556
+ const QuickFilterDropdownMultiSelection = _ref => {
24557
+ let {
24558
+ label,
24559
+ labelEmptyValue,
24560
+ options,
24561
+ selectedValue,
24562
+ placeHolder,
24563
+ onChange,
24564
+ required,
24565
+ disabled,
24566
+ width,
24567
+ error,
24568
+ errorMessage,
24569
+ labelColor,
24570
+ xIconShow,
24571
+ checkBoxColor,
24572
+ showLabelOnTop
24573
+ } = _ref;
24570
24574
  const [isFocused, setIsFocused] = React$1.useState(false);
24571
24575
  const [showOptions, setShowOptions] = React$1.useState(false);
24572
24576
  const [inputValue, setInputValue] = React$1.useState('');
@@ -35882,9 +35886,9 @@ const ToggleSlider = styled__default["default"].span`
35882
35886
  }
35883
35887
  `;
35884
35888
 
35885
- /**
35886
- * ToggleSwitch component for on/off states.
35887
- * Supports small/large sizes and disabled state.
35889
+ /**
35890
+ * ToggleSwitch component for on/off states.
35891
+ * Supports small/large sizes and disabled state.
35888
35892
  */
35889
35893
  function ToggleSwitch(_ref) {
35890
35894
  let {
@@ -37851,7 +37855,9 @@ const TableHeader = ({
37851
37855
  onSelectAll,
37852
37856
  activeFilters = [],
37853
37857
  activeSorts = [],
37854
- expandable = false
37858
+ expandable = false,
37859
+ onHeaderCheckboxClick = () => {},
37860
+ headerCheckboxStates = {}
37855
37861
  }) => {
37856
37862
  const [focusedFilter, setFocusedFilter] = React$1.useState(null);
37857
37863
  const [focusedSort, setFocusedSort] = React$1.useState(null);
@@ -38201,6 +38207,20 @@ const TableHeader = ({
38201
38207
  return isFocused || isActive || hasSelection;
38202
38208
  };
38203
38209
 
38210
+ // Handle header checkbox click
38211
+ const handleHeaderCheckboxClick = (columnKey, event) => {
38212
+ // Don't prevent the default checkbox behavior
38213
+ const newValue = event.target.checked;
38214
+
38215
+ // Fire the callback with column info and new value - let parent handle state
38216
+ if (onHeaderCheckboxClick) {
38217
+ onHeaderCheckboxClick({
38218
+ columnName: columnKey,
38219
+ checked: newValue
38220
+ });
38221
+ }
38222
+ };
38223
+
38204
38224
  // Update showColumnFilter to pass current filterSelections to stateless FilterPop
38205
38225
  const showColumnFilter = column => {
38206
38226
  const {
@@ -38304,7 +38324,24 @@ const TableHeader = ({
38304
38324
  type: "checkbox",
38305
38325
  onChange: e => handleCheckboxChange(column.key, e.target.checked),
38306
38326
  "data-column": column.key
38307
- }), /*#__PURE__*/React__default["default"].createElement(ColumnLabel, null, column.title), (column.filter || column.sort) && /*#__PURE__*/React__default["default"].createElement(ColumnActions, null, column.sort && /*#__PURE__*/React__default["default"].createElement(IconButton, {
38327
+ }), column.fieldType?.toLowerCase() === 'checkbox' && column.showCheckboxInTitle !== false && /*#__PURE__*/React__default["default"].createElement(ColumnCheckbox, {
38328
+ type: "checkbox",
38329
+ checked: headerCheckboxStates[column.key] || false,
38330
+ onChange: e => handleHeaderCheckboxClick(column.key, e),
38331
+ "data-column": column.key,
38332
+ style: {
38333
+ width: '18px',
38334
+ height: '18px',
38335
+ marginLeft: '10px',
38336
+ // Moved 5px more to the right (was 5px)
38337
+ cursor: 'pointer',
38338
+ accentColor: '#066768',
38339
+ // Use the same green color as row checkboxes
38340
+ display: 'flex',
38341
+ alignItems: 'center',
38342
+ justifyContent: 'center'
38343
+ }
38344
+ }), column.fieldType?.toLowerCase() !== 'checkbox' && /*#__PURE__*/React__default["default"].createElement(ColumnLabel, null, column.title), (column.filter || column.sort) && /*#__PURE__*/React__default["default"].createElement(ColumnActions, null, column.sort && /*#__PURE__*/React__default["default"].createElement(IconButton, {
38308
38345
  ref: el => iconRefs.current[`sort-${column.key}`] = el,
38309
38346
  onClick: () => handleSort(column.key),
38310
38347
  onMouseEnter: () => setFocusedSort(column.key),
@@ -39280,8 +39317,19 @@ const DropdownButton$1 = styled__default["default"].button`
39280
39317
  align-items: center;
39281
39318
  justify-content: space-between;
39282
39319
  width: 100%;
39283
- min-width: 120px;
39284
- background-color: ${props => props.$isRowFocused || props.$isRowHovered ? props.$selectedColor : "white"};
39320
+ min-width: 120px;
39321
+ background-color: ${props => {
39322
+ // When row is being hovered (regardless of focus state), use hover color
39323
+ if (props.$isRowHovered) {
39324
+ return props.$selectedColor; // Use selected color for row hover
39325
+ }
39326
+ // Row focused/selected state (only when NOT hovering the row) - should use selected color
39327
+ if (props.$isRowFocused) {
39328
+ return props.$selectedColor; // Use selected color when row is focused/selected
39329
+ }
39330
+ // Default
39331
+ return 'white';
39332
+ }};
39285
39333
  border: none;
39286
39334
  border-radius: 0;
39287
39335
  font-family: "Poppins", sans-serif;
@@ -39314,7 +39362,22 @@ const DropdownIcon = styled__default["default"].div`
39314
39362
  justify-content: center;
39315
39363
  width: 20px;
39316
39364
  height: 20px;
39317
- background-color: ${props => props.$isRowFocused || props.$isRowHovered ? '#B4D1D2' : 'white'};
39365
+ background-color: ${props => {
39366
+ // Highest Priority: dropdown-specific hover takes precedence over everything
39367
+ if (props.$isDropdownHovered) {
39368
+ return '#B4D1D2'; // Green color when specifically hovering this dropdown
39369
+ }
39370
+ // When row is being hovered (regardless of focus state), other dropdowns should use hover color
39371
+ if (props.$isRowHovered) {
39372
+ return '#E6F0F0'; // Light gray when row is hovered but not this specific dropdown
39373
+ }
39374
+ // Row focused/selected state (only when NOT hovering the row) - should use green color
39375
+ if (props.$isRowFocused) {
39376
+ return '#B4D1D2'; // Green color when row is focused/selected but not being hovered
39377
+ }
39378
+ // Default
39379
+ return 'white';
39380
+ }};
39318
39381
  border-radius: 4px;
39319
39382
  margin-left: 8px;
39320
39383
  transition: all 0.2s ease;
@@ -39326,8 +39389,14 @@ const DropdownIcon = styled__default["default"].div`
39326
39389
  const DropdownMenu = styled__default["default"].div`
39327
39390
  position: absolute;
39328
39391
  top: calc(100%);
39329
- left: 0;
39330
- right: 0;
39392
+ ${props => {
39393
+ if (props.$dropdownOptionsAlignment === 'left') {
39394
+ return props.$dropdownOptionsWidth ? `left: 0; width: ${props.$dropdownOptionsWidth};` : 'left: 0; right: 0;';
39395
+ } else {
39396
+ // Default: right alignment
39397
+ return props.$dropdownOptionsWidth ? `right: 0; width: ${props.$dropdownOptionsWidth};` : 'left: 0; right: 0;';
39398
+ }
39399
+ }}
39331
39400
  z-index: 1000;
39332
39401
  background-color: white;
39333
39402
  border: none;
@@ -39396,23 +39465,41 @@ const Dropdown = ({
39396
39465
  maxDropdownHeight,
39397
39466
  isRowFocused = false,
39398
39467
  isRowHovered = false,
39399
- selectedColor
39468
+ selectedColor,
39469
+ dropdownOptionsWidth,
39470
+ dropdownOptionsAlignment = 'right',
39471
+ placeholder = 'Select...'
39400
39472
  }) => {
39401
- return /*#__PURE__*/React__default["default"].createElement(DropdownContainer$1, null, /*#__PURE__*/React__default["default"].createElement(DropdownButton$1, {
39473
+ const [isDropdownHovered, setIsDropdownHovered] = React$1.useState(false);
39474
+
39475
+ // Reset dropdown hover state when dropdown closes
39476
+ React$1.useEffect(() => {
39477
+ if (!isOpen) {
39478
+ setIsDropdownHovered(false);
39479
+ }
39480
+ }, [isOpen]);
39481
+ return /*#__PURE__*/React__default["default"].createElement(DropdownContainer$1, {
39482
+ onMouseEnter: () => setIsDropdownHovered(true),
39483
+ onMouseLeave: () => setIsDropdownHovered(false)
39484
+ }, /*#__PURE__*/React__default["default"].createElement(DropdownButton$1, {
39402
39485
  onClick: onToggle,
39403
39486
  $isOpen: isOpen,
39404
39487
  $isRowFocused: isRowFocused,
39488
+ $isRowHovered: isRowHovered,
39405
39489
  $selectedColor: selectedColor
39406
39490
  }, /*#__PURE__*/React__default["default"].createElement("span", null, displayText), /*#__PURE__*/React__default["default"].createElement(DropdownIcon, {
39407
39491
  $isOpen: isOpen,
39408
39492
  $isRowFocused: isRowFocused,
39409
- $isRowHovered: isRowHovered
39493
+ $isRowHovered: isRowHovered,
39494
+ $isDropdownHovered: isDropdownHovered
39410
39495
  }, /*#__PURE__*/React__default["default"].createElement(MenuItemOpenIcon, {
39411
39496
  width: "10",
39412
39497
  height: "6",
39413
39498
  color: "#212121"
39414
39499
  }))), isOpen && /*#__PURE__*/React__default["default"].createElement(DropdownMenu, {
39415
- $maxDropdownHeight: maxDropdownHeight
39500
+ $maxDropdownHeight: maxDropdownHeight,
39501
+ $dropdownOptionsWidth: dropdownOptionsWidth,
39502
+ $dropdownOptionsAlignment: dropdownOptionsAlignment
39416
39503
  }, options.map((option, index) => /*#__PURE__*/React__default["default"].createElement(DropdownOption, {
39417
39504
  key: index,
39418
39505
  onClick: e => onOptionSelect(option, e),
@@ -39436,7 +39523,10 @@ Dropdown.propTypes = {
39436
39523
  maxDropdownHeight: PropTypes.string,
39437
39524
  isRowFocused: PropTypes.bool,
39438
39525
  isRowHovered: PropTypes.bool,
39439
- selectedColor: PropTypes.string
39526
+ selectedColor: PropTypes.string,
39527
+ dropdownOptionsWidth: PropTypes.string,
39528
+ dropdownOptionsAlignment: PropTypes.oneOf(['left', 'right']),
39529
+ placeholder: PropTypes.string
39440
39530
  };
39441
39531
 
39442
39532
  // TableBody.jsx
@@ -39475,6 +39565,8 @@ const TableBody = ({
39475
39565
  expandedBackgroundColor = '#E6F0F0',
39476
39566
  // New prop with default
39477
39567
  onDropdownSelected = () => {},
39568
+ onCheckboxClick = () => {},
39569
+ onHeaderCheckboxClick = () => {},
39478
39570
  ref = null
39479
39571
  }) => {
39480
39572
  const [hoveredRowIndex, setHoveredRowIndex] = React$1.useState(null);
@@ -39824,10 +39916,13 @@ const TableBody = ({
39824
39916
  const isOpen = openDropdowns[dropdownKey] || false;
39825
39917
  const dropdownOptions = column.dropdownOptions || [];
39826
39918
  const maxDropdownHeight = column.maxDropdownHeight || '200px';
39919
+ const dropdownOptionsWidth = column.dropdownOptionsWidth; // Get from column config
39920
+ const dropdownOptionsAlignment = column.dropdownOptionsAlignment || 'right'; // Get from column config, default to 'right'
39921
+ const placeholder = column.placeholder || 'Select...'; // Get from column config, default to 'Select...'
39827
39922
 
39828
39923
  // Find the current selected option to display its label
39829
39924
  const currentOption = dropdownOptions.find(option => option.value === value);
39830
- const displayText = currentOption ? currentOption.label : value || 'Select...';
39925
+ const displayText = currentOption ? currentOption.label : value || placeholder;
39831
39926
  return /*#__PURE__*/React__default["default"].createElement(Dropdown, {
39832
39927
  isOpen: isOpen,
39833
39928
  options: dropdownOptions,
@@ -39836,10 +39931,37 @@ const TableBody = ({
39836
39931
  onToggle: e => handleDropdownClick(rowIndex, column.key, e),
39837
39932
  onOptionSelect: (option, e) => handleDropdownOptionClick(row, rowIndex, column.key, option, e),
39838
39933
  maxDropdownHeight: maxDropdownHeight,
39934
+ dropdownOptionsWidth: dropdownOptionsWidth,
39935
+ dropdownOptionsAlignment: dropdownOptionsAlignment,
39936
+ placeholder: placeholder,
39839
39937
  isRowFocused: focusedRowIndex === rowIndex,
39840
39938
  isRowHovered: hoveredRowIndex === rowIndex,
39841
39939
  selectedColor: selectedColor
39842
39940
  });
39941
+ case 'checkbox':
39942
+ const isChecked = Boolean(value); // Convert to boolean
39943
+
39944
+ return /*#__PURE__*/React__default["default"].createElement("div", {
39945
+ style: {
39946
+ display: 'flex',
39947
+ alignItems: 'center',
39948
+ justifyContent: 'center',
39949
+ width: '100%',
39950
+ height: '100%'
39951
+ }
39952
+ }, /*#__PURE__*/React__default["default"].createElement("input", {
39953
+ type: "checkbox",
39954
+ checked: isChecked,
39955
+ onChange: e => handleCheckboxClick(row, column.key, e),
39956
+ onClick: e => e.stopPropagation() // Prevent row click on checkbox click
39957
+ ,
39958
+ style: {
39959
+ width: '18px',
39960
+ height: '18px',
39961
+ cursor: 'pointer',
39962
+ accentColor: buttonColor // Use the theme color for checkbox
39963
+ }
39964
+ }));
39843
39965
  default:
39844
39966
  // Treat default as text
39845
39967
  return value.toString();
@@ -39859,6 +39981,28 @@ const TableBody = ({
39859
39981
  }
39860
39982
  };
39861
39983
 
39984
+ // Handle checkbox click
39985
+ const handleCheckboxClick = (row, columnKey, event) => {
39986
+ event.stopPropagation();
39987
+ const currentValue = row[columnKey];
39988
+ const newValue = !currentValue; // Toggle the value
39989
+
39990
+ // Create updated row with new checkbox value
39991
+ const updatedRow = {
39992
+ ...row,
39993
+ [columnKey]: newValue
39994
+ };
39995
+
39996
+ // Fire the onCheckboxClick event with updated row
39997
+ if (onCheckboxClick) {
39998
+ onCheckboxClick({
39999
+ fullRow: updatedRow,
40000
+ columnName: columnKey,
40001
+ checked: newValue
40002
+ });
40003
+ }
40004
+ };
40005
+
39862
40006
  // Handle dropdown click
39863
40007
  const handleDropdownClick = (rowIndex, columnKey, event) => {
39864
40008
  event.stopPropagation();
@@ -39906,7 +40050,7 @@ const TableBody = ({
39906
40050
  onMouseEnter: () => setHoveredRowIndex(rowIndex),
39907
40051
  onMouseLeave: () => setHoveredRowIndex(null),
39908
40052
  onClick: () => handleRowClick(row, rowIndex)
39909
- }, expandable && /*#__PURE__*/React__default["default"].createElement(TableCell, {
40053
+ }, expandable && expandedContent[rowIndex] !== null && /*#__PURE__*/React__default["default"].createElement(TableCell, {
39910
40054
  $fieldType: "expand",
39911
40055
  $minWidth: "16px",
39912
40056
  $maxWidth: "16px"
@@ -39995,6 +40139,8 @@ TableBody.propTypes = {
39995
40139
  onCommentSave: PropTypes.func,
39996
40140
  commentTextLimit: PropTypes.number,
39997
40141
  onDropdownSelected: PropTypes.func,
40142
+ onCheckboxClick: PropTypes.func,
40143
+ onHeaderCheckboxClick: PropTypes.func,
39998
40144
  ref: PropTypes.object
39999
40145
  };
40000
40146
  TableBody.displayName = 'TableBody';
@@ -43354,6 +43500,9 @@ const Table = props => {
43354
43500
  expandedBackgroundColor = '#E6F0F0',
43355
43501
  // New prop
43356
43502
  onDropdownSelected = () => {},
43503
+ onCheckboxClick = () => {},
43504
+ onHeaderCheckboxClick = () => {},
43505
+ headerCheckboxStates = {},
43357
43506
  // Accept ref as a regular prop
43358
43507
  ref = null
43359
43508
  } = props;
@@ -43480,7 +43629,9 @@ const Table = props => {
43480
43629
  onSort: onSort,
43481
43630
  onFilter: onFilter,
43482
43631
  onSelectAll: onSelectAll,
43483
- expandable: expandable
43632
+ expandable: expandable,
43633
+ onHeaderCheckboxClick: onHeaderCheckboxClick,
43634
+ headerCheckboxStates: headerCheckboxStates
43484
43635
  }), columns.length > 0 && data.length > 0 && /*#__PURE__*/React__default["default"].createElement(TableBody, {
43485
43636
  ref: tableBodyRef,
43486
43637
  columns: columns,
@@ -43501,7 +43652,9 @@ const Table = props => {
43501
43652
  expandedContent: expandedContent,
43502
43653
  onExpandRow: onExpandRow,
43503
43654
  expandedBackgroundColor: expandedBackgroundColor,
43504
- onDropdownSelected: onDropdownSelected
43655
+ onDropdownSelected: onDropdownSelected,
43656
+ onCheckboxClick: onCheckboxClick,
43657
+ onHeaderCheckboxClick: onHeaderCheckboxClick
43505
43658
  })), 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, {
43506
43659
  height: "45px",
43507
43660
  leftIcon: noEventsButtonIcon,