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.js
CHANGED
|
@@ -35876,9 +35876,12 @@ const TableContainer = styled__default["default"].div`
|
|
|
35876
35876
|
${scrollableStyles$1}
|
|
35877
35877
|
`;
|
|
35878
35878
|
const TableBodyScrollWrapper = styled__default["default"].div`
|
|
35879
|
+
height: ${props => props.tableBodyHeight || '728px'};
|
|
35880
|
+
min-height: ${props => props.tableBodyHeight || '728px'};
|
|
35879
35881
|
max-height: ${props => props.tableBodyHeight || '728px'};
|
|
35880
35882
|
overflow-y: auto;
|
|
35881
35883
|
overflow-x: ${props => props.showHorizontalScroll ? 'auto' : 'hidden'};
|
|
35884
|
+
position: relative;
|
|
35882
35885
|
|
|
35883
35886
|
&::-webkit-scrollbar {
|
|
35884
35887
|
height: 8px;
|
|
@@ -36357,6 +36360,7 @@ const FieldPop = props => {
|
|
|
36357
36360
|
}, "\xD7")));
|
|
36358
36361
|
};
|
|
36359
36362
|
|
|
36363
|
+
// FilterPop.style.js
|
|
36360
36364
|
const FilterPopContainer = styled__default["default"].div`
|
|
36361
36365
|
font-family: 'Poppins', sans-serif;
|
|
36362
36366
|
width: ${props => props.width || '300px'};
|
|
@@ -36366,6 +36370,13 @@ const FilterPopContainer = styled__default["default"].div`
|
|
|
36366
36370
|
background-color: #fff;
|
|
36367
36371
|
border-radius: 4px;
|
|
36368
36372
|
box-shadow: 0px 4px 20px 0px rgba(0, 0, 0, 0.10);
|
|
36373
|
+
|
|
36374
|
+
/* Add this CSS for checkbox styling */
|
|
36375
|
+
input[type="checkbox"] {
|
|
36376
|
+
accent-color: ${props => props.accentColor || '#066768'};
|
|
36377
|
+
width: 16px;
|
|
36378
|
+
height: 16px;
|
|
36379
|
+
}
|
|
36369
36380
|
`;
|
|
36370
36381
|
const Title$5 = styled__default["default"].h6`
|
|
36371
36382
|
font-size: 16px;
|
|
@@ -36388,6 +36399,12 @@ const CheckboxLabel = styled__default["default"].label`
|
|
|
36388
36399
|
font-size: 14px;
|
|
36389
36400
|
font-weight: 400;
|
|
36390
36401
|
color: #212121;
|
|
36402
|
+
cursor: pointer;
|
|
36403
|
+
|
|
36404
|
+
&:hover {
|
|
36405
|
+
background-color: #E6F0F0;
|
|
36406
|
+
}
|
|
36407
|
+
|
|
36391
36408
|
> span {
|
|
36392
36409
|
width: ${props => props.width};
|
|
36393
36410
|
white-space: nowrap;
|
|
@@ -36407,9 +36424,11 @@ const ResetButton$1 = styled__default["default"].button`
|
|
|
36407
36424
|
cursor: pointer;
|
|
36408
36425
|
|
|
36409
36426
|
&:hover {
|
|
36427
|
+
// color: #066768;
|
|
36410
36428
|
}
|
|
36411
36429
|
|
|
36412
36430
|
&:active {
|
|
36431
|
+
// color: #066768;
|
|
36413
36432
|
}
|
|
36414
36433
|
`;
|
|
36415
36434
|
|
|
@@ -36442,22 +36461,8 @@ const FilterPop = props => {
|
|
|
36442
36461
|
return initialState;
|
|
36443
36462
|
};
|
|
36444
36463
|
|
|
36445
|
-
// Use
|
|
36446
|
-
const
|
|
36447
|
-
// If propSelectedAttributes has values, use it; otherwise use initial state
|
|
36448
|
-
const hasValues = Object.keys(propSelectedAttributes).length > 0;
|
|
36449
|
-
return hasValues ? propSelectedAttributes : createInitialState();
|
|
36450
|
-
});
|
|
36451
|
-
|
|
36452
|
-
// Use ref to track if we're programmatically updating to avoid loops
|
|
36453
|
-
const isProgrammaticUpdate = React$1.useRef(false);
|
|
36454
|
-
|
|
36455
|
-
// Sync with parent's selectedAttributes when they change
|
|
36456
|
-
React$1.useEffect(() => {
|
|
36457
|
-
if (Object.keys(propSelectedAttributes).length > 0) {
|
|
36458
|
-
setSelectedAttributes(propSelectedAttributes);
|
|
36459
|
-
}
|
|
36460
|
-
}, [propSelectedAttributes]);
|
|
36464
|
+
// Use props directly, fallback to initial state only if props are empty
|
|
36465
|
+
const selectedAttributes = Object.keys(propSelectedAttributes).length > 0 ? propSelectedAttributes : createInitialState();
|
|
36461
36466
|
|
|
36462
36467
|
// Helper function to get non-"All" items
|
|
36463
36468
|
const getNonAllItems = () => {
|
|
@@ -36515,19 +36520,16 @@ const FilterPop = props => {
|
|
|
36515
36520
|
}
|
|
36516
36521
|
};
|
|
36517
36522
|
const handleCheckboxChange = attribute => {
|
|
36518
|
-
// console.log(`Checkbox changed: ${attribute}`);
|
|
36519
|
-
|
|
36520
36523
|
if (attribute === 'All') {
|
|
36521
|
-
// If "Select All" is clicked
|
|
36522
|
-
const
|
|
36524
|
+
// If "Select All" is clicked - determine new state based on current "Select All" state
|
|
36525
|
+
const currentSelectAllState = selectedAttributes.All || false;
|
|
36526
|
+
const newState = !currentSelectAllState;
|
|
36523
36527
|
const updatedAttributes = {};
|
|
36524
36528
|
|
|
36525
36529
|
// Set all items to the same state as "Select All"
|
|
36526
36530
|
fullList.forEach(item => {
|
|
36527
36531
|
updatedAttributes[item.value] = newState;
|
|
36528
36532
|
});
|
|
36529
|
-
isProgrammaticUpdate.current = true;
|
|
36530
|
-
setSelectedAttributes(updatedAttributes);
|
|
36531
36533
|
|
|
36532
36534
|
// Call onCheck callback with new efficient structure
|
|
36533
36535
|
const filterData = createFilterData(updatedAttributes);
|
|
@@ -36543,14 +36545,8 @@ const FilterPop = props => {
|
|
|
36543
36545
|
[attribute]: !selectedAttributes[attribute]
|
|
36544
36546
|
};
|
|
36545
36547
|
|
|
36546
|
-
// Don't automatically update "Select All" here - let useEffect handle it
|
|
36547
|
-
setSelectedAttributes(updatedAttributes);
|
|
36548
|
-
|
|
36549
36548
|
// Call onCheck callback with new efficient structure
|
|
36550
36549
|
const filterData = createFilterData(updatedAttributes);
|
|
36551
|
-
// console.log('Just checked/unchecked:', attribute);
|
|
36552
|
-
// console.log('Filter data:', filterData);
|
|
36553
|
-
|
|
36554
36550
|
onCheck({
|
|
36555
36551
|
changedItem: attribute,
|
|
36556
36552
|
filterData: filterData,
|
|
@@ -36558,40 +36554,9 @@ const FilterPop = props => {
|
|
|
36558
36554
|
});
|
|
36559
36555
|
}
|
|
36560
36556
|
};
|
|
36561
|
-
|
|
36562
|
-
// Update "Select All" state based on other selections
|
|
36563
|
-
React$1.useEffect(() => {
|
|
36564
|
-
// Skip if this was a programmatic update
|
|
36565
|
-
if (isProgrammaticUpdate.current) {
|
|
36566
|
-
isProgrammaticUpdate.current = false;
|
|
36567
|
-
return;
|
|
36568
|
-
}
|
|
36569
|
-
const selectAllItem = fullList.find(item => item.value === 'All');
|
|
36570
|
-
if (!selectAllItem) return;
|
|
36571
|
-
const allSelected = areAllNonAllItemsSelected();
|
|
36572
|
-
const currentSelectAllState = selectedAttributes.All;
|
|
36573
|
-
|
|
36574
|
-
// Only update "Select All" if its state should actually change
|
|
36575
|
-
if (allSelected !== currentSelectAllState) {
|
|
36576
|
-
const updatedAttributes = {
|
|
36577
|
-
...selectedAttributes,
|
|
36578
|
-
[selectAllItem.value]: allSelected
|
|
36579
|
-
};
|
|
36580
|
-
setSelectedAttributes(updatedAttributes);
|
|
36581
|
-
|
|
36582
|
-
// Also notify parent of the change with new efficient structure
|
|
36583
|
-
const filterData = createFilterData(updatedAttributes);
|
|
36584
|
-
onCheck({
|
|
36585
|
-
changedItem: 'selectAll',
|
|
36586
|
-
filterData: filterData,
|
|
36587
|
-
allItems: updatedAttributes
|
|
36588
|
-
});
|
|
36589
|
-
}
|
|
36590
|
-
}, [Object.keys(selectedAttributes).filter(key => key !== 'All').map(key => selectedAttributes[key]).join(',')]);
|
|
36591
36557
|
const handleReset = () => {
|
|
36592
36558
|
// Reset to the original default state (all selected)
|
|
36593
36559
|
const resetState = createInitialState();
|
|
36594
|
-
setSelectedAttributes(resetState);
|
|
36595
36560
|
|
|
36596
36561
|
// Call the onReset callback
|
|
36597
36562
|
onReset();
|
|
@@ -36634,7 +36599,8 @@ const FilterPop = props => {
|
|
|
36634
36599
|
})];
|
|
36635
36600
|
return /*#__PURE__*/React__default["default"].createElement(FilterPopContainer, {
|
|
36636
36601
|
width: width,
|
|
36637
|
-
height: height
|
|
36602
|
+
height: height,
|
|
36603
|
+
accentColor: color // Pass color as prop to styled component
|
|
36638
36604
|
}, /*#__PURE__*/React__default["default"].createElement(Title$5, null, menuName), /*#__PURE__*/React__default["default"].createElement(CheckboxGroup, {
|
|
36639
36605
|
style: {
|
|
36640
36606
|
display: doubleColumn ? 'grid' : 'flex',
|
|
@@ -36644,19 +36610,29 @@ const FilterPop = props => {
|
|
|
36644
36610
|
}, sortedList.map(item => {
|
|
36645
36611
|
const isSelectAll = item.value === 'All';
|
|
36646
36612
|
const checkboxProps = isSelectAll ? getSelectAllCheckboxProps() : {};
|
|
36613
|
+
const isChecked = isSelectAll ? checkboxProps.checked : selectedAttributes[item.value] || false;
|
|
36647
36614
|
return /*#__PURE__*/React__default["default"].createElement(CheckboxLabel, {
|
|
36648
36615
|
width: !doubleColumn ?? width,
|
|
36649
|
-
key: item.value
|
|
36616
|
+
key: `${item.value}-${JSON.stringify(selectedAttributes)}`
|
|
36650
36617
|
}, /*#__PURE__*/React__default["default"].createElement("input", {
|
|
36651
36618
|
type: "checkbox",
|
|
36652
|
-
checked:
|
|
36653
|
-
|
|
36654
|
-
|
|
36619
|
+
checked: isChecked,
|
|
36620
|
+
ref: el => {
|
|
36621
|
+
if (el) {
|
|
36622
|
+
// Handle indeterminate for Select All FIRST
|
|
36623
|
+
if (isSelectAll) {
|
|
36624
|
+
el.indeterminate = checkboxProps.indeterminate;
|
|
36625
|
+
}
|
|
36626
|
+
|
|
36627
|
+
// FORCE DOM SYNC - manually set DOM state to match React state
|
|
36628
|
+
if (el.checked !== isChecked) {
|
|
36629
|
+
el.checked = isChecked;
|
|
36630
|
+
}
|
|
36631
|
+
}
|
|
36655
36632
|
},
|
|
36656
|
-
|
|
36657
|
-
|
|
36658
|
-
}
|
|
36659
|
-
onChange: () => handleCheckboxChange(item.value)
|
|
36633
|
+
onChange: e => {
|
|
36634
|
+
handleCheckboxChange(item.value);
|
|
36635
|
+
}
|
|
36660
36636
|
}), /*#__PURE__*/React__default["default"].createElement("span", null, item.label));
|
|
36661
36637
|
})), /*#__PURE__*/React__default["default"].createElement(ButtonWrapper$2, null, /*#__PURE__*/React__default["default"].createElement(ResetButton$1, {
|
|
36662
36638
|
onClick: handleReset,
|
|
@@ -37250,7 +37226,9 @@ const TableHeader = ({
|
|
|
37250
37226
|
// Remove onSort call - we only want to call it when selection is made
|
|
37251
37227
|
};
|
|
37252
37228
|
React$1.useEffect(() => {
|
|
37253
|
-
|
|
37229
|
+
if (Object.keys(filterState).length > 0) {
|
|
37230
|
+
onFilter(filterState);
|
|
37231
|
+
}
|
|
37254
37232
|
}, [filterState]);
|
|
37255
37233
|
const handleFilter = key => {
|
|
37256
37234
|
const iconElement = iconRefs.current[`filter-${key}`];
|
|
@@ -37291,25 +37269,25 @@ const TableHeader = ({
|
|
|
37291
37269
|
}
|
|
37292
37270
|
};
|
|
37293
37271
|
|
|
37294
|
-
// Handle filter selection changes - Updated to work with
|
|
37272
|
+
// Handle filter selection changes - Updated to work with stateless FilterPop
|
|
37295
37273
|
const handleFilterSelectionChange = (columnKey, selectionData) => {
|
|
37296
|
-
//
|
|
37297
|
-
setFilterSelections(prev =>
|
|
37298
|
-
|
|
37299
|
-
|
|
37300
|
-
|
|
37274
|
+
// Force immediate synchronous update using callback form
|
|
37275
|
+
setFilterSelections(prev => {
|
|
37276
|
+
const updated = {
|
|
37277
|
+
...prev,
|
|
37278
|
+
[columnKey]: selectionData.allItems
|
|
37279
|
+
};
|
|
37280
|
+
return updated;
|
|
37281
|
+
});
|
|
37301
37282
|
|
|
37302
|
-
//
|
|
37303
|
-
const {
|
|
37304
|
-
filterData
|
|
37305
|
-
} = selectionData;
|
|
37283
|
+
// Also update filter state
|
|
37306
37284
|
setFilterState(prev => ({
|
|
37307
37285
|
...prev,
|
|
37308
|
-
[columnKey]: filterData
|
|
37286
|
+
[columnKey]: selectionData.filterData
|
|
37309
37287
|
}));
|
|
37310
37288
|
};
|
|
37311
37289
|
|
|
37312
|
-
// Handle filter reset - Updated to work with
|
|
37290
|
+
// Handle filter reset - Updated to work with stateless FilterPop
|
|
37313
37291
|
const handleFilterReset = columnKey => {
|
|
37314
37292
|
const column = columns.find(col => col.key === columnKey);
|
|
37315
37293
|
if (column && column.filterOptions) {
|
|
@@ -37321,6 +37299,8 @@ const TableHeader = ({
|
|
|
37321
37299
|
fullList.forEach(item => {
|
|
37322
37300
|
resetState[item.value] = true;
|
|
37323
37301
|
});
|
|
37302
|
+
|
|
37303
|
+
// Update filter selections immediately
|
|
37324
37304
|
setFilterSelections(prev => ({
|
|
37325
37305
|
...prev,
|
|
37326
37306
|
[columnKey]: resetState
|
|
@@ -37420,7 +37400,7 @@ const TableHeader = ({
|
|
|
37420
37400
|
return isFocused || isActive || hasSelection;
|
|
37421
37401
|
};
|
|
37422
37402
|
|
|
37423
|
-
// Update showColumnFilter to
|
|
37403
|
+
// Update showColumnFilter to pass current filterSelections to stateless FilterPop
|
|
37424
37404
|
const showColumnFilter = column => {
|
|
37425
37405
|
const {
|
|
37426
37406
|
key,
|
|
@@ -41376,7 +41356,7 @@ const Table = props => {
|
|
|
41376
41356
|
return /*#__PURE__*/React__default["default"].createElement(TableWrapper, {
|
|
41377
41357
|
width: width,
|
|
41378
41358
|
height: height
|
|
41379
|
-
}, /*#__PURE__*/React__default["default"].createElement(NoInfoFound, null, /*#__PURE__*/React__default["default"].createElement(TableTop, null, /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement(Title$7, null, tableTitle), /*#__PURE__*/React__default["default"].createElement(SubTitle, null,
|
|
41359
|
+
}, /*#__PURE__*/React__default["default"].createElement(NoInfoFound, null, /*#__PURE__*/React__default["default"].createElement(TableTop, null, /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement(Title$7, null, tableTitle), /*#__PURE__*/React__default["default"].createElement(SubTitle, null, data.length === 0 ? 'No Events' : `${counter} Events`)), showSideButton && /*#__PURE__*/React__default["default"].createElement(Button$1, {
|
|
41380
41360
|
height: "45px",
|
|
41381
41361
|
leftIcon: "Plus",
|
|
41382
41362
|
text: "New Event",
|
|
@@ -41384,15 +41364,7 @@ const Table = props => {
|
|
|
41384
41364
|
backgroundColor: sideButtonColor,
|
|
41385
41365
|
hoverBackgroundColor: sideButtonHoverColor,
|
|
41386
41366
|
onClick: onSideButtonClick
|
|
41387
|
-
})), children,
|
|
41388
|
-
height: "45px",
|
|
41389
|
-
leftIcon: "Plus",
|
|
41390
|
-
text: "New Event",
|
|
41391
|
-
borderRadius: "12px",
|
|
41392
|
-
backgroundColor: buttonColor,
|
|
41393
|
-
hoverBackgroundColor: buttonHoverColor,
|
|
41394
|
-
onClick: onButtonClick
|
|
41395
|
-
})) : /*#__PURE__*/React__default["default"].createElement(TableContainer, {
|
|
41367
|
+
})), children, /*#__PURE__*/React__default["default"].createElement(TableContainer, {
|
|
41396
41368
|
showHorizontalScroll: showHorizontalScroll
|
|
41397
41369
|
}, /*#__PURE__*/React__default["default"].createElement(TableBodyScrollWrapper, {
|
|
41398
41370
|
tableBodyHeight: tableBodyHeight,
|
|
@@ -41410,6 +41382,14 @@ const Table = props => {
|
|
|
41410
41382
|
onSendClick: onSendClick,
|
|
41411
41383
|
onDeleteClick: onDeleteClick,
|
|
41412
41384
|
buttonColor: buttonColor
|
|
41385
|
+
})), 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, {
|
|
41386
|
+
height: "45px",
|
|
41387
|
+
leftIcon: "Plus",
|
|
41388
|
+
text: "New Event",
|
|
41389
|
+
borderRadius: "12px",
|
|
41390
|
+
backgroundColor: buttonColor,
|
|
41391
|
+
hoverBackgroundColor: buttonHoverColor,
|
|
41392
|
+
onClick: onButtonClick
|
|
41413
41393
|
}))), isLoading && /*#__PURE__*/React__default["default"].createElement(LoadingWrapper, null, /*#__PURE__*/React__default["default"].createElement(Lottie, {
|
|
41414
41394
|
style: {
|
|
41415
41395
|
width: "24px",
|