@commercetools-uikit/search-select-field 14.0.1 → 14.0.2
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/README.md +3 -3
- package/dist/commercetools-uikit-search-select-field.cjs.dev.js +6 -2
- package/dist/commercetools-uikit-search-select-field.cjs.prod.js +3 -1
- package/dist/commercetools-uikit-search-select-field.esm.js +6 -2
- package/dist/declarations/src/search-select-field.d.ts +5 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -111,7 +111,7 @@ export default Example;
|
|
|
111
111
|
| `menuShouldBlockScroll` | `boolean` | | | whether the menu should block scroll while open |
|
|
112
112
|
| `showOptionGroupDivider` | `boolean` | | | Determines if option groups will be separated by a divider |
|
|
113
113
|
| `onBlur` | `Function`<br/>[See signature.](#signature-onBlur) | | | Handle blur events on the control |
|
|
114
|
-
| `onChange` | `Function`<br/>[See signature.](#signature-onChange) |
|
|
114
|
+
| `onChange` | `Function`<br/>[See signature.](#signature-onChange) | | | Called with a fake event when value changes.
<br />
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`. |
|
|
115
115
|
| `onFocus` | `AsyncProps['onFocus']` | | | Handle focus events on the control
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
116
116
|
| `onInputChange` | `AsyncProps['onInputChange']` | | | Handle change events on the input
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
117
117
|
| `tabSelectsValue` | `AsyncProps['tabSelectsValue']` | | | Select the currently focused option when the user presses tab
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
@@ -136,13 +136,13 @@ export default Example;
|
|
|
136
136
|
### Signature `onBlur`
|
|
137
137
|
|
|
138
138
|
```ts
|
|
139
|
-
(event:
|
|
139
|
+
(event: TCustomEvent) => void
|
|
140
140
|
```
|
|
141
141
|
|
|
142
142
|
### Signature `onChange`
|
|
143
143
|
|
|
144
144
|
```ts
|
|
145
|
-
(event:
|
|
145
|
+
(event: TCustomEvent, info: ActionMeta<unknown>) => void
|
|
146
146
|
```
|
|
147
147
|
|
|
148
148
|
### Signature `renderError`
|
|
@@ -62,6 +62,10 @@ var SearchSelectField = function SearchSelectField(props) {
|
|
|
62
62
|
var hasError = Boolean(props.touched) && hasErrors(props.errors);
|
|
63
63
|
var id = hooks.useFieldId(props.id, sequentialId);
|
|
64
64
|
|
|
65
|
+
if (!props.isReadOnly) {
|
|
66
|
+
process.env.NODE_ENV !== "production" ? utils.warning(typeof props.onChange === 'function', 'SearchSelectField: `onChange` is required when field is not read only.') : void 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
65
69
|
if (props.hintIcon) {
|
|
66
70
|
process.env.NODE_ENV !== "production" ? utils.warning(typeof props.hint === 'string' || /*#__PURE__*/react.isValidElement(props.hint), 'SearchSelectField: `hint` is required to be string or ReactNode if hintIcon is present') : void 0;
|
|
67
71
|
}
|
|
@@ -145,7 +149,7 @@ SearchSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
145
149
|
menuShouldBlockScroll: _pt__default["default"].bool,
|
|
146
150
|
showOptionGroupDivider: _pt__default["default"].bool,
|
|
147
151
|
onBlur: _pt__default["default"].func,
|
|
148
|
-
onChange: _pt__default["default"].func
|
|
152
|
+
onChange: _pt__default["default"].func,
|
|
149
153
|
loadingMessage: _pt__default["default"].oneOfType([_pt__default["default"].string, _pt__default["default"].func]),
|
|
150
154
|
optionType: _pt__default["default"].oneOf(['single-property', 'double-property', 'multiple-properties']),
|
|
151
155
|
errors: _pt__default["default"].objectOf(_pt__default["default"].bool),
|
|
@@ -173,7 +177,7 @@ SearchSelectField.toFieldErrors = function toFieldErrors(errors) {
|
|
|
173
177
|
var SearchSelectField$1 = SearchSelectField;
|
|
174
178
|
|
|
175
179
|
// NOTE: This string will be replaced on build time with the package version.
|
|
176
|
-
var version = "14.0.
|
|
180
|
+
var version = "14.0.2";
|
|
177
181
|
|
|
178
182
|
exports["default"] = SearchSelectField$1;
|
|
179
183
|
exports.version = version;
|
|
@@ -60,6 +60,8 @@ var SearchSelectField = function SearchSelectField(props) {
|
|
|
60
60
|
var hasError = Boolean(props.touched) && hasErrors(props.errors);
|
|
61
61
|
var id = hooks.useFieldId(props.id, sequentialId);
|
|
62
62
|
|
|
63
|
+
if (!props.isReadOnly) ;
|
|
64
|
+
|
|
63
65
|
if (props.hintIcon) ;
|
|
64
66
|
|
|
65
67
|
if (props.isMulti) ;
|
|
@@ -141,7 +143,7 @@ SearchSelectField.toFieldErrors = function toFieldErrors(errors) {
|
|
|
141
143
|
var SearchSelectField$1 = SearchSelectField;
|
|
142
144
|
|
|
143
145
|
// NOTE: This string will be replaced on build time with the package version.
|
|
144
|
-
var version = "14.0.
|
|
146
|
+
var version = "14.0.2";
|
|
145
147
|
|
|
146
148
|
exports["default"] = SearchSelectField$1;
|
|
147
149
|
exports.version = version;
|
|
@@ -38,6 +38,10 @@ var SearchSelectField = function SearchSelectField(props) {
|
|
|
38
38
|
var hasError = Boolean(props.touched) && hasErrors(props.errors);
|
|
39
39
|
var id = useFieldId(props.id, sequentialId);
|
|
40
40
|
|
|
41
|
+
if (!props.isReadOnly) {
|
|
42
|
+
process.env.NODE_ENV !== "production" ? warning(typeof props.onChange === 'function', 'SearchSelectField: `onChange` is required when field is not read only.') : void 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
41
45
|
if (props.hintIcon) {
|
|
42
46
|
process.env.NODE_ENV !== "production" ? warning(typeof props.hint === 'string' || /*#__PURE__*/isValidElement(props.hint), 'SearchSelectField: `hint` is required to be string or ReactNode if hintIcon is present') : void 0;
|
|
43
47
|
}
|
|
@@ -121,7 +125,7 @@ SearchSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
121
125
|
menuShouldBlockScroll: _pt.bool,
|
|
122
126
|
showOptionGroupDivider: _pt.bool,
|
|
123
127
|
onBlur: _pt.func,
|
|
124
|
-
onChange: _pt.func
|
|
128
|
+
onChange: _pt.func,
|
|
125
129
|
loadingMessage: _pt.oneOfType([_pt.string, _pt.func]),
|
|
126
130
|
optionType: _pt.oneOf(['single-property', 'double-property', 'multiple-properties']),
|
|
127
131
|
errors: _pt.objectOf(_pt.bool),
|
|
@@ -149,6 +153,6 @@ SearchSelectField.toFieldErrors = function toFieldErrors(errors) {
|
|
|
149
153
|
var SearchSelectField$1 = SearchSelectField;
|
|
150
154
|
|
|
151
155
|
// NOTE: This string will be replaced on build time with the package version.
|
|
152
|
-
var version = "14.0.
|
|
156
|
+
var version = "14.0.2";
|
|
153
157
|
|
|
154
158
|
export { SearchSelectField$1 as default, version };
|
|
@@ -2,9 +2,10 @@ import { type ReactNode, type MouseEvent, type KeyboardEvent, type ReactElement
|
|
|
2
2
|
import type { ActionMeta, GroupBase } from 'react-select';
|
|
3
3
|
import type { AsyncProps } from 'react-select/async';
|
|
4
4
|
declare type ReactSelectAsyncProps = AsyncProps<unknown, boolean, GroupBase<unknown>>;
|
|
5
|
-
declare type
|
|
5
|
+
declare type TCustomEvent = {
|
|
6
6
|
target: {
|
|
7
|
-
|
|
7
|
+
id?: ReactSelectAsyncProps['inputId'];
|
|
8
|
+
name?: ReactSelectAsyncProps['name'];
|
|
8
9
|
value?: unknown;
|
|
9
10
|
};
|
|
10
11
|
persist: () => void;
|
|
@@ -40,8 +41,8 @@ declare type TSearchSelectFieldProps = {
|
|
|
40
41
|
menuPortalZIndex?: number;
|
|
41
42
|
menuShouldBlockScroll?: boolean;
|
|
42
43
|
showOptionGroupDivider?: boolean;
|
|
43
|
-
onBlur?: (event:
|
|
44
|
-
onChange
|
|
44
|
+
onBlur?: (event: TCustomEvent) => void;
|
|
45
|
+
onChange?: (event: TCustomEvent, info: ActionMeta<unknown>) => void;
|
|
45
46
|
onFocus?: ReactSelectAsyncProps['onFocus'];
|
|
46
47
|
onInputChange?: ReactSelectAsyncProps['onInputChange'];
|
|
47
48
|
tabSelectsValue?: ReactSelectAsyncProps['tabSelectsValue'];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-uikit/search-select-field",
|
|
3
3
|
"description": "A search select field built on top of search select input, allowing users to asynchronously search for options",
|
|
4
|
-
"version": "14.0.
|
|
4
|
+
"version": "14.0.2",
|
|
5
5
|
"bugs": "https://github.com/commercetools/ui-kit/issues",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"@commercetools-uikit/constraints": "14.0.1",
|
|
25
25
|
"@commercetools-uikit/design-system": "14.0.0",
|
|
26
26
|
"@commercetools-uikit/field-errors": "14.0.1",
|
|
27
|
-
"@commercetools-uikit/field-label": "14.0.
|
|
27
|
+
"@commercetools-uikit/field-label": "14.0.2",
|
|
28
28
|
"@commercetools-uikit/hooks": "14.0.1",
|
|
29
|
-
"@commercetools-uikit/search-select-input": "14.0.
|
|
29
|
+
"@commercetools-uikit/search-select-input": "14.0.2",
|
|
30
30
|
"@commercetools-uikit/spacings": "14.0.1",
|
|
31
31
|
"@commercetools-uikit/utils": "14.0.1",
|
|
32
32
|
"@emotion/react": "^11.4.0",
|