@xyo-network/react-table 2.81.10 → 2.82.0
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/TableEx.d.cts +4 -4
- package/dist/browser/components/TableEx/TableEx.d.cts.map +1 -1
- package/dist/browser/components/TableEx/TableEx.d.mts +4 -4
- package/dist/browser/components/TableEx/TableEx.d.mts.map +1 -1
- package/dist/browser/components/TableEx/TableEx.d.ts +4 -4
- package/dist/browser/components/TableEx/TableEx.d.ts.map +1 -1
- package/dist/browser/components/TableEx/TableFooterEx.d.cts +2 -2
- package/dist/browser/components/TableEx/TableFooterEx.d.cts.map +1 -1
- package/dist/browser/components/TableEx/TableFooterEx.d.mts +2 -2
- package/dist/browser/components/TableEx/TableFooterEx.d.mts.map +1 -1
- package/dist/browser/components/TableEx/TableFooterEx.d.ts +2 -2
- package/dist/browser/components/TableEx/TableFooterEx.d.ts.map +1 -1
- package/dist/browser/components/TableEx/index.d.cts +4 -4
- package/dist/browser/components/TableEx/index.d.cts.map +1 -1
- package/dist/browser/components/TableEx/index.d.mts +4 -4
- package/dist/browser/components/TableEx/index.d.mts.map +1 -1
- package/dist/browser/components/TableEx/index.d.ts +4 -4
- package/dist/browser/components/TableEx/index.d.ts.map +1 -1
- package/dist/browser/components/TableEx/types/index.d.cts +1 -1
- package/dist/browser/components/TableEx/types/index.d.mts +1 -1
- package/dist/browser/components/TableEx/types/index.d.ts +1 -1
- package/dist/browser/components/index.d.cts +1 -1
- package/dist/browser/components/index.d.mts +1 -1
- package/dist/browser/components/index.d.ts +1 -1
- package/dist/browser/context/TableHeight/Context.d.cts +1 -1
- package/dist/browser/context/TableHeight/Context.d.mts +1 -1
- package/dist/browser/context/TableHeight/Context.d.ts +1 -1
- package/dist/browser/context/TableHeight/Provider.d.cts +1 -0
- package/dist/browser/context/TableHeight/Provider.d.cts.map +1 -1
- package/dist/browser/context/TableHeight/Provider.d.mts +1 -0
- package/dist/browser/context/TableHeight/Provider.d.mts.map +1 -1
- package/dist/browser/context/TableHeight/Provider.d.ts +1 -0
- package/dist/browser/context/TableHeight/Provider.d.ts.map +1 -1
- package/dist/browser/context/TableHeight/index.d.cts +4 -4
- package/dist/browser/context/TableHeight/index.d.cts.map +1 -1
- package/dist/browser/context/TableHeight/index.d.mts +4 -4
- package/dist/browser/context/TableHeight/index.d.mts.map +1 -1
- package/dist/browser/context/TableHeight/index.d.ts +4 -4
- package/dist/browser/context/TableHeight/index.d.ts.map +1 -1
- package/dist/browser/context/TableHeight/use.d.cts +1 -1
- package/dist/browser/context/TableHeight/use.d.cts.map +1 -1
- package/dist/browser/context/TableHeight/use.d.mts +1 -1
- package/dist/browser/context/TableHeight/use.d.mts.map +1 -1
- package/dist/browser/context/TableHeight/use.d.ts +1 -1
- package/dist/browser/context/TableHeight/use.d.ts.map +1 -1
- package/dist/browser/context/index.d.cts +1 -1
- package/dist/browser/context/index.d.mts +1 -1
- package/dist/browser/context/index.d.ts +1 -1
- package/dist/browser/index.cjs +74 -34
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.d.cts +3 -3
- package/dist/browser/index.d.mts +3 -3
- package/dist/browser/index.d.ts +3 -3
- package/dist/browser/index.mjs +113 -0
- package/dist/browser/index.mjs.map +1 -0
- package/dist/browser/types/index.d.cts +1 -1
- package/dist/browser/types/index.d.mts +1 -1
- package/dist/browser/types/index.d.ts +1 -1
- package/dist/neutral/components/TableEx/TableEx.d.cts +4 -4
- package/dist/neutral/components/TableEx/TableEx.d.cts.map +1 -1
- package/dist/neutral/components/TableEx/TableEx.d.mts +4 -4
- package/dist/neutral/components/TableEx/TableEx.d.mts.map +1 -1
- package/dist/neutral/components/TableEx/TableEx.d.ts +4 -4
- package/dist/neutral/components/TableEx/TableEx.d.ts.map +1 -1
- package/dist/neutral/components/TableEx/TableFooterEx.d.cts +2 -2
- package/dist/neutral/components/TableEx/TableFooterEx.d.cts.map +1 -1
- package/dist/neutral/components/TableEx/TableFooterEx.d.mts +2 -2
- package/dist/neutral/components/TableEx/TableFooterEx.d.mts.map +1 -1
- package/dist/neutral/components/TableEx/TableFooterEx.d.ts +2 -2
- package/dist/neutral/components/TableEx/TableFooterEx.d.ts.map +1 -1
- package/dist/neutral/components/TableEx/index.d.cts +4 -4
- package/dist/neutral/components/TableEx/index.d.cts.map +1 -1
- package/dist/neutral/components/TableEx/index.d.mts +4 -4
- package/dist/neutral/components/TableEx/index.d.mts.map +1 -1
- package/dist/neutral/components/TableEx/index.d.ts +4 -4
- package/dist/neutral/components/TableEx/index.d.ts.map +1 -1
- package/dist/neutral/components/TableEx/types/index.d.cts +1 -1
- package/dist/neutral/components/TableEx/types/index.d.mts +1 -1
- package/dist/neutral/components/TableEx/types/index.d.ts +1 -1
- package/dist/neutral/components/index.d.cts +1 -1
- package/dist/neutral/components/index.d.mts +1 -1
- package/dist/neutral/components/index.d.ts +1 -1
- package/dist/neutral/context/TableHeight/Context.d.cts +1 -1
- package/dist/neutral/context/TableHeight/Context.d.mts +1 -1
- package/dist/neutral/context/TableHeight/Context.d.ts +1 -1
- package/dist/neutral/context/TableHeight/Provider.d.cts +1 -0
- package/dist/neutral/context/TableHeight/Provider.d.cts.map +1 -1
- package/dist/neutral/context/TableHeight/Provider.d.mts +1 -0
- package/dist/neutral/context/TableHeight/Provider.d.mts.map +1 -1
- package/dist/neutral/context/TableHeight/Provider.d.ts +1 -0
- package/dist/neutral/context/TableHeight/Provider.d.ts.map +1 -1
- package/dist/neutral/context/TableHeight/index.d.cts +4 -4
- package/dist/neutral/context/TableHeight/index.d.cts.map +1 -1
- package/dist/neutral/context/TableHeight/index.d.mts +4 -4
- package/dist/neutral/context/TableHeight/index.d.mts.map +1 -1
- package/dist/neutral/context/TableHeight/index.d.ts +4 -4
- package/dist/neutral/context/TableHeight/index.d.ts.map +1 -1
- package/dist/neutral/context/TableHeight/use.d.cts +1 -1
- package/dist/neutral/context/TableHeight/use.d.cts.map +1 -1
- package/dist/neutral/context/TableHeight/use.d.mts +1 -1
- package/dist/neutral/context/TableHeight/use.d.mts.map +1 -1
- package/dist/neutral/context/TableHeight/use.d.ts +1 -1
- package/dist/neutral/context/TableHeight/use.d.ts.map +1 -1
- package/dist/neutral/context/index.d.cts +1 -1
- package/dist/neutral/context/index.d.mts +1 -1
- package/dist/neutral/context/index.d.ts +1 -1
- package/dist/neutral/index.cjs +74 -34
- package/dist/neutral/index.cjs.map +1 -1
- package/dist/neutral/index.d.cts +3 -3
- package/dist/neutral/index.d.mts +3 -3
- package/dist/neutral/index.d.ts +3 -3
- package/dist/neutral/index.mjs +113 -0
- package/dist/neutral/index.mjs.map +1 -0
- package/dist/neutral/types/index.d.cts +1 -1
- package/dist/neutral/types/index.d.mts +1 -1
- package/dist/neutral/types/index.d.ts +1 -1
- package/dist/node/components/TableEx/TableEx.d.cts +4 -4
- package/dist/node/components/TableEx/TableEx.d.cts.map +1 -1
- package/dist/node/components/TableEx/TableEx.d.mts +4 -4
- package/dist/node/components/TableEx/TableEx.d.mts.map +1 -1
- package/dist/node/components/TableEx/TableEx.d.ts +4 -4
- package/dist/node/components/TableEx/TableEx.d.ts.map +1 -1
- package/dist/node/components/TableEx/TableFooterEx.d.cts +2 -2
- package/dist/node/components/TableEx/TableFooterEx.d.cts.map +1 -1
- package/dist/node/components/TableEx/TableFooterEx.d.mts +2 -2
- package/dist/node/components/TableEx/TableFooterEx.d.mts.map +1 -1
- package/dist/node/components/TableEx/TableFooterEx.d.ts +2 -2
- package/dist/node/components/TableEx/TableFooterEx.d.ts.map +1 -1
- package/dist/node/components/TableEx/index.d.cts +4 -4
- package/dist/node/components/TableEx/index.d.cts.map +1 -1
- package/dist/node/components/TableEx/index.d.mts +4 -4
- package/dist/node/components/TableEx/index.d.mts.map +1 -1
- package/dist/node/components/TableEx/index.d.ts +4 -4
- package/dist/node/components/TableEx/index.d.ts.map +1 -1
- package/dist/node/components/TableEx/types/index.d.cts +1 -1
- package/dist/node/components/TableEx/types/index.d.mts +1 -1
- package/dist/node/components/TableEx/types/index.d.ts +1 -1
- package/dist/node/components/index.d.cts +1 -1
- package/dist/node/components/index.d.mts +1 -1
- package/dist/node/components/index.d.ts +1 -1
- package/dist/node/context/TableHeight/Context.d.cts +1 -1
- package/dist/node/context/TableHeight/Context.d.mts +1 -1
- package/dist/node/context/TableHeight/Context.d.ts +1 -1
- package/dist/node/context/TableHeight/Provider.d.cts +1 -0
- package/dist/node/context/TableHeight/Provider.d.cts.map +1 -1
- package/dist/node/context/TableHeight/Provider.d.mts +1 -0
- package/dist/node/context/TableHeight/Provider.d.mts.map +1 -1
- package/dist/node/context/TableHeight/Provider.d.ts +1 -0
- package/dist/node/context/TableHeight/Provider.d.ts.map +1 -1
- package/dist/node/context/TableHeight/index.d.cts +4 -4
- package/dist/node/context/TableHeight/index.d.cts.map +1 -1
- package/dist/node/context/TableHeight/index.d.mts +4 -4
- package/dist/node/context/TableHeight/index.d.mts.map +1 -1
- package/dist/node/context/TableHeight/index.d.ts +4 -4
- package/dist/node/context/TableHeight/index.d.ts.map +1 -1
- package/dist/node/context/TableHeight/use.d.cts +1 -1
- package/dist/node/context/TableHeight/use.d.cts.map +1 -1
- package/dist/node/context/TableHeight/use.d.mts +1 -1
- package/dist/node/context/TableHeight/use.d.mts.map +1 -1
- package/dist/node/context/TableHeight/use.d.ts +1 -1
- package/dist/node/context/TableHeight/use.d.ts.map +1 -1
- package/dist/node/context/index.d.cts +1 -1
- package/dist/node/context/index.d.mts +1 -1
- package/dist/node/context/index.d.ts +1 -1
- package/dist/node/index.cjs +74 -34
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +3 -3
- package/dist/node/index.d.mts +3 -3
- package/dist/node/index.d.ts +3 -3
- package/dist/node/index.mjs +113 -0
- package/dist/node/index.mjs.map +1 -0
- package/dist/node/types/index.d.cts +1 -1
- package/dist/node/types/index.d.mts +1 -1
- package/dist/node/types/index.d.ts +1 -1
- package/package.json +11 -11
- package/src/components/TableEx/TableCellEx.tsx +1 -1
- package/src/components/TableEx/TableEx.stories.tsx +9 -7
- package/src/components/TableEx/TableEx.tsx +2 -2
- package/src/components/TableEx/TableFooterEx.tsx +3 -3
- package/src/components/TableEx/index.ts +4 -4
- package/src/components/TableEx/types/index.ts +1 -1
- package/src/components/index.ts +1 -1
- package/src/context/TableHeight/Context.ts +1 -1
- package/src/context/TableHeight/Provider.tsx +5 -3
- package/src/context/TableHeight/index.ts +4 -4
- package/src/context/TableHeight/{use.tsx → use.ts} +1 -1
- package/src/context/index.ts +1 -1
- package/src/index.ts +3 -3
- package/src/types/index.ts +1 -1
- package/dist/browser/index.js +0 -81
- package/dist/browser/index.js.map +0 -1
- package/dist/neutral/index.js +0 -81
- package/dist/neutral/index.js.map +0 -1
- package/dist/node/index.js +0 -81
- package/dist/node/index.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/* eslint-disable import/no-internal-modules */
|
|
2
1
|
import { TableBody, TableCell, TableHead, TablePagination, TableRow, useTheme } from '@mui/material'
|
|
3
2
|
import { Decorator, Meta, StoryFn } from '@storybook/react'
|
|
4
3
|
import { WithRefDecorator } from '@xyo-network/react-storybook'
|
|
4
|
+
import React from 'react'
|
|
5
5
|
|
|
6
|
-
import { TableCellEx } from './TableCellEx.
|
|
7
|
-
import { TableEx } from './TableEx.
|
|
8
|
-
import { TableFooterEx } from './TableFooterEx.
|
|
6
|
+
import { TableCellEx } from './TableCellEx.tsx'
|
|
7
|
+
import { TableEx } from './TableEx.tsx'
|
|
8
|
+
import { TableFooterEx } from './TableFooterEx.tsx'
|
|
9
9
|
|
|
10
10
|
const ScrollableDecorator: Decorator = (Story, args) => (
|
|
11
11
|
<div style={{ height: 'calc(100vh - 2rem)', inset: 0, position: 'absolute' }}>
|
|
@@ -38,9 +38,12 @@ const Template: StoryFn<typeof TableEx> = (args) => {
|
|
|
38
38
|
</TableRow>
|
|
39
39
|
</TableHead>
|
|
40
40
|
<TableBody>
|
|
41
|
-
{tableRows.map(
|
|
41
|
+
{tableRows.map(row => (
|
|
42
42
|
<TableRow key={row}>
|
|
43
|
-
<TableCell>
|
|
43
|
+
<TableCell>
|
|
44
|
+
Row
|
|
45
|
+
{row}
|
|
46
|
+
</TableCell>
|
|
44
47
|
<TableCell>Cell 2</TableCell>
|
|
45
48
|
</TableRow>
|
|
46
49
|
))}
|
|
@@ -84,5 +87,4 @@ WithScrollable.decorators = [ScrollableDecorator]
|
|
|
84
87
|
|
|
85
88
|
export { Default, WithRef, WithScrollable }
|
|
86
89
|
|
|
87
|
-
// eslint-disable-next-line import/no-default-export
|
|
88
90
|
export default StorybookEntry
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Table, TableProps } from '@mui/material'
|
|
2
|
-
import { forwardRef, PropsWithChildren } from 'react'
|
|
2
|
+
import React, { forwardRef, PropsWithChildren } from 'react'
|
|
3
3
|
|
|
4
|
-
import { TableExVariants } from './types/index.
|
|
4
|
+
import { TableExVariants } from './types/index.ts'
|
|
5
5
|
|
|
6
6
|
export interface TableExProps extends PropsWithChildren, TableProps {
|
|
7
7
|
variant?: TableExVariants
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { styled, TableFooter, TableFooterProps } from '@mui/material'
|
|
2
|
-
import { PropsWithChildren } from 'react'
|
|
2
|
+
import React, { PropsWithChildren } from 'react'
|
|
3
3
|
|
|
4
|
-
import { TableExVariants } from './types/index.
|
|
4
|
+
import { TableExVariants } from './types/index.ts'
|
|
5
5
|
|
|
6
6
|
const TableFooterExRoot = styled(TableFooter, {
|
|
7
7
|
name: 'TableFooterEx',
|
|
8
|
-
shouldForwardProp:
|
|
8
|
+
shouldForwardProp: propName => propName !== 'scrollable',
|
|
9
9
|
slot: 'Root',
|
|
10
10
|
})<TableFooterExProps>(({ variant, theme }) => ({
|
|
11
11
|
backgroundColor: theme.palette.background.default,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './TableCellEx.
|
|
2
|
-
export * from './TableEx.
|
|
3
|
-
export * from './TableFooterEx.
|
|
4
|
-
export * from './types/index.
|
|
1
|
+
export * from './TableCellEx.tsx'
|
|
2
|
+
export * from './TableEx.tsx'
|
|
3
|
+
export * from './TableFooterEx.tsx'
|
|
4
|
+
export * from './types/index.ts'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './TableExVariants.
|
|
1
|
+
export * from './TableExVariants.ts'
|
package/src/components/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './TableEx/index.
|
|
1
|
+
export * from './TableEx/index.ts'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { WithChildren } from '@xylabs/react-shared'
|
|
2
2
|
import { ContextExProviderProps } from '@xyo-network/react-shared'
|
|
3
|
-
import { useEffect, useMemo, useState } from 'react'
|
|
3
|
+
import React, { useEffect, useMemo, useState } from 'react'
|
|
4
4
|
|
|
5
|
-
import { TableHeightContext } from './Context.
|
|
5
|
+
import { TableHeightContext } from './Context.ts'
|
|
6
6
|
|
|
7
7
|
export interface TableHeightProviderProps extends ContextExProviderProps, WithChildren {
|
|
8
8
|
/** @field Account for optional header and footer rows */
|
|
@@ -33,8 +33,10 @@ export const TableHeightProvider: React.FC<TableHeightProviderProps> = ({
|
|
|
33
33
|
}
|
|
34
34
|
}, [defaultVisibleRows, rowHeight, visibleRows, additionalRows])
|
|
35
35
|
|
|
36
|
+
const value = useMemo(() => ({ height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }), [formattedHeight, rowHeight, setRowHeight, setVisibleRows, visibleRows])
|
|
37
|
+
|
|
36
38
|
return (
|
|
37
|
-
<TableHeightContext.Provider value={
|
|
39
|
+
<TableHeightContext.Provider value={value}>
|
|
38
40
|
{children}
|
|
39
41
|
</TableHeightContext.Provider>
|
|
40
42
|
)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './Context.
|
|
2
|
-
export * from './Provider.
|
|
3
|
-
export * from './State.
|
|
4
|
-
export * from './use.
|
|
1
|
+
export * from './Context.ts'
|
|
2
|
+
export * from './Provider.tsx'
|
|
3
|
+
export * from './State.ts'
|
|
4
|
+
export * from './use.ts'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useContextEx } from '@xyo-network/react-shared'
|
|
2
2
|
|
|
3
|
-
import { TableHeightContext } from './Context.
|
|
3
|
+
import { TableHeightContext } from './Context.ts'
|
|
4
4
|
|
|
5
5
|
export const useTableHeight = (required = false) => useContextEx(TableHeightContext, 'TableHeight', required)
|
package/src/context/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './TableHeight/index.
|
|
1
|
+
export * from './TableHeight/index.ts'
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './components/index.
|
|
2
|
-
export * from './context/index.
|
|
3
|
-
export * from './types/index.
|
|
1
|
+
export * from './components/index.ts'
|
|
2
|
+
export * from './context/index.ts'
|
|
3
|
+
export * from './types/index.ts'
|
package/src/types/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './TableHead.
|
|
1
|
+
export * from './TableHead.ts'
|
package/dist/browser/index.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
// src/components/TableEx/TableCellEx.tsx
|
|
2
|
-
import { styled, TableCell } from "@mui/material";
|
|
3
|
-
var TableCellEx = styled(TableCell, { name: "TableCellNoBgColor", shouldForwardProp: (prop) => prop !== "noBgColor" })(
|
|
4
|
-
({ noBgColor = true }) => ({
|
|
5
|
-
...noBgColor && { backgroundColor: "transparent" }
|
|
6
|
-
})
|
|
7
|
-
);
|
|
8
|
-
|
|
9
|
-
// src/components/TableEx/TableEx.tsx
|
|
10
|
-
import { Table } from "@mui/material";
|
|
11
|
-
import { forwardRef } from "react";
|
|
12
|
-
import { jsx } from "react/jsx-runtime";
|
|
13
|
-
var TableExInner = forwardRef(({ children, ...props }, ref) => {
|
|
14
|
-
return /* @__PURE__ */ jsx(Table, { ref, ...props, children });
|
|
15
|
-
});
|
|
16
|
-
TableExInner.displayName = "TableExInner";
|
|
17
|
-
var TableExWithRef = forwardRef(({ variant, children, ...props }, ref) => {
|
|
18
|
-
return /* @__PURE__ */ jsx(TableExInner, { stickyHeader: variant === "scrollable", ref, ...props, children });
|
|
19
|
-
});
|
|
20
|
-
TableExWithRef.displayName = "TableEx";
|
|
21
|
-
var TableEx = TableExWithRef;
|
|
22
|
-
|
|
23
|
-
// src/components/TableEx/TableFooterEx.tsx
|
|
24
|
-
import { styled as styled2, TableFooter } from "@mui/material";
|
|
25
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
26
|
-
var TableFooterExRoot = styled2(TableFooter, {
|
|
27
|
-
name: "TableFooterEx",
|
|
28
|
-
shouldForwardProp: (propName) => propName !== "scrollable",
|
|
29
|
-
slot: "Root"
|
|
30
|
-
})(({ variant, theme }) => ({
|
|
31
|
-
backgroundColor: theme.palette.background.default,
|
|
32
|
-
bottom: "unset",
|
|
33
|
-
position: "relative",
|
|
34
|
-
...variant === "scrollable" && {
|
|
35
|
-
bottom: 0,
|
|
36
|
-
position: "sticky"
|
|
37
|
-
}
|
|
38
|
-
}));
|
|
39
|
-
var TableFooterEx = ({ children, ...props }) => /* @__PURE__ */ jsx2(TableFooterExRoot, { ...props, children });
|
|
40
|
-
|
|
41
|
-
// src/context/TableHeight/Context.ts
|
|
42
|
-
import { createContextEx } from "@xyo-network/react-shared";
|
|
43
|
-
var TableHeightContext = createContextEx();
|
|
44
|
-
|
|
45
|
-
// src/context/TableHeight/Provider.tsx
|
|
46
|
-
import { useEffect, useMemo, useState } from "react";
|
|
47
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
48
|
-
var TableHeightProvider = ({
|
|
49
|
-
children,
|
|
50
|
-
additionalRows = 0,
|
|
51
|
-
defaultVisibleRows,
|
|
52
|
-
heightFormat = "px"
|
|
53
|
-
}) => {
|
|
54
|
-
const [visibleRows, setVisibleRows] = useState(defaultVisibleRows);
|
|
55
|
-
const [height, setHeight] = useState();
|
|
56
|
-
const [rowHeight, setRowHeight] = useState();
|
|
57
|
-
const formattedHeight = useMemo(() => height === void 0 ? void 0 : `${height}${heightFormat}`, [height, heightFormat]);
|
|
58
|
-
useEffect(() => {
|
|
59
|
-
setVisibleRows(defaultVisibleRows);
|
|
60
|
-
}, [defaultVisibleRows]);
|
|
61
|
-
useEffect(() => {
|
|
62
|
-
if (rowHeight !== void 0 && visibleRows !== void 0) {
|
|
63
|
-
setHeight(rowHeight * (visibleRows + additionalRows));
|
|
64
|
-
}
|
|
65
|
-
}, [defaultVisibleRows, rowHeight, visibleRows, additionalRows]);
|
|
66
|
-
return /* @__PURE__ */ jsx3(TableHeightContext.Provider, { value: { height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }, children });
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
// src/context/TableHeight/use.tsx
|
|
70
|
-
import { useContextEx } from "@xyo-network/react-shared";
|
|
71
|
-
var useTableHeight = (required = false) => useContextEx(TableHeightContext, "TableHeight", required);
|
|
72
|
-
export {
|
|
73
|
-
TableCellEx,
|
|
74
|
-
TableEx,
|
|
75
|
-
TableExWithRef,
|
|
76
|
-
TableFooterEx,
|
|
77
|
-
TableHeightContext,
|
|
78
|
-
TableHeightProvider,
|
|
79
|
-
useTableHeight
|
|
80
|
-
};
|
|
81
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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.tsx"],"sourcesContent":["import { styled, TableCell, TableCellProps } 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 { Table, TableProps } from '@mui/material'\nimport { forwardRef, PropsWithChildren } from 'react'\n\nimport { TableExVariants } from './types/index.js'\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 { styled, TableFooter, TableFooterProps } from '@mui/material'\nimport { PropsWithChildren } from 'react'\n\nimport { TableExVariants } from './types/index.js'\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 { TableHeightState } from './State.js'\n\nexport const TableHeightContext = createContextEx<TableHeightState>()\n","import { WithChildren } from '@xylabs/react-shared'\nimport { ContextExProviderProps } from '@xyo-network/react-shared'\nimport { useEffect, useMemo, useState } from 'react'\n\nimport { TableHeightContext } from './Context.js'\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 return (\n <TableHeightContext.Provider value={{ height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }}>\n {children}\n </TableHeightContext.Provider>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { TableHeightContext } from './Context.js'\n\nexport const useTableHeight = (required = false) => useContextEx(TableHeightContext, 'TableHeight', required)\n"],"mappings":";AAAA,SAAS,QAAQ,iBAAiC;AAM3C,IAAM,cAAc,OAAO,WAAW,EAAE,MAAM,sBAAsB,mBAAmB,CAAC,SAAS,SAAS,YAAY,CAAC;AAAA,EAC5H,CAAC,EAAE,YAAY,KAAK,OAAO;AAAA,IACzB,GAAI,aAAa,EAAE,iBAAiB,cAAc;AAAA,EACpD;AACF;;;ACVA,SAAS,aAAyB;AAClC,SAAS,kBAAqC;AAU1C;AAFJ,IAAM,eAAe,WAA2C,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ;AAC/F,SACE,oBAAC,SAAM,KAAW,GAAG,OAClB,UACH;AAEJ,CAAC;AAED,aAAa,cAAc;AAEpB,IAAM,iBAAiB,WAA2C,CAAC,EAAE,SAAS,UAAU,GAAG,MAAM,GAAG,QAAQ;AACjH,SACE,oBA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AAA,EACF,GAAG,CAAC,oBAAoB,WAAW,aAAa,cAAc,CAAC;AAE/D,SACE,gBAAAA,KAAC,mBAAmB,UAAnB,EAA4B,OAAO,EAAE,QAAQ,iBAAiB,UAAU,MAAM,WAAW,cAAc,gBAAgB,YAAY,GACjI,UACH;AAEJ;;;ACxCA,SAAS,oBAAoB;AAItB,IAAM,iBAAiB,CAAC,WAAW,UAAU,aAAa,oBAAoB,eAAe,QAAQ;","names":["styled","jsx","jsx"]}
|
package/dist/neutral/index.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
// src/components/TableEx/TableCellEx.tsx
|
|
2
|
-
import { styled, TableCell } from "@mui/material";
|
|
3
|
-
var TableCellEx = styled(TableCell, { name: "TableCellNoBgColor", shouldForwardProp: (prop) => prop !== "noBgColor" })(
|
|
4
|
-
({ noBgColor = true }) => ({
|
|
5
|
-
...noBgColor && { backgroundColor: "transparent" }
|
|
6
|
-
})
|
|
7
|
-
);
|
|
8
|
-
|
|
9
|
-
// src/components/TableEx/TableEx.tsx
|
|
10
|
-
import { Table } from "@mui/material";
|
|
11
|
-
import { forwardRef } from "react";
|
|
12
|
-
import { jsx } from "react/jsx-runtime";
|
|
13
|
-
var TableExInner = forwardRef(({ children, ...props }, ref) => {
|
|
14
|
-
return /* @__PURE__ */ jsx(Table, { ref, ...props, children });
|
|
15
|
-
});
|
|
16
|
-
TableExInner.displayName = "TableExInner";
|
|
17
|
-
var TableExWithRef = forwardRef(({ variant, children, ...props }, ref) => {
|
|
18
|
-
return /* @__PURE__ */ jsx(TableExInner, { stickyHeader: variant === "scrollable", ref, ...props, children });
|
|
19
|
-
});
|
|
20
|
-
TableExWithRef.displayName = "TableEx";
|
|
21
|
-
var TableEx = TableExWithRef;
|
|
22
|
-
|
|
23
|
-
// src/components/TableEx/TableFooterEx.tsx
|
|
24
|
-
import { styled as styled2, TableFooter } from "@mui/material";
|
|
25
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
26
|
-
var TableFooterExRoot = styled2(TableFooter, {
|
|
27
|
-
name: "TableFooterEx",
|
|
28
|
-
shouldForwardProp: (propName) => propName !== "scrollable",
|
|
29
|
-
slot: "Root"
|
|
30
|
-
})(({ variant, theme }) => ({
|
|
31
|
-
backgroundColor: theme.palette.background.default,
|
|
32
|
-
bottom: "unset",
|
|
33
|
-
position: "relative",
|
|
34
|
-
...variant === "scrollable" && {
|
|
35
|
-
bottom: 0,
|
|
36
|
-
position: "sticky"
|
|
37
|
-
}
|
|
38
|
-
}));
|
|
39
|
-
var TableFooterEx = ({ children, ...props }) => /* @__PURE__ */ jsx2(TableFooterExRoot, { ...props, children });
|
|
40
|
-
|
|
41
|
-
// src/context/TableHeight/Context.ts
|
|
42
|
-
import { createContextEx } from "@xyo-network/react-shared";
|
|
43
|
-
var TableHeightContext = createContextEx();
|
|
44
|
-
|
|
45
|
-
// src/context/TableHeight/Provider.tsx
|
|
46
|
-
import { useEffect, useMemo, useState } from "react";
|
|
47
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
48
|
-
var TableHeightProvider = ({
|
|
49
|
-
children,
|
|
50
|
-
additionalRows = 0,
|
|
51
|
-
defaultVisibleRows,
|
|
52
|
-
heightFormat = "px"
|
|
53
|
-
}) => {
|
|
54
|
-
const [visibleRows, setVisibleRows] = useState(defaultVisibleRows);
|
|
55
|
-
const [height, setHeight] = useState();
|
|
56
|
-
const [rowHeight, setRowHeight] = useState();
|
|
57
|
-
const formattedHeight = useMemo(() => height === void 0 ? void 0 : `${height}${heightFormat}`, [height, heightFormat]);
|
|
58
|
-
useEffect(() => {
|
|
59
|
-
setVisibleRows(defaultVisibleRows);
|
|
60
|
-
}, [defaultVisibleRows]);
|
|
61
|
-
useEffect(() => {
|
|
62
|
-
if (rowHeight !== void 0 && visibleRows !== void 0) {
|
|
63
|
-
setHeight(rowHeight * (visibleRows + additionalRows));
|
|
64
|
-
}
|
|
65
|
-
}, [defaultVisibleRows, rowHeight, visibleRows, additionalRows]);
|
|
66
|
-
return /* @__PURE__ */ jsx3(TableHeightContext.Provider, { value: { height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }, children });
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
// src/context/TableHeight/use.tsx
|
|
70
|
-
import { useContextEx } from "@xyo-network/react-shared";
|
|
71
|
-
var useTableHeight = (required = false) => useContextEx(TableHeightContext, "TableHeight", required);
|
|
72
|
-
export {
|
|
73
|
-
TableCellEx,
|
|
74
|
-
TableEx,
|
|
75
|
-
TableExWithRef,
|
|
76
|
-
TableFooterEx,
|
|
77
|
-
TableHeightContext,
|
|
78
|
-
TableHeightProvider,
|
|
79
|
-
useTableHeight
|
|
80
|
-
};
|
|
81
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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.tsx"],"sourcesContent":["import { styled, TableCell, TableCellProps } 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 { Table, TableProps } from '@mui/material'\nimport { forwardRef, PropsWithChildren } from 'react'\n\nimport { TableExVariants } from './types/index.js'\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 { styled, TableFooter, TableFooterProps } from '@mui/material'\nimport { PropsWithChildren } from 'react'\n\nimport { TableExVariants } from './types/index.js'\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 { TableHeightState } from './State.js'\n\nexport const TableHeightContext = createContextEx<TableHeightState>()\n","import { WithChildren } from '@xylabs/react-shared'\nimport { ContextExProviderProps } from '@xyo-network/react-shared'\nimport { useEffect, useMemo, useState } from 'react'\n\nimport { TableHeightContext } from './Context.js'\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 return (\n <TableHeightContext.Provider value={{ height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }}>\n {children}\n </TableHeightContext.Provider>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { TableHeightContext } from './Context.js'\n\nexport const useTableHeight = (required = false) => useContextEx(TableHeightContext, 'TableHeight', required)\n"],"mappings":";AAAA,SAAS,QAAQ,iBAAiC;AAM3C,IAAM,cAAc,OAAO,WAAW,EAAE,MAAM,sBAAsB,mBAAmB,CAAC,SAAS,SAAS,YAAY,CAAC;AAAA,EAC5H,CAAC,EAAE,YAAY,KAAK,OAAO;AAAA,IACzB,GAAI,aAAa,EAAE,iBAAiB,cAAc;AAAA,EACpD;AACF;;;ACVA,SAAS,aAAyB;AAClC,SAAS,kBAAqC;AAU1C;AAFJ,IAAM,eAAe,WAA2C,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ;AAC/F,SACE,oBAAC,SAAM,KAAW,GAAG,OAClB,UACH;AAEJ,CAAC;AAED,aAAa,cAAc;AAEpB,IAAM,iBAAiB,WAA2C,CAAC,EAAE,SAAS,UAAU,GAAG,MAAM,GAAG,QAAQ;AACjH,SACE,oBAAC,gBAAa,cAAc,YAAY,cAAc,KAAW,GAAG,OACjE,UACH;AAEJ,CAAC;AAED,eAAe,cAAc;AAEtB,IAAM,UAAU;;;AC7BvB,SAAS,UAAAA,SAAQ,mBAAqC;AAuBiC,gBAAAC,YAAA;AAlBvF,IAAM,oBAAoBD,QAAO,aAAa;AAAA,EAC5C,MAAM;AAAA,EACN,mBAAmB,CAAC,aAAa,aAAa;AAAA,EAC9C,MAAM;AACR,CAAC,EAAsB,CAAC,EAAE,SAAS,MAAM,OAAO;AAAA,EAC9C,iBAAiB,MAAM,QAAQ,WAAW;AAAA,EAC1C,QAA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
|
|
2
|
-
import { styled, TableCell } from "@mui/material";
|
|
3
|
-
var TableCellEx = styled(TableCell, { name: "TableCellNoBgColor", shouldForwardProp: (prop) => prop !== "noBgColor" })(
|
|
4
|
-
({ noBgColor = true }) => ({
|
|
5
|
-
...noBgColor && { backgroundColor: "transparent" }
|
|
6
|
-
})
|
|
7
|
-
);
|
|
8
|
-
|
|
9
|
-
// src/components/TableEx/TableEx.tsx
|
|
10
|
-
import { Table } from "@mui/material";
|
|
11
|
-
import { forwardRef } from "react";
|
|
12
|
-
import { jsx } from "react/jsx-runtime";
|
|
13
|
-
var TableExInner = forwardRef(({ children, ...props }, ref) => {
|
|
14
|
-
return /* @__PURE__ */ jsx(Table, { ref, ...props, children });
|
|
15
|
-
});
|
|
16
|
-
TableExInner.displayName = "TableExInner";
|
|
17
|
-
var TableExWithRef = forwardRef(({ variant, children, ...props }, ref) => {
|
|
18
|
-
return /* @__PURE__ */ jsx(TableExInner, { stickyHeader: variant === "scrollable", ref, ...props, children });
|
|
19
|
-
});
|
|
20
|
-
TableExWithRef.displayName = "TableEx";
|
|
21
|
-
var TableEx = TableExWithRef;
|
|
22
|
-
|
|
23
|
-
// src/components/TableEx/TableFooterEx.tsx
|
|
24
|
-
import { styled as styled2, TableFooter } from "@mui/material";
|
|
25
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
26
|
-
var TableFooterExRoot = styled2(TableFooter, {
|
|
27
|
-
name: "TableFooterEx",
|
|
28
|
-
shouldForwardProp: (propName) => propName !== "scrollable",
|
|
29
|
-
slot: "Root"
|
|
30
|
-
})(({ variant, theme }) => ({
|
|
31
|
-
backgroundColor: theme.palette.background.default,
|
|
32
|
-
bottom: "unset",
|
|
33
|
-
position: "relative",
|
|
34
|
-
...variant === "scrollable" && {
|
|
35
|
-
bottom: 0,
|
|
36
|
-
position: "sticky"
|
|
37
|
-
}
|
|
38
|
-
}));
|
|
39
|
-
var TableFooterEx = ({ children, ...props }) => /* @__PURE__ */ jsx2(TableFooterExRoot, { ...props, children });
|
|
40
|
-
|
|
41
|
-
// src/context/TableHeight/Context.ts
|
|
42
|
-
import { createContextEx } from "@xyo-network/react-shared";
|
|
43
|
-
var TableHeightContext = createContextEx();
|
|
44
|
-
|
|
45
|
-
// src/context/TableHeight/Provider.tsx
|
|
46
|
-
import { useEffect, useMemo, useState } from "react";
|
|
47
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
48
|
-
var TableHeightProvider = ({
|
|
49
|
-
children,
|
|
50
|
-
additionalRows = 0,
|
|
51
|
-
defaultVisibleRows,
|
|
52
|
-
heightFormat = "px"
|
|
53
|
-
}) => {
|
|
54
|
-
const [visibleRows, setVisibleRows] = useState(defaultVisibleRows);
|
|
55
|
-
const [height, setHeight] = useState();
|
|
56
|
-
const [rowHeight, setRowHeight] = useState();
|
|
57
|
-
const formattedHeight = useMemo(() => height === void 0 ? void 0 : `${height}${heightFormat}`, [height, heightFormat]);
|
|
58
|
-
useEffect(() => {
|
|
59
|
-
setVisibleRows(defaultVisibleRows);
|
|
60
|
-
}, [defaultVisibleRows]);
|
|
61
|
-
useEffect(() => {
|
|
62
|
-
if (rowHeight !== void 0 && visibleRows !== void 0) {
|
|
63
|
-
setHeight(rowHeight * (visibleRows + additionalRows));
|
|
64
|
-
}
|
|
65
|
-
}, [defaultVisibleRows, rowHeight, visibleRows, additionalRows]);
|
|
66
|
-
return /* @__PURE__ */ jsx3(TableHeightContext.Provider, { value: { height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }, children });
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
// src/context/TableHeight/use.tsx
|
|
70
|
-
import { useContextEx } from "@xyo-network/react-shared";
|
|
71
|
-
var useTableHeight = (required = false) => useContextEx(TableHeightContext, "TableHeight", required);
|
|
72
|
-
export {
|
|
73
|
-
TableCellEx,
|
|
74
|
-
TableEx,
|
|
75
|
-
TableExWithRef,
|
|
76
|
-
TableFooterEx,
|
|
77
|
-
TableHeightContext,
|
|
78
|
-
TableHeightProvider,
|
|
79
|
-
useTableHeight
|
|
80
|
-
};
|
|
81
|
-
//# sourceMappingURL=index.js.map
|
package/dist/node/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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.tsx"],"sourcesContent":["import { styled, TableCell, TableCellProps } 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 { Table, TableProps } from '@mui/material'\nimport { forwardRef, PropsWithChildren } from 'react'\n\nimport { TableExVariants } from './types/index.js'\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 { styled, TableFooter, TableFooterProps } from '@mui/material'\nimport { PropsWithChildren } from 'react'\n\nimport { TableExVariants } from './types/index.js'\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 { TableHeightState } from './State.js'\n\nexport const TableHeightContext = createContextEx<TableHeightState>()\n","import { WithChildren } from '@xylabs/react-shared'\nimport { ContextExProviderProps } from '@xyo-network/react-shared'\nimport { useEffect, useMemo, useState } from 'react'\n\nimport { TableHeightContext } from './Context.js'\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 return (\n <TableHeightContext.Provider value={{ height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }}>\n {children}\n </TableHeightContext.Provider>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { TableHeightContext } from './Context.js'\n\nexport const useTableHeight = (required = false) => useContextEx(TableHeightContext, 'TableHeight', required)\n"],"mappings":";AAAA,SAAS,QAAQ,iBAA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