@orfium/ictinus 4.40.0 → 4.41.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.
@@ -36,6 +36,8 @@ export declare type Props = {
36
36
  isLoading?: boolean;
37
37
  /** if options list is virtualized */
38
38
  isVirtualized?: boolean;
39
+ /** A callback that's called when the user clicks the 'clear' icon */
40
+ onClear?: () => void;
39
41
  } & TextFieldProps;
40
42
  declare const Select: React.ForwardRefExoticComponent<{
41
43
  /** The function that is used to return the selected options */
@@ -65,6 +67,8 @@ declare const Select: React.ForwardRefExoticComponent<{
65
67
  isLoading?: boolean | undefined;
66
68
  /** if options list is virtualized */
67
69
  isVirtualized?: boolean | undefined;
70
+ /** A callback that's called when the user clicks the 'clear' icon */
71
+ onClear?: (() => void) | undefined;
68
72
  } & {
69
73
  id?: string | undefined;
70
74
  onBlur?: React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
@@ -29,7 +29,7 @@ var _Loader = _interopRequireDefault(require("../Loader"));
29
29
 
30
30
  var _react2 = require("@emotion/react");
31
31
 
32
- var _excluded = ["handleSelectedOption", "defaultValue", "selectedOption", "multi", "options", "isAsync", "isLoading", "asyncSearch", "status", "minCharactersToSearch", "highlightSearch", "isSearchable", "isVirtualized", "styleType", "disabled", "locked", "dataTestId"];
32
+ var _excluded = ["handleSelectedOption", "defaultValue", "selectedOption", "multi", "options", "isAsync", "isLoading", "asyncSearch", "status", "minCharactersToSearch", "highlightSearch", "isSearchable", "isVirtualized", "styleType", "disabled", "locked", "dataTestId", "onClear"];
33
33
 
34
34
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
35
35
 
@@ -78,6 +78,7 @@ var Select = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
78
78
  disabled = _ref.disabled,
79
79
  locked = _ref.locked,
80
80
  dataTestId = _ref.dataTestId,
81
+ onClear = _ref.onClear,
81
82
  restInputProps = _objectWithoutPropertiesLoose(_ref, _excluded);
82
83
 
83
84
  var theme = (0, _useTheme["default"])();
@@ -175,8 +176,12 @@ var Select = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
175
176
  setSearchValue('');
176
177
  setInputValue(emptyValue);
177
178
  asyncSearch('');
179
+
180
+ if (onClear) {
181
+ onClear();
182
+ }
178
183
  }
179
- }, [asyncSearch, inputValue.value, isSearchable, open, searchValue]);
184
+ }, [asyncSearch, inputValue.value, isSearchable, onClear, open, searchValue]);
180
185
 
181
186
  var rightIconRender = (0, _react.useMemo)(function () {
182
187
  return (0, _react2.jsx)("div", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orfium/ictinus",
3
- "version": "4.40.0",
3
+ "version": "4.41.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "license": "MIT",