@monolith-forensics/monolith-ui 1.1.29 → 1.1.31

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 (67) hide show
  1. package/dist/Button/Button.js +327 -0
  2. package/dist/Button/index.js +1 -0
  3. package/dist/Calendar/Calendar.js +204 -0
  4. package/dist/Calendar/CalendarStyles.js +164 -0
  5. package/dist/Calendar/calendarHelpers.js +169 -0
  6. package/dist/Calendar/index.js +1 -0
  7. package/dist/CheckBox/CheckBox.js +41 -0
  8. package/dist/CheckBox/index.js +1 -0
  9. package/dist/DateInput/DateInput.js +504 -0
  10. package/dist/DateInput/index.js +1 -0
  11. package/dist/DropDownMenu/DropDownMenu.js +208 -0
  12. package/dist/DropDownMenu/index.js +1 -0
  13. package/dist/Error/Error.js +33 -0
  14. package/dist/Error/index.js +1 -0
  15. package/dist/FieldLabel/FieldLabel.js +90 -0
  16. package/dist/FieldLabel/index.js +1 -0
  17. package/dist/FileInputField/FileInputField.js +112 -0
  18. package/dist/FileInputField/index.js +1 -0
  19. package/dist/Flyout/Flyout.js +106 -0
  20. package/dist/Flyout/FlyoutHeader.js +7 -0
  21. package/dist/Flyout/FlyoutTitle.js +8 -0
  22. package/dist/Flyout/index.js +3 -0
  23. package/dist/FormSection/FormSection.js +46 -0
  24. package/dist/FormSection/index.js +1 -0
  25. package/dist/Grid/Grid.js +13 -0
  26. package/dist/Grid/index.js +1 -0
  27. package/dist/IconButton/IconButton.js +25 -0
  28. package/dist/IconButton/index.js +1 -0
  29. package/dist/Input/Input.js +144 -0
  30. package/dist/Input/index.js +1 -0
  31. package/dist/Modal/Modal.js +105 -0
  32. package/dist/Modal/index.js +1 -0
  33. package/dist/MonolithUIProvider/GlobalStyle.js +51 -0
  34. package/dist/MonolithUIProvider/MonolithUIProvider.js +23 -0
  35. package/dist/MonolithUIProvider/index.js +3 -0
  36. package/dist/MonolithUIProvider/useMonolithUITheme.js +10 -0
  37. package/dist/Pill/Pill.js +147 -0
  38. package/dist/Pill/index.js +1 -0
  39. package/dist/SelectBox/SelectBox.js +471 -0
  40. package/dist/SelectBox/index.js +1 -0
  41. package/dist/Switch/Switch.js +129 -0
  42. package/dist/Switch/index.js +1 -0
  43. package/dist/Table/Table.js +707 -0
  44. package/dist/Table/index.js +2 -0
  45. package/dist/TagBox/TagBox.js +585 -0
  46. package/dist/TagBox/TagBoxStyles.js +107 -0
  47. package/dist/TagBox/index.js +1 -0
  48. package/dist/TextArea/TextArea.js +76 -0
  49. package/dist/TextArea/index.js +1 -0
  50. package/dist/TextAreaInput/TextAreaInput.js +9 -0
  51. package/dist/TextAreaInput/index.js +1 -0
  52. package/dist/TextInput/TextInput.js +26 -0
  53. package/dist/TextInput/index.js +1 -0
  54. package/dist/Tooltip/Tooltip.js +25 -0
  55. package/dist/Tooltip/index.js +1 -0
  56. package/dist/core/ArrowButton.js +43 -0
  57. package/dist/core/ClearButton.js +43 -0
  58. package/dist/core/StyledContent.js +42 -0
  59. package/dist/core/StyledFloatContainer.js +5 -0
  60. package/dist/core/Types/Size.js +1 -0
  61. package/dist/core/Types/Variant.js +1 -0
  62. package/dist/core/index.js +4 -0
  63. package/dist/index.js +26 -0
  64. package/dist/theme/index.js +9 -0
  65. package/dist/theme/typography.js +57 -0
  66. package/dist/theme/variants.js +270 -0
  67. package/package.json +1 -1
@@ -0,0 +1,25 @@
1
+ import styled from "styled-components";
2
+ import { Button } from "..";
3
+ const IconButton = styled(Button) `
4
+ padding: ${({ size, variant }) => {
5
+ if (variant === "text")
6
+ return `0px 0px`;
7
+ switch (size) {
8
+ case "xxs":
9
+ return `0px 4px`;
10
+ case "xs":
11
+ return `0px 4px`;
12
+ case "sm":
13
+ return `0px 6px`;
14
+ case "md":
15
+ return `0px 8px`;
16
+ case "lg":
17
+ return `0px 10px`;
18
+ case "xl":
19
+ return `0px 12px`;
20
+ default:
21
+ return `0px 6px`;
22
+ }
23
+ }};
24
+ `;
25
+ export default IconButton;
@@ -0,0 +1 @@
1
+ export { default } from "./IconButton";
@@ -0,0 +1,144 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import styled from "styled-components";
14
+ import { forwardRef } from "react";
15
+ const Input = styled(forwardRef((_a, ref) => {
16
+ var { className, size = "sm", variant = "outlined", width } = _a, rest = __rest(_a, ["className", "size", "variant", "width"]);
17
+ return _jsx("input", Object.assign({ ref: ref, className: className }, rest));
18
+ })) `
19
+ font-family: ${({ theme }) => theme.typography.fontFamily};
20
+ pointer-events: "all";
21
+ user-select: "all";
22
+ outline: none;
23
+ box-sizing: border-box;
24
+
25
+ color: ${({ theme }) => theme.palette.text.primary};
26
+ font-size: ${({ size }) => size === "xs"
27
+ ? "11px"
28
+ : size === "sm"
29
+ ? "13px"
30
+ : size === "md"
31
+ ? "15px"
32
+ : size === "lg"
33
+ ? "17px"
34
+ : size === "xl"
35
+ ? "19px"
36
+ : "13px"};
37
+
38
+ height: ${({ size }) => size === "xs"
39
+ ? "26px"
40
+ : size === "sm"
41
+ ? "30px"
42
+ : size === "md"
43
+ ? "36px"
44
+ : size === "lg"
45
+ ? "42px"
46
+ : size === "xl"
47
+ ? "50px"
48
+ : "30px"};
49
+
50
+ min-height: ${({ size }) => size === "xs"
51
+ ? "26px"
52
+ : size === "sm"
53
+ ? "30px"
54
+ : size === "md"
55
+ ? "36px"
56
+ : size === "lg"
57
+ ? "42px"
58
+ : size === "xl"
59
+ ? "50px"
60
+ : "30px"};
61
+
62
+ transition: border 0.1s ease-in-out;
63
+ border-radius: 4px;
64
+ border: 1px solid
65
+ ${({ theme, variant }) => {
66
+ switch (variant) {
67
+ case "contained":
68
+ return "transparent";
69
+ case "filled":
70
+ return "transparent";
71
+ case "outlined":
72
+ return theme.palette.input.border;
73
+ case "text":
74
+ return "transparent";
75
+ default:
76
+ return theme.palette.input.border;
77
+ }
78
+ }};
79
+
80
+ padding: ${({ size }) => size === "xs"
81
+ ? "0px 8px"
82
+ : size === "sm"
83
+ ? "0px 10px"
84
+ : size === "md"
85
+ ? "0px 12px"
86
+ : size === "lg"
87
+ ? "0px 14px"
88
+ : size === "xl"
89
+ ? "0px 16px"
90
+ : "0px 10px"};
91
+
92
+ width: ${({ width }) => {
93
+ if (typeof width === "undefined")
94
+ return "100%";
95
+ if (width === null)
96
+ return "100%";
97
+ if (typeof width === "string")
98
+ return width;
99
+ if (typeof width === "number")
100
+ return `${width}px`;
101
+ }};
102
+
103
+ background-color: ${({ theme, variant }) => {
104
+ switch (variant) {
105
+ case "contained":
106
+ return theme.palette.input.background;
107
+ case "filled":
108
+ return theme.palette.input.background;
109
+ case "outlined":
110
+ return theme.palette.input.background;
111
+ case "text":
112
+ return "transparent";
113
+ default:
114
+ return theme.palette.input.background;
115
+ }
116
+ }};
117
+
118
+ ::placeholder {
119
+ font-size: ${({ size }) => size === "xs"
120
+ ? "10px"
121
+ : size === "sm"
122
+ ? "12px"
123
+ : size === "md"
124
+ ? "14px"
125
+ : size === "lg"
126
+ ? "16px"
127
+ : size === "xl"
128
+ ? "18px"
129
+ : "12px"};
130
+ }
131
+
132
+ &:focus {
133
+ border: 1px solid ${({ theme }) => theme.palette.primary.main};
134
+ }
135
+
136
+ &[data-button-right="true"] {
137
+ padding-right: 36px;
138
+ }
139
+
140
+ &[readOnly] {
141
+ cursor: pointer;
142
+ }
143
+ `;
144
+ export default Input;
@@ -0,0 +1 @@
1
+ export { default } from "./Input";
@@ -0,0 +1,105 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import styled from "styled-components";
3
+ import { X } from "lucide-react";
4
+ import { FloatingFocusManager, FloatingOverlay, FloatingPortal, useFloating, } from "@floating-ui/react";
5
+ const StyledOverlay = styled(FloatingOverlay) `
6
+ background-color: rgba(0, 0, 0, 0.3);
7
+ position: fixed;
8
+ inset: 0;
9
+ z-index: 1400;
10
+
11
+ @keyframes overlayShow {
12
+ from {
13
+ opacity: 0;
14
+ }
15
+ to {
16
+ opacity: 1;
17
+ }
18
+ }
19
+ `;
20
+ const StyledContent = styled.div `
21
+ background-color: ${({ theme }) => theme.name === "DARK"
22
+ ? theme.palette.background.default
23
+ : theme.palette.background.default};
24
+ border-radius: 6px;
25
+ border: 1px solid ${(props) => props.theme.palette.divider};
26
+ position: fixed;
27
+ top: 25px;
28
+ left: 50%;
29
+ transform: translate(-50%, 0px);
30
+ box-shadow: rgba(0, 0, 0, 0.5) 0px 16px 70px;
31
+
32
+ z-index: 2;
33
+
34
+ max-height: calc(100vh - 50px);
35
+ max-width: calc(100vw - 50px);
36
+
37
+ display: flex;
38
+ flex-direction: column;
39
+
40
+ overflow-y: hidden;
41
+
42
+ &:focus {
43
+ outline: none;
44
+ }
45
+
46
+ @keyframes contentShow {
47
+ from {
48
+ opacity: 0;
49
+ transform: translate(-50%, -48%) scale(0.96);
50
+ }
51
+ to {
52
+ opacity: 1;
53
+ transform: translate(-50%, -50%) scale(1);
54
+ }
55
+ }
56
+ `;
57
+ const StyledInnerContent = styled.div `
58
+ display: flex;
59
+ flex-direction: column;
60
+
61
+ overflow-y: auto;
62
+ padding: 25px;
63
+ `;
64
+ const StyledClose = styled.div `
65
+ position: absolute;
66
+ top: 15px;
67
+ right: 15px;
68
+
69
+ color: ${(props) => props.theme.palette.text.secondary};
70
+ `;
71
+ const StyledButton = styled.button `
72
+ background-color: transparent;
73
+ border: none;
74
+ outline: none;
75
+ cursor: pointer;
76
+ padding: 0;
77
+ `;
78
+ const Title = styled.h1 `
79
+ font-size: 20px;
80
+ font-weight: 600;
81
+ margin: 0px;
82
+ `;
83
+ const SubTitle = styled.h2 `
84
+ font-size: 14px;
85
+ font-weight: 500;
86
+ margin: 0px;
87
+ color: ${(props) => props.theme.palette.text.secondary};
88
+ `;
89
+ const Modal = ({ children, open = false, onClose, style = {}, showCloseButton = false, FocusProps = {}, }) => {
90
+ const { refs, floatingStyles, context } = useFloating({
91
+ open,
92
+ onOpenChange: (isOpen) => {
93
+ if (!isOpen) {
94
+ onClose === null || onClose === void 0 ? void 0 : onClose();
95
+ }
96
+ },
97
+ });
98
+ const handleMouseDown = () => {
99
+ onClose === null || onClose === void 0 ? void 0 : onClose();
100
+ };
101
+ return (_jsx(FloatingPortal, { preserveTabOrder: true, children: open && (_jsx(StyledOverlay, { className: "mf-ModalOverlay", lockScroll: true, children: _jsx(FloatingFocusManager, Object.assign({ context: context, modal: true }, FocusProps, { children: _jsxs(StyledContent, Object.assign({ style: style, className: "mf-Modal", ref: refs.setFloating }, floatingStyles, { children: [showCloseButton && (_jsx(StyledClose, { children: _jsx(StyledButton, { onMouseDown: handleMouseDown, children: _jsx(X, { size: 18 }) }) })), _jsx(StyledInnerContent, { children: children })] })) })) })) }));
102
+ };
103
+ Modal.Title = Title;
104
+ Modal.SubTitle = SubTitle;
105
+ export default Modal;
@@ -0,0 +1 @@
1
+ export { default } from "./Modal";
@@ -0,0 +1,51 @@
1
+ import { createGlobalStyle } from "styled-components";
2
+ const GlobalStyle = createGlobalStyle `
3
+ * {
4
+ box-sizing: border-box;
5
+ }
6
+
7
+ body {
8
+ margin: 0;
9
+ padding: 0;
10
+ font-family: ${({ theme }) => theme.typography.fontFamily};
11
+ background-color: ${({ theme }) => theme.palette.background.default};
12
+ color: ${({ theme }) => theme.palette.text.primary};
13
+ display: flex;
14
+ flex-direction: column;
15
+ height: 100vh;
16
+ }
17
+
18
+ #root{
19
+ display: flex;
20
+ flex-direction: column;
21
+ height: 100%;
22
+ }
23
+
24
+ h1, h2, h3, h4, h5, h6 {
25
+ font-family: ${({ theme }) => theme.typography.fontFamily};
26
+ color: ${({ theme }) => theme.palette.text.primary};
27
+ margin: 0;
28
+ }
29
+
30
+ h1 {
31
+ margin: 3px 0px;
32
+ }
33
+
34
+ h2 {
35
+ margin: 2px 0px;
36
+ }
37
+
38
+ h3 {
39
+ margin: 1px 0px;
40
+ }
41
+
42
+ h4, h5, h6 {
43
+ margin: 0px;
44
+ }
45
+
46
+ a {
47
+ text-decoration: none;
48
+ color: unset;
49
+ }
50
+ `;
51
+ export default GlobalStyle;
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import merge from "deepmerge";
3
+ import { ThemeProvider } from "styled-components";
4
+ import getTheme from "../theme";
5
+ import { createContext, useState } from "react";
6
+ import GlobalStyle from "./GlobalStyle";
7
+ export const MonolithUIContext = createContext(undefined);
8
+ const MonolithUIProvider = ({ children, theme = {}, defaultColorScheme = "dark", }) => {
9
+ const [colorScheme, setColorScheme] = useState(defaultColorScheme);
10
+ const toggleColorScheme = () => {
11
+ setColorScheme(colorScheme === "light" ? "dark" : "light");
12
+ };
13
+ const defaultTheme = getTheme(colorScheme);
14
+ // override default theme with the provided theme
15
+ const _theme = merge(defaultTheme, theme);
16
+ return (_jsx(MonolithUIContext.Provider, { value: {
17
+ theme: _theme,
18
+ colorScheme,
19
+ toggleColorScheme,
20
+ setColorScheme,
21
+ }, children: _jsxs(ThemeProvider, { theme: _theme, children: [_jsx(GlobalStyle, { theme: _theme }), children] }) }));
22
+ };
23
+ export default MonolithUIProvider;
@@ -0,0 +1,3 @@
1
+ export { default } from "./MonolithUIProvider";
2
+ export { default as useMonolithUITheme } from "./useMonolithUITheme";
3
+ export { default as getTheme } from "../theme";
@@ -0,0 +1,10 @@
1
+ import { useContext } from "react";
2
+ import { MonolithUIContext } from "./MonolithUIProvider";
3
+ const useMonolithUITheme = () => {
4
+ const context = useContext(MonolithUIContext);
5
+ if (context === undefined) {
6
+ throw new Error("hook must be used within a MonolithUIProvider");
7
+ }
8
+ return context;
9
+ };
10
+ export default useMonolithUITheme;
@@ -0,0 +1,147 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import styled from "styled-components";
3
+ import { X } from "lucide-react";
4
+ const StyledButton = styled.button `
5
+ background-color: transparent;
6
+ border: none;
7
+ cursor: pointer;
8
+ display: flex;
9
+ align-items: center;
10
+ justify-content: center;
11
+ padding: 0;
12
+ margin: 0;
13
+ outline: none;
14
+ transition: color 0.2s;
15
+ padding-inline-end: 5px;
16
+ `;
17
+ const Pill = styled(({ className, children, size = "md", showRemoveIcon = true, onRemove, }) => {
18
+ const handleRemove = (e) => {
19
+ e.preventDefault();
20
+ e.stopPropagation();
21
+ onRemove === null || onRemove === void 0 ? void 0 : onRemove();
22
+ };
23
+ return (_jsxs("div", { className: className, onClick: (e) => {
24
+ e.preventDefault();
25
+ e.stopPropagation();
26
+ }, children: [_jsx("span", { className: "pill-content", children: children }), showRemoveIcon && (_jsx(StyledButton, { onClick: handleRemove, onMouseDown: (e) => {
27
+ e.preventDefault();
28
+ e.stopPropagation();
29
+ }, children: _jsx(X, {}) }))] }));
30
+ }) `
31
+ user-select: none;
32
+ display: flex;
33
+ align-items: center;
34
+ justify-content: space-between;
35
+ flex-direction: row;
36
+ width: fit-content;
37
+ max-width: 250px;
38
+ gap: 5px;
39
+ flex: 0;
40
+
41
+ font-weight: 500;
42
+ color: ${({ theme }) => theme.palette.text.primary};
43
+
44
+ padding-inline-end: ${({ size, showRemoveIcon }) => {
45
+ if (showRemoveIcon !== false) {
46
+ return "0px";
47
+ }
48
+ switch (size) {
49
+ case "xs":
50
+ return "8px";
51
+ case "sm":
52
+ return "10px";
53
+ case "md":
54
+ return "12px";
55
+ case "lg":
56
+ return "14px";
57
+ case "xl":
58
+ return "16px";
59
+ default:
60
+ return "10px";
61
+ }
62
+ }};
63
+
64
+ padding-inline-start: ${({ size }) => {
65
+ switch (size) {
66
+ case "xs":
67
+ return "8px";
68
+ case "sm":
69
+ return "10px";
70
+ case "md":
71
+ return "12px";
72
+ case "lg":
73
+ return "14px";
74
+ case "xl":
75
+ return "16px";
76
+ default:
77
+ return "10px";
78
+ }
79
+ }};
80
+
81
+ height: ${({ size }) => {
82
+ switch (size) {
83
+ case "xs":
84
+ return "20px";
85
+ case "sm":
86
+ return "22px";
87
+ case "md":
88
+ return "24px";
89
+ case "lg":
90
+ return "26px";
91
+ case "xl":
92
+ return "28px";
93
+ default:
94
+ return "22px";
95
+ }
96
+ }};
97
+
98
+ border: 1px solid ${({ theme }) => theme.palette.divider};
99
+ border-radius: 1000px;
100
+
101
+ background-color: ${({ theme }) => theme.palette.background.secondary};
102
+
103
+ .pill-content {
104
+ white-space: nowrap;
105
+ overflow: hidden;
106
+ text-overflow: ellipsis;
107
+
108
+ font-size: ${({ size }) => {
109
+ switch (size) {
110
+ case "xs":
111
+ return "10px";
112
+ case "sm":
113
+ return "12px";
114
+ case "md":
115
+ return "14px";
116
+ case "lg":
117
+ return "16px";
118
+ case "xl":
119
+ return "18px";
120
+ default:
121
+ return "12px";
122
+ }
123
+ }};
124
+ }
125
+
126
+ svg {
127
+ color: ${({ theme }) => theme.palette.text.primary};
128
+
129
+ width: ${({ size }) => {
130
+ switch (size) {
131
+ case "xs":
132
+ return "12px";
133
+ case "sm":
134
+ return "14px";
135
+ case "md":
136
+ return "16px";
137
+ case "lg":
138
+ return "18px";
139
+ case "xl":
140
+ return "20px";
141
+ default:
142
+ return "14px";
143
+ }
144
+ }};
145
+ }
146
+ `;
147
+ export default Pill;
@@ -0,0 +1 @@
1
+ export { default } from "./Pill";