@dfds-ui/forms 2.0.25 → 2.0.26-alpha.06ae76d8
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.
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import CreatableSelect from 'react-select/creatable';
|
|
3
|
+
import { ActionMeta, createFilter, GroupBase, MultiValue, OptionsOrGroups, SingleValue } from 'react-select';
|
|
4
|
+
import { BaseFieldProps } from '../types';
|
|
5
|
+
export declare type BaseReactSelectProps = Omit<React.PropsWithRef<CreatableSelect>, 'size' | 'css'>;
|
|
6
|
+
export declare type Size = 'small' | 'medium' | 'large';
|
|
7
|
+
export declare const ReactSelectWrapper: import("@emotion/styled").StyledComponent<{
|
|
8
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
9
|
+
as?: React.ElementType<any> | undefined;
|
|
10
|
+
} & {
|
|
11
|
+
error?: boolean | undefined;
|
|
12
|
+
size?: string | undefined;
|
|
13
|
+
arrow?: boolean | undefined;
|
|
14
|
+
selected?: boolean | undefined;
|
|
15
|
+
}, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
16
|
+
export declare const Menu: (props: any) => JSX.Element;
|
|
17
|
+
export declare type SelectFieldProps<T = string> = BaseFieldProps & {
|
|
18
|
+
assistiveText?: string;
|
|
19
|
+
autoFocus?: boolean;
|
|
20
|
+
className?: string;
|
|
21
|
+
components?: any;
|
|
22
|
+
defaultValue?: SingleValue<T>;
|
|
23
|
+
errorMessage?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Configuration object passed to react-select createFilter function to create [custom filter
|
|
26
|
+
* logic](https://react-select.com/advanced#custom-filter-logic)
|
|
27
|
+
* @param ignoreCase - boolean (optional)
|
|
28
|
+
* @param ignoreAccents - boolean (optional)
|
|
29
|
+
* @param stringify (obj: any) => string (optional)
|
|
30
|
+
* @param trim - boolean (optional)
|
|
31
|
+
* @param matchForm - 'any' | 'start'
|
|
32
|
+
*/
|
|
33
|
+
filterConfig?: Parameters<typeof createFilter>[0];
|
|
34
|
+
/**
|
|
35
|
+
* Indicates that the Select can be cleared after selecting an Option.
|
|
36
|
+
*
|
|
37
|
+
* Setting this to true will display a small dismiss cross when a value is selected
|
|
38
|
+
*/
|
|
39
|
+
isClearable?: boolean;
|
|
40
|
+
isMulti?: boolean;
|
|
41
|
+
isSearchable?: boolean;
|
|
42
|
+
menuIsOpen?: boolean;
|
|
43
|
+
menuPlacement?: 'bottom' | 'auto' | 'top';
|
|
44
|
+
onBlur?: (value: any) => void;
|
|
45
|
+
onChange?: (newValue: SingleValue<T> | MultiValue<T>, actionMeta: ActionMeta<T>) => void;
|
|
46
|
+
onSelect?: (value: SingleValue<T> | MultiValue<T>) => void;
|
|
47
|
+
options?: OptionsOrGroups<T, GroupBase<T>>;
|
|
48
|
+
placeholder?: string;
|
|
49
|
+
prefix?: React.ReactNode;
|
|
50
|
+
styles?: any;
|
|
51
|
+
suffix?: React.ReactNode;
|
|
52
|
+
value?: SingleValue<T> | MultiValue<T>;
|
|
53
|
+
visualSize?: Size;
|
|
54
|
+
};
|
|
55
|
+
declare function CreatableSelectFieldInner<T>({ assistiveText, components, defaultValue, disabled, errorMessage, filterConfig, help, helpPlacement, hideAsterisk, isClearable, isMulti, isSearchable, label, name, onBlur, onChange, onSelect, options, placeholder, required, styles, value, visualSize, ...rest }: SelectFieldProps<T>, ref: React.ForwardedRef<any>): JSX.Element;
|
|
56
|
+
export declare const CreatableSelectField: <T>(props: BaseFieldProps & {
|
|
57
|
+
assistiveText?: string | undefined;
|
|
58
|
+
autoFocus?: boolean | undefined;
|
|
59
|
+
className?: string | undefined;
|
|
60
|
+
components?: any;
|
|
61
|
+
defaultValue?: SingleValue<T> | undefined;
|
|
62
|
+
errorMessage?: string | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Configuration object passed to react-select createFilter function to create [custom filter
|
|
65
|
+
* logic](https://react-select.com/advanced#custom-filter-logic)
|
|
66
|
+
* @param ignoreCase - boolean (optional)
|
|
67
|
+
* @param ignoreAccents - boolean (optional)
|
|
68
|
+
* @param stringify (obj: any) => string (optional)
|
|
69
|
+
* @param trim - boolean (optional)
|
|
70
|
+
* @param matchForm - 'any' | 'start'
|
|
71
|
+
*/
|
|
72
|
+
filterConfig?: Parameters<typeof createFilter>[0];
|
|
73
|
+
/**
|
|
74
|
+
* Indicates that the Select can be cleared after selecting an Option.
|
|
75
|
+
*
|
|
76
|
+
* Setting this to true will display a small dismiss cross when a value is selected
|
|
77
|
+
*/
|
|
78
|
+
isClearable?: boolean | undefined;
|
|
79
|
+
isMulti?: boolean | undefined;
|
|
80
|
+
isSearchable?: boolean | undefined;
|
|
81
|
+
menuIsOpen?: boolean | undefined;
|
|
82
|
+
menuPlacement?: "auto" | "top" | "bottom" | undefined;
|
|
83
|
+
onBlur?: ((value: any) => void) | undefined;
|
|
84
|
+
onChange?: ((newValue: SingleValue<T> | MultiValue<T>, actionMeta: ActionMeta<T>) => void) | undefined;
|
|
85
|
+
onSelect?: ((value: SingleValue<T> | MultiValue<T>) => void) | undefined;
|
|
86
|
+
options?: OptionsOrGroups<T, GroupBase<T>> | undefined;
|
|
87
|
+
placeholder?: string | undefined;
|
|
88
|
+
prefix?: React.ReactNode;
|
|
89
|
+
styles?: any;
|
|
90
|
+
suffix?: React.ReactNode;
|
|
91
|
+
value?: SingleValue<T> | MultiValue<T> | undefined;
|
|
92
|
+
visualSize?: Size | undefined;
|
|
93
|
+
} & {
|
|
94
|
+
ref?: React.ForwardedRef<any> | undefined;
|
|
95
|
+
}) => ReturnType<typeof CreatableSelectFieldInner>;
|
|
96
|
+
export default CreatableSelectField;
|