@commercetools-uikit/search-text-input 15.13.0 → 15.13.1

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.
@@ -12,7 +12,6 @@ var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/ob
12
12
  var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
13
13
  var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
14
14
  var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
15
- var _pt = require('prop-types');
16
15
  var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
17
16
  var react$1 = require('react');
18
17
  var SecondaryIconButton = require('@commercetools-uikit/secondary-icon-button');
@@ -34,7 +33,6 @@ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachIns
34
33
  var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
35
34
  var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
36
35
  var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
37
- var _pt__default = /*#__PURE__*/_interopDefault(_pt);
38
36
  var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
39
37
  var SecondaryIconButton__default = /*#__PURE__*/_interopDefault(SecondaryIconButton);
40
38
  var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
@@ -136,8 +134,7 @@ var defaultProps = {
136
134
  horizontalConstraint: 'scale',
137
135
  isClearable: true
138
136
  };
139
-
140
- var SearchTextInput = function SearchTextInput(props) {
137
+ var SearchTextInput = /*#__PURE__*/react$1.forwardRef(function (props, forwardedRef) {
141
138
  if (!props.isReadOnly) {
142
139
  process.env.NODE_ENV !== "production" ? utils.warning(typeof props.onChange === 'function', 'TextInput: `onChange` is required when is not read only.') : void 0;
143
140
  }
@@ -192,7 +189,8 @@ var SearchTextInput = function SearchTextInput(props) {
192
189
  contentEditable: !props.isReadOnly,
193
190
  "aria-invalid": props['aria-invalid'],
194
191
  "aria-errormessage": props['aria-errormessage'],
195
- css: getSearchTextInputStyles(props)
192
+ css: getSearchTextInputStyles(props),
193
+ ref: forwardedRef
196
194
  }, utils.filterDataAttributes(props)), {}, {
197
195
  onKeyDown: function onKeyDown(event) {
198
196
  if (!props.isReadOnly && event.key === 'Enter') {
@@ -214,40 +212,19 @@ var SearchTextInput = function SearchTextInput(props) {
214
212
  })]
215
213
  })
216
214
  });
217
- };
218
-
219
- SearchTextInput.propTypes = process.env.NODE_ENV !== "production" ? {
220
- id: _pt__default["default"].string,
221
- autoComplete: _pt__default["default"].string,
222
- 'aria-invalid': _pt__default["default"].bool,
223
- 'aria-errormessage': _pt__default["default"].string,
224
- name: _pt__default["default"].string,
225
- value: _pt__default["default"].string.isRequired,
226
- onChange: _pt__default["default"].func,
227
- onBlur: _pt__default["default"].func,
228
- onFocus: _pt__default["default"].func,
229
- onSubmit: _pt__default["default"].func.isRequired,
230
- onReset: _pt__default["default"].func.isRequired,
231
- isAutofocussed: _pt__default["default"].bool,
232
- isDisabled: _pt__default["default"].bool,
233
- isReadOnly: _pt__default["default"].bool,
234
- hasError: _pt__default["default"].bool,
235
- hasWarning: _pt__default["default"].bool,
236
- placeholder: _pt__default["default"].string,
237
- isClearable: _pt__default["default"].bool,
238
- horizontalConstraint: _pt__default["default"].oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'])
239
- } : {};
215
+ });
240
216
  SearchTextInput.displayName = 'SearchTextInput';
241
217
  SearchTextInput.defaultProps = defaultProps;
242
218
 
243
- SearchTextInput.isEmpty = function (value) {
219
+ var isEmpty = function isEmpty(value) {
244
220
  return !value || _trimInstanceProperty__default["default"](value).call(value).length === 0;
245
221
  };
246
222
 
223
+ SearchTextInput.isEmpty = isEmpty;
247
224
  var SearchTextInput$1 = SearchTextInput;
248
225
 
249
226
  // NOTE: This string will be replaced on build time with the package version.
250
- var version = "15.13.0";
227
+ var version = "15.13.1";
251
228
 
252
229
  exports["default"] = SearchTextInput$1;
253
230
  exports.version = version;
@@ -12,7 +12,6 @@ var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/ob
12
12
  var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
13
13
  var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
14
14
  var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
15
- require('prop-types');
16
15
  var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
17
16
  var react$1 = require('react');
18
17
  var SecondaryIconButton = require('@commercetools-uikit/secondary-icon-button');
@@ -128,8 +127,7 @@ var defaultProps = {
128
127
  horizontalConstraint: 'scale',
129
128
  isClearable: true
130
129
  };
131
-
132
- var SearchTextInput = function SearchTextInput(props) {
130
+ var SearchTextInput = /*#__PURE__*/react$1.forwardRef(function (props, forwardedRef) {
133
131
  if (!props.isReadOnly) ;
134
132
 
135
133
  var _useState = react$1.useState(props.value || ''),
@@ -182,7 +180,8 @@ var SearchTextInput = function SearchTextInput(props) {
182
180
  contentEditable: !props.isReadOnly,
183
181
  "aria-invalid": props['aria-invalid'],
184
182
  "aria-errormessage": props['aria-errormessage'],
185
- css: getSearchTextInputStyles(props)
183
+ css: getSearchTextInputStyles(props),
184
+ ref: forwardedRef
186
185
  }, utils.filterDataAttributes(props)), {}, {
187
186
  onKeyDown: function onKeyDown(event) {
188
187
  if (!props.isReadOnly && event.key === 'Enter') {
@@ -204,20 +203,19 @@ var SearchTextInput = function SearchTextInput(props) {
204
203
  })]
205
204
  })
206
205
  });
207
- };
208
-
209
- SearchTextInput.propTypes = {};
206
+ });
210
207
  SearchTextInput.displayName = 'SearchTextInput';
211
208
  SearchTextInput.defaultProps = defaultProps;
212
209
 
213
- SearchTextInput.isEmpty = function (value) {
210
+ var isEmpty = function isEmpty(value) {
214
211
  return !value || _trimInstanceProperty__default["default"](value).call(value).length === 0;
215
212
  };
216
213
 
214
+ SearchTextInput.isEmpty = isEmpty;
217
215
  var SearchTextInput$1 = SearchTextInput;
218
216
 
219
217
  // NOTE: This string will be replaced on build time with the package version.
220
- var version = "15.13.0";
218
+ var version = "15.13.1";
221
219
 
222
220
  exports["default"] = SearchTextInput$1;
223
221
  exports.version = version;
@@ -8,9 +8,8 @@ import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/obje
8
8
  import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
9
9
  import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
10
10
  import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
11
- import _pt from 'prop-types';
12
11
  import _trimInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/trim';
13
- import { useState } from 'react';
12
+ import { forwardRef, useState } from 'react';
14
13
  import SecondaryIconButton from '@commercetools-uikit/secondary-icon-button';
15
14
  import Constraints from '@commercetools-uikit/constraints';
16
15
  import { CloseIcon, SearchIcon } from '@commercetools-uikit/icons';
@@ -117,8 +116,7 @@ var defaultProps = {
117
116
  horizontalConstraint: 'scale',
118
117
  isClearable: true
119
118
  };
120
-
121
- var SearchTextInput = function SearchTextInput(props) {
119
+ var SearchTextInput = /*#__PURE__*/forwardRef(function (props, forwardedRef) {
122
120
  if (!props.isReadOnly) {
123
121
  process.env.NODE_ENV !== "production" ? warning(typeof props.onChange === 'function', 'TextInput: `onChange` is required when is not read only.') : void 0;
124
122
  }
@@ -173,7 +171,8 @@ var SearchTextInput = function SearchTextInput(props) {
173
171
  contentEditable: !props.isReadOnly,
174
172
  "aria-invalid": props['aria-invalid'],
175
173
  "aria-errormessage": props['aria-errormessage'],
176
- css: getSearchTextInputStyles(props)
174
+ css: getSearchTextInputStyles(props),
175
+ ref: forwardedRef
177
176
  }, filterDataAttributes(props)), {}, {
178
177
  onKeyDown: function onKeyDown(event) {
179
178
  if (!props.isReadOnly && event.key === 'Enter') {
@@ -195,39 +194,18 @@ var SearchTextInput = function SearchTextInput(props) {
195
194
  })]
196
195
  })
197
196
  });
198
- };
199
-
200
- SearchTextInput.propTypes = process.env.NODE_ENV !== "production" ? {
201
- id: _pt.string,
202
- autoComplete: _pt.string,
203
- 'aria-invalid': _pt.bool,
204
- 'aria-errormessage': _pt.string,
205
- name: _pt.string,
206
- value: _pt.string.isRequired,
207
- onChange: _pt.func,
208
- onBlur: _pt.func,
209
- onFocus: _pt.func,
210
- onSubmit: _pt.func.isRequired,
211
- onReset: _pt.func.isRequired,
212
- isAutofocussed: _pt.bool,
213
- isDisabled: _pt.bool,
214
- isReadOnly: _pt.bool,
215
- hasError: _pt.bool,
216
- hasWarning: _pt.bool,
217
- placeholder: _pt.string,
218
- isClearable: _pt.bool,
219
- horizontalConstraint: _pt.oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'])
220
- } : {};
197
+ });
221
198
  SearchTextInput.displayName = 'SearchTextInput';
222
199
  SearchTextInput.defaultProps = defaultProps;
223
200
 
224
- SearchTextInput.isEmpty = function (value) {
201
+ var isEmpty = function isEmpty(value) {
225
202
  return !value || _trimInstanceProperty(value).call(value).length === 0;
226
203
  };
227
204
 
205
+ SearchTextInput.isEmpty = isEmpty;
228
206
  var SearchTextInput$1 = SearchTextInput;
229
207
 
230
208
  // NOTE: This string will be replaced on build time with the package version.
231
- var version = "15.13.0";
209
+ var version = "15.13.1";
232
210
 
233
211
  export { SearchTextInput$1 as default, version };
@@ -1,4 +1,4 @@
1
- import { type FocusEventHandler, type ChangeEventHandler } from 'react';
1
+ import { type FocusEventHandler, type ChangeEventHandler, type ForwardRefExoticComponent, type RefAttributes } from 'react';
2
2
  export type TSearchTextInputProps = {
3
3
  id?: string;
4
4
  autoComplete?: string;
@@ -20,10 +20,9 @@ export type TSearchTextInputProps = {
20
20
  isClearable?: boolean;
21
21
  horizontalConstraint?: 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 'scale' | 'auto';
22
22
  };
23
- declare const SearchTextInput: {
24
- (props: TSearchTextInputProps): import("@emotion/react/jsx-runtime").JSX.Element;
25
- displayName: string;
26
- defaultProps: Pick<TSearchTextInputProps, "isClearable" | "horizontalConstraint">;
27
- isEmpty(value: TSearchTextInputProps['value']): boolean;
23
+ type StaticProps = {
24
+ isEmpty: typeof isEmpty;
28
25
  };
26
+ declare const SearchTextInput: ForwardRefExoticComponent<TSearchTextInputProps & RefAttributes<HTMLInputElement>> & Partial<StaticProps>;
27
+ declare const isEmpty: (value: TSearchTextInputProps['value']) => boolean;
29
28
  export default SearchTextInput;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@commercetools-uikit/search-text-input",
3
3
  "description": "A controlled search text input component for single-line strings with validation states.",
4
- "version": "15.13.0",
4
+ "version": "15.13.1",
5
5
  "bugs": "https://github.com/commercetools/ui-kit/issues",
6
6
  "repository": {
7
7
  "type": "git",
@@ -21,12 +21,12 @@
21
21
  "dependencies": {
22
22
  "@babel/runtime": "^7.20.13",
23
23
  "@babel/runtime-corejs3": "^7.20.13",
24
- "@commercetools-uikit/constraints": "15.13.0",
25
- "@commercetools-uikit/design-system": "15.13.0",
26
- "@commercetools-uikit/icons": "15.13.0",
27
- "@commercetools-uikit/input-utils": "15.13.0",
28
- "@commercetools-uikit/secondary-icon-button": "15.13.0",
29
- "@commercetools-uikit/utils": "15.13.0",
24
+ "@commercetools-uikit/constraints": "15.13.1",
25
+ "@commercetools-uikit/design-system": "15.13.1",
26
+ "@commercetools-uikit/icons": "15.13.1",
27
+ "@commercetools-uikit/input-utils": "15.13.1",
28
+ "@commercetools-uikit/secondary-icon-button": "15.13.1",
29
+ "@commercetools-uikit/utils": "15.13.1",
30
30
  "@emotion/react": "^11.10.5",
31
31
  "@emotion/styled": "^11.10.5",
32
32
  "prop-types": "15.8.1"