sag_components 2.0.0-beta111 → 2.0.0-beta112
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.esm.js +72 -92
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +72 -92
- package/dist/index.js.map +1 -1
- package/dist/types/components/ItemManagerPanel/ItemManagerPanel.stories.d.ts +25 -5
- package/dist/types/components/Table/Table.stories.d.ts +4 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -35866,9 +35866,12 @@ const TableContainer = styled.div`
|
|
|
35866
35866
|
${scrollableStyles$1}
|
|
35867
35867
|
`;
|
|
35868
35868
|
const TableBodyScrollWrapper = styled.div`
|
|
35869
|
+
height: ${props => props.tableBodyHeight || '728px'};
|
|
35870
|
+
min-height: ${props => props.tableBodyHeight || '728px'};
|
|
35869
35871
|
max-height: ${props => props.tableBodyHeight || '728px'};
|
|
35870
35872
|
overflow-y: auto;
|
|
35871
35873
|
overflow-x: ${props => props.showHorizontalScroll ? 'auto' : 'hidden'};
|
|
35874
|
+
position: relative;
|
|
35872
35875
|
|
|
35873
35876
|
&::-webkit-scrollbar {
|
|
35874
35877
|
height: 8px;
|
|
@@ -36347,6 +36350,7 @@ const FieldPop = props => {
|
|
|
36347
36350
|
}, "\xD7")));
|
|
36348
36351
|
};
|
|
36349
36352
|
|
|
36353
|
+
// FilterPop.style.js
|
|
36350
36354
|
const FilterPopContainer = styled.div`
|
|
36351
36355
|
font-family: 'Poppins', sans-serif;
|
|
36352
36356
|
width: ${props => props.width || '300px'};
|
|
@@ -36356,6 +36360,13 @@ const FilterPopContainer = styled.div`
|
|
|
36356
36360
|
background-color: #fff;
|
|
36357
36361
|
border-radius: 4px;
|
|
36358
36362
|
box-shadow: 0px 4px 20px 0px rgba(0, 0, 0, 0.10);
|
|
36363
|
+
|
|
36364
|
+
/* Add this CSS for checkbox styling */
|
|
36365
|
+
input[type="checkbox"] {
|
|
36366
|
+
accent-color: ${props => props.accentColor || '#066768'};
|
|
36367
|
+
width: 16px;
|
|
36368
|
+
height: 16px;
|
|
36369
|
+
}
|
|
36359
36370
|
`;
|
|
36360
36371
|
const Title$5 = styled.h6`
|
|
36361
36372
|
font-size: 16px;
|
|
@@ -36378,6 +36389,12 @@ const CheckboxLabel = styled.label`
|
|
|
36378
36389
|
font-size: 14px;
|
|
36379
36390
|
font-weight: 400;
|
|
36380
36391
|
color: #212121;
|
|
36392
|
+
cursor: pointer;
|
|
36393
|
+
|
|
36394
|
+
&:hover {
|
|
36395
|
+
background-color: #E6F0F0;
|
|
36396
|
+
}
|
|
36397
|
+
|
|
36381
36398
|
> span {
|
|
36382
36399
|
width: ${props => props.width};
|
|
36383
36400
|
white-space: nowrap;
|
|
@@ -36397,9 +36414,11 @@ const ResetButton$1 = styled.button`
|
|
|
36397
36414
|
cursor: pointer;
|
|
36398
36415
|
|
|
36399
36416
|
&:hover {
|
|
36417
|
+
// color: #066768;
|
|
36400
36418
|
}
|
|
36401
36419
|
|
|
36402
36420
|
&:active {
|
|
36421
|
+
// color: #066768;
|
|
36403
36422
|
}
|
|
36404
36423
|
`;
|
|
36405
36424
|
|
|
@@ -36432,22 +36451,8 @@ const FilterPop = props => {
|
|
|
36432
36451
|
return initialState;
|
|
36433
36452
|
};
|
|
36434
36453
|
|
|
36435
|
-
// Use
|
|
36436
|
-
const
|
|
36437
|
-
// If propSelectedAttributes has values, use it; otherwise use initial state
|
|
36438
|
-
const hasValues = Object.keys(propSelectedAttributes).length > 0;
|
|
36439
|
-
return hasValues ? propSelectedAttributes : createInitialState();
|
|
36440
|
-
});
|
|
36441
|
-
|
|
36442
|
-
// Use ref to track if we're programmatically updating to avoid loops
|
|
36443
|
-
const isProgrammaticUpdate = useRef(false);
|
|
36444
|
-
|
|
36445
|
-
// Sync with parent's selectedAttributes when they change
|
|
36446
|
-
useEffect(() => {
|
|
36447
|
-
if (Object.keys(propSelectedAttributes).length > 0) {
|
|
36448
|
-
setSelectedAttributes(propSelectedAttributes);
|
|
36449
|
-
}
|
|
36450
|
-
}, [propSelectedAttributes]);
|
|
36454
|
+
// Use props directly, fallback to initial state only if props are empty
|
|
36455
|
+
const selectedAttributes = Object.keys(propSelectedAttributes).length > 0 ? propSelectedAttributes : createInitialState();
|
|
36451
36456
|
|
|
36452
36457
|
// Helper function to get non-"All" items
|
|
36453
36458
|
const getNonAllItems = () => {
|
|
@@ -36505,19 +36510,16 @@ const FilterPop = props => {
|
|
|
36505
36510
|
}
|
|
36506
36511
|
};
|
|
36507
36512
|
const handleCheckboxChange = attribute => {
|
|
36508
|
-
// console.log(`Checkbox changed: ${attribute}`);
|
|
36509
|
-
|
|
36510
36513
|
if (attribute === 'All') {
|
|
36511
|
-
// If "Select All" is clicked
|
|
36512
|
-
const
|
|
36514
|
+
// If "Select All" is clicked - determine new state based on current "Select All" state
|
|
36515
|
+
const currentSelectAllState = selectedAttributes.All || false;
|
|
36516
|
+
const newState = !currentSelectAllState;
|
|
36513
36517
|
const updatedAttributes = {};
|
|
36514
36518
|
|
|
36515
36519
|
// Set all items to the same state as "Select All"
|
|
36516
36520
|
fullList.forEach(item => {
|
|
36517
36521
|
updatedAttributes[item.value] = newState;
|
|
36518
36522
|
});
|
|
36519
|
-
isProgrammaticUpdate.current = true;
|
|
36520
|
-
setSelectedAttributes(updatedAttributes);
|
|
36521
36523
|
|
|
36522
36524
|
// Call onCheck callback with new efficient structure
|
|
36523
36525
|
const filterData = createFilterData(updatedAttributes);
|
|
@@ -36533,14 +36535,8 @@ const FilterPop = props => {
|
|
|
36533
36535
|
[attribute]: !selectedAttributes[attribute]
|
|
36534
36536
|
};
|
|
36535
36537
|
|
|
36536
|
-
// Don't automatically update "Select All" here - let useEffect handle it
|
|
36537
|
-
setSelectedAttributes(updatedAttributes);
|
|
36538
|
-
|
|
36539
36538
|
// Call onCheck callback with new efficient structure
|
|
36540
36539
|
const filterData = createFilterData(updatedAttributes);
|
|
36541
|
-
// console.log('Just checked/unchecked:', attribute);
|
|
36542
|
-
// console.log('Filter data:', filterData);
|
|
36543
|
-
|
|
36544
36540
|
onCheck({
|
|
36545
36541
|
changedItem: attribute,
|
|
36546
36542
|
filterData: filterData,
|
|
@@ -36548,40 +36544,9 @@ const FilterPop = props => {
|
|
|
36548
36544
|
});
|
|
36549
36545
|
}
|
|
36550
36546
|
};
|
|
36551
|
-
|
|
36552
|
-
// Update "Select All" state based on other selections
|
|
36553
|
-
useEffect(() => {
|
|
36554
|
-
// Skip if this was a programmatic update
|
|
36555
|
-
if (isProgrammaticUpdate.current) {
|
|
36556
|
-
isProgrammaticUpdate.current = false;
|
|
36557
|
-
return;
|
|
36558
|
-
}
|
|
36559
|
-
const selectAllItem = fullList.find(item => item.value === 'All');
|
|
36560
|
-
if (!selectAllItem) return;
|
|
36561
|
-
const allSelected = areAllNonAllItemsSelected();
|
|
36562
|
-
const currentSelectAllState = selectedAttributes.All;
|
|
36563
|
-
|
|
36564
|
-
// Only update "Select All" if its state should actually change
|
|
36565
|
-
if (allSelected !== currentSelectAllState) {
|
|
36566
|
-
const updatedAttributes = {
|
|
36567
|
-
...selectedAttributes,
|
|
36568
|
-
[selectAllItem.value]: allSelected
|
|
36569
|
-
};
|
|
36570
|
-
setSelectedAttributes(updatedAttributes);
|
|
36571
|
-
|
|
36572
|
-
// Also notify parent of the change with new efficient structure
|
|
36573
|
-
const filterData = createFilterData(updatedAttributes);
|
|
36574
|
-
onCheck({
|
|
36575
|
-
changedItem: 'selectAll',
|
|
36576
|
-
filterData: filterData,
|
|
36577
|
-
allItems: updatedAttributes
|
|
36578
|
-
});
|
|
36579
|
-
}
|
|
36580
|
-
}, [Object.keys(selectedAttributes).filter(key => key !== 'All').map(key => selectedAttributes[key]).join(',')]);
|
|
36581
36547
|
const handleReset = () => {
|
|
36582
36548
|
// Reset to the original default state (all selected)
|
|
36583
36549
|
const resetState = createInitialState();
|
|
36584
|
-
setSelectedAttributes(resetState);
|
|
36585
36550
|
|
|
36586
36551
|
// Call the onReset callback
|
|
36587
36552
|
onReset();
|
|
@@ -36624,7 +36589,8 @@ const FilterPop = props => {
|
|
|
36624
36589
|
})];
|
|
36625
36590
|
return /*#__PURE__*/React$1.createElement(FilterPopContainer, {
|
|
36626
36591
|
width: width,
|
|
36627
|
-
height: height
|
|
36592
|
+
height: height,
|
|
36593
|
+
accentColor: color // Pass color as prop to styled component
|
|
36628
36594
|
}, /*#__PURE__*/React$1.createElement(Title$5, null, menuName), /*#__PURE__*/React$1.createElement(CheckboxGroup, {
|
|
36629
36595
|
style: {
|
|
36630
36596
|
display: doubleColumn ? 'grid' : 'flex',
|
|
@@ -36634,19 +36600,29 @@ const FilterPop = props => {
|
|
|
36634
36600
|
}, sortedList.map(item => {
|
|
36635
36601
|
const isSelectAll = item.value === 'All';
|
|
36636
36602
|
const checkboxProps = isSelectAll ? getSelectAllCheckboxProps() : {};
|
|
36603
|
+
const isChecked = isSelectAll ? checkboxProps.checked : selectedAttributes[item.value] || false;
|
|
36637
36604
|
return /*#__PURE__*/React$1.createElement(CheckboxLabel, {
|
|
36638
36605
|
width: !doubleColumn ?? width,
|
|
36639
|
-
key: item.value
|
|
36606
|
+
key: `${item.value}-${JSON.stringify(selectedAttributes)}`
|
|
36640
36607
|
}, /*#__PURE__*/React$1.createElement("input", {
|
|
36641
36608
|
type: "checkbox",
|
|
36642
|
-
checked:
|
|
36643
|
-
|
|
36644
|
-
|
|
36609
|
+
checked: isChecked,
|
|
36610
|
+
ref: el => {
|
|
36611
|
+
if (el) {
|
|
36612
|
+
// Handle indeterminate for Select All FIRST
|
|
36613
|
+
if (isSelectAll) {
|
|
36614
|
+
el.indeterminate = checkboxProps.indeterminate;
|
|
36615
|
+
}
|
|
36616
|
+
|
|
36617
|
+
// FORCE DOM SYNC - manually set DOM state to match React state
|
|
36618
|
+
if (el.checked !== isChecked) {
|
|
36619
|
+
el.checked = isChecked;
|
|
36620
|
+
}
|
|
36621
|
+
}
|
|
36645
36622
|
},
|
|
36646
|
-
|
|
36647
|
-
|
|
36648
|
-
}
|
|
36649
|
-
onChange: () => handleCheckboxChange(item.value)
|
|
36623
|
+
onChange: e => {
|
|
36624
|
+
handleCheckboxChange(item.value);
|
|
36625
|
+
}
|
|
36650
36626
|
}), /*#__PURE__*/React$1.createElement("span", null, item.label));
|
|
36651
36627
|
})), /*#__PURE__*/React$1.createElement(ButtonWrapper$2, null, /*#__PURE__*/React$1.createElement(ResetButton$1, {
|
|
36652
36628
|
onClick: handleReset,
|
|
@@ -37240,7 +37216,9 @@ const TableHeader = ({
|
|
|
37240
37216
|
// Remove onSort call - we only want to call it when selection is made
|
|
37241
37217
|
};
|
|
37242
37218
|
useEffect(() => {
|
|
37243
|
-
|
|
37219
|
+
if (Object.keys(filterState).length > 0) {
|
|
37220
|
+
onFilter(filterState);
|
|
37221
|
+
}
|
|
37244
37222
|
}, [filterState]);
|
|
37245
37223
|
const handleFilter = key => {
|
|
37246
37224
|
const iconElement = iconRefs.current[`filter-${key}`];
|
|
@@ -37281,25 +37259,25 @@ const TableHeader = ({
|
|
|
37281
37259
|
}
|
|
37282
37260
|
};
|
|
37283
37261
|
|
|
37284
|
-
// Handle filter selection changes - Updated to work with
|
|
37262
|
+
// Handle filter selection changes - Updated to work with stateless FilterPop
|
|
37285
37263
|
const handleFilterSelectionChange = (columnKey, selectionData) => {
|
|
37286
|
-
//
|
|
37287
|
-
setFilterSelections(prev =>
|
|
37288
|
-
|
|
37289
|
-
|
|
37290
|
-
|
|
37264
|
+
// Force immediate synchronous update using callback form
|
|
37265
|
+
setFilterSelections(prev => {
|
|
37266
|
+
const updated = {
|
|
37267
|
+
...prev,
|
|
37268
|
+
[columnKey]: selectionData.allItems
|
|
37269
|
+
};
|
|
37270
|
+
return updated;
|
|
37271
|
+
});
|
|
37291
37272
|
|
|
37292
|
-
//
|
|
37293
|
-
const {
|
|
37294
|
-
filterData
|
|
37295
|
-
} = selectionData;
|
|
37273
|
+
// Also update filter state
|
|
37296
37274
|
setFilterState(prev => ({
|
|
37297
37275
|
...prev,
|
|
37298
|
-
[columnKey]: filterData
|
|
37276
|
+
[columnKey]: selectionData.filterData
|
|
37299
37277
|
}));
|
|
37300
37278
|
};
|
|
37301
37279
|
|
|
37302
|
-
// Handle filter reset - Updated to work with
|
|
37280
|
+
// Handle filter reset - Updated to work with stateless FilterPop
|
|
37303
37281
|
const handleFilterReset = columnKey => {
|
|
37304
37282
|
const column = columns.find(col => col.key === columnKey);
|
|
37305
37283
|
if (column && column.filterOptions) {
|
|
@@ -37311,6 +37289,8 @@ const TableHeader = ({
|
|
|
37311
37289
|
fullList.forEach(item => {
|
|
37312
37290
|
resetState[item.value] = true;
|
|
37313
37291
|
});
|
|
37292
|
+
|
|
37293
|
+
// Update filter selections immediately
|
|
37314
37294
|
setFilterSelections(prev => ({
|
|
37315
37295
|
...prev,
|
|
37316
37296
|
[columnKey]: resetState
|
|
@@ -37410,7 +37390,7 @@ const TableHeader = ({
|
|
|
37410
37390
|
return isFocused || isActive || hasSelection;
|
|
37411
37391
|
};
|
|
37412
37392
|
|
|
37413
|
-
// Update showColumnFilter to
|
|
37393
|
+
// Update showColumnFilter to pass current filterSelections to stateless FilterPop
|
|
37414
37394
|
const showColumnFilter = column => {
|
|
37415
37395
|
const {
|
|
37416
37396
|
key,
|
|
@@ -41366,7 +41346,7 @@ const Table = props => {
|
|
|
41366
41346
|
return /*#__PURE__*/React$1.createElement(TableWrapper, {
|
|
41367
41347
|
width: width,
|
|
41368
41348
|
height: height
|
|
41369
|
-
}, /*#__PURE__*/React$1.createElement(NoInfoFound, null, /*#__PURE__*/React$1.createElement(TableTop, null, /*#__PURE__*/React$1.createElement("div", null, /*#__PURE__*/React$1.createElement(Title$7, null, tableTitle), /*#__PURE__*/React$1.createElement(SubTitle, null,
|
|
41349
|
+
}, /*#__PURE__*/React$1.createElement(NoInfoFound, null, /*#__PURE__*/React$1.createElement(TableTop, null, /*#__PURE__*/React$1.createElement("div", null, /*#__PURE__*/React$1.createElement(Title$7, null, tableTitle), /*#__PURE__*/React$1.createElement(SubTitle, null, data.length === 0 ? 'No Events' : `${counter} Events`)), showSideButton && /*#__PURE__*/React$1.createElement(Button$1, {
|
|
41370
41350
|
height: "45px",
|
|
41371
41351
|
leftIcon: "Plus",
|
|
41372
41352
|
text: "New Event",
|
|
@@ -41374,15 +41354,7 @@ const Table = props => {
|
|
|
41374
41354
|
backgroundColor: sideButtonColor,
|
|
41375
41355
|
hoverBackgroundColor: sideButtonHoverColor,
|
|
41376
41356
|
onClick: onSideButtonClick
|
|
41377
|
-
})), children,
|
|
41378
|
-
height: "45px",
|
|
41379
|
-
leftIcon: "Plus",
|
|
41380
|
-
text: "New Event",
|
|
41381
|
-
borderRadius: "12px",
|
|
41382
|
-
backgroundColor: buttonColor,
|
|
41383
|
-
hoverBackgroundColor: buttonHoverColor,
|
|
41384
|
-
onClick: onButtonClick
|
|
41385
|
-
})) : /*#__PURE__*/React$1.createElement(TableContainer, {
|
|
41357
|
+
})), children, /*#__PURE__*/React$1.createElement(TableContainer, {
|
|
41386
41358
|
showHorizontalScroll: showHorizontalScroll
|
|
41387
41359
|
}, /*#__PURE__*/React$1.createElement(TableBodyScrollWrapper, {
|
|
41388
41360
|
tableBodyHeight: tableBodyHeight,
|
|
@@ -41400,6 +41372,14 @@ const Table = props => {
|
|
|
41400
41372
|
onSendClick: onSendClick,
|
|
41401
41373
|
onDeleteClick: onDeleteClick,
|
|
41402
41374
|
buttonColor: buttonColor
|
|
41375
|
+
})), 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, {
|
|
41376
|
+
height: "45px",
|
|
41377
|
+
leftIcon: "Plus",
|
|
41378
|
+
text: "New Event",
|
|
41379
|
+
borderRadius: "12px",
|
|
41380
|
+
backgroundColor: buttonColor,
|
|
41381
|
+
hoverBackgroundColor: buttonHoverColor,
|
|
41382
|
+
onClick: onButtonClick
|
|
41403
41383
|
}))), isLoading && /*#__PURE__*/React$1.createElement(LoadingWrapper, null, /*#__PURE__*/React$1.createElement(Lottie, {
|
|
41404
41384
|
style: {
|
|
41405
41385
|
width: "24px",
|