@stella-source/stellasource-dsl 4.0.0 → 5.1.1
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/cjs/index.js +108 -46
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/RadioButton/RadioButton.d.ts +4 -0
- package/dist/cjs/types/components/RadioButton/RadioButton.stories.d.ts +14 -0
- package/dist/cjs/types/components/RadioButton/styles.d.ts +38 -0
- package/dist/cjs/types/components/RadioButton/types.d.ts +13 -0
- package/dist/cjs/types/components/RadioButtonGroup/RadioButtonGroup.d.ts +4 -0
- package/dist/cjs/types/components/RadioButtonGroup/RadioButtonGroup.stories.d.ts +87 -0
- package/dist/cjs/types/components/RadioButtonGroup/styles.d.ts +8 -0
- package/dist/cjs/types/components/RadioButtonGroup/types.d.ts +22 -0
- package/dist/cjs/types/components/Table/Table.d.ts +1 -1
- package/dist/cjs/types/components/Table/Table.stories.d.ts +8 -0
- package/dist/cjs/types/components/Table/styles.d.ts +15 -3
- package/dist/cjs/types/components/Table/types.d.ts +4 -5
- package/dist/esm/index.esm.js +108 -46
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/esm/types/components/RadioButton/RadioButton.d.ts +4 -0
- package/dist/esm/types/components/RadioButton/RadioButton.stories.d.ts +14 -0
- package/dist/esm/types/components/RadioButton/styles.d.ts +38 -0
- package/dist/esm/types/components/RadioButton/types.d.ts +13 -0
- package/dist/esm/types/components/RadioButtonGroup/RadioButtonGroup.d.ts +4 -0
- package/dist/esm/types/components/RadioButtonGroup/RadioButtonGroup.stories.d.ts +87 -0
- package/dist/esm/types/components/RadioButtonGroup/styles.d.ts +8 -0
- package/dist/esm/types/components/RadioButtonGroup/types.d.ts +22 -0
- package/dist/esm/types/components/Table/Table.d.ts +1 -1
- package/dist/esm/types/components/Table/Table.stories.d.ts +8 -0
- package/dist/esm/types/components/Table/styles.d.ts +15 -3
- package/dist/esm/types/components/Table/types.d.ts +4 -5
- package/dist/index.d.ts +5 -6
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -22115,6 +22115,7 @@ const HeaderRow = styled.tr `
|
|
|
22115
22115
|
background-color: ${Styles.color.grey.pale};
|
|
22116
22116
|
min-height: 50px;
|
|
22117
22117
|
height: 50px;
|
|
22118
|
+
display: ${({ $isEmpty }) => ($isEmpty ? "none" : "table-row")};
|
|
22118
22119
|
`;
|
|
22119
22120
|
const CellRow = styled.tr `
|
|
22120
22121
|
min-height: 50px;
|
|
@@ -22328,6 +22329,7 @@ const LoadingShimmer = styled.div `
|
|
|
22328
22329
|
`;
|
|
22329
22330
|
const CustomPagination = styled(Pagination) `
|
|
22330
22331
|
border-top: ${({ $hasData }) => $hasData ? "0px" : `1px solid ${Styles.color.grey.light}`};
|
|
22332
|
+
display: ${({ $isEmpty }) => ($isEmpty ? "none" : "flex")};
|
|
22331
22333
|
`;
|
|
22332
22334
|
const KebabAlign = styled.div `
|
|
22333
22335
|
display: flex;
|
|
@@ -22344,12 +22346,8 @@ const EmptyTableSection = styled.section `
|
|
|
22344
22346
|
flex-direction: column;
|
|
22345
22347
|
justify-content: center;
|
|
22346
22348
|
align-items: center;
|
|
22347
|
-
position: absolute;
|
|
22348
22349
|
gap: 20px;
|
|
22349
|
-
|
|
22350
|
-
left: 0;
|
|
22351
|
-
right: 0;
|
|
22352
|
-
margin: 80px auto 0;
|
|
22350
|
+
margin: 0 auto;
|
|
22353
22351
|
`;
|
|
22354
22352
|
const EmptyTableHeader = styled.p `
|
|
22355
22353
|
display: flex;
|
|
@@ -22378,6 +22376,37 @@ const ClearFilterButtonRow = styled.div `
|
|
|
22378
22376
|
align-items: "center";
|
|
22379
22377
|
text-align: "center";
|
|
22380
22378
|
`;
|
|
22379
|
+
const ExpandedContentRow = styled.tr `
|
|
22380
|
+
background-color: ${Styles.color.grey.pale};
|
|
22381
|
+
`;
|
|
22382
|
+
const ExpandedContentCell = styled.td `
|
|
22383
|
+
padding: 12px 16px;
|
|
22384
|
+
border-bottom: 1px solid ${Styles.color.grey.light};
|
|
22385
|
+
background-color: ${Styles.color.grey.pale};
|
|
22386
|
+
`;
|
|
22387
|
+
const ExpandChevronButton = styled.button `
|
|
22388
|
+
display: flex;
|
|
22389
|
+
align-items: center;
|
|
22390
|
+
justify-content: center;
|
|
22391
|
+
background: none;
|
|
22392
|
+
border: none;
|
|
22393
|
+
cursor: pointer;
|
|
22394
|
+
padding: 4px;
|
|
22395
|
+
border-radius: 4px;
|
|
22396
|
+
transition:
|
|
22397
|
+
transform 0.2s ease,
|
|
22398
|
+
background-color 0.15s ease;
|
|
22399
|
+
|
|
22400
|
+
& > svg {
|
|
22401
|
+
transition: transform 0.2s ease;
|
|
22402
|
+
transform: ${({ $expanded }) => $expanded ? "rotate(90deg)" : "rotate(0deg)"};
|
|
22403
|
+
fill: ${Styles.color.grey.charcoal};
|
|
22404
|
+
}
|
|
22405
|
+
|
|
22406
|
+
&:hover {
|
|
22407
|
+
background-color: ${Styles.color.grey.light};
|
|
22408
|
+
}
|
|
22409
|
+
`;
|
|
22381
22410
|
const ActionBar = styled.div `
|
|
22382
22411
|
display: flex;
|
|
22383
22412
|
justify-content: space-between;
|
|
@@ -22618,7 +22647,7 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
22618
22647
|
startingPage: 1,
|
|
22619
22648
|
rowsPerPage: 10,
|
|
22620
22649
|
totalRows: data.length,
|
|
22621
|
-
}, selectionMenuItems, dataAuto, dataTestId, id, className, htmlProps, resetTrigger, emptyTableState, defaultFilters, staticFilters, enableShowHide, globalActions, }) {
|
|
22650
|
+
}, selectionMenuItems, dataAuto, dataTestId, id, className, htmlProps, resetTrigger, emptyTableState, defaultFilters, staticFilters, enableShowHide, globalActions, showExpandedRowToggle = false, renderExpandedRow, }) {
|
|
22622
22651
|
const [rowSelection, setRowSelection] = a$n.useState({});
|
|
22623
22652
|
const [selectedRows] = a$n.useState({});
|
|
22624
22653
|
const [pageIndex, setPageIndex] = a$n.useState(paginationDetails?.startingPage);
|
|
@@ -22678,6 +22707,14 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
22678
22707
|
});
|
|
22679
22708
|
const [rowStatusesState, setRowStatusesState] = a$n.useState(rowStatuses || {});
|
|
22680
22709
|
const [filterMenuOpen, setFilterMenuOpen] = a$n.useState({});
|
|
22710
|
+
const [expandedRows, setExpandedRows] = a$n.useState(new Set());
|
|
22711
|
+
const toggleRowExpanded = (rowId) => {
|
|
22712
|
+
setExpandedRows((prev) => {
|
|
22713
|
+
const next = new Set(prev);
|
|
22714
|
+
next.has(rowId) ? next.delete(rowId) : next.add(rowId);
|
|
22715
|
+
return next;
|
|
22716
|
+
});
|
|
22717
|
+
};
|
|
22681
22718
|
a$n.useEffect(() => {
|
|
22682
22719
|
setRowStatusesState(rowStatuses || {});
|
|
22683
22720
|
}, [rowStatuses]);
|
|
@@ -22751,6 +22788,18 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
22751
22788
|
};
|
|
22752
22789
|
const enhancedColumns = a$n.useMemo(() => {
|
|
22753
22790
|
const cols = [];
|
|
22791
|
+
if (showExpandedRowToggle) {
|
|
22792
|
+
cols.push({
|
|
22793
|
+
id: "expand",
|
|
22794
|
+
header: "",
|
|
22795
|
+
cell: ({ row }) => !!renderExpandedRow?.(row) ? (a$n.createElement(ExpandChevronButton, { "$expanded": expandedRows.has(row.id), onClick: (e) => {
|
|
22796
|
+
e.stopPropagation();
|
|
22797
|
+
toggleRowExpanded(row.id);
|
|
22798
|
+
}, "aria-label": expandedRows.has(row.id) ? "Collapse row" : "Expand row" },
|
|
22799
|
+
a$n.createElement(StellaIcon, { iconName: "chevron-right", size: 14 }))) : (a$n.createElement(a$n.Fragment, null)),
|
|
22800
|
+
size: 36,
|
|
22801
|
+
});
|
|
22802
|
+
}
|
|
22754
22803
|
if (showSelection) {
|
|
22755
22804
|
cols.push({
|
|
22756
22805
|
id: "select",
|
|
@@ -22782,6 +22831,7 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
22782
22831
|
onRowSelect,
|
|
22783
22832
|
showSelection,
|
|
22784
22833
|
showRowOptions,
|
|
22834
|
+
expandedRows,
|
|
22785
22835
|
]);
|
|
22786
22836
|
const table = useReactTable({
|
|
22787
22837
|
data: localData,
|
|
@@ -22887,7 +22937,7 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
22887
22937
|
};
|
|
22888
22938
|
return (a$n.createElement(a$n.Fragment, null,
|
|
22889
22939
|
!isLoading && (a$n.createElement(ActionBar, null,
|
|
22890
|
-
a$n.createElement(GlobalActionWrapper, null, globalActions?.
|
|
22940
|
+
a$n.createElement(GlobalActionWrapper, null, globalActions?.(table)),
|
|
22891
22941
|
a$n.createElement(GlobalActionWrapper, null, enableShowHide && (a$n.createElement(a$n.Fragment, null,
|
|
22892
22942
|
a$n.createElement(IconButton, { ref: visibilityButtonRef, ariaLabel: "Column show hide button", variant: "tertiary", iconName: "table", onClick: () => {
|
|
22893
22943
|
const rect = visibilityButtonRef.current?.getBoundingClientRect();
|
|
@@ -22949,7 +22999,7 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
22949
22999
|
}, key: index + "loading-row" }, Array.from({
|
|
22950
23000
|
length: 10,
|
|
22951
23001
|
}).map((_, i) => (a$n.createElement(LoadingShimmer, { key: `${i}-loading`, "$width": "110px", "$height": "25px" }))))))))) : (a$n.createElement(StyledTable, { id: `${id}-table`, ...htmlProps },
|
|
22952
|
-
a$n.createElement("thead", null, table.getHeaderGroups().map((headerGroup) => (a$n.createElement(HeaderRow, { key: headerGroup.id }, headerGroup.headers.map((header, i) => {
|
|
23002
|
+
a$n.createElement("thead", null, table.getHeaderGroups().map((headerGroup) => (a$n.createElement(HeaderRow, { key: headerGroup.id, "$isEmpty": table.getRowModel().rows.length === 0 }, headerGroup.headers.map((header, i) => {
|
|
22953
23003
|
return (a$n.createElement(TableHeaderCell, { key: header.id, serverSide: serverSide, header: header, filters: filters, sorting: sorting, scrollPosition: scrollState, onFilterMenuInteraction: (id, active) => {
|
|
22954
23004
|
setFilterMenuOpen((prev) => ({
|
|
22955
23005
|
...prev,
|
|
@@ -22965,45 +23015,57 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
22965
23015
|
}))))),
|
|
22966
23016
|
a$n.createElement("tbody", null,
|
|
22967
23017
|
table.getRowModel().rows.length === 0 && (a$n.createElement(EmptyTableState, { header: emptyTableState?.header || "No data available.", subHeader: emptyTableState?.subHeader, showClearFilterButton: emptyTableState?.showClearFilterButton, onClearFilters: resetTable, colSpan: table.getVisibleLeafColumns().length, size: "large" })),
|
|
22968
|
-
table.getRowModel().rows.map((row) => (a$n.createElement(
|
|
22969
|
-
|
|
22970
|
-
|
|
22971
|
-
|
|
22972
|
-
|
|
22973
|
-
|
|
22974
|
-
|
|
22975
|
-
.
|
|
22976
|
-
|
|
22977
|
-
|
|
22978
|
-
|
|
22979
|
-
|
|
22980
|
-
|
|
22981
|
-
|
|
22982
|
-
|
|
22983
|
-
|
|
22984
|
-
|
|
22985
|
-
|
|
22986
|
-
|
|
22987
|
-
|
|
23018
|
+
table.getRowModel().rows.map((row) => (a$n.createElement(a$n.Fragment, { key: row.id },
|
|
23019
|
+
a$n.createElement(CellRow, { onClick: () => {
|
|
23020
|
+
if (!showExpandedRowToggle &&
|
|
23021
|
+
!!renderExpandedRow?.(row))
|
|
23022
|
+
toggleRowExpanded(row.id);
|
|
23023
|
+
onRowClick?.(row.original);
|
|
23024
|
+
}, "$isClickable": !!onRowClick }, row.getVisibleCells().map((cell) => {
|
|
23025
|
+
const value = flexRender(cell.column.columnDef.cell, {
|
|
23026
|
+
...cell.getContext(),
|
|
23027
|
+
localValue: rowState[row.id]?.[cell.column.id],
|
|
23028
|
+
onLocalChange: (val) => handleInputChange(row.id, cell.column.id, val),
|
|
23029
|
+
});
|
|
23030
|
+
const meta = cell.column.columnDef
|
|
23031
|
+
.meta;
|
|
23032
|
+
return (a$n.createElement(BodyCell, { key: cell.id, style: {
|
|
23033
|
+
width: cell.column.getSize(),
|
|
23034
|
+
textAlign: meta?.cellAlign ||
|
|
23035
|
+
(typeof cell.getValue() === "number" ||
|
|
23036
|
+
meta?.dataType === "number"
|
|
23037
|
+
? "right"
|
|
23038
|
+
: "left"),
|
|
23039
|
+
boxShadow: scrollState.atLeft &&
|
|
23040
|
+
cell.column.getIsPinned() === "left"
|
|
22988
23041
|
? "none"
|
|
22989
|
-
:
|
|
22990
|
-
|
|
22991
|
-
|
|
22992
|
-
|
|
22993
|
-
|
|
22994
|
-
|
|
22995
|
-
|
|
22996
|
-
|
|
22997
|
-
|
|
22998
|
-
|
|
22999
|
-
|
|
23000
|
-
|
|
23001
|
-
|
|
23002
|
-
|
|
23003
|
-
|
|
23004
|
-
|
|
23005
|
-
|
|
23006
|
-
|
|
23042
|
+
: scrollState.atRight &&
|
|
23043
|
+
cell.column.getIsPinned() === "right"
|
|
23044
|
+
? "none"
|
|
23045
|
+
: undefined,
|
|
23046
|
+
backgroundColor: table
|
|
23047
|
+
.getSelectedRowModel()
|
|
23048
|
+
.rows.find((r) => r.id === row.id)
|
|
23049
|
+
? "#EBF0FA"
|
|
23050
|
+
: rowStatusesState?.[row.id] ===
|
|
23051
|
+
"action-pending"
|
|
23052
|
+
? "#FFFDEB"
|
|
23053
|
+
: rowStatusesState?.[row.id] === "completed"
|
|
23054
|
+
? "#F5F5F5"
|
|
23055
|
+
: "",
|
|
23056
|
+
}, "$isPinnedLeft": cell.column.getIsPinned() === "left", "$isPinnedRight": cell.column.getIsPinned() === "right", "$columnInfo": cell.column, "$isLastRow": serverSide
|
|
23057
|
+
? row.index ===
|
|
23058
|
+
table.getRowModel().rows.length - 1
|
|
23059
|
+
: row.index -
|
|
23060
|
+
pagination.pageSize *
|
|
23061
|
+
pagination.pageIndex ===
|
|
23062
|
+
table.getRowModel().rows.length - 1 }, value));
|
|
23063
|
+
})),
|
|
23064
|
+
expandedRows.has(row.id) &&
|
|
23065
|
+
renderExpandedRow &&
|
|
23066
|
+
!!renderExpandedRow(row) && (a$n.createElement(ExpandedContentRow, null,
|
|
23067
|
+
a$n.createElement(ExpandedContentCell, { colSpan: table.getVisibleLeafColumns().length }, renderExpandedRow(row))))))))))),
|
|
23068
|
+
showPagination && paginationDetails?.totalRows > 0 && (a$n.createElement(CustomPagination, { "$hasData": table.getRowModel().rows.length > 0, "$isEmpty": table.getRowModel().rows.length === 0, totalRows: serverSide ? totalData : table.getFilteredRowModel().rows.length, isLoading: isLoading, rowsPerPage: paginationDetails?.rowsPerPage, startingPage: pageIndex, onPageChange: (page, pageSize) => {
|
|
23007
23069
|
table.toggleAllRowsSelected(false);
|
|
23008
23070
|
setPageIndex(page);
|
|
23009
23071
|
setPagination((prev) => ({
|