@monolith-forensics/monolith-ui 1.0.12 → 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/dist/Button/Button.d.ts +19 -0
- package/dist/Button/Button.js +332 -0
- package/dist/Button/index.d.ts +2 -0
- package/dist/Button/index.js +8 -0
- package/dist/Calendar/Calendar.d.ts +15 -0
- package/dist/Calendar/Calendar.js +232 -0
- package/dist/Calendar/CalendarStyles.d.ts +36 -0
- package/{src/components → dist}/Calendar/CalendarStyles.js +32 -52
- package/dist/Calendar/calendarHelpers.d.ts +53 -0
- package/dist/Calendar/calendarHelpers.js +181 -0
- package/dist/Calendar/index.d.ts +1 -0
- package/dist/Calendar/index.js +8 -0
- package/dist/CheckBox/CheckBox.d.ts +11 -0
- package/dist/CheckBox/CheckBox.js +34 -0
- package/dist/CheckBox/index.d.ts +1 -0
- package/dist/CheckBox/index.js +8 -0
- package/dist/DateInput/DateInput.d.ts +24 -0
- package/dist/DateInput/DateInput.js +511 -0
- package/dist/DateInput/index.d.ts +1 -0
- package/dist/DateInput/index.js +8 -0
- package/dist/DropDownMenu/DropDownMenu.d.ts +36 -0
- package/dist/DropDownMenu/DropDownMenu.js +212 -0
- package/dist/DropDownMenu/index.d.ts +1 -0
- package/dist/DropDownMenu/index.js +8 -0
- package/dist/Error/Error.d.ts +4 -0
- package/dist/Error/Error.js +38 -0
- package/dist/Error/index.d.ts +1 -0
- package/dist/Error/index.js +8 -0
- package/dist/FieldLabel/FieldLabel.d.ts +19 -0
- package/dist/FieldLabel/FieldLabel.js +119 -0
- package/dist/FieldLabel/index.js +8 -0
- package/dist/FileInputField/FileInputField.d.ts +18 -0
- package/dist/FileInputField/FileInputField.js +116 -0
- package/dist/FileInputField/index.d.ts +1 -0
- package/dist/FileInputField/index.js +8 -0
- package/dist/Flyout/Flyout.d.ts +10 -0
- package/dist/Flyout/Flyout.js +111 -0
- package/dist/Flyout/FlyoutHeader.d.ts +5 -0
- package/dist/Flyout/FlyoutHeader.js +12 -0
- package/dist/Flyout/FlyoutTitle.d.ts +2 -0
- package/dist/Flyout/FlyoutTitle.js +13 -0
- package/dist/Flyout/index.d.ts +3 -0
- package/dist/Flyout/index.js +12 -0
- package/dist/FormSection/FormSection.d.ts +9 -0
- package/dist/FormSection/FormSection.js +51 -0
- package/dist/FormSection/index.d.ts +1 -0
- package/dist/FormSection/index.js +8 -0
- package/dist/Grid/Grid.d.ts +6 -0
- package/dist/Grid/Grid.js +15 -0
- package/dist/Grid/index.d.ts +1 -0
- package/dist/Grid/index.js +8 -0
- package/dist/IconButton/IconButton.d.ts +5 -0
- package/dist/IconButton/IconButton.js +30 -0
- package/dist/IconButton/index.d.ts +1 -0
- package/dist/IconButton/index.js +8 -0
- package/dist/Input/Input.d.ts +21 -0
- package/dist/Input/Input.js +148 -0
- package/dist/Input/index.js +8 -0
- package/dist/Modal/Modal.d.ts +14 -0
- package/dist/Modal/Modal.js +134 -0
- package/dist/Modal/index.d.ts +1 -0
- package/dist/Modal/index.js +8 -0
- package/dist/Pill/Pill.d.ts +11 -0
- package/dist/Pill/Pill.js +146 -0
- package/dist/Pill/index.js +8 -0
- package/dist/SelectBox/SelectBox.d.ts +45 -0
- package/dist/SelectBox/SelectBox.js +469 -0
- package/dist/SelectBox/index.d.ts +1 -0
- package/dist/SelectBox/index.js +8 -0
- package/dist/Switch/Switch.d.ts +18 -0
- package/dist/Switch/Switch.js +157 -0
- package/dist/Switch/index.d.ts +1 -0
- package/dist/Switch/index.js +8 -0
- package/dist/TagBox/TagBox.d.ts +38 -0
- package/dist/TagBox/TagBox.js +440 -0
- package/dist/TagBox/TagBoxStyles.d.ts +11 -0
- package/dist/TagBox/TagBoxStyles.js +113 -0
- package/dist/TagBox/index.d.ts +1 -0
- package/dist/TagBox/index.js +8 -0
- package/dist/TextArea/TextArea.d.ts +16 -0
- package/dist/TextArea/TextArea.js +80 -0
- package/dist/TextArea/index.js +8 -0
- package/dist/TextAreaInput/TextAreaInput.d.ts +12 -0
- package/dist/TextAreaInput/TextAreaInput.js +23 -0
- package/dist/TextAreaInput/index.js +8 -0
- package/dist/TextInput/TextInput.d.ts +12 -0
- package/dist/TextInput/TextInput.js +30 -0
- package/dist/TextInput/index.js +8 -0
- package/dist/Tooltip/Tooltip.d.ts +12 -0
- package/dist/Tooltip/Tooltip.js +53 -0
- package/dist/Tooltip/index.d.ts +1 -0
- package/dist/Tooltip/index.js +8 -0
- package/dist/core/ArrowButton.d.ts +6 -0
- package/dist/core/ArrowButton.js +48 -0
- package/dist/core/ClearButton.d.ts +6 -0
- package/dist/core/ClearButton.js +48 -0
- package/dist/core/StyledContent.d.ts +7 -0
- package/dist/core/StyledContent.js +46 -0
- package/dist/core/StyledFloatContainer.d.ts +2 -0
- package/dist/core/StyledFloatContainer.js +10 -0
- package/dist/core/Types/Size.d.ts +2 -0
- package/dist/core/Types/Size.js +2 -0
- package/dist/core/Types/Variant.d.ts +2 -0
- package/dist/core/Types/Variant.js +2 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.js +14 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +51 -0
- package/package.json +15 -20
- package/.gitattributes +0 -2
- package/rollup.config.js +0 -10
- package/src/components/ArrowButton/ArrowButton.tsx +0 -54
- package/src/components/ArrowButton/index.tsx +0 -1
- package/src/components/Button/Button.tsx +0 -278
- package/src/components/Button/index.ts +0 -1
- package/src/components/Calendar/Calendar.js +0 -365
- package/src/components/Calendar/calendarHelpers.js +0 -194
- package/src/components/DateInput/DateInput.js +0 -583
- package/src/components/FieldLabel/FieldLabel.tsx +0 -152
- package/src/components/FileInputField/FileInputField.js +0 -171
- package/src/components/Input/Input.tsx +0 -141
- package/src/components/Pill/Pill.tsx +0 -144
- package/src/components/SelectBox/SelectBox.js +0 -543
- package/src/components/TagBox/TagBox.js +0 -563
- package/src/components/TextArea/TextArea.tsx +0 -70
- package/src/components/TextAreaInput/TextAreaInput.tsx +0 -48
- package/src/components/TextInput/TextInput.tsx +0 -50
- package/src/components/core/index.js +0 -16
- package/src/components/index.ts +0 -7
- package/src/components/theme/breakpoints.js +0 -11
- package/src/components/theme/components.js +0 -140
- package/src/components/theme/index.js +0 -77
- package/src/components/theme/shadows.js +0 -33
- package/src/components/theme/typography.js +0 -58
- package/src/components/theme/variants.js +0 -235
- package/src/index.ts +0 -1
- package/tsconfig.json +0 -109
- /package/{src/components/FieldLabel/index.ts → dist/FieldLabel/index.d.ts} +0 -0
- /package/{src/components/Input/index.tsx → dist/Input/index.d.ts} +0 -0
- /package/{src/components/Pill/index.ts → dist/Pill/index.d.ts} +0 -0
- /package/{src/components/TextArea/index.ts → dist/TextArea/index.d.ts} +0 -0
- /package/{src/components/TextAreaInput/index.ts → dist/TextAreaInput/index.d.ts} +0 -0
- /package/{src/components/TextInput/index.tsx → dist/TextInput/index.d.ts} +0 -0
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import styled from "styled-components";
|
|
3
|
-
import * as Tooltip from "@radix-ui/react-tooltip";
|
|
4
|
-
|
|
5
|
-
interface InfoComponentProps {
|
|
6
|
-
description?: string | null;
|
|
7
|
-
label?: string | Element;
|
|
8
|
-
children: React.ReactNode;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const InfoComponent: React.FC<InfoComponentProps> = styled(
|
|
12
|
-
({ className, children, description, label }) => {
|
|
13
|
-
if (!description) return children;
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<Tooltip.Provider
|
|
17
|
-
delayDuration={800}
|
|
18
|
-
skipDelayDuration={0}
|
|
19
|
-
disableHoverableContent
|
|
20
|
-
>
|
|
21
|
-
<Tooltip.Root>
|
|
22
|
-
<Tooltip.Trigger asChild>{children}</Tooltip.Trigger>
|
|
23
|
-
<Tooltip.Portal>
|
|
24
|
-
<Tooltip.Content
|
|
25
|
-
className={className}
|
|
26
|
-
side="right"
|
|
27
|
-
sideOffset={15}
|
|
28
|
-
align="start"
|
|
29
|
-
onClick={(e) => e.stopPropagation()}
|
|
30
|
-
>
|
|
31
|
-
<div className="title">{label || "Info"}</div>
|
|
32
|
-
<div>{description || "N/A"}</div>
|
|
33
|
-
</Tooltip.Content>
|
|
34
|
-
</Tooltip.Portal>
|
|
35
|
-
</Tooltip.Root>
|
|
36
|
-
</Tooltip.Provider>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
)`
|
|
40
|
-
pointer-events: none;
|
|
41
|
-
z-index: 99999;
|
|
42
|
-
background-color: ${({ theme }) => theme.palette.background.default};
|
|
43
|
-
padding: 15px;
|
|
44
|
-
border-radius: 5px;
|
|
45
|
-
border: 1px solid ${({ theme }) => theme.palette.divider};
|
|
46
|
-
font-size: 0.75rem;
|
|
47
|
-
max-width: 350px;
|
|
48
|
-
width: 250px;
|
|
49
|
-
|
|
50
|
-
white-space: pre-wrap;
|
|
51
|
-
|
|
52
|
-
.title {
|
|
53
|
-
font-size: 0.85rem;
|
|
54
|
-
font-weight: 600;
|
|
55
|
-
margin-bottom: 5px;
|
|
56
|
-
}
|
|
57
|
-
`;
|
|
58
|
-
|
|
59
|
-
interface FieldLabelProps {
|
|
60
|
-
errorMessage?: string;
|
|
61
|
-
error?: boolean;
|
|
62
|
-
description?: string | null;
|
|
63
|
-
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
64
|
-
asterisk?: boolean;
|
|
65
|
-
children: string | Element;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const FieldLabel: React.FC<FieldLabelProps> = styled(
|
|
69
|
-
({
|
|
70
|
-
className,
|
|
71
|
-
children,
|
|
72
|
-
errorMessage,
|
|
73
|
-
error = false,
|
|
74
|
-
description = null,
|
|
75
|
-
}) => {
|
|
76
|
-
return (
|
|
77
|
-
<div className={className}>
|
|
78
|
-
<InfoComponent description={description} label={children}>
|
|
79
|
-
<div className="label">{children}</div>
|
|
80
|
-
</InfoComponent>
|
|
81
|
-
{error && (
|
|
82
|
-
<div className="error" title={errorMessage || error}>
|
|
83
|
-
{errorMessage || error || "Invalid Value"}
|
|
84
|
-
</div>
|
|
85
|
-
)}
|
|
86
|
-
</div>
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
)`
|
|
90
|
-
font-family: apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
|
|
91
|
-
"Helvetica Neue", Arial, sans-serif;
|
|
92
|
-
user-select: none;
|
|
93
|
-
display: flex;
|
|
94
|
-
flex-direction: row;
|
|
95
|
-
align-items: center;
|
|
96
|
-
gap: 5px;
|
|
97
|
-
|
|
98
|
-
min-height: 15px;
|
|
99
|
-
// font-size: 12px;
|
|
100
|
-
font-weight: 400;
|
|
101
|
-
margin-bottom: 2.5px;
|
|
102
|
-
|
|
103
|
-
font-size: ${({ size }) =>
|
|
104
|
-
size === "xs"
|
|
105
|
-
? "10px"
|
|
106
|
-
: size === "sm"
|
|
107
|
-
? "12px"
|
|
108
|
-
: size === "md"
|
|
109
|
-
? "14px"
|
|
110
|
-
: size === "lg"
|
|
111
|
-
? "16px"
|
|
112
|
-
: size === "xl"
|
|
113
|
-
? "18px"
|
|
114
|
-
: "10px"};
|
|
115
|
-
|
|
116
|
-
transition: all 0.2s ease;
|
|
117
|
-
color: ${({ theme, error }) => theme.palette.text.secondary};
|
|
118
|
-
|
|
119
|
-
.label {
|
|
120
|
-
width: fit-content;
|
|
121
|
-
min-width: fit-content;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.label::after {
|
|
125
|
-
content: ${(props) => (props.asterisk ? "'*'" : "")};
|
|
126
|
-
color: ${({ theme }) => theme.palette.error.main};
|
|
127
|
-
margin-left: 2px;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.label:hover {
|
|
131
|
-
cursor: ${({ description }) => (description ? "pointer" : "default")};
|
|
132
|
-
color: ${({ description, theme }) =>
|
|
133
|
-
description ? theme.palette.text.primary : theme.palette.text.secondary};
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
.error {
|
|
137
|
-
transition: all 0.2s ease;
|
|
138
|
-
cursor: pointer;
|
|
139
|
-
color: ${({ theme }) => theme.palette.error.main};
|
|
140
|
-
font-size: 10px;
|
|
141
|
-
max-width: 85%;
|
|
142
|
-
white-space: nowrap;
|
|
143
|
-
overflow: hidden;
|
|
144
|
-
text-overflow: ellipsis;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.error:hover {
|
|
148
|
-
color: ${({ theme }) => theme.palette.error.light};
|
|
149
|
-
}
|
|
150
|
-
`;
|
|
151
|
-
|
|
152
|
-
export default FieldLabel;
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import { useCallback, useState } from "react";
|
|
2
|
-
import { useDropzone } from "react-dropzone";
|
|
3
|
-
import styled from "styled-components";
|
|
4
|
-
import FieldLabel from "../FieldLabel/FieldLabel.js";
|
|
5
|
-
import Pill from "../Pill/Pill.js";
|
|
6
|
-
|
|
7
|
-
const FileInputField = styled(
|
|
8
|
-
({
|
|
9
|
-
className,
|
|
10
|
-
children,
|
|
11
|
-
label,
|
|
12
|
-
error,
|
|
13
|
-
errorMessage,
|
|
14
|
-
required,
|
|
15
|
-
size,
|
|
16
|
-
onChange,
|
|
17
|
-
onFocus,
|
|
18
|
-
dropZoneOptions = {},
|
|
19
|
-
style = {},
|
|
20
|
-
}) => {
|
|
21
|
-
const [files, setFiles] = useState([]);
|
|
22
|
-
|
|
23
|
-
const onDrop = useCallback((acceptedFiles) => {
|
|
24
|
-
setFiles(acceptedFiles);
|
|
25
|
-
// Do something with the files
|
|
26
|
-
onChange?.(acceptedFiles);
|
|
27
|
-
}, []);
|
|
28
|
-
|
|
29
|
-
const handleRemoveFile = (file) => {
|
|
30
|
-
setFiles((prev) => prev.filter((f) => f !== file));
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const { getRootProps, getInputProps } = useDropzone({
|
|
34
|
-
onDrop,
|
|
35
|
-
...dropZoneOptions,
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<div className={className}>
|
|
40
|
-
{label && (
|
|
41
|
-
<FieldLabel
|
|
42
|
-
error={error}
|
|
43
|
-
errorMessage={errorMessage}
|
|
44
|
-
asterisk={required}
|
|
45
|
-
size={size}
|
|
46
|
-
>
|
|
47
|
-
{label}
|
|
48
|
-
</FieldLabel>
|
|
49
|
-
)}
|
|
50
|
-
<div
|
|
51
|
-
className={"file-input-container"}
|
|
52
|
-
{...getRootProps()}
|
|
53
|
-
onFocus={onFocus}
|
|
54
|
-
style={style}
|
|
55
|
-
>
|
|
56
|
-
<input {...getInputProps()} />
|
|
57
|
-
{children && children}
|
|
58
|
-
{!children && <div>Drop files here or click to select files ...</div>}
|
|
59
|
-
</div>
|
|
60
|
-
<div className="file-selections">
|
|
61
|
-
{files.map((file, index) => (
|
|
62
|
-
<Pill
|
|
63
|
-
size="sm"
|
|
64
|
-
key={index}
|
|
65
|
-
showRemoveIcon
|
|
66
|
-
onRemove={() => handleRemoveFile(file)}
|
|
67
|
-
>
|
|
68
|
-
{file.name}
|
|
69
|
-
</Pill>
|
|
70
|
-
))}
|
|
71
|
-
</div>
|
|
72
|
-
</div>
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
)`
|
|
76
|
-
display: flex;
|
|
77
|
-
flex-direction: column;
|
|
78
|
-
|
|
79
|
-
.file-input-container {
|
|
80
|
-
user-select: none;
|
|
81
|
-
cursor: pointer;
|
|
82
|
-
outline: none;
|
|
83
|
-
|
|
84
|
-
display: flex;
|
|
85
|
-
flex-direction: column;
|
|
86
|
-
align-items: center;
|
|
87
|
-
justify-content: center;
|
|
88
|
-
height: 75px;
|
|
89
|
-
|
|
90
|
-
color: ${({ theme }) => theme.palette.text.secondary};
|
|
91
|
-
|
|
92
|
-
font-size: ${({ size }) =>
|
|
93
|
-
size === "xs"
|
|
94
|
-
? "12px"
|
|
95
|
-
: size === "sm"
|
|
96
|
-
? "14px"
|
|
97
|
-
: size === "md"
|
|
98
|
-
? "16px"
|
|
99
|
-
: size === "lg"
|
|
100
|
-
? "18px"
|
|
101
|
-
: size === "xl"
|
|
102
|
-
? "20px"
|
|
103
|
-
: "12px"};
|
|
104
|
-
|
|
105
|
-
background-color: ${({ theme, variant }) => {
|
|
106
|
-
switch (variant) {
|
|
107
|
-
case "contained":
|
|
108
|
-
return theme.palette.input.background;
|
|
109
|
-
case "filled":
|
|
110
|
-
return theme.palette.input.background;
|
|
111
|
-
case "outlined":
|
|
112
|
-
return theme.palette.input.background;
|
|
113
|
-
case "text":
|
|
114
|
-
return "transparent";
|
|
115
|
-
default:
|
|
116
|
-
return theme.palette.input.background;
|
|
117
|
-
}
|
|
118
|
-
}};
|
|
119
|
-
|
|
120
|
-
border-radius: 4px;
|
|
121
|
-
border: 1px solid
|
|
122
|
-
${({ theme, variant }) => {
|
|
123
|
-
switch (variant) {
|
|
124
|
-
case "contained":
|
|
125
|
-
return "transparent";
|
|
126
|
-
case "filled":
|
|
127
|
-
return "transparent";
|
|
128
|
-
case "outlined":
|
|
129
|
-
return theme.palette.input.border;
|
|
130
|
-
case "text":
|
|
131
|
-
return "transparent";
|
|
132
|
-
default:
|
|
133
|
-
return theme.palette.input.border;
|
|
134
|
-
}
|
|
135
|
-
}};
|
|
136
|
-
|
|
137
|
-
padding: ${({ size }) =>
|
|
138
|
-
size === "xs"
|
|
139
|
-
? "0px 8px"
|
|
140
|
-
: size === "sm"
|
|
141
|
-
? "0px 10px"
|
|
142
|
-
: size === "md"
|
|
143
|
-
? "0px 12px"
|
|
144
|
-
: size === "lg"
|
|
145
|
-
? "0px 14px"
|
|
146
|
-
: size === "xl"
|
|
147
|
-
? "0px 16px"
|
|
148
|
-
: "0px 8px"};
|
|
149
|
-
|
|
150
|
-
max-width: 100%;
|
|
151
|
-
|
|
152
|
-
transition: border 0.2s;
|
|
153
|
-
|
|
154
|
-
&:hover {
|
|
155
|
-
border: 1px solid ${({ theme }) => theme.palette.primary.main};
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
&:focus {
|
|
159
|
-
border: 1px solid ${({ theme }) => theme.palette.primary.main};
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
.file-selections {
|
|
164
|
-
display: flex;
|
|
165
|
-
flex-wrap: wrap;
|
|
166
|
-
gap: 10px;
|
|
167
|
-
margin-top: 10px;
|
|
168
|
-
}
|
|
169
|
-
`;
|
|
170
|
-
|
|
171
|
-
export default FileInputField;
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import styled from "styled-components";
|
|
3
|
-
|
|
4
|
-
interface StyledInputProps {
|
|
5
|
-
variant?: "contained" | "filled" | "outlined" | "text";
|
|
6
|
-
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
7
|
-
width?: string | number | null;
|
|
8
|
-
error?: boolean;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const StyledInput = styled.input<StyledInputProps>`
|
|
12
|
-
font-family: ${({ theme }) => theme.typography.fontFamily};
|
|
13
|
-
pointer-events: "all";
|
|
14
|
-
user-select: "all";
|
|
15
|
-
outline: none;
|
|
16
|
-
|
|
17
|
-
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
|
-
}};
|
|
34
|
-
|
|
35
|
-
height: ${({ size }) =>
|
|
36
|
-
size === "xs"
|
|
37
|
-
? "26px"
|
|
38
|
-
: size === "sm"
|
|
39
|
-
? "30px"
|
|
40
|
-
: size === "md"
|
|
41
|
-
? "36px"
|
|
42
|
-
: size === "lg"
|
|
43
|
-
? "42px"
|
|
44
|
-
: size === "xl"
|
|
45
|
-
? "50px"
|
|
46
|
-
: "26px"};
|
|
47
|
-
|
|
48
|
-
min-height: ${({ size }) =>
|
|
49
|
-
size === "xs"
|
|
50
|
-
? "26px"
|
|
51
|
-
: size === "sm"
|
|
52
|
-
? "30px"
|
|
53
|
-
: size === "md"
|
|
54
|
-
? "36px"
|
|
55
|
-
: size === "lg"
|
|
56
|
-
? "42px"
|
|
57
|
-
: size === "xl"
|
|
58
|
-
? "50px"
|
|
59
|
-
: "26px"};
|
|
60
|
-
|
|
61
|
-
border-radius: 4px;
|
|
62
|
-
border: 1px solid
|
|
63
|
-
${({ theme, variant, error }) => {
|
|
64
|
-
// if (!!error) return theme.palette.error.main;
|
|
65
|
-
|
|
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 }) =>
|
|
81
|
-
size === "xs"
|
|
82
|
-
? "0px 8px"
|
|
83
|
-
: size === "sm"
|
|
84
|
-
? "0px 10px"
|
|
85
|
-
: size === "md"
|
|
86
|
-
? "0px 12px"
|
|
87
|
-
: size === "lg"
|
|
88
|
-
? "0px 14px"
|
|
89
|
-
: size === "xl"
|
|
90
|
-
? "0px 16px"
|
|
91
|
-
: "0px 8px"};
|
|
92
|
-
|
|
93
|
-
width: ${({ width }) => {
|
|
94
|
-
if (typeof width === "undefined") return "100%";
|
|
95
|
-
if (width === null) return "100%";
|
|
96
|
-
if (typeof width === "string") return width;
|
|
97
|
-
if (typeof width === "number") return `${width}px`;
|
|
98
|
-
}};
|
|
99
|
-
|
|
100
|
-
background-color: ${({ theme, variant }) => {
|
|
101
|
-
switch (variant) {
|
|
102
|
-
case "contained":
|
|
103
|
-
return theme.palette.input.background;
|
|
104
|
-
case "filled":
|
|
105
|
-
return theme.palette.input.background;
|
|
106
|
-
case "outlined":
|
|
107
|
-
return theme.palette.input.background;
|
|
108
|
-
case "text":
|
|
109
|
-
return "transparent";
|
|
110
|
-
default:
|
|
111
|
-
return theme.palette.input.background;
|
|
112
|
-
}
|
|
113
|
-
}};
|
|
114
|
-
|
|
115
|
-
transition: border 0.1s ease-in-out;
|
|
116
|
-
|
|
117
|
-
::placeholder {
|
|
118
|
-
font-size: ${({ size }) =>
|
|
119
|
-
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
|
-
: "10px"};
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// &:hover {
|
|
133
|
-
// border: 1px solid ${(props) => props.theme.palette.input.border};
|
|
134
|
-
// }
|
|
135
|
-
|
|
136
|
-
&:focus {
|
|
137
|
-
border: 1px solid ${({ theme, error }) => theme.palette.primary.main};
|
|
138
|
-
}
|
|
139
|
-
`;
|
|
140
|
-
|
|
141
|
-
export default StyledInput;
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import styled from "styled-components";
|
|
3
|
-
import { X } from "lucide-react";
|
|
4
|
-
|
|
5
|
-
interface PillProps {
|
|
6
|
-
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
7
|
-
showRemoveIcon?: boolean;
|
|
8
|
-
onRemove?: () => void;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const StyledButton = styled.button`
|
|
12
|
-
background-color: transparent;
|
|
13
|
-
border: none;
|
|
14
|
-
cursor: pointer;
|
|
15
|
-
display: flex;
|
|
16
|
-
align-items: center;
|
|
17
|
-
justify-content: center;
|
|
18
|
-
padding: 0;
|
|
19
|
-
margin: 0;
|
|
20
|
-
outline: none;
|
|
21
|
-
transition: color 0.2s;
|
|
22
|
-
padding-inline-end: 5px;
|
|
23
|
-
`;
|
|
24
|
-
|
|
25
|
-
const Pill: React.FC<PillProps> = styled(
|
|
26
|
-
({ className, children, size, showRemoveIcon = true, onRemove }) => {
|
|
27
|
-
const handleRemove = (e) => {
|
|
28
|
-
e.preventDefault();
|
|
29
|
-
e.stopPropagation();
|
|
30
|
-
onRemove?.();
|
|
31
|
-
};
|
|
32
|
-
return (
|
|
33
|
-
<div className={className}>
|
|
34
|
-
<span className="pill-content">{children}</span>
|
|
35
|
-
{showRemoveIcon && (
|
|
36
|
-
<StyledButton onClick={handleRemove}>
|
|
37
|
-
<X />
|
|
38
|
-
</StyledButton>
|
|
39
|
-
)}
|
|
40
|
-
</div>
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
)`
|
|
44
|
-
user-select: none;
|
|
45
|
-
display: flex;
|
|
46
|
-
align-items: center;
|
|
47
|
-
justify-content: space-between;
|
|
48
|
-
flex-direction: row;
|
|
49
|
-
width: fit-content;
|
|
50
|
-
max-width: 250px;
|
|
51
|
-
gap: 5px;
|
|
52
|
-
flex: 0;
|
|
53
|
-
|
|
54
|
-
font-weight: 500;
|
|
55
|
-
color: ${({ theme }) => theme.palette.text.primary};
|
|
56
|
-
|
|
57
|
-
padding-inline-end: 0px;
|
|
58
|
-
|
|
59
|
-
padding-inline-start: ${({ size }) => {
|
|
60
|
-
switch (size) {
|
|
61
|
-
case "xs":
|
|
62
|
-
return "8px";
|
|
63
|
-
case "sm":
|
|
64
|
-
return "10px";
|
|
65
|
-
case "md":
|
|
66
|
-
return "12px";
|
|
67
|
-
case "lg":
|
|
68
|
-
return "14px";
|
|
69
|
-
case "xl":
|
|
70
|
-
return "16px";
|
|
71
|
-
default:
|
|
72
|
-
return "10px";
|
|
73
|
-
}
|
|
74
|
-
}};
|
|
75
|
-
|
|
76
|
-
height: ${({ size }) => {
|
|
77
|
-
switch (size) {
|
|
78
|
-
case "xs":
|
|
79
|
-
return "20px";
|
|
80
|
-
case "sm":
|
|
81
|
-
return "22px";
|
|
82
|
-
case "md":
|
|
83
|
-
return "24px";
|
|
84
|
-
case "lg":
|
|
85
|
-
return "26px";
|
|
86
|
-
case "xl":
|
|
87
|
-
return "28px";
|
|
88
|
-
default:
|
|
89
|
-
return "22px";
|
|
90
|
-
}
|
|
91
|
-
}};
|
|
92
|
-
|
|
93
|
-
border: 1px solid ${({ theme }) => theme.palette.divider};
|
|
94
|
-
border-radius: 1000px;
|
|
95
|
-
|
|
96
|
-
background-color: ${({ theme }) => theme.palette.background.secondary};
|
|
97
|
-
|
|
98
|
-
.pill-content {
|
|
99
|
-
// max-width: 90%;
|
|
100
|
-
white-space: nowrap;
|
|
101
|
-
overflow: hidden;
|
|
102
|
-
text-overflow: ellipsis;
|
|
103
|
-
|
|
104
|
-
font-size: ${({ size }) => {
|
|
105
|
-
switch (size) {
|
|
106
|
-
case "xs":
|
|
107
|
-
return "10px";
|
|
108
|
-
case "sm":
|
|
109
|
-
return "12px";
|
|
110
|
-
case "md":
|
|
111
|
-
return "14px";
|
|
112
|
-
case "lg":
|
|
113
|
-
return "16px";
|
|
114
|
-
case "xl":
|
|
115
|
-
return "18px";
|
|
116
|
-
default:
|
|
117
|
-
return "12px";
|
|
118
|
-
}
|
|
119
|
-
}};
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
svg {
|
|
123
|
-
color: ${({ theme }) => theme.palette.text.primary};
|
|
124
|
-
|
|
125
|
-
width: ${({ size }) => {
|
|
126
|
-
switch (size) {
|
|
127
|
-
case "xs":
|
|
128
|
-
return "12px";
|
|
129
|
-
case "sm":
|
|
130
|
-
return "14px";
|
|
131
|
-
case "md":
|
|
132
|
-
return "16px";
|
|
133
|
-
case "lg":
|
|
134
|
-
return "18px";
|
|
135
|
-
case "xl":
|
|
136
|
-
return "20px";
|
|
137
|
-
default:
|
|
138
|
-
return "14px";
|
|
139
|
-
}
|
|
140
|
-
}};
|
|
141
|
-
}
|
|
142
|
-
`;
|
|
143
|
-
|
|
144
|
-
export default Pill;
|