sag_components 2.0.0-beta126 → 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 +1 -1
- package/dist/index.esm.js +104 -26
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +103 -25
- package/dist/index.js.map +1 -1
- package/dist/types/components/Table/Table.d.ts +2 -1
- package/dist/types/components/Table/Table.stories.d.ts +32 -0
- package/dist/types/components/Table/TableBody.d.ts +2 -8
- package/package.json +1 -1
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
|
|
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';
|
|
@@ -23897,21 +23897,22 @@ const DeleteIcon = styled.div`
|
|
|
23897
23897
|
position: absolute;
|
|
23898
23898
|
`;
|
|
23899
23899
|
|
|
23900
|
-
const QuickFilterDropdownSingle =
|
|
23901
|
-
|
|
23902
|
-
|
|
23903
|
-
|
|
23904
|
-
|
|
23905
|
-
|
|
23906
|
-
|
|
23907
|
-
|
|
23908
|
-
|
|
23909
|
-
|
|
23910
|
-
|
|
23911
|
-
|
|
23912
|
-
|
|
23913
|
-
|
|
23914
|
-
|
|
23900
|
+
const QuickFilterDropdownSingle = _ref => {
|
|
23901
|
+
let {
|
|
23902
|
+
label,
|
|
23903
|
+
hoverColor,
|
|
23904
|
+
options,
|
|
23905
|
+
selectedValue,
|
|
23906
|
+
placeHolder,
|
|
23907
|
+
onChange,
|
|
23908
|
+
disabled,
|
|
23909
|
+
width,
|
|
23910
|
+
error,
|
|
23911
|
+
errorMessage,
|
|
23912
|
+
xIconShow,
|
|
23913
|
+
labelColor,
|
|
23914
|
+
showLabelOnTop
|
|
23915
|
+
} = _ref;
|
|
23915
23916
|
const [isFocused, setIsFocused] = useState(false);
|
|
23916
23917
|
const [showOptions, setShowOptions] = useState(false);
|
|
23917
23918
|
const [inputValue, setInputValue] = useState("");
|
|
@@ -34418,7 +34419,11 @@ const ModalWithOverlay = props => {
|
|
|
34418
34419
|
leftIcon: cancelButtonLeftIcon,
|
|
34419
34420
|
rightIcon: cancelButtonRightIcon,
|
|
34420
34421
|
text: cancelButtonText,
|
|
34421
|
-
onClick: onCancel
|
|
34422
|
+
onClick: onCancel,
|
|
34423
|
+
borderColor: "#D3D3D3",
|
|
34424
|
+
hoverTextColor: "#212121",
|
|
34425
|
+
hoverBackgroundColor: "#E6F0F0",
|
|
34426
|
+
hoverBorderColor: "#D3D3D3"
|
|
34422
34427
|
}), showOkButton && (disableOkButton && tooltipContent !== '' ? /*#__PURE__*/React$1.createElement(Tooltip$2, {
|
|
34423
34428
|
direction: "top",
|
|
34424
34429
|
topFactor: -0.85,
|
|
@@ -37888,17 +37893,39 @@ const DisabledTrashIcon = ({
|
|
|
37888
37893
|
};
|
|
37889
37894
|
|
|
37890
37895
|
// TableBody.jsx
|
|
37891
|
-
const TableBody = ({
|
|
37896
|
+
const TableBody = /*#__PURE__*/forwardRef(({
|
|
37892
37897
|
columns,
|
|
37893
37898
|
data,
|
|
37894
37899
|
onRowClick,
|
|
37895
37900
|
onSendClick,
|
|
37896
37901
|
buttonColor,
|
|
37897
|
-
onDeleteClick
|
|
37898
|
-
|
|
37902
|
+
onDeleteClick,
|
|
37903
|
+
resetFocus = false,
|
|
37904
|
+
onFocusChange
|
|
37905
|
+
}, ref) => {
|
|
37899
37906
|
const [hoveredRowIndex, setHoveredRowIndex] = useState(null);
|
|
37900
37907
|
const [focusedRowIndex, setFocusedRowIndex] = useState(null);
|
|
37901
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
|
+
|
|
37902
37929
|
// Handle row click for focus state
|
|
37903
37930
|
const handleRowClick = (row, rowIndex) => {
|
|
37904
37931
|
setFocusedRowIndex(rowIndex);
|
|
@@ -38138,7 +38165,10 @@ const TableBody = ({
|
|
|
38138
38165
|
$maxWidth: column.maxWidth
|
|
38139
38166
|
}, formattedValue);
|
|
38140
38167
|
}))));
|
|
38141
|
-
};
|
|
38168
|
+
});
|
|
38169
|
+
|
|
38170
|
+
// Add displayName for better debugging
|
|
38171
|
+
TableBody.displayName = 'TableBody';
|
|
38142
38172
|
|
|
38143
38173
|
var nm$1 = "calendar_lottie";
|
|
38144
38174
|
var ddd$1 = 0;
|
|
@@ -41307,7 +41337,7 @@ var Lottie = function Lottie(props) {
|
|
|
41307
41337
|
};
|
|
41308
41338
|
|
|
41309
41339
|
// Table.jsx
|
|
41310
|
-
const Table = props => {
|
|
41340
|
+
const Table = /*#__PURE__*/forwardRef((props, ref) => {
|
|
41311
41341
|
const {
|
|
41312
41342
|
width = '100%',
|
|
41313
41343
|
height = 'auto',
|
|
@@ -41338,10 +41368,34 @@ const Table = props => {
|
|
|
41338
41368
|
onDeleteClick = () => {},
|
|
41339
41369
|
showNoDataInSearch = false,
|
|
41340
41370
|
noDataInSearchTitle = "No Results Found",
|
|
41341
|
-
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
|
|
41342
41376
|
} = props;
|
|
41343
41377
|
const scrollWrapperRef = useRef(null);
|
|
41378
|
+
const tableBodyRef = useRef(null);
|
|
41379
|
+
const tableContainerRef = useRef(null);
|
|
41344
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
|
+
}));
|
|
41345
41399
|
useEffect(() => {
|
|
41346
41400
|
const scrollWrapper = scrollWrapperRef.current;
|
|
41347
41401
|
if (!scrollWrapper || !onLastRowsReached) return;
|
|
@@ -41370,6 +41424,23 @@ const Table = props => {
|
|
|
41370
41424
|
scrollWrapper.addEventListener('scroll', handleScroll);
|
|
41371
41425
|
return () => scrollWrapper.removeEventListener('scroll', handleScroll);
|
|
41372
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]);
|
|
41373
41444
|
return /*#__PURE__*/React$1.createElement(TableWrapper, {
|
|
41374
41445
|
width: width,
|
|
41375
41446
|
height: height
|
|
@@ -41384,7 +41455,8 @@ const Table = props => {
|
|
|
41384
41455
|
hoverBackgroundColor: sideButtonHoverColor,
|
|
41385
41456
|
onClick: onSideButtonClick
|
|
41386
41457
|
})), children, /*#__PURE__*/React$1.createElement(TableContainer, {
|
|
41387
|
-
showHorizontalScroll: showHorizontalScroll
|
|
41458
|
+
showHorizontalScroll: showHorizontalScroll,
|
|
41459
|
+
ref: tableContainerRef
|
|
41388
41460
|
}, /*#__PURE__*/React$1.createElement(TableBodyScrollWrapper, {
|
|
41389
41461
|
tableBodyHeight: tableBodyHeight,
|
|
41390
41462
|
showHorizontalScroll: showHorizontalScroll,
|
|
@@ -41395,12 +41467,15 @@ const Table = props => {
|
|
|
41395
41467
|
onFilter: onFilter,
|
|
41396
41468
|
onSelectAll: onSelectAll
|
|
41397
41469
|
}), columns.length > 0 && data.length > 0 && /*#__PURE__*/React$1.createElement(TableBody, {
|
|
41470
|
+
ref: tableBodyRef,
|
|
41398
41471
|
columns: columns,
|
|
41399
41472
|
data: data,
|
|
41400
41473
|
onRowClick: onRowClick,
|
|
41401
41474
|
onSendClick: onSendClick,
|
|
41402
41475
|
onDeleteClick: onDeleteClick,
|
|
41403
|
-
buttonColor: buttonColor
|
|
41476
|
+
buttonColor: buttonColor,
|
|
41477
|
+
resetFocus: resetTableFocus,
|
|
41478
|
+
onFocusChange: handleTableFocusChange
|
|
41404
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, {
|
|
41405
41480
|
height: "45px",
|
|
41406
41481
|
leftIcon: "Plus",
|
|
@@ -41419,7 +41494,10 @@ const Table = props => {
|
|
|
41419
41494
|
animationData: LoadingAnimation,
|
|
41420
41495
|
loop: true
|
|
41421
41496
|
}), /*#__PURE__*/React$1.createElement(LoadingText, null, isLoadingText)))));
|
|
41422
|
-
};
|
|
41497
|
+
});
|
|
41498
|
+
|
|
41499
|
+
// Add displayName for better debugging
|
|
41500
|
+
Table.displayName = 'Table';
|
|
41423
41501
|
|
|
41424
41502
|
const Card = styled.div`
|
|
41425
41503
|
background: ${props => props.backgroundColor};
|