@soul-refiner/design-system 0.2.69 → 0.2.71
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/components/input/filter/filter.js +5 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/input/index.js +1 -0
- package/dist/components/input/text_area/index.d.ts +2 -0
- package/dist/components/input/text_area/index.js +1 -0
- package/dist/components/input/text_area/text_area.d.ts +45 -0
- package/dist/components/input/text_area/text_area.js +109 -0
- package/package.json +1 -1
|
@@ -155,6 +155,7 @@ const Outlined = styled.button `
|
|
|
155
155
|
border: 1px solid var(--color-grey-8);
|
|
156
156
|
border-radius: 8px;
|
|
157
157
|
background-color: var(--color-white);
|
|
158
|
+
font-family: var(--font-inter);
|
|
158
159
|
|
|
159
160
|
&:hover {
|
|
160
161
|
background-color: var(--color-grey-9);
|
|
@@ -165,6 +166,7 @@ const Pill = styled.button `
|
|
|
165
166
|
${Styles.flex}
|
|
166
167
|
border-radius: 24px;
|
|
167
168
|
background-color: var(--color-primary-blue-4);
|
|
169
|
+
font-family: var(--font-inter);
|
|
168
170
|
|
|
169
171
|
& > * {
|
|
170
172
|
color: var(--color-primary-blue-2);
|
|
@@ -181,6 +183,7 @@ const Labeled = styled.button `
|
|
|
181
183
|
border-radius: 24px;
|
|
182
184
|
border: 1px solid var(--color-grey-8);
|
|
183
185
|
background-color: var(--color-white);
|
|
186
|
+
font-family: var(--font-inter);
|
|
184
187
|
|
|
185
188
|
&:hover {
|
|
186
189
|
background-color: var(--color-grey-9);
|
|
@@ -196,6 +199,7 @@ const Avatar = styled.button `
|
|
|
196
199
|
${Styles.flex}
|
|
197
200
|
padding: 4px 16px;
|
|
198
201
|
border-radius: 32px;
|
|
202
|
+
font-family: var(--font-inter);
|
|
199
203
|
|
|
200
204
|
&:hover {
|
|
201
205
|
background-color: var(--color-grey-10);
|
|
@@ -217,6 +221,7 @@ const Text = styled.button `
|
|
|
217
221
|
gap: 8px;
|
|
218
222
|
background-color: transparent;
|
|
219
223
|
border-radius: 32px;
|
|
224
|
+
font-family: var(--font-inter);
|
|
220
225
|
|
|
221
226
|
&:hover {
|
|
222
227
|
background-color: var(--color-grey-10);
|
|
@@ -10,5 +10,7 @@ export { Search } from './search';
|
|
|
10
10
|
export type { SearchProps } from './search';
|
|
11
11
|
export { Select } from './select';
|
|
12
12
|
export type { SelectProps } from './select';
|
|
13
|
+
export { TextArea } from './text_area';
|
|
14
|
+
export type { TextAreaProps } from './text_area';
|
|
13
15
|
export { TextInput } from './text_input';
|
|
14
16
|
export type { TextInputProps } from './text_input';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TextArea } from './text_area';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type Props = {
|
|
3
|
+
disabled?: boolean | never;
|
|
4
|
+
successful?: boolean | never;
|
|
5
|
+
warning?: boolean | never;
|
|
6
|
+
bg?: string;
|
|
7
|
+
icon?: React.ReactElement;
|
|
8
|
+
helperText?: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
maxCharacters?: number;
|
|
11
|
+
/**
|
|
12
|
+
* @param minHeight if set, this will make the textarea grow with the text inputted
|
|
13
|
+
* @see resize !! do not use with resize={true} !!
|
|
14
|
+
*/
|
|
15
|
+
minHeight?: number;
|
|
16
|
+
minWidth?: number;
|
|
17
|
+
name?: string;
|
|
18
|
+
onChange?: React.ChangeEventHandler<HTMLTextAreaElement>;
|
|
19
|
+
placeholder?: string;
|
|
20
|
+
/**
|
|
21
|
+
* @param resize the user can change the size of the textarea
|
|
22
|
+
* @see resize !! do not use with minHeight !!
|
|
23
|
+
*/
|
|
24
|
+
resize?: boolean;
|
|
25
|
+
sx?: string;
|
|
26
|
+
value: string | string[];
|
|
27
|
+
};
|
|
28
|
+
interface DisabledProps extends Props {
|
|
29
|
+
disabled?: true;
|
|
30
|
+
successful?: false | never;
|
|
31
|
+
warning?: false | never;
|
|
32
|
+
}
|
|
33
|
+
interface SuccessfulProps extends Props {
|
|
34
|
+
disabled?: false | never;
|
|
35
|
+
successful?: true;
|
|
36
|
+
warning?: false | never;
|
|
37
|
+
}
|
|
38
|
+
interface WarningProps extends Props {
|
|
39
|
+
disabled?: false | never;
|
|
40
|
+
successful?: false | never;
|
|
41
|
+
warning?: true;
|
|
42
|
+
}
|
|
43
|
+
export type TextAreaProps = DisabledProps | SuccessfulProps | WarningProps;
|
|
44
|
+
export declare const TextArea: ({ bg, disabled, helperText, icon, label, maxCharacters, minHeight, minWidth, name, onChange, placeholder, resize, successful, sx, value, warning, }: TextAreaProps) => React.JSX.Element;
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { Box } from '../../atoms/box/box';
|
|
5
|
+
import { CheckmarkCircle, AlertCircle } from '../../../icons';
|
|
6
|
+
export const TextArea = ({ bg = 'var(--color-blue-10)', disabled, helperText, icon, label, maxCharacters, minHeight, minWidth, name, onChange, placeholder, resize = false, successful, sx, value, warning, }) => {
|
|
7
|
+
const ref = React.useRef(null);
|
|
8
|
+
React.useEffect(() => {
|
|
9
|
+
if (ref.current) {
|
|
10
|
+
ref.current.style.height = `${minHeight}px`;
|
|
11
|
+
const scrollHeight = ref.current.scrollHeight;
|
|
12
|
+
ref.current.style.height = scrollHeight + 'px';
|
|
13
|
+
}
|
|
14
|
+
}, [ref.current, value]);
|
|
15
|
+
return (React.createElement(Label, { "$disabled": disabled, "$sx": sx },
|
|
16
|
+
label,
|
|
17
|
+
React.createElement(InputWrapper, { "$bg": bg, "$minWidth": minWidth, "$successful": successful, "$warning": warning },
|
|
18
|
+
icon,
|
|
19
|
+
React.createElement(TextAreaElement, { disabled: disabled, name: name, onChange: onChange, placeholder: placeholder, ref: ref, value: maxCharacters
|
|
20
|
+
? value.slice(0, maxCharacters - 1)
|
|
21
|
+
: value, "$resize": resize }),
|
|
22
|
+
successful && React.createElement(CheckmarkCircle, { color: "green-3" }),
|
|
23
|
+
warning && React.createElement(AlertCircle, { color: "red-4" })),
|
|
24
|
+
React.createElement(Box, { "$gap": 16, "$justify": "space-between" },
|
|
25
|
+
helperText && React.createElement(HelperText, null, helperText),
|
|
26
|
+
maxCharacters && (React.createElement(MaxCharactersText, null,
|
|
27
|
+
value.length,
|
|
28
|
+
" / ",
|
|
29
|
+
maxCharacters)))));
|
|
30
|
+
};
|
|
31
|
+
const Label = styled.label `
|
|
32
|
+
width: 100%;
|
|
33
|
+
display: flex;
|
|
34
|
+
gap: 4px;
|
|
35
|
+
flex-flow: column nowrap;
|
|
36
|
+
color: var(--color-grey-2);
|
|
37
|
+
font-family: var(--font-inter);
|
|
38
|
+
font-size: 18px;
|
|
39
|
+
font-weight: 500;
|
|
40
|
+
line-height: 26px;
|
|
41
|
+
|
|
42
|
+
${({ $disabled }) => $disabled
|
|
43
|
+
? `
|
|
44
|
+
color: var(--color-grey-7) !important;
|
|
45
|
+
& > * {
|
|
46
|
+
color: var(--color-grey-7) !important;
|
|
47
|
+
}
|
|
48
|
+
& > div:first-of-type {
|
|
49
|
+
background-color: var(--color-grey-9) !important;
|
|
50
|
+
}`
|
|
51
|
+
: ''}
|
|
52
|
+
|
|
53
|
+
${({ $sx }) => ($sx ? $sx : '')}
|
|
54
|
+
`;
|
|
55
|
+
const InputWrapper = styled.div `
|
|
56
|
+
min-width: ${({ $minWidth }) => ($minWidth ? $minWidth + 'px;' : '')}
|
|
57
|
+
display: flex;
|
|
58
|
+
gap: 8px;
|
|
59
|
+
align-items: center;
|
|
60
|
+
box-sizing: border-box;
|
|
61
|
+
padding: 12px;
|
|
62
|
+
background-color: ${({ $bg }) => $bg};
|
|
63
|
+
border-radius: 8px;
|
|
64
|
+
border: 1px solid transparent;
|
|
65
|
+
|
|
66
|
+
&:hover {
|
|
67
|
+
border-color: var(--color-grey-8);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&:focus-within {
|
|
71
|
+
border-color: var(--color-primary-blue-2);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
${({ $successful }) => $successful ? 'border-color: var(--color-green-3) !important;' : ''}
|
|
75
|
+
${({ $warning }) => $warning ? 'border-color: var(--color-red-4) !important;' : ''}
|
|
76
|
+
`;
|
|
77
|
+
const TextAreaElement = styled.textarea `
|
|
78
|
+
padding: 0px;
|
|
79
|
+
flex: 1;
|
|
80
|
+
font-family: var(--font-inter);
|
|
81
|
+
font-size: 16px;
|
|
82
|
+
line-height: 24px;
|
|
83
|
+
color: var(--color-grey-3);
|
|
84
|
+
border: none;
|
|
85
|
+
outline: none;
|
|
86
|
+
border-radius: 8px;
|
|
87
|
+
background-color: transparent;
|
|
88
|
+
|
|
89
|
+
&::placeholder {
|
|
90
|
+
color: var(--color-grey-6);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
${({ $resize }) => ($resize ? '' : 'resize: none;')}
|
|
94
|
+
`;
|
|
95
|
+
const HelperText = styled.p `
|
|
96
|
+
color: var(--color-grey-4);
|
|
97
|
+
font-family: var(--font-inter);
|
|
98
|
+
font-size: 14px;
|
|
99
|
+
line-height: 20px;
|
|
100
|
+
`;
|
|
101
|
+
const MaxCharactersText = styled.p `
|
|
102
|
+
text-align: right;
|
|
103
|
+
color: var(--color-grey-6);
|
|
104
|
+
font-family: var(--font-inter);
|
|
105
|
+
font-size: 14px;
|
|
106
|
+
font-style: normal;
|
|
107
|
+
font-weight: 400;
|
|
108
|
+
line-height: 20px;
|
|
109
|
+
`;
|