schummar-table 0.10.5 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +968 -521
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.js +1018 -549
- package/dist/es/index.js.map +1 -1
- package/dist/types/components/table.d.ts +1 -0
- package/dist/types/hooks/useFilter.d.ts +1 -1
- package/dist/types/internalState/tableStateStorage.d.ts +3 -1
- package/dist/types/internalState/useTableState.d.ts +1 -1
- package/dist/types/misc/queue.d.ts +1 -0
- package/dist/types/types.d.ts +6 -0
- package/package.json +19 -17
- package/dist/cjs/mui4Theme.js +0 -98
- package/dist/cjs/mui4Theme.js.map +0 -1
- package/dist/cjs/mui5Theme.js +0 -102
- package/dist/cjs/mui5Theme.js.map +0 -1
- package/dist/cjs/tableTheme.js +0 -248
- package/dist/cjs/tableTheme.js.map +0 -1
- package/dist/es/mui4Theme.js +0 -94
- package/dist/es/mui4Theme.js.map +0 -1
- package/dist/es/mui5Theme.js +0 -98
- package/dist/es/mui5Theme.js.map +0 -1
- package/dist/es/tableTheme.js +0 -238
- package/dist/es/tableTheme.js.map +0 -1
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Store } from 'schummar-state/react';
|
|
3
3
|
import { Id, InternalTableState, TableProps } from '../types';
|
|
4
4
|
export declare const TableContext: React.Context<Store<InternalTableState<any>> | null>;
|
|
5
|
+
export declare const TableResetContext: React.Context<() => void>;
|
|
5
6
|
export declare const ColumnContext: React.Context<Id | null>;
|
|
6
7
|
export declare function useTableContext<T>(): Store<InternalTableState<T>>;
|
|
7
8
|
export declare function useColumnContext(): Id;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FilterImplementation, SerializableValue } from '../types';
|
|
2
2
|
export declare function useFilter<T, V, F, S extends SerializableValue>(impl: FilterImplementation<T, V, F, S>): {
|
|
3
3
|
value: S | undefined;
|
|
4
|
-
onChange: (value?: S
|
|
4
|
+
onChange: (value?: S) => void;
|
|
5
5
|
close: () => void;
|
|
6
6
|
filterBy: (value: V, item: T) => F | F[];
|
|
7
7
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Store } from 'schummar-state/react';
|
|
2
|
+
import { InternalTableState } from '../types';
|
|
1
3
|
export declare type TableStateStorage = {
|
|
2
4
|
getItem: (key: string) => string | null | Promise<string | null>;
|
|
3
5
|
setItem: (key: string, value: string) => unknown | Promise<unknown>;
|
|
@@ -8,4 +10,4 @@ export declare type TableStateStorage = {
|
|
|
8
10
|
length: number | (() => number | Promise<number>);
|
|
9
11
|
key: (keyIndex: number) => string | null | Promise<string | null>;
|
|
10
12
|
});
|
|
11
|
-
export declare function useTableStateStorage(): boolean;
|
|
13
|
+
export declare function useTableStateStorage(table: Store<InternalTableState<any>>): readonly [boolean, () => Promise<void>];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Store } from 'schummar-state/react';
|
|
2
2
|
import { InternalTableState, TableProps } from '../types';
|
|
3
|
-
export declare function useTableState<T>(_props: TableProps<T>): Store<InternalTableState<T
|
|
3
|
+
export declare function useTableState<T>(_props: TableProps<T>): [Store<InternalTableState<T>>, () => void];
|
package/dist/types/types.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export interface TableTheme<T = unknown> {
|
|
|
29
29
|
loading: ReactNode;
|
|
30
30
|
clearFilters: ReactNode;
|
|
31
31
|
deselectAll: ReactNode;
|
|
32
|
+
resetAll: ReactNode;
|
|
32
33
|
};
|
|
33
34
|
/** Define styles. */
|
|
34
35
|
classes?: {
|
|
@@ -136,6 +137,8 @@ export interface TableProps<T> extends PartialTableTheme<T> {
|
|
|
136
137
|
sort?: Sort[];
|
|
137
138
|
/** Called when sort order changes. */
|
|
138
139
|
onSortChange?: (sort: Sort[]) => void;
|
|
140
|
+
/** Handle sorting externally, e.g. server side */
|
|
141
|
+
externalSort?: boolean;
|
|
139
142
|
/** Default selection. */
|
|
140
143
|
defaultSelection?: Set<Id>;
|
|
141
144
|
/** If given, controls the selection. */
|
|
@@ -280,6 +283,7 @@ declare type Required<T, S> = T & {
|
|
|
280
283
|
};
|
|
281
284
|
export declare type InternalTableState<T> = {
|
|
282
285
|
props: InternalTableProps<T>;
|
|
286
|
+
key: any;
|
|
283
287
|
sort: Sort[];
|
|
284
288
|
selection: Set<Id>;
|
|
285
289
|
expanded: Set<Id>;
|
|
@@ -306,6 +310,8 @@ export declare type CommonFilterProps<T, V, F, S extends SerializableValue> = {
|
|
|
306
310
|
value?: S;
|
|
307
311
|
/** Notifies on filter change. */
|
|
308
312
|
onChange?: (value?: S) => void;
|
|
313
|
+
/** Table should not filter using this filter. It will be done externally, e.g. server side. */
|
|
314
|
+
external?: boolean;
|
|
309
315
|
/** Whether to persist filter value (given that filter persitance is enabled for the table).
|
|
310
316
|
* @default true
|
|
311
317
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "schummar-table",
|
|
3
3
|
"repository": "schummar/schummar-table",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.12.1",
|
|
5
5
|
"description": "",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": false,
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"license": "ISC",
|
|
46
46
|
"scripts": {
|
|
47
|
-
"start": "
|
|
47
|
+
"start": "npm -w docs start",
|
|
48
48
|
"build": "runp build:clean :p build:compile:* :s build:cjsPackage",
|
|
49
49
|
"build:clean": "rimraf \"dist/**/*\"",
|
|
50
50
|
"build:compile:js": "vite build",
|
|
@@ -54,13 +54,12 @@
|
|
|
54
54
|
"lint:eslint": "eslint src",
|
|
55
55
|
"lint:tsc": "tsc --emitDeclarationOnly false --noEmit",
|
|
56
56
|
"prepublishOnly": "runp :s lint build",
|
|
57
|
-
"docs": "npm -w docs start",
|
|
58
57
|
"docs:build": "npm -w docs run build"
|
|
59
58
|
},
|
|
60
59
|
"dependencies": {
|
|
61
|
-
"@emotion/react": "^11.
|
|
62
|
-
"dayzed": "^3.2.
|
|
63
|
-
"immer": "^9.0.
|
|
60
|
+
"@emotion/react": "^11.10.4",
|
|
61
|
+
"dayzed": "^3.2.3",
|
|
62
|
+
"immer": "^9.0.15",
|
|
64
63
|
"schummar-state": "0.2.1-experimental-13"
|
|
65
64
|
},
|
|
66
65
|
"peerDependencies": {
|
|
@@ -83,29 +82,32 @@
|
|
|
83
82
|
}
|
|
84
83
|
},
|
|
85
84
|
"devDependencies": {
|
|
86
|
-
"@emotion/styled": "^11.
|
|
85
|
+
"@emotion/styled": "^11.10.4",
|
|
87
86
|
"@material-ui/core": "^4.12.4",
|
|
88
|
-
"@mui/material": "^5.
|
|
87
|
+
"@mui/material": "^5.10.3",
|
|
89
88
|
"@schummar/runp": "^1.5.3",
|
|
90
89
|
"@types/react": "17",
|
|
91
90
|
"@types/react-dom": "^17.0.13",
|
|
92
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
93
|
-
"@typescript-eslint/parser": "^5.
|
|
94
|
-
"@vitejs/plugin-react": "^
|
|
95
|
-
"eslint": "^8.
|
|
96
|
-
"
|
|
91
|
+
"@typescript-eslint/eslint-plugin": "^5.36.1",
|
|
92
|
+
"@typescript-eslint/parser": "^5.36.1",
|
|
93
|
+
"@vitejs/plugin-react": "^2.0.1",
|
|
94
|
+
"eslint": "^8.23.0",
|
|
95
|
+
"eslint-plugin-storybook": "^0.6.4",
|
|
96
|
+
"prettier": "^2.7.1",
|
|
97
97
|
"react": "17",
|
|
98
98
|
"react-dom": "17",
|
|
99
99
|
"rimraf": "^3.0.2",
|
|
100
100
|
"semantic-release": "^19.0.5",
|
|
101
|
-
"typescript": "^4.
|
|
102
|
-
"vite": "^
|
|
101
|
+
"typescript": "^4.8.2",
|
|
102
|
+
"vite": "^3.0.9"
|
|
103
103
|
},
|
|
104
104
|
"files": [
|
|
105
105
|
"dist"
|
|
106
106
|
],
|
|
107
107
|
"workspaces": [
|
|
108
|
-
"example",
|
|
109
108
|
"docs"
|
|
110
|
-
]
|
|
109
|
+
],
|
|
110
|
+
"volta": {
|
|
111
|
+
"node": "16.17.0"
|
|
112
|
+
}
|
|
111
113
|
}
|
package/dist/cjs/mui4Theme.js
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
-
var __objRest = (source, exclude) => {
|
|
22
|
-
var target = {};
|
|
23
|
-
for (var prop in source)
|
|
24
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
-
target[prop] = source[prop];
|
|
26
|
-
if (source != null && __getOwnPropSymbols)
|
|
27
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
}
|
|
31
|
-
return target;
|
|
32
|
-
};
|
|
33
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
-
exports[Symbol.toStringTag] = "Module";
|
|
35
|
-
var core = require("@material-ui/core");
|
|
36
|
-
var react = require("react");
|
|
37
|
-
var tableTheme = require("./tableTheme.js");
|
|
38
|
-
var jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
39
|
-
require("react-dom");
|
|
40
|
-
require("@emotion/react");
|
|
41
|
-
const mui4Theme = {
|
|
42
|
-
components: {
|
|
43
|
-
Button: (props) => /* @__PURE__ */ jsxRuntime.jsx(core.Button, __spreadProps(__spreadValues({}, props), {
|
|
44
|
-
size: "small",
|
|
45
|
-
fullWidth: true,
|
|
46
|
-
css: {
|
|
47
|
-
justifyContent: "start !important"
|
|
48
|
-
},
|
|
49
|
-
color: props.variant === "contained" ? "primary" : "inherit"
|
|
50
|
-
})),
|
|
51
|
-
IconButton: (props) => /* @__PURE__ */ jsxRuntime.jsx(core.IconButton, __spreadProps(__spreadValues({}, props), {
|
|
52
|
-
size: "small",
|
|
53
|
-
color: "inherit"
|
|
54
|
-
})),
|
|
55
|
-
Checkbox: (props) => /* @__PURE__ */ jsxRuntime.jsx(core.Checkbox, __spreadProps(__spreadValues({}, props), {
|
|
56
|
-
color: "primary",
|
|
57
|
-
size: "medium"
|
|
58
|
-
})),
|
|
59
|
-
Popover: tableTheme.Popover,
|
|
60
|
-
Badge: core.Badge,
|
|
61
|
-
TextField: (_a) => {
|
|
62
|
-
var _b = _a, {
|
|
63
|
-
endIcon
|
|
64
|
-
} = _b, props = __objRest(_b, [
|
|
65
|
-
"endIcon"
|
|
66
|
-
]);
|
|
67
|
-
return /* @__PURE__ */ jsxRuntime.jsx(core.TextField, __spreadProps(__spreadValues({}, props), {
|
|
68
|
-
InputProps: {
|
|
69
|
-
endAdornment: endIcon
|
|
70
|
-
},
|
|
71
|
-
size: "small",
|
|
72
|
-
variant: "outlined"
|
|
73
|
-
}));
|
|
74
|
-
},
|
|
75
|
-
Spinner: core.CircularProgress
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
function Mui4TableThemeProvider({
|
|
79
|
-
theme,
|
|
80
|
-
children
|
|
81
|
-
}) {
|
|
82
|
-
const muiTheme = core.useTheme();
|
|
83
|
-
const _theme = react.useMemo(() => {
|
|
84
|
-
return tableTheme.mergeThemes({
|
|
85
|
-
colors: {
|
|
86
|
-
primary: muiTheme.palette.primary,
|
|
87
|
-
secondary: muiTheme.palette.secondary
|
|
88
|
-
}
|
|
89
|
-
}, mui4Theme, theme != null ? theme : {});
|
|
90
|
-
}, [muiTheme, theme]);
|
|
91
|
-
return /* @__PURE__ */ jsxRuntime.jsx(tableTheme.TableThemeContext.Provider, {
|
|
92
|
-
value: _theme,
|
|
93
|
-
children
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
exports.Mui4TableThemeProvider = Mui4TableThemeProvider;
|
|
97
|
-
exports.mui4Theme = mui4Theme;
|
|
98
|
-
//# sourceMappingURL=mui4Theme.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mui4Theme.js","sources":["../../src/theme/mui4Theme/index.tsx"],"sourcesContent":["import { Badge, Button, Checkbox, CircularProgress, IconButton, TextField, useTheme } from '@material-ui/core';\nimport { ReactNode, useMemo } from 'react';\nimport { PartialTableTheme } from '../../types';\nimport { Popover } from '../defaultTheme/popover';\nimport { mergeThemes, TableThemeContext } from '../tableTheme';\n\nexport const mui4Theme: PartialTableTheme = {\n components: {\n Button: (props) => (\n <Button\n {...props}\n size=\"small\"\n fullWidth\n css={{ justifyContent: 'start !important' }}\n color={props.variant === 'contained' ? 'primary' : 'inherit'}\n />\n ),\n IconButton: (props) => <IconButton {...props} size=\"small\" color=\"inherit\" />,\n Checkbox: (props) => <Checkbox {...props} color=\"primary\" size=\"medium\" />,\n Popover,\n Badge,\n TextField: ({ endIcon, ...props }) => <TextField {...props} InputProps={{ endAdornment: endIcon }} size=\"small\" variant=\"outlined\" />,\n Spinner: CircularProgress,\n },\n};\n\nexport function Mui4TableThemeProvider({ theme, children }: { theme?: PartialTableTheme; children: ReactNode }) {\n const muiTheme = useTheme();\n\n const _theme = useMemo(() => {\n return mergeThemes(\n {\n colors: {\n primary: muiTheme.palette.primary,\n secondary: muiTheme.palette.secondary,\n },\n },\n mui4Theme,\n theme ?? {},\n );\n }, [muiTheme, theme]);\n\n return <TableThemeContext.Provider value={_theme}>{children}</TableThemeContext.Provider>;\n}\n"],"names":["mui4Theme","components","Button","props","justifyContent","variant","IconButton","Checkbox","Popover","Badge","TextField","endIcon","endAdornment","Spinner","CircularProgress","theme","children","muiTheme","useTheme","_theme","useMemo","mergeThemes","colors","primary","palette","secondary","TableThemeContext"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAMaA,YAA+B;AAAA,EAC1CC,YAAY;AAAA,IACVC,QAASC,0CACND,8CACKC;MACJ,MAAK;AAAA,MACL;MACA,KAAK;AAAA,QAAEC,gBAAgB;AAAA;MACvB,OAAOD,MAAME,YAAY,cAAc,YAAY;AAAA;IAGvDC,YAAaH,0CAAWG,kDAAeH;MAAO,MAAK;AAAA,MAAQ,OAAM;AAAA;IACjEI,UAAWJ,0CAAWI,gDAAaJ;MAAO,OAAM;AAAA,MAAU,MAAK;AAAA;aAC/DK;WACAC;IACAC,WAAW,CAAC;AAAA,mBAAEC;AAAAA;AAAAA,UAAF,IAAcR,kBAAd,IAAcA;AAAAA,QAAZQ;AAAAA;4CAAyBD,iDAAcP;QAAO,YAAY;AAAA,UAAES,cAAcD;AAAAA;QAAW,MAAK;AAAA,QAAQ,SAAQ;AAAA;;IACxHE,SAASC;;AAhB+B;gCAoBL;AAAA,EAAEC;AAAAA,EAAOC;AAAAA,GAAgE;QACxGC,WAAWC;QAEXC,SAASC,cAAQ,MAAM;WACpBC,uBACL;AAAA,MACEC,QAAQ;AAAA,QACNC,SAASN,SAASO,QAAQD;AAAAA,QAC1BE,WAAWR,SAASO,QAAQC;AAAAA;OAGhCzB,WACAe,wBAAS,EARO;AAAA,KAUjB,CAACE,UAAUF,KAAX,CAXmB;wCAadW,6BAAkB;IAAS,OAAOP;AAAAA;;AAC3C;;;"}
|
package/dist/cjs/mui5Theme.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
-
var __objRest = (source, exclude) => {
|
|
22
|
-
var target = {};
|
|
23
|
-
for (var prop in source)
|
|
24
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
-
target[prop] = source[prop];
|
|
26
|
-
if (source != null && __getOwnPropSymbols)
|
|
27
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
}
|
|
31
|
-
return target;
|
|
32
|
-
};
|
|
33
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
-
exports[Symbol.toStringTag] = "Module";
|
|
35
|
-
var material = require("@mui/material");
|
|
36
|
-
var react = require("react");
|
|
37
|
-
var tableTheme = require("./tableTheme.js");
|
|
38
|
-
var jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
39
|
-
require("react-dom");
|
|
40
|
-
require("@emotion/react");
|
|
41
|
-
const mui5Theme = {
|
|
42
|
-
components: {
|
|
43
|
-
Button: (props) => /* @__PURE__ */ jsxRuntime.jsx(material.Button, __spreadProps(__spreadValues({}, props), {
|
|
44
|
-
size: "small",
|
|
45
|
-
fullWidth: true,
|
|
46
|
-
css: {
|
|
47
|
-
justifyContent: "start !important"
|
|
48
|
-
},
|
|
49
|
-
color: props.variant === "contained" ? "primary" : "inherit"
|
|
50
|
-
})),
|
|
51
|
-
IconButton: (props) => /* @__PURE__ */ jsxRuntime.jsx(material.IconButton, __spreadProps(__spreadValues({}, props), {
|
|
52
|
-
size: "small",
|
|
53
|
-
css: {
|
|
54
|
-
fontSize: "0.8em"
|
|
55
|
-
},
|
|
56
|
-
color: "inherit"
|
|
57
|
-
})),
|
|
58
|
-
Checkbox: (props) => /* @__PURE__ */ jsxRuntime.jsx(material.Checkbox, __spreadProps(__spreadValues({}, props), {
|
|
59
|
-
color: "primary",
|
|
60
|
-
size: "small"
|
|
61
|
-
})),
|
|
62
|
-
Popover: tableTheme.Popover,
|
|
63
|
-
Badge: material.Badge,
|
|
64
|
-
TextField: (_a) => {
|
|
65
|
-
var _b = _a, {
|
|
66
|
-
endIcon
|
|
67
|
-
} = _b, props = __objRest(_b, [
|
|
68
|
-
"endIcon"
|
|
69
|
-
]);
|
|
70
|
-
return /* @__PURE__ */ jsxRuntime.jsx(material.TextField, __spreadProps(__spreadValues({}, props), {
|
|
71
|
-
InputProps: {
|
|
72
|
-
endAdornment: endIcon
|
|
73
|
-
},
|
|
74
|
-
size: "small"
|
|
75
|
-
}));
|
|
76
|
-
},
|
|
77
|
-
Spinner: (props) => /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, __spreadProps(__spreadValues({}, props), {
|
|
78
|
-
size: 20
|
|
79
|
-
}))
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
function Mui5TableThemeProvider({
|
|
83
|
-
theme,
|
|
84
|
-
children
|
|
85
|
-
}) {
|
|
86
|
-
const muiTheme = material.useTheme();
|
|
87
|
-
const _theme = react.useMemo(() => {
|
|
88
|
-
return tableTheme.mergeThemes({
|
|
89
|
-
colors: {
|
|
90
|
-
primary: muiTheme.palette.primary,
|
|
91
|
-
secondary: muiTheme.palette.secondary
|
|
92
|
-
}
|
|
93
|
-
}, mui5Theme, theme != null ? theme : {});
|
|
94
|
-
}, [muiTheme, theme]);
|
|
95
|
-
return /* @__PURE__ */ jsxRuntime.jsx(tableTheme.TableThemeContext.Provider, {
|
|
96
|
-
value: _theme,
|
|
97
|
-
children
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
exports.Mui5TableThemeProvider = Mui5TableThemeProvider;
|
|
101
|
-
exports.mui5Theme = mui5Theme;
|
|
102
|
-
//# sourceMappingURL=mui5Theme.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mui5Theme.js","sources":["../../src/theme/mui5Theme/index.tsx"],"sourcesContent":["import { Badge, Button, Checkbox, CircularProgress, IconButton, TextField, useTheme } from '@mui/material';\nimport { ReactNode, useMemo } from 'react';\nimport { PartialTableTheme } from '../../types';\nimport { Popover } from '../defaultTheme/popover';\nimport { mergeThemes, TableThemeContext } from '../tableTheme';\n\nexport const mui5Theme: PartialTableTheme = {\n components: {\n Button: (props) => (\n <Button\n {...props}\n size=\"small\"\n fullWidth\n css={{ justifyContent: 'start !important' }}\n color={props.variant === 'contained' ? 'primary' : 'inherit'}\n />\n ),\n IconButton: (props) => <IconButton {...props} size=\"small\" css={{ fontSize: '0.8em' }} color=\"inherit\" />,\n Checkbox: (props) => <Checkbox {...props} color=\"primary\" size=\"small\" />,\n Popover,\n Badge,\n TextField: ({ endIcon, ...props }) => <TextField {...props} InputProps={{ endAdornment: endIcon }} size=\"small\" />,\n Spinner: (props) => <CircularProgress {...props} size={20} />,\n },\n};\n\nexport function Mui5TableThemeProvider({ theme, children }: { theme?: PartialTableTheme; children: ReactNode }) {\n const muiTheme = useTheme();\n\n const _theme = useMemo(() => {\n return mergeThemes(\n {\n colors: {\n primary: muiTheme.palette.primary,\n secondary: muiTheme.palette.secondary,\n },\n },\n mui5Theme,\n theme ?? {},\n );\n }, [muiTheme, theme]);\n\n return <TableThemeContext.Provider value={_theme}>{children}</TableThemeContext.Provider>;\n}\n"],"names":["mui5Theme","components","Button","props","justifyContent","variant","IconButton","fontSize","Checkbox","Popover","Badge","TextField","endIcon","endAdornment","Spinner","CircularProgress","theme","children","muiTheme","useTheme","_theme","useMemo","mergeThemes","colors","primary","palette","secondary","TableThemeContext"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAMaA,YAA+B;AAAA,EAC1CC,YAAY;AAAA,IACVC,QAASC,0CACND,kDACKC;MACJ,MAAK;AAAA,MACL;MACA,KAAK;AAAA,QAAEC,gBAAgB;AAAA;MACvB,OAAOD,MAAME,YAAY,cAAc,YAAY;AAAA;IAGvDC,YAAaH,0CAAWG,sDAAeH;MAAO,MAAK;AAAA,MAAQ,KAAK;AAAA,QAAEI,UAAU;AAAA;MAAW,OAAM;AAAA;IAC7FC,UAAWL,0CAAWK,oDAAaL;MAAO,OAAM;AAAA,MAAU,MAAK;AAAA;aAC/DM;WACAC;IACAC,WAAW,CAAC;AAAA,mBAAEC;AAAAA;AAAAA,UAAF,IAAcT,kBAAd,IAAcA;AAAAA,QAAZS;AAAAA;4CAAyBD,qDAAcR;QAAO,YAAY;AAAA,UAAEU,cAAcD;AAAAA;QAAW,MAAK;AAAA;;IACxGE,SAAUX,0CAAWY,4DAAqBZ;MAAO,MAAM;AAAA;;AAhBf;gCAoBL;AAAA,EAAEa;AAAAA,EAAOC;AAAAA,GAAgE;QACxGC,WAAWC;QAEXC,SAASC,cAAQ,MAAM;WACpBC,uBACL;AAAA,MACEC,QAAQ;AAAA,QACNC,SAASN,SAASO,QAAQD;AAAAA,QAC1BE,WAAWR,SAASO,QAAQC;AAAAA;OAGhC1B,WACAgB,wBAAS,EARO;AAAA,KAUjB,CAACE,UAAUF,KAAX,CAXmB;wCAadW,6BAAkB;IAAS,OAAOP;AAAAA;;AAC3C;;;"}
|
package/dist/cjs/tableTheme.js
DELETED
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
-
var react$1 = require("react");
|
|
22
|
-
var reactDom = require("react-dom");
|
|
23
|
-
var react = require("@emotion/react");
|
|
24
|
-
var jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
25
|
-
const white = "#ffffff";
|
|
26
|
-
const lightGray = "#eeeeee";
|
|
27
|
-
const gray = "#bdbdbd";
|
|
28
|
-
const darkGray = "#777";
|
|
29
|
-
const cell = react.css({
|
|
30
|
-
padding: `calc(var(--spacing) * 0.1) calc(2 * var(--spacing))`,
|
|
31
|
-
display: "flex",
|
|
32
|
-
alignItems: "center",
|
|
33
|
-
borderBottom: `1px solid #dfe2e9`,
|
|
34
|
-
whiteSpace: "nowrap",
|
|
35
|
-
overflow: "hidden",
|
|
36
|
-
background: "white"
|
|
37
|
-
});
|
|
38
|
-
const defaultClasses = {
|
|
39
|
-
table: react.css({
|
|
40
|
-
position: "relative",
|
|
41
|
-
display: "grid"
|
|
42
|
-
}),
|
|
43
|
-
cell,
|
|
44
|
-
cellFill: react.css({
|
|
45
|
-
borderBottom: `1px solid ${lightGray}`
|
|
46
|
-
}),
|
|
47
|
-
headerCell: react.css(cell, {
|
|
48
|
-
padding: `var(--spacing) 0 var(--spacing) calc(2 * var(--spacing))`,
|
|
49
|
-
borderBottom: `1px solid #c9cfda`
|
|
50
|
-
}),
|
|
51
|
-
footerCell: react.css(cell, {
|
|
52
|
-
padding: `var(--spacing) calc(2 * var(--spacing))`,
|
|
53
|
-
borderTop: `1px solid #c9cfda`,
|
|
54
|
-
borderBottom: "none"
|
|
55
|
-
}),
|
|
56
|
-
firstCell: react.css({
|
|
57
|
-
justifyContent: "start"
|
|
58
|
-
}),
|
|
59
|
-
sticky: react.css({
|
|
60
|
-
position: "sticky",
|
|
61
|
-
top: 0,
|
|
62
|
-
zIndex: 2
|
|
63
|
-
}),
|
|
64
|
-
stickyBottom: react.css({
|
|
65
|
-
position: "sticky",
|
|
66
|
-
bottom: 0,
|
|
67
|
-
zIndex: 2
|
|
68
|
-
}),
|
|
69
|
-
headerFill: react.css({
|
|
70
|
-
borderBottom: `1px solid #c9cfda`,
|
|
71
|
-
background: white
|
|
72
|
-
}),
|
|
73
|
-
footerFill: react.css({
|
|
74
|
-
borderTop: `1px solid #c9cfda`,
|
|
75
|
-
background: white
|
|
76
|
-
}),
|
|
77
|
-
text: react.css({
|
|
78
|
-
minWidth: 0,
|
|
79
|
-
overflow: "hidden",
|
|
80
|
-
textOverflow: "ellipsis"
|
|
81
|
-
}),
|
|
82
|
-
card: react.css({
|
|
83
|
-
borderRadius: 4,
|
|
84
|
-
boxShadow: "0px 3px 14px 2px rgb(0 0 0 / 12%)",
|
|
85
|
-
background: "white"
|
|
86
|
-
}),
|
|
87
|
-
clearFiltersButton: react.css({
|
|
88
|
-
padding: `0 calc(2 * var(--spacing))`,
|
|
89
|
-
fontWeight: "bold",
|
|
90
|
-
position: "sticky",
|
|
91
|
-
left: 0,
|
|
92
|
-
maxWidth: "fit-content",
|
|
93
|
-
gridColumn: "2/-1",
|
|
94
|
-
button: {
|
|
95
|
-
color: "var(--primaryMain) !important",
|
|
96
|
-
border: "solid 1px",
|
|
97
|
-
borderColor: "var(--primaryMain) !important",
|
|
98
|
-
margin: "var(--spacing)"
|
|
99
|
-
}
|
|
100
|
-
})
|
|
101
|
-
};
|
|
102
|
-
const MARGIN = 10;
|
|
103
|
-
const MAX_OFFSET = 20;
|
|
104
|
-
const PopoverContext = react$1.createContext({
|
|
105
|
-
depth: 0,
|
|
106
|
-
visible: false
|
|
107
|
-
});
|
|
108
|
-
const Popover = ({
|
|
109
|
-
anchorEl,
|
|
110
|
-
open,
|
|
111
|
-
hidden,
|
|
112
|
-
onClose,
|
|
113
|
-
children,
|
|
114
|
-
className,
|
|
115
|
-
align
|
|
116
|
-
}) => {
|
|
117
|
-
const popper = react$1.useRef(null);
|
|
118
|
-
const [position, setPosition] = react$1.useState();
|
|
119
|
-
react$1.useLayoutEffect(() => {
|
|
120
|
-
if (!anchorEl || !open) {
|
|
121
|
-
setPosition(void 0);
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
let last;
|
|
125
|
-
function check() {
|
|
126
|
-
var _a, _b;
|
|
127
|
-
if (!anchorEl)
|
|
128
|
-
return;
|
|
129
|
-
const {
|
|
130
|
-
left: anchorLeft,
|
|
131
|
-
bottom: anchorBottom,
|
|
132
|
-
width: anchorWidth
|
|
133
|
-
} = anchorEl.getBoundingClientRect();
|
|
134
|
-
const {
|
|
135
|
-
width: popperWidth = 0,
|
|
136
|
-
height: popperHeight = 0
|
|
137
|
-
} = (_b = (_a = popper.current) == null ? void 0 : _a.getBoundingClientRect()) != null ? _b : {};
|
|
138
|
-
const viewportWidth = document.documentElement.clientWidth;
|
|
139
|
-
const viewportHeight = document.documentElement.clientHeight;
|
|
140
|
-
const next = {
|
|
141
|
-
left: align === "center" ? anchorLeft + anchorWidth / 2 - popperWidth / 2 : anchorLeft - Math.min(popperWidth ? popperWidth / 2 : Infinity, MAX_OFFSET),
|
|
142
|
-
top: anchorBottom
|
|
143
|
-
};
|
|
144
|
-
if (next.left + popperWidth + MARGIN > viewportWidth) {
|
|
145
|
-
next.left = viewportWidth - popperWidth - MARGIN;
|
|
146
|
-
}
|
|
147
|
-
if (next.top + popperHeight + MARGIN > viewportHeight) {
|
|
148
|
-
next.top = viewportHeight - popperHeight - MARGIN;
|
|
149
|
-
}
|
|
150
|
-
if (next.left !== (last == null ? void 0 : last.left) || next.top !== (last == null ? void 0 : last.top)) {
|
|
151
|
-
setPosition(next);
|
|
152
|
-
}
|
|
153
|
-
last = next;
|
|
154
|
-
}
|
|
155
|
-
check();
|
|
156
|
-
const handle = setInterval(check, 16);
|
|
157
|
-
return () => {
|
|
158
|
-
clearInterval(handle);
|
|
159
|
-
};
|
|
160
|
-
}, [anchorEl, open]);
|
|
161
|
-
const {
|
|
162
|
-
depth
|
|
163
|
-
} = react$1.useContext(PopoverContext);
|
|
164
|
-
const visible = !hidden && !!position;
|
|
165
|
-
const context = react$1.useMemo(() => ({
|
|
166
|
-
depth: depth + 1,
|
|
167
|
-
visible
|
|
168
|
-
}), [depth, visible]);
|
|
169
|
-
if (!open)
|
|
170
|
-
return null;
|
|
171
|
-
return /* @__PURE__ */ jsxRuntime.jsx(PopoverContext.Provider, {
|
|
172
|
-
value: context,
|
|
173
|
-
children: reactDom.createPortal(/* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
174
|
-
children: [/* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
175
|
-
css: [{
|
|
176
|
-
position: "fixed",
|
|
177
|
-
left: 0,
|
|
178
|
-
right: 0,
|
|
179
|
-
top: 0,
|
|
180
|
-
bottom: 0,
|
|
181
|
-
zIndex: 1e3 + depth * 2
|
|
182
|
-
}, hidden && {
|
|
183
|
-
display: "none"
|
|
184
|
-
}],
|
|
185
|
-
onClick: () => onClose()
|
|
186
|
-
}), /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
187
|
-
ref: popper,
|
|
188
|
-
className,
|
|
189
|
-
css: [defaultClasses.card, __spreadProps(__spreadValues({
|
|
190
|
-
position: "fixed",
|
|
191
|
-
maxWidth: document.documentElement.clientWidth,
|
|
192
|
-
maxHeight: document.documentElement.clientHeight
|
|
193
|
-
}, position), {
|
|
194
|
-
zIndex: 1001 + depth * 2
|
|
195
|
-
}), hidden && {
|
|
196
|
-
display: "none"
|
|
197
|
-
}, !position && {
|
|
198
|
-
visibility: "hidden"
|
|
199
|
-
}],
|
|
200
|
-
children
|
|
201
|
-
})]
|
|
202
|
-
}), document.body)
|
|
203
|
-
});
|
|
204
|
-
};
|
|
205
|
-
exports.globalTableTheme = {};
|
|
206
|
-
function configureTableTheme(tableTheme) {
|
|
207
|
-
exports.globalTableTheme = tableTheme;
|
|
208
|
-
}
|
|
209
|
-
const TableThemeContext = react$1.createContext({});
|
|
210
|
-
function TableThemeProvider({
|
|
211
|
-
theme,
|
|
212
|
-
children
|
|
213
|
-
}) {
|
|
214
|
-
return /* @__PURE__ */ jsxRuntime.jsx(TableThemeContext.Provider, {
|
|
215
|
-
value: theme,
|
|
216
|
-
children
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
function mergeThemes(...themes) {
|
|
220
|
-
return {
|
|
221
|
-
text: Object.assign({}, ...themes.map((theme) => theme.text)),
|
|
222
|
-
classes: Object.assign({}, ...themes.map((theme) => theme.classes)),
|
|
223
|
-
components: Object.assign({}, ...themes.map((theme) => theme.components)),
|
|
224
|
-
icons: Object.assign({}, ...themes.map((theme) => theme.icons)),
|
|
225
|
-
colors: {
|
|
226
|
-
primary: Object.assign({}, ...themes.map((theme) => {
|
|
227
|
-
var _a;
|
|
228
|
-
return (_a = theme.colors) == null ? void 0 : _a.primary;
|
|
229
|
-
})),
|
|
230
|
-
secondary: Object.assign({}, ...themes.map((theme) => {
|
|
231
|
-
var _a;
|
|
232
|
-
return (_a = theme.colors) == null ? void 0 : _a.secondary;
|
|
233
|
-
}))
|
|
234
|
-
},
|
|
235
|
-
spacing: themes.map((theme) => theme.spacing).reverse().find((x) => x !== void 0)
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
exports.Popover = Popover;
|
|
239
|
-
exports.PopoverContext = PopoverContext;
|
|
240
|
-
exports.TableThemeContext = TableThemeContext;
|
|
241
|
-
exports.TableThemeProvider = TableThemeProvider;
|
|
242
|
-
exports.configureTableTheme = configureTableTheme;
|
|
243
|
-
exports.darkGray = darkGray;
|
|
244
|
-
exports.defaultClasses = defaultClasses;
|
|
245
|
-
exports.gray = gray;
|
|
246
|
-
exports.lightGray = lightGray;
|
|
247
|
-
exports.mergeThemes = mergeThemes;
|
|
248
|
-
//# sourceMappingURL=tableTheme.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tableTheme.js","sources":["../../src/theme/defaultTheme/defaultClasses.ts","../../src/theme/defaultTheme/popover.tsx","../../src/theme/tableTheme.tsx"],"sourcesContent":["import { css } from '@emotion/react';\n\nexport const white = '#ffffff';\nexport const lightGray = '#eeeeee';\nexport const gray = '#bdbdbd';\nexport const darkGray = '#777';\n\nconst cell = css({\n padding: `calc(var(--spacing) * 0.1) calc(2 * var(--spacing))`,\n display: 'flex',\n alignItems: 'center',\n borderBottom: `1px solid #dfe2e9`,\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n background: 'white',\n});\n\nexport const defaultClasses = {\n table: css({\n position: 'relative',\n display: 'grid',\n }),\n\n cell,\n\n cellFill: css({\n borderBottom: `1px solid ${lightGray}`,\n }),\n\n headerCell: css(cell, {\n padding: `var(--spacing) 0 var(--spacing) calc(2 * var(--spacing))`,\n borderBottom: `1px solid #c9cfda`,\n }),\n\n footerCell: css(cell, {\n padding: `var(--spacing) calc(2 * var(--spacing))`,\n borderTop: `1px solid #c9cfda`,\n borderBottom: 'none',\n }),\n\n firstCell: css({\n justifyContent: 'start',\n }),\n\n sticky: css({\n position: 'sticky',\n top: 0,\n zIndex: 2,\n }),\n\n stickyBottom: css({\n position: 'sticky',\n bottom: 0,\n zIndex: 2,\n }),\n\n headerFill: css({\n borderBottom: `1px solid #c9cfda`,\n background: white,\n }),\n\n footerFill: css({\n borderTop: `1px solid #c9cfda`,\n background: white,\n }),\n\n text: css({\n minWidth: 0,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n }),\n\n card: css({\n borderRadius: 4,\n boxShadow: '0px 3px 14px 2px rgb(0 0 0 / 12%)',\n background: 'white',\n }),\n\n clearFiltersButton: css({\n padding: `0 calc(2 * var(--spacing))`,\n fontWeight: 'bold',\n position: 'sticky',\n left: 0,\n maxWidth: 'fit-content',\n gridColumn: '2/-1',\n button: {\n color: 'var(--primaryMain) !important',\n border: 'solid 1px',\n borderColor: 'var(--primaryMain) !important',\n margin: 'var(--spacing)',\n },\n }),\n};\n","import React, { createContext, useContext, useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport { TableTheme } from '../../types';\nimport { defaultClasses } from './defaultClasses';\n\nconst MARGIN = 10;\nconst MAX_OFFSET = 20;\n\nexport const PopoverContext = createContext({ depth: 0, visible: false });\n\nexport const Popover: TableTheme['components']['Popover'] = ({ anchorEl, open, hidden, onClose, children, className, align }) => {\n const popper = useRef<HTMLDivElement>(null);\n const [position, setPosition] = useState<{ left: number; top: number }>();\n\n useLayoutEffect(() => {\n if (!anchorEl || !open) {\n setPosition(undefined);\n return;\n }\n\n let last: { left: number; top: number } | undefined;\n\n function check() {\n if (!anchorEl) return;\n const { left: anchorLeft, bottom: anchorBottom, width: anchorWidth } = anchorEl.getBoundingClientRect();\n const { width: popperWidth = 0, height: popperHeight = 0 } = popper.current?.getBoundingClientRect() ?? {};\n const viewportWidth = document.documentElement.clientWidth;\n const viewportHeight = document.documentElement.clientHeight;\n\n const next = {\n left:\n align === 'center'\n ? anchorLeft + anchorWidth / 2 - popperWidth / 2\n : anchorLeft - Math.min(popperWidth ? popperWidth / 2 : Infinity, MAX_OFFSET),\n top: anchorBottom,\n };\n\n if (next.left + popperWidth + MARGIN > viewportWidth) {\n next.left = viewportWidth - popperWidth - MARGIN;\n }\n if (next.top + popperHeight + MARGIN > viewportHeight) {\n next.top = viewportHeight - popperHeight - MARGIN;\n }\n\n if (next.left !== last?.left || next.top !== last?.top) {\n setPosition(next);\n }\n\n last = next;\n }\n check();\n\n const handle = setInterval(check, 16);\n return () => {\n clearInterval(handle);\n };\n }, [anchorEl, open]);\n\n const { depth } = useContext(PopoverContext);\n const visible = !hidden && !!position;\n const context = useMemo(() => ({ depth: depth + 1, visible }), [depth, visible]);\n\n if (!open) return null;\n\n return (\n <PopoverContext.Provider value={context}>\n {createPortal(\n <>\n <div\n css={[\n {\n position: 'fixed',\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n zIndex: 1000 + depth * 2,\n },\n hidden && { display: 'none' },\n ]}\n onClick={() => onClose()}\n />\n\n <div\n ref={popper}\n className={className}\n css={[\n defaultClasses.card,\n {\n position: 'fixed',\n maxWidth: document.documentElement.clientWidth,\n maxHeight: document.documentElement.clientHeight,\n ...position,\n zIndex: 1001 + depth * 2,\n },\n hidden && { display: 'none' },\n !position && { visibility: 'hidden' },\n ]}\n >\n {children}\n </div>\n </>,\n document.body,\n )}\n </PopoverContext.Provider>\n );\n};\n","import { createContext, ReactNode } from 'react';\nimport { PartialTableTheme } from '../types';\n\nexport let globalTableTheme: PartialTableTheme = {};\nexport function configureTableTheme(tableTheme: PartialTableTheme) {\n globalTableTheme = tableTheme;\n}\n\nexport const TableThemeContext = createContext<PartialTableTheme>({});\n\nexport function TableThemeProvider({ theme, children }: { theme: PartialTableTheme; children: ReactNode }) {\n return <TableThemeContext.Provider value={theme}>{children}</TableThemeContext.Provider>;\n}\n\nexport function mergeThemes<T>(...themes: PartialTableTheme<T>[]): PartialTableTheme<T> {\n return {\n text: Object.assign({}, ...themes.map((theme) => theme.text)),\n classes: Object.assign({}, ...themes.map((theme) => theme.classes)),\n components: Object.assign({}, ...themes.map((theme) => theme.components)),\n icons: Object.assign({}, ...themes.map((theme) => theme.icons)),\n colors: {\n primary: Object.assign({}, ...themes.map((theme) => theme.colors?.primary)),\n secondary: Object.assign({}, ...themes.map((theme) => theme.colors?.secondary)),\n },\n spacing: themes\n .map((theme) => theme.spacing)\n .reverse()\n .find((x) => x !== undefined),\n };\n}\n"],"names":["css","MARGIN","MAX_OFFSET","PopoverContext","createContext","depth","visible","Popover","anchorEl","open","hidden","onClose","children","className","align","popper","useRef","position","setPosition","useState","undefined","last","left","anchorLeft","bottom","anchorBottom","width","anchorWidth","getBoundingClientRect","popperWidth","height","popperHeight","current","viewportWidth","document","documentElement","clientWidth","viewportHeight","clientHeight","next","Math","min","Infinity","top","handle","setInterval","check","useContext","context","useMemo","createPortal","right","zIndex","display","defaultClasses","card","maxWidth","maxHeight","visibility","body","globalTableTheme","tableTheme","TableThemeContext","theme","themes","text","Object","assign","map","classes","components","icons","colors","primary","secondary","spacing","reverse","find","x"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;MAEa,QAAQ;MACR,YAAY;MACZ,OAAO;MACP,WAAW;AAExB,MAAM,OAAOA,UAAI;AAAA,EACf,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