@xyo-network/react-table 2.77.2 → 2.78.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.
@@ -1,2 +1,104 @@
1
- "use strict";var x=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var W=Object.prototype.hasOwnProperty;var y=(e,o)=>{for(var r in o)x(e,r,{get:o[r],enumerable:!0})},k=(e,o,r,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of R(o))!W.call(e,t)&&t!==r&&x(e,t,{get:()=>o[t],enumerable:!(a=v(o,t))||a.enumerable});return e};var w=e=>k(x({},"__esModule",{value:!0}),e);var L={};y(L,{TableCellEx:()=>B,TableEx:()=>I,TableExWithRef:()=>d,TableFooterEx:()=>N,TableHeightContext:()=>n,TableHeightProvider:()=>S,useTableHeight:()=>V});module.exports=w(L);var s=require("@mui/material"),B=(0,s.styled)(s.TableCell,{name:"TableCellNoBgColor",shouldForwardProp:e=>e!=="noBgColor"})(({noBgColor:e=!0})=>({...e&&{backgroundColor:"transparent"}}));var h=require("@mui/material"),T=require("react"),m=require("react/jsx-runtime"),P=(0,T.forwardRef)(({children:e,...o},r)=>(0,m.jsx)(h.Table,{ref:r,...o,children:e}));P.displayName="TableExInner";var d=(0,T.forwardRef)(({variant:e,children:o,...r},a)=>(0,m.jsx)(P,{stickyHeader:e==="scrollable",ref:a,...r,children:o}));d.displayName="TableEx";var I=d;var p=require("@mui/material"),E=require("react/jsx-runtime"),M=(0,p.styled)(p.TableFooter,{name:"TableFooterEx",shouldForwardProp:e=>e!=="scrollable",slot:"Root"})(({variant:e,theme:o})=>({backgroundColor:o.palette.background.default,bottom:"unset",position:"relative",...e==="scrollable"&&{bottom:0,position:"sticky"}})),N=({children:e,...o})=>(0,E.jsx)(M,{...o,children:e});var C=require("@xyo-network/react-shared"),n=(0,C.createContextEx)();var l=require("react");var c=require("react/jsx-runtime"),S=({children:e,additionalRows:o=0,defaultVisibleRows:r,heightFormat:a="px"})=>{let[t,f]=(0,l.useState)(r),[b,u]=(0,l.useState)(),[i,H]=(0,l.useState)(),F=(0,l.useMemo)(()=>b===void 0?void 0:`${b}${a}`,[b,a]);return(0,l.useEffect)(()=>{f(r)},[r]),(0,l.useEffect)(()=>{i!==void 0&&t!==void 0&&u(i*(t+o))},[r,i,t,o]),(0,c.jsx)(n.Provider,{value:{height:F,provided:!0,rowHeight:i,setRowHeight:H,setVisibleRows:f,visibleRows:t},children:e})};var g=require("@xyo-network/react-shared");var V=(e=!1)=>(0,g.useContextEx)(n,"TableHeight",e);
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ TableCellEx: () => TableCellEx,
24
+ TableEx: () => TableEx,
25
+ TableExWithRef: () => TableExWithRef,
26
+ TableFooterEx: () => TableFooterEx,
27
+ TableHeightContext: () => TableHeightContext,
28
+ TableHeightProvider: () => TableHeightProvider,
29
+ useTableHeight: () => useTableHeight
30
+ });
31
+ module.exports = __toCommonJS(src_exports);
32
+
33
+ // src/components/TableEx/TableCellEx.tsx
34
+ var import_material = require("@mui/material");
35
+ var TableCellEx = (0, import_material.styled)(import_material.TableCell, { name: "TableCellNoBgColor", shouldForwardProp: (prop) => prop !== "noBgColor" })(
36
+ ({ noBgColor = true }) => ({
37
+ ...noBgColor && { backgroundColor: "transparent" }
38
+ })
39
+ );
40
+
41
+ // src/components/TableEx/TableEx.tsx
42
+ var import_material2 = require("@mui/material");
43
+ var import_react = require("react");
44
+ var import_jsx_runtime = require("react/jsx-runtime");
45
+ var TableExInner = (0, import_react.forwardRef)(({ children, ...props }, ref) => {
46
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material2.Table, { ref, ...props, children });
47
+ });
48
+ TableExInner.displayName = "TableExInner";
49
+ var TableExWithRef = (0, import_react.forwardRef)(({ variant, children, ...props }, ref) => {
50
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableExInner, { stickyHeader: variant === "scrollable", ref, ...props, children });
51
+ });
52
+ TableExWithRef.displayName = "TableEx";
53
+ var TableEx = TableExWithRef;
54
+
55
+ // src/components/TableEx/TableFooterEx.tsx
56
+ var import_material3 = require("@mui/material");
57
+ var import_jsx_runtime2 = require("react/jsx-runtime");
58
+ var TableFooterExRoot = (0, import_material3.styled)(import_material3.TableFooter, {
59
+ name: "TableFooterEx",
60
+ shouldForwardProp: (propName) => propName !== "scrollable",
61
+ slot: "Root"
62
+ })(({ variant, theme }) => ({
63
+ backgroundColor: theme.palette.background.default,
64
+ bottom: "unset",
65
+ position: "relative",
66
+ ...variant === "scrollable" && {
67
+ bottom: 0,
68
+ position: "sticky"
69
+ }
70
+ }));
71
+ var TableFooterEx = ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TableFooterExRoot, { ...props, children });
72
+
73
+ // src/context/TableHeight/Context.ts
74
+ var import_react_shared = require("@xyo-network/react-shared");
75
+ var TableHeightContext = (0, import_react_shared.createContextEx)();
76
+
77
+ // src/context/TableHeight/Provider.tsx
78
+ var import_react2 = require("react");
79
+ var import_jsx_runtime3 = require("react/jsx-runtime");
80
+ var TableHeightProvider = ({
81
+ children,
82
+ additionalRows = 0,
83
+ defaultVisibleRows,
84
+ heightFormat = "px"
85
+ }) => {
86
+ const [visibleRows, setVisibleRows] = (0, import_react2.useState)(defaultVisibleRows);
87
+ const [height, setHeight] = (0, import_react2.useState)();
88
+ const [rowHeight, setRowHeight] = (0, import_react2.useState)();
89
+ const formattedHeight = (0, import_react2.useMemo)(() => height === void 0 ? void 0 : `${height}${heightFormat}`, [height, heightFormat]);
90
+ (0, import_react2.useEffect)(() => {
91
+ setVisibleRows(defaultVisibleRows);
92
+ }, [defaultVisibleRows]);
93
+ (0, import_react2.useEffect)(() => {
94
+ if (rowHeight !== void 0 && visibleRows !== void 0) {
95
+ setHeight(rowHeight * (visibleRows + additionalRows));
96
+ }
97
+ }, [defaultVisibleRows, rowHeight, visibleRows, additionalRows]);
98
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TableHeightContext.Provider, { value: { height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }, children });
99
+ };
100
+
101
+ // src/context/TableHeight/use.tsx
102
+ var import_react_shared2 = require("@xyo-network/react-shared");
103
+ var useTableHeight = (required = false) => (0, import_react_shared2.useContextEx)(TableHeightContext, "TableHeight", required);
2
104
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../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":["export * from './components'\nexport * from './context'\nexport * from './types'\n","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'\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'\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'\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'\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'\n\nexport const useTableHeight = (required = false) => useContextEx(TableHeightContext, 'TableHeight', required)\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,EAAA,YAAAC,EAAA,mBAAAC,EAAA,kBAAAC,EAAA,uBAAAC,EAAA,wBAAAC,EAAA,mBAAAC,IAAA,eAAAC,EAAAT,GCAA,IAAAU,EAAkD,yBAMrCC,KAAc,UAAO,YAAW,CAAE,KAAM,qBAAsB,kBAAoBC,GAASA,IAAS,WAAY,CAAC,EAC5H,CAAC,CAAE,UAAAC,EAAY,EAAK,KAAO,CACzB,GAAIA,GAAa,CAAE,gBAAiB,aAAc,CACpD,EACF,ECVA,IAAAC,EAAkC,yBAClCC,EAA8C,iBAU1CC,EAAA,6BAFEC,KAAe,cAA2C,CAAC,CAAE,SAAAC,EAAU,GAAGC,CAAM,EAAGC,OAErF,OAAC,SAAM,IAAKA,EAAM,GAAGD,EAClB,SAAAD,EACH,CAEH,EAEDD,EAAa,YAAc,eAEpB,IAAMI,KAAiB,cAA2C,CA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,CAAc,CAAC,KAG7D,OAACU,EAAmB,SAAnB,CAA4B,MAAO,CAAE,OAAQD,EAAiB,SAAU,GAAM,UAAAF,EAAW,aAAAC,EAAc,eAAAJ,EAAgB,YAAAD,CAAY,EACjI,SAAAJ,EACH,CAEJ,ECxCA,IAAAY,EAA6B,qCAItB,IAAMC,EAAiB,CAACC,EAAW,QAAU,gBAAaC,EAAoB,cAAeD,CAAQ","names":["src_exports","__export","TableCellEx","TableEx","TableExWithRef","TableFooterEx","TableHeightContext","TableHeightProvider","useTableHeight","__toCommonJS","import_material","TableCellEx","prop","noBgColor","import_material","import_react","import_jsx_runtime","TableExInner","children","props","ref","TableExWithRef","variant","TableEx","import_material","import_jsx_runtime","TableFooterExRoot","propName","variant","theme","TableFooterEx","children","props","import_react_shared","TableHeightContext","import_react","import_jsx_runtime","TableHeightProvider","children","additionalRows","defaultVisibleRows","heightFormat","visibleRows","setVisibleRows","height","setHeight","rowHeight","setRowHeight","formattedHeight","TableHeightContext","import_react_shared","useTableHeight","required","TableHeightContext"]}
1
+ {"version":3,"sources":["../../src/index.ts","../../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":["export * from './components'\nexport * from './context'\nexport * from './types'\n","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'\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'\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'\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'\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'\n\nexport const useTableHeight = (required = false) => useContextEx(TableHeightContext, 'TableHeight', required)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,sBAAkD;AAM3C,IAAM,kBAAc,wBAAO,2BAAW,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,IAAAA,mBAAkC;AAClC,mBAA8C;AAU1C;AAFJ,IAAM,mBAAe,yBAA2C,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ;AAC/F,SACE,4CAAC,0BAAM,KAAW,GAAG,OAClB,UACH;AAEJ,CAAC;AAED,aAAa,cAAc;AAEpB,IAAM,qBAAiB,yBAA2C,CAAC,EAAE,SAAS,UAAU,GAAG,MAAM,GAAG,QAAQ;AACjH,SACE,4CAAC,gBAAa,cAAc,YAAY,cAAc,KAAW,GAAG,OACjE,UACH;AAEJ,CAAC;AAED,eAAe,cAAc;AAEtB,IAAM,UAAU;;;AC7BvB,IAAAC,mBAAsD;AAu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Y,GACjI,UACH;AAEJ;;;ACxCA,IAAAC,uBAA6B;AAItB,IAAM,iBAAiB,CAAC,WAAW,cAAU,mCAAa,oBAAoB,eAAe,QAAQ;","names":["import_material","import_material","import_jsx_runtime","import_react","import_jsx_runtime","import_react_shared"]}
@@ -1,2 +1,81 @@
1
- import{styled as E,TableCell as C}from"@mui/material";var B=E(C,{name:"TableCellNoBgColor",shouldForwardProp:e=>e!=="noBgColor"})(({noBgColor:e=!0})=>({...e&&{backgroundColor:"transparent"}}));import{Table as c}from"@mui/material";import{forwardRef as b}from"react";import{jsx as d}from"react/jsx-runtime";var x=b(({children:e,...o},r)=>d(c,{ref:r,...o,children:e}));x.displayName="TableExInner";var T=b(({variant:e,children:o,...r},t)=>d(x,{stickyHeader:e==="scrollable",ref:t,...r,children:o}));T.displayName="TableEx";var L=T;import{styled as g,TableFooter as u}from"@mui/material";import{jsx as F}from"react/jsx-runtime";var H=g(u,{name:"TableFooterEx",shouldForwardProp:e=>e!=="scrollable",slot:"Root"})(({variant:e,theme:o})=>({backgroundColor:o.palette.background.default,bottom:"unset",position:"relative",...e==="scrollable"&&{bottom:0,position:"sticky"}})),D=({children:e,...o})=>F(H,{...o,children:e});import{createContextEx as v}from"@xyo-network/react-shared";var n=v();import{useEffect as m,useMemo as R,useState as s}from"react";import{jsx as W}from"react/jsx-runtime";var X=({children:e,additionalRows:o=0,defaultVisibleRows:r,heightFormat:t="px"})=>{let[l,p]=s(r),[i,f]=s(),[a,h]=s(),P=R(()=>i===void 0?void 0:`${i}${t}`,[i,t]);return m(()=>{p(r)},[r]),m(()=>{a!==void 0&&l!==void 0&&f(a*(l+o))},[r,a,l,o]),W(n.Provider,{value:{height:P,provided:!0,rowHeight:a,setRowHeight:h,setVisibleRows:p,visibleRows:l},children:e})};import{useContextEx as y}from"@xyo-network/react-shared";var ee=(e=!1)=>y(n,"TableHeight",e);export{B as TableCellEx,L as TableEx,T as TableExWithRef,D as TableFooterEx,n as TableHeightContext,X as TableHeightProvider,ee as useTableHeight};
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
+ };
2
81
  //# sourceMappingURL=index.js.map
@@ -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.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'\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'\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'\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'\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'\n\nexport const useTableHeight = (required = false) => useContextEx(TableHeightContext, 'TableHeight', required)\n"],"mappings":"AAAA,OAAS,UAAAA,EAAQ,aAAAC,MAAiC,gBAM3C,IAAMC,EAAcF,EAAOC,EAAW,CAAE,KAAM,qBAAsB,kBAAoBE,GAASA,IAAS,WAAY,CAAC,EAC5H,CAAC,CAAE,UAAAC,EAAY,EAAK,KAAO,CACzB,GAAIA,GAAa,CAAE,gBAAiB,aAAc,CACpD,EACF,ECVA,OAAS,SAAAC,MAAyB,gBAClC,OAAS,cAAAC,MAAqC,QAU1C,cAAAC,MAAA,oBAFJ,IAAMC,EAAeF,EAA2C,CAAC,CAAE,SAAAG,EAAU,GAAGC,CAAM,EAAGC,IAErFJ,EAACF,EAAA,CAAM,IAAKM,EAAM,GAAGD,EAClB,SAAAD,EACH,CAEH,EAEDD,EAAa,YAAc,eAEpB,IAAMI,EAAiBN,EAA2C,CAAC,CAAE,QAAAO,EAAS,SAAAJ,EAAU,GAAGC,CAAM,EAAGC,IAEvGJ,EAACC,EAAA,CAAa,aAAcK,IAAY,aAAc,IAAKF,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AAC,EAG7DH,EAACgB,EAAmB,SAAnB,CAA4B,MAAO,CAAE,OAAQH,EAAiB,SAAU,GAAM,UAAAF,EAAW,aAAAC,EAAc,eAAAL,EAAgB,YAAAD,CAAY,EACjI,SAAAJ,EACH,CAEJ,ECxCA,OAAS,gBAAAe,MAAoB,4BAItB,IAAMC,GAAiB,CAACC,EAAW,KAAUC,EAAaC,EAAoB,cAAeF,CAAQ","names":["styled","TableCell","TableCellEx","prop","noBgColor","Table","forwardRef","jsx","TableExInner","children","props","ref","TableExWithRef","variant","TableEx","styled","TableFooter","jsx","TableFooterExRoot","propName","variant","theme","TableFooterEx","children","props","createContextEx","TableHeightContext","useEffect","useMemo","useState","jsx","TableHeightProvider","children","additionalRows","defaultVisibleRows","heightFormat","visibleRows","setVisibleRows","useState","height","setHeight","rowHeight","setRowHeight","formattedHeight","useMemo","useEffect","TableHeightContext","useContextEx","useTableHeight","required","useContextEx","TableHeightContext"]}
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'\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'\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'\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'\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'\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,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
1
- "use strict";var x=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var W=Object.prototype.hasOwnProperty;var y=(e,o)=>{for(var r in o)x(e,r,{get:o[r],enumerable:!0})},k=(e,o,r,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of R(o))!W.call(e,t)&&t!==r&&x(e,t,{get:()=>o[t],enumerable:!(a=v(o,t))||a.enumerable});return e};var w=e=>k(x({},"__esModule",{value:!0}),e);var L={};y(L,{TableCellEx:()=>B,TableEx:()=>I,TableExWithRef:()=>d,TableFooterEx:()=>N,TableHeightContext:()=>n,TableHeightProvider:()=>S,useTableHeight:()=>V});module.exports=w(L);var s=require("@mui/material"),B=(0,s.styled)(s.TableCell,{name:"TableCellNoBgColor",shouldForwardProp:e=>e!=="noBgColor"})(({noBgColor:e=!0})=>({...e&&{backgroundColor:"transparent"}}));var h=require("@mui/material"),T=require("react"),m=require("react/jsx-runtime"),P=(0,T.forwardRef)(({children:e,...o},r)=>(0,m.jsx)(h.Table,{ref:r,...o,children:e}));P.displayName="TableExInner";var d=(0,T.forwardRef)(({variant:e,children:o,...r},a)=>(0,m.jsx)(P,{stickyHeader:e==="scrollable",ref:a,...r,children:o}));d.displayName="TableEx";var I=d;var p=require("@mui/material"),E=require("react/jsx-runtime"),M=(0,p.styled)(p.TableFooter,{name:"TableFooterEx",shouldForwardProp:e=>e!=="scrollable",slot:"Root"})(({variant:e,theme:o})=>({backgroundColor:o.palette.background.default,bottom:"unset",position:"relative",...e==="scrollable"&&{bottom:0,position:"sticky"}})),N=({children:e,...o})=>(0,E.jsx)(M,{...o,children:e});var C=require("@xyo-network/react-shared"),n=(0,C.createContextEx)();var l=require("react");var c=require("react/jsx-runtime"),S=({children:e,additionalRows:o=0,defaultVisibleRows:r,heightFormat:a="px"})=>{let[t,f]=(0,l.useState)(r),[b,u]=(0,l.useState)(),[i,H]=(0,l.useState)(),F=(0,l.useMemo)(()=>b===void 0?void 0:`${b}${a}`,[b,a]);return(0,l.useEffect)(()=>{f(r)},[r]),(0,l.useEffect)(()=>{i!==void 0&&t!==void 0&&u(i*(t+o))},[r,i,t,o]),(0,c.jsx)(n.Provider,{value:{height:F,provided:!0,rowHeight:i,setRowHeight:H,setVisibleRows:f,visibleRows:t},children:e})};var g=require("@xyo-network/react-shared");var V=(e=!1)=>(0,g.useContextEx)(n,"TableHeight",e);
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ TableCellEx: () => TableCellEx,
24
+ TableEx: () => TableEx,
25
+ TableExWithRef: () => TableExWithRef,
26
+ TableFooterEx: () => TableFooterEx,
27
+ TableHeightContext: () => TableHeightContext,
28
+ TableHeightProvider: () => TableHeightProvider,
29
+ useTableHeight: () => useTableHeight
30
+ });
31
+ module.exports = __toCommonJS(src_exports);
32
+
33
+ // src/components/TableEx/TableCellEx.tsx
34
+ var import_material = require("@mui/material");
35
+ var TableCellEx = (0, import_material.styled)(import_material.TableCell, { name: "TableCellNoBgColor", shouldForwardProp: (prop) => prop !== "noBgColor" })(
36
+ ({ noBgColor = true }) => ({
37
+ ...noBgColor && { backgroundColor: "transparent" }
38
+ })
39
+ );
40
+
41
+ // src/components/TableEx/TableEx.tsx
42
+ var import_material2 = require("@mui/material");
43
+ var import_react = require("react");
44
+ var import_jsx_runtime = require("react/jsx-runtime");
45
+ var TableExInner = (0, import_react.forwardRef)(({ children, ...props }, ref) => {
46
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material2.Table, { ref, ...props, children });
47
+ });
48
+ TableExInner.displayName = "TableExInner";
49
+ var TableExWithRef = (0, import_react.forwardRef)(({ variant, children, ...props }, ref) => {
50
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableExInner, { stickyHeader: variant === "scrollable", ref, ...props, children });
51
+ });
52
+ TableExWithRef.displayName = "TableEx";
53
+ var TableEx = TableExWithRef;
54
+
55
+ // src/components/TableEx/TableFooterEx.tsx
56
+ var import_material3 = require("@mui/material");
57
+ var import_jsx_runtime2 = require("react/jsx-runtime");
58
+ var TableFooterExRoot = (0, import_material3.styled)(import_material3.TableFooter, {
59
+ name: "TableFooterEx",
60
+ shouldForwardProp: (propName) => propName !== "scrollable",
61
+ slot: "Root"
62
+ })(({ variant, theme }) => ({
63
+ backgroundColor: theme.palette.background.default,
64
+ bottom: "unset",
65
+ position: "relative",
66
+ ...variant === "scrollable" && {
67
+ bottom: 0,
68
+ position: "sticky"
69
+ }
70
+ }));
71
+ var TableFooterEx = ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TableFooterExRoot, { ...props, children });
72
+
73
+ // src/context/TableHeight/Context.ts
74
+ var import_react_shared = require("@xyo-network/react-shared");
75
+ var TableHeightContext = (0, import_react_shared.createContextEx)();
76
+
77
+ // src/context/TableHeight/Provider.tsx
78
+ var import_react2 = require("react");
79
+ var import_jsx_runtime3 = require("react/jsx-runtime");
80
+ var TableHeightProvider = ({
81
+ children,
82
+ additionalRows = 0,
83
+ defaultVisibleRows,
84
+ heightFormat = "px"
85
+ }) => {
86
+ const [visibleRows, setVisibleRows] = (0, import_react2.useState)(defaultVisibleRows);
87
+ const [height, setHeight] = (0, import_react2.useState)();
88
+ const [rowHeight, setRowHeight] = (0, import_react2.useState)();
89
+ const formattedHeight = (0, import_react2.useMemo)(() => height === void 0 ? void 0 : `${height}${heightFormat}`, [height, heightFormat]);
90
+ (0, import_react2.useEffect)(() => {
91
+ setVisibleRows(defaultVisibleRows);
92
+ }, [defaultVisibleRows]);
93
+ (0, import_react2.useEffect)(() => {
94
+ if (rowHeight !== void 0 && visibleRows !== void 0) {
95
+ setHeight(rowHeight * (visibleRows + additionalRows));
96
+ }
97
+ }, [defaultVisibleRows, rowHeight, visibleRows, additionalRows]);
98
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TableHeightContext.Provider, { value: { height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }, children });
99
+ };
100
+
101
+ // src/context/TableHeight/use.tsx
102
+ var import_react_shared2 = require("@xyo-network/react-shared");
103
+ var useTableHeight = (required = false) => (0, import_react_shared2.useContextEx)(TableHeightContext, "TableHeight", required);
2
104
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../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":["export * from './components'\nexport * from './context'\nexport * from './types'\n","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'\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'\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'\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'\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'\n\nexport const useTableHeight = (required = false) => useContextEx(TableHeightContext, 'TableHeight', required)\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,EAAA,YAAAC,EAAA,mBAAAC,EAAA,kBAAAC,EAAA,uBAAAC,EAAA,wBAAAC,EAAA,mBAAAC,IAAA,eAAAC,EAAAT,GCAA,IAAAU,EAAkD,yBAMrCC,KAAc,UAAO,YAAW,CAAE,KAAM,qBAAsB,kBAAoBC,GAASA,IAAS,WAAY,CAAC,EAC5H,CAAC,CAAE,UAAAC,EAAY,EAAK,KAAO,CACzB,GAAIA,GAAa,CAAE,gBAAiB,aAAc,CACpD,EACF,ECVA,IAAAC,EAAkC,yBAClCC,EAA8C,iBAU1CC,EAAA,6BAFEC,KAAe,cAA2C,CAAC,CAAE,SAAAC,EAAU,GAAGC,CAAM,EAAGC,OAErF,OAAC,SAAM,IAAKA,EAAM,GAAGD,EAClB,SAAAD,EACH,CAEH,EAEDD,EAAa,YAAc,eAEpB,IAAMI,KAAiB,cAA2C,CAAC,CAAE,QAAAC,EAAS,SAAAJ,EAAU,GAAGC,CAAM,EAAGC,OAEvG,OAACH,EAAA,CAAa,aAAcK,IAAY,aAAc,IAAKF,EAAM,GAAGD,EACjE,SA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AAD,CAAY,EACjI,SAAAJ,EACH,CAEJ,ECxCA,IAAAY,EAA6B,qCAItB,IAAMC,EAAiB,CAACC,EAAW,QAAU,gBAAaC,EAAoB,cAAeD,CAAQ","names":["src_exports","__export","TableCellEx","TableEx","TableExWithRef","TableFooterEx","TableHeightContext","TableHeightProvider","useTableHeight","__toCommonJS","import_material","TableCellEx","prop","noBgColor","import_material","import_react","import_jsx_runtime","TableExInner","children","props","ref","TableExWithRef","variant","TableEx","import_material","import_jsx_runtime","TableFooterExRoot","propName","variant","theme","TableFooterEx","children","props","import_react_shared","TableHeightContext","import_react","import_jsx_runtime","TableHeightProvider","children","additionalRows","defaultVisibleRows","heightFormat","visibleRows","setVisibleRows","height","setHeight","rowHeight","setRowHeight","formattedHeight","TableHeightContext","import_react_shared","useTableHeight","required","TableHeightContext"]}
1
+ {"version":3,"sources":["../../src/index.ts","../../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":["export * from './components'\nexport * from './context'\nexport * from './types'\n","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'\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'\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'\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'\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'\n\nexport const useTableHeight = (required = false) => useContextEx(TableHeightContext, 'TableHeight', required)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,sBAAkD;AAM3C,IAAM,kBAAc,wBAAO,2BAAW,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,IAAAA,mBAAkC;AAClC,mBAA8C;AAU1C;AAFJ,IAAM,mBAAe,yBAA2C,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ;AAC/F,SACE,4CAAC,0BAAM,KAAW,GAAG,OAClB,UACH;AAEJ,CAAC;AAED,aAAa,cAAc;AAEpB,IAAM,qBAAiB,yBAA2C,CAAC,EAAE,SAAS,UAAU,GAAG,MAAM,GAAG,QAAQ;AACjH,SACE,4CAAC,gBAAa,cAAc,YAAY,cAAc,KAAW,GAAG,OACjE,UACH;AAEJ,CAAC;AAED,eAAe,cAAc;AAEtB,IAAM,UAAU;;;AC7BvB,IAAAC,mBAAsD;AAuBiC,IAAAC,sBAAA;AAlBvF,IAAM,wBAAoB,yBAAO,8BAAa;AAAA,EAC5C,MAAM;AAAA,EACN,mBAAmB,CAAC,aAAa,aAAa;AAAA,EAC9C,MAAM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sx_runtime","import_react","import_jsx_runtime","import_react_shared"]}
@@ -1,2 +1,81 @@
1
- import{styled as E,TableCell as C}from"@mui/material";var B=E(C,{name:"TableCellNoBgColor",shouldForwardProp:e=>e!=="noBgColor"})(({noBgColor:e=!0})=>({...e&&{backgroundColor:"transparent"}}));import{Table as c}from"@mui/material";import{forwardRef as b}from"react";import{jsx as d}from"react/jsx-runtime";var x=b(({children:e,...o},r)=>d(c,{ref:r,...o,children:e}));x.displayName="TableExInner";var T=b(({variant:e,children:o,...r},t)=>d(x,{stickyHeader:e==="scrollable",ref:t,...r,children:o}));T.displayName="TableEx";var L=T;import{styled as g,TableFooter as u}from"@mui/material";import{jsx as F}from"react/jsx-runtime";var H=g(u,{name:"TableFooterEx",shouldForwardProp:e=>e!=="scrollable",slot:"Root"})(({variant:e,theme:o})=>({backgroundColor:o.palette.background.default,bottom:"unset",position:"relative",...e==="scrollable"&&{bottom:0,position:"sticky"}})),D=({children:e,...o})=>F(H,{...o,children:e});import{createContextEx as v}from"@xyo-network/react-shared";var n=v();import{useEffect as m,useMemo as R,useState as s}from"react";import{jsx as W}from"react/jsx-runtime";var X=({children:e,additionalRows:o=0,defaultVisibleRows:r,heightFormat:t="px"})=>{let[l,p]=s(r),[i,f]=s(),[a,h]=s(),P=R(()=>i===void 0?void 0:`${i}${t}`,[i,t]);return m(()=>{p(r)},[r]),m(()=>{a!==void 0&&l!==void 0&&f(a*(l+o))},[r,a,l,o]),W(n.Provider,{value:{height:P,provided:!0,rowHeight:a,setRowHeight:h,setVisibleRows:p,visibleRows:l},children:e})};import{useContextEx as y}from"@xyo-network/react-shared";var ee=(e=!1)=>y(n,"TableHeight",e);export{B as TableCellEx,L as TableEx,T as TableExWithRef,D as TableFooterEx,n as TableHeightContext,X as TableHeightProvider,ee as useTableHeight};
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
+ };
2
81
  //# sourceMappingURL=index.js.map
@@ -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.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'\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'\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'\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'\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'\n\nexport const useTableHeight = (required = false) => useContextEx(TableHeightContext, 'TableHeight', required)\n"],"mappings":"AAAA,OAAS,UAAAA,EAAQ,aAAAC,MAAiC,gBAM3C,IAAMC,EAAcF,EAAOC,EAAW,CAAE,KAAM,qBAAsB,kBAAoBE,GAASA,IAAS,WAAY,CAAC,EAC5H,CAAC,CAAE,UAAAC,EAAY,EAAK,KAAO,CACzB,GAAIA,GAAa,CAAE,gBAAiB,aAAc,CACpD,EACF,ECVA,OAAS,SAAAC,MAAyB,gBAClC,OAAS,cAAAC,MAAqC,QAU1C,cAAAC,MAAA,oBAFJ,IAAMC,EAAeF,EAA2C,CAAC,CAAE,SAAAG,EAAU,GAAGC,CAAM,EAAGC,IAErFJ,EAACF,EAAA,CAAM,IAAKM,EAAM,GAAGD,EAClB,SAAAD,EACH,CAEH,EAEDD,EAAa,YAAc,eAEpB,IAAMI,EAAiBN,EAA2C,CAAC,CAAE,QAAAO,EAAS,SAAAJ,EAAU,GAAGC,CAAM,EAAGC,IAEvGJ,EAACC,EAAA,CAAa,aAAcK,IAAY,aAAc,IAAKF,EAAM,GAAGD,EACjE,SAAAD,EACH,CAEH,EAEDG,EAAe,YAAc,UAEtB,IAAME,EAAUF,EC7BvB,OAAS,UAAAG,EAAQ,eAAAC,MAAqC,gBAuBiC,c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AY,EACjI,SAAAJ,EACH,CAEJ,ECxCA,OAAS,gBAAAe,MAAoB,4BAItB,IAAMC,GAAiB,CAACC,EAAW,KAAUC,EAAaC,EAAoB,cAAeF,CAAQ","names":["styled","TableCell","TableCellEx","prop","noBgColor","Table","forwardRef","jsx","TableExInner","children","props","ref","TableExWithRef","variant","TableEx","styled","TableFooter","jsx","TableFooterExRoot","propName","variant","theme","TableFooterEx","children","props","createContextEx","TableHeightContext","useEffect","useMemo","useState","jsx","TableHeightProvider","children","additionalRows","defaultVisibleRows","heightFormat","visibleRows","setVisibleRows","useState","height","setHeight","rowHeight","setRowHeight","formattedHeight","useMemo","useEffect","TableHeightContext","useContextEx","useTableHeight","required","useContextEx","TableHeightContext"]}
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'\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'\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'\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'\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'\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,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,GAAI,YAAY,gBAAgB;AAAA,IAC9B,QAAQ;AAAA,IACR,UAAU;AAAA,EACZ;AACF,EAAE;AAMK,IAAM,gBAA8C,CAAC,EAAE,UAAU,GAAG,MAAM,MAAM,gBAAAC,KAAC,qBAAmB,GAAG,OAAQ,UAAS;;;ACvB/H,SAAS,uBAAuB;AAIzB,IAAM,qBAAqB,gBAAkC;;;ACFpE,SAAS,WAAW,SAAS,gBAAgB;AAkCzC,gBAAAC,YAAA;AAvBG,IAAM,sBAA0D,CAAC;AAAA,EACtE;AAAA,EACA,iBAAiB;AAAA,EACjB;AAAA,EACA,eAAe;AACjB,MAAM;AACJ,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,kBAAkB;AACjE,QAAM,CAAC,QAAQ,SAAS,IAAI,SAA6B;AACzD,QAAM,CAAC,WAAW,YAAY,IAAI,SAA6B;AAE/D,QAAM,kBAAkB,QAAQ,MAAO,WAAW,SAAY,SAAY,GAAG,MAAM,GAAG,YAAY,IAAK,CAAC,QAAQ,YAAY,CAAC;AAE7H,YAAU,MAAM;AACd,mBAAe,kBAAkB;AAAA,EACnC,GAAG,CAAC,kBAAkB,CAAC;AAEvB,YAAU,MAAM;AACd,QAAI,cAAc,UAAa,gBAAgB,QAAW;AACxD,gBAAU,aAAa,cAAc,eAAe;AAAA,IACtD;AAAA,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"]}
@@ -1,2 +1,114 @@
1
- "use strict";var x=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var W=Object.prototype.hasOwnProperty;var y=(e,o)=>{for(var r in o)x(e,r,{get:o[r],enumerable:!0})},k=(e,o,r,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of R(o))!W.call(e,t)&&t!==r&&x(e,t,{get:()=>o[t],enumerable:!(a=v(o,t))||a.enumerable});return e};var w=e=>k(x({},"__esModule",{value:!0}),e);var L={};y(L,{TableCellEx:()=>B,TableEx:()=>I,TableExWithRef:()=>d,TableFooterEx:()=>N,TableHeightContext:()=>n,TableHeightProvider:()=>S,useTableHeight:()=>V});module.exports=w(L);var s=require("@mui/material"),B=(0,s.styled)(s.TableCell,{name:"TableCellNoBgColor",shouldForwardProp:e=>e!=="noBgColor"})(({noBgColor:e=!0})=>({...e&&{backgroundColor:"transparent"}}));var h=require("@mui/material"),T=require("react"),m=require("react/jsx-runtime"),P=(0,T.forwardRef)(({children:e,...o},r)=>(0,m.jsx)(h.Table,{ref:r,...o,children:e}));P.displayName="TableExInner";var d=(0,T.forwardRef)(({variant:e,children:o,...r},a)=>(0,m.jsx)(P,{stickyHeader:e==="scrollable",ref:a,...r,children:o}));d.displayName="TableEx";var I=d;var p=require("@mui/material"),E=require("react/jsx-runtime"),M=(0,p.styled)(p.TableFooter,{name:"TableFooterEx",shouldForwardProp:e=>e!=="scrollable",slot:"Root"})(({variant:e,theme:o})=>({backgroundColor:o.palette.background.default,bottom:"unset",position:"relative",...e==="scrollable"&&{bottom:0,position:"sticky"}})),N=({children:e,...o})=>(0,E.jsx)(M,{...o,children:e});var C=require("@xyo-network/react-shared"),n=(0,C.createContextEx)();var l=require("react");var c=require("react/jsx-runtime"),S=({children:e,additionalRows:o=0,defaultVisibleRows:r,heightFormat:a="px"})=>{let[t,f]=(0,l.useState)(r),[b,u]=(0,l.useState)(),[i,H]=(0,l.useState)(),F=(0,l.useMemo)(()=>b===void 0?void 0:`${b}${a}`,[b,a]);return(0,l.useEffect)(()=>{f(r)},[r]),(0,l.useEffect)(()=>{i!==void 0&&t!==void 0&&u(i*(t+o))},[r,i,t,o]),(0,c.jsx)(n.Provider,{value:{height:F,provided:!0,rowHeight:i,setRowHeight:H,setVisibleRows:f,visibleRows:t},children:e})};var g=require("@xyo-network/react-shared");var V=(e=!1)=>(0,g.useContextEx)(n,"TableHeight",e);0&&(module.exports={TableCellEx,TableEx,TableExWithRef,TableFooterEx,TableHeightContext,TableHeightProvider,useTableHeight});
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ TableCellEx: () => TableCellEx,
24
+ TableEx: () => TableEx,
25
+ TableExWithRef: () => TableExWithRef,
26
+ TableFooterEx: () => TableFooterEx,
27
+ TableHeightContext: () => TableHeightContext,
28
+ TableHeightProvider: () => TableHeightProvider,
29
+ useTableHeight: () => useTableHeight
30
+ });
31
+ module.exports = __toCommonJS(src_exports);
32
+
33
+ // src/components/TableEx/TableCellEx.tsx
34
+ var import_material = require("@mui/material");
35
+ var TableCellEx = (0, import_material.styled)(import_material.TableCell, { name: "TableCellNoBgColor", shouldForwardProp: (prop) => prop !== "noBgColor" })(
36
+ ({ noBgColor = true }) => ({
37
+ ...noBgColor && { backgroundColor: "transparent" }
38
+ })
39
+ );
40
+
41
+ // src/components/TableEx/TableEx.tsx
42
+ var import_material2 = require("@mui/material");
43
+ var import_react = require("react");
44
+ var import_jsx_runtime = require("react/jsx-runtime");
45
+ var TableExInner = (0, import_react.forwardRef)(({ children, ...props }, ref) => {
46
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material2.Table, { ref, ...props, children });
47
+ });
48
+ TableExInner.displayName = "TableExInner";
49
+ var TableExWithRef = (0, import_react.forwardRef)(({ variant, children, ...props }, ref) => {
50
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableExInner, { stickyHeader: variant === "scrollable", ref, ...props, children });
51
+ });
52
+ TableExWithRef.displayName = "TableEx";
53
+ var TableEx = TableExWithRef;
54
+
55
+ // src/components/TableEx/TableFooterEx.tsx
56
+ var import_material3 = require("@mui/material");
57
+ var import_jsx_runtime2 = require("react/jsx-runtime");
58
+ var TableFooterExRoot = (0, import_material3.styled)(import_material3.TableFooter, {
59
+ name: "TableFooterEx",
60
+ shouldForwardProp: (propName) => propName !== "scrollable",
61
+ slot: "Root"
62
+ })(({ variant, theme }) => ({
63
+ backgroundColor: theme.palette.background.default,
64
+ bottom: "unset",
65
+ position: "relative",
66
+ ...variant === "scrollable" && {
67
+ bottom: 0,
68
+ position: "sticky"
69
+ }
70
+ }));
71
+ var TableFooterEx = ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TableFooterExRoot, { ...props, children });
72
+
73
+ // src/context/TableHeight/Context.ts
74
+ var import_react_shared = require("@xyo-network/react-shared");
75
+ var TableHeightContext = (0, import_react_shared.createContextEx)();
76
+
77
+ // src/context/TableHeight/Provider.tsx
78
+ var import_react2 = require("react");
79
+ var import_jsx_runtime3 = require("react/jsx-runtime");
80
+ var TableHeightProvider = ({
81
+ children,
82
+ additionalRows = 0,
83
+ defaultVisibleRows,
84
+ heightFormat = "px"
85
+ }) => {
86
+ const [visibleRows, setVisibleRows] = (0, import_react2.useState)(defaultVisibleRows);
87
+ const [height, setHeight] = (0, import_react2.useState)();
88
+ const [rowHeight, setRowHeight] = (0, import_react2.useState)();
89
+ const formattedHeight = (0, import_react2.useMemo)(() => height === void 0 ? void 0 : `${height}${heightFormat}`, [height, heightFormat]);
90
+ (0, import_react2.useEffect)(() => {
91
+ setVisibleRows(defaultVisibleRows);
92
+ }, [defaultVisibleRows]);
93
+ (0, import_react2.useEffect)(() => {
94
+ if (rowHeight !== void 0 && visibleRows !== void 0) {
95
+ setHeight(rowHeight * (visibleRows + additionalRows));
96
+ }
97
+ }, [defaultVisibleRows, rowHeight, visibleRows, additionalRows]);
98
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TableHeightContext.Provider, { value: { height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }, children });
99
+ };
100
+
101
+ // src/context/TableHeight/use.tsx
102
+ var import_react_shared2 = require("@xyo-network/react-shared");
103
+ var useTableHeight = (required = false) => (0, import_react_shared2.useContextEx)(TableHeightContext, "TableHeight", required);
104
+ // Annotate the CommonJS export names for ESM import in node:
105
+ 0 && (module.exports = {
106
+ TableCellEx,
107
+ TableEx,
108
+ TableExWithRef,
109
+ TableFooterEx,
110
+ TableHeightContext,
111
+ TableHeightProvider,
112
+ useTableHeight
113
+ });
2
114
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../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":["export * from './components'\nexport * from './context'\nexport * from './types'\n","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'\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'\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'\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'\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'\n\nexport const useTableHeight = (required = false) => useContextEx(TableHeightContext, 'TableHeight', required)\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,EAAA,YAAAC,EAAA,mBAAAC,EAAA,kBAAAC,EAAA,uBAAAC,EAAA,wBAAAC,EAAA,mBAAAC,IAAA,eAAAC,EAAAT,GCAA,IAAAU,EAAkD,yBAMrCC,KAAc,UAAO,YAAW,CAAE,KAAM,qBAAsB,kBAAoBC,GAASA,IAAS,WAAY,CAAC,EAC5H,CAAC,CAAE,UAAAC,EAAY,EAAK,KAAO,CACzB,GAAIA,GAAa,CAAE,gBAAiB,aAAc,CACpD,EACF,ECVA,IAAAC,EAAkC,yBAClCC,EAA8C,iBAU1CC,EAAA,6BAFEC,KAAe,cAA2C,CAAC,CAAE,SAAAC,EAAU,GAAGC,CAAM,EAAGC,OAErF,OAAC,SAAM,IAAKA,EAAM,GAAGD,EAClB,SAAAD,EACH,CAEH,EAEDD,EAAa,YAAc,eAEpB,IAAMI,KAAiB,cAA2C,CAAC,CAAE,QAAAC,EAAS,SAAA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AAmB,SAAnB,CAA4B,MAAO,CAAE,OAAQD,EAAiB,SAAU,GAAM,UAAAF,EAAW,aAAAC,EAAc,eAAAJ,EAAgB,YAAAD,CAAY,EACjI,SAAAJ,EACH,CAEJ,ECxCA,IAAAY,EAA6B,qCAItB,IAAMC,EAAiB,CAACC,EAAW,QAAU,gBAAaC,EAAoB,cAAeD,CAAQ","names":["src_exports","__export","TableCellEx","TableEx","TableExWithRef","TableFooterEx","TableHeightContext","TableHeightProvider","useTableHeight","__toCommonJS","import_material","TableCellEx","prop","noBgColor","import_material","import_react","import_jsx_runtime","TableExInner","children","props","ref","TableExWithRef","variant","TableEx","import_material","import_jsx_runtime","TableFooterExRoot","propName","variant","theme","TableFooterEx","children","props","import_react_shared","TableHeightContext","import_react","import_jsx_runtime","TableHeightProvider","children","additionalRows","defaultVisibleRows","heightFormat","visibleRows","setVisibleRows","height","setHeight","rowHeight","setRowHeight","formattedHeight","TableHeightContext","import_react_shared","useTableHeight","required","TableHeightContext"]}
1
+ {"version":3,"sources":["../../src/index.ts","../../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":["export * from './components'\nexport * from './context'\nexport * from './types'\n","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'\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'\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'\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'\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'\n\nexport const useTableHeight = (required = false) => useContextEx(TableHeightContext, 'TableHeight', required)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,sBAAkD;AAM3C,IAAM,kBAAc,wBAAO,2BAAW,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,IAAAA,mBAAkC;AAClC,mBAA8C;AAU1C;AAFJ,IAAM,mBAAe,yBAA2C,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ;AAC/F,SACE,4CAAC,0BAAM,KAAW,GAAG,OAClB,UACH;AAEJ,CAAC;AAED,aAAa,cAAc;AAEpB,IAAM,qBAAiB,yBAA2C,CAAC,EAAE,SAAS,UAAU,GAAG,MAAM,GAAG,QAAQ;AACjH,SACE,4CAAC,gBAAa,cAAc,YAAY,cAAc,KAAW,GAAG,OACjE,UACH;AAEJ,CAAC;AAED,eAAe,cAAc;AAEtB,IAAM,UAAU;;;AC7BvB,IAAAC,mBAAsD;AAuBiC,IAAAC,sBAAA;AAlBvF,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A,IAAAC,uBAA6B;AAItB,IAAM,iBAAiB,CAAC,WAAW,cAAU,mCAAa,oBAAoB,eAAe,QAAQ;","names":["import_material","import_material","import_jsx_runtime","import_react","import_jsx_runtime","import_react_shared"]}
@@ -1,2 +1,81 @@
1
- import{styled as E,TableCell as C}from"@mui/material";var B=E(C,{name:"TableCellNoBgColor",shouldForwardProp:e=>e!=="noBgColor"})(({noBgColor:e=!0})=>({...e&&{backgroundColor:"transparent"}}));import{Table as c}from"@mui/material";import{forwardRef as b}from"react";import{jsx as d}from"react/jsx-runtime";var x=b(({children:e,...o},r)=>d(c,{ref:r,...o,children:e}));x.displayName="TableExInner";var T=b(({variant:e,children:o,...r},t)=>d(x,{stickyHeader:e==="scrollable",ref:t,...r,children:o}));T.displayName="TableEx";var L=T;import{styled as g,TableFooter as u}from"@mui/material";import{jsx as F}from"react/jsx-runtime";var H=g(u,{name:"TableFooterEx",shouldForwardProp:e=>e!=="scrollable",slot:"Root"})(({variant:e,theme:o})=>({backgroundColor:o.palette.background.default,bottom:"unset",position:"relative",...e==="scrollable"&&{bottom:0,position:"sticky"}})),D=({children:e,...o})=>F(H,{...o,children:e});import{createContextEx as v}from"@xyo-network/react-shared";var n=v();import{useEffect as m,useMemo as R,useState as s}from"react";import{jsx as W}from"react/jsx-runtime";var X=({children:e,additionalRows:o=0,defaultVisibleRows:r,heightFormat:t="px"})=>{let[l,p]=s(r),[i,f]=s(),[a,h]=s(),P=R(()=>i===void 0?void 0:`${i}${t}`,[i,t]);return m(()=>{p(r)},[r]),m(()=>{a!==void 0&&l!==void 0&&f(a*(l+o))},[r,a,l,o]),W(n.Provider,{value:{height:P,provided:!0,rowHeight:a,setRowHeight:h,setVisibleRows:p,visibleRows:l},children:e})};import{useContextEx as y}from"@xyo-network/react-shared";var ee=(e=!1)=>y(n,"TableHeight",e);export{B as TableCellEx,L as TableEx,T as TableExWithRef,D as TableFooterEx,n as TableHeightContext,X as TableHeightProvider,ee as useTableHeight};
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
+ };
2
81
  //# sourceMappingURL=index.js.map
@@ -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.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'\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'\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'\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'\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'\n\nexport const useTableHeight = (required = false) => useContextEx(TableHeightContext, 'TableHeight', required)\n"],"mappings":"AAAA,OAAS,UAAAA,EAAQ,aAAAC,MAAiC,gBAM3C,IAAMC,EAAcF,EAAOC,EAAW,CAAE,KAAM,qBAAsB,kBAAoBE,GAASA,IAAS,WAAY,CAAC,EAC5H,CAAC,CAAE,UAAAC,EAAY,EAAK,KAAO,CACzB,GAAIA,GAAa,CAAE,gBAAiB,aAAc,CACpD,EACF,ECVA,OAAS,SAAAC,MAAyB,gBAClC,OAAS,cAAAC,MAAqC,QAU1C,cAAAC,MAAA,oBAFJ,IAAMC,EAAeF,EAA2C,CAAC,CAAE,SAAAG,EAAU,GAAGC,CAAM,EAAGC,IAErFJ,EAACF,EAAA,CAAM,IAAKM,EAAM,GAAGD,EAClB,SAAAD,EACH,CAEH,EAEDD,EAAa,YAAc,eAEpB,IAAMI,EAAiBN,EAA2C,CAAC,CAAE,QAAAO,EAAS,SAAAJ,EAAU,GAAGC,CAAM,EAAGC,IAEvGJ,EAACC,EAAA,CAAa,aAAcK,IAAY,aAAc,IAAKF,EAAM,GAAGD,EACjE,SAAAD,E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SAAnB,CAA4B,MAAO,CAAE,OAAQH,EAAiB,SAAU,GAAM,UAAAF,EAAW,aAAAC,EAAc,eAAAL,EAAgB,YAAAD,CAAY,EACjI,SAAAJ,EACH,CAEJ,ECxCA,OAAS,gBAAAe,MAAoB,4BAItB,IAAMC,GAAiB,CAACC,EAAW,KAAUC,EAAaC,EAAoB,cAAeF,CAAQ","names":["styled","TableCell","TableCellEx","prop","noBgColor","Table","forwardRef","jsx","TableExInner","children","props","ref","TableExWithRef","variant","TableEx","styled","TableFooter","jsx","TableFooterExRoot","propName","variant","theme","TableFooterEx","children","props","createContextEx","TableHeightContext","useEffect","useMemo","useState","jsx","TableHeightProvider","children","additionalRows","defaultVisibleRows","heightFormat","visibleRows","setVisibleRows","useState","height","setHeight","rowHeight","setRowHeight","formattedHeight","useMemo","useEffect","TableHeightContext","useContextEx","useTableHeight","required","useContextEx","TableHeightContext"]}
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'\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'\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'\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'\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'\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,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  "dependencies": {
13
13
  "@xylabs/react-shared": "^3.1.7",
14
- "@xyo-network/react-shared": "~2.77.2"
14
+ "@xyo-network/react-shared": "^2.78.1"
15
15
  },
16
16
  "devDependencies": {
17
- "@storybook/react": "^7.6.19",
18
- "@xylabs/ts-scripts-yarn3": "^3.11.7",
19
- "@xylabs/tsconfig-react": "^3.11.7",
20
- "@xyo-network/react-storybook": "~2.77.2",
21
- "typescript": "^5.4.5"
17
+ "@storybook/react": "^7.6.20",
18
+ "@xylabs/ts-scripts-yarn3": "^3.11.12",
19
+ "@xylabs/tsconfig-react": "^3.11.12",
20
+ "@xyo-network/react-storybook": "^2.78.1",
21
+ "typescript": "^5.5.2"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "@mui/icons-material": "^5",
@@ -78,6 +78,6 @@
78
78
  },
79
79
  "sideEffects": false,
80
80
  "types": "dist/browser/index.d.ts",
81
- "version": "2.77.2",
81
+ "version": "2.78.1",
82
82
  "type": "module"
83
83
  }