@dfds-ui/forms 2.0.26-alpha.06ae76d8 → 2.0.26-alpha.a10b16da
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/cjs/index.d.ts +1 -0
- package/cjs/index.js +11 -0
- package/cjs/select-field/CreatableSelectField.d.ts +95 -26
- package/cjs/select-field/CreatableSelectField.js +40 -60
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +7 -7
- package/select-field/CreatableSelectField.d.ts +95 -26
- package/select-field/CreatableSelectField.js +41 -59
package/cjs/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from './password-field/PasswordField';
|
|
|
10
10
|
export * from './radio';
|
|
11
11
|
export * from './rating';
|
|
12
12
|
export * from './select-field/AsyncSelectField';
|
|
13
|
+
export * from './select-field/CreatableSelectField';
|
|
13
14
|
export * from './select-field/NativeSelectField';
|
|
14
15
|
export * from './select-field/SelectField';
|
|
15
16
|
export * from './switch/index';
|
package/cjs/index.js
CHANGED
|
@@ -135,6 +135,17 @@ Object.keys(_AsyncSelectField).forEach(function (key) {
|
|
|
135
135
|
}
|
|
136
136
|
});
|
|
137
137
|
});
|
|
138
|
+
var _CreatableSelectField = require("./select-field/CreatableSelectField");
|
|
139
|
+
Object.keys(_CreatableSelectField).forEach(function (key) {
|
|
140
|
+
if (key === "default" || key === "__esModule") return;
|
|
141
|
+
if (key in exports && exports[key] === _CreatableSelectField[key]) return;
|
|
142
|
+
Object.defineProperty(exports, key, {
|
|
143
|
+
enumerable: true,
|
|
144
|
+
get: function get() {
|
|
145
|
+
return _CreatableSelectField[key];
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
});
|
|
138
149
|
var _NativeSelectField = require("./select-field/NativeSelectField");
|
|
139
150
|
Object.keys(_NativeSelectField).forEach(function (key) {
|
|
140
151
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -1,25 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { CreatableProps } from 'react-select/creatable';
|
|
3
3
|
import { ActionMeta, createFilter, GroupBase, MultiValue, OptionsOrGroups, SingleValue } from 'react-select';
|
|
4
4
|
import { BaseFieldProps } from '../types';
|
|
5
|
-
|
|
6
|
-
export declare type
|
|
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 & {
|
|
5
|
+
declare type Size = 'small' | 'medium' | 'large';
|
|
6
|
+
export declare type CreatableSelectFieldProps<Option, IsMulti extends boolean, Group extends GroupBase<Option>> = BaseFieldProps & CreatableProps<Option, IsMulti, Group> & {
|
|
18
7
|
assistiveText?: string;
|
|
19
8
|
autoFocus?: boolean;
|
|
20
9
|
className?: string;
|
|
21
10
|
components?: any;
|
|
22
|
-
defaultValue?: SingleValue<
|
|
11
|
+
defaultValue?: SingleValue<Option>;
|
|
23
12
|
errorMessage?: string;
|
|
24
13
|
/**
|
|
25
14
|
* Configuration object passed to react-select createFilter function to create [custom filter
|
|
@@ -42,23 +31,103 @@ export declare type SelectFieldProps<T = string> = BaseFieldProps & {
|
|
|
42
31
|
menuIsOpen?: boolean;
|
|
43
32
|
menuPlacement?: 'bottom' | 'auto' | 'top';
|
|
44
33
|
onBlur?: (value: any) => void;
|
|
45
|
-
onChange?: (newValue: SingleValue<
|
|
46
|
-
onSelect?: (value: SingleValue<
|
|
47
|
-
options?: OptionsOrGroups<
|
|
34
|
+
onChange?: (newValue: SingleValue<Option> | MultiValue<Option>, actionMeta: ActionMeta<Option>) => void;
|
|
35
|
+
onSelect?: (value: SingleValue<Option> | MultiValue<Option>) => void;
|
|
36
|
+
options?: OptionsOrGroups<Option, GroupBase<Option>>;
|
|
48
37
|
placeholder?: string;
|
|
49
38
|
prefix?: React.ReactNode;
|
|
50
39
|
styles?: any;
|
|
51
40
|
suffix?: React.ReactNode;
|
|
52
|
-
value?: SingleValue<
|
|
41
|
+
value?: SingleValue<Option> | MultiValue<Option>;
|
|
53
42
|
visualSize?: Size;
|
|
54
43
|
};
|
|
55
|
-
declare
|
|
56
|
-
export declare const CreatableSelectField: <
|
|
44
|
+
declare const CreatableSelectFieldInner: <Option, IsMulti extends boolean, Group extends GroupBase<Option>>({ assistiveText, components, defaultValue, disabled, errorMessage, filterConfig, help, helpPlacement, hideAsterisk, isClearable, isMulti, isSearchable, label, name, onBlur, onChange, onSelect, options, placeholder, required, styles, value, visualSize, ...rest }: CreatableSelectFieldProps<Option, IsMulti, Group>, ref: React.ForwardedRef<any>) => JSX.Element;
|
|
45
|
+
export declare const CreatableSelectField: <Option, IsMulti extends boolean, Group extends GroupBase<Option>>(props: BaseFieldProps & Omit<Pick<import("react-select/dist/declarations/src/Select").Props<Option, IsMulti, Group>, "id" | "name" | "value" | "form" | "className" | "autoFocus" | "aria-errormessage" | "aria-invalid" | "aria-label" | "aria-labelledby" | "onFocus" | "onBlur" | "onChange" | "onKeyDown" | "theme" | "ariaLiveMessages" | "classNamePrefix" | "delimiter" | "formatOptionLabel" | "hideSelectedOptions" | "inputValue" | "inputId" | "instanceId" | "isClearable" | "isOptionSelected" | "menuPortalTarget" | "onInputChange" | "onMenuOpen" | "onMenuClose" | "onMenuScrollToTop" | "onMenuScrollToBottom"> & Partial<Pick<import("react-select/dist/declarations/src/Select").Props<Option, IsMulti, Group>, "tabIndex" | "options" | "placeholder" | "aria-live" | "components" | "isOptionDisabled" | "isRtl" | "styles" | "isDisabled" | "isMulti" | "controlShouldRenderValue" | "menuPlacement" | "menuPosition" | "loadingMessage" | "noOptionsMessage" | "backspaceRemovesValue" | "blurInputOnSelect" | "captureMenuScroll" | "closeMenuOnSelect" | "closeMenuOnScroll" | "escapeClearsValue" | "filterOption" | "formatGroupLabel" | "getOptionLabel" | "getOptionValue" | "isLoading" | "isSearchable" | "minMenuHeight" | "maxMenuHeight" | "menuIsOpen" | "menuShouldBlockScroll" | "menuShouldScrollIntoView" | "openMenuOnFocus" | "openMenuOnClick" | "pageSize" | "screenReaderStatus" | "tabSelectsValue">> & Partial<Pick<{
|
|
46
|
+
'aria-live': string;
|
|
47
|
+
backspaceRemovesValue: boolean;
|
|
48
|
+
blurInputOnSelect: boolean;
|
|
49
|
+
captureMenuScroll: boolean;
|
|
50
|
+
closeMenuOnSelect: boolean;
|
|
51
|
+
closeMenuOnScroll: boolean;
|
|
52
|
+
components: {};
|
|
53
|
+
controlShouldRenderValue: boolean;
|
|
54
|
+
escapeClearsValue: boolean;
|
|
55
|
+
filterOption: (option: import("react-select/dist/declarations/src/filters").FilterOptionOption<unknown>, rawInput: string) => boolean;
|
|
56
|
+
formatGroupLabel: <Option_1, Group_1 extends GroupBase<Option_1>>(group: Group_1) => string;
|
|
57
|
+
getOptionLabel: <Option_2>(option: Option_2) => string;
|
|
58
|
+
getOptionValue: <Option_3>(option: Option_3) => string;
|
|
59
|
+
isDisabled: boolean;
|
|
60
|
+
isLoading: boolean;
|
|
61
|
+
isMulti: boolean;
|
|
62
|
+
isRtl: boolean;
|
|
63
|
+
isSearchable: boolean;
|
|
64
|
+
isOptionDisabled: <Option_4>(option: Option_4) => boolean;
|
|
65
|
+
loadingMessage: () => string;
|
|
66
|
+
maxMenuHeight: number;
|
|
67
|
+
minMenuHeight: number;
|
|
68
|
+
menuIsOpen: boolean;
|
|
69
|
+
menuPlacement: string;
|
|
70
|
+
menuPosition: string;
|
|
71
|
+
menuShouldBlockScroll: boolean;
|
|
72
|
+
menuShouldScrollIntoView: boolean;
|
|
73
|
+
noOptionsMessage: () => string;
|
|
74
|
+
openMenuOnFocus: boolean;
|
|
75
|
+
openMenuOnClick: boolean;
|
|
76
|
+
options: never[];
|
|
77
|
+
pageSize: number;
|
|
78
|
+
placeholder: string;
|
|
79
|
+
screenReaderStatus: ({ count }: {
|
|
80
|
+
count: number;
|
|
81
|
+
}) => string;
|
|
82
|
+
styles: {};
|
|
83
|
+
tabIndex: number;
|
|
84
|
+
tabSelectsValue: boolean;
|
|
85
|
+
}, never>>, "value" | "onChange" | "inputValue" | "menuIsOpen" | "onInputChange" | "onMenuOpen" | "onMenuClose"> & Partial<Pick<import("react-select/dist/declarations/src/Select").Props<Option, IsMulti, Group>, "id" | "name" | "value" | "form" | "className" | "autoFocus" | "aria-errormessage" | "aria-invalid" | "aria-label" | "aria-labelledby" | "onFocus" | "onBlur" | "onChange" | "onKeyDown" | "theme" | "ariaLiveMessages" | "classNamePrefix" | "delimiter" | "formatOptionLabel" | "hideSelectedOptions" | "inputValue" | "inputId" | "instanceId" | "isClearable" | "isOptionSelected" | "menuPortalTarget" | "onInputChange" | "onMenuOpen" | "onMenuClose" | "onMenuScrollToTop" | "onMenuScrollToBottom"> & Partial<Pick<import("react-select/dist/declarations/src/Select").Props<Option, IsMulti, Group>, "tabIndex" | "options" | "placeholder" | "aria-live" | "components" | "isOptionDisabled" | "isRtl" | "styles" | "isDisabled" | "isMulti" | "controlShouldRenderValue" | "menuPlacement" | "menuPosition" | "loadingMessage" | "noOptionsMessage" | "backspaceRemovesValue" | "blurInputOnSelect" | "captureMenuScroll" | "closeMenuOnSelect" | "closeMenuOnScroll" | "escapeClearsValue" | "filterOption" | "formatGroupLabel" | "getOptionLabel" | "getOptionValue" | "isLoading" | "isSearchable" | "minMenuHeight" | "maxMenuHeight" | "menuIsOpen" | "menuShouldBlockScroll" | "menuShouldScrollIntoView" | "openMenuOnFocus" | "openMenuOnClick" | "pageSize" | "screenReaderStatus" | "tabSelectsValue">> & Partial<Pick<{
|
|
86
|
+
'aria-live': string;
|
|
87
|
+
backspaceRemovesValue: boolean;
|
|
88
|
+
blurInputOnSelect: boolean;
|
|
89
|
+
captureMenuScroll: boolean;
|
|
90
|
+
closeMenuOnSelect: boolean;
|
|
91
|
+
closeMenuOnScroll: boolean;
|
|
92
|
+
components: {};
|
|
93
|
+
controlShouldRenderValue: boolean;
|
|
94
|
+
escapeClearsValue: boolean;
|
|
95
|
+
filterOption: (option: import("react-select/dist/declarations/src/filters").FilterOptionOption<unknown>, rawInput: string) => boolean;
|
|
96
|
+
formatGroupLabel: <Option_1, Group_1 extends GroupBase<Option_1>>(group: Group_1) => string;
|
|
97
|
+
getOptionLabel: <Option_2>(option: Option_2) => string;
|
|
98
|
+
getOptionValue: <Option_3>(option: Option_3) => string;
|
|
99
|
+
isDisabled: boolean;
|
|
100
|
+
isLoading: boolean;
|
|
101
|
+
isMulti: boolean;
|
|
102
|
+
isRtl: boolean;
|
|
103
|
+
isSearchable: boolean;
|
|
104
|
+
isOptionDisabled: <Option_4>(option: Option_4) => boolean;
|
|
105
|
+
loadingMessage: () => string;
|
|
106
|
+
maxMenuHeight: number;
|
|
107
|
+
minMenuHeight: number;
|
|
108
|
+
menuIsOpen: boolean;
|
|
109
|
+
menuPlacement: string;
|
|
110
|
+
menuPosition: string;
|
|
111
|
+
menuShouldBlockScroll: boolean;
|
|
112
|
+
menuShouldScrollIntoView: boolean;
|
|
113
|
+
noOptionsMessage: () => string;
|
|
114
|
+
openMenuOnFocus: boolean;
|
|
115
|
+
openMenuOnClick: boolean;
|
|
116
|
+
options: never[];
|
|
117
|
+
pageSize: number;
|
|
118
|
+
placeholder: string;
|
|
119
|
+
screenReaderStatus: ({ count }: {
|
|
120
|
+
count: number;
|
|
121
|
+
}) => string;
|
|
122
|
+
styles: {};
|
|
123
|
+
tabIndex: number;
|
|
124
|
+
tabSelectsValue: boolean;
|
|
125
|
+
}, never>>> & import("react-select/dist/declarations/src/useStateManager").StateManagerAdditionalProps<Option> & import("react-select/dist/declarations/src/useCreatable").CreatableAdditionalProps<Option, Group> & {
|
|
57
126
|
assistiveText?: string | undefined;
|
|
58
127
|
autoFocus?: boolean | undefined;
|
|
59
128
|
className?: string | undefined;
|
|
60
129
|
components?: any;
|
|
61
|
-
defaultValue?: SingleValue<
|
|
130
|
+
defaultValue?: SingleValue<Option> | undefined;
|
|
62
131
|
errorMessage?: string | undefined;
|
|
63
132
|
/**
|
|
64
133
|
* Configuration object passed to react-select createFilter function to create [custom filter
|
|
@@ -81,14 +150,14 @@ export declare const CreatableSelectField: <T>(props: BaseFieldProps & {
|
|
|
81
150
|
menuIsOpen?: boolean | undefined;
|
|
82
151
|
menuPlacement?: "auto" | "top" | "bottom" | undefined;
|
|
83
152
|
onBlur?: ((value: any) => void) | undefined;
|
|
84
|
-
onChange?: ((newValue:
|
|
85
|
-
onSelect?: ((value:
|
|
86
|
-
options?: OptionsOrGroups<
|
|
153
|
+
onChange?: ((newValue: MultiValue<Option> | SingleValue<Option>, actionMeta: ActionMeta<Option>) => void) | undefined;
|
|
154
|
+
onSelect?: ((value: MultiValue<Option> | SingleValue<Option>) => void) | undefined;
|
|
155
|
+
options?: OptionsOrGroups<Option, GroupBase<Option>> | undefined;
|
|
87
156
|
placeholder?: string | undefined;
|
|
88
157
|
prefix?: React.ReactNode;
|
|
89
158
|
styles?: any;
|
|
90
159
|
suffix?: React.ReactNode;
|
|
91
|
-
value?:
|
|
160
|
+
value?: MultiValue<Option> | SingleValue<Option> | undefined;
|
|
92
161
|
visualSize?: Size | undefined;
|
|
93
162
|
} & {
|
|
94
163
|
ref?: React.ForwardedRef<any> | undefined;
|