@monolith-forensics/monolith-ui 1.2.91 → 1.2.93
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/Button/Button.d.ts +1 -0
- package/dist/Button/Button.js +3 -2
- package/dist/Calendar/CalendarStyles.d.ts +5 -15
- package/dist/Calendar/calendarHelpers.d.ts +1 -1
- package/dist/CheckBox/CheckBox.js +6 -4
- package/dist/DateInput/DateInput.d.ts +5 -3
- package/dist/DateInput/DateInput.js +41 -25
- package/dist/DropDownMenu/DropDownMenu.d.ts +2 -45
- package/dist/DropDownMenu/DropDownMenu.js +9 -315
- package/dist/DropDownMenu/components/Menu.d.ts +2 -0
- package/dist/DropDownMenu/components/Menu.js +11 -0
- package/dist/DropDownMenu/components/MenuComponent.d.ts +2 -0
- package/dist/DropDownMenu/components/MenuComponent.js +117 -0
- package/dist/DropDownMenu/components/MenuContext.d.ts +7 -0
- package/dist/DropDownMenu/components/MenuContext.js +8 -0
- package/dist/DropDownMenu/components/MenuItem.d.ts +7 -0
- package/dist/DropDownMenu/components/MenuItem.js +99 -0
- package/dist/DropDownMenu/components/MenuItemList.d.ts +18 -0
- package/dist/DropDownMenu/components/MenuItemList.js +92 -0
- package/dist/DropDownMenu/components/SearchInput.d.ts +1 -0
- package/dist/DropDownMenu/components/SearchInput.js +4 -0
- package/dist/DropDownMenu/components/StyledContent.d.ts +2 -0
- package/dist/DropDownMenu/components/StyledContent.js +42 -0
- package/dist/DropDownMenu/components/StyledFloatContainer.d.ts +1 -0
- package/dist/DropDownMenu/components/StyledFloatContainer.js +5 -0
- package/dist/DropDownMenu/components/StyledInnerItemContainer.d.ts +1 -0
- package/dist/DropDownMenu/components/StyledInnerItemContainer.js +9 -0
- package/dist/DropDownMenu/components/index.d.ts +9 -0
- package/dist/DropDownMenu/components/index.js +9 -0
- package/dist/DropDownMenu/index.d.ts +1 -1
- package/dist/DropDownMenu/index.js +1 -0
- package/dist/DropDownMenu/types.d.ts +52 -0
- package/dist/FieldLabel/FieldLabel.d.ts +1 -1
- package/dist/FileViewer/FileViewer.d.ts +13 -0
- package/dist/FileViewer/FileViewer.js +180 -0
- package/dist/FileViewer/index.d.ts +1 -0
- package/dist/FileViewer/index.js +1 -0
- package/dist/FileViewer/viewers/CodeViewer.d.ts +6 -0
- package/dist/FileViewer/viewers/CodeViewer.js +106 -0
- package/dist/FileViewer/viewers/ImageViewer.d.ts +6 -0
- package/dist/FileViewer/viewers/ImageViewer.js +58 -0
- package/dist/FileViewer/viewers/OfficeViewer.d.ts +5 -0
- package/dist/FileViewer/viewers/OfficeViewer.js +70 -0
- package/dist/FileViewer/viewers/PdfViewer.d.ts +8 -0
- package/dist/FileViewer/viewers/PdfViewer.js +63 -0
- package/dist/FileViewer/viewers/PlainTextViewer.d.ts +4 -0
- package/dist/FileViewer/viewers/PlainTextViewer.js +62 -0
- package/dist/FileViewer/viewers/VideoViewer.d.ts +6 -0
- package/dist/FileViewer/viewers/VideoViewer.js +30 -0
- package/dist/FileViewer/viewers/index.d.ts +6 -0
- package/dist/FileViewer/viewers/index.js +6 -0
- package/dist/FormSection/FormSection.d.ts +10 -2
- package/dist/FormSection/FormSection.js +43 -8
- package/dist/IconButton/IconButton.d.ts +1 -3
- package/dist/Input/Input.js +5 -0
- package/dist/MonolithUIProvider/GlobalStyle.d.ts +1 -1
- package/dist/MonolithUIProvider/GlobalStyle.js +1 -1
- package/dist/MonolithUIProvider/MonolithUIProvider.d.ts +2 -2
- package/dist/MonolithUIProvider/MonolithUIProvider.js +8 -3
- package/dist/MonolithUIProvider/index.d.ts +2 -2
- package/dist/MonolithUIProvider/index.js +2 -2
- package/dist/MonolithUIProvider/useMonolithUITheme.d.ts +1 -2
- package/dist/MonolithUIProvider/useMonolithUITheme.js +1 -2
- package/dist/Pill/Pill.d.ts +2 -1
- package/dist/Pill/Pill.js +2 -2
- package/dist/QueryFilter/DefaultOperators.d.ts +2 -3
- package/dist/QueryFilter/DefaultOperators.js +2 -3
- package/dist/QueryFilter/QueryFilter.d.ts +2 -3
- package/dist/QueryFilter/QueryFilter.js +126 -49
- package/dist/QueryFilter/index.d.ts +4 -2
- package/dist/QueryFilter/index.js +4 -2
- package/dist/QueryFilter/types.d.ts +12 -8
- package/dist/QueryFilter/useFilterHelper.d.ts +20 -0
- package/dist/QueryFilter/useFilterHelper.js +61 -0
- package/dist/QueryFilter/useQueryFilter.d.ts +1 -2
- package/dist/QueryFilter/useQueryFilter.js +5 -2
- package/dist/RichTextEditor/Components/BubbleMenu.d.ts +3 -4
- package/dist/RichTextEditor/Components/BubbleMenu.js +29 -26
- package/dist/RichTextEditor/Components/ColorPicker.d.ts +4 -0
- package/dist/RichTextEditor/Components/ColorPicker.js +37 -0
- package/dist/RichTextEditor/Components/index.d.ts +1 -0
- package/dist/RichTextEditor/Components/index.js +1 -0
- package/dist/RichTextEditor/RichTextEditor.d.ts +2 -3
- package/dist/RichTextEditor/RichTextEditor.js +83 -86
- package/dist/RichTextEditor/Toolbar/ControlsGroup.d.ts +1 -3
- package/dist/RichTextEditor/Toolbar/Toolbar.d.ts +1 -1
- package/dist/RichTextEditor/Toolbar/Toolbar.js +10 -14
- package/dist/SelectBox/SelectBox.d.ts +1 -1
- package/dist/SelectBox/SelectBox.js +133 -92
- package/dist/SelectBox/types.d.ts +8 -5
- package/dist/Switch/Switch.js +4 -4
- package/dist/Table/ActionButton.d.ts +1 -3
- package/dist/Table/ActionCell.d.ts +1 -3
- package/dist/Table/SelectionCell.d.ts +1 -3
- package/dist/Table/StaticRows.d.ts +2 -2
- package/dist/Table/Table.d.ts +1 -2
- package/dist/Table/Table.js +9 -13
- package/dist/Table/TableComponents.d.ts +2 -6
- package/dist/Table/TableComponents.js +0 -5
- package/dist/Table/TableHeader.js +8 -2
- package/dist/Table/TableMenu/TableMenu.js +12 -10
- package/dist/Table/TableProvider.js +36 -30
- package/dist/Table/TableRow.js +5 -2
- package/dist/Table/VirtualIzedRows.d.ts +2 -2
- package/dist/Table/VirtualIzedRows.js +12 -10
- package/dist/Table/index.d.ts +1 -2
- package/dist/Table/index.js +1 -2
- package/dist/Table/types.d.ts +23 -3
- package/dist/TagBox/TagBox.d.ts +1 -1
- package/dist/TagBox/TagBox.js +180 -92
- package/dist/TagBox/TagBoxStyles.d.ts +1 -3
- package/dist/TagBox/types.d.ts +4 -2
- package/dist/TextArea/TextArea.d.ts +1 -3
- package/dist/Tooltip/Tooltip.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/theme/getTheme.d.ts +1 -1
- package/package.json +11 -5
- package/dist/RichTextEditor/Components/DefaultColorIcon.d.ts +0 -4
- package/dist/RichTextEditor/Components/DefaultColorIcon.js +0 -7
- package/dist/Table/Column.d.ts +0 -3
- package/dist/Table/Column.js +0 -5
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
import Loader from "../../Loader";
|
|
4
|
+
const StyledContainer = styled.div `
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
align-items: center;
|
|
9
|
+
|
|
10
|
+
flex: 1 1 auto;
|
|
11
|
+
height: 0px;
|
|
12
|
+
width: 100%;
|
|
13
|
+
`;
|
|
14
|
+
const StyledInnerContainer = styled.div `
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
flex: 1 1 auto;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
align-items: center;
|
|
20
|
+
|
|
21
|
+
width: 100%;
|
|
22
|
+
max-width: 100%;
|
|
23
|
+
|
|
24
|
+
#office-iframe {
|
|
25
|
+
width: 100%;
|
|
26
|
+
height: 100%;
|
|
27
|
+
border: none;
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
30
|
+
const StyledIframe = styled.iframe `
|
|
31
|
+
width: 100%;
|
|
32
|
+
height: 100%;
|
|
33
|
+
border: none;
|
|
34
|
+
`;
|
|
35
|
+
const StyledLoader = styled.div `
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
align-items: center;
|
|
40
|
+
gap: 10px;
|
|
41
|
+
`;
|
|
42
|
+
const resolveOfficeType = (file) => {
|
|
43
|
+
let ext = file.ext;
|
|
44
|
+
if (!ext) {
|
|
45
|
+
ext = file.name.split(".").pop();
|
|
46
|
+
}
|
|
47
|
+
if (!ext) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
switch (ext) {
|
|
51
|
+
case "doc":
|
|
52
|
+
case "docx":
|
|
53
|
+
return "word";
|
|
54
|
+
case "xls":
|
|
55
|
+
case "xlsx":
|
|
56
|
+
return "excel";
|
|
57
|
+
case "ppt":
|
|
58
|
+
case "pptx":
|
|
59
|
+
return "powerpoint";
|
|
60
|
+
default:
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
export const OfficeViewer = ({ file, isPending }) => {
|
|
65
|
+
const type = resolveOfficeType(file);
|
|
66
|
+
if (isPending) {
|
|
67
|
+
return (_jsxs(StyledLoader, { children: [_jsx(Loader, { size: 50 }), _jsx("div", { children: "Loading Image..." })] }));
|
|
68
|
+
}
|
|
69
|
+
return (_jsx(StyledContainer, { children: _jsx(StyledInnerContainer, { "data-type": type, children: !(file === null || file === void 0 ? void 0 : file.url) ? (_jsx(Loader, {})) : (_jsx(StyledIframe, { id: "office-iframe", title: "office-iframe", src: `https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent(file.url)}` })) }) }));
|
|
70
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Document, Page, pdfjs } from "react-pdf";
|
|
4
|
+
import "react-pdf/dist/esm/Page/AnnotationLayer.css";
|
|
5
|
+
import "react-pdf/dist/esm/Page/TextLayer.css";
|
|
6
|
+
import styled from "styled-components";
|
|
7
|
+
import Loader from "../../Loader";
|
|
8
|
+
if (typeof Promise.withResolvers === "undefined") {
|
|
9
|
+
if (window)
|
|
10
|
+
// @ts-expect-error This does not exist outside of polyfill which this is doing
|
|
11
|
+
window.Promise.withResolvers = function () {
|
|
12
|
+
let resolve, reject;
|
|
13
|
+
const promise = new Promise((res, rej) => {
|
|
14
|
+
resolve = res;
|
|
15
|
+
reject = rej;
|
|
16
|
+
});
|
|
17
|
+
return { promise, resolve, reject };
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
pdfjs.GlobalWorkerOptions.workerSrc = new URL("pdfjs-dist/legacy/build/pdf.worker.min.mjs", import.meta.url).toString();
|
|
21
|
+
const StyledContainer = styled.div.attrs({
|
|
22
|
+
className: "PdfViewer-container",
|
|
23
|
+
}) `
|
|
24
|
+
flex: 1 1 auto;
|
|
25
|
+
height: 0px;
|
|
26
|
+
width: 100%;
|
|
27
|
+
`;
|
|
28
|
+
const StyledDocument = styled(Document).attrs({
|
|
29
|
+
className: "PdfViewer-document",
|
|
30
|
+
}) ``;
|
|
31
|
+
const StyledPage = styled(Page) `
|
|
32
|
+
width: fit-content;
|
|
33
|
+
background-color: transparent;
|
|
34
|
+
margin: 0 auto;
|
|
35
|
+
margin-bottom: 10px;
|
|
36
|
+
`;
|
|
37
|
+
const StyledLoader = styled.div `
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
align-items: center;
|
|
42
|
+
gap: 10px;
|
|
43
|
+
|
|
44
|
+
height: 100%;
|
|
45
|
+
margin: auto;
|
|
46
|
+
`;
|
|
47
|
+
export const PdfViewer = ({ file, zoomFactor = 1, isPending }) => {
|
|
48
|
+
const [loading, setLoading] = useState(true);
|
|
49
|
+
const [numPages, setNumPages] = useState();
|
|
50
|
+
const [pageNumber, setPageNumber] = useState(1);
|
|
51
|
+
function onDocumentLoadSuccess({ numPages }) {
|
|
52
|
+
setLoading(false);
|
|
53
|
+
setNumPages(numPages);
|
|
54
|
+
}
|
|
55
|
+
// viewport width
|
|
56
|
+
const vw = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) / 1.15;
|
|
57
|
+
if (isPending) {
|
|
58
|
+
return (_jsxs(StyledLoader, { children: [_jsx(Loader, { size: 50 }), _jsx("div", { children: "Loading File..." })] }));
|
|
59
|
+
}
|
|
60
|
+
return (_jsxs(StyledContainer, { className: "PdfViewer", children: [loading && (_jsxs(StyledLoader, { children: [_jsx(Loader, { size: 50 }), _jsx("div", { children: "Loading File..." })] })), _jsx(StyledDocument, { file: file.url, onLoadStart: () => setLoading(true), onLoadSuccess: onDocumentLoadSuccess, loading: _jsx(_Fragment, {}), onClick: (e) => {
|
|
61
|
+
e.stopPropagation();
|
|
62
|
+
}, children: Array.from(new Array(numPages), (el, index) => (_jsx(StyledPage, { pageNumber: index + 1, scale: zoomFactor, width: vw }, `page_${index + 1}`))) })] }));
|
|
63
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import styled from "styled-components";
|
|
12
|
+
import { useState } from "react";
|
|
13
|
+
import Loader from "../../Loader";
|
|
14
|
+
const getFileData = (file) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
if (!file.url)
|
|
16
|
+
return "";
|
|
17
|
+
const response = yield fetch(file.url);
|
|
18
|
+
const text = yield response.text();
|
|
19
|
+
return text;
|
|
20
|
+
});
|
|
21
|
+
const StyledContainer = styled.div `
|
|
22
|
+
display: flex;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
|
|
25
|
+
flex: 1 1 auto;
|
|
26
|
+
height: 0px;
|
|
27
|
+
`;
|
|
28
|
+
const StyledTextData = styled.div `
|
|
29
|
+
width: 100%;
|
|
30
|
+
height: fit-content;
|
|
31
|
+
max-width: 8.5in;
|
|
32
|
+
padding: 25px;
|
|
33
|
+
|
|
34
|
+
background-color: ${(props) => props.theme.palette.background.alt};
|
|
35
|
+
white-space: pre-wrap !important;
|
|
36
|
+
word-wrap: break-word !important;
|
|
37
|
+
|
|
38
|
+
font-family: monospace;
|
|
39
|
+
font-size: 10px;
|
|
40
|
+
`;
|
|
41
|
+
const StyledLoader = styled.div `
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
align-items: center;
|
|
46
|
+
gap: 10px;
|
|
47
|
+
`;
|
|
48
|
+
export const PlainTextViewer = ({ file }) => {
|
|
49
|
+
const [query, setQuery] = useState({
|
|
50
|
+
data: null,
|
|
51
|
+
isLoading: false,
|
|
52
|
+
});
|
|
53
|
+
if (!query.data) {
|
|
54
|
+
if (!query.isLoading) {
|
|
55
|
+
setQuery({ data: null, isLoading: true });
|
|
56
|
+
getFileData(file).then((text) => {
|
|
57
|
+
setQuery({ data: text, isLoading: false });
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return (_jsxs(StyledContainer, { className: "mfui-PlainTextViewer", children: [!query.data && (_jsxs(StyledLoader, { children: [_jsx(Loader, { size: 50 }), _jsx("div", { children: "Loading File..." })] })), query.data && (_jsx(StyledTextData, { className: "text-doc", children: query.data }))] }));
|
|
62
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
import Loader from "../../Loader";
|
|
4
|
+
const StyledContainer = styled.div `
|
|
5
|
+
display: flex;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
|
|
8
|
+
flex: 1 1 auto;
|
|
9
|
+
height: 0px;
|
|
10
|
+
`;
|
|
11
|
+
const StyledVideo = styled.video `
|
|
12
|
+
max-width: 100%;
|
|
13
|
+
max-height: 100%;
|
|
14
|
+
object-fit: contain;
|
|
15
|
+
`;
|
|
16
|
+
const StyledLoader = styled.div `
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
align-items: center;
|
|
21
|
+
gap: 10px;
|
|
22
|
+
`;
|
|
23
|
+
export const VideoViewer = ({ file, isPending }) => {
|
|
24
|
+
if (isPending) {
|
|
25
|
+
return (_jsxs(StyledLoader, { children: [_jsx(Loader, { size: 50 }), _jsx("div", { children: "Loading Image..." })] }));
|
|
26
|
+
}
|
|
27
|
+
return (_jsx(StyledContainer, { className: "mfui-VideoViewer", children: _jsx(StyledVideo, { src: file.url, controls: true, autoPlay: true, onClick: (e) => {
|
|
28
|
+
e.stopPropagation();
|
|
29
|
+
} }) }));
|
|
30
|
+
};
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
+
import { LucideIcon } from "lucide-react";
|
|
1
2
|
import { ReactNode } from "react";
|
|
3
|
+
import { Size } from "../core";
|
|
2
4
|
interface FormSectionProps {
|
|
3
5
|
children?: ReactNode;
|
|
4
6
|
className?: string;
|
|
5
|
-
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
title?: string | ReactNode;
|
|
9
|
+
open?: boolean;
|
|
6
10
|
defaultOpen?: boolean;
|
|
11
|
+
onOpenChange?: (open: boolean) => void;
|
|
7
12
|
allowCollapse?: boolean;
|
|
13
|
+
size?: Size;
|
|
14
|
+
icon?: LucideIcon;
|
|
15
|
+
iconColor?: string;
|
|
8
16
|
}
|
|
9
|
-
declare const FormSection:
|
|
17
|
+
declare const FormSection: ({ title, children, open, defaultOpen, onOpenChange, allowCollapse, size, style, icon: Icon, iconColor, }: FormSectionProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
18
|
export default FormSection;
|
|
@@ -2,16 +2,21 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { ChevronDownIcon } from "lucide-react";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import styled from "styled-components";
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
setOpen(!open);
|
|
10
|
-
}
|
|
11
|
-
}, children: [_jsx("h3", { children: title }), _jsx("div", { className: "section-line" }), !!allowCollapse ? _jsx(ChevronDownIcon, { size: 18, className: open ? "open" : "" }) : ""] }), _jsx("div", { className: "section-content", "data-open": open, children: children })] }));
|
|
12
|
-
}) `
|
|
5
|
+
const StyledContainer = styled.div `
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
|
|
13
9
|
h3 {
|
|
14
10
|
margin: 0;
|
|
11
|
+
font-size: ${({ size = "md" }) => size === "xs"
|
|
12
|
+
? "x-small"
|
|
13
|
+
: size === "sm"
|
|
14
|
+
? "small"
|
|
15
|
+
: size === "md"
|
|
16
|
+
? "medium"
|
|
17
|
+
: size === "lg"
|
|
18
|
+
? "large"
|
|
19
|
+
: "x-large"};
|
|
15
20
|
}
|
|
16
21
|
|
|
17
22
|
.section-header {
|
|
@@ -41,10 +46,40 @@ const FormSection = styled(({ className, title, children, defaultOpen = true, al
|
|
|
41
46
|
}
|
|
42
47
|
|
|
43
48
|
.section-content {
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
height: 100%;
|
|
44
52
|
padding: 10px 0px;
|
|
53
|
+
|
|
45
54
|
&[data-open="false"] {
|
|
46
55
|
display: none;
|
|
47
56
|
}
|
|
48
57
|
}
|
|
49
58
|
`;
|
|
59
|
+
const resolveIconSize = (size) => {
|
|
60
|
+
switch (size) {
|
|
61
|
+
case "xs":
|
|
62
|
+
return 12;
|
|
63
|
+
case "sm":
|
|
64
|
+
return 14;
|
|
65
|
+
case "md":
|
|
66
|
+
return 18;
|
|
67
|
+
case "lg":
|
|
68
|
+
return 24;
|
|
69
|
+
case "xl":
|
|
70
|
+
return 28;
|
|
71
|
+
default:
|
|
72
|
+
return 18;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const FormSection = ({ title, children, open, defaultOpen = true, onOpenChange, allowCollapse = true, size, style, icon: Icon, iconColor, }) => {
|
|
76
|
+
const [_open, setOpen] = useState(defaultOpen);
|
|
77
|
+
const openState = open !== null && open !== void 0 ? open : _open;
|
|
78
|
+
return (_jsxs(StyledContainer, { className: "mfui-FormSection", size: size, style: style, children: [_jsxs("div", { className: "section-header", onClick: (e) => {
|
|
79
|
+
if (allowCollapse) {
|
|
80
|
+
setOpen(!openState);
|
|
81
|
+
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(!openState);
|
|
82
|
+
}
|
|
83
|
+
}, children: [Icon && _jsx(Icon, { size: resolveIconSize(size), color: iconColor }), _jsx("h3", { children: title }), _jsx("div", { className: "section-line" }), !!allowCollapse ? (_jsx(ChevronDownIcon, { size: 18, className: openState ? "open" : "" })) : ("")] }), _jsx("div", { className: "section-content", "data-open": openState, children: children })] }));
|
|
84
|
+
};
|
|
50
85
|
export default FormSection;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import { ButtonProps } from "../Button/Button.js";
|
|
2
|
-
declare const IconButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<
|
|
3
|
-
ref?: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
4
|
-
}, ButtonProps>> & string & Omit<import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>, keyof import("react").Component<any, {}, any>>;
|
|
2
|
+
declare const IconButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<ButtonProps & import("react").RefAttributes<HTMLButtonElement>, ButtonProps>> & string & Omit<import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>, keyof import("react").Component<any, {}, any>>;
|
|
5
3
|
export default IconButton;
|
package/dist/Input/Input.js
CHANGED
|
@@ -137,6 +137,11 @@ const StyledInput = styled.input `
|
|
|
137
137
|
&[readOnly] {
|
|
138
138
|
cursor: pointer;
|
|
139
139
|
}
|
|
140
|
+
|
|
141
|
+
&[disabled] {
|
|
142
|
+
cursor: not-allowed;
|
|
143
|
+
opacity: 0.5;
|
|
144
|
+
}
|
|
140
145
|
`;
|
|
141
146
|
const Input = forwardRef((_a, ref) => {
|
|
142
147
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DefaultTheme } from "styled-components";
|
|
2
|
+
export { styled, useTheme, createGlobalStyle, css } from "styled-components";
|
|
2
3
|
import { Themes } from "../theme";
|
|
3
4
|
import React from "react";
|
|
4
5
|
import typography from "../theme/typography";
|
|
@@ -140,5 +141,4 @@ interface MonolithUIProviderProps {
|
|
|
140
141
|
defaultColorScheme?: Themes;
|
|
141
142
|
colorScheme?: Themes;
|
|
142
143
|
}
|
|
143
|
-
declare const MonolithUIProvider: ({ children, theme, defaultColorScheme, colorScheme, }: MonolithUIProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
144
|
-
export default MonolithUIProvider;
|
|
144
|
+
export declare const MonolithUIProvider: ({ children, theme, defaultColorScheme, colorScheme, }: MonolithUIProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import merge from "deepmerge";
|
|
3
3
|
import { ThemeProvider } from "styled-components";
|
|
4
|
+
export { styled, useTheme, createGlobalStyle, css } from "styled-components";
|
|
4
5
|
import { Themes, getTheme } from "../theme";
|
|
5
|
-
import { createContext, useState } from "react";
|
|
6
|
+
import { createContext, useEffect, useState } from "react";
|
|
6
7
|
import GlobalStyle from "./GlobalStyle";
|
|
8
|
+
const LocalStorageTheme = "Monolith Theme";
|
|
7
9
|
export const MonolithUIContext = createContext(undefined);
|
|
8
|
-
const MonolithUIProvider = ({ children, theme, defaultColorScheme =
|
|
10
|
+
export const MonolithUIProvider = ({ children, theme, defaultColorScheme = localStorage.getItem(LocalStorageTheme) ||
|
|
11
|
+
Themes.DARK, colorScheme, }) => {
|
|
9
12
|
const [colorSchemeState, setColorSchemeState] = useState(defaultColorScheme);
|
|
10
13
|
const toggleColorScheme = () => {
|
|
11
14
|
setColorSchemeState((prev) => prev === Themes.LIGHT ? Themes.DARK : Themes.LIGHT);
|
|
@@ -14,6 +17,9 @@ const MonolithUIProvider = ({ children, theme, defaultColorScheme = Themes.DARK,
|
|
|
14
17
|
const defaultTheme = getTheme(_scheme);
|
|
15
18
|
// override default theme with the provided theme
|
|
16
19
|
const _theme = merge(defaultTheme, theme || {});
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
localStorage.setItem(LocalStorageTheme, _scheme);
|
|
22
|
+
}, [_scheme]);
|
|
17
23
|
return (_jsx(MonolithUIContext.Provider, { value: {
|
|
18
24
|
theme: _theme,
|
|
19
25
|
Themes,
|
|
@@ -22,4 +28,3 @@ const MonolithUIProvider = ({ children, theme, defaultColorScheme = Themes.DARK,
|
|
|
22
28
|
setColorScheme: setColorSchemeState,
|
|
23
29
|
}, children: _jsxs(ThemeProvider, { theme: _theme, children: [_jsx(GlobalStyle, { theme: _theme }), children] }) }));
|
|
24
30
|
};
|
|
25
|
-
export default MonolithUIProvider;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export * from "./MonolithUIProvider";
|
|
2
|
+
export * from "./useMonolithUITheme";
|
|
3
3
|
export { getTheme } from "../theme";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export * from "./MonolithUIProvider";
|
|
2
|
+
export * from "./useMonolithUITheme";
|
|
3
3
|
export { getTheme } from "../theme";
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { useContext } from "react";
|
|
2
2
|
import { MonolithUIContext } from "./MonolithUIProvider";
|
|
3
|
-
const useMonolithUITheme = () => {
|
|
3
|
+
export const useMonolithUITheme = () => {
|
|
4
4
|
const context = useContext(MonolithUIContext);
|
|
5
5
|
if (context === undefined) {
|
|
6
6
|
throw new Error("hook must be used within a MonolithUIProvider");
|
|
7
7
|
}
|
|
8
8
|
return context;
|
|
9
9
|
};
|
|
10
|
-
export default useMonolithUITheme;
|
package/dist/Pill/Pill.d.ts
CHANGED
|
@@ -3,9 +3,10 @@ import { Size } from "../core";
|
|
|
3
3
|
interface PillProps {
|
|
4
4
|
className?: string;
|
|
5
5
|
children?: ReactNode;
|
|
6
|
+
title?: string;
|
|
6
7
|
size?: Size;
|
|
7
8
|
showRemoveIcon?: boolean;
|
|
8
9
|
onRemove?: () => void;
|
|
9
10
|
}
|
|
10
|
-
declare const Pill: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<PillProps, never>> & string & Omit<({ className, children, size, showRemoveIcon, onRemove, }: PillProps) => import("react/jsx-runtime").JSX.Element, keyof import("react").Component<any, {}, any>>;
|
|
11
|
+
declare const Pill: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<PillProps, never>> & string & Omit<({ className, children, title, size, showRemoveIcon, onRemove, }: PillProps) => import("react/jsx-runtime").JSX.Element, keyof import("react").Component<any, {}, any>>;
|
|
11
12
|
export default Pill;
|
package/dist/Pill/Pill.js
CHANGED
|
@@ -14,13 +14,13 @@ const StyledButton = styled.button `
|
|
|
14
14
|
transition: color 0.2s;
|
|
15
15
|
padding-inline-end: 5px;
|
|
16
16
|
`;
|
|
17
|
-
const Pill = styled(({ className, children, size = "md", showRemoveIcon = true, onRemove, }) => {
|
|
17
|
+
const Pill = styled(({ className, children, title, size = "md", showRemoveIcon = true, onRemove, }) => {
|
|
18
18
|
const handleRemove = (e) => {
|
|
19
19
|
e.preventDefault();
|
|
20
20
|
e.stopPropagation();
|
|
21
21
|
onRemove === null || onRemove === void 0 ? void 0 : onRemove();
|
|
22
22
|
};
|
|
23
|
-
return (_jsxs("div", { className: className, onClick: (e) => {
|
|
23
|
+
return (_jsxs("div", { className: className, title: title, onClick: (e) => {
|
|
24
24
|
e.preventDefault();
|
|
25
25
|
e.stopPropagation();
|
|
26
26
|
}, children: [_jsx("span", { className: "pill-content", children: children }), showRemoveIcon && (_jsx(StyledButton, { tabIndex: -1, onClick: handleRemove, onMouseDown: (e) => {
|
|
@@ -48,11 +48,11 @@ export declare const Operators: {
|
|
|
48
48
|
value: string;
|
|
49
49
|
label: string;
|
|
50
50
|
};
|
|
51
|
-
|
|
51
|
+
IsEmpty: {
|
|
52
52
|
value: string;
|
|
53
53
|
label: string;
|
|
54
54
|
};
|
|
55
|
-
|
|
55
|
+
IsNotEmpty: {
|
|
56
56
|
value: string;
|
|
57
57
|
label: string;
|
|
58
58
|
};
|
|
@@ -74,4 +74,3 @@ export declare const Operators: {
|
|
|
74
74
|
};
|
|
75
75
|
};
|
|
76
76
|
export declare const DefaultOperators: Operator[];
|
|
77
|
-
export default DefaultOperators;
|
|
@@ -11,12 +11,11 @@ export const Operators = {
|
|
|
11
11
|
DoesNotContain: { value: "doesNotContain", label: "does not contain" },
|
|
12
12
|
DoesNotBeginWith: { value: "doesNotBeginWith", label: "does not begin with" },
|
|
13
13
|
DoesNotEndWith: { value: "doesNotEndWith", label: "does not end with" },
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
IsEmpty: { value: "isEmpty", label: "is empty" },
|
|
15
|
+
IsNotEmpty: { value: "isNotEmpty", label: "is not empty" },
|
|
16
16
|
In: { value: "in", label: "is any of" },
|
|
17
17
|
NIn: { value: "nin", label: "is none of" },
|
|
18
18
|
Between: { value: "between", label: "between" },
|
|
19
19
|
NotBetween: { value: "notBetween", label: "not between" },
|
|
20
20
|
};
|
|
21
21
|
export const DefaultOperators = Object.values(Operators);
|
|
22
|
-
export default DefaultOperators;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const QueryFilter: React.FC<{
|
|
1
|
+
import { QueryFilterType as QueryFilterType } from "./types";
|
|
2
|
+
export declare const QueryFilter: React.FC<{
|
|
3
3
|
queryFilter: QueryFilterType;
|
|
4
4
|
}>;
|
|
5
|
-
export default QueryFilter;
|