@commercetools-uikit/creatable-select-field 19.9.0 → 19.10.0
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/dist/commercetools-uikit-creatable-select-field.cjs.dev.js +1 -1
- package/dist/commercetools-uikit-creatable-select-field.cjs.prod.js +1 -1
- package/dist/commercetools-uikit-creatable-select-field.esm.js +1 -1
- package/dist/declarations/src/creatable-select-field.d.ts +236 -0
- package/package.json +9 -9
|
@@ -227,7 +227,7 @@ CreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
227
227
|
} : {};
|
|
228
228
|
|
|
229
229
|
// NOTE: This string will be replaced on build time with the package version.
|
|
230
|
-
var version = "19.
|
|
230
|
+
var version = "19.10.0";
|
|
231
231
|
|
|
232
232
|
exports["default"] = CreatableSelectField;
|
|
233
233
|
exports.version = version;
|
|
@@ -186,7 +186,7 @@ CreatableSelectField.getDerivedStateFromProps = (props, state) => ({
|
|
|
186
186
|
CreatableSelectField.propTypes = {};
|
|
187
187
|
|
|
188
188
|
// NOTE: This string will be replaced on build time with the package version.
|
|
189
|
-
var version = "19.
|
|
189
|
+
var version = "19.10.0";
|
|
190
190
|
|
|
191
191
|
exports["default"] = CreatableSelectField;
|
|
192
192
|
exports.version = version;
|
|
@@ -201,6 +201,6 @@ CreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
201
201
|
} : {};
|
|
202
202
|
|
|
203
203
|
// NOTE: This string will be replaced on build time with the package version.
|
|
204
|
-
var version = "19.
|
|
204
|
+
var version = "19.10.0";
|
|
205
205
|
|
|
206
206
|
export { CreatableSelectField as default, version };
|
|
@@ -24,57 +24,288 @@ type TCustomEvent = {
|
|
|
24
24
|
persist?: () => void;
|
|
25
25
|
};
|
|
26
26
|
export type TCreatableSelectFieldProps = {
|
|
27
|
+
/**
|
|
28
|
+
* Used as HTML id property. An id is auto-generated when it is not specified.
|
|
29
|
+
* <br>
|
|
30
|
+
* [Props from React select was used](https://react-select.com/props#creatable-props)
|
|
31
|
+
*/
|
|
27
32
|
id?: ReactSelectCreatableProps['inputId'];
|
|
33
|
+
/**
|
|
34
|
+
* Horizontal size limit of the input fields.
|
|
35
|
+
*/
|
|
28
36
|
horizontalConstraint?: 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 'scale' | 'auto';
|
|
37
|
+
/**
|
|
38
|
+
* A map of errors. Error messages for known errors are rendered automatically.
|
|
39
|
+
* <br>
|
|
40
|
+
* Unknown errors will be forwarded to `renderError`
|
|
41
|
+
*/
|
|
29
42
|
errors?: TFieldErrors;
|
|
43
|
+
/**
|
|
44
|
+
* Called with custom errors. This function can return a message which will be wrapped in an ErrorMessage. It can also return null to show no error.
|
|
45
|
+
*/
|
|
30
46
|
renderError?: TErrorRenderer;
|
|
47
|
+
/**
|
|
48
|
+
* A map of warnings. Warning messages for known warnings are rendered automatically.
|
|
49
|
+
* <br />
|
|
50
|
+
* Unknown warnings will be forwarded to `renderWarning`
|
|
51
|
+
*/
|
|
31
52
|
warnings?: TFieldWarnings;
|
|
53
|
+
/**
|
|
54
|
+
* Called with custom warnings. This function can return a message which will be wrapped in an WarningMessage. It can also return null to show no warning.
|
|
55
|
+
*/
|
|
32
56
|
renderWarning?: (key: string, warning?: boolean) => ReactNode;
|
|
57
|
+
/**
|
|
58
|
+
* Indicates if the value is required. Shows an the "required asterisk" if so.
|
|
59
|
+
*/
|
|
33
60
|
isRequired?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Indicates whether the field was touched. Errors will only be shown when the field was touched.
|
|
63
|
+
*/
|
|
34
64
|
touched?: boolean[] | boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Aria label (for assistive tech)
|
|
67
|
+
* <br>
|
|
68
|
+
* [Props from React select was used](https://react-select.com/props#creatable-props)
|
|
69
|
+
*/
|
|
35
70
|
'aria-label'?: ReactSelectCreatableProps['aria-label'];
|
|
71
|
+
/**
|
|
72
|
+
* HTML ID of an element that should be used as the label (for assistive tech)
|
|
73
|
+
* <br>
|
|
74
|
+
* [Props from React select was used](https://react-select.com/props#creatable-props)
|
|
75
|
+
*/
|
|
36
76
|
'aria-labelledby'?: ReactSelectCreatableProps['aria-label'];
|
|
77
|
+
/**
|
|
78
|
+
* Focus the control when it is mounted
|
|
79
|
+
*/
|
|
37
80
|
isAutofocussed?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Remove the currently focused option when the user presses backspace
|
|
83
|
+
* <br>
|
|
84
|
+
* [Props from React select was used](https://react-select.com/props#creatable-props)
|
|
85
|
+
*/
|
|
38
86
|
backspaceRemovesValue?: ReactSelectCreatableProps['backspaceRemovesValue'];
|
|
87
|
+
/**
|
|
88
|
+
* Map of components to overwrite the default ones, see [what components you can override](https://react-select.com/components)
|
|
89
|
+
* <br>
|
|
90
|
+
* [Props from React select was used](https://react-select.com/props#creatable-props)
|
|
91
|
+
*/
|
|
39
92
|
components?: ReactSelectCreatableProps['components'];
|
|
93
|
+
/**
|
|
94
|
+
* Custom method to filter whether an option should be displayed in the menu
|
|
95
|
+
* <br>
|
|
96
|
+
* [Props from React select was used](https://react-select.com/props#creatable-props)
|
|
97
|
+
*/
|
|
40
98
|
filterOption?: ReactSelectCreatableProps['filterOption'];
|
|
99
|
+
/**
|
|
100
|
+
* The id to set on the SelectContainer component
|
|
101
|
+
* <br>
|
|
102
|
+
* [Props from React select was used](https://react-select.com/props#creatable-props)
|
|
103
|
+
*/
|
|
41
104
|
containerId?: ReactSelectCreatableProps['id'];
|
|
105
|
+
/**
|
|
106
|
+
* Is the select value clearable
|
|
107
|
+
* <br>
|
|
108
|
+
* [Props from React select was used](https://react-select.com/props#creatable-props)
|
|
109
|
+
*/
|
|
42
110
|
isClearable?: ReactSelectCreatableProps['isClearable'];
|
|
111
|
+
/**
|
|
112
|
+
* Is the select disabled
|
|
113
|
+
* <br>
|
|
114
|
+
* [Props from React select was used](https://react-select.com/props#creatable-props)
|
|
115
|
+
*/
|
|
43
116
|
isDisabled?: ReactSelectCreatableProps['isDisabled'];
|
|
117
|
+
/**
|
|
118
|
+
* Is the select read-only
|
|
119
|
+
*/
|
|
44
120
|
isReadOnly?: ConstrainBooleanParameters;
|
|
121
|
+
/**
|
|
122
|
+
* Override the built-in logic to detect whether an option is disabled
|
|
123
|
+
* <br>
|
|
124
|
+
* [Props from React select was used](https://react-select.com/props#creatable-props)
|
|
125
|
+
*/
|
|
45
126
|
isOptionDisabled?: ReactSelectCreatableProps['isOptionDisabled'];
|
|
127
|
+
/**
|
|
128
|
+
* Support multiple selected options
|
|
129
|
+
* <br>
|
|
130
|
+
* [Props from React select was used](https://react-select.com/props#creatable-props)
|
|
131
|
+
*/
|
|
46
132
|
isMulti?: ReactSelectCreatableProps['isMulti'];
|
|
133
|
+
/**
|
|
134
|
+
* Whether to enable search functionality
|
|
135
|
+
* <br>
|
|
136
|
+
* [Props from React select was used](https://react-select.com/props#creatable-props)
|
|
137
|
+
*/
|
|
47
138
|
isSearchable?: ReactSelectCreatableProps['isSearchable'];
|
|
139
|
+
/**
|
|
140
|
+
* Indicates the input field has an error
|
|
141
|
+
* @deprecated Please use the `warnings` prop instead so users know the reason why the field is in warning state.
|
|
142
|
+
*/
|
|
48
143
|
hasWarning?: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Maximum height of the menu before scrolling
|
|
146
|
+
* <br>
|
|
147
|
+
* [Props from React select was used](https://react-select.com/props#creatable-props)
|
|
148
|
+
*/
|
|
49
149
|
maxMenuHeight?: ReactSelectCreatableProps['maxMenuHeight'];
|
|
150
|
+
/**
|
|
151
|
+
* Dom element to portal the select menu to
|
|
152
|
+
* <br>
|
|
153
|
+
* [Props from React select was used](https://react-select.com/props#creatable-props)
|
|
154
|
+
*/
|
|
50
155
|
menuPortalTarget?: ReactSelectCreatableProps['menuPortalTarget'];
|
|
156
|
+
/**
|
|
157
|
+
* z-index value for the menu portal
|
|
158
|
+
* <br>
|
|
159
|
+
* Use in conjunction with `menuPortalTarget`
|
|
160
|
+
*/
|
|
51
161
|
menuPortalZIndex?: number;
|
|
162
|
+
/**
|
|
163
|
+
* whether the menu should block scroll while open
|
|
164
|
+
* <br>
|
|
165
|
+
* [Props from React select was used](https://react-select.com/props#creatable-props)
|
|
166
|
+
*/
|
|
52
167
|
menuShouldBlockScroll?: ReactSelectCreatableProps['menuShouldBlockScroll'];
|
|
168
|
+
/**
|
|
169
|
+
* Name of the HTML Input (optional - without this, no input will be rendered)
|
|
170
|
+
* <br>
|
|
171
|
+
* [Props from React select was used](https://react-select.com/props#creatable-props)
|
|
172
|
+
*/
|
|
53
173
|
name?: ReactSelectCreatableProps['name'];
|
|
174
|
+
/**
|
|
175
|
+
* Can be used to render a custom value when there are no options (either because of no search results, or all options have been used, or there were none in the first place).
|
|
176
|
+
* <br>
|
|
177
|
+
* Gets called with `{ inputValue: String }`. `inputValue` will be an empty string when no search text is present.
|
|
178
|
+
* <br>
|
|
179
|
+
* [Props from React select was used](https://react-select.com/props#creatable-props)
|
|
180
|
+
*/
|
|
54
181
|
noOptionsMessage?: ReactSelectCreatableProps['noOptionsMessage'];
|
|
182
|
+
/**
|
|
183
|
+
* Handle blur events on the control
|
|
184
|
+
*/
|
|
55
185
|
onBlur?: (event: TCustomEvent) => void;
|
|
186
|
+
/**
|
|
187
|
+
* Called with a fake event when value changes.
|
|
188
|
+
* <br>
|
|
189
|
+
* The event's `target.name` will be the name supplied in props. The event's `target.value` will hold the value. The value will be the selected option, or an array of options in case `isMulti` is `true`.
|
|
190
|
+
*/
|
|
56
191
|
onChange?: (event: TCustomEvent, info: ActionMeta<unknown>) => void;
|
|
192
|
+
/**
|
|
193
|
+
* Handle focus events on the control
|
|
194
|
+
* <br>
|
|
195
|
+
* [Props from React select was used](https://react-select.com/props#creatable-props)
|
|
196
|
+
*/
|
|
57
197
|
onFocus?: ReactSelectCreatableProps['onFocus'];
|
|
198
|
+
/**
|
|
199
|
+
* Handle change events on the input
|
|
200
|
+
* <br>
|
|
201
|
+
* [Props from React select was used](https://react-select.com/props#creatable-props)
|
|
202
|
+
*/
|
|
58
203
|
onInputChange?: ReactSelectCreatableProps['onInputChange'];
|
|
204
|
+
/**
|
|
205
|
+
* Array of options that populate the select menu
|
|
206
|
+
*/
|
|
59
207
|
options?: TOptions;
|
|
208
|
+
/**
|
|
209
|
+
* Placeholder text for the select value
|
|
210
|
+
* <br>
|
|
211
|
+
* [Props from React select was used](https://react-select.com/props#creatable-props)
|
|
212
|
+
*/
|
|
60
213
|
placeholder?: ReactSelectCreatableProps['placeholder'];
|
|
214
|
+
/**
|
|
215
|
+
* Use this property to reduce the paddings of the component for a ui compact variant
|
|
216
|
+
*/
|
|
61
217
|
isCondensed?: boolean;
|
|
218
|
+
/**
|
|
219
|
+
* Sets the tabIndex attribute on the input
|
|
220
|
+
* <br>
|
|
221
|
+
* [Props from React select was used](https://react-select.com/props#creatable-props)
|
|
222
|
+
*/
|
|
62
223
|
tabIndex?: ReactSelectCreatableProps['tabIndex'];
|
|
224
|
+
/**
|
|
225
|
+
* Select the currently focused option when the user presses tab
|
|
226
|
+
* <br>
|
|
227
|
+
* [Props from React select was used](https://react-select.com/props#creatable-props)
|
|
228
|
+
*/
|
|
63
229
|
tabSelectsValue?: ReactSelectCreatableProps['tabSelectsValue'];
|
|
230
|
+
/**
|
|
231
|
+
* The value of the select; reflected by the selected option
|
|
232
|
+
* <br>
|
|
233
|
+
* [Props from React select was used](https://react-select.com/props#creatable-props)
|
|
234
|
+
*/
|
|
64
235
|
value?: ReactSelectCreatableProps['value'];
|
|
236
|
+
/**
|
|
237
|
+
* Determines if option groups will be separated by a divider
|
|
238
|
+
*/
|
|
65
239
|
showOptionGroupDivider?: boolean;
|
|
240
|
+
/**
|
|
241
|
+
* Allow options to be created while the isLoading prop is true. Useful to prevent the "create new ..." option being displayed while async results are still being loaded.
|
|
242
|
+
* <br>
|
|
243
|
+
* [Props from React select was used](https://react-select.com/props#creatable-props)
|
|
244
|
+
*/
|
|
66
245
|
allowCreateWhileLoading?: ReactSelectCreatableProps['allowCreateWhileLoading'];
|
|
246
|
+
/**
|
|
247
|
+
* Gets the label for the "create new ..." option in the menu. Is given the current input value.
|
|
248
|
+
* <br>
|
|
249
|
+
* [Props from React select was used](https://react-select.com/props#creatable-props)
|
|
250
|
+
*/
|
|
67
251
|
formatCreateLabel?: ReactSelectCreatableProps['formatCreateLabel'];
|
|
252
|
+
/**
|
|
253
|
+
* Determines whether the "create new ..." option should be displayed based on the current input value, select value and options array.
|
|
254
|
+
* <br>
|
|
255
|
+
* [Props from React select was used](https://react-select.com/props#creatable-props)
|
|
256
|
+
*/
|
|
68
257
|
isValidNewOption?: ReactSelectCreatableProps['isValidNewOption'];
|
|
258
|
+
/**
|
|
259
|
+
* Returns the data for the new option when it is created. Used to display the value, and is passed to onChange.
|
|
260
|
+
* <br>
|
|
261
|
+
* [Props from React select was used](https://react-select.com/props#creatable-props)
|
|
262
|
+
*/
|
|
69
263
|
getNewOptionData?: ReactSelectCreatableProps['getNewOptionData'];
|
|
264
|
+
/**
|
|
265
|
+
* If provided, this will be called with the input value when a new option is created, and onChange will not be called. Use this when you need more control over what happens when new options are created.
|
|
266
|
+
* <br>
|
|
267
|
+
* [Props from React select was used](https://react-select.com/props#creatable-props)
|
|
268
|
+
*/
|
|
70
269
|
onCreateOption?: ReactSelectCreatableProps['onCreateOption'];
|
|
270
|
+
/**
|
|
271
|
+
* Sets the position of the createOption element in your options list.
|
|
272
|
+
* <br>
|
|
273
|
+
* [Props from React select was used](https://react-select.com/props#creatable-props)
|
|
274
|
+
*/
|
|
71
275
|
createOptionPosition?: ReactSelectCreatableProps['createOptionPosition'];
|
|
276
|
+
/**
|
|
277
|
+
* Title of the label
|
|
278
|
+
*/
|
|
72
279
|
title: string | ReactNode;
|
|
280
|
+
/**
|
|
281
|
+
* Hint for the label. Provides a supplementary but important information regarding the behaviour of the input (e.g warn about uniqueness of a field, when it can only be set once), whereas `description` can describe it in more depth. Can also receive a `hintIcon`.
|
|
282
|
+
*/
|
|
73
283
|
hint?: string | ReactNode;
|
|
284
|
+
/**
|
|
285
|
+
* Provides a description for the title.
|
|
286
|
+
*/
|
|
74
287
|
description?: string | ReactNode;
|
|
288
|
+
/**
|
|
289
|
+
* Function called when info button is pressed.
|
|
290
|
+
* <br>
|
|
291
|
+
* Info button will only be visible when this prop is passed.
|
|
292
|
+
*/
|
|
75
293
|
onInfoButtonClick?: () => void;
|
|
294
|
+
/**
|
|
295
|
+
* Icon to be displayed beside the hint text.
|
|
296
|
+
* <br>
|
|
297
|
+
* Will only get rendered when `hint` is passed as well.
|
|
298
|
+
*/
|
|
76
299
|
hintIcon?: ReactElement;
|
|
300
|
+
/**
|
|
301
|
+
* Badge to be displayed beside the label.
|
|
302
|
+
* <br>
|
|
303
|
+
* Might be used to display additional information about the content of the field (E.g verified email)
|
|
304
|
+
*/
|
|
77
305
|
badge?: ReactNode;
|
|
306
|
+
/**
|
|
307
|
+
* Icon to display on the left of the placeholder text and selected value. Has no effect when isMulti is enabled.
|
|
308
|
+
*/
|
|
78
309
|
iconLeft?: ReactNode;
|
|
79
310
|
};
|
|
80
311
|
type TCreatableSelectFieldState = Pick<TCreatableSelectFieldProps, 'id'>;
|
|
@@ -89,6 +320,11 @@ export default class CreatableSelectField extends Component<TCreatableSelectFiel
|
|
|
89
320
|
static getDerivedStateFromProps: (props: TCreatableSelectFieldProps, state: TCreatableSelectFieldState) => {
|
|
90
321
|
id: string;
|
|
91
322
|
};
|
|
323
|
+
/**
|
|
324
|
+
* Use this function to convert the Formik `errors` object type to
|
|
325
|
+
* our custom field errors type.
|
|
326
|
+
* This is primarly useful when using TypeScript.
|
|
327
|
+
*/
|
|
92
328
|
static toFieldErrors<FormValues>(errors: unknown): TCustomFormErrors<FormValues>;
|
|
93
329
|
render(): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
94
330
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-uikit/creatable-select-field",
|
|
3
3
|
"description": "A controlled input component with validation states and a label getting a selection from the user, and where options can also be created by the user.",
|
|
4
|
-
"version": "19.
|
|
4
|
+
"version": "19.10.0",
|
|
5
5
|
"bugs": "https://github.com/commercetools/ui-kit/issues",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@babel/runtime": "^7.20.13",
|
|
23
23
|
"@babel/runtime-corejs3": "^7.20.13",
|
|
24
|
-
"@commercetools-uikit/constraints": "19.
|
|
25
|
-
"@commercetools-uikit/creatable-select-input": "19.
|
|
26
|
-
"@commercetools-uikit/design-system": "19.
|
|
27
|
-
"@commercetools-uikit/field-errors": "19.
|
|
28
|
-
"@commercetools-uikit/field-label": "19.
|
|
29
|
-
"@commercetools-uikit/field-warnings": "19.
|
|
30
|
-
"@commercetools-uikit/spacings": "19.
|
|
31
|
-
"@commercetools-uikit/utils": "19.
|
|
24
|
+
"@commercetools-uikit/constraints": "19.10.0",
|
|
25
|
+
"@commercetools-uikit/creatable-select-input": "19.10.0",
|
|
26
|
+
"@commercetools-uikit/design-system": "19.10.0",
|
|
27
|
+
"@commercetools-uikit/field-errors": "19.10.0",
|
|
28
|
+
"@commercetools-uikit/field-label": "19.10.0",
|
|
29
|
+
"@commercetools-uikit/field-warnings": "19.10.0",
|
|
30
|
+
"@commercetools-uikit/spacings": "19.10.0",
|
|
31
|
+
"@commercetools-uikit/utils": "19.10.0",
|
|
32
32
|
"@emotion/react": "^11.10.5",
|
|
33
33
|
"@emotion/styled": "^11.10.5",
|
|
34
34
|
"prop-types": "15.8.1",
|