@monolith-forensics/monolith-ui 1.1.0 → 1.1.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/package.json +4 -1
- package/Button/Button.tsx +0 -382
- package/Button/index.ts +0 -2
- package/Calendar/Calendar.tsx +0 -376
- package/Calendar/CalendarStyles.tsx +0 -180
- package/Calendar/calendarHelpers.ts +0 -196
- package/Calendar/index.ts +0 -1
- package/CheckBox/CheckBox.tsx +0 -61
- package/CheckBox/index.ts +0 -1
- package/DateInput/DateInput.tsx +0 -717
- package/DateInput/index.ts +0 -1
- package/DropDownMenu/DropDownMenu.tsx +0 -402
- package/DropDownMenu/index.ts +0 -1
- package/Error/Error.tsx +0 -51
- package/Error/index.ts +0 -1
- package/FieldLabel/FieldLabel.tsx +0 -155
- package/FieldLabel/index.ts +0 -1
- package/FileInputField/FileInputField.tsx +0 -179
- package/FileInputField/index.ts +0 -1
- package/Flyout/Flyout.tsx +0 -172
- package/Flyout/FlyoutHeader.tsx +0 -14
- package/Flyout/FlyoutTitle.tsx +0 -10
- package/Flyout/index.ts +0 -3
- package/FormSection/FormSection.tsx +0 -71
- package/FormSection/index.ts +0 -1
- package/Grid/Grid.tsx +0 -18
- package/Grid/index.ts +0 -1
- package/IconButton/IconButton.tsx +0 -27
- package/IconButton/index.ts +0 -1
- package/Input/Input.tsx +0 -164
- package/Input/index.ts +0 -1
- package/Modal/Modal.tsx +0 -172
- package/Modal/index.ts +0 -1
- package/Pill/Pill.tsx +0 -174
- package/Pill/index.ts +0 -1
- package/SelectBox/SelectBox.tsx +0 -745
- package/SelectBox/index.ts +0 -1
- package/Switch/Switch.tsx +0 -204
- package/Switch/index.ts +0 -1
- package/TagBox/TagBox.tsx +0 -694
- package/TagBox/TagBoxStyles.tsx +0 -116
- package/TagBox/index.ts +0 -1
- package/TextArea/TextArea.tsx +0 -92
- package/TextArea/index.ts +0 -1
- package/TextAreaInput/TextAreaInput.tsx +0 -46
- package/TextAreaInput/index.ts +0 -1
- package/TextInput/TextInput.tsx +0 -48
- package/TextInput/index.ts +0 -1
- package/Tooltip/Tooltip.tsx +0 -68
- package/Tooltip/index.ts +0 -1
- package/core/ArrowButton.tsx +0 -51
- package/core/ClearButton.tsx +0 -51
- package/core/MonolithThemeProvider.js +0 -16
- package/core/StyledContent.tsx +0 -50
- package/core/StyledFloatContainer.tsx +0 -7
- package/core/Types/Size.ts +0 -3
- package/core/Types/Variant.ts +0 -10
- package/core/index.ts +0 -6
- package/index.ts +0 -22
- package/theme/breakpoints.js +0 -11
- package/theme/components.js +0 -138
- package/theme/index.js +0 -76
- package/theme/shadows.js +0 -33
- package/theme/typography.js +0 -58
- package/theme/variants.js +0 -234
- package/tsconfig.json +0 -109
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import { useCallback, useState, ReactNode, HTMLAttributes } from "react";
|
|
2
|
-
import styled from "styled-components";
|
|
3
|
-
import { useDropzone, DropzoneOptions } from "react-dropzone";
|
|
4
|
-
import { Pill, FieldLabel } from "..";
|
|
5
|
-
import { Size, Variant } from "../core";
|
|
6
|
-
|
|
7
|
-
interface FileInputFieldProps {
|
|
8
|
-
className?: string;
|
|
9
|
-
children?: ReactNode;
|
|
10
|
-
variant?: Variant;
|
|
11
|
-
label?: string;
|
|
12
|
-
error?: string;
|
|
13
|
-
required?: boolean;
|
|
14
|
-
size?: Size;
|
|
15
|
-
onChange?: (files: File[]) => void;
|
|
16
|
-
onFocus?: () => void;
|
|
17
|
-
dropZoneOptions?: DropzoneOptions;
|
|
18
|
-
style?: HTMLAttributes<HTMLDivElement>;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const FileInputField = styled(
|
|
22
|
-
({
|
|
23
|
-
className,
|
|
24
|
-
children,
|
|
25
|
-
label,
|
|
26
|
-
error,
|
|
27
|
-
required,
|
|
28
|
-
size,
|
|
29
|
-
onChange,
|
|
30
|
-
onFocus,
|
|
31
|
-
dropZoneOptions = {},
|
|
32
|
-
style = {},
|
|
33
|
-
}: FileInputFieldProps) => {
|
|
34
|
-
const [files, setFiles] = useState<File[]>([]);
|
|
35
|
-
|
|
36
|
-
const onDrop = useCallback((acceptedFiles: File[]) => {
|
|
37
|
-
setFiles(acceptedFiles);
|
|
38
|
-
// Do something with the files
|
|
39
|
-
onChange?.(acceptedFiles);
|
|
40
|
-
}, []);
|
|
41
|
-
|
|
42
|
-
const handleRemoveFile = (file: File) => {
|
|
43
|
-
setFiles((prev) => prev.filter((f) => f !== file));
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const { getRootProps, getInputProps } = useDropzone({
|
|
47
|
-
onDrop,
|
|
48
|
-
...dropZoneOptions,
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<div className={className}>
|
|
53
|
-
{label && (
|
|
54
|
-
<FieldLabel error={error} asterisk={required} size={size}>
|
|
55
|
-
{label}
|
|
56
|
-
</FieldLabel>
|
|
57
|
-
)}
|
|
58
|
-
<div
|
|
59
|
-
className={"file-input-container"}
|
|
60
|
-
{...getRootProps()}
|
|
61
|
-
onFocus={onFocus}
|
|
62
|
-
style={style}
|
|
63
|
-
>
|
|
64
|
-
<input {...getInputProps()} />
|
|
65
|
-
{children && children}
|
|
66
|
-
{!children && <div>Drop files here or click to select files ...</div>}
|
|
67
|
-
</div>
|
|
68
|
-
<div className="file-selections">
|
|
69
|
-
{files.map((file, index) => (
|
|
70
|
-
<Pill
|
|
71
|
-
size="sm"
|
|
72
|
-
key={index}
|
|
73
|
-
showRemoveIcon
|
|
74
|
-
onRemove={() => handleRemoveFile(file)}
|
|
75
|
-
>
|
|
76
|
-
{file.name}
|
|
77
|
-
</Pill>
|
|
78
|
-
))}
|
|
79
|
-
</div>
|
|
80
|
-
</div>
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
)`
|
|
84
|
-
display: flex;
|
|
85
|
-
flex-direction: column;
|
|
86
|
-
|
|
87
|
-
.file-input-container {
|
|
88
|
-
user-select: none;
|
|
89
|
-
cursor: pointer;
|
|
90
|
-
outline: none;
|
|
91
|
-
|
|
92
|
-
display: flex;
|
|
93
|
-
flex-direction: column;
|
|
94
|
-
align-items: center;
|
|
95
|
-
justify-content: center;
|
|
96
|
-
height: 75px;
|
|
97
|
-
|
|
98
|
-
color: ${({ theme }) => theme.palette.text.secondary};
|
|
99
|
-
|
|
100
|
-
font-size: ${({ size }) =>
|
|
101
|
-
size === "xs"
|
|
102
|
-
? "12px"
|
|
103
|
-
: size === "sm"
|
|
104
|
-
? "14px"
|
|
105
|
-
: size === "md"
|
|
106
|
-
? "16px"
|
|
107
|
-
: size === "lg"
|
|
108
|
-
? "18px"
|
|
109
|
-
: size === "xl"
|
|
110
|
-
? "20px"
|
|
111
|
-
: "12px"};
|
|
112
|
-
|
|
113
|
-
background-color: ${({ theme, variant }) => {
|
|
114
|
-
switch (variant) {
|
|
115
|
-
case "contained":
|
|
116
|
-
return theme.palette.input.background;
|
|
117
|
-
case "filled":
|
|
118
|
-
return theme.palette.input.background;
|
|
119
|
-
case "outlined":
|
|
120
|
-
return theme.palette.input.background;
|
|
121
|
-
case "text":
|
|
122
|
-
return "transparent";
|
|
123
|
-
default:
|
|
124
|
-
return theme.palette.input.background;
|
|
125
|
-
}
|
|
126
|
-
}};
|
|
127
|
-
|
|
128
|
-
border-radius: 4px;
|
|
129
|
-
border: 1px solid
|
|
130
|
-
${({ theme, variant }) => {
|
|
131
|
-
switch (variant) {
|
|
132
|
-
case "contained":
|
|
133
|
-
return "transparent";
|
|
134
|
-
case "filled":
|
|
135
|
-
return "transparent";
|
|
136
|
-
case "outlined":
|
|
137
|
-
return theme.palette.input.border;
|
|
138
|
-
case "text":
|
|
139
|
-
return "transparent";
|
|
140
|
-
default:
|
|
141
|
-
return theme.palette.input.border;
|
|
142
|
-
}
|
|
143
|
-
}};
|
|
144
|
-
|
|
145
|
-
padding: ${({ size }) =>
|
|
146
|
-
size === "xs"
|
|
147
|
-
? "0px 8px"
|
|
148
|
-
: size === "sm"
|
|
149
|
-
? "0px 10px"
|
|
150
|
-
: size === "md"
|
|
151
|
-
? "0px 12px"
|
|
152
|
-
: size === "lg"
|
|
153
|
-
? "0px 14px"
|
|
154
|
-
: size === "xl"
|
|
155
|
-
? "0px 16px"
|
|
156
|
-
: "0px 8px"};
|
|
157
|
-
|
|
158
|
-
max-width: 100%;
|
|
159
|
-
|
|
160
|
-
transition: border 0.2s;
|
|
161
|
-
|
|
162
|
-
&:hover {
|
|
163
|
-
border: 1px solid ${({ theme }) => theme.palette.primary.main};
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
&:focus {
|
|
167
|
-
border: 1px solid ${({ theme }) => theme.palette.primary.main};
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
.file-selections {
|
|
172
|
-
display: flex;
|
|
173
|
-
flex-wrap: wrap;
|
|
174
|
-
gap: 10px;
|
|
175
|
-
margin-top: 10px;
|
|
176
|
-
}
|
|
177
|
-
`;
|
|
178
|
-
|
|
179
|
-
export default FileInputField;
|
package/FileInputField/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./FileInputField";
|
package/Flyout/Flyout.tsx
DELETED
|
@@ -1,172 +0,0 @@
|
|
|
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;
|
package/Flyout/FlyoutHeader.tsx
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
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;
|
package/Flyout/FlyoutTitle.tsx
DELETED
package/Flyout/index.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
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;
|
package/FormSection/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./FormSection";
|
package/Grid/Grid.tsx
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
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
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./Grid";
|
|
@@ -1,27 +0,0 @@
|
|
|
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;
|
package/IconButton/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./IconButton";
|
package/Input/Input.tsx
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
import { Size, Variant } from "../core";
|
|
3
|
-
import { forwardRef } from "react";
|
|
4
|
-
|
|
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;
|
|
20
|
-
}
|
|
21
|
-
|
|
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
|
-
)`
|
|
38
|
-
font-family: ${({ theme }) => theme.typography.fontFamily};
|
|
39
|
-
pointer-events: "all";
|
|
40
|
-
user-select: "all";
|
|
41
|
-
outline: none;
|
|
42
|
-
|
|
43
|
-
color: ${({ theme }) => theme.palette.text.primary};
|
|
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"};
|
|
56
|
-
|
|
57
|
-
height: ${({ size }) =>
|
|
58
|
-
size === "xs"
|
|
59
|
-
? "26px"
|
|
60
|
-
: size === "sm"
|
|
61
|
-
? "30px"
|
|
62
|
-
: size === "md"
|
|
63
|
-
? "36px"
|
|
64
|
-
: size === "lg"
|
|
65
|
-
? "42px"
|
|
66
|
-
: size === "xl"
|
|
67
|
-
? "50px"
|
|
68
|
-
: "26px"};
|
|
69
|
-
|
|
70
|
-
min-height: ${({ size }) =>
|
|
71
|
-
size === "xs"
|
|
72
|
-
? "26px"
|
|
73
|
-
: size === "sm"
|
|
74
|
-
? "30px"
|
|
75
|
-
: size === "md"
|
|
76
|
-
? "36px"
|
|
77
|
-
: size === "lg"
|
|
78
|
-
? "42px"
|
|
79
|
-
: size === "xl"
|
|
80
|
-
? "50px"
|
|
81
|
-
: "26px"};
|
|
82
|
-
|
|
83
|
-
transition: border 0.1s ease-in-out;
|
|
84
|
-
border-radius: 4px;
|
|
85
|
-
border: 1px solid
|
|
86
|
-
${({ theme, variant }) => {
|
|
87
|
-
switch (variant) {
|
|
88
|
-
case "contained":
|
|
89
|
-
return "transparent";
|
|
90
|
-
case "filled":
|
|
91
|
-
return "transparent";
|
|
92
|
-
case "outlined":
|
|
93
|
-
return theme.palette.input.border;
|
|
94
|
-
case "text":
|
|
95
|
-
return "transparent";
|
|
96
|
-
default:
|
|
97
|
-
return theme.palette.input.border;
|
|
98
|
-
}
|
|
99
|
-
}};
|
|
100
|
-
|
|
101
|
-
padding: ${({ size }) =>
|
|
102
|
-
size === "xs"
|
|
103
|
-
? "0px 8px"
|
|
104
|
-
: size === "sm"
|
|
105
|
-
? "0px 10px"
|
|
106
|
-
: size === "md"
|
|
107
|
-
? "0px 12px"
|
|
108
|
-
: size === "lg"
|
|
109
|
-
? "0px 14px"
|
|
110
|
-
: size === "xl"
|
|
111
|
-
? "0px 16px"
|
|
112
|
-
: "0px 8px"};
|
|
113
|
-
|
|
114
|
-
width: ${({ width }) => {
|
|
115
|
-
if (typeof width === "undefined") return "100%";
|
|
116
|
-
if (width === null) return "100%";
|
|
117
|
-
if (typeof width === "string") return width;
|
|
118
|
-
if (typeof width === "number") return `${width}px`;
|
|
119
|
-
}};
|
|
120
|
-
|
|
121
|
-
background-color: ${({ theme, variant }) => {
|
|
122
|
-
switch (variant) {
|
|
123
|
-
case "contained":
|
|
124
|
-
return theme.palette.input.background;
|
|
125
|
-
case "filled":
|
|
126
|
-
return theme.palette.input.background;
|
|
127
|
-
case "outlined":
|
|
128
|
-
return theme.palette.input.background;
|
|
129
|
-
case "text":
|
|
130
|
-
return "transparent";
|
|
131
|
-
default:
|
|
132
|
-
return theme.palette.input.background;
|
|
133
|
-
}
|
|
134
|
-
}};
|
|
135
|
-
|
|
136
|
-
::placeholder {
|
|
137
|
-
font-size: ${({ size }) =>
|
|
138
|
-
size === "xs"
|
|
139
|
-
? "10px"
|
|
140
|
-
: size === "sm"
|
|
141
|
-
? "12px"
|
|
142
|
-
: size === "md"
|
|
143
|
-
? "14px"
|
|
144
|
-
: size === "lg"
|
|
145
|
-
? "16px"
|
|
146
|
-
: size === "xl"
|
|
147
|
-
? "18px"
|
|
148
|
-
: "10px"};
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
&:focus {
|
|
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;
|
|
161
|
-
}
|
|
162
|
-
`;
|
|
163
|
-
|
|
164
|
-
export default Input;
|
package/Input/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./Input";
|