@soul-refiner/design-system 0.2.98 → 0.2.100
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.
|
@@ -19,9 +19,10 @@ export interface DropdownProps extends NativeProps, React.PropsWithChildren {
|
|
|
19
19
|
additionalOptions?: Omit<DropdownOptionProps, 'selected' | 'onClick'>[];
|
|
20
20
|
additionalOnChange?: (value: string) => void;
|
|
21
21
|
defaultAdditionalValue?: string;
|
|
22
|
+
useFullWidth?: boolean;
|
|
22
23
|
}
|
|
23
24
|
declare const Dropdown: {
|
|
24
|
-
({ checkbox, children, closeOnChange, closeOnBlur, defaultValue, disabled, hasArrow, maintainState, multiple, offset, onChange, open: openDirection, options, sx, trigger, containerSx, additionalOptions, additionalOnChange, defaultAdditionalValue, ...rest }: DropdownProps): React.JSX.Element;
|
|
25
|
+
({ checkbox, children, closeOnChange, closeOnBlur, defaultValue, disabled, hasArrow, maintainState, multiple, offset, onChange, open: openDirection, options, sx, trigger, containerSx, additionalOptions, additionalOnChange, defaultAdditionalValue, useFullWidth, ...rest }: DropdownProps): React.JSX.Element;
|
|
25
26
|
Option: {
|
|
26
27
|
({ checkbox, disabled, icon, label, onClick, selected, sublabel, sx, value, color, }: DropdownOptionProps): React.JSX.Element;
|
|
27
28
|
displayName: string;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { Box, Checkbox, P } from '../../';
|
|
5
|
-
const Dropdown = ({ checkbox, children, closeOnChange = true, closeOnBlur = true, defaultValue = '', disabled = false, hasArrow, maintainState = true, multiple, offset = [0, 16], onChange, open: openDirection = 'right', options, sx, trigger, containerSx, additionalOptions, additionalOnChange, defaultAdditionalValue, ...rest }) => {
|
|
5
|
+
const Dropdown = ({ checkbox, children, closeOnChange = true, closeOnBlur = true, defaultValue = '', disabled = false, hasArrow, maintainState = true, multiple, offset = [0, 16], onChange, open: openDirection = 'right', options, sx, trigger, containerSx, additionalOptions, additionalOnChange, defaultAdditionalValue, useFullWidth = false, ...rest }) => {
|
|
6
6
|
const id = React.useId();
|
|
7
7
|
const wrapperRef = React.useRef(null);
|
|
8
8
|
const optionsRef = React.useRef(null);
|
|
@@ -104,7 +104,7 @@ const Dropdown = ({ checkbox, children, closeOnChange = true, closeOnBlur = true
|
|
|
104
104
|
trigger.type?.name !== 'Button')
|
|
105
105
|
? { onClick: handleOpen }
|
|
106
106
|
: { isDropdownOpen: open, onClick: handleOpen }),
|
|
107
|
-
open && (React.createElement(Container, { "$hasArrow": hasArrow, "$offset": offset, "$openDirection": openDirection, ref: optionsRef, "$sx": containerSx },
|
|
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
109
|
React.createElement("div", { style: { display: 'flex', flexDirection: 'column' } }, dropdownOptions),
|
|
110
110
|
!!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 }))))))))));
|
|
@@ -119,7 +119,7 @@ const Container = styled.div `
|
|
|
119
119
|
z-index: 1;
|
|
120
120
|
background-color: var(--color-white);
|
|
121
121
|
position: absolute;
|
|
122
|
-
width: max-content;
|
|
122
|
+
${({ $useFullWidth }) => $useFullWidth ? 'width: 100%;' : 'width: max-content;'}
|
|
123
123
|
z-index: 100;
|
|
124
124
|
outline: none;
|
|
125
125
|
cursor: pointer;
|
|
@@ -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)));
|