@xyo-network/react-table 3.0.1 → 3.0.2
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.map +1 -1
- package/package.json +8 -8
- package/src/components/TableEx/TableCellEx.tsx +2 -1
- package/src/components/TableEx/TableEx.stories.tsx +1 -1
- package/src/components/TableEx/TableEx.tsx +5 -3
- package/src/components/TableEx/TableFooterEx.tsx +5 -3
- package/src/context/TableHeight/Context.ts +1 -1
- package/src/context/TableHeight/Provider.tsx +2 -2
- package/src/context/TableHeight/State.ts +2 -2
- package/src/types/TableHead.ts +1 -1
- package/xy.config.ts +1 -1
|
@@ -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 { styled, TableCell
|
|
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 }) => ({\n ...(noBgColor && { backgroundColor: 'transparent' }),\n }),\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>(({ variant, children, ...props }, 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, { useEffect, useMemo, useState } 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(() => ({ height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }), [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;EACzB,GAAIA,aAAa;IAAEC,iBAAiB;EAAc;AACpD,EAAA;;;ACTF,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,EAAEO,SAASL,UAAU,GAAGC,MAAAA,GAASC,QAAAA;AACzG,SACE,sBAAA,cAACH,cAAAA;IAAaO,cAAcD,YAAY;IAAcH;IAAW,GA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Mc,QAAQH,QAAQ,OAAO;IAAEL,QAAQI;IAAiBK,UAAU;IAAMP;IAAWC;IAAcL;IAAgBD;EAAY,IAAI;IAACO;IAAiBF;IAAWC;IAAcL;IAAgBD;GAAY;AAExM,SACE,gBAAAa,OAAA,cAACC,mBAAmBC,UAAQ;IAACJ;KAC1Bf,QAAAA;AAGP,GA7BuE;;;ACbvE,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"]}
|
package/package.json
CHANGED
|
@@ -7,17 +7,17 @@
|
|
|
7
7
|
},
|
|
8
8
|
"bugs": {
|
|
9
9
|
"email": "support@xyo.network",
|
|
10
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues"
|
|
10
|
+
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@xylabs/react-shared": "^4.0.
|
|
14
|
-
"@xyo-network/react-shared": "^3.0.
|
|
13
|
+
"@xylabs/react-shared": "^4.0.3",
|
|
14
|
+
"@xyo-network/react-shared": "^3.0.2"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@storybook/react": "^8.2.9",
|
|
18
|
-
"@xylabs/ts-scripts-yarn3": "^4.0.0-rc.
|
|
19
|
-
"@xylabs/tsconfig-react": "^4.0.0-rc.
|
|
20
|
-
"@xyo-network/react-storybook": "^3.0.
|
|
18
|
+
"@xylabs/ts-scripts-yarn3": "^4.0.0-rc.20",
|
|
19
|
+
"@xylabs/tsconfig-react": "^4.0.0-rc.20",
|
|
20
|
+
"@xyo-network/react-storybook": "^3.0.2",
|
|
21
21
|
"typescript": "^5.5.4"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
},
|
|
55
55
|
"repository": {
|
|
56
56
|
"type": "git",
|
|
57
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js.git"
|
|
57
|
+
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-react-js.git"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"lint-pkg": "npmPkgJsonLint .",
|
|
@@ -62,6 +62,6 @@
|
|
|
62
62
|
},
|
|
63
63
|
"sideEffects": false,
|
|
64
64
|
"types": "dist/browser/index.d.ts",
|
|
65
|
-
"version": "3.0.
|
|
65
|
+
"version": "3.0.2",
|
|
66
66
|
"type": "module"
|
|
67
67
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TableBody, TableCell, TableHead, TablePagination, TableRow, useTheme } from '@mui/material'
|
|
2
|
-
import { Decorator, Meta, StoryFn } from '@storybook/react'
|
|
2
|
+
import type { Decorator, Meta, StoryFn } from '@storybook/react'
|
|
3
3
|
import { WithRefDecorator } from '@xyo-network/react-storybook'
|
|
4
4
|
import React from 'react'
|
|
5
5
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import type { TableProps } from '@mui/material'
|
|
2
|
+
import { Table } from '@mui/material'
|
|
3
|
+
import type { PropsWithChildren } from 'react'
|
|
4
|
+
import React, { forwardRef } from 'react'
|
|
3
5
|
|
|
4
|
-
import { TableExVariants } from './types/index.ts'
|
|
6
|
+
import type { TableExVariants } from './types/index.ts'
|
|
5
7
|
|
|
6
8
|
export interface TableExProps extends PropsWithChildren, TableProps {
|
|
7
9
|
variant?: TableExVariants
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import type { TableFooterProps } from '@mui/material'
|
|
2
|
+
import { styled, TableFooter } from '@mui/material'
|
|
3
|
+
import type { PropsWithChildren } from 'react'
|
|
4
|
+
import React from 'react'
|
|
3
5
|
|
|
4
|
-
import { TableExVariants } from './types/index.ts'
|
|
6
|
+
import type { TableExVariants } from './types/index.ts'
|
|
5
7
|
|
|
6
8
|
const TableFooterExRoot = styled(TableFooter, {
|
|
7
9
|
name: 'TableFooterEx',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WithChildren } from '@xylabs/react-shared'
|
|
2
|
-
import { ContextExProviderProps } from '@xyo-network/react-shared'
|
|
1
|
+
import type { WithChildren } from '@xylabs/react-shared'
|
|
2
|
+
import type { ContextExProviderProps } from '@xyo-network/react-shared'
|
|
3
3
|
import React, { useEffect, useMemo, useState } from 'react'
|
|
4
4
|
|
|
5
5
|
import { TableHeightContext } from './Context.ts'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ContextExState } from '@xyo-network/react-shared'
|
|
2
|
-
import { Dispatch, SetStateAction } from 'react'
|
|
1
|
+
import type { ContextExState } from '@xyo-network/react-shared'
|
|
2
|
+
import type { Dispatch, SetStateAction } from 'react'
|
|
3
3
|
|
|
4
4
|
export interface TableHeightState extends ContextExState {
|
|
5
5
|
height?: string
|
package/src/types/TableHead.ts
CHANGED
package/xy.config.ts
CHANGED