@xyo-network/react-table 2.81.10 → 2.82.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/dist/browser/components/TableEx/TableEx.d.cts +4 -4
  2. package/dist/browser/components/TableEx/TableEx.d.cts.map +1 -1
  3. package/dist/browser/components/TableEx/TableEx.d.mts +4 -4
  4. package/dist/browser/components/TableEx/TableEx.d.mts.map +1 -1
  5. package/dist/browser/components/TableEx/TableEx.d.ts +4 -4
  6. package/dist/browser/components/TableEx/TableEx.d.ts.map +1 -1
  7. package/dist/browser/components/TableEx/TableFooterEx.d.cts +2 -2
  8. package/dist/browser/components/TableEx/TableFooterEx.d.cts.map +1 -1
  9. package/dist/browser/components/TableEx/TableFooterEx.d.mts +2 -2
  10. package/dist/browser/components/TableEx/TableFooterEx.d.mts.map +1 -1
  11. package/dist/browser/components/TableEx/TableFooterEx.d.ts +2 -2
  12. package/dist/browser/components/TableEx/TableFooterEx.d.ts.map +1 -1
  13. package/dist/browser/components/TableEx/index.d.cts +4 -4
  14. package/dist/browser/components/TableEx/index.d.cts.map +1 -1
  15. package/dist/browser/components/TableEx/index.d.mts +4 -4
  16. package/dist/browser/components/TableEx/index.d.mts.map +1 -1
  17. package/dist/browser/components/TableEx/index.d.ts +4 -4
  18. package/dist/browser/components/TableEx/index.d.ts.map +1 -1
  19. package/dist/browser/components/TableEx/types/index.d.cts +1 -1
  20. package/dist/browser/components/TableEx/types/index.d.mts +1 -1
  21. package/dist/browser/components/TableEx/types/index.d.ts +1 -1
  22. package/dist/browser/components/index.d.cts +1 -1
  23. package/dist/browser/components/index.d.mts +1 -1
  24. package/dist/browser/components/index.d.ts +1 -1
  25. package/dist/browser/context/TableHeight/Context.d.cts +1 -1
  26. package/dist/browser/context/TableHeight/Context.d.mts +1 -1
  27. package/dist/browser/context/TableHeight/Context.d.ts +1 -1
  28. package/dist/browser/context/TableHeight/Provider.d.cts +1 -0
  29. package/dist/browser/context/TableHeight/Provider.d.cts.map +1 -1
  30. package/dist/browser/context/TableHeight/Provider.d.mts +1 -0
  31. package/dist/browser/context/TableHeight/Provider.d.mts.map +1 -1
  32. package/dist/browser/context/TableHeight/Provider.d.ts +1 -0
  33. package/dist/browser/context/TableHeight/Provider.d.ts.map +1 -1
  34. package/dist/browser/context/TableHeight/index.d.cts +4 -4
  35. package/dist/browser/context/TableHeight/index.d.cts.map +1 -1
  36. package/dist/browser/context/TableHeight/index.d.mts +4 -4
  37. package/dist/browser/context/TableHeight/index.d.mts.map +1 -1
  38. package/dist/browser/context/TableHeight/index.d.ts +4 -4
  39. package/dist/browser/context/TableHeight/index.d.ts.map +1 -1
  40. package/dist/browser/context/TableHeight/use.d.cts +1 -1
  41. package/dist/browser/context/TableHeight/use.d.cts.map +1 -1
  42. package/dist/browser/context/TableHeight/use.d.mts +1 -1
  43. package/dist/browser/context/TableHeight/use.d.mts.map +1 -1
  44. package/dist/browser/context/TableHeight/use.d.ts +1 -1
  45. package/dist/browser/context/TableHeight/use.d.ts.map +1 -1
  46. package/dist/browser/context/index.d.cts +1 -1
  47. package/dist/browser/context/index.d.mts +1 -1
  48. package/dist/browser/context/index.d.ts +1 -1
  49. package/dist/browser/index.cjs +74 -34
  50. package/dist/browser/index.cjs.map +1 -1
  51. package/dist/browser/index.d.cts +3 -3
  52. package/dist/browser/index.d.mts +3 -3
  53. package/dist/browser/index.d.ts +3 -3
  54. package/dist/browser/index.mjs +113 -0
  55. package/dist/browser/index.mjs.map +1 -0
  56. package/dist/browser/types/index.d.cts +1 -1
  57. package/dist/browser/types/index.d.mts +1 -1
  58. package/dist/browser/types/index.d.ts +1 -1
  59. package/dist/neutral/components/TableEx/TableEx.d.cts +4 -4
  60. package/dist/neutral/components/TableEx/TableEx.d.cts.map +1 -1
  61. package/dist/neutral/components/TableEx/TableEx.d.mts +4 -4
  62. package/dist/neutral/components/TableEx/TableEx.d.mts.map +1 -1
  63. package/dist/neutral/components/TableEx/TableEx.d.ts +4 -4
  64. package/dist/neutral/components/TableEx/TableEx.d.ts.map +1 -1
  65. package/dist/neutral/components/TableEx/TableFooterEx.d.cts +2 -2
  66. package/dist/neutral/components/TableEx/TableFooterEx.d.cts.map +1 -1
  67. package/dist/neutral/components/TableEx/TableFooterEx.d.mts +2 -2
  68. package/dist/neutral/components/TableEx/TableFooterEx.d.mts.map +1 -1
  69. package/dist/neutral/components/TableEx/TableFooterEx.d.ts +2 -2
  70. package/dist/neutral/components/TableEx/TableFooterEx.d.ts.map +1 -1
  71. package/dist/neutral/components/TableEx/index.d.cts +4 -4
  72. package/dist/neutral/components/TableEx/index.d.cts.map +1 -1
  73. package/dist/neutral/components/TableEx/index.d.mts +4 -4
  74. package/dist/neutral/components/TableEx/index.d.mts.map +1 -1
  75. package/dist/neutral/components/TableEx/index.d.ts +4 -4
  76. package/dist/neutral/components/TableEx/index.d.ts.map +1 -1
  77. package/dist/neutral/components/TableEx/types/index.d.cts +1 -1
  78. package/dist/neutral/components/TableEx/types/index.d.mts +1 -1
  79. package/dist/neutral/components/TableEx/types/index.d.ts +1 -1
  80. package/dist/neutral/components/index.d.cts +1 -1
  81. package/dist/neutral/components/index.d.mts +1 -1
  82. package/dist/neutral/components/index.d.ts +1 -1
  83. package/dist/neutral/context/TableHeight/Context.d.cts +1 -1
  84. package/dist/neutral/context/TableHeight/Context.d.mts +1 -1
  85. package/dist/neutral/context/TableHeight/Context.d.ts +1 -1
  86. package/dist/neutral/context/TableHeight/Provider.d.cts +1 -0
  87. package/dist/neutral/context/TableHeight/Provider.d.cts.map +1 -1
  88. package/dist/neutral/context/TableHeight/Provider.d.mts +1 -0
  89. package/dist/neutral/context/TableHeight/Provider.d.mts.map +1 -1
  90. package/dist/neutral/context/TableHeight/Provider.d.ts +1 -0
  91. package/dist/neutral/context/TableHeight/Provider.d.ts.map +1 -1
  92. package/dist/neutral/context/TableHeight/index.d.cts +4 -4
  93. package/dist/neutral/context/TableHeight/index.d.cts.map +1 -1
  94. package/dist/neutral/context/TableHeight/index.d.mts +4 -4
  95. package/dist/neutral/context/TableHeight/index.d.mts.map +1 -1
  96. package/dist/neutral/context/TableHeight/index.d.ts +4 -4
  97. package/dist/neutral/context/TableHeight/index.d.ts.map +1 -1
  98. package/dist/neutral/context/TableHeight/use.d.cts +1 -1
  99. package/dist/neutral/context/TableHeight/use.d.cts.map +1 -1
  100. package/dist/neutral/context/TableHeight/use.d.mts +1 -1
  101. package/dist/neutral/context/TableHeight/use.d.mts.map +1 -1
  102. package/dist/neutral/context/TableHeight/use.d.ts +1 -1
  103. package/dist/neutral/context/TableHeight/use.d.ts.map +1 -1
  104. package/dist/neutral/context/index.d.cts +1 -1
  105. package/dist/neutral/context/index.d.mts +1 -1
  106. package/dist/neutral/context/index.d.ts +1 -1
  107. package/dist/neutral/index.cjs +74 -34
  108. package/dist/neutral/index.cjs.map +1 -1
  109. package/dist/neutral/index.d.cts +3 -3
  110. package/dist/neutral/index.d.mts +3 -3
  111. package/dist/neutral/index.d.ts +3 -3
  112. package/dist/neutral/index.mjs +113 -0
  113. package/dist/neutral/index.mjs.map +1 -0
  114. package/dist/neutral/types/index.d.cts +1 -1
  115. package/dist/neutral/types/index.d.mts +1 -1
  116. package/dist/neutral/types/index.d.ts +1 -1
  117. package/dist/node/components/TableEx/TableEx.d.cts +4 -4
  118. package/dist/node/components/TableEx/TableEx.d.cts.map +1 -1
  119. package/dist/node/components/TableEx/TableEx.d.mts +4 -4
  120. package/dist/node/components/TableEx/TableEx.d.mts.map +1 -1
  121. package/dist/node/components/TableEx/TableEx.d.ts +4 -4
  122. package/dist/node/components/TableEx/TableEx.d.ts.map +1 -1
  123. package/dist/node/components/TableEx/TableFooterEx.d.cts +2 -2
  124. package/dist/node/components/TableEx/TableFooterEx.d.cts.map +1 -1
  125. package/dist/node/components/TableEx/TableFooterEx.d.mts +2 -2
  126. package/dist/node/components/TableEx/TableFooterEx.d.mts.map +1 -1
  127. package/dist/node/components/TableEx/TableFooterEx.d.ts +2 -2
  128. package/dist/node/components/TableEx/TableFooterEx.d.ts.map +1 -1
  129. package/dist/node/components/TableEx/index.d.cts +4 -4
  130. package/dist/node/components/TableEx/index.d.cts.map +1 -1
  131. package/dist/node/components/TableEx/index.d.mts +4 -4
  132. package/dist/node/components/TableEx/index.d.mts.map +1 -1
  133. package/dist/node/components/TableEx/index.d.ts +4 -4
  134. package/dist/node/components/TableEx/index.d.ts.map +1 -1
  135. package/dist/node/components/TableEx/types/index.d.cts +1 -1
  136. package/dist/node/components/TableEx/types/index.d.mts +1 -1
  137. package/dist/node/components/TableEx/types/index.d.ts +1 -1
  138. package/dist/node/components/index.d.cts +1 -1
  139. package/dist/node/components/index.d.mts +1 -1
  140. package/dist/node/components/index.d.ts +1 -1
  141. package/dist/node/context/TableHeight/Context.d.cts +1 -1
  142. package/dist/node/context/TableHeight/Context.d.mts +1 -1
  143. package/dist/node/context/TableHeight/Context.d.ts +1 -1
  144. package/dist/node/context/TableHeight/Provider.d.cts +1 -0
  145. package/dist/node/context/TableHeight/Provider.d.cts.map +1 -1
  146. package/dist/node/context/TableHeight/Provider.d.mts +1 -0
  147. package/dist/node/context/TableHeight/Provider.d.mts.map +1 -1
  148. package/dist/node/context/TableHeight/Provider.d.ts +1 -0
  149. package/dist/node/context/TableHeight/Provider.d.ts.map +1 -1
  150. package/dist/node/context/TableHeight/index.d.cts +4 -4
  151. package/dist/node/context/TableHeight/index.d.cts.map +1 -1
  152. package/dist/node/context/TableHeight/index.d.mts +4 -4
  153. package/dist/node/context/TableHeight/index.d.mts.map +1 -1
  154. package/dist/node/context/TableHeight/index.d.ts +4 -4
  155. package/dist/node/context/TableHeight/index.d.ts.map +1 -1
  156. package/dist/node/context/TableHeight/use.d.cts +1 -1
  157. package/dist/node/context/TableHeight/use.d.cts.map +1 -1
  158. package/dist/node/context/TableHeight/use.d.mts +1 -1
  159. package/dist/node/context/TableHeight/use.d.mts.map +1 -1
  160. package/dist/node/context/TableHeight/use.d.ts +1 -1
  161. package/dist/node/context/TableHeight/use.d.ts.map +1 -1
  162. package/dist/node/context/index.d.cts +1 -1
  163. package/dist/node/context/index.d.mts +1 -1
  164. package/dist/node/context/index.d.ts +1 -1
  165. package/dist/node/index.cjs +74 -34
  166. package/dist/node/index.cjs.map +1 -1
  167. package/dist/node/index.d.cts +3 -3
  168. package/dist/node/index.d.mts +3 -3
  169. package/dist/node/index.d.ts +3 -3
  170. package/dist/node/index.mjs +113 -0
  171. package/dist/node/index.mjs.map +1 -0
  172. package/dist/node/types/index.d.cts +1 -1
  173. package/dist/node/types/index.d.mts +1 -1
  174. package/dist/node/types/index.d.ts +1 -1
  175. package/package.json +11 -11
  176. package/src/components/TableEx/TableCellEx.tsx +1 -1
  177. package/src/components/TableEx/TableEx.stories.tsx +9 -7
  178. package/src/components/TableEx/TableEx.tsx +2 -2
  179. package/src/components/TableEx/TableFooterEx.tsx +3 -3
  180. package/src/components/TableEx/index.ts +4 -4
  181. package/src/components/TableEx/types/index.ts +1 -1
  182. package/src/components/index.ts +1 -1
  183. package/src/context/TableHeight/Context.ts +1 -1
  184. package/src/context/TableHeight/Provider.tsx +5 -3
  185. package/src/context/TableHeight/index.ts +4 -4
  186. package/src/context/TableHeight/{use.tsx → use.ts} +1 -1
  187. package/src/context/index.ts +1 -1
  188. package/src/index.ts +3 -3
  189. package/src/types/index.ts +1 -1
  190. package/dist/browser/index.js +0 -81
  191. package/dist/browser/index.js.map +0 -1
  192. package/dist/neutral/index.js +0 -81
  193. package/dist/neutral/index.js.map +0 -1
  194. package/dist/node/index.js +0 -81
  195. package/dist/node/index.js.map +0 -1
@@ -1,11 +1,11 @@
1
- /* eslint-disable import/no-internal-modules */
2
1
  import { TableBody, TableCell, TableHead, TablePagination, TableRow, useTheme } from '@mui/material'
3
2
  import { Decorator, Meta, StoryFn } from '@storybook/react'
4
3
  import { WithRefDecorator } from '@xyo-network/react-storybook'
4
+ import React from 'react'
5
5
 
6
- import { TableCellEx } from './TableCellEx.js'
7
- import { TableEx } from './TableEx.js'
8
- import { TableFooterEx } from './TableFooterEx.js'
6
+ import { TableCellEx } from './TableCellEx.tsx'
7
+ import { TableEx } from './TableEx.tsx'
8
+ import { TableFooterEx } from './TableFooterEx.tsx'
9
9
 
10
10
  const ScrollableDecorator: Decorator = (Story, args) => (
11
11
  <div style={{ height: 'calc(100vh - 2rem)', inset: 0, position: 'absolute' }}>
@@ -38,9 +38,12 @@ const Template: StoryFn<typeof TableEx> = (args) => {
38
38
  </TableRow>
39
39
  </TableHead>
40
40
  <TableBody>
41
- {tableRows.map((row) => (
41
+ {tableRows.map(row => (
42
42
  <TableRow key={row}>
43
- <TableCell>Row {row}</TableCell>
43
+ <TableCell>
44
+ Row
45
+ {row}
46
+ </TableCell>
44
47
  <TableCell>Cell 2</TableCell>
45
48
  </TableRow>
46
49
  ))}
@@ -84,5 +87,4 @@ WithScrollable.decorators = [ScrollableDecorator]
84
87
 
85
88
  export { Default, WithRef, WithScrollable }
86
89
 
87
- // eslint-disable-next-line import/no-default-export
88
90
  export default StorybookEntry
@@ -1,7 +1,7 @@
1
1
  import { Table, TableProps } from '@mui/material'
2
- import { forwardRef, PropsWithChildren } from 'react'
2
+ import React, { forwardRef, PropsWithChildren } from 'react'
3
3
 
4
- import { TableExVariants } from './types/index.js'
4
+ import { TableExVariants } from './types/index.ts'
5
5
 
6
6
  export interface TableExProps extends PropsWithChildren, TableProps {
7
7
  variant?: TableExVariants
@@ -1,11 +1,11 @@
1
1
  import { styled, TableFooter, TableFooterProps } from '@mui/material'
2
- import { PropsWithChildren } from 'react'
2
+ import React, { PropsWithChildren } from 'react'
3
3
 
4
- import { TableExVariants } from './types/index.js'
4
+ import { TableExVariants } from './types/index.ts'
5
5
 
6
6
  const TableFooterExRoot = styled(TableFooter, {
7
7
  name: 'TableFooterEx',
8
- shouldForwardProp: (propName) => propName !== 'scrollable',
8
+ shouldForwardProp: propName => propName !== 'scrollable',
9
9
  slot: 'Root',
10
10
  })<TableFooterExProps>(({ variant, theme }) => ({
11
11
  backgroundColor: theme.palette.background.default,
@@ -1,4 +1,4 @@
1
- export * from './TableCellEx.js'
2
- export * from './TableEx.js'
3
- export * from './TableFooterEx.js'
4
- export * from './types/index.js'
1
+ export * from './TableCellEx.tsx'
2
+ export * from './TableEx.tsx'
3
+ export * from './TableFooterEx.tsx'
4
+ export * from './types/index.ts'
@@ -1 +1 @@
1
- export * from './TableExVariants.js'
1
+ export * from './TableExVariants.ts'
@@ -1 +1 @@
1
- export * from './TableEx/index.js'
1
+ export * from './TableEx/index.ts'
@@ -1,5 +1,5 @@
1
1
  import { createContextEx } from '@xyo-network/react-shared'
2
2
 
3
- import { TableHeightState } from './State.js'
3
+ import { TableHeightState } from './State.ts'
4
4
 
5
5
  export const TableHeightContext = createContextEx<TableHeightState>()
@@ -1,8 +1,8 @@
1
1
  import { WithChildren } from '@xylabs/react-shared'
2
2
  import { ContextExProviderProps } from '@xyo-network/react-shared'
3
- import { useEffect, useMemo, useState } from 'react'
3
+ import React, { useEffect, useMemo, useState } from 'react'
4
4
 
5
- import { TableHeightContext } from './Context.js'
5
+ import { TableHeightContext } from './Context.ts'
6
6
 
7
7
  export interface TableHeightProviderProps extends ContextExProviderProps, WithChildren {
8
8
  /** @field Account for optional header and footer rows */
@@ -33,8 +33,10 @@ export const TableHeightProvider: React.FC<TableHeightProviderProps> = ({
33
33
  }
34
34
  }, [defaultVisibleRows, rowHeight, visibleRows, additionalRows])
35
35
 
36
+ const value = useMemo(() => ({ height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }), [formattedHeight, rowHeight, setRowHeight, setVisibleRows, visibleRows])
37
+
36
38
  return (
37
- <TableHeightContext.Provider value={{ height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }}>
39
+ <TableHeightContext.Provider value={value}>
38
40
  {children}
39
41
  </TableHeightContext.Provider>
40
42
  )
@@ -1,4 +1,4 @@
1
- export * from './Context.js'
2
- export * from './Provider.js'
3
- export * from './State.js'
4
- export * from './use.js'
1
+ export * from './Context.ts'
2
+ export * from './Provider.tsx'
3
+ export * from './State.ts'
4
+ export * from './use.ts'
@@ -1,5 +1,5 @@
1
1
  import { useContextEx } from '@xyo-network/react-shared'
2
2
 
3
- import { TableHeightContext } from './Context.js'
3
+ import { TableHeightContext } from './Context.ts'
4
4
 
5
5
  export const useTableHeight = (required = false) => useContextEx(TableHeightContext, 'TableHeight', required)
@@ -1 +1 @@
1
- export * from './TableHeight/index.js'
1
+ export * from './TableHeight/index.ts'
package/src/index.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from './components/index.js'
2
- export * from './context/index.js'
3
- export * from './types/index.js'
1
+ export * from './components/index.ts'
2
+ export * from './context/index.ts'
3
+ export * from './types/index.ts'
@@ -1 +1 @@
1
- export * from './TableHead.js'
1
+ export * from './TableHead.ts'
@@ -1,81 +0,0 @@
1
- // src/components/TableEx/TableCellEx.tsx
2
- import { styled, TableCell } from "@mui/material";
3
- var TableCellEx = styled(TableCell, { name: "TableCellNoBgColor", shouldForwardProp: (prop) => prop !== "noBgColor" })(
4
- ({ noBgColor = true }) => ({
5
- ...noBgColor && { backgroundColor: "transparent" }
6
- })
7
- );
8
-
9
- // src/components/TableEx/TableEx.tsx
10
- import { Table } from "@mui/material";
11
- import { forwardRef } from "react";
12
- import { jsx } from "react/jsx-runtime";
13
- var TableExInner = forwardRef(({ children, ...props }, ref) => {
14
- return /* @__PURE__ */ jsx(Table, { ref, ...props, children });
15
- });
16
- TableExInner.displayName = "TableExInner";
17
- var TableExWithRef = forwardRef(({ variant, children, ...props }, ref) => {
18
- return /* @__PURE__ */ jsx(TableExInner, { stickyHeader: variant === "scrollable", ref, ...props, children });
19
- });
20
- TableExWithRef.displayName = "TableEx";
21
- var TableEx = TableExWithRef;
22
-
23
- // src/components/TableEx/TableFooterEx.tsx
24
- import { styled as styled2, TableFooter } from "@mui/material";
25
- import { jsx as jsx2 } from "react/jsx-runtime";
26
- var TableFooterExRoot = styled2(TableFooter, {
27
- name: "TableFooterEx",
28
- shouldForwardProp: (propName) => propName !== "scrollable",
29
- slot: "Root"
30
- })(({ variant, theme }) => ({
31
- backgroundColor: theme.palette.background.default,
32
- bottom: "unset",
33
- position: "relative",
34
- ...variant === "scrollable" && {
35
- bottom: 0,
36
- position: "sticky"
37
- }
38
- }));
39
- var TableFooterEx = ({ children, ...props }) => /* @__PURE__ */ jsx2(TableFooterExRoot, { ...props, children });
40
-
41
- // src/context/TableHeight/Context.ts
42
- import { createContextEx } from "@xyo-network/react-shared";
43
- var TableHeightContext = createContextEx();
44
-
45
- // src/context/TableHeight/Provider.tsx
46
- import { useEffect, useMemo, useState } from "react";
47
- import { jsx as jsx3 } from "react/jsx-runtime";
48
- var TableHeightProvider = ({
49
- children,
50
- additionalRows = 0,
51
- defaultVisibleRows,
52
- heightFormat = "px"
53
- }) => {
54
- const [visibleRows, setVisibleRows] = useState(defaultVisibleRows);
55
- const [height, setHeight] = useState();
56
- const [rowHeight, setRowHeight] = useState();
57
- const formattedHeight = useMemo(() => height === void 0 ? void 0 : `${height}${heightFormat}`, [height, heightFormat]);
58
- useEffect(() => {
59
- setVisibleRows(defaultVisibleRows);
60
- }, [defaultVisibleRows]);
61
- useEffect(() => {
62
- if (rowHeight !== void 0 && visibleRows !== void 0) {
63
- setHeight(rowHeight * (visibleRows + additionalRows));
64
- }
65
- }, [defaultVisibleRows, rowHeight, visibleRows, additionalRows]);
66
- return /* @__PURE__ */ jsx3(TableHeightContext.Provider, { value: { height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }, children });
67
- };
68
-
69
- // src/context/TableHeight/use.tsx
70
- import { useContextEx } from "@xyo-network/react-shared";
71
- var useTableHeight = (required = false) => useContextEx(TableHeightContext, "TableHeight", required);
72
- export {
73
- TableCellEx,
74
- TableEx,
75
- TableExWithRef,
76
- TableFooterEx,
77
- TableHeightContext,
78
- TableHeightProvider,
79
- useTableHeight
80
- };
81
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/TableEx/TableCellEx.tsx","../../src/components/TableEx/TableEx.tsx","../../src/components/TableEx/TableFooterEx.tsx","../../src/context/TableHeight/Context.ts","../../src/context/TableHeight/Provider.tsx","../../src/context/TableHeight/use.tsx"],"sourcesContent":["import { styled, TableCell, TableCellProps } from '@mui/material'\n\nexport interface TableCellExProps extends TableCellProps {\n noBgColor?: boolean\n}\n\nexport const TableCellEx = styled(TableCell, { name: 'TableCellNoBgColor', shouldForwardProp: (prop) => prop !== 'noBgColor' })<TableCellExProps>(\n ({ noBgColor = true }) => ({\n ...(noBgColor && { backgroundColor: 'transparent' }),\n }),\n)\n","import { Table, TableProps } from '@mui/material'\nimport { forwardRef, PropsWithChildren } from 'react'\n\nimport { TableExVariants } from './types/index.js'\n\nexport interface TableExProps extends PropsWithChildren, TableProps {\n variant?: TableExVariants\n}\n\nconst TableExInner = forwardRef<HTMLTableElement, TableExProps>(({ children, ...props }, ref) => {\n return (\n <Table ref={ref} {...props}>\n {children}\n </Table>\n )\n})\n\nTableExInner.displayName = 'TableExInner'\n\nexport const TableExWithRef = forwardRef<HTMLTableElement, TableExProps>(({ variant, children, ...props }, ref) => {\n return (\n <TableExInner stickyHeader={variant === 'scrollable'} ref={ref} {...props}>\n {children}\n </TableExInner>\n )\n})\n\nTableExWithRef.displayName = 'TableEx'\n\nexport const TableEx = TableExWithRef\n","import { styled, TableFooter, TableFooterProps } from '@mui/material'\nimport { PropsWithChildren } from 'react'\n\nimport { TableExVariants } from './types/index.js'\n\nconst TableFooterExRoot = styled(TableFooter, {\n name: 'TableFooterEx',\n shouldForwardProp: (propName) => propName !== 'scrollable',\n slot: 'Root',\n})<TableFooterExProps>(({ variant, theme }) => ({\n backgroundColor: theme.palette.background.default,\n bottom: 'unset',\n position: 'relative',\n ...(variant === 'scrollable' && {\n bottom: 0,\n position: 'sticky',\n }),\n}))\n\nexport interface TableFooterExProps extends PropsWithChildren, TableFooterProps {\n variant?: TableExVariants\n}\n\nexport const TableFooterEx: React.FC<TableFooterExProps> = ({ children, ...props }) => <TableFooterExRoot {...props}>{children}</TableFooterExRoot>\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { TableHeightState } from './State.js'\n\nexport const TableHeightContext = createContextEx<TableHeightState>()\n","import { WithChildren } from '@xylabs/react-shared'\nimport { ContextExProviderProps } from '@xyo-network/react-shared'\nimport { useEffect, useMemo, useState } from 'react'\n\nimport { TableHeightContext } from './Context.js'\n\nexport interface TableHeightProviderProps extends ContextExProviderProps, WithChildren {\n /** @field Account for optional header and footer rows */\n additionalRows?: number\n defaultVisibleRows?: number\n heightFormat?: string\n}\n\nexport const TableHeightProvider: React.FC<TableHeightProviderProps> = ({\n children,\n additionalRows = 0,\n defaultVisibleRows,\n heightFormat = 'px',\n}) => {\n const [visibleRows, setVisibleRows] = useState(defaultVisibleRows)\n const [height, setHeight] = useState<number | undefined>()\n const [rowHeight, setRowHeight] = useState<number | undefined>()\n\n const formattedHeight = useMemo(() => (height === undefined ? undefined : `${height}${heightFormat}`), [height, heightFormat])\n\n useEffect(() => {\n setVisibleRows(defaultVisibleRows)\n }, [defaultVisibleRows])\n\n useEffect(() => {\n if (rowHeight !== undefined && visibleRows !== undefined) {\n setHeight(rowHeight * (visibleRows + additionalRows))\n }\n }, [defaultVisibleRows, rowHeight, visibleRows, additionalRows])\n\n return (\n <TableHeightContext.Provider value={{ height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }}>\n {children}\n </TableHeightContext.Provider>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { TableHeightContext } from './Context.js'\n\nexport const useTableHeight = (required = false) => useContextEx(TableHeightContext, 'TableHeight', required)\n"],"mappings":";AAAA,SAAS,QAAQ,iBAAiC;AAM3C,IAAM,cAAc,OAAO,WAAW,EAAE,MAAM,sBAAsB,mBAAmB,CAAC,SAAS,SAAS,YAAY,CAAC;AAAA,EAC5H,CAAC,EAAE,YAAY,KAAK,OAAO;AAAA,IACzB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I,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,81 +0,0 @@
1
- // src/components/TableEx/TableCellEx.tsx
2
- import { styled, TableCell } from "@mui/material";
3
- var TableCellEx = styled(TableCell, { name: "TableCellNoBgColor", shouldForwardProp: (prop) => prop !== "noBgColor" })(
4
- ({ noBgColor = true }) => ({
5
- ...noBgColor && { backgroundColor: "transparent" }
6
- })
7
- );
8
-
9
- // src/components/TableEx/TableEx.tsx
10
- import { Table } from "@mui/material";
11
- import { forwardRef } from "react";
12
- import { jsx } from "react/jsx-runtime";
13
- var TableExInner = forwardRef(({ children, ...props }, ref) => {
14
- return /* @__PURE__ */ jsx(Table, { ref, ...props, children });
15
- });
16
- TableExInner.displayName = "TableExInner";
17
- var TableExWithRef = forwardRef(({ variant, children, ...props }, ref) => {
18
- return /* @__PURE__ */ jsx(TableExInner, { stickyHeader: variant === "scrollable", ref, ...props, children });
19
- });
20
- TableExWithRef.displayName = "TableEx";
21
- var TableEx = TableExWithRef;
22
-
23
- // src/components/TableEx/TableFooterEx.tsx
24
- import { styled as styled2, TableFooter } from "@mui/material";
25
- import { jsx as jsx2 } from "react/jsx-runtime";
26
- var TableFooterExRoot = styled2(TableFooter, {
27
- name: "TableFooterEx",
28
- shouldForwardProp: (propName) => propName !== "scrollable",
29
- slot: "Root"
30
- })(({ variant, theme }) => ({
31
- backgroundColor: theme.palette.background.default,
32
- bottom: "unset",
33
- position: "relative",
34
- ...variant === "scrollable" && {
35
- bottom: 0,
36
- position: "sticky"
37
- }
38
- }));
39
- var TableFooterEx = ({ children, ...props }) => /* @__PURE__ */ jsx2(TableFooterExRoot, { ...props, children });
40
-
41
- // src/context/TableHeight/Context.ts
42
- import { createContextEx } from "@xyo-network/react-shared";
43
- var TableHeightContext = createContextEx();
44
-
45
- // src/context/TableHeight/Provider.tsx
46
- import { useEffect, useMemo, useState } from "react";
47
- import { jsx as jsx3 } from "react/jsx-runtime";
48
- var TableHeightProvider = ({
49
- children,
50
- additionalRows = 0,
51
- defaultVisibleRows,
52
- heightFormat = "px"
53
- }) => {
54
- const [visibleRows, setVisibleRows] = useState(defaultVisibleRows);
55
- const [height, setHeight] = useState();
56
- const [rowHeight, setRowHeight] = useState();
57
- const formattedHeight = useMemo(() => height === void 0 ? void 0 : `${height}${heightFormat}`, [height, heightFormat]);
58
- useEffect(() => {
59
- setVisibleRows(defaultVisibleRows);
60
- }, [defaultVisibleRows]);
61
- useEffect(() => {
62
- if (rowHeight !== void 0 && visibleRows !== void 0) {
63
- setHeight(rowHeight * (visibleRows + additionalRows));
64
- }
65
- }, [defaultVisibleRows, rowHeight, visibleRows, additionalRows]);
66
- return /* @__PURE__ */ jsx3(TableHeightContext.Provider, { value: { height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }, children });
67
- };
68
-
69
- // src/context/TableHeight/use.tsx
70
- import { useContextEx } from "@xyo-network/react-shared";
71
- var useTableHeight = (required = false) => useContextEx(TableHeightContext, "TableHeight", required);
72
- export {
73
- TableCellEx,
74
- TableEx,
75
- TableExWithRef,
76
- TableFooterEx,
77
- TableHeightContext,
78
- TableHeightProvider,
79
- useTableHeight
80
- };
81
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/TableEx/TableCellEx.tsx","../../src/components/TableEx/TableEx.tsx","../../src/components/TableEx/TableFooterEx.tsx","../../src/context/TableHeight/Context.ts","../../src/context/TableHeight/Provider.tsx","../../src/context/TableHeight/use.tsx"],"sourcesContent":["import { styled, TableCell, TableCellProps } from '@mui/material'\n\nexport interface TableCellExProps extends TableCellProps {\n noBgColor?: boolean\n}\n\nexport const TableCellEx = styled(TableCell, { name: 'TableCellNoBgColor', shouldForwardProp: (prop) => prop !== 'noBgColor' })<TableCellExProps>(\n ({ noBgColor = true }) => ({\n ...(noBgColor && { backgroundColor: 'transparent' }),\n }),\n)\n","import { Table, TableProps } from '@mui/material'\nimport { forwardRef, PropsWithChildren } from 'react'\n\nimport { TableExVariants } from './types/index.js'\n\nexport interface TableExProps extends PropsWithChildren, TableProps {\n variant?: TableExVariants\n}\n\nconst TableExInner = forwardRef<HTMLTableElement, TableExProps>(({ children, ...props }, ref) => {\n return (\n <Table ref={ref} {...props}>\n {children}\n </Table>\n )\n})\n\nTableExInner.displayName = 'TableExInner'\n\nexport const TableExWithRef = forwardRef<HTMLTableElement, TableExProps>(({ variant, children, ...props }, ref) => {\n return (\n <TableExInner stickyHeader={variant === 'scrollable'} ref={ref} {...props}>\n {children}\n </TableExInner>\n )\n})\n\nTableExWithRef.displayName = 'TableEx'\n\nexport const TableEx = TableExWithRef\n","import { styled, TableFooter, TableFooterProps } from '@mui/material'\nimport { PropsWithChildren } from 'react'\n\nimport { TableExVariants } from './types/index.js'\n\nconst TableFooterExRoot = styled(TableFooter, {\n name: 'TableFooterEx',\n shouldForwardProp: (propName) => propName !== 'scrollable',\n slot: 'Root',\n})<TableFooterExProps>(({ variant, theme }) => ({\n backgroundColor: theme.palette.background.default,\n bottom: 'unset',\n position: 'relative',\n ...(variant === 'scrollable' && {\n bottom: 0,\n position: 'sticky',\n }),\n}))\n\nexport interface TableFooterExProps extends PropsWithChildren, TableFooterProps {\n variant?: TableExVariants\n}\n\nexport const TableFooterEx: React.FC<TableFooterExProps> = ({ children, ...props }) => <TableFooterExRoot {...props}>{children}</TableFooterExRoot>\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { TableHeightState } from './State.js'\n\nexport const TableHeightContext = createContextEx<TableHeightState>()\n","import { WithChildren } from '@xylabs/react-shared'\nimport { ContextExProviderProps } from '@xyo-network/react-shared'\nimport { useEffect, useMemo, useState } from 'react'\n\nimport { TableHeightContext } from './Context.js'\n\nexport interface TableHeightProviderProps extends ContextExProviderProps, WithChildren {\n /** @field Account for optional header and footer rows */\n additionalRows?: number\n defaultVisibleRows?: number\n heightFormat?: string\n}\n\nexport const TableHeightProvider: React.FC<TableHeightProviderProps> = ({\n children,\n additionalRows = 0,\n defaultVisibleRows,\n heightFormat = 'px',\n}) => {\n const [visibleRows, setVisibleRows] = useState(defaultVisibleRows)\n const [height, setHeight] = useState<number | undefined>()\n const [rowHeight, setRowHeight] = useState<number | undefined>()\n\n const formattedHeight = useMemo(() => (height === undefined ? undefined : `${height}${heightFormat}`), [height, heightFormat])\n\n useEffect(() => {\n setVisibleRows(defaultVisibleRows)\n }, [defaultVisibleRows])\n\n useEffect(() => {\n if (rowHeight !== undefined && visibleRows !== undefined) {\n setHeight(rowHeight * (visibleRows + additionalRows))\n }\n }, [defaultVisibleRows, rowHeight, visibleRows, additionalRows])\n\n return (\n <TableHeightContext.Provider value={{ height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }}>\n {children}\n </TableHeightContext.Provider>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { TableHeightContext } from './Context.js'\n\nexport const useTableHeight = (required = false) => useContextEx(TableHeightContext, 'TableHeight', required)\n"],"mappings":";AAAA,SAAS,QAAQ,iBAAiC;AAM3C,IAA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BAAiB;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,81 +0,0 @@
1
- // src/components/TableEx/TableCellEx.tsx
2
- import { styled, TableCell } from "@mui/material";
3
- var TableCellEx = styled(TableCell, { name: "TableCellNoBgColor", shouldForwardProp: (prop) => prop !== "noBgColor" })(
4
- ({ noBgColor = true }) => ({
5
- ...noBgColor && { backgroundColor: "transparent" }
6
- })
7
- );
8
-
9
- // src/components/TableEx/TableEx.tsx
10
- import { Table } from "@mui/material";
11
- import { forwardRef } from "react";
12
- import { jsx } from "react/jsx-runtime";
13
- var TableExInner = forwardRef(({ children, ...props }, ref) => {
14
- return /* @__PURE__ */ jsx(Table, { ref, ...props, children });
15
- });
16
- TableExInner.displayName = "TableExInner";
17
- var TableExWithRef = forwardRef(({ variant, children, ...props }, ref) => {
18
- return /* @__PURE__ */ jsx(TableExInner, { stickyHeader: variant === "scrollable", ref, ...props, children });
19
- });
20
- TableExWithRef.displayName = "TableEx";
21
- var TableEx = TableExWithRef;
22
-
23
- // src/components/TableEx/TableFooterEx.tsx
24
- import { styled as styled2, TableFooter } from "@mui/material";
25
- import { jsx as jsx2 } from "react/jsx-runtime";
26
- var TableFooterExRoot = styled2(TableFooter, {
27
- name: "TableFooterEx",
28
- shouldForwardProp: (propName) => propName !== "scrollable",
29
- slot: "Root"
30
- })(({ variant, theme }) => ({
31
- backgroundColor: theme.palette.background.default,
32
- bottom: "unset",
33
- position: "relative",
34
- ...variant === "scrollable" && {
35
- bottom: 0,
36
- position: "sticky"
37
- }
38
- }));
39
- var TableFooterEx = ({ children, ...props }) => /* @__PURE__ */ jsx2(TableFooterExRoot, { ...props, children });
40
-
41
- // src/context/TableHeight/Context.ts
42
- import { createContextEx } from "@xyo-network/react-shared";
43
- var TableHeightContext = createContextEx();
44
-
45
- // src/context/TableHeight/Provider.tsx
46
- import { useEffect, useMemo, useState } from "react";
47
- import { jsx as jsx3 } from "react/jsx-runtime";
48
- var TableHeightProvider = ({
49
- children,
50
- additionalRows = 0,
51
- defaultVisibleRows,
52
- heightFormat = "px"
53
- }) => {
54
- const [visibleRows, setVisibleRows] = useState(defaultVisibleRows);
55
- const [height, setHeight] = useState();
56
- const [rowHeight, setRowHeight] = useState();
57
- const formattedHeight = useMemo(() => height === void 0 ? void 0 : `${height}${heightFormat}`, [height, heightFormat]);
58
- useEffect(() => {
59
- setVisibleRows(defaultVisibleRows);
60
- }, [defaultVisibleRows]);
61
- useEffect(() => {
62
- if (rowHeight !== void 0 && visibleRows !== void 0) {
63
- setHeight(rowHeight * (visibleRows + additionalRows));
64
- }
65
- }, [defaultVisibleRows, rowHeight, visibleRows, additionalRows]);
66
- return /* @__PURE__ */ jsx3(TableHeightContext.Provider, { value: { height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }, children });
67
- };
68
-
69
- // src/context/TableHeight/use.tsx
70
- import { useContextEx } from "@xyo-network/react-shared";
71
- var useTableHeight = (required = false) => useContextEx(TableHeightContext, "TableHeight", required);
72
- export {
73
- TableCellEx,
74
- TableEx,
75
- TableExWithRef,
76
- TableFooterEx,
77
- TableHeightContext,
78
- TableHeightProvider,
79
- useTableHeight
80
- };
81
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/TableEx/TableCellEx.tsx","../../src/components/TableEx/TableEx.tsx","../../src/components/TableEx/TableFooterEx.tsx","../../src/context/TableHeight/Context.ts","../../src/context/TableHeight/Provider.tsx","../../src/context/TableHeight/use.tsx"],"sourcesContent":["import { styled, TableCell, TableCellProps } from '@mui/material'\n\nexport interface TableCellExProps extends TableCellProps {\n noBgColor?: boolean\n}\n\nexport const TableCellEx = styled(TableCell, { name: 'TableCellNoBgColor', shouldForwardProp: (prop) => prop !== 'noBgColor' })<TableCellExProps>(\n ({ noBgColor = true }) => ({\n ...(noBgColor && { backgroundColor: 'transparent' }),\n }),\n)\n","import { Table, TableProps } from '@mui/material'\nimport { forwardRef, PropsWithChildren } from 'react'\n\nimport { TableExVariants } from './types/index.js'\n\nexport interface TableExProps extends PropsWithChildren, TableProps {\n variant?: TableExVariants\n}\n\nconst TableExInner = forwardRef<HTMLTableElement, TableExProps>(({ children, ...props }, ref) => {\n return (\n <Table ref={ref} {...props}>\n {children}\n </Table>\n )\n})\n\nTableExInner.displayName = 'TableExInner'\n\nexport const TableExWithRef = forwardRef<HTMLTableElement, TableExProps>(({ variant, children, ...props }, ref) => {\n return (\n <TableExInner stickyHeader={variant === 'scrollable'} ref={ref} {...props}>\n {children}\n </TableExInner>\n )\n})\n\nTableExWithRef.displayName = 'TableEx'\n\nexport const TableEx = TableExWithRef\n","import { styled, TableFooter, TableFooterProps } from '@mui/material'\nimport { PropsWithChildren } from 'react'\n\nimport { TableExVariants } from './types/index.js'\n\nconst TableFooterExRoot = styled(TableFooter, {\n name: 'TableFooterEx',\n shouldForwardProp: (propName) => propName !== 'scrollable',\n slot: 'Root',\n})<TableFooterExProps>(({ variant, theme }) => ({\n backgroundColor: theme.palette.background.default,\n bottom: 'unset',\n position: 'relative',\n ...(variant === 'scrollable' && {\n bottom: 0,\n position: 'sticky',\n }),\n}))\n\nexport interface TableFooterExProps extends PropsWithChildren, TableFooterProps {\n variant?: TableExVariants\n}\n\nexport const TableFooterEx: React.FC<TableFooterExProps> = ({ children, ...props }) => <TableFooterExRoot {...props}>{children}</TableFooterExRoot>\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { TableHeightState } from './State.js'\n\nexport const TableHeightContext = createContextEx<TableHeightState>()\n","import { WithChildren } from '@xylabs/react-shared'\nimport { ContextExProviderProps } from '@xyo-network/react-shared'\nimport { useEffect, useMemo, useState } from 'react'\n\nimport { TableHeightContext } from './Context.js'\n\nexport interface TableHeightProviderProps extends ContextExProviderProps, WithChildren {\n /** @field Account for optional header and footer rows */\n additionalRows?: number\n defaultVisibleRows?: number\n heightFormat?: string\n}\n\nexport const TableHeightProvider: React.FC<TableHeightProviderProps> = ({\n children,\n additionalRows = 0,\n defaultVisibleRows,\n heightFormat = 'px',\n}) => {\n const [visibleRows, setVisibleRows] = useState(defaultVisibleRows)\n const [height, setHeight] = useState<number | undefined>()\n const [rowHeight, setRowHeight] = useState<number | undefined>()\n\n const formattedHeight = useMemo(() => (height === undefined ? undefined : `${height}${heightFormat}`), [height, heightFormat])\n\n useEffect(() => {\n setVisibleRows(defaultVisibleRows)\n }, [defaultVisibleRows])\n\n useEffect(() => {\n if (rowHeight !== undefined && visibleRows !== undefined) {\n setHeight(rowHeight * (visibleRows + additionalRows))\n }\n }, [defaultVisibleRows, rowHeight, visibleRows, additionalRows])\n\n return (\n <TableHeightContext.Provider value={{ height: formattedHeight, provided: true, rowHeight, setRowHeight, setVisibleRows, visibleRows }}>\n {children}\n </TableHeightContext.Provider>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { TableHeightContext } from './Context.js'\n\nexport const useTableHeight = (required = false) => useContextEx(TableHeightContext, 'TableHeight', required)\n"],"mappings":";AAAA,SAAS,QAAQ,iBAAiC;AAM3C,IAAM,cAAc,OAAO,WAAW,EAAE,MAAM,sBAAsB,mBAAmB,CAAC,SAAS,SAAS,YAAY,CAAC;AAAA,EAC5H,CAAC,EAAE,YAAY,KAAK,OAAO;AAAA,IACzB,GAAI,aAAa,EAAE,iBAAiB,cAAc;AAAA,EACpD;AACF;;;ACVA,SAAS,aAAyB;AAClC,SAAS,kBAAqC;AAU1C;AAFJ,IAAM,eAAe,WAA2C,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ;AAC/F,SACE,oBAAC,SAAM,KAAW,GAAG,OAClB,UACH;AAEJ,CAAC;AAED,aAAa,cAAc;AAEpB,IAAM,iBAAiB,WAA2C,CAAC,EAAE,SAAS,UAAU,GAAG,MAAM,GAAG,QAAQ;AACjH,SACE,oBAAC,gBAAa,cAAc,YAAY,cAAc,KAAW,GAAG,OACjE,UACH;AAEJ,CAAC;AAED,eAAe,cAAc;AAEtB,IAAM,UAAU;;;AC7BvB,SAAS,UAAAA,SAAQ,mBAAqC;AAuBiC,gBAAAC,YAAA;AAlBvF,IAAM,oBAAoBD,QAAO,aAAa;AAAA,EAC5C,MAAM;AAAA,EACN,mBAAmB,CAAC,aAAa,aAAa;AAAA,EAC9C,MAAM;AACR,CAAC,EAAsB,CAAC,EAAE,SAAS,MAAM,OAAO;AAAA,EAC9C,iBAAiB,MAAM,QAAQ,WAAW;AAAA,EAC1C,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,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