@monolith-forensics/monolith-ui 1.2.98 → 1.2.100
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,5 +1,5 @@
|
|
|
1
1
|
import { DefaultTheme } from "styled-components";
|
|
2
|
-
export { styled,
|
|
2
|
+
export { styled, createGlobalStyle, css } from "styled-components";
|
|
3
3
|
import { Themes } from "../theme";
|
|
4
4
|
import React from "react";
|
|
5
5
|
import typography from "../theme/typography";
|
|
@@ -142,3 +142,4 @@ interface MonolithUIProviderProps {
|
|
|
142
142
|
colorScheme?: Themes;
|
|
143
143
|
}
|
|
144
144
|
export declare const MonolithUIProvider: ({ children, theme, defaultColorScheme, colorScheme, }: MonolithUIProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
145
|
+
export declare const useTheme: () => MonolithDefaultTheme;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import merge from "deepmerge";
|
|
3
|
-
import { ThemeProvider } from "styled-components";
|
|
4
|
-
export { styled,
|
|
3
|
+
import { ThemeProvider, useTheme as useStyledTheme, } from "styled-components";
|
|
4
|
+
export { styled, createGlobalStyle, css } from "styled-components";
|
|
5
5
|
import { Themes, getTheme } from "../theme";
|
|
6
6
|
import { createContext, useEffect, useState } from "react";
|
|
7
7
|
import GlobalStyle from "./GlobalStyle";
|
|
@@ -28,3 +28,7 @@ export const MonolithUIProvider = ({ children, theme, defaultColorScheme = local
|
|
|
28
28
|
setColorScheme: setColorSchemeState,
|
|
29
29
|
}, children: _jsxs(ThemeProvider, { theme: _theme, children: [_jsx(GlobalStyle, { theme: _theme }), children] }) }));
|
|
30
30
|
};
|
|
31
|
+
// Custom typed useTheme hook
|
|
32
|
+
export const useTheme = () => {
|
|
33
|
+
return useStyledTheme();
|
|
34
|
+
};
|
|
@@ -11,6 +11,7 @@ import InfoBadge from "./InfoBadge";
|
|
|
11
11
|
import { QueryFilter, useQueryFilter, } from "../../QueryFilter";
|
|
12
12
|
import shortUUID from "short-uuid";
|
|
13
13
|
import { DefaultOperators } from "../../QueryFilter";
|
|
14
|
+
import { useEffect, useRef } from "react";
|
|
14
15
|
const StyledContainer = styled.div `
|
|
15
16
|
display: flex;
|
|
16
17
|
flex-direction: column;
|
|
@@ -28,7 +29,8 @@ const FlexedRow = styled.div `
|
|
|
28
29
|
`;
|
|
29
30
|
const TableMenu = () => {
|
|
30
31
|
var _a, _b, _c, _d;
|
|
31
|
-
const { data, columnState, searchState, toggleColumnVisibility, tableMenuOptions, runSearch, enableSelection, compactState, toggleCompact, totalRecords, getCalculatedSelectionTotal, filterState, handleFilterChange, } = useTable();
|
|
32
|
+
const { data, columnState, searchState, toggleColumnVisibility, tableMenuOptions, runSearch, enableSelection, compactState, toggleCompact, totalRecords, getCalculatedSelectionTotal, filterState, handleFilterChange, clearSearch, } = useTable();
|
|
33
|
+
const inputRef = useRef(null);
|
|
32
34
|
if ((tableMenuOptions === null || tableMenuOptions === void 0 ? void 0 : tableMenuOptions.enabled) !== true)
|
|
33
35
|
return null;
|
|
34
36
|
const { addButtonOptions, filterOptions, tableCountOptions, exportOptions, compactOptions, columnSelectorOptions, searchOptions, children, } = tableMenuOptions;
|
|
@@ -59,6 +61,12 @@ const TableMenu = () => {
|
|
|
59
61
|
label: item.label,
|
|
60
62
|
});
|
|
61
63
|
};
|
|
64
|
+
// simultate
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (inputRef.current && searchState === "") {
|
|
67
|
+
inputRef.current.value = "";
|
|
68
|
+
}
|
|
69
|
+
}, [searchState]);
|
|
62
70
|
return (_jsxs(StyledContainer, { children: [_jsxs(FlexedRow, { className: "justify-sb", children: [_jsxs(FlexedRow, { children: [(addButtonOptions === null || addButtonOptions === void 0 ? void 0 : addButtonOptions.enabled) === true &&
|
|
63
71
|
((addButtonOptions === null || addButtonOptions === void 0 ? void 0 : addButtonOptions.type) === "button" ||
|
|
64
72
|
(addButtonOptions === null || addButtonOptions === void 0 ? void 0 : addButtonOptions.type) === undefined) && (_jsx(Button, Object.assign({ color: "primary", variant: "contained", size: "xxs", onClick: () => { var _a; return (_a = addButtonOptions === null || addButtonOptions === void 0 ? void 0 : addButtonOptions.onClick) === null || _a === void 0 ? void 0 : _a.call(addButtonOptions); } }, addButtonOptions === null || addButtonOptions === void 0 ? void 0 : addButtonOptions.buttonOptions, { children: ((_a = tableMenuOptions === null || tableMenuOptions === void 0 ? void 0 : tableMenuOptions.addButtonOptions) === null || _a === void 0 ? void 0 : _a.label) || "+ Add Record" }))), (addButtonOptions === null || addButtonOptions === void 0 ? void 0 : addButtonOptions.enabled) === true &&
|
|
@@ -109,6 +117,6 @@ const TableMenu = () => {
|
|
|
109
117
|
style: { padding: "0px 4px", height: 24 },
|
|
110
118
|
}, dropDownProps: {
|
|
111
119
|
style: { width: 175, maxWidth: 400 },
|
|
112
|
-
}, children: _jsx(Columns3Icon, { size: 14 }) })), (searchOptions === null || searchOptions === void 0 ? void 0 : searchOptions.enabled) === true && (_jsx(TextInput, { size: "xs", placeholder: ((_d = tableMenuOptions === null || tableMenuOptions === void 0 ? void 0 : tableMenuOptions.searchOptions) === null || _d === void 0 ? void 0 : _d.placeholder) || "Search",
|
|
120
|
+
}, children: _jsx(Columns3Icon, { size: 14 }) })), (searchOptions === null || searchOptions === void 0 ? void 0 : searchOptions.enabled) === true && (_jsx(TextInput, { ref: inputRef, size: "xs", placeholder: ((_d = tableMenuOptions === null || tableMenuOptions === void 0 ? void 0 : tableMenuOptions.searchOptions) === null || _d === void 0 ? void 0 : _d.placeholder) || "Search", defaultValue: searchState, onChange: handleSearch }))] })] }), _jsx(QueryFilter, { queryFilter: queryFilter })] }));
|
|
113
121
|
};
|
|
114
122
|
export default TableMenu;
|