sag_components 2.0.0-beta125 → 2.0.0-beta127

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
@@ -34429,7 +34429,11 @@ const ModalWithOverlay = props => {
34429
34429
  leftIcon: cancelButtonLeftIcon,
34430
34430
  rightIcon: cancelButtonRightIcon,
34431
34431
  text: cancelButtonText,
34432
- onClick: onCancel
34432
+ onClick: onCancel,
34433
+ borderColor: "#D3D3D3",
34434
+ hoverTextColor: "#212121",
34435
+ hoverBackgroundColor: "#E6F0F0",
34436
+ hoverBorderColor: "#D3D3D3"
34433
34437
  }), showOkButton && (disableOkButton && tooltipContent !== '' ? /*#__PURE__*/React__default["default"].createElement(Tooltip$2, {
34434
34438
  direction: "top",
34435
34439
  topFactor: -0.85,
@@ -37609,11 +37613,22 @@ const TableRow = styled__default["default"].tr`
37609
37613
  border-bottom: 1px solid #F2F2F2;
37610
37614
  transition: background-color 0.2s;
37611
37615
  font-family: 'Poppins', sans-serif;
37616
+ cursor: pointer;
37612
37617
 
37613
37618
  &:hover {
37614
37619
  background-color: #E6F0F0;
37615
37620
  }
37616
37621
 
37622
+ /* Focus state - persistent until another row is clicked */
37623
+ ${props => props.$isFocused && styled.css`
37624
+ background-color: #D1E7E7;
37625
+ border-left: 3px solid #066768;
37626
+
37627
+ &:hover {
37628
+ background-color: #C1D7D7;
37629
+ }
37630
+ `}
37631
+
37617
37632
  &:last-child {
37618
37633
  border-bottom: none;
37619
37634
  }
@@ -37888,15 +37903,46 @@ const DisabledTrashIcon = ({
37888
37903
  };
37889
37904
 
37890
37905
  // TableBody.jsx
37891
- const TableBody = ({
37906
+ const TableBody = /*#__PURE__*/React$1.forwardRef(({
37892
37907
  columns,
37893
37908
  data,
37894
37909
  onRowClick,
37895
37910
  onSendClick,
37896
37911
  buttonColor,
37897
- onDeleteClick
37898
- }) => {
37912
+ onDeleteClick,
37913
+ resetFocus = false,
37914
+ onFocusChange
37915
+ }, ref) => {
37899
37916
  const [hoveredRowIndex, setHoveredRowIndex] = React$1.useState(null);
37917
+ const [focusedRowIndex, setFocusedRowIndex] = React$1.useState(null);
37918
+
37919
+ // Expose methods to parent components via ref
37920
+ React$1.useImperativeHandle(ref, () => ({
37921
+ clearFocus: () => setFocusedRowIndex(null),
37922
+ getFocusedRowIndex: () => focusedRowIndex
37923
+ }));
37924
+
37925
+ // Handle resetFocus prop
37926
+ React$1.useEffect(() => {
37927
+ if (resetFocus) {
37928
+ setFocusedRowIndex(null);
37929
+ }
37930
+ }, [resetFocus]);
37931
+
37932
+ // Notify parent of focus changes
37933
+ React$1.useEffect(() => {
37934
+ if (onFocusChange) {
37935
+ onFocusChange(focusedRowIndex);
37936
+ }
37937
+ }, [focusedRowIndex, onFocusChange]);
37938
+
37939
+ // Handle row click for focus state
37940
+ const handleRowClick = (row, rowIndex) => {
37941
+ setFocusedRowIndex(rowIndex);
37942
+ if (onRowClick) {
37943
+ onRowClick(row);
37944
+ }
37945
+ };
37900
37946
 
37901
37947
  // Function to calculate tooltip height based on text length
37902
37948
  const calculateTooltipOffset = (text, isRegularCell = false) => {
@@ -37996,7 +38042,7 @@ const TableBody = ({
37996
38042
  hoverBackgroundColor: "#E6F0F0",
37997
38043
  hoverBorderColor: "#D9D9D9",
37998
38044
  disabledTextColor: "#B1B1B1",
37999
- disabledBackgroundColor: hoveredRowIndex === rowIndex ? "#E6F0F0" : "#FFF",
38045
+ disabledBackgroundColor: focusedRowIndex === rowIndex ? "#D1E7E7" : hoveredRowIndex === rowIndex ? "#E6F0F0" : "#FFF",
38000
38046
  disabledBorderColor: "#D9D9D9",
38001
38047
  width: "100px",
38002
38048
  height: "32px",
@@ -38009,7 +38055,7 @@ const TableBody = ({
38009
38055
  leftIcon: "Fly",
38010
38056
  text: "Send",
38011
38057
  borderRadius: "8px",
38012
- backgroundColor: hoveredRowIndex === rowIndex ? "#E6F0F0" : "#FFF",
38058
+ backgroundColor: focusedRowIndex === rowIndex ? "#D1E7E7" : hoveredRowIndex === rowIndex ? "#E6F0F0" : "#FFF",
38013
38059
  textColor: buttonColor,
38014
38060
  borderColor: buttonColor,
38015
38061
  hoverTextColor: buttonColor,
@@ -38099,8 +38145,10 @@ const TableBody = ({
38099
38145
  return /*#__PURE__*/React__default["default"].createElement(StyledTableBody, null, data.map((row, rowIndex) => /*#__PURE__*/React__default["default"].createElement(TableRow, {
38100
38146
  key: rowIndex,
38101
38147
  "data-row-index": rowIndex,
38148
+ $isFocused: focusedRowIndex === rowIndex,
38102
38149
  onMouseEnter: () => setHoveredRowIndex(rowIndex),
38103
- onMouseLeave: () => setHoveredRowIndex(null)
38150
+ onMouseLeave: () => setHoveredRowIndex(null),
38151
+ onClick: () => handleRowClick(row, rowIndex)
38104
38152
  }, columns.map(column => {
38105
38153
  const value = row[column.key];
38106
38154
  const formattedValue = formatValue(value, column, row, rowIndex);
@@ -38124,11 +38172,13 @@ const TableBody = ({
38124
38172
  $fieldType: column.fieldType?.toLowerCase(),
38125
38173
  $color: column.color,
38126
38174
  $minWidth: column.minWidth,
38127
- $maxWidth: column.maxWidth,
38128
- onClick: onRowClick ? () => onRowClick(row) : undefined
38175
+ $maxWidth: column.maxWidth
38129
38176
  }, formattedValue);
38130
38177
  }))));
38131
- };
38178
+ });
38179
+
38180
+ // Add displayName for better debugging
38181
+ TableBody.displayName = 'TableBody';
38132
38182
 
38133
38183
  var nm$1 = "calendar_lottie";
38134
38184
  var ddd$1 = 0;
@@ -41297,7 +41347,7 @@ var Lottie = function Lottie(props) {
41297
41347
  };
41298
41348
 
41299
41349
  // Table.jsx
41300
- const Table = props => {
41350
+ const Table = /*#__PURE__*/React$1.forwardRef((props, ref) => {
41301
41351
  const {
41302
41352
  width = '100%',
41303
41353
  height = 'auto',
@@ -41328,10 +41378,34 @@ const Table = props => {
41328
41378
  onDeleteClick = () => {},
41329
41379
  showNoDataInSearch = false,
41330
41380
  noDataInSearchTitle = "No Results Found",
41331
- noDataInSearchMessage = "Try to refine your query and search again"
41381
+ noDataInSearchMessage = "Try to refine your query and search again",
41382
+ // New props for focus management
41383
+ resetTableFocus = false,
41384
+ onTableFocusChange = () => {},
41385
+ clearFocusOnOutsideClick = true
41332
41386
  } = props;
41333
41387
  const scrollWrapperRef = React$1.useRef(null);
41388
+ const tableBodyRef = React$1.useRef(null);
41389
+ const tableContainerRef = React$1.useRef(null);
41334
41390
  const [hasTriggered, setHasTriggered] = React$1.useState(false);
41391
+
41392
+ // Expose method to clear table focus to parent components
41393
+ const clearTableFocus = () => {
41394
+ if (tableBodyRef.current) {
41395
+ tableBodyRef.current.clearFocus();
41396
+ }
41397
+ };
41398
+
41399
+ // Handle focus change from TableBody
41400
+ const handleTableFocusChange = focusedRowIndex => {
41401
+ onTableFocusChange(focusedRowIndex);
41402
+ };
41403
+
41404
+ // Expose methods to parent components via ref
41405
+ React$1.useImperativeHandle(ref, () => ({
41406
+ clearTableFocus,
41407
+ getTableBodyRef: () => tableBodyRef.current
41408
+ }));
41335
41409
  React$1.useEffect(() => {
41336
41410
  const scrollWrapper = scrollWrapperRef.current;
41337
41411
  if (!scrollWrapper || !onLastRowsReached) return;
@@ -41360,6 +41434,23 @@ const Table = props => {
41360
41434
  scrollWrapper.addEventListener('scroll', handleScroll);
41361
41435
  return () => scrollWrapper.removeEventListener('scroll', handleScroll);
41362
41436
  }, [onLastRowsReached, data.length, lastRowsThreshold, hasTriggered]);
41437
+
41438
+ // Handle outside click to clear focus
41439
+ React$1.useEffect(() => {
41440
+ if (!clearFocusOnOutsideClick) return;
41441
+ const handleOutsideClick = event => {
41442
+ if (tableContainerRef.current && !tableContainerRef.current.contains(event.target)) {
41443
+ // Click is outside the table container
41444
+ if (tableBodyRef.current) {
41445
+ tableBodyRef.current.clearFocus();
41446
+ }
41447
+ }
41448
+ };
41449
+ document.addEventListener('mousedown', handleOutsideClick);
41450
+ return () => {
41451
+ document.removeEventListener('mousedown', handleOutsideClick);
41452
+ };
41453
+ }, [clearFocusOnOutsideClick]);
41363
41454
  return /*#__PURE__*/React__default["default"].createElement(TableWrapper, {
41364
41455
  width: width,
41365
41456
  height: height
@@ -41374,7 +41465,8 @@ const Table = props => {
41374
41465
  hoverBackgroundColor: sideButtonHoverColor,
41375
41466
  onClick: onSideButtonClick
41376
41467
  })), children, /*#__PURE__*/React__default["default"].createElement(TableContainer, {
41377
- showHorizontalScroll: showHorizontalScroll
41468
+ showHorizontalScroll: showHorizontalScroll,
41469
+ ref: tableContainerRef
41378
41470
  }, /*#__PURE__*/React__default["default"].createElement(TableBodyScrollWrapper, {
41379
41471
  tableBodyHeight: tableBodyHeight,
41380
41472
  showHorizontalScroll: showHorizontalScroll,
@@ -41385,12 +41477,15 @@ const Table = props => {
41385
41477
  onFilter: onFilter,
41386
41478
  onSelectAll: onSelectAll
41387
41479
  }), columns.length > 0 && data.length > 0 && /*#__PURE__*/React__default["default"].createElement(TableBody, {
41480
+ ref: tableBodyRef,
41388
41481
  columns: columns,
41389
41482
  data: data,
41390
41483
  onRowClick: onRowClick,
41391
41484
  onSendClick: onSendClick,
41392
41485
  onDeleteClick: onDeleteClick,
41393
- buttonColor: buttonColor
41486
+ buttonColor: buttonColor,
41487
+ resetFocus: resetTableFocus,
41488
+ onFocusChange: handleTableFocusChange
41394
41489
  })), data.length === 0 && /*#__PURE__*/React__default["default"].createElement(NoEventsParent, null, /*#__PURE__*/React__default["default"].createElement(NoEventsWrapper, null, showNoDataInSearch ? /*#__PURE__*/React__default["default"].createElement(NoDataInSearchIcon, null) : /*#__PURE__*/React__default["default"].createElement(NoEvents, null)), /*#__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, "You haven't created any events yet"), /*#__PURE__*/React__default["default"].createElement("br", null), "Let's get started and create your first one!")), !showNoDataInSearch && /*#__PURE__*/React__default["default"].createElement(Button$1, {
41395
41490
  height: "45px",
41396
41491
  leftIcon: "Plus",
@@ -41409,7 +41504,10 @@ const Table = props => {
41409
41504
  animationData: LoadingAnimation,
41410
41505
  loop: true
41411
41506
  }), /*#__PURE__*/React__default["default"].createElement(LoadingText, null, isLoadingText)))));
41412
- };
41507
+ });
41508
+
41509
+ // Add displayName for better debugging
41510
+ Table.displayName = 'Table';
41413
41511
 
41414
41512
  const Card = styled__default["default"].div`
41415
41513
  background: ${props => props.backgroundColor};
@@ -42179,7 +42277,11 @@ const NewSubitem = ({
42179
42277
  size: "small",
42180
42278
  text: "Cancel",
42181
42279
  type: "secondary",
42182
- borderRadius: "8px"
42280
+ borderRadius: "8px",
42281
+ borderColor: "#D3D3D3",
42282
+ hoverTextColor: "#212121",
42283
+ hoverBackgroundColor: "#E6F0F0",
42284
+ hoverBorderColor: "#D3D3D3"
42183
42285
  }), /*#__PURE__*/React__default["default"].createElement(Button$1, {
42184
42286
  leftIcon: "none",
42185
42287
  onClick: () => {
@@ -42325,7 +42427,12 @@ const ConfirmationDialog = ({
42325
42427
  rightIcon: "none",
42326
42428
  size: "",
42327
42429
  text: "Cancel",
42328
- type: "secondary"
42430
+ type: "secondary",
42431
+ borderRadius: "8px",
42432
+ borderColor: "#D3D3D3",
42433
+ hoverTextColor: "#212121",
42434
+ hoverBackgroundColor: "#E6F0F0",
42435
+ hoverBorderColor: "#D3D3D3"
42329
42436
  }), /*#__PURE__*/React__default["default"].createElement(Button$1, {
42330
42437
  leftIcon: "none",
42331
42438
  onClick: onConfirm,
@@ -42333,9 +42440,11 @@ const ConfirmationDialog = ({
42333
42440
  size: "",
42334
42441
  text: "Confirm & Send",
42335
42442
  type: "primary",
42443
+ borderRadius: "8px",
42336
42444
  borderColor: linkColor,
42337
42445
  backgroundColor: linkColor,
42338
- hoverTextColor: "#212121"
42446
+ hoverBackgroundColor: "#388586",
42447
+ hoverBorderColor: "#388586"
42339
42448
  }))), /*#__PURE__*/React__default["default"].createElement(Dialog, null, vendors.map((vendor, idx) => /*#__PURE__*/React__default["default"].createElement(VendorSection, {
42340
42449
  key: vendor.name
42341
42450
  }, /*#__PURE__*/React__default["default"].createElement(VendorHeader, null, /*#__PURE__*/React__default["default"].createElement(VendorName, null, vendor.name), /*#__PURE__*/React__default["default"].createElement(NewBadge, null, vendor.newPackages.length, " New")), /*#__PURE__*/React__default["default"].createElement(PackageList, null, vendor.newPackages.map((pkg, i) => /*#__PURE__*/React__default["default"].createElement(Item, {
@@ -51046,7 +51155,10 @@ const ItemManagerPanel = _ref => {
51046
51155
  type: "secondary",
51047
51156
  borderRadius: "8px",
51048
51157
  borderColor: linkColor,
51049
- textColor: linkColor
51158
+ textColor: linkColor,
51159
+ hoverTextColor: "#ffffff",
51160
+ hoverBackgroundColor: linkColor,
51161
+ hoverBorderColor: linkColor
51050
51162
  })), /*#__PURE__*/React__default["default"].createElement(Subtitle$1, {
51051
51163
  color: actuallyAllFormsSent ? "#90CE9C" : "#8b8989"
51052
51164
  }, actuallyAllFormsSent ? '✔ All Forms Sent' : itemAndPackage.filter(item => item.packages !== null).length > 0 ? `${itemAndPackage.filter(item => item.packages !== null).length.toString()} New Forms` : ''))), /*#__PURE__*/React__default["default"].createElement(AddButtonContainer$1, null, /*#__PURE__*/React__default["default"].createElement(LinkButton, {