@xyo-network/react-table 5.0.0 → 5.0.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/browser/index.mjs
CHANGED
|
@@ -15,17 +15,13 @@ var TableCellEx = styled(TableCell, {
|
|
|
15
15
|
// src/components/TableEx/TableEx.tsx
|
|
16
16
|
import { Table } from "@mui/material";
|
|
17
17
|
import React from "react";
|
|
18
|
-
var TableExInner = /* @__PURE__ */ __name(({
|
|
19
|
-
return /* @__PURE__ */ React.createElement(Table,
|
|
20
|
-
ref,
|
|
21
|
-
...props
|
|
22
|
-
}, children);
|
|
18
|
+
var TableExInner = /* @__PURE__ */ __name(({ children, ...props }) => {
|
|
19
|
+
return /* @__PURE__ */ React.createElement(Table, props, children);
|
|
23
20
|
}, "TableExInner");
|
|
24
21
|
TableExInner.displayName = "TableExInner";
|
|
25
|
-
var TableExWithRef = /* @__PURE__ */ __name(({
|
|
22
|
+
var TableExWithRef = /* @__PURE__ */ __name(({ variant, children, ...props }) => {
|
|
26
23
|
return /* @__PURE__ */ React.createElement(TableExInner, {
|
|
27
24
|
stickyHeader: variant === "scrollable",
|
|
28
|
-
ref,
|
|
29
25
|
...props
|
|
30
26
|
}, children);
|
|
31
27
|
}, "TableExWithRef");
|
|
@@ -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 }) => ({ ...(noBgColor && { backgroundColor: 'transparent' }) }),\n)\n","import type { TableProps } from '@mui/material'\nimport { Table } from '@mui/material'\nimport type { PropsWithChildren } from 'react'\nimport React from 'react'\n\nimport type { TableExVariants } from './types/index.ts'\n\nexport interface TableExProps extends PropsWithChildren, TableProps {\n variant?: TableExVariants\n}\n\nconst TableExInner = ({
|
|
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 from 'react'\n\nimport type { TableExVariants } from './types/index.ts'\n\nexport interface TableExProps extends PropsWithChildren, TableProps {\n variant?: TableExVariants\n}\n\nconst TableExInner: React.FC<TableExProps> = ({ children, ...props }) => {\n return (\n <Table {...props}>\n {children}\n </Table>\n )\n}\n\nTableExInner.displayName = 'TableExInner'\n\nexport const TableExWithRef: React.FC<TableExProps> = ({\n variant, children, ...props\n}) => {\n return (\n <TableExInner stickyHeader={variant === 'scrollable'} {...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 { useResetState } from '@xylabs/react-hooks'\nimport type { ContextExProviderProps } from '@xyo-network/react-shared'\nimport type { PropsWithChildren } from 'react'\nimport React, { useMemo, useState } from 'react'\n\nimport { TableHeightContext } from './Context.ts'\n\nexport interface TableHeightProviderProps extends ContextExProviderProps, PropsWithChildren {\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] = useResetState(defaultVisibleRows)\n const [rowHeight, setRowHeight] = useState<number | undefined>()\n\n const height = useMemo(() => {\n if (rowHeight !== undefined && visibleRows !== undefined) {\n return rowHeight * (visibleRows + additionalRows)\n }\n }, [defaultVisibleRows, rowHeight, visibleRows, additionalRows])\n\n const formattedHeight = useMemo(() => (height === undefined ? undefined : `${height}${heightFormat}`), [height, heightFormat])\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 value={value}>\n {children}\n </TableHeightContext>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { TableHeightContext } from './Context.ts'\n\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AAqB;AAG9B,OAAOC,UAASC,SAASC,gBAAgB;AAWlC,IAAMC,sBAA0D,wBAAC,EACtEC,UACAC,iBAAiB,GACjBC,oBACAC,eAAe,KAAI,MACpB;AACC,QAAM,CAACC,aAAaC,cAAAA,IAAkBC,cAAcJ,kBAAAA;AACpD,QAAM,CAACK,WAAWC,YAAAA,IAAgBC,SAAAA;AAElC,QAAMC,SAASC,QAAQ,MAAA;AACrB,QAAIJ,cAAcK,UAAaR,gBAAgBQ,QAAW;AACxD,aAAOL,aAAaH,cAAcH;IACpC;EACF,GAAG;IAACC;IAAoBK;IAAWH;IAAaH;GAAe;AAE/D,QAAMY,kBAAkBF,QAAQ,MAAOD,WAAWE,SAAYA,SAAY,GAAGF,MAAAA,GAASP,YAAAA,IAAiB;IAACO;IAAQP;GAAa;AAE7H,QAAMW,QAAQH,QAAQ,OAAO;IAC3BD,QAAQG;IAAiBE,UAAU;IAAMR;IAAWC;IAAcH;IAAgBD;EACpF,IAAI;IAACS;IAAiBN;IAAWC;IAAcH;IAAgBD;GAAY;AAE3E,SACE,gBAAAY,OAAA,cAACC,oBAAAA;IAAmBH;KACjBd,QAAAA;AAGP,GA1BuE;;;ACdvE,SAASkB,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","TableExInner","children","props","Table","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","useResetState","React","useMemo","useState","TableHeightProvider","children","additionalRows","defaultVisibleRows","heightFormat","visibleRows","setVisibleRows","useResetState","rowHeight","setRowHeight","useState","height","useMemo","undefined","formattedHeight","value","provided","React","TableHeightContext","useContextEx","useTableHeight","required","useContextEx","TableHeightContext"]}
|
|
@@ -5,16 +5,6 @@ import type { TableExVariants } from './types/index.ts';
|
|
|
5
5
|
export interface TableExProps extends PropsWithChildren, TableProps {
|
|
6
6
|
variant?: TableExVariants;
|
|
7
7
|
}
|
|
8
|
-
export declare const TableExWithRef:
|
|
9
|
-
|
|
10
|
-
ref?: React.RefObject<HTMLTableElement | null>;
|
|
11
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
displayName: string;
|
|
13
|
-
};
|
|
14
|
-
export declare const TableEx: {
|
|
15
|
-
({ ref, variant, children, ...props }: TableExProps & {
|
|
16
|
-
ref?: React.RefObject<HTMLTableElement | null>;
|
|
17
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
displayName: string;
|
|
19
|
-
};
|
|
8
|
+
export declare const TableExWithRef: React.FC<TableExProps>;
|
|
9
|
+
export declare const TableEx: React.FC<TableExProps>;
|
|
20
10
|
//# sourceMappingURL=TableEx.d.ts.map
|
|
@@ -1 +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,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAEvD,MAAM,WAAW,YAAa,SAAQ,iBAAiB,EAAE,UAAU;IACjE,OAAO,CAAC,EAAE,eAAe,CAAA;CAC1B;
|
|
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,KAAK,MAAM,OAAO,CAAA;AAEzB,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,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAQjD,CAAA;AAID,eAAO,MAAM,OAAO,wBAAiB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/react-table",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "Common React library for all XYO projects that use React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xyo",
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
"./package.json": "./package.json"
|
|
38
38
|
},
|
|
39
39
|
"module": "dist/browser/index.mjs",
|
|
40
|
-
"types": "dist/
|
|
40
|
+
"types": "dist/types/index.d.ts",
|
|
41
41
|
"scripts": {
|
|
42
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
43
|
"lint-pkg": "npmPkgJsonLint ."
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@xylabs/react-hooks": "^6.0.
|
|
47
|
-
"@xyo-network/react-shared": "^5.0.
|
|
46
|
+
"@xylabs/react-hooks": "^6.0.2",
|
|
47
|
+
"@xyo-network/react-shared": "^5.0.1"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@mui/icons-material": "^6.4.7",
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"@mui/styles": "^6.4.7",
|
|
53
53
|
"@storybook/react": "^8.6.4",
|
|
54
54
|
"@types/react": "^19.0.10",
|
|
55
|
-
"@xylabs/ts-scripts-yarn3": "^6.0.
|
|
56
|
-
"@xylabs/tsconfig-react": "^6.0.
|
|
57
|
-
"@xyo-network/react-storybook": "^5.0.
|
|
55
|
+
"@xylabs/ts-scripts-yarn3": "^6.0.8",
|
|
56
|
+
"@xylabs/tsconfig-react": "^6.0.8",
|
|
57
|
+
"@xyo-network/react-storybook": "^5.0.1",
|
|
58
58
|
"react": "^19.0.0",
|
|
59
59
|
"react-dom": "^19.0.0",
|
|
60
60
|
"react-router-dom": "^7.3.0",
|
|
@@ -9,11 +9,9 @@ export interface TableExProps extends PropsWithChildren, TableProps {
|
|
|
9
9
|
variant?: TableExVariants
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
const TableExInner = ({
|
|
13
|
-
ref, children, ...props
|
|
14
|
-
}: TableExProps & { ref?: React.RefObject<HTMLTableElement | null> }) => {
|
|
12
|
+
const TableExInner: React.FC<TableExProps> = ({ children, ...props }) => {
|
|
15
13
|
return (
|
|
16
|
-
<Table
|
|
14
|
+
<Table {...props}>
|
|
17
15
|
{children}
|
|
18
16
|
</Table>
|
|
19
17
|
)
|
|
@@ -21,11 +19,11 @@ const TableExInner = ({
|
|
|
21
19
|
|
|
22
20
|
TableExInner.displayName = 'TableExInner'
|
|
23
21
|
|
|
24
|
-
export const TableExWithRef = ({
|
|
25
|
-
|
|
26
|
-
}
|
|
22
|
+
export const TableExWithRef: React.FC<TableExProps> = ({
|
|
23
|
+
variant, children, ...props
|
|
24
|
+
}) => {
|
|
27
25
|
return (
|
|
28
|
-
<TableExInner stickyHeader={variant === 'scrollable'}
|
|
26
|
+
<TableExInner stickyHeader={variant === 'scrollable'} {...props}>
|
|
29
27
|
{children}
|
|
30
28
|
</TableExInner>
|
|
31
29
|
)
|