@commercetools-uikit/search-text-input 15.12.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
|
}
|
|
@@ -175,7 +172,7 @@ var SearchTextInput = function SearchTextInput(props) {
|
|
|
175
172
|
max: props.horizontalConstraint,
|
|
176
173
|
children: jsxRuntime.jsxs("div", {
|
|
177
174
|
css: getSearchTextInputContainerStyles(props),
|
|
178
|
-
children: [jsxRuntime.jsx("input", _objectSpread({
|
|
175
|
+
children: [jsxRuntime.jsx("input", _objectSpread(_objectSpread({
|
|
179
176
|
id: props.id,
|
|
180
177
|
name: props.name,
|
|
181
178
|
type: "text",
|
|
@@ -192,8 +189,15 @@ 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)
|
|
196
|
-
|
|
192
|
+
css: getSearchTextInputStyles(props),
|
|
193
|
+
ref: forwardedRef
|
|
194
|
+
}, utils.filterDataAttributes(props)), {}, {
|
|
195
|
+
onKeyDown: function onKeyDown(event) {
|
|
196
|
+
if (!props.isReadOnly && event.key === 'Enter') {
|
|
197
|
+
handleSubmit(event);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
})), props.isClearable && searchValue && !props.isDisabled && !props.isReadOnly && jsxRuntime.jsx(SecondaryIconButton__default["default"], {
|
|
197
201
|
icon: jsxRuntime.jsx(icons.CloseIcon, {
|
|
198
202
|
size: "medium"
|
|
199
203
|
}),
|
|
@@ -208,40 +212,19 @@ var SearchTextInput = function SearchTextInput(props) {
|
|
|
208
212
|
})]
|
|
209
213
|
})
|
|
210
214
|
});
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
SearchTextInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
214
|
-
id: _pt__default["default"].string,
|
|
215
|
-
autoComplete: _pt__default["default"].string,
|
|
216
|
-
'aria-invalid': _pt__default["default"].bool,
|
|
217
|
-
'aria-errormessage': _pt__default["default"].string,
|
|
218
|
-
name: _pt__default["default"].string,
|
|
219
|
-
value: _pt__default["default"].string.isRequired,
|
|
220
|
-
onChange: _pt__default["default"].func,
|
|
221
|
-
onBlur: _pt__default["default"].func,
|
|
222
|
-
onFocus: _pt__default["default"].func,
|
|
223
|
-
onSubmit: _pt__default["default"].func.isRequired,
|
|
224
|
-
onReset: _pt__default["default"].func.isRequired,
|
|
225
|
-
isAutofocussed: _pt__default["default"].bool,
|
|
226
|
-
isDisabled: _pt__default["default"].bool,
|
|
227
|
-
isReadOnly: _pt__default["default"].bool,
|
|
228
|
-
hasError: _pt__default["default"].bool,
|
|
229
|
-
hasWarning: _pt__default["default"].bool,
|
|
230
|
-
placeholder: _pt__default["default"].string,
|
|
231
|
-
isClearable: _pt__default["default"].bool,
|
|
232
|
-
horizontalConstraint: _pt__default["default"].oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'])
|
|
233
|
-
} : {};
|
|
215
|
+
});
|
|
234
216
|
SearchTextInput.displayName = 'SearchTextInput';
|
|
235
217
|
SearchTextInput.defaultProps = defaultProps;
|
|
236
218
|
|
|
237
|
-
|
|
219
|
+
var isEmpty = function isEmpty(value) {
|
|
238
220
|
return !value || _trimInstanceProperty__default["default"](value).call(value).length === 0;
|
|
239
221
|
};
|
|
240
222
|
|
|
223
|
+
SearchTextInput.isEmpty = isEmpty;
|
|
241
224
|
var SearchTextInput$1 = SearchTextInput;
|
|
242
225
|
|
|
243
226
|
// NOTE: This string will be replaced on build time with the package version.
|
|
244
|
-
var version = "15.
|
|
227
|
+
var version = "15.13.1";
|
|
245
228
|
|
|
246
229
|
exports["default"] = SearchTextInput$1;
|
|
247
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 || ''),
|
|
@@ -165,7 +163,7 @@ var SearchTextInput = function SearchTextInput(props) {
|
|
|
165
163
|
max: props.horizontalConstraint,
|
|
166
164
|
children: jsxRuntime.jsxs("div", {
|
|
167
165
|
css: getSearchTextInputContainerStyles(props),
|
|
168
|
-
children: [jsxRuntime.jsx("input", _objectSpread({
|
|
166
|
+
children: [jsxRuntime.jsx("input", _objectSpread(_objectSpread({
|
|
169
167
|
id: props.id,
|
|
170
168
|
name: props.name,
|
|
171
169
|
type: "text",
|
|
@@ -182,8 +180,15 @@ 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)
|
|
186
|
-
|
|
183
|
+
css: getSearchTextInputStyles(props),
|
|
184
|
+
ref: forwardedRef
|
|
185
|
+
}, utils.filterDataAttributes(props)), {}, {
|
|
186
|
+
onKeyDown: function onKeyDown(event) {
|
|
187
|
+
if (!props.isReadOnly && event.key === 'Enter') {
|
|
188
|
+
handleSubmit(event);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
})), props.isClearable && searchValue && !props.isDisabled && !props.isReadOnly && jsxRuntime.jsx(SecondaryIconButton__default["default"], {
|
|
187
192
|
icon: jsxRuntime.jsx(icons.CloseIcon, {
|
|
188
193
|
size: "medium"
|
|
189
194
|
}),
|
|
@@ -198,20 +203,19 @@ var SearchTextInput = function SearchTextInput(props) {
|
|
|
198
203
|
})]
|
|
199
204
|
})
|
|
200
205
|
});
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
SearchTextInput.propTypes = {};
|
|
206
|
+
});
|
|
204
207
|
SearchTextInput.displayName = 'SearchTextInput';
|
|
205
208
|
SearchTextInput.defaultProps = defaultProps;
|
|
206
209
|
|
|
207
|
-
|
|
210
|
+
var isEmpty = function isEmpty(value) {
|
|
208
211
|
return !value || _trimInstanceProperty__default["default"](value).call(value).length === 0;
|
|
209
212
|
};
|
|
210
213
|
|
|
214
|
+
SearchTextInput.isEmpty = isEmpty;
|
|
211
215
|
var SearchTextInput$1 = SearchTextInput;
|
|
212
216
|
|
|
213
217
|
// NOTE: This string will be replaced on build time with the package version.
|
|
214
|
-
var version = "15.
|
|
218
|
+
var version = "15.13.1";
|
|
215
219
|
|
|
216
220
|
exports["default"] = SearchTextInput$1;
|
|
217
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
|
}
|
|
@@ -156,7 +154,7 @@ var SearchTextInput = function SearchTextInput(props) {
|
|
|
156
154
|
max: props.horizontalConstraint,
|
|
157
155
|
children: jsxs("div", {
|
|
158
156
|
css: getSearchTextInputContainerStyles(props),
|
|
159
|
-
children: [jsx("input", _objectSpread({
|
|
157
|
+
children: [jsx("input", _objectSpread(_objectSpread({
|
|
160
158
|
id: props.id,
|
|
161
159
|
name: props.name,
|
|
162
160
|
type: "text",
|
|
@@ -173,8 +171,15 @@ 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)
|
|
177
|
-
|
|
174
|
+
css: getSearchTextInputStyles(props),
|
|
175
|
+
ref: forwardedRef
|
|
176
|
+
}, filterDataAttributes(props)), {}, {
|
|
177
|
+
onKeyDown: function onKeyDown(event) {
|
|
178
|
+
if (!props.isReadOnly && event.key === 'Enter') {
|
|
179
|
+
handleSubmit(event);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
})), props.isClearable && searchValue && !props.isDisabled && !props.isReadOnly && jsx(SecondaryIconButton, {
|
|
178
183
|
icon: jsx(CloseIcon, {
|
|
179
184
|
size: "medium"
|
|
180
185
|
}),
|
|
@@ -189,39 +194,18 @@ var SearchTextInput = function SearchTextInput(props) {
|
|
|
189
194
|
})]
|
|
190
195
|
})
|
|
191
196
|
});
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
SearchTextInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
195
|
-
id: _pt.string,
|
|
196
|
-
autoComplete: _pt.string,
|
|
197
|
-
'aria-invalid': _pt.bool,
|
|
198
|
-
'aria-errormessage': _pt.string,
|
|
199
|
-
name: _pt.string,
|
|
200
|
-
value: _pt.string.isRequired,
|
|
201
|
-
onChange: _pt.func,
|
|
202
|
-
onBlur: _pt.func,
|
|
203
|
-
onFocus: _pt.func,
|
|
204
|
-
onSubmit: _pt.func.isRequired,
|
|
205
|
-
onReset: _pt.func.isRequired,
|
|
206
|
-
isAutofocussed: _pt.bool,
|
|
207
|
-
isDisabled: _pt.bool,
|
|
208
|
-
isReadOnly: _pt.bool,
|
|
209
|
-
hasError: _pt.bool,
|
|
210
|
-
hasWarning: _pt.bool,
|
|
211
|
-
placeholder: _pt.string,
|
|
212
|
-
isClearable: _pt.bool,
|
|
213
|
-
horizontalConstraint: _pt.oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'])
|
|
214
|
-
} : {};
|
|
197
|
+
});
|
|
215
198
|
SearchTextInput.displayName = 'SearchTextInput';
|
|
216
199
|
SearchTextInput.defaultProps = defaultProps;
|
|
217
200
|
|
|
218
|
-
|
|
201
|
+
var isEmpty = function isEmpty(value) {
|
|
219
202
|
return !value || _trimInstanceProperty(value).call(value).length === 0;
|
|
220
203
|
};
|
|
221
204
|
|
|
205
|
+
SearchTextInput.isEmpty = isEmpty;
|
|
222
206
|
var SearchTextInput$1 = SearchTextInput;
|
|
223
207
|
|
|
224
208
|
// NOTE: This string will be replaced on build time with the package version.
|
|
225
|
-
var version = "15.
|
|
209
|
+
var version = "15.13.1";
|
|
226
210
|
|
|
227
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
|
-
|
|
24
|
-
|
|
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.
|
|
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.
|
|
25
|
-
"@commercetools-uikit/design-system": "15.
|
|
26
|
-
"@commercetools-uikit/icons": "15.
|
|
27
|
-
"@commercetools-uikit/input-utils": "15.
|
|
28
|
-
"@commercetools-uikit/secondary-icon-button": "15.
|
|
29
|
-
"@commercetools-uikit/utils": "15.
|
|
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"
|