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.js
CHANGED
|
@@ -23907,21 +23907,22 @@ const DeleteIcon = styled__default["default"].div`
|
|
|
23907
23907
|
position: absolute;
|
|
23908
23908
|
`;
|
|
23909
23909
|
|
|
23910
|
-
const QuickFilterDropdownSingle =
|
|
23911
|
-
|
|
23912
|
-
|
|
23913
|
-
|
|
23914
|
-
|
|
23915
|
-
|
|
23916
|
-
|
|
23917
|
-
|
|
23918
|
-
|
|
23919
|
-
|
|
23920
|
-
|
|
23921
|
-
|
|
23922
|
-
|
|
23923
|
-
|
|
23924
|
-
|
|
23910
|
+
const QuickFilterDropdownSingle = _ref => {
|
|
23911
|
+
let {
|
|
23912
|
+
label,
|
|
23913
|
+
hoverColor,
|
|
23914
|
+
options,
|
|
23915
|
+
selectedValue,
|
|
23916
|
+
placeHolder,
|
|
23917
|
+
onChange,
|
|
23918
|
+
disabled,
|
|
23919
|
+
width,
|
|
23920
|
+
error,
|
|
23921
|
+
errorMessage,
|
|
23922
|
+
xIconShow,
|
|
23923
|
+
labelColor,
|
|
23924
|
+
showLabelOnTop
|
|
23925
|
+
} = _ref;
|
|
23925
23926
|
const [isFocused, setIsFocused] = React$1.useState(false);
|
|
23926
23927
|
const [showOptions, setShowOptions] = React$1.useState(false);
|
|
23927
23928
|
const [inputValue, setInputValue] = React$1.useState("");
|
|
@@ -34428,7 +34429,11 @@ const ModalWithOverlay = props => {
|
|
|
34428
34429
|
leftIcon: cancelButtonLeftIcon,
|
|
34429
34430
|
rightIcon: cancelButtonRightIcon,
|
|
34430
34431
|
text: cancelButtonText,
|
|
34431
|
-
onClick: onCancel
|
|
34432
|
+
onClick: onCancel,
|
|
34433
|
+
borderColor: "#D3D3D3",
|
|
34434
|
+
hoverTextColor: "#212121",
|
|
34435
|
+
hoverBackgroundColor: "#E6F0F0",
|
|
34436
|
+
hoverBorderColor: "#D3D3D3"
|
|
34432
34437
|
}), showOkButton && (disableOkButton && tooltipContent !== '' ? /*#__PURE__*/React__default["default"].createElement(Tooltip$2, {
|
|
34433
34438
|
direction: "top",
|
|
34434
34439
|
topFactor: -0.85,
|
|
@@ -37898,17 +37903,39 @@ const DisabledTrashIcon = ({
|
|
|
37898
37903
|
};
|
|
37899
37904
|
|
|
37900
37905
|
// TableBody.jsx
|
|
37901
|
-
const TableBody = ({
|
|
37906
|
+
const TableBody = /*#__PURE__*/React$1.forwardRef(({
|
|
37902
37907
|
columns,
|
|
37903
37908
|
data,
|
|
37904
37909
|
onRowClick,
|
|
37905
37910
|
onSendClick,
|
|
37906
37911
|
buttonColor,
|
|
37907
|
-
onDeleteClick
|
|
37908
|
-
|
|
37912
|
+
onDeleteClick,
|
|
37913
|
+
resetFocus = false,
|
|
37914
|
+
onFocusChange
|
|
37915
|
+
}, ref) => {
|
|
37909
37916
|
const [hoveredRowIndex, setHoveredRowIndex] = React$1.useState(null);
|
|
37910
37917
|
const [focusedRowIndex, setFocusedRowIndex] = React$1.useState(null);
|
|
37911
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
|
+
|
|
37912
37939
|
// Handle row click for focus state
|
|
37913
37940
|
const handleRowClick = (row, rowIndex) => {
|
|
37914
37941
|
setFocusedRowIndex(rowIndex);
|
|
@@ -38148,7 +38175,10 @@ const TableBody = ({
|
|
|
38148
38175
|
$maxWidth: column.maxWidth
|
|
38149
38176
|
}, formattedValue);
|
|
38150
38177
|
}))));
|
|
38151
|
-
};
|
|
38178
|
+
});
|
|
38179
|
+
|
|
38180
|
+
// Add displayName for better debugging
|
|
38181
|
+
TableBody.displayName = 'TableBody';
|
|
38152
38182
|
|
|
38153
38183
|
var nm$1 = "calendar_lottie";
|
|
38154
38184
|
var ddd$1 = 0;
|
|
@@ -41317,7 +41347,7 @@ var Lottie = function Lottie(props) {
|
|
|
41317
41347
|
};
|
|
41318
41348
|
|
|
41319
41349
|
// Table.jsx
|
|
41320
|
-
const Table = props => {
|
|
41350
|
+
const Table = /*#__PURE__*/React$1.forwardRef((props, ref) => {
|
|
41321
41351
|
const {
|
|
41322
41352
|
width = '100%',
|
|
41323
41353
|
height = 'auto',
|
|
@@ -41348,10 +41378,34 @@ const Table = props => {
|
|
|
41348
41378
|
onDeleteClick = () => {},
|
|
41349
41379
|
showNoDataInSearch = false,
|
|
41350
41380
|
noDataInSearchTitle = "No Results Found",
|
|
41351
|
-
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
|
|
41352
41386
|
} = props;
|
|
41353
41387
|
const scrollWrapperRef = React$1.useRef(null);
|
|
41388
|
+
const tableBodyRef = React$1.useRef(null);
|
|
41389
|
+
const tableContainerRef = React$1.useRef(null);
|
|
41354
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
|
+
}));
|
|
41355
41409
|
React$1.useEffect(() => {
|
|
41356
41410
|
const scrollWrapper = scrollWrapperRef.current;
|
|
41357
41411
|
if (!scrollWrapper || !onLastRowsReached) return;
|
|
@@ -41380,6 +41434,23 @@ const Table = props => {
|
|
|
41380
41434
|
scrollWrapper.addEventListener('scroll', handleScroll);
|
|
41381
41435
|
return () => scrollWrapper.removeEventListener('scroll', handleScroll);
|
|
41382
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]);
|
|
41383
41454
|
return /*#__PURE__*/React__default["default"].createElement(TableWrapper, {
|
|
41384
41455
|
width: width,
|
|
41385
41456
|
height: height
|
|
@@ -41394,7 +41465,8 @@ const Table = props => {
|
|
|
41394
41465
|
hoverBackgroundColor: sideButtonHoverColor,
|
|
41395
41466
|
onClick: onSideButtonClick
|
|
41396
41467
|
})), children, /*#__PURE__*/React__default["default"].createElement(TableContainer, {
|
|
41397
|
-
showHorizontalScroll: showHorizontalScroll
|
|
41468
|
+
showHorizontalScroll: showHorizontalScroll,
|
|
41469
|
+
ref: tableContainerRef
|
|
41398
41470
|
}, /*#__PURE__*/React__default["default"].createElement(TableBodyScrollWrapper, {
|
|
41399
41471
|
tableBodyHeight: tableBodyHeight,
|
|
41400
41472
|
showHorizontalScroll: showHorizontalScroll,
|
|
@@ -41405,12 +41477,15 @@ const Table = props => {
|
|
|
41405
41477
|
onFilter: onFilter,
|
|
41406
41478
|
onSelectAll: onSelectAll
|
|
41407
41479
|
}), columns.length > 0 && data.length > 0 && /*#__PURE__*/React__default["default"].createElement(TableBody, {
|
|
41480
|
+
ref: tableBodyRef,
|
|
41408
41481
|
columns: columns,
|
|
41409
41482
|
data: data,
|
|
41410
41483
|
onRowClick: onRowClick,
|
|
41411
41484
|
onSendClick: onSendClick,
|
|
41412
41485
|
onDeleteClick: onDeleteClick,
|
|
41413
|
-
buttonColor: buttonColor
|
|
41486
|
+
buttonColor: buttonColor,
|
|
41487
|
+
resetFocus: resetTableFocus,
|
|
41488
|
+
onFocusChange: handleTableFocusChange
|
|
41414
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, {
|
|
41415
41490
|
height: "45px",
|
|
41416
41491
|
leftIcon: "Plus",
|
|
@@ -41429,7 +41504,10 @@ const Table = props => {
|
|
|
41429
41504
|
animationData: LoadingAnimation,
|
|
41430
41505
|
loop: true
|
|
41431
41506
|
}), /*#__PURE__*/React__default["default"].createElement(LoadingText, null, isLoadingText)))));
|
|
41432
|
-
};
|
|
41507
|
+
});
|
|
41508
|
+
|
|
41509
|
+
// Add displayName for better debugging
|
|
41510
|
+
Table.displayName = 'Table';
|
|
41433
41511
|
|
|
41434
41512
|
const Card = styled__default["default"].div`
|
|
41435
41513
|
background: ${props => props.backgroundColor};
|