@xyo-network/react-table 3.0.2 → 3.0.3
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/browser/components/TableEx/TableCellEx.d.ts +6 -0
- package/dist/browser/components/TableEx/TableCellEx.d.ts.map +1 -0
- package/dist/browser/components/TableEx/TableEx.d.ts +10 -0
- package/dist/browser/components/TableEx/TableEx.d.ts.map +1 -0
- package/dist/browser/components/TableEx/TableFooterEx.d.ts +9 -0
- package/dist/browser/components/TableEx/TableFooterEx.d.ts.map +1 -0
- package/dist/browser/components/TableEx/index.d.ts +5 -0
- package/dist/browser/components/TableEx/index.d.ts.map +1 -0
- package/dist/browser/components/TableEx/types/TableExVariants.d.ts +2 -0
- package/dist/browser/components/TableEx/types/TableExVariants.d.ts.map +1 -0
- package/dist/browser/components/TableEx/types/index.d.ts +2 -0
- package/dist/browser/components/TableEx/types/index.d.ts.map +1 -0
- package/dist/browser/components/index.d.ts +2 -0
- package/dist/browser/components/index.d.ts.map +1 -0
- package/dist/browser/context/TableHeight/Context.d.ts +3 -0
- package/dist/browser/context/TableHeight/Context.d.ts.map +1 -0
- package/dist/browser/context/TableHeight/Provider.d.ts +10 -0
- package/dist/browser/context/TableHeight/Provider.d.ts.map +1 -0
- package/dist/browser/context/TableHeight/State.d.ts +10 -0
- package/dist/browser/context/TableHeight/State.d.ts.map +1 -0
- package/dist/browser/context/TableHeight/index.d.ts +5 -0
- package/dist/browser/context/TableHeight/index.d.ts.map +1 -0
- package/dist/browser/context/TableHeight/use.d.ts +2 -0
- package/dist/browser/context/TableHeight/use.d.ts.map +1 -0
- package/dist/browser/context/index.d.ts +2 -0
- package/dist/browser/context/index.d.ts.map +1 -0
- package/dist/browser/index.d.ts +4 -58
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.mjs.map +1 -1
- package/dist/browser/types/TableHead.d.ts +11 -0
- package/dist/browser/types/TableHead.d.ts.map +1 -0
- package/dist/browser/types/index.d.ts +2 -0
- package/dist/browser/types/index.d.ts.map +1 -0
- package/package.json +48 -42
- package/src/components/TableEx/TableCellEx.tsx +1 -3
- package/src/components/TableEx/TableEx.stories.tsx +15 -12
- package/src/components/TableEx/TableEx.tsx +3 -1
- package/src/context/TableHeight/Provider.tsx +6 -2
- package/xy.config.ts +1 -3
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TableCellProps } from '@mui/material';
|
|
2
|
+
export interface TableCellExProps extends TableCellProps {
|
|
3
|
+
noBgColor?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare const TableCellEx: import("@emotion/styled").StyledComponent<TableCellProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & TableCellExProps, {}, {}>;
|
|
6
|
+
//# sourceMappingURL=TableCellEx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableCellEx.d.ts","sourceRoot":"","sources":["../../../../src/components/TableEx/TableCellEx.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAGnD,MAAM,WAAW,gBAAiB,SAAQ,cAAc;IACtD,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,eAAO,MAAM,WAAW,kKAEvB,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TableProps } from '@mui/material';
|
|
2
|
+
import type { PropsWithChildren } from 'react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import type { TableExVariants } from './types/index.ts';
|
|
5
|
+
export interface TableExProps extends PropsWithChildren, TableProps {
|
|
6
|
+
variant?: TableExVariants;
|
|
7
|
+
}
|
|
8
|
+
export declare const TableExWithRef: React.ForwardRefExoticComponent<Omit<TableExProps, "ref"> & React.RefAttributes<HTMLTableElement>>;
|
|
9
|
+
export declare const TableEx: React.ForwardRefExoticComponent<Omit<TableExProps, "ref"> & React.RefAttributes<HTMLTableElement>>;
|
|
10
|
+
//# sourceMappingURL=TableEx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableEx.d.ts","sourceRoot":"","sources":["../../../../src/components/TableEx/TableEx.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAEvD,MAAM,WAAW,YAAa,SAAQ,iBAAiB,EAAE,UAAU;IACjE,OAAO,CAAC,EAAE,eAAe,CAAA;CAC1B;AAYD,eAAO,MAAM,cAAc,oGAQzB,CAAA;AAIF,eAAO,MAAM,OAAO,oGAAiB,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TableFooterProps } from '@mui/material';
|
|
2
|
+
import type { PropsWithChildren } from 'react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import type { TableExVariants } from './types/index.ts';
|
|
5
|
+
export interface TableFooterExProps extends PropsWithChildren, TableFooterProps {
|
|
6
|
+
variant?: TableExVariants;
|
|
7
|
+
}
|
|
8
|
+
export declare const TableFooterEx: React.FC<TableFooterExProps>;
|
|
9
|
+
//# sourceMappingURL=TableFooterEx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableFooterEx.d.ts","sourceRoot":"","sources":["../../../../src/components/TableEx/TableFooterEx.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAErD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAgBvD,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB,EAAE,gBAAgB;IAC7E,OAAO,CAAC,EAAE,eAAe,CAAA;CAC1B;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAA4F,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/TableEx/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableExVariants.d.ts","sourceRoot":"","sources":["../../../../../src/components/TableEx/types/TableExVariants.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,YAAY,GAAG,QAAQ,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/TableEx/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../../src/context/TableHeight/Context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,eAAO,MAAM,kBAAkB,gGAAsC,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { WithChildren } from '@xylabs/react-shared';
|
|
2
|
+
import type { ContextExProviderProps } from '@xyo-network/react-shared';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export interface TableHeightProviderProps extends ContextExProviderProps, WithChildren {
|
|
5
|
+
additionalRows?: number;
|
|
6
|
+
defaultVisibleRows?: number;
|
|
7
|
+
heightFormat?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const TableHeightProvider: React.FC<TableHeightProviderProps>;
|
|
10
|
+
//# sourceMappingURL=Provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/context/TableHeight/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAA;AACvE,OAAO,KAEN,MAAM,OAAO,CAAA;AAId,MAAM,WAAW,wBAAyB,SAAQ,sBAAsB,EAAE,YAAY;IAEpF,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CA+BlE,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ContextExState } from '@xyo-network/react-shared';
|
|
2
|
+
import type { Dispatch, SetStateAction } from 'react';
|
|
3
|
+
export interface TableHeightState extends ContextExState {
|
|
4
|
+
height?: string;
|
|
5
|
+
rowHeight?: number;
|
|
6
|
+
setRowHeight?: Dispatch<SetStateAction<number | undefined>>;
|
|
7
|
+
setVisibleRows?: Dispatch<SetStateAction<number | undefined>>;
|
|
8
|
+
visibleRows?: number;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=State.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"State.d.ts","sourceRoot":"","sources":["../../../../src/context/TableHeight/State.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAErD,MAAM,WAAW,gBAAiB,SAAQ,cAAc;IACtD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,CAAA;IAC3D,cAAc,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,CAAA;IAC7D,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/context/TableHeight/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../../../src/context/TableHeight/use.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc,sIAAkF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/context/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -1,58 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import * as React from 'react';
|
|
6
|
-
import React__default, { PropsWithChildren, Dispatch, SetStateAction, CSSProperties } from 'react';
|
|
7
|
-
import * as _xyo_network_react_shared from '@xyo-network/react-shared';
|
|
8
|
-
import { ContextExState, ContextExProviderProps } from '@xyo-network/react-shared';
|
|
9
|
-
import { WithChildren } from '@xylabs/react-shared';
|
|
10
|
-
|
|
11
|
-
interface TableCellExProps extends TableCellProps {
|
|
12
|
-
noBgColor?: boolean;
|
|
13
|
-
}
|
|
14
|
-
declare const TableCellEx: _emotion_styled.StyledComponent<TableCellProps & _mui_system.MUIStyledCommonProps<_mui_material.Theme> & TableCellExProps, {}, {}>;
|
|
15
|
-
|
|
16
|
-
type TableExVariants = 'scrollable' | 'normal';
|
|
17
|
-
|
|
18
|
-
interface TableExProps extends PropsWithChildren, TableProps {
|
|
19
|
-
variant?: TableExVariants;
|
|
20
|
-
}
|
|
21
|
-
declare const TableExWithRef: React__default.ForwardRefExoticComponent<Omit<TableExProps, "ref"> & React__default.RefAttributes<HTMLTableElement>>;
|
|
22
|
-
declare const TableEx: React__default.ForwardRefExoticComponent<Omit<TableExProps, "ref"> & React__default.RefAttributes<HTMLTableElement>>;
|
|
23
|
-
|
|
24
|
-
interface TableFooterExProps extends PropsWithChildren, TableFooterProps {
|
|
25
|
-
variant?: TableExVariants;
|
|
26
|
-
}
|
|
27
|
-
declare const TableFooterEx: React__default.FC<TableFooterExProps>;
|
|
28
|
-
|
|
29
|
-
interface TableHeightState extends ContextExState {
|
|
30
|
-
height?: string;
|
|
31
|
-
rowHeight?: number;
|
|
32
|
-
setRowHeight?: Dispatch<SetStateAction<number | undefined>>;
|
|
33
|
-
setVisibleRows?: Dispatch<SetStateAction<number | undefined>>;
|
|
34
|
-
visibleRows?: number;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
declare const TableHeightContext: React.Context<TableHeightState & _xyo_network_react_shared.ContextExState>;
|
|
38
|
-
|
|
39
|
-
interface TableHeightProviderProps extends ContextExProviderProps, WithChildren {
|
|
40
|
-
additionalRows?: number;
|
|
41
|
-
defaultVisibleRows?: number;
|
|
42
|
-
heightFormat?: string;
|
|
43
|
-
}
|
|
44
|
-
declare const TableHeightProvider: React__default.FC<TableHeightProviderProps>;
|
|
45
|
-
|
|
46
|
-
declare const useTableHeight: (required?: boolean) => Omit<TableHeightState & _xyo_network_react_shared.ContextExState, "provided">;
|
|
47
|
-
|
|
48
|
-
interface TableHeadCell {
|
|
49
|
-
align?: 'left' | 'right' | 'center';
|
|
50
|
-
disablePadding: boolean;
|
|
51
|
-
id: string;
|
|
52
|
-
label: string;
|
|
53
|
-
numeric: boolean;
|
|
54
|
-
showOnMobile: boolean;
|
|
55
|
-
width?: CSSProperties['width'];
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export { TableCellEx, type TableCellExProps, TableEx, type TableExProps, type TableExVariants, TableExWithRef, TableFooterEx, type TableFooterExProps, type TableHeadCell, TableHeightContext, TableHeightProvider, type TableHeightProviderProps, type TableHeightState, useTableHeight };
|
|
1
|
+
export * from './components/index.ts';
|
|
2
|
+
export * from './context/index.ts';
|
|
3
|
+
export * from './types/index.ts';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/TableEx/TableCellEx.tsx","../../src/components/TableEx/TableEx.tsx","../../src/components/TableEx/TableFooterEx.tsx","../../src/context/TableHeight/Context.ts","../../src/context/TableHeight/Provider.tsx","../../src/context/TableHeight/use.ts"],"sourcesContent":["import type { TableCellProps } from '@mui/material'\nimport { styled, TableCell } from '@mui/material'\n\nexport interface TableCellExProps extends TableCellProps {\n noBgColor?: boolean\n}\n\nexport const TableCellEx = styled(TableCell, { name: 'TableCellNoBgColor', shouldForwardProp: prop => prop !== 'noBgColor' })<TableCellExProps>(\n ({ noBgColor = true }) => ({
|
|
1
|
+
{"version":3,"sources":["../../src/components/TableEx/TableCellEx.tsx","../../src/components/TableEx/TableEx.tsx","../../src/components/TableEx/TableFooterEx.tsx","../../src/context/TableHeight/Context.ts","../../src/context/TableHeight/Provider.tsx","../../src/context/TableHeight/use.ts"],"sourcesContent":["import type { TableCellProps } from '@mui/material'\nimport { styled, TableCell } from '@mui/material'\n\nexport interface TableCellExProps extends TableCellProps {\n noBgColor?: boolean\n}\n\nexport const TableCellEx = styled(TableCell, { name: 'TableCellNoBgColor', shouldForwardProp: prop => prop !== 'noBgColor' })<TableCellExProps>(\n ({ noBgColor = true }) => ({ ...(noBgColor && { backgroundColor: 'transparent' }) }),\n)\n","import type { TableProps } from '@mui/material'\nimport { Table } from '@mui/material'\nimport type { PropsWithChildren } from 'react'\nimport React, { forwardRef } from 'react'\n\nimport type { TableExVariants } from './types/index.ts'\n\nexport interface TableExProps extends PropsWithChildren, TableProps {\n variant?: TableExVariants\n}\n\nconst TableExInner = forwardRef<HTMLTableElement, TableExProps>(({ children, ...props }, ref) => {\n return (\n <Table ref={ref} {...props}>\n {children}\n </Table>\n )\n})\n\nTableExInner.displayName = 'TableExInner'\n\nexport const TableExWithRef = forwardRef<HTMLTableElement, TableExProps>(({\n variant, children, ...props\n}, ref) => {\n return (\n <TableExInner stickyHeader={variant === 'scrollable'} ref={ref} {...props}>\n {children}\n </TableExInner>\n )\n})\n\nTableExWithRef.displayName = 'TableEx'\n\nexport const TableEx = TableExWithRef\n","import type { TableFooterProps } from '@mui/material'\nimport { styled, TableFooter } from '@mui/material'\nimport type { PropsWithChildren } from 'react'\nimport React from 'react'\n\nimport type { TableExVariants } from './types/index.ts'\n\nconst TableFooterExRoot = styled(TableFooter, {\n name: 'TableFooterEx',\n shouldForwardProp: propName => propName !== 'scrollable',\n slot: 'Root',\n})<TableFooterExProps>(({ variant, theme }) => ({\n backgroundColor: theme.palette.background.default,\n bottom: 'unset',\n position: 'relative',\n ...(variant === 'scrollable' && {\n bottom: 0,\n position: 'sticky',\n }),\n}))\n\nexport interface TableFooterExProps extends PropsWithChildren, TableFooterProps {\n variant?: TableExVariants\n}\n\nexport const TableFooterEx: React.FC<TableFooterExProps> = ({ children, ...props }) => <TableFooterExRoot {...props}>{children}</TableFooterExRoot>\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport type { TableHeightState } from './State.ts'\n\nexport const TableHeightContext = createContextEx<TableHeightState>()\n","import type { WithChildren } from '@xylabs/react-shared'\nimport type { ContextExProviderProps } from '@xyo-network/react-shared'\nimport React, {\n useEffect, useMemo, useState,\n} from 'react'\n\nimport { TableHeightContext } from './Context.ts'\n\nexport interface TableHeightProviderProps extends ContextExProviderProps, WithChildren {\n /** @field Account for optional header and footer rows */\n additionalRows?: number\n defaultVisibleRows?: number\n heightFormat?: string\n}\n\nexport const TableHeightProvider: React.FC<TableHeightProviderProps> = ({\n children,\n additionalRows = 0,\n defaultVisibleRows,\n heightFormat = 'px',\n}) => {\n const [visibleRows, setVisibleRows] = useState(defaultVisibleRows)\n const [height, setHeight] = useState<number | undefined>()\n const [rowHeight, setRowHeight] = useState<number | undefined>()\n\n const formattedHeight = useMemo(() => (height === undefined ? undefined : `${height}${heightFormat}`), [height, heightFormat])\n\n useEffect(() => {\n setVisibleRows(defaultVisibleRows)\n }, [defaultVisibleRows])\n\n useEffect(() => {\n if (rowHeight !== undefined && visibleRows !== undefined) {\n setHeight(rowHeight * (visibleRows + additionalRows))\n }\n }, [defaultVisibleRows, rowHeight, visibleRows, additionalRows])\n\n const value = useMemo(() => ({\n height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows,\n }), [formattedHeight, rowHeight, setRowHeight, setVisibleRows, visibleRows])\n\n return (\n <TableHeightContext.Provider value={value}>\n {children}\n </TableHeightContext.Provider>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { TableHeightContext } from './Context.ts'\n\nexport const useTableHeight = (required = false) => useContextEx(TableHeightContext, 'TableHeight', required)\n"],"mappings":";;;;AACA,SAASA,QAAQC,iBAAiB;AAM3B,IAAMC,cAAcC,OAAOC,WAAW;EAAEC,MAAM;EAAsBC,mBAAmBC,wBAAAA,SAAQA,SAAS,aAAjBA;AAA6B,CAAA,EACzH,CAAC,EAAEC,YAAY,KAAI,OAAQ;EAAE,GAAIA,aAAa;IAAEC,iBAAiB;EAAc;AAAG,EAAA;;;ACPpF,SAASC,aAAa;AAEtB,OAAOC,SAASC,kBAAkB;AAQlC,IAAMC,eAAeD,2BAA2C,CAAC,EAAEE,UAAU,GAAGC,MAAAA,GAASC,QAAAA;AACvF,SACE,sBAAA,cAACN,OAAAA;IAAMM;IAAW,GAAGD;KAClBD,QAAAA;AAGP,CAAA;AAEAD,aAAaI,cAAc;AAEpB,IAAMC,iBAAiBN,2BAA2C,CAAC,EACxEO,SAASL,UAAU,GAAGC,MAAAA,GACrBC,QAAAA;AACD,SACE,sBAAA,cAACH,cAAAA;IAAaO,cAAcD,YAAY;IAAcH;IAAW,GAAGD;KACjED,QAAAA;AAGP,CAAA;AAEAI,eAAeD,cAAc;AAEtB,IAAMI,UAAUH;;;AChCvB,SAASI,UAAAA,SAAQC,mBAAmB;AAEpC,OAAOC,YAAW;AAIlB,IAAMC,oBAAoBC,QAAOC,aAAa;EAC5CC,MAAM;EACNC,mBAAmBC,wBAAAA,aAAYA,aAAa,cAAzBA;EACnBC,MAAM;AACR,CAAA,EAAuB,CAAC,EAAEC,SAASC,MAAK,OAAQ;EAC9CC,iBAAiBD,MAAME,QAAQC,WAAWC;EAC1CC,QAAQ;EACRC,UAAU;EACV,GAAIP,YAAY,gBAAgB;IAC9BM,QAAQ;IACRC,UAAU;EACZ;AACF,EAAA;AAMO,IAAMC,gBAA8C,wBAAC,EAAEC,UAAU,GAAGC,MAAAA,MAAY,gBAAAC,OAAA,cAAClB,mBAAsBiB,OAAQD,QAAAA,GAA3D;;;ACzB3D,SAASG,uBAAuB;AAIzB,IAAMC,qBAAqBD,gBAAAA;;;ACFlC,OAAOE,UACLC,WAAWC,SAASC,gBACf;AAWA,IAAMC,sBAA0D,wBAAC,EACtEC,UACAC,iBAAiB,GACjBC,oBACAC,eAAe,KAAI,MACpB;AACC,QAAM,CAACC,aAAaC,cAAAA,IAAkBC,SAASJ,kBAAAA;AAC/C,QAAM,CAACK,QAAQC,SAAAA,IAAaF,SAAAA;AAC5B,QAAM,CAACG,WAAWC,YAAAA,IAAgBJ,SAAAA;AAElC,QAAMK,kBAAkBC,QAAQ,MAAOL,WAAWM,SAAYA,SAAY,GAAGN,MAAAA,GAASJ,YAAAA,IAAiB;IAACI;IAAQJ;GAAa;AAE7HW,YAAU,MAAA;AACRT,mBAAeH,kBAAAA;EACjB,GAAG;IAACA;GAAmB;AAEvBY,YAAU,MAAA;AACR,QAAIL,cAAcI,UAAaT,gBAAgBS,QAAW;AACxDL,gBAAUC,aAAaL,cAAcH,eAAa;IACpD;EACF,GAAG;IAACC;IAAoBO;IAAWL;IAAaH;GAAe;AAE/D,QAAMc,QAAQH,QAAQ,OAAO;IAC3BL,QAAQI;IAAiBK,UAAU;IAAMP;IAAWC;IAAcL;IAAgBD;EACpF,IAAI;IAACO;IAAiBF;IAAWC;IAAcL;IAAgBD;GAAY;AAE3E,SACE,gBAAAa,OAAA,cAACC,mBAAmBC,UAAQ;IAACJ;KAC1Bf,QAAAA;AAGP,GA/BuE;;;ACfvE,SAASoB,oBAAoB;AAItB,IAAMC,iBAAiB,wBAACC,WAAW,UAAUC,aAAaC,oBAAoB,eAAeF,QAAAA,GAAtE;","names":["styled","TableCell","TableCellEx","styled","TableCell","name","shouldForwardProp","prop","noBgColor","backgroundColor","Table","React","forwardRef","TableExInner","children","props","ref","displayName","TableExWithRef","variant","stickyHeader","TableEx","styled","TableFooter","React","TableFooterExRoot","styled","TableFooter","name","shouldForwardProp","propName","slot","variant","theme","backgroundColor","palette","background","default","bottom","position","TableFooterEx","children","props","React","createContextEx","TableHeightContext","React","useEffect","useMemo","useState","TableHeightProvider","children","additionalRows","defaultVisibleRows","heightFormat","visibleRows","setVisibleRows","useState","height","setHeight","rowHeight","setRowHeight","formattedHeight","useMemo","undefined","useEffect","value","provided","React","TableHeightContext","Provider","useContextEx","useTableHeight","required","useContextEx","TableHeightContext"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
export interface TableHeadCell {
|
|
3
|
+
align?: 'left' | 'right' | 'center';
|
|
4
|
+
disablePadding: boolean;
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
numeric: boolean;
|
|
8
|
+
showOnMobile: boolean;
|
|
9
|
+
width?: CSSProperties['width'];
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=TableHead.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableHead.d.ts","sourceRoot":"","sources":["../../../src/types/TableHead.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAE1C,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAA;IACnC,cAAc,EAAE,OAAO,CAAA;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE,OAAO,CAAA;IACrB,KAAK,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAA;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,23 +1,62 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/react-table",
|
|
3
|
+
"version": "3.0.3",
|
|
4
|
+
"description": "Common React library for all XYO projects that use React",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"xyo",
|
|
7
|
+
"utility",
|
|
8
|
+
"typescript",
|
|
9
|
+
"react"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://xyo.network",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues",
|
|
14
|
+
"email": "support@xyo.network"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-react-js.git"
|
|
19
|
+
},
|
|
20
|
+
"license": "LGPL-3.0-only",
|
|
3
21
|
"author": {
|
|
4
|
-
"email": "support@xyo.network",
|
|
5
22
|
"name": "XYO Development Team",
|
|
23
|
+
"email": "support@xyo.network",
|
|
6
24
|
"url": "https://xyo.network"
|
|
7
25
|
},
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
26
|
+
"sideEffects": false,
|
|
27
|
+
"type": "module",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"import": {
|
|
31
|
+
"types": "./dist/browser/index.d.ts",
|
|
32
|
+
"default": "./dist/browser/index.mjs"
|
|
33
|
+
},
|
|
34
|
+
"types": "./dist/browser/index.d.ts",
|
|
35
|
+
"default": "./dist/browser/index.mjs"
|
|
36
|
+
},
|
|
37
|
+
"./package.json": "./package.json"
|
|
38
|
+
},
|
|
39
|
+
"module": "dist/browser/index.mjs",
|
|
40
|
+
"types": "dist/browser/index.d.ts",
|
|
41
|
+
"scripts": {
|
|
42
|
+
"license": "yarn license-checker --exclude \"MIT, ISC, Apache-2.0, BSD, BSD-2-Clause, CC-BY-4.0, Unlicense, CC-BY-3.0, CC0-1.0\"",
|
|
43
|
+
"lint-pkg": "npmPkgJsonLint ."
|
|
11
44
|
},
|
|
12
45
|
"dependencies": {
|
|
13
46
|
"@xylabs/react-shared": "^4.0.3",
|
|
14
|
-
"@xyo-network/react-shared": "^3.0.
|
|
47
|
+
"@xyo-network/react-shared": "^3.0.3"
|
|
15
48
|
},
|
|
16
49
|
"devDependencies": {
|
|
50
|
+
"@mui/icons-material": "^5.16.7",
|
|
51
|
+
"@mui/material": "^5.16.7",
|
|
52
|
+
"@mui/styles": "^5.16.7",
|
|
17
53
|
"@storybook/react": "^8.2.9",
|
|
18
|
-
"@xylabs/ts-scripts-yarn3": "^4.0.
|
|
19
|
-
"@xylabs/tsconfig-react": "^4.0.
|
|
20
|
-
"@xyo-network/react-storybook": "^3.0.
|
|
54
|
+
"@xylabs/ts-scripts-yarn3": "^4.0.7",
|
|
55
|
+
"@xylabs/tsconfig-react": "^4.0.7",
|
|
56
|
+
"@xyo-network/react-storybook": "^3.0.3",
|
|
57
|
+
"react": "^18.3.1",
|
|
58
|
+
"react-dom": "^18.3.1",
|
|
59
|
+
"storybook": "^8.2.9",
|
|
21
60
|
"typescript": "^5.5.4"
|
|
22
61
|
},
|
|
23
62
|
"peerDependencies": {
|
|
@@ -27,41 +66,8 @@
|
|
|
27
66
|
"react": "^18",
|
|
28
67
|
"react-dom": "^18"
|
|
29
68
|
},
|
|
30
|
-
"description": "Common React library for all XYO projects that use React",
|
|
31
|
-
"docs": "dist/docs.json",
|
|
32
|
-
"exports": {
|
|
33
|
-
".": {
|
|
34
|
-
"import": {
|
|
35
|
-
"types": "./dist/browser/index.d.ts",
|
|
36
|
-
"default": "./dist/browser/index.mjs"
|
|
37
|
-
},
|
|
38
|
-
"types": "./dist/browser/index.d.ts",
|
|
39
|
-
"default": "./dist/browser/index.mjs"
|
|
40
|
-
},
|
|
41
|
-
"./package.json": "./package.json"
|
|
42
|
-
},
|
|
43
|
-
"module": "dist/browser/index.mjs",
|
|
44
|
-
"homepage": "https://xyo.network",
|
|
45
|
-
"keywords": [
|
|
46
|
-
"xyo",
|
|
47
|
-
"utility",
|
|
48
|
-
"typescript",
|
|
49
|
-
"react"
|
|
50
|
-
],
|
|
51
|
-
"license": "LGPL-3.0-only",
|
|
52
69
|
"publishConfig": {
|
|
53
70
|
"access": "public"
|
|
54
71
|
},
|
|
55
|
-
"
|
|
56
|
-
"type": "git",
|
|
57
|
-
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-react-js.git"
|
|
58
|
-
},
|
|
59
|
-
"scripts": {
|
|
60
|
-
"lint-pkg": "npmPkgJsonLint .",
|
|
61
|
-
"license": "yarn license-checker --exclude \"MIT, ISC, Apache-2.0, BSD, BSD-2-Clause, CC-BY-4.0, Unlicense, CC-BY-3.0, CC0-1.0\""
|
|
62
|
-
},
|
|
63
|
-
"sideEffects": false,
|
|
64
|
-
"types": "dist/browser/index.d.ts",
|
|
65
|
-
"version": "3.0.2",
|
|
66
|
-
"type": "module"
|
|
72
|
+
"docs": "dist/docs.json"
|
|
67
73
|
}
|
|
@@ -6,7 +6,5 @@ export interface TableCellExProps extends TableCellProps {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export const TableCellEx = styled(TableCell, { name: 'TableCellNoBgColor', shouldForwardProp: prop => prop !== 'noBgColor' })<TableCellExProps>(
|
|
9
|
-
({ noBgColor = true }) => ({
|
|
10
|
-
...(noBgColor && { backgroundColor: 'transparent' }),
|
|
11
|
-
}),
|
|
9
|
+
({ noBgColor = true }) => ({ ...(noBgColor && { backgroundColor: 'transparent' }) }),
|
|
12
10
|
)
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
TableBody, TableCell, TableHead, TablePagination, TableRow, useTheme,
|
|
3
|
+
} from '@mui/material'
|
|
4
|
+
import type {
|
|
5
|
+
Decorator, Meta, StoryFn,
|
|
6
|
+
} from '@storybook/react'
|
|
3
7
|
import { WithRefDecorator } from '@xyo-network/react-storybook'
|
|
4
8
|
import React from 'react'
|
|
5
9
|
|
|
@@ -8,7 +12,10 @@ import { TableEx } from './TableEx.tsx'
|
|
|
8
12
|
import { TableFooterEx } from './TableFooterEx.tsx'
|
|
9
13
|
|
|
10
14
|
const ScrollableDecorator: Decorator = (Story, args) => (
|
|
11
|
-
<div style={{
|
|
15
|
+
<div style={{
|
|
16
|
+
height: 'calc(100vh - 2rem)', inset: 0, position: 'absolute',
|
|
17
|
+
}}
|
|
18
|
+
>
|
|
12
19
|
<Story {...args} />
|
|
13
20
|
</div>
|
|
14
21
|
)
|
|
@@ -16,11 +23,7 @@ const ScrollableDecorator: Decorator = (Story, args) => (
|
|
|
16
23
|
const StorybookEntry = {
|
|
17
24
|
argTypes: {},
|
|
18
25
|
component: TableEx,
|
|
19
|
-
parameters: {
|
|
20
|
-
docs: {
|
|
21
|
-
page: null,
|
|
22
|
-
},
|
|
23
|
-
},
|
|
26
|
+
parameters: { docs: { page: null } },
|
|
24
27
|
title: 'shared/TableEx',
|
|
25
28
|
} as Meta<typeof TableEx>
|
|
26
29
|
|
|
@@ -57,9 +60,7 @@ const Template: StoryFn<typeof TableEx> = (args) => {
|
|
|
57
60
|
rowsPerPage={5}
|
|
58
61
|
style={{ borderTop: '1px solid', borderTopColor: theme.palette.divider }}
|
|
59
62
|
SelectProps={{
|
|
60
|
-
inputProps: {
|
|
61
|
-
'aria-label': 'rows per page',
|
|
62
|
-
},
|
|
63
|
+
inputProps: { 'aria-label': 'rows per page' },
|
|
63
64
|
native: true,
|
|
64
65
|
}}
|
|
65
66
|
onPageChange={() => {
|
|
@@ -85,6 +86,8 @@ const WithScrollable = Template.bind({})
|
|
|
85
86
|
WithScrollable.args = { variant: 'scrollable' }
|
|
86
87
|
WithScrollable.decorators = [ScrollableDecorator]
|
|
87
88
|
|
|
88
|
-
export {
|
|
89
|
+
export {
|
|
90
|
+
Default, WithRef, WithScrollable,
|
|
91
|
+
}
|
|
89
92
|
|
|
90
93
|
export default StorybookEntry
|
|
@@ -19,7 +19,9 @@ const TableExInner = forwardRef<HTMLTableElement, TableExProps>(({ children, ...
|
|
|
19
19
|
|
|
20
20
|
TableExInner.displayName = 'TableExInner'
|
|
21
21
|
|
|
22
|
-
export const TableExWithRef = forwardRef<HTMLTableElement, TableExProps>(({
|
|
22
|
+
export const TableExWithRef = forwardRef<HTMLTableElement, TableExProps>(({
|
|
23
|
+
variant, children, ...props
|
|
24
|
+
}, ref) => {
|
|
23
25
|
return (
|
|
24
26
|
<TableExInner stickyHeader={variant === 'scrollable'} ref={ref} {...props}>
|
|
25
27
|
{children}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { WithChildren } from '@xylabs/react-shared'
|
|
2
2
|
import type { ContextExProviderProps } from '@xyo-network/react-shared'
|
|
3
|
-
import React, {
|
|
3
|
+
import React, {
|
|
4
|
+
useEffect, useMemo, useState,
|
|
5
|
+
} from 'react'
|
|
4
6
|
|
|
5
7
|
import { TableHeightContext } from './Context.ts'
|
|
6
8
|
|
|
@@ -33,7 +35,9 @@ export const TableHeightProvider: React.FC<TableHeightProviderProps> = ({
|
|
|
33
35
|
}
|
|
34
36
|
}, [defaultVisibleRows, rowHeight, visibleRows, additionalRows])
|
|
35
37
|
|
|
36
|
-
const value = useMemo(() => ({
|
|
38
|
+
const value = useMemo(() => ({
|
|
39
|
+
height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows,
|
|
40
|
+
}), [formattedHeight, rowHeight, setRowHeight, setVisibleRows, visibleRows])
|
|
37
41
|
|
|
38
42
|
return (
|
|
39
43
|
<TableHeightContext.Provider value={value}>
|