@monolith-forensics/monolith-ui 1.0.10 → 1.1.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 (189) hide show
  1. package/Button/Button.tsx +382 -0
  2. package/Button/index.ts +2 -0
  3. package/{src/components/Calendar/Calendar.js → Calendar/Calendar.tsx} +104 -93
  4. package/{src/components/Calendar/CalendarStyles.js → Calendar/CalendarStyles.tsx} +26 -36
  5. package/{src/components/Calendar/calendarHelpers.js → Calendar/calendarHelpers.ts} +10 -8
  6. package/Calendar/index.ts +1 -0
  7. package/CheckBox/CheckBox.tsx +61 -0
  8. package/CheckBox/index.ts +1 -0
  9. package/{src/components/DateInput/DateInput.js → DateInput/DateInput.tsx} +227 -93
  10. package/DateInput/index.ts +1 -0
  11. package/DropDownMenu/DropDownMenu.tsx +402 -0
  12. package/DropDownMenu/index.ts +1 -0
  13. package/Error/Error.tsx +51 -0
  14. package/Error/index.ts +1 -0
  15. package/{src/components/FieldLabel → FieldLabel}/FieldLabel.tsx +25 -22
  16. package/{src/components/FileInputField/FileInputField.js → FileInputField/FileInputField.tsx} +23 -15
  17. package/FileInputField/index.ts +1 -0
  18. package/Flyout/Flyout.tsx +172 -0
  19. package/Flyout/FlyoutHeader.tsx +14 -0
  20. package/Flyout/FlyoutTitle.tsx +10 -0
  21. package/Flyout/index.ts +3 -0
  22. package/FormSection/FormSection.tsx +71 -0
  23. package/FormSection/index.ts +1 -0
  24. package/Grid/Grid.tsx +18 -0
  25. package/Grid/index.ts +1 -0
  26. package/IconButton/IconButton.tsx +27 -0
  27. package/IconButton/index.ts +1 -0
  28. package/{src/components/Input → Input}/Input.tsx +57 -34
  29. package/Modal/Modal.tsx +172 -0
  30. package/Modal/index.ts +1 -0
  31. package/{src/components/Pill → Pill}/Pill.tsx +41 -11
  32. package/SelectBox/SelectBox.tsx +745 -0
  33. package/SelectBox/index.ts +1 -0
  34. package/Switch/Switch.tsx +204 -0
  35. package/Switch/index.ts +1 -0
  36. package/TagBox/TagBox.tsx +694 -0
  37. package/TagBox/TagBoxStyles.tsx +116 -0
  38. package/TagBox/index.ts +1 -0
  39. package/{src/components/TextArea → TextArea}/TextArea.tsx +35 -13
  40. package/{src/components/TextAreaInput → TextAreaInput}/TextAreaInput.tsx +11 -13
  41. package/{src/components/TextInput → TextInput}/TextInput.tsx +11 -13
  42. package/Tooltip/Tooltip.tsx +68 -0
  43. package/Tooltip/index.ts +1 -0
  44. package/{src/components/ArrowButton → core}/ArrowButton.tsx +17 -20
  45. package/core/ClearButton.tsx +51 -0
  46. package/core/StyledContent.tsx +50 -0
  47. package/core/StyledFloatContainer.tsx +7 -0
  48. package/core/Types/Size.ts +3 -0
  49. package/core/Types/Variant.ts +10 -0
  50. package/core/index.ts +6 -0
  51. package/dist/Button/Button.d.ts +19 -0
  52. package/dist/Button/Button.js +332 -0
  53. package/dist/Button/index.d.ts +2 -0
  54. package/dist/Button/index.js +8 -0
  55. package/dist/Calendar/Calendar.d.ts +15 -0
  56. package/dist/Calendar/Calendar.js +232 -0
  57. package/dist/Calendar/CalendarStyles.d.ts +36 -0
  58. package/dist/Calendar/CalendarStyles.js +170 -0
  59. package/dist/Calendar/calendarHelpers.d.ts +53 -0
  60. package/dist/Calendar/calendarHelpers.js +181 -0
  61. package/dist/Calendar/index.d.ts +1 -0
  62. package/dist/Calendar/index.js +8 -0
  63. package/dist/CheckBox/CheckBox.d.ts +11 -0
  64. package/dist/CheckBox/CheckBox.js +34 -0
  65. package/dist/CheckBox/index.d.ts +1 -0
  66. package/dist/CheckBox/index.js +8 -0
  67. package/dist/DateInput/DateInput.d.ts +24 -0
  68. package/dist/DateInput/DateInput.js +511 -0
  69. package/dist/DateInput/index.d.ts +1 -0
  70. package/dist/DateInput/index.js +8 -0
  71. package/dist/DropDownMenu/DropDownMenu.d.ts +36 -0
  72. package/dist/DropDownMenu/DropDownMenu.js +212 -0
  73. package/dist/DropDownMenu/index.d.ts +1 -0
  74. package/dist/DropDownMenu/index.js +8 -0
  75. package/dist/Error/Error.d.ts +4 -0
  76. package/dist/Error/Error.js +38 -0
  77. package/dist/Error/index.d.ts +1 -0
  78. package/dist/Error/index.js +8 -0
  79. package/dist/FieldLabel/FieldLabel.d.ts +19 -0
  80. package/dist/FieldLabel/FieldLabel.js +119 -0
  81. package/dist/FieldLabel/index.d.ts +1 -0
  82. package/dist/FieldLabel/index.js +8 -0
  83. package/dist/FileInputField/FileInputField.d.ts +18 -0
  84. package/dist/FileInputField/FileInputField.js +116 -0
  85. package/dist/FileInputField/index.d.ts +1 -0
  86. package/dist/FileInputField/index.js +8 -0
  87. package/dist/Flyout/Flyout.d.ts +10 -0
  88. package/dist/Flyout/Flyout.js +111 -0
  89. package/dist/Flyout/FlyoutHeader.d.ts +5 -0
  90. package/dist/Flyout/FlyoutHeader.js +12 -0
  91. package/dist/Flyout/FlyoutTitle.d.ts +2 -0
  92. package/dist/Flyout/FlyoutTitle.js +13 -0
  93. package/dist/Flyout/index.d.ts +3 -0
  94. package/dist/Flyout/index.js +12 -0
  95. package/dist/FormSection/FormSection.d.ts +9 -0
  96. package/dist/FormSection/FormSection.js +51 -0
  97. package/dist/FormSection/index.d.ts +1 -0
  98. package/dist/FormSection/index.js +8 -0
  99. package/dist/Grid/Grid.d.ts +6 -0
  100. package/dist/Grid/Grid.js +15 -0
  101. package/dist/Grid/index.d.ts +1 -0
  102. package/dist/Grid/index.js +8 -0
  103. package/dist/IconButton/IconButton.d.ts +5 -0
  104. package/dist/IconButton/IconButton.js +30 -0
  105. package/dist/IconButton/index.d.ts +1 -0
  106. package/dist/IconButton/index.js +8 -0
  107. package/dist/Input/Input.d.ts +21 -0
  108. package/dist/Input/Input.js +148 -0
  109. package/dist/Input/index.d.ts +1 -0
  110. package/dist/Input/index.js +8 -0
  111. package/dist/Modal/Modal.d.ts +14 -0
  112. package/dist/Modal/Modal.js +134 -0
  113. package/dist/Modal/index.d.ts +1 -0
  114. package/dist/Modal/index.js +8 -0
  115. package/dist/Pill/Pill.d.ts +11 -0
  116. package/dist/Pill/Pill.js +146 -0
  117. package/dist/Pill/index.d.ts +1 -0
  118. package/dist/Pill/index.js +8 -0
  119. package/dist/SelectBox/SelectBox.d.ts +45 -0
  120. package/dist/SelectBox/SelectBox.js +469 -0
  121. package/dist/SelectBox/index.d.ts +1 -0
  122. package/dist/SelectBox/index.js +8 -0
  123. package/dist/Switch/Switch.d.ts +18 -0
  124. package/dist/Switch/Switch.js +157 -0
  125. package/dist/Switch/index.d.ts +1 -0
  126. package/dist/Switch/index.js +8 -0
  127. package/dist/TagBox/TagBox.d.ts +38 -0
  128. package/dist/TagBox/TagBox.js +440 -0
  129. package/dist/TagBox/TagBoxStyles.d.ts +11 -0
  130. package/dist/TagBox/TagBoxStyles.js +113 -0
  131. package/dist/TagBox/index.d.ts +1 -0
  132. package/dist/TagBox/index.js +8 -0
  133. package/dist/TextArea/TextArea.d.ts +16 -0
  134. package/dist/TextArea/TextArea.js +80 -0
  135. package/dist/TextArea/index.d.ts +1 -0
  136. package/dist/TextArea/index.js +8 -0
  137. package/dist/TextAreaInput/TextAreaInput.d.ts +12 -0
  138. package/dist/TextAreaInput/TextAreaInput.js +23 -0
  139. package/dist/TextAreaInput/index.d.ts +1 -0
  140. package/dist/TextAreaInput/index.js +8 -0
  141. package/dist/TextInput/TextInput.d.ts +12 -0
  142. package/dist/TextInput/TextInput.js +30 -0
  143. package/dist/TextInput/index.d.ts +1 -0
  144. package/dist/TextInput/index.js +8 -0
  145. package/dist/Tooltip/Tooltip.d.ts +12 -0
  146. package/dist/Tooltip/Tooltip.js +53 -0
  147. package/dist/Tooltip/index.d.ts +1 -0
  148. package/dist/Tooltip/index.js +8 -0
  149. package/dist/core/ArrowButton.d.ts +6 -0
  150. package/dist/core/ArrowButton.js +48 -0
  151. package/dist/core/ClearButton.d.ts +6 -0
  152. package/dist/core/ClearButton.js +48 -0
  153. package/dist/core/StyledContent.d.ts +7 -0
  154. package/dist/core/StyledContent.js +46 -0
  155. package/dist/core/StyledFloatContainer.d.ts +2 -0
  156. package/dist/core/StyledFloatContainer.js +10 -0
  157. package/dist/core/Types/Size.d.ts +2 -0
  158. package/dist/core/Types/Size.js +2 -0
  159. package/dist/core/Types/Variant.d.ts +2 -0
  160. package/dist/core/Types/Variant.js +2 -0
  161. package/dist/core/index.d.ts +6 -0
  162. package/dist/core/index.js +14 -0
  163. package/dist/index.d.ts +22 -0
  164. package/dist/index.js +51 -0
  165. package/index.ts +22 -0
  166. package/package.json +12 -21
  167. package/{src/components/theme → theme}/components.js +0 -2
  168. package/{src/components/theme → theme}/index.js +0 -1
  169. package/{src/components/theme → theme}/variants.js +0 -1
  170. package/tsconfig.json +11 -11
  171. package/.gitattributes +0 -2
  172. package/rollup.config.js +0 -10
  173. package/src/components/ArrowButton/index.tsx +0 -1
  174. package/src/components/Button/Button.tsx +0 -278
  175. package/src/components/Button/index.ts +0 -1
  176. package/src/components/SelectBox/SelectBox.js +0 -543
  177. package/src/components/TagBox/TagBox.js +0 -563
  178. package/src/components/index.ts +0 -7
  179. package/src/index.ts +0 -1
  180. /package/{src/components/FieldLabel → FieldLabel}/index.ts +0 -0
  181. /package/{src/components/Input/index.tsx → Input/index.ts} +0 -0
  182. /package/{src/components/Pill → Pill}/index.ts +0 -0
  183. /package/{src/components/TextArea → TextArea}/index.ts +0 -0
  184. /package/{src/components/TextAreaInput → TextAreaInput}/index.ts +0 -0
  185. /package/{src/components/TextInput/index.tsx → TextInput/index.ts} +0 -0
  186. /package/{src/components/core/index.js → core/MonolithThemeProvider.js} +0 -0
  187. /package/{src/components/theme → theme}/breakpoints.js +0 -0
  188. /package/{src/components/theme → theme}/shadows.js +0 -0
  189. /package/{src/components/theme → theme}/typography.js +0 -0
@@ -0,0 +1,172 @@
1
+ import {
2
+ FloatingFocusManager,
3
+ FloatingOverlay,
4
+ FloatingPortal,
5
+ useFloating,
6
+ } from "@floating-ui/react";
7
+ import { XIcon } from "lucide-react";
8
+ import styled from "styled-components";
9
+
10
+ const ANIMATION_TIME = 300;
11
+
12
+ const StyledOverlay = styled(FloatingOverlay)`
13
+ background-color: rgba(0, 0, 0, 0.3);
14
+ position: fixed;
15
+ inset: 0;
16
+ z-index: 1400;
17
+
18
+ @keyframes overlayShow {
19
+ from {
20
+ opacity: 0;
21
+ }
22
+ to {
23
+ opacity: 1;
24
+ }
25
+ }
26
+ `;
27
+
28
+ const StyledClose = styled.div`
29
+ position: absolute;
30
+ top: 20px;
31
+ right: 20px;
32
+
33
+ color: ${(props) => props.theme.palette.text.secondary};
34
+ `;
35
+
36
+ const StyledButton = styled.button`
37
+ background-color: transparent;
38
+ border: none;
39
+ outline: none;
40
+ cursor: pointer;
41
+ padding: 0;
42
+
43
+ color: ${(props) => props.theme.palette.text.primary};
44
+
45
+ &:hover {
46
+ background-color: ${(props) => props.theme.palette.action.hover};
47
+ }
48
+ `;
49
+
50
+ interface StyledContentProps {
51
+ translate?: any;
52
+ }
53
+
54
+ const StyledContent = styled.div<StyledContentProps>`
55
+ background-color: ${({ theme }) =>
56
+ theme.name === "DARK"
57
+ ? theme.palette.background.alt
58
+ : theme.palette.background.default};
59
+ border-radius: 6px;
60
+ border: 1px solid ${(props) => props.theme.palette.divider};
61
+ position: fixed;
62
+ margin: 10px;
63
+
64
+ top: 0px;
65
+ right: 0px;
66
+ width: 50vw;
67
+ height: calc(100vh - 20px);
68
+
69
+ box-shadow: rgba(0, 0, 0, 0.5) 0px 16px 70px;
70
+
71
+ display: flex;
72
+ flex-direction: column;
73
+ flex: 1 1 auto;
74
+
75
+ overflow-y: hidden;
76
+
77
+ &:focus {
78
+ outline: none;
79
+ }
80
+
81
+ animation: contentShow ${ANIMATION_TIME}ms cubic-bezier(0.16, 1, 0.3, 1);
82
+
83
+ // slide in from right to left
84
+ @keyframes contentShow {
85
+ from {
86
+ transform: translate(100%, 0);
87
+ }
88
+ to {
89
+ transform: translate(0, 0);
90
+ }
91
+ }
92
+ `;
93
+
94
+ const StyledInnerContent = styled.div`
95
+ display: flex;
96
+ flex-direction: column;
97
+ flex: 1 1 auto;
98
+
99
+ overflow-y: auto;
100
+ padding: 25px;
101
+ `;
102
+
103
+ interface FlyoutProps {
104
+ children: React.ReactNode;
105
+ open?: boolean;
106
+ onClose?: () => void;
107
+ style?: React.CSSProperties;
108
+ closeOnOutsideClick?: boolean;
109
+ showCloseButton?: boolean;
110
+ }
111
+
112
+ const Flyout: React.FC<FlyoutProps> = ({
113
+ children,
114
+ open = false,
115
+ onClose = () => {},
116
+ style = {},
117
+ closeOnOutsideClick = true,
118
+ showCloseButton = true,
119
+ }) => {
120
+ const { refs, floatingStyles, context } = useFloating({
121
+ open,
122
+ onOpenChange: (isOpen) => {
123
+ if (!isOpen) {
124
+ onClose?.();
125
+ }
126
+ },
127
+ });
128
+
129
+ const handleMouseDown = (event: React.MouseEvent<HTMLDivElement>) => {
130
+ const target = event.target as HTMLDivElement;
131
+ if (
132
+ target?.className?.includes?.("mf-ModalOverlay") &&
133
+ closeOnOutsideClick
134
+ ) {
135
+ onClose?.();
136
+ }
137
+ };
138
+
139
+ return (
140
+ <FloatingPortal preserveTabOrder>
141
+ {open && (
142
+ <StyledOverlay
143
+ className="mf-ModalOverlay"
144
+ lockScroll
145
+ onMouseDown={handleMouseDown}
146
+ >
147
+ <FloatingFocusManager context={context} modal={true}>
148
+ <StyledContent
149
+ style={style}
150
+ className={`mf-Modal mf-Flyout`}
151
+ ref={refs.setFloating}
152
+ {...floatingStyles}
153
+ >
154
+ {showCloseButton && (
155
+ <StyledClose>
156
+ <StyledButton onMouseDown={() => onClose?.()}>
157
+ <XIcon size={18} />
158
+ </StyledButton>
159
+ </StyledClose>
160
+ )}
161
+ <StyledInnerContent className="mf-Flyout inner-content">
162
+ {children}
163
+ </StyledInnerContent>
164
+ </StyledContent>
165
+ </FloatingFocusManager>
166
+ </StyledOverlay>
167
+ )}
168
+ </FloatingPortal>
169
+ );
170
+ };
171
+
172
+ export default Flyout;
@@ -0,0 +1,14 @@
1
+ import styled from "styled-components";
2
+
3
+ interface FlyoutHeaderProps {
4
+ hasBorder?: boolean;
5
+ }
6
+
7
+ const FlyoutHeader = styled.div<FlyoutHeaderProps>`
8
+ border-bottom: ${({ theme, hasBorder }) =>
9
+ hasBorder ? `1px solid ${theme.palette.divider}` : "none"};
10
+
11
+ min-height: 50px;
12
+ `;
13
+
14
+ export default FlyoutHeader;
@@ -0,0 +1,10 @@
1
+ import styled from "styled-components";
2
+
3
+ const FlyoutTitle = styled.h1`
4
+ font-size: 24px;
5
+ font-weight: 600;
6
+ margin: 0px;
7
+ color: ${(props) => props.theme.palette.text.primary};
8
+ `;
9
+
10
+ export default FlyoutTitle;
@@ -0,0 +1,3 @@
1
+ export { default } from "./Flyout";
2
+ export { default as FlyoutHeader } from "./FlyoutHeader";
3
+ export { default as FlyoutTitle } from "./FlyoutTitle";
@@ -0,0 +1,71 @@
1
+ import { ChevronDownIcon } from "lucide-react";
2
+ import { ReactNode, useState } from "react";
3
+ import styled from "styled-components";
4
+
5
+ interface FormSectionProps {
6
+ children?: ReactNode;
7
+ className?: string;
8
+ title?: string;
9
+ defaultOpen?: boolean;
10
+ }
11
+
12
+ const FormSection = styled(
13
+ ({ className, title, children, defaultOpen = true }: FormSectionProps) => {
14
+ const [open, setOpen] = useState(defaultOpen);
15
+
16
+ return (
17
+ <div className={className}>
18
+ <div
19
+ className="section-header"
20
+ onClick={(e) => setOpen((prev) => !prev)}
21
+ >
22
+ <h3>{title}</h3>
23
+ <div className="section-line"></div>
24
+ <ChevronDownIcon size={18} className={open ? "open" : ""} />
25
+ </div>
26
+ <div className="section-content" data-open={open}>
27
+ {children}
28
+ </div>
29
+ </div>
30
+ );
31
+ }
32
+ )`
33
+ h3 {
34
+ margin: 0;
35
+ }
36
+
37
+ .section-header {
38
+ user-select: none;
39
+ cursor: pointer;
40
+ margin-bottom: 10px;
41
+
42
+ display: flex;
43
+ flex-direction: row;
44
+ gap: 10px;
45
+ align-items: center;
46
+
47
+ .section-line {
48
+ flex: 1;
49
+ height: 1px;
50
+ background-color: ${({ theme }) => theme.palette.divider};
51
+ }
52
+
53
+ svg {
54
+ transition: transform 0.2s;
55
+ color: ${({ theme }) => theme.palette.text.secondary};
56
+
57
+ &.open {
58
+ transform: rotate(180deg);
59
+ }
60
+ }
61
+ }
62
+
63
+ .section-content {
64
+ padding: 10px 0px;
65
+ &[data-open="false"] {
66
+ display: none;
67
+ }
68
+ }
69
+ `;
70
+
71
+ export default FormSection;
@@ -0,0 +1 @@
1
+ export { default } from "./FormSection";
package/Grid/Grid.tsx ADDED
@@ -0,0 +1,18 @@
1
+ import styled from "styled-components";
2
+
3
+ interface GridProps {
4
+ col?: number;
5
+ width?: string | number;
6
+ }
7
+
8
+ const Grid = styled.div<GridProps>`
9
+ display: grid;
10
+ grid-template-columns: repeat(${({ col }) => col || 1}, minmax(0, 1fr));
11
+ gap: 20px;
12
+
13
+ width: ${({ width }) =>
14
+ Number.isInteger(width) ? `${width}px` : width || "100%"};
15
+ height: auto;
16
+ `;
17
+
18
+ export default Grid;
package/Grid/index.ts ADDED
@@ -0,0 +1 @@
1
+ export { default } from "./Grid";
@@ -0,0 +1,27 @@
1
+ import styled from "styled-components";
2
+ import { Button } from "..";
3
+ import { ButtonProps } from "../Button/Button.js";
4
+
5
+ const IconButton = styled(Button)<ButtonProps>`
6
+ padding: ${({ size, variant }) => {
7
+ if (variant === "text") return `0px 0px`;
8
+ switch (size) {
9
+ case "xxs":
10
+ return `0px 4px`;
11
+ case "xs":
12
+ return `0px 4px`;
13
+ case "sm":
14
+ return `0px 6px`;
15
+ case "md":
16
+ return `0px 8px`;
17
+ case "lg":
18
+ return `0px 10px`;
19
+ case "xl":
20
+ return `0px 12px`;
21
+ default:
22
+ return `0px 6px`;
23
+ }
24
+ }};
25
+ `;
26
+
27
+ export default IconButton;
@@ -0,0 +1 @@
1
+ export { default } from "./IconButton";
@@ -1,36 +1,58 @@
1
- import React from "react";
2
1
  import styled from "styled-components";
2
+ import { Size, Variant } from "../core";
3
+ import { forwardRef } from "react";
3
4
 
4
- interface StyledInputProps {
5
- variant?: "contained" | "filled" | "outlined" | "text";
6
- size?: "xs" | "sm" | "md" | "lg" | "xl";
7
- width?: string | number | null;
8
- error?: boolean;
5
+ export interface InputProps {
6
+ ref?: React.Ref<HTMLInputElement>;
7
+ className?: string;
8
+ size?: Size;
9
+ variant?: Variant;
10
+ width?: string | number | null | undefined;
11
+ style?: React.CSSProperties;
12
+ placeholder?: string;
13
+ onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
14
+ onKeyUp?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
15
+ onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
16
+ onFocus?: (e: React.FocusEvent<HTMLInputElement>) => void;
17
+ onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
18
+ autoFocus?: boolean;
19
+ readOnly?: boolean;
9
20
  }
10
21
 
11
- const StyledInput = styled.input<StyledInputProps>`
22
+ const Input = styled(
23
+ forwardRef(
24
+ (
25
+ {
26
+ className,
27
+ size = "sm",
28
+ variant = "outlined",
29
+ width,
30
+ ...rest
31
+ }: InputProps,
32
+ ref: React.Ref<HTMLInputElement>
33
+ ) => {
34
+ return <input ref={ref} className={className} {...rest} />;
35
+ }
36
+ )
37
+ )`
12
38
  font-family: ${({ theme }) => theme.typography.fontFamily};
13
39
  pointer-events: "all";
14
40
  user-select: "all";
15
41
  outline: none;
16
42
 
17
43
  color: ${({ theme }) => theme.palette.text.primary};
18
- font-size: ${({ size }) => {
19
- switch (size) {
20
- case "xs":
21
- return "12px";
22
- case "sm":
23
- return "14px";
24
- case "md":
25
- return "16px";
26
- case "lg":
27
- return "18px";
28
- case "xl":
29
- return "20px";
30
- default:
31
- return "12px";
32
- }
33
- }};
44
+ font-size: ${({ size }) =>
45
+ size === "xs"
46
+ ? "11px"
47
+ : size === "sm"
48
+ ? "13px"
49
+ : size === "md"
50
+ ? "15px"
51
+ : size === "lg"
52
+ ? "17px"
53
+ : size === "xl"
54
+ ? "19px"
55
+ : "11px"};
34
56
 
35
57
  height: ${({ size }) =>
36
58
  size === "xs"
@@ -58,11 +80,10 @@ const StyledInput = styled.input<StyledInputProps>`
58
80
  ? "50px"
59
81
  : "26px"};
60
82
 
83
+ transition: border 0.1s ease-in-out;
61
84
  border-radius: 4px;
62
85
  border: 1px solid
63
- ${({ theme, variant, error }) => {
64
- // if (!!error) return theme.palette.error.main;
65
-
86
+ ${({ theme, variant }) => {
66
87
  switch (variant) {
67
88
  case "contained":
68
89
  return "transparent";
@@ -112,8 +133,6 @@ const StyledInput = styled.input<StyledInputProps>`
112
133
  }
113
134
  }};
114
135
 
115
- transition: border 0.1s ease-in-out;
116
-
117
136
  ::placeholder {
118
137
  font-size: ${({ size }) =>
119
138
  size === "xs"
@@ -129,13 +148,17 @@ const StyledInput = styled.input<StyledInputProps>`
129
148
  : "10px"};
130
149
  }
131
150
 
132
- // &:hover {
133
- // border: 1px solid ${(props) => props.theme.palette.input.border};
134
- // }
135
-
136
151
  &:focus {
137
- border: 1px solid ${({ theme, error }) => theme.palette.primary.main};
152
+ border: 1px solid ${({ theme }) => theme.palette.primary.main};
153
+ }
154
+
155
+ &[data-button-right="true"] {
156
+ padding-right: 36px;
157
+ }
158
+
159
+ &[readOnly] {
160
+ cursor: pointer;
138
161
  }
139
162
  `;
140
163
 
141
- export default StyledInput;
164
+ export default Input;
@@ -0,0 +1,172 @@
1
+ import styled from "styled-components";
2
+ import * as RadixDialog from "@radix-ui/react-dialog";
3
+ import { X } from "lucide-react";
4
+ import {
5
+ FloatingFocusManager,
6
+ FloatingOverlay,
7
+ FloatingPortal,
8
+ useFloating,
9
+ } from "@floating-ui/react";
10
+ import { CSSProperties, Ref } from "react";
11
+
12
+ const StyledOverlay = styled(FloatingOverlay)`
13
+ background-color: rgba(0, 0, 0, 0.3);
14
+ position: fixed;
15
+ inset: 0;
16
+ z-index: 1400;
17
+
18
+ @keyframes overlayShow {
19
+ from {
20
+ opacity: 0;
21
+ }
22
+ to {
23
+ opacity: 1;
24
+ }
25
+ }
26
+ `;
27
+
28
+ interface StyledContentProps {
29
+ style?: CSSProperties;
30
+ className?: string;
31
+ ref?: Ref<HTMLDivElement>;
32
+ // Add other props that StyledContent might receive
33
+ [key: string]: any; // For additional props such as `floatingStyles`
34
+ }
35
+
36
+ const StyledContent = styled.div<StyledContentProps>`
37
+ background-color: ${({ theme }) =>
38
+ theme.name === "DARK"
39
+ ? theme.palette.background.default
40
+ : theme.palette.background.default};
41
+ border-radius: 6px;
42
+ border: 1px solid ${(props) => props.theme.palette.divider};
43
+ position: fixed;
44
+ top: 25px;
45
+ left: 50%;
46
+ transform: translate(-50%, 0px);
47
+ box-shadow: rgba(0, 0, 0, 0.5) 0px 16px 70px;
48
+
49
+ z-index: 2;
50
+
51
+ max-height: calc(100vh - 50px);
52
+ max-width: calc(100vw - 50px);
53
+
54
+ display: flex;
55
+ flex-direction: column;
56
+
57
+ overflow-y: hidden;
58
+
59
+ &:focus {
60
+ outline: none;
61
+ }
62
+
63
+ @keyframes contentShow {
64
+ from {
65
+ opacity: 0;
66
+ transform: translate(-50%, -48%) scale(0.96);
67
+ }
68
+ to {
69
+ opacity: 1;
70
+ transform: translate(-50%, -50%) scale(1);
71
+ }
72
+ }
73
+ `;
74
+
75
+ const StyledInnerContent = styled.div`
76
+ display: flex;
77
+ flex-direction: column;
78
+
79
+ overflow-y: auto;
80
+ padding: 25px;
81
+ `;
82
+
83
+ const StyledClose = styled(RadixDialog.Close)`
84
+ position: absolute;
85
+ top: 15px;
86
+ right: 15px;
87
+
88
+ color: ${(props) => props.theme.palette.text.secondary};
89
+ `;
90
+
91
+ const StyledButton = styled.button`
92
+ background-color: transparent;
93
+ border: none;
94
+ outline: none;
95
+ cursor: pointer;
96
+ padding: 0;
97
+ `;
98
+
99
+ const Title = styled.h1`
100
+ font-size: 20px;
101
+ font-weight: 600;
102
+ margin: 0px;
103
+ `;
104
+
105
+ const SubTitle = styled.h2`
106
+ font-size: 14px;
107
+ font-weight: 500;
108
+ margin: 0px;
109
+ color: ${(props) => props.theme.palette.text.secondary};
110
+ `;
111
+
112
+ interface ModalProps {
113
+ children: React.ReactNode;
114
+ open?: boolean;
115
+ onClose?: () => void;
116
+ style?: React.CSSProperties;
117
+ showCloseButton?: boolean;
118
+ FocusProps?: any;
119
+ }
120
+
121
+ const Modal = ({
122
+ children,
123
+ open = false,
124
+ onClose,
125
+ style = {},
126
+ showCloseButton = false,
127
+ FocusProps = {},
128
+ }: ModalProps) => {
129
+ const { refs, floatingStyles, context } = useFloating({
130
+ open,
131
+ onOpenChange: (isOpen) => {
132
+ if (!isOpen) {
133
+ onClose?.();
134
+ }
135
+ },
136
+ });
137
+
138
+ const handleMouseDown = () => {
139
+ onClose?.();
140
+ };
141
+
142
+ return (
143
+ <FloatingPortal preserveTabOrder>
144
+ {open && (
145
+ <StyledOverlay className="mf-ModalOverlay" lockScroll>
146
+ <FloatingFocusManager context={context} modal={true} {...FocusProps}>
147
+ <StyledContent
148
+ style={style}
149
+ className="mf-Modal"
150
+ ref={refs.setFloating}
151
+ {...floatingStyles}
152
+ >
153
+ {showCloseButton && (
154
+ <StyledClose asChild>
155
+ <StyledButton onMouseDown={handleMouseDown}>
156
+ <X size={18} />
157
+ </StyledButton>
158
+ </StyledClose>
159
+ )}
160
+ <StyledInnerContent>{children}</StyledInnerContent>
161
+ </StyledContent>
162
+ </FloatingFocusManager>
163
+ </StyledOverlay>
164
+ )}
165
+ </FloatingPortal>
166
+ );
167
+ };
168
+
169
+ Modal.Title = Title;
170
+ Modal.SubTitle = SubTitle;
171
+
172
+ export default Modal;
package/Modal/index.ts ADDED
@@ -0,0 +1 @@
1
+ export { default } from "./Modal";