@stella-source/stellasource-dsl 0.2.2 → 0.2.4
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 +128 -76
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/Table/Table.d.ts +1 -1
- package/dist/cjs/types/components/Table/TableComponents/EmptyTableState.d.ts +13 -0
- package/dist/cjs/types/components/Table/styles.d.ts +9 -2
- package/dist/cjs/types/components/Table/types.d.ts +5 -0
- package/dist/cjs/types/components/TableUnitsAndTotals/types.d.ts +4 -4
- package/dist/cjs/types/index.d.ts +3 -0
- package/dist/cjs/types/shared/tokens/whiteLabel/TransformValuesForOverridesUtil.d.ts +4 -0
- package/dist/cjs/types/shared/tokens/whiteLabel/WhiteLabelCSSOverrides.d.ts +9 -0
- package/dist/cjs/types/shared/utils/numberHelpers.d.ts +0 -1
- package/dist/esm/index.esm.js +121 -69
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/esm/types/components/Table/Table.d.ts +1 -1
- package/dist/esm/types/components/Table/TableComponents/EmptyTableState.d.ts +13 -0
- package/dist/esm/types/components/Table/styles.d.ts +9 -2
- package/dist/esm/types/components/Table/types.d.ts +5 -0
- package/dist/esm/types/components/TableUnitsAndTotals/types.d.ts +4 -4
- package/dist/esm/types/index.d.ts +3 -0
- package/dist/esm/types/shared/tokens/whiteLabel/TransformValuesForOverridesUtil.d.ts +4 -0
- package/dist/esm/types/shared/tokens/whiteLabel/WhiteLabelCSSOverrides.d.ts +9 -0
- package/dist/esm/types/shared/utils/numberHelpers.d.ts +0 -1
- package/dist/index.d.ts +11 -6
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { TableProps } from "./types";
|
|
3
|
-
declare function Table<T>({ columns, data, isLoading, serverSide, onPageChange, onSortChange, onFilterChange, onRowSelect, rowStatuses, showSelection, showRowOptions, showPagination, variant, paginationDetails, selectionMenuItems, dataAuto, dataTestId, id, className, htmlProps, resetTrigger, }: TableProps<T>): React.JSX.Element;
|
|
3
|
+
declare function Table<T>({ columns, data, isLoading, serverSide, onPageChange, onSortChange, onFilterChange, onRowSelect, rowStatuses, showSelection, showRowOptions, showPagination, variant, paginationDetails, selectionMenuItems, dataAuto, dataTestId, id, className, htmlProps, resetTrigger, emptyTableState, }: TableProps<T>): React.JSX.Element;
|
|
4
4
|
export default Table;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface EmptyTableStateProps {
|
|
3
|
+
id?: string;
|
|
4
|
+
className?: string;
|
|
5
|
+
header: string;
|
|
6
|
+
subHeader?: string;
|
|
7
|
+
showClearFilterButton?: boolean;
|
|
8
|
+
onClearFilters?: () => void;
|
|
9
|
+
colSpan: number;
|
|
10
|
+
size?: "small" | "large";
|
|
11
|
+
}
|
|
12
|
+
declare const EmptyTableState: ({ id, className, header, subHeader, showClearFilterButton, colSpan, size, onClearFilters, }: EmptyTableStateProps) => React.JSX.Element;
|
|
13
|
+
export default EmptyTableState;
|
|
@@ -12,7 +12,7 @@ declare const HeaderCell: import("styled-components/dist/types").IStyledComponen
|
|
|
12
12
|
declare const HeaderCellPosition: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
13
13
|
declare const TableWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
14
14
|
declare const TableWrapperScroll: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
15
|
-
$
|
|
15
|
+
$stopScroll: boolean;
|
|
16
16
|
}>> & string;
|
|
17
17
|
declare const StyledTable: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, never>> & string;
|
|
18
18
|
declare const CustomIconButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<import("../IconButton/types").IconButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>, HeaderIconButtonProps>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<import("../IconButton/types").IconButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>, keyof import("react").Component<any, {}, any>>;
|
|
@@ -41,4 +41,11 @@ declare const LoadingShimmer: import("styled-components/dist/types").IStyledComp
|
|
|
41
41
|
}>> & string;
|
|
42
42
|
declare const CustomPagination: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("../Pagination/types").PaginationProps, never>> & string & Omit<({ isLoading, rowsPerPage, totalRows, ariaLabel, onPageChange, startingPage, id, className, htmlProps, }: import("../Pagination/types").PaginationProps) => import("react").JSX.Element, keyof import("react").Component<any, {}, any>>;
|
|
43
43
|
declare const KebabAlign: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
44
|
-
|
|
44
|
+
declare const EmptyTableCell: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, never>> & string;
|
|
45
|
+
declare const EmptyTableSection: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {
|
|
46
|
+
$size?: "small" | "large";
|
|
47
|
+
}>> & string;
|
|
48
|
+
declare const EmptyTableHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>> & string;
|
|
49
|
+
declare const EmptyTableSubHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>> & string;
|
|
50
|
+
declare const ClearFilterButtonRow: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
51
|
+
export { HeaderCell, TableWrapper, TableWrapperScroll, StyledTable, CustomIconButton, SortButton, HeaderRow, FilterMenu, Checkbox, BodyCell, HeaderCellPosition, MenuButton, MenuItem, FilterBoxLabel, LoadingShimmer, FilterLabelTransparent, CustomPagination, CellRow, MenuItemGroup, KebabAlign, MenuItemOption, EmptyTableCell, EmptyTableSection, EmptyTableHeader, EmptyTableSubHeader, ClearFilterButtonRow, };
|
|
@@ -38,6 +38,11 @@ export interface TableProps<T> {
|
|
|
38
38
|
paginationDetails?: PaginationDetails;
|
|
39
39
|
rowStatuses?: Record<number | string, RowStatus>;
|
|
40
40
|
resetTrigger?: number;
|
|
41
|
+
emptyTableState: {
|
|
42
|
+
header: string;
|
|
43
|
+
subHeader?: string;
|
|
44
|
+
showClearFilterButton?: boolean;
|
|
45
|
+
};
|
|
41
46
|
}
|
|
42
47
|
export interface CustomColumnMeta {
|
|
43
48
|
headerAlign?: "left" | "right";
|
|
@@ -13,16 +13,16 @@ export declare enum QuoteCategory {
|
|
|
13
13
|
interface TableUnitsAndTotalsProps {
|
|
14
14
|
id?: string;
|
|
15
15
|
className?: string;
|
|
16
|
-
value: number;
|
|
17
|
-
subValue?: number;
|
|
16
|
+
value: number | string;
|
|
17
|
+
subValue?: number | string;
|
|
18
18
|
rightCategory?: `${QuoteCategory}`;
|
|
19
19
|
}
|
|
20
20
|
interface TotalPriceProps {
|
|
21
|
-
variant: QuoteVariants.TOTAL_PRICE
|
|
21
|
+
variant: `${QuoteVariants.TOTAL_PRICE}`;
|
|
22
22
|
leftCategory?: `${TableUnitsAndTotalsLeftCategory}`;
|
|
23
23
|
}
|
|
24
24
|
interface TotalWeightProps {
|
|
25
|
-
variant: QuoteVariants.TOTAL_WEIGHT
|
|
25
|
+
variant: `${QuoteVariants.TOTAL_WEIGHT}`;
|
|
26
26
|
leftCategory?: never;
|
|
27
27
|
}
|
|
28
28
|
export type TableUnitsAndTotals = TableUnitsAndTotalsProps & (TotalPriceProps | TotalWeightProps);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** Imports */
|
|
1
2
|
/** Components */
|
|
2
3
|
import Label from "./components/Label/Label";
|
|
3
4
|
import StellaButton from "./components/StellaButton/StellaButton";
|
|
@@ -18,5 +19,7 @@ import { StellaButtonVariant } from "./components/StellaButton/types";
|
|
|
18
19
|
/** Tokens */
|
|
19
20
|
import { Styles } from "./shared/tokens";
|
|
20
21
|
import "./shared/tokens/tokens.css";
|
|
22
|
+
/**Exports */
|
|
23
|
+
export * from "./components/TableUnitsAndTotals/types";
|
|
21
24
|
export type { StellaIconDefinition } from "./components/StellaIcon/types";
|
|
22
25
|
export { Label, StellaButton, IconButton, Loader, HelperText, Tooltip, StellaIcon, TextInput, PasswordInput, NumberInput, Table, Pagination, Sync, TableUnitsAndTotals, StellaButtonVariant, Styles, };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { WhiteLabelCSSOverridesProps } from "./WhiteLabelCSSOverrides";
|
|
2
|
+
export declare const getValueFromColorVar: (color?: string) => string | undefined;
|
|
3
|
+
export declare const getButtonHover: (all: WhiteLabelCSSOverridesProps) => string;
|
|
4
|
+
export declare const getButtonHoverST: (all: WhiteLabelCSSOverridesProps) => string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface WhiteLabelCSSOverridesProps {
|
|
2
|
+
primary?: string;
|
|
3
|
+
secondary?: string;
|
|
4
|
+
tertiary?: string;
|
|
5
|
+
quaternary?: string;
|
|
6
|
+
accent?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const WhiteLabelCSSOverrides: import("react").NamedExoticComponent<import("styled-components").ExecutionProps & WhiteLabelCSSOverridesProps>;
|
|
9
|
+
export default WhiteLabelCSSOverrides;
|
package/dist/esm/index.esm.js
CHANGED
|
@@ -16779,7 +16779,6 @@ const variantSelector = (variant) => {
|
|
|
16779
16779
|
}
|
|
16780
16780
|
|
|
16781
16781
|
&:disabled {
|
|
16782
|
-
background-color: var(--DSL-button-st-background-disabled);
|
|
16783
16782
|
border: 1px solid var(--DSL-button-disabled);
|
|
16784
16783
|
color: var(--DSL-button-disabled);
|
|
16785
16784
|
& svg {
|
|
@@ -16813,7 +16812,6 @@ const variantSelector = (variant) => {
|
|
|
16813
16812
|
}
|
|
16814
16813
|
|
|
16815
16814
|
&:disabled {
|
|
16816
|
-
background-color: var(--DSL-button-st-background-disabled);
|
|
16817
16815
|
color: var(--DSL-button-disabled);
|
|
16818
16816
|
& svg {
|
|
16819
16817
|
fill: var(--DSL-button-disabled);
|
|
@@ -16853,6 +16851,7 @@ const ButtonComponent = styled.button.attrs({
|
|
|
16853
16851
|
}
|
|
16854
16852
|
|
|
16855
16853
|
/* Button CSS Variables */
|
|
16854
|
+
/* p = primary, st = secondary, tertiary */
|
|
16856
16855
|
--DSL-button-branding: ${Styles.color.core.primary};
|
|
16857
16856
|
--DSL-button-hover: ${Styles.color.blue.darkNavy};
|
|
16858
16857
|
--DSL-button-active: ${Styles.color.blue.darkNavy};
|
|
@@ -17017,7 +17016,7 @@ const IconContainer = styled.div `
|
|
|
17017
17016
|
`;
|
|
17018
17017
|
|
|
17019
17018
|
const TextFieldContainer = ({ id, label, children, tooltipText, endIcon, className, rightCategory, leftCategory, helperText, dataTestId, helperTextAffectLayout = true, disabled = false, hideLabel = false, isLoading = false, hasError = false, isRequired = false, }) => {
|
|
17020
|
-
return (a__default.createElement(Wrapper, { "data-
|
|
17019
|
+
return (a__default.createElement(Wrapper, { "data-testid": dataTestId, className: className },
|
|
17021
17020
|
a__default.createElement(Label, { tooltipText: tooltipText, required: isRequired, labelValue: label, hideLabel: hideLabel, id: `${id}-label`, htmlFor: `${id}-text-field` }),
|
|
17022
17021
|
a__default.createElement(TextFieldWrapper, { id: id, "$hasError": hasError, "$isDisabled": disabled, "$isLoading": isLoading, "data-testid": "text-input-wrapper" },
|
|
17023
17022
|
leftCategory && a__default.createElement(Category, null, leftCategory),
|
|
@@ -17107,19 +17106,6 @@ const formatDynamicNumbersWithCommas = (num, decimalPlaces) => {
|
|
|
17107
17106
|
})}${decimalEnding ? "." : ""}${decimalZero ? "0" : ""}`
|
|
17108
17107
|
: "";
|
|
17109
17108
|
};
|
|
17110
|
-
const formatNumberWithDecimals = (num, decimalPlaces = 2, isCurrency = false) => {
|
|
17111
|
-
if (num === null || num === undefined || num === "")
|
|
17112
|
-
return "";
|
|
17113
|
-
const parsed = Number(num);
|
|
17114
|
-
if (isNaN(parsed))
|
|
17115
|
-
return "";
|
|
17116
|
-
return parsed.toLocaleString("en-US", {
|
|
17117
|
-
style: isCurrency ? "currency" : "decimal",
|
|
17118
|
-
currency: isCurrency ? "USD" : undefined,
|
|
17119
|
-
minimumFractionDigits: decimalPlaces,
|
|
17120
|
-
maximumFractionDigits: decimalPlaces,
|
|
17121
|
-
});
|
|
17122
|
-
};
|
|
17123
17109
|
|
|
17124
17110
|
const NumberInput = ({ id, className, htmlProps, leftCategory, rightCategory, label, onChange, onBlur, onFocus, value, isRequired, maxLength, tooltipText, helperText, endIcon, placeholder = "0", textAlign = "left", isTruncated = false, helperTextAffectLayout = true, hideLabel = false, disabled = false, isLoading = false, hasError = false, thousandSeparator = true, decimalPlaces = 0, allowNegativeNumbers = false, ariaDescribedBy, }) => {
|
|
17125
17111
|
const containerProps = {
|
|
@@ -20623,8 +20609,8 @@ const SelectCaret = styled(StellaIcon) `
|
|
|
20623
20609
|
position: absolute;
|
|
20624
20610
|
right: 0;
|
|
20625
20611
|
pointer-events: none;
|
|
20626
|
-
color: ${Styles.color.
|
|
20627
|
-
fill: ${Styles.color.
|
|
20612
|
+
color: ${Styles.color.core.primary};
|
|
20613
|
+
fill: ${Styles.color.core.primary};
|
|
20628
20614
|
transform: rotate(180deg);
|
|
20629
20615
|
`;
|
|
20630
20616
|
const RowInfo = styled.div `
|
|
@@ -20742,11 +20728,11 @@ const HeaderCell = styled.th `
|
|
|
20742
20728
|
: "unset"};
|
|
20743
20729
|
z-index: ${({ $isPinnedLeft, $isPinnedRight }) => $isPinnedLeft || $isPinnedRight ? 2 : 1};
|
|
20744
20730
|
text-align: inherit;
|
|
20745
|
-
padding:
|
|
20731
|
+
padding: 0px 12px;
|
|
20746
20732
|
font-weight: 400;
|
|
20747
20733
|
font-size: 14px;
|
|
20748
20734
|
color: ${Styles.color.grey.charcoal};
|
|
20749
|
-
border-bottom: 1px solid ${Styles.color.grey.
|
|
20735
|
+
border-bottom: 1px solid ${Styles.color.grey.light};
|
|
20750
20736
|
background-color: ${Styles.color.grey.pale};
|
|
20751
20737
|
transition: box-shadow 0.3s ease-out;
|
|
20752
20738
|
& button {
|
|
@@ -20773,6 +20759,7 @@ const HeaderCellPosition = styled.div `
|
|
|
20773
20759
|
`;
|
|
20774
20760
|
const TableWrapper = styled.div `
|
|
20775
20761
|
width: 100%;
|
|
20762
|
+
position: relative;
|
|
20776
20763
|
overflow-x: hidden;
|
|
20777
20764
|
border: 1px solid ${Styles.color.grey.light};
|
|
20778
20765
|
border-radius: 5px;
|
|
@@ -20781,7 +20768,7 @@ const TableWrapper = styled.div `
|
|
|
20781
20768
|
`;
|
|
20782
20769
|
const TableWrapperScroll = styled.div `
|
|
20783
20770
|
width: 100%;
|
|
20784
|
-
overflow-x: ${({ $
|
|
20771
|
+
overflow-x: ${({ $stopScroll }) => ($stopScroll ? "hidden" : "auto")};
|
|
20785
20772
|
`;
|
|
20786
20773
|
const StyledTable = styled.table `
|
|
20787
20774
|
width: 100%;
|
|
@@ -20820,6 +20807,11 @@ const HeaderRow = styled.tr `
|
|
|
20820
20807
|
const CellRow = styled.tr `
|
|
20821
20808
|
min-height: 50px;
|
|
20822
20809
|
height: 50px;
|
|
20810
|
+
&:hover {
|
|
20811
|
+
& > td {
|
|
20812
|
+
background-color: ${Styles.color.blue.pale};
|
|
20813
|
+
}
|
|
20814
|
+
}
|
|
20823
20815
|
`;
|
|
20824
20816
|
const FilterMenu = styled.div `
|
|
20825
20817
|
position: absolute;
|
|
@@ -20860,10 +20852,10 @@ const BodyCell = styled.td `
|
|
|
20860
20852
|
: "unset"};
|
|
20861
20853
|
z-index: ${({ $isPinnedLeft, $isPinnedRight }) => $isPinnedLeft || $isPinnedRight ? 1 : 0};
|
|
20862
20854
|
background: white;
|
|
20863
|
-
padding:
|
|
20855
|
+
padding: 0px 12px;
|
|
20864
20856
|
font-size: 12px;
|
|
20865
20857
|
color: ${Styles.color.grey.charcoal};
|
|
20866
|
-
border-bottom: ${({ $isLastRow }) => $isLastRow ? "none" : `1px solid ${Styles.color.grey.
|
|
20858
|
+
border-bottom: ${({ $isLastRow }) => $isLastRow ? "none" : `1px solid ${Styles.color.grey.light}`};
|
|
20867
20859
|
transition: box-shadow 0.3s ease-out;
|
|
20868
20860
|
`;
|
|
20869
20861
|
const MenuButton = styled.button `
|
|
@@ -21011,12 +21003,57 @@ const LoadingShimmer = styled.div `
|
|
|
21011
21003
|
}
|
|
21012
21004
|
`;
|
|
21013
21005
|
const CustomPagination = styled(Pagination) `
|
|
21014
|
-
border-top: 1px solid ${Styles.color.grey.
|
|
21006
|
+
border-top: 1px solid ${Styles.color.grey.light};
|
|
21015
21007
|
`;
|
|
21016
21008
|
const KebabAlign = styled.div `
|
|
21017
21009
|
display: flex;
|
|
21018
21010
|
justify-content: end;
|
|
21019
21011
|
`;
|
|
21012
|
+
// EmptyTableState
|
|
21013
|
+
const EmptyTableCell = styled.td `
|
|
21014
|
+
padding: 10rem;
|
|
21015
|
+
background-color: white;
|
|
21016
|
+
`;
|
|
21017
|
+
const EmptyTableSection = styled.section `
|
|
21018
|
+
width: ${({ $size }) => ($size === "small" ? "360px" : "450px")};
|
|
21019
|
+
display: flex;
|
|
21020
|
+
flex-direction: column;
|
|
21021
|
+
justify-content: center;
|
|
21022
|
+
align-items: center;
|
|
21023
|
+
position: absolute;
|
|
21024
|
+
gap: 20px;
|
|
21025
|
+
top: 50px;
|
|
21026
|
+
left: 0;
|
|
21027
|
+
right: 0;
|
|
21028
|
+
margin: 80px auto 0;
|
|
21029
|
+
`;
|
|
21030
|
+
const EmptyTableHeader = styled.p `
|
|
21031
|
+
display: flex;
|
|
21032
|
+
justify-content: center;
|
|
21033
|
+
align-items: center;
|
|
21034
|
+
color: ${Styles.color.grey.smoke};
|
|
21035
|
+
font-size: 22px;
|
|
21036
|
+
font-weight: 400;
|
|
21037
|
+
text-align: center;
|
|
21038
|
+
line-height: 22px;
|
|
21039
|
+
margin-bottom: 0px;
|
|
21040
|
+
`;
|
|
21041
|
+
const EmptyTableSubHeader = styled.p `
|
|
21042
|
+
display: flex;
|
|
21043
|
+
justify-content: center;
|
|
21044
|
+
align-items: center;
|
|
21045
|
+
color: ${Styles.color.grey.shadow};
|
|
21046
|
+
font-size: 18px;
|
|
21047
|
+
text-align: center;
|
|
21048
|
+
font-weight: 400;
|
|
21049
|
+
margin-top: 0px;
|
|
21050
|
+
`;
|
|
21051
|
+
const ClearFilterButtonRow = styled.div `
|
|
21052
|
+
display: "flex";
|
|
21053
|
+
justify-content: "center";
|
|
21054
|
+
align-items: "center";
|
|
21055
|
+
text-align: "center";
|
|
21056
|
+
`;
|
|
21020
21057
|
|
|
21021
21058
|
const IndeterminateCheckbox = ({ isIndeterminate, isChecked, onChange, }) => {
|
|
21022
21059
|
const ref = useRef(null);
|
|
@@ -21095,7 +21132,7 @@ const TableHeaderCell = ({ header, serverSide, filters, sorting, scrollPosition,
|
|
|
21095
21132
|
a__default.createElement(HeaderCellPosition, { style: {
|
|
21096
21133
|
justifyContent: textAlign === "left" ? "start" : "end",
|
|
21097
21134
|
} },
|
|
21098
|
-
textAlign === "left" && (a__default.createElement("span",
|
|
21135
|
+
textAlign === "left" && (a__default.createElement("span", { style: { fontWeight: 600 } }, flexRender(columnDef.header, header.getContext()))),
|
|
21099
21136
|
header.column.getCanFilter() && (a__default.createElement("div", { style: {
|
|
21100
21137
|
display: "flex",
|
|
21101
21138
|
alignItems: "center",
|
|
@@ -21157,7 +21194,7 @@ const TableHeaderCell = ({ header, serverSide, filters, sorting, scrollPosition,
|
|
|
21157
21194
|
setCurrentAppliedFilters([]);
|
|
21158
21195
|
} }, "Clear Filter"))), document.body))),
|
|
21159
21196
|
header.column.getCanSort() && (a__default.createElement(SortButton, { className: "icon", iconName: "sort", ariaLabel: "Sort Button", variant: "tertiary", "$active": sorting.some((s) => s.id === header.column.id), "$sort": column.getIsSorted(), onClick: (e) => header.column.getToggleSortingHandler()?.(e) })),
|
|
21160
|
-
textAlign === "right" && (a__default.createElement("span",
|
|
21197
|
+
textAlign === "right" && (a__default.createElement("span", { style: { fontWeight: 600 } }, flexRender(columnDef.header, header.getContext()))))));
|
|
21161
21198
|
};
|
|
21162
21199
|
|
|
21163
21200
|
const RowOptions = ({ row, selectionMenuItems }) => {
|
|
@@ -21202,12 +21239,21 @@ const RowOptions = ({ row, selectionMenuItems }) => {
|
|
|
21202
21239
|
})), document.body)));
|
|
21203
21240
|
};
|
|
21204
21241
|
|
|
21242
|
+
const EmptyTableState = ({ id, className, header, subHeader, showClearFilterButton, colSpan, size = "large", onClearFilters, }) => {
|
|
21243
|
+
return (a__default.createElement("tr", null,
|
|
21244
|
+
a__default.createElement(EmptyTableCell, { colSpan: colSpan },
|
|
21245
|
+
a__default.createElement(EmptyTableSection, { "$size": size, id: id, className: className },
|
|
21246
|
+
a__default.createElement(EmptyTableHeader, null, header),
|
|
21247
|
+
a__default.createElement(EmptyTableSubHeader, null, subHeader),
|
|
21248
|
+
a__default.createElement(ClearFilterButtonRow, null, showClearFilterButton && (a__default.createElement(StellaButton, { label: "Clear Filters", onClick: () => onClearFilters?.(), variant: "secondary" })))))));
|
|
21249
|
+
};
|
|
21250
|
+
|
|
21205
21251
|
// DataTable.tsx
|
|
21206
21252
|
function Table({ columns, data, isLoading, serverSide = false, onPageChange, onSortChange, onFilterChange, onRowSelect, rowStatuses, showSelection = false, showRowOptions = false, showPagination = true, variant, paginationDetails = {
|
|
21207
21253
|
startingPage: 1,
|
|
21208
21254
|
rowsPerPage: 10,
|
|
21209
21255
|
totalRows: data.length,
|
|
21210
|
-
}, selectionMenuItems, dataAuto, dataTestId, id, className, htmlProps, resetTrigger, }) {
|
|
21256
|
+
}, selectionMenuItems, dataAuto, dataTestId, id, className, htmlProps, resetTrigger, emptyTableState, }) {
|
|
21211
21257
|
const [rowSelection, setRowSelection] = useState({});
|
|
21212
21258
|
const [selectedRows] = useState({});
|
|
21213
21259
|
const [pageIndex, setPageIndex] = useState(paginationDetails?.startingPage);
|
|
@@ -21233,7 +21279,11 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
21233
21279
|
}, [rowStatuses]);
|
|
21234
21280
|
useEffect(() => {
|
|
21235
21281
|
setTotalData(paginationDetails?.totalRows);
|
|
21236
|
-
|
|
21282
|
+
setPagination({
|
|
21283
|
+
pageIndex: paginationDetails?.startingPage - 1,
|
|
21284
|
+
pageSize: paginationDetails?.rowsPerPage || 10,
|
|
21285
|
+
});
|
|
21286
|
+
}, [paginationDetails, data]);
|
|
21237
21287
|
useEffect(() => {
|
|
21238
21288
|
const el = scrollRef?.current;
|
|
21239
21289
|
if (!el)
|
|
@@ -21354,7 +21404,7 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
21354
21404
|
});
|
|
21355
21405
|
};
|
|
21356
21406
|
return (a__default.createElement(TableWrapper, { className: className, id: id, "data-testid": dataTestId, "data-auto": dataAuto },
|
|
21357
|
-
a__default.createElement(TableWrapperScroll, { "$
|
|
21407
|
+
a__default.createElement(TableWrapperScroll, { "$stopScroll": Object.values(filterMenuOpen).some((value) => value), ref: scrollRef }, isLoading ? (a__default.createElement("div", null,
|
|
21358
21408
|
a__default.createElement("div", { style: {
|
|
21359
21409
|
width: "100%",
|
|
21360
21410
|
maxWidth: "100%",
|
|
@@ -21389,39 +21439,45 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
21389
21439
|
}));
|
|
21390
21440
|
} }));
|
|
21391
21441
|
}))))),
|
|
21392
|
-
a__default.createElement("tbody", null,
|
|
21393
|
-
|
|
21394
|
-
|
|
21395
|
-
|
|
21396
|
-
|
|
21397
|
-
|
|
21398
|
-
|
|
21399
|
-
|
|
21400
|
-
|
|
21401
|
-
|
|
21402
|
-
|
|
21403
|
-
|
|
21404
|
-
|
|
21405
|
-
|
|
21406
|
-
|
|
21407
|
-
|
|
21408
|
-
|
|
21409
|
-
|
|
21410
|
-
cell.column.getIsPinned() === "right"
|
|
21442
|
+
a__default.createElement("tbody", null,
|
|
21443
|
+
table.getRowModel().rows.length === 0 && (a__default.createElement(EmptyTableState, { header: emptyTableState.header, subHeader: emptyTableState.subHeader, showClearFilterButton: emptyTableState.showClearFilterButton, onClearFilters: resetTable, colSpan: table.getVisibleLeafColumns().length, size: "large" })),
|
|
21444
|
+
table.getRowModel().rows.map((row) => (a__default.createElement(CellRow, { key: row.id }, row.getVisibleCells().map((cell) => {
|
|
21445
|
+
const value = flexRender(cell.column.columnDef.cell, {
|
|
21446
|
+
...cell.getContext(),
|
|
21447
|
+
localValue: rowState[row.id]?.[cell.column.id],
|
|
21448
|
+
onLocalChange: (val) => handleInputChange(row.id, cell.column.id, val),
|
|
21449
|
+
});
|
|
21450
|
+
const meta = cell.column.columnDef.meta;
|
|
21451
|
+
return (a__default.createElement(BodyCell, { key: cell.id, style: {
|
|
21452
|
+
width: cell.column.getSize(),
|
|
21453
|
+
textAlign: meta?.cellAlign ||
|
|
21454
|
+
(typeof cell.getValue() === "number" ||
|
|
21455
|
+
meta?.dataType === "number"
|
|
21456
|
+
? "right"
|
|
21457
|
+
: "left"),
|
|
21458
|
+
boxShadow: scrollState.atLeft &&
|
|
21459
|
+
cell.column.getIsPinned() === "left"
|
|
21411
21460
|
? "none"
|
|
21412
|
-
:
|
|
21413
|
-
|
|
21414
|
-
|
|
21415
|
-
|
|
21416
|
-
|
|
21417
|
-
|
|
21418
|
-
|
|
21419
|
-
|
|
21420
|
-
|
|
21421
|
-
|
|
21422
|
-
|
|
21423
|
-
|
|
21424
|
-
|
|
21461
|
+
: scrollState.atRight &&
|
|
21462
|
+
cell.column.getIsPinned() === "right"
|
|
21463
|
+
? "none"
|
|
21464
|
+
: undefined,
|
|
21465
|
+
backgroundColor: table
|
|
21466
|
+
.getSelectedRowModel()
|
|
21467
|
+
.rows.find((r) => r.id === row.id)
|
|
21468
|
+
? "#EBF0FA"
|
|
21469
|
+
: rowStatusesState?.[row.id] === "action-pending"
|
|
21470
|
+
? "#FFFDEB"
|
|
21471
|
+
: rowStatusesState?.[row.id] === "completed"
|
|
21472
|
+
? "#F5F5F5"
|
|
21473
|
+
: "",
|
|
21474
|
+
}, "$isPinnedLeft": cell.column.getIsPinned() === "left", "$isPinnedRight": cell.column.getIsPinned() === "right", "$columnInfo": cell.column, "$isLastRow": serverSide
|
|
21475
|
+
? row.index === table.getRowModel().rows.length - 1
|
|
21476
|
+
: row.index -
|
|
21477
|
+
pagination.pageSize * pagination.pageIndex ===
|
|
21478
|
+
table.getRowModel().rows.length - 1 }, value));
|
|
21479
|
+
})))))))),
|
|
21480
|
+
showPagination && paginationDetails?.totalRows > 0 && (a__default.createElement(CustomPagination, { totalRows: serverSide ? totalData : table.getFilteredRowModel().rows.length, isLoading: isLoading, rowsPerPage: paginationDetails?.rowsPerPage, startingPage: pageIndex, onPageChange: (page, pageSize) => {
|
|
21425
21481
|
setPageIndex(page);
|
|
21426
21482
|
setPagination((prev) => ({
|
|
21427
21483
|
...prev,
|
|
@@ -21546,13 +21602,9 @@ const SubHeaderText = styled.span `
|
|
|
21546
21602
|
const TableUnitsAndTotals = ({ id, className, value, subValue, variant, leftCategory = TableUnitsAndTotalsLeftCategory.US_CURRENCY, rightCategory, }) => {
|
|
21547
21603
|
const isWeight = variant === QuoteVariants.TOTAL_WEIGHT;
|
|
21548
21604
|
const leftCategoryValue = isWeight ? "" : leftCategory;
|
|
21549
|
-
const header =
|
|
21550
|
-
|
|
21551
|
-
|
|
21552
|
-
const subHeader = subValue !== undefined
|
|
21553
|
-
? (leftCategoryValue ?? "") +
|
|
21554
|
-
formatNumberWithDecimals(subValue, 3, false) +
|
|
21555
|
-
(rightCategory ? ` ${rightCategory}` : "")
|
|
21605
|
+
const header = `${leftCategoryValue ?? ""}${value} ${rightCategory && isWeight ? ` ${rightCategory}` : ""}`;
|
|
21606
|
+
const subHeader = subValue
|
|
21607
|
+
? `${leftCategoryValue ?? ""}${subValue} ${rightCategory ? ` ${rightCategory}` : ""}`
|
|
21556
21608
|
: undefined;
|
|
21557
21609
|
return (a__default.createElement(Container, { id: id, className: className },
|
|
21558
21610
|
a__default.createElement(Column, { "$align": "right" },
|
|
@@ -21560,5 +21612,5 @@ const TableUnitsAndTotals = ({ id, className, value, subValue, variant, leftCate
|
|
|
21560
21612
|
subHeader && a__default.createElement(SubHeaderText, null, subHeader))));
|
|
21561
21613
|
};
|
|
21562
21614
|
|
|
21563
|
-
export { HelperText, IconButton, Label, Loader, NumberInput, Pagination, PasswordInput, StellaButton, StellaButtonVariant, StellaIcon, Styles, Sync, Table, TableUnitsAndTotals, TextInput, Tooltip };
|
|
21615
|
+
export { HelperText, IconButton, Label, Loader, NumberInput, Pagination, PasswordInput, QuoteCategory, QuoteVariants, StellaButton, StellaButtonVariant, StellaIcon, Styles, Sync, Table, TableUnitsAndTotals, TableUnitsAndTotalsLeftCategory, TextInput, Tooltip };
|
|
21564
21616
|
//# sourceMappingURL=index.esm.js.map
|