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.d.ts CHANGED
@@ -1424,7 +1424,7 @@ declare function Execute({ width, height, fill }: {
1424
1424
  fill?: string;
1425
1425
  }): react_jsx_runtime.JSX.Element;
1426
1426
 
1427
- declare function Table(props: any): react_jsx_runtime.JSX.Element;
1427
+ declare const Table: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
1428
1428
 
1429
1429
  declare function FilterPop(props: any): react_jsx_runtime.JSX.Element;
1430
1430
 
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import React$1, { useState, useRef, useEffect, useMemo, useCallback } from 'react';
1
+ import React$1, { useState, useRef, useEffect, useMemo, useCallback, forwardRef, useImperativeHandle } from 'react';
2
2
  import styled, { keyframes, css } from 'styled-components';
3
3
  import { ResponsiveContainer, PieChart as PieChart$1, Pie, Cell, Tooltip as Tooltip$3, BarChart as BarChart$1, CartesianGrid, XAxis, YAxis, Bar, LabelList, ReferenceLine, LineChart, Line, AreaChart as AreaChart$1, Legend, Area, ScatterChart, ZAxis, Scatter, Brush, ComposedChart } from 'recharts';
4
4
  import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
@@ -34419,7 +34419,11 @@ const ModalWithOverlay = props => {
34419
34419
  leftIcon: cancelButtonLeftIcon,
34420
34420
  rightIcon: cancelButtonRightIcon,
34421
34421
  text: cancelButtonText,
34422
- onClick: onCancel
34422
+ onClick: onCancel,
34423
+ borderColor: "#D3D3D3",
34424
+ hoverTextColor: "#212121",
34425
+ hoverBackgroundColor: "#E6F0F0",
34426
+ hoverBorderColor: "#D3D3D3"
34423
34427
  }), showOkButton && (disableOkButton && tooltipContent !== '' ? /*#__PURE__*/React$1.createElement(Tooltip$2, {
34424
34428
  direction: "top",
34425
34429
  topFactor: -0.85,
@@ -37599,11 +37603,22 @@ const TableRow = styled.tr`
37599
37603
  border-bottom: 1px solid #F2F2F2;
37600
37604
  transition: background-color 0.2s;
37601
37605
  font-family: 'Poppins', sans-serif;
37606
+ cursor: pointer;
37602
37607
 
37603
37608
  &:hover {
37604
37609
  background-color: #E6F0F0;
37605
37610
  }
37606
37611
 
37612
+ /* Focus state - persistent until another row is clicked */
37613
+ ${props => props.$isFocused && css`
37614
+ background-color: #D1E7E7;
37615
+ border-left: 3px solid #066768;
37616
+
37617
+ &:hover {
37618
+ background-color: #C1D7D7;
37619
+ }
37620
+ `}
37621
+
37607
37622
  &:last-child {
37608
37623
  border-bottom: none;
37609
37624
  }
@@ -37878,15 +37893,46 @@ const DisabledTrashIcon = ({
37878
37893
  };
37879
37894
 
37880
37895
  // TableBody.jsx
37881
- const TableBody = ({
37896
+ const TableBody = /*#__PURE__*/forwardRef(({
37882
37897
  columns,
37883
37898
  data,
37884
37899
  onRowClick,
37885
37900
  onSendClick,
37886
37901
  buttonColor,
37887
- onDeleteClick
37888
- }) => {
37902
+ onDeleteClick,
37903
+ resetFocus = false,
37904
+ onFocusChange
37905
+ }, ref) => {
37889
37906
  const [hoveredRowIndex, setHoveredRowIndex] = useState(null);
37907
+ const [focusedRowIndex, setFocusedRowIndex] = useState(null);
37908
+
37909
+ // Expose methods to parent components via ref
37910
+ useImperativeHandle(ref, () => ({
37911
+ clearFocus: () => setFocusedRowIndex(null),
37912
+ getFocusedRowIndex: () => focusedRowIndex
37913
+ }));
37914
+
37915
+ // Handle resetFocus prop
37916
+ useEffect(() => {
37917
+ if (resetFocus) {
37918
+ setFocusedRowIndex(null);
37919
+ }
37920
+ }, [resetFocus]);
37921
+
37922
+ // Notify parent of focus changes
37923
+ useEffect(() => {
37924
+ if (onFocusChange) {
37925
+ onFocusChange(focusedRowIndex);
37926
+ }
37927
+ }, [focusedRowIndex, onFocusChange]);
37928
+
37929
+ // Handle row click for focus state
37930
+ const handleRowClick = (row, rowIndex) => {
37931
+ setFocusedRowIndex(rowIndex);
37932
+ if (onRowClick) {
37933
+ onRowClick(row);
37934
+ }
37935
+ };
37890
37936
 
37891
37937
  // Function to calculate tooltip height based on text length
37892
37938
  const calculateTooltipOffset = (text, isRegularCell = false) => {
@@ -37986,7 +38032,7 @@ const TableBody = ({
37986
38032
  hoverBackgroundColor: "#E6F0F0",
37987
38033
  hoverBorderColor: "#D9D9D9",
37988
38034
  disabledTextColor: "#B1B1B1",
37989
- disabledBackgroundColor: hoveredRowIndex === rowIndex ? "#E6F0F0" : "#FFF",
38035
+ disabledBackgroundColor: focusedRowIndex === rowIndex ? "#D1E7E7" : hoveredRowIndex === rowIndex ? "#E6F0F0" : "#FFF",
37990
38036
  disabledBorderColor: "#D9D9D9",
37991
38037
  width: "100px",
37992
38038
  height: "32px",
@@ -37999,7 +38045,7 @@ const TableBody = ({
37999
38045
  leftIcon: "Fly",
38000
38046
  text: "Send",
38001
38047
  borderRadius: "8px",
38002
- backgroundColor: hoveredRowIndex === rowIndex ? "#E6F0F0" : "#FFF",
38048
+ backgroundColor: focusedRowIndex === rowIndex ? "#D1E7E7" : hoveredRowIndex === rowIndex ? "#E6F0F0" : "#FFF",
38003
38049
  textColor: buttonColor,
38004
38050
  borderColor: buttonColor,
38005
38051
  hoverTextColor: buttonColor,
@@ -38089,8 +38135,10 @@ const TableBody = ({
38089
38135
  return /*#__PURE__*/React$1.createElement(StyledTableBody, null, data.map((row, rowIndex) => /*#__PURE__*/React$1.createElement(TableRow, {
38090
38136
  key: rowIndex,
38091
38137
  "data-row-index": rowIndex,
38138
+ $isFocused: focusedRowIndex === rowIndex,
38092
38139
  onMouseEnter: () => setHoveredRowIndex(rowIndex),
38093
- onMouseLeave: () => setHoveredRowIndex(null)
38140
+ onMouseLeave: () => setHoveredRowIndex(null),
38141
+ onClick: () => handleRowClick(row, rowIndex)
38094
38142
  }, columns.map(column => {
38095
38143
  const value = row[column.key];
38096
38144
  const formattedValue = formatValue(value, column, row, rowIndex);
@@ -38114,11 +38162,13 @@ const TableBody = ({
38114
38162
  $fieldType: column.fieldType?.toLowerCase(),
38115
38163
  $color: column.color,
38116
38164
  $minWidth: column.minWidth,
38117
- $maxWidth: column.maxWidth,
38118
- onClick: onRowClick ? () => onRowClick(row) : undefined
38165
+ $maxWidth: column.maxWidth
38119
38166
  }, formattedValue);
38120
38167
  }))));
38121
- };
38168
+ });
38169
+
38170
+ // Add displayName for better debugging
38171
+ TableBody.displayName = 'TableBody';
38122
38172
 
38123
38173
  var nm$1 = "calendar_lottie";
38124
38174
  var ddd$1 = 0;
@@ -41287,7 +41337,7 @@ var Lottie = function Lottie(props) {
41287
41337
  };
41288
41338
 
41289
41339
  // Table.jsx
41290
- const Table = props => {
41340
+ const Table = /*#__PURE__*/forwardRef((props, ref) => {
41291
41341
  const {
41292
41342
  width = '100%',
41293
41343
  height = 'auto',
@@ -41318,10 +41368,34 @@ const Table = props => {
41318
41368
  onDeleteClick = () => {},
41319
41369
  showNoDataInSearch = false,
41320
41370
  noDataInSearchTitle = "No Results Found",
41321
- noDataInSearchMessage = "Try to refine your query and search again"
41371
+ noDataInSearchMessage = "Try to refine your query and search again",
41372
+ // New props for focus management
41373
+ resetTableFocus = false,
41374
+ onTableFocusChange = () => {},
41375
+ clearFocusOnOutsideClick = true
41322
41376
  } = props;
41323
41377
  const scrollWrapperRef = useRef(null);
41378
+ const tableBodyRef = useRef(null);
41379
+ const tableContainerRef = useRef(null);
41324
41380
  const [hasTriggered, setHasTriggered] = useState(false);
41381
+
41382
+ // Expose method to clear table focus to parent components
41383
+ const clearTableFocus = () => {
41384
+ if (tableBodyRef.current) {
41385
+ tableBodyRef.current.clearFocus();
41386
+ }
41387
+ };
41388
+
41389
+ // Handle focus change from TableBody
41390
+ const handleTableFocusChange = focusedRowIndex => {
41391
+ onTableFocusChange(focusedRowIndex);
41392
+ };
41393
+
41394
+ // Expose methods to parent components via ref
41395
+ useImperativeHandle(ref, () => ({
41396
+ clearTableFocus,
41397
+ getTableBodyRef: () => tableBodyRef.current
41398
+ }));
41325
41399
  useEffect(() => {
41326
41400
  const scrollWrapper = scrollWrapperRef.current;
41327
41401
  if (!scrollWrapper || !onLastRowsReached) return;
@@ -41350,6 +41424,23 @@ const Table = props => {
41350
41424
  scrollWrapper.addEventListener('scroll', handleScroll);
41351
41425
  return () => scrollWrapper.removeEventListener('scroll', handleScroll);
41352
41426
  }, [onLastRowsReached, data.length, lastRowsThreshold, hasTriggered]);
41427
+
41428
+ // Handle outside click to clear focus
41429
+ useEffect(() => {
41430
+ if (!clearFocusOnOutsideClick) return;
41431
+ const handleOutsideClick = event => {
41432
+ if (tableContainerRef.current && !tableContainerRef.current.contains(event.target)) {
41433
+ // Click is outside the table container
41434
+ if (tableBodyRef.current) {
41435
+ tableBodyRef.current.clearFocus();
41436
+ }
41437
+ }
41438
+ };
41439
+ document.addEventListener('mousedown', handleOutsideClick);
41440
+ return () => {
41441
+ document.removeEventListener('mousedown', handleOutsideClick);
41442
+ };
41443
+ }, [clearFocusOnOutsideClick]);
41353
41444
  return /*#__PURE__*/React$1.createElement(TableWrapper, {
41354
41445
  width: width,
41355
41446
  height: height
@@ -41364,7 +41455,8 @@ const Table = props => {
41364
41455
  hoverBackgroundColor: sideButtonHoverColor,
41365
41456
  onClick: onSideButtonClick
41366
41457
  })), children, /*#__PURE__*/React$1.createElement(TableContainer, {
41367
- showHorizontalScroll: showHorizontalScroll
41458
+ showHorizontalScroll: showHorizontalScroll,
41459
+ ref: tableContainerRef
41368
41460
  }, /*#__PURE__*/React$1.createElement(TableBodyScrollWrapper, {
41369
41461
  tableBodyHeight: tableBodyHeight,
41370
41462
  showHorizontalScroll: showHorizontalScroll,
@@ -41375,12 +41467,15 @@ const Table = props => {
41375
41467
  onFilter: onFilter,
41376
41468
  onSelectAll: onSelectAll
41377
41469
  }), columns.length > 0 && data.length > 0 && /*#__PURE__*/React$1.createElement(TableBody, {
41470
+ ref: tableBodyRef,
41378
41471
  columns: columns,
41379
41472
  data: data,
41380
41473
  onRowClick: onRowClick,
41381
41474
  onSendClick: onSendClick,
41382
41475
  onDeleteClick: onDeleteClick,
41383
- buttonColor: buttonColor
41476
+ buttonColor: buttonColor,
41477
+ resetFocus: resetTableFocus,
41478
+ onFocusChange: handleTableFocusChange
41384
41479
  })), data.length === 0 && /*#__PURE__*/React$1.createElement(NoEventsParent, null, /*#__PURE__*/React$1.createElement(NoEventsWrapper, null, showNoDataInSearch ? /*#__PURE__*/React$1.createElement(NoDataInSearchIcon, null) : /*#__PURE__*/React$1.createElement(NoEvents, null)), /*#__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, "You haven't created any events yet"), /*#__PURE__*/React$1.createElement("br", null), "Let's get started and create your first one!")), !showNoDataInSearch && /*#__PURE__*/React$1.createElement(Button$1, {
41385
41480
  height: "45px",
41386
41481
  leftIcon: "Plus",
@@ -41399,7 +41494,10 @@ const Table = props => {
41399
41494
  animationData: LoadingAnimation,
41400
41495
  loop: true
41401
41496
  }), /*#__PURE__*/React$1.createElement(LoadingText, null, isLoadingText)))));
41402
- };
41497
+ });
41498
+
41499
+ // Add displayName for better debugging
41500
+ Table.displayName = 'Table';
41403
41501
 
41404
41502
  const Card = styled.div`
41405
41503
  background: ${props => props.backgroundColor};
@@ -42169,7 +42267,11 @@ const NewSubitem = ({
42169
42267
  size: "small",
42170
42268
  text: "Cancel",
42171
42269
  type: "secondary",
42172
- borderRadius: "8px"
42270
+ borderRadius: "8px",
42271
+ borderColor: "#D3D3D3",
42272
+ hoverTextColor: "#212121",
42273
+ hoverBackgroundColor: "#E6F0F0",
42274
+ hoverBorderColor: "#D3D3D3"
42173
42275
  }), /*#__PURE__*/React$1.createElement(Button$1, {
42174
42276
  leftIcon: "none",
42175
42277
  onClick: () => {
@@ -42315,7 +42417,12 @@ const ConfirmationDialog = ({
42315
42417
  rightIcon: "none",
42316
42418
  size: "",
42317
42419
  text: "Cancel",
42318
- type: "secondary"
42420
+ type: "secondary",
42421
+ borderRadius: "8px",
42422
+ borderColor: "#D3D3D3",
42423
+ hoverTextColor: "#212121",
42424
+ hoverBackgroundColor: "#E6F0F0",
42425
+ hoverBorderColor: "#D3D3D3"
42319
42426
  }), /*#__PURE__*/React$1.createElement(Button$1, {
42320
42427
  leftIcon: "none",
42321
42428
  onClick: onConfirm,
@@ -42323,9 +42430,11 @@ const ConfirmationDialog = ({
42323
42430
  size: "",
42324
42431
  text: "Confirm & Send",
42325
42432
  type: "primary",
42433
+ borderRadius: "8px",
42326
42434
  borderColor: linkColor,
42327
42435
  backgroundColor: linkColor,
42328
- hoverTextColor: "#212121"
42436
+ hoverBackgroundColor: "#388586",
42437
+ hoverBorderColor: "#388586"
42329
42438
  }))), /*#__PURE__*/React$1.createElement(Dialog, null, vendors.map((vendor, idx) => /*#__PURE__*/React$1.createElement(VendorSection, {
42330
42439
  key: vendor.name
42331
42440
  }, /*#__PURE__*/React$1.createElement(VendorHeader, null, /*#__PURE__*/React$1.createElement(VendorName, null, vendor.name), /*#__PURE__*/React$1.createElement(NewBadge, null, vendor.newPackages.length, " New")), /*#__PURE__*/React$1.createElement(PackageList, null, vendor.newPackages.map((pkg, i) => /*#__PURE__*/React$1.createElement(Item, {
@@ -51036,7 +51145,10 @@ const ItemManagerPanel = _ref => {
51036
51145
  type: "secondary",
51037
51146
  borderRadius: "8px",
51038
51147
  borderColor: linkColor,
51039
- textColor: linkColor
51148
+ textColor: linkColor,
51149
+ hoverTextColor: "#ffffff",
51150
+ hoverBackgroundColor: linkColor,
51151
+ hoverBorderColor: linkColor
51040
51152
  })), /*#__PURE__*/React$1.createElement(Subtitle$1, {
51041
51153
  color: actuallyAllFormsSent ? "#90CE9C" : "#8b8989"
51042
51154
  }, actuallyAllFormsSent ? '✔ All Forms Sent' : itemAndPackage.filter(item => item.packages !== null).length > 0 ? `${itemAndPackage.filter(item => item.packages !== null).length.toString()} New Forms` : ''))), /*#__PURE__*/React$1.createElement(AddButtonContainer$1, null, /*#__PURE__*/React$1.createElement(LinkButton, {