@commercetools-uikit/search-select-field 14.0.1 → 14.0.6

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 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) || | Called with a fake event when value changes.&#xA;<br />&#xA;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`. |
114
+ | `onChange` | `Function`<br/>[See signature.](#signature-onChange) | | | Called with a fake event when value changes.&#xA;<br />&#xA;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&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
116
116
  | `onInputChange` | `AsyncProps['onInputChange']` | | | Handle change events on the input&#xA;<br>&#xA;[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&#xA;<br>&#xA;[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: TEvent) => void
139
+ (event: TCustomEvent) => void
140
140
  ```
141
141
 
142
142
  ### Signature `onChange`
143
143
 
144
144
  ```ts
145
- (event: TEvent, info: ActionMeta<unknown>) => void
145
+ (event: TCustomEvent, info: ActionMeta<unknown>) => void
146
146
  ```
147
147
 
148
148
  ### Signature `renderError`
@@ -62,13 +62,17 @@ 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
  }
68
72
 
69
73
  if (props.isMulti) {
70
74
  process.env.NODE_ENV !== "production" ? utils.warning(_Array$isArray__default["default"](props.value), 'SearchSelectField: `value` is expected to be an array of string when isMulti is true') : void 0;
71
- process.env.NODE_ENV !== "production" ? utils.warning(_Array$isArray__default["default"](props.touched), 'SearchSelectField: `touched` is expected to be an array of boolean when isMulti is true') : void 0;
75
+ process.env.NODE_ENV !== "production" ? utils.warning(typeof props.touched === 'undefined' || _Array$isArray__default["default"](props.touched), 'SearchSelectField: `touched` is expected to be an array of boolean when isMulti is true') : void 0;
72
76
  }
73
77
 
74
78
  return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
@@ -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.isRequired,
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.1";
180
+ var version = "14.0.6";
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.1";
146
+ var version = "14.0.6";
145
147
 
146
148
  exports["default"] = SearchSelectField$1;
147
149
  exports.version = version;
@@ -38,13 +38,17 @@ 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
  }
44
48
 
45
49
  if (props.isMulti) {
46
50
  process.env.NODE_ENV !== "production" ? warning(_Array$isArray(props.value), 'SearchSelectField: `value` is expected to be an array of string when isMulti is true') : void 0;
47
- process.env.NODE_ENV !== "production" ? warning(_Array$isArray(props.touched), 'SearchSelectField: `touched` is expected to be an array of boolean when isMulti is true') : void 0;
51
+ process.env.NODE_ENV !== "production" ? warning(typeof props.touched === 'undefined' || _Array$isArray(props.touched), 'SearchSelectField: `touched` is expected to be an array of boolean when isMulti is true') : void 0;
48
52
  }
49
53
 
50
54
  return jsx(Constraints.Horizontal, {
@@ -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.isRequired,
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.1";
156
+ var version = "14.0.6";
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 TEvent = {
5
+ declare type TCustomEvent = {
6
6
  target: {
7
- name?: string;
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: TEvent) => void;
44
- onChange: (event: TEvent, info: ActionMeta<unknown>) => void;
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.1",
4
+ "version": "14.0.6",
5
5
  "bugs": "https://github.com/commercetools/ui-kit/issues",
6
6
  "repository": {
7
7
  "type": "git",
@@ -24,10 +24,10 @@
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.1",
28
- "@commercetools-uikit/hooks": "14.0.1",
29
- "@commercetools-uikit/search-select-input": "14.0.1",
30
- "@commercetools-uikit/spacings": "14.0.1",
27
+ "@commercetools-uikit/field-label": "14.0.6",
28
+ "@commercetools-uikit/hooks": "14.0.3",
29
+ "@commercetools-uikit/search-select-input": "14.0.6",
30
+ "@commercetools-uikit/spacings": "14.0.6",
31
31
  "@commercetools-uikit/utils": "14.0.1",
32
32
  "@emotion/react": "^11.4.0",
33
33
  "@emotion/styled": "^11.3.0",