@soul-refiner/design-system 1.1.5 → 1.1.6
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.
|
@@ -6,7 +6,7 @@ type NativeProps = Pick<React.HTMLAttributes<SVGElement>, 'children' | 'classNam
|
|
|
6
6
|
export interface IconProps extends NativeProps {
|
|
7
7
|
as?: React.ElementType;
|
|
8
8
|
color?: (typeof COLORS)[number];
|
|
9
|
-
size?: 16 | 20 | 24;
|
|
9
|
+
size?: 16 | 20 | 24 | 40;
|
|
10
10
|
sx?: string;
|
|
11
11
|
}
|
|
12
12
|
export declare const Icon: ({ as, children, color, size, sx, ...rest }: IconProps) => React.JSX.Element;
|
|
@@ -17,9 +17,9 @@ export type Props = {
|
|
|
17
17
|
size?: TextInputSize;
|
|
18
18
|
sx?: string;
|
|
19
19
|
value: string | string[];
|
|
20
|
-
isNumber?: boolean;
|
|
21
20
|
placeIconAtTheEnd?: boolean;
|
|
22
21
|
inputSx?: string;
|
|
22
|
+
type?: 'number' | 'password' | 'text';
|
|
23
23
|
};
|
|
24
24
|
interface DisabledProps extends Props {
|
|
25
25
|
disabled?: true;
|
|
@@ -37,5 +37,5 @@ interface WarningProps extends Props {
|
|
|
37
37
|
warning?: true;
|
|
38
38
|
}
|
|
39
39
|
export type TextInputProps = DisabledProps | SuccessfulProps | WarningProps;
|
|
40
|
-
export declare const TextInput: ({ bg, disabled, helperText, icon, label, maxCharacters, multiple, name, onChange, onMultipleChange, placeholder, size, successful, sx, value, warning,
|
|
40
|
+
export declare const TextInput: ({ bg, disabled, helperText, icon, label, maxCharacters, multiple, name, onChange, onMultipleChange, placeholder, size, successful, sx, value, warning, type, placeIconAtTheEnd, inputSx, }: TextInputProps) => React.JSX.Element;
|
|
41
41
|
export {};
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { Chip } from '../../feedback/chip/chip';
|
|
5
5
|
import { CheckmarkCircle, AlertCircle } from '../../../icons';
|
|
6
|
-
export const TextInput = ({ bg = 'var(--color-blue-10)', disabled, helperText, icon, label, maxCharacters, multiple, name, onChange, onMultipleChange, placeholder, size = 'large', successful, sx, value, warning,
|
|
6
|
+
export const TextInput = ({ bg = 'var(--color-blue-10)', disabled, helperText, icon, label, maxCharacters, multiple, name, onChange, onMultipleChange, placeholder, size = 'large', successful, sx, value, warning, type = 'text', placeIconAtTheEnd = false, inputSx, }) => {
|
|
7
7
|
const id = React.useId();
|
|
8
8
|
const isMultiple = multiple;
|
|
9
9
|
const [multipleValueToAdd, setMultipleValueToAdd] = React.useState('');
|
|
@@ -49,12 +49,12 @@ export const TextInput = ({ bg = 'var(--color-blue-10)', disabled, helperText, i
|
|
|
49
49
|
isMultiple && (React.createElement(MultipleInputWrapper, { onSubmit: handleMultipleAdd },
|
|
50
50
|
value.filter(Boolean).map((item, index) => (React.createElement(Chip, { key: id + item + index, color: "blue", size: "small", onDismiss: () => handleMultipleItemRemoval(item) }, item))),
|
|
51
51
|
React.createElement(Input, { onChange: handleMultipleValueToAdd, onKeyDown: handleMultipleValueDelete, value: multipleValueToAdd, "$size": size, "$sx": inputSx }))),
|
|
52
|
-
!isMultiple && (React.createElement(Input, { disabled: disabled, name: name, onChange: onChange, placeholder: placeholder, value:
|
|
52
|
+
!isMultiple && (React.createElement(Input, { disabled: disabled, name: name, onChange: onChange, placeholder: placeholder, value: type === 'number'
|
|
53
53
|
? value
|
|
54
54
|
: maxCharacters
|
|
55
55
|
? value?.slice(0, maxCharacters - 1) || ''
|
|
56
|
-
: value, "$size": size, type:
|
|
57
|
-
maxCharacters &&
|
|
56
|
+
: value, "$size": size, type: type, "$sx": inputSx })),
|
|
57
|
+
maxCharacters && type !== 'number' && !placeIconAtTheEnd && (React.createElement(MaxCharactersText, { "$size": size },
|
|
58
58
|
value?.length || 0,
|
|
59
59
|
" / ",
|
|
60
60
|
maxCharacters)),
|