@soul-refiner/design-system 0.2.99 → 0.2.101
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.
|
@@ -106,7 +106,11 @@ const Dropdown = ({ checkbox, children, closeOnChange = true, closeOnBlur = true
|
|
|
106
106
|
: { isDropdownOpen: open, onClick: handleOpen }),
|
|
107
107
|
open && (React.createElement(Container, { "$hasArrow": hasArrow, "$offset": offset, "$openDirection": openDirection, ref: optionsRef, "$sx": containerSx, "$useFullWidth": useFullWidth },
|
|
108
108
|
React.createElement("div", { style: { display: 'flex' } },
|
|
109
|
-
React.createElement("div", { style: {
|
|
109
|
+
React.createElement("div", { style: {
|
|
110
|
+
display: 'flex',
|
|
111
|
+
flexDirection: 'column',
|
|
112
|
+
width: '100%',
|
|
113
|
+
} }, dropdownOptions),
|
|
110
114
|
!!additionalOptions?.length && (React.createElement("div", { style: { display: 'flex', flexDirection: 'column' } }, additionalOptions.map((additionalOption) => (React.createElement(Option, { key: additionalOption.value, onClick: handleAdditionalChange, selected: additionalSelected === additionalOption.value, label: additionalOption.label, value: additionalOption.value }))))))))));
|
|
111
115
|
};
|
|
112
116
|
const Wrapper = styled.div `
|
|
@@ -18,6 +18,7 @@ export type Props = {
|
|
|
18
18
|
sx?: string;
|
|
19
19
|
value: string | string[];
|
|
20
20
|
isNumber?: boolean;
|
|
21
|
+
placeIconAtTheEnd?: boolean;
|
|
21
22
|
};
|
|
22
23
|
interface DisabledProps extends Props {
|
|
23
24
|
disabled?: true;
|
|
@@ -35,5 +36,5 @@ interface WarningProps extends Props {
|
|
|
35
36
|
warning?: true;
|
|
36
37
|
}
|
|
37
38
|
export type TextInputProps = DisabledProps | SuccessfulProps | WarningProps;
|
|
38
|
-
export declare const TextInput: ({ bg, disabled, helperText, icon, label, maxCharacters, multiple, name, onChange, onMultipleChange, placeholder, size, successful, sx, value, warning, isNumber, }: TextInputProps) => React.JSX.Element;
|
|
39
|
+
export declare const TextInput: ({ bg, disabled, helperText, icon, label, maxCharacters, multiple, name, onChange, onMultipleChange, placeholder, size, successful, sx, value, warning, isNumber, placeIconAtTheEnd, }: TextInputProps) => React.JSX.Element;
|
|
39
40
|
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, isNumber, }) => {
|
|
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, isNumber, placeIconAtTheEnd = false, }) => {
|
|
7
7
|
const id = React.useId();
|
|
8
8
|
const isMultiple = multiple;
|
|
9
9
|
const [multipleValueToAdd, setMultipleValueToAdd] = React.useState('');
|
|
@@ -45,7 +45,7 @@ export const TextInput = ({ bg = 'var(--color-blue-10)', disabled, helperText, i
|
|
|
45
45
|
return (React.createElement(Label, { "$disabled": disabled, "$size": size, "$sx": sx },
|
|
46
46
|
label,
|
|
47
47
|
React.createElement(InputWrapper, { "$bg": bg, "$size": size, "$successful": successful, "$warning": warning },
|
|
48
|
-
icon,
|
|
48
|
+
!placeIconAtTheEnd && icon,
|
|
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 }))),
|
|
@@ -54,10 +54,11 @@ export const TextInput = ({ bg = 'var(--color-blue-10)', disabled, helperText, i
|
|
|
54
54
|
: maxCharacters
|
|
55
55
|
? value.slice(0, maxCharacters - 1)
|
|
56
56
|
: value, "$size": size, type: isNumber ? 'number' : 'text' })),
|
|
57
|
-
maxCharacters && !isNumber && (React.createElement(MaxCharactersText, { "$size": size },
|
|
57
|
+
maxCharacters && !isNumber && !placeIconAtTheEnd && (React.createElement(MaxCharactersText, { "$size": size },
|
|
58
58
|
value.length,
|
|
59
59
|
" / ",
|
|
60
60
|
maxCharacters)),
|
|
61
|
+
placeIconAtTheEnd && icon,
|
|
61
62
|
successful && React.createElement(CheckmarkCircle, { color: "green-3" }),
|
|
62
63
|
warning && React.createElement(AlertCircle, { color: "red-4" })),
|
|
63
64
|
helperText && React.createElement(HelperText, { "$size": size }, helperText)));
|