@bigbinary/neetoui 5.1.6 → 5.1.7

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/index.cjs.js CHANGED
@@ -2115,6 +2115,37 @@ _curry2(function omit(names, obj) {
2115
2115
  return result;
2116
2116
  });
2117
2117
 
2118
+ /**
2119
+ * Replace a substring or regex match in a string with a replacement.
2120
+ *
2121
+ * The first two parameters correspond to the parameters of the
2122
+ * `String.prototype.replace()` function, so the second parameter can also be a
2123
+ * function.
2124
+ *
2125
+ * @func
2126
+ * @memberOf R
2127
+ * @since v0.7.0
2128
+ * @category String
2129
+ * @sig RegExp|String -> String -> String -> String
2130
+ * @param {RegExp|String} pattern A regular expression or a substring to match.
2131
+ * @param {String} replacement The string to replace the matches with.
2132
+ * @param {String} str The String to do the search and replacement in.
2133
+ * @return {String} The result.
2134
+ * @example
2135
+ *
2136
+ * R.replace('foo', 'bar', 'foo foo foo'); //=> 'bar foo foo'
2137
+ * R.replace(/foo/, 'bar', 'foo foo foo'); //=> 'bar foo foo'
2138
+ *
2139
+ * // Use the "g" (global) flag to replace all occurrences:
2140
+ * R.replace(/foo/g, 'bar', 'foo foo foo'); //=> 'bar bar bar'
2141
+ */
2142
+
2143
+ var replace$2 =
2144
+ /*#__PURE__*/
2145
+ _curry3(function replace(regex, replacement, str) {
2146
+ return str.replace(regex, replacement);
2147
+ });
2148
+
2118
2149
  /**
2119
2150
  * Converts an object into an array of key, value arrays. Only the object's
2120
2151
  * own properties are used.
@@ -20328,7 +20359,7 @@ var DatePicker = /*#__PURE__*/React$5.forwardRef(function (_ref2, ref) {
20328
20359
  });
20329
20360
  DatePicker.displayName = "DatePicker";
20330
20361
 
20331
- var _excluded$p = ["size", "type", "label", "error", "suffix", "prefix", "disabled", "helpText", "className", "nakedInput", "contentSize", "required", "maxLength", "unlimitedChars", "labelProps"];
20362
+ var _excluded$p = ["size", "type", "label", "error", "suffix", "prefix", "disabled", "helpText", "className", "nakedInput", "contentSize", "required", "maxLength", "unlimitedChars", "labelProps", "rejectCharsRegex"];
20332
20363
  var SIZES$5 = {
20333
20364
  small: "small",
20334
20365
  medium: "medium",
@@ -20364,6 +20395,7 @@ var Input$1 = /*#__PURE__*/React$5.forwardRef(function (_ref, ref) {
20364
20395
  _ref$unlimitedChars = _ref.unlimitedChars,
20365
20396
  unlimitedChars = _ref$unlimitedChars === void 0 ? false : _ref$unlimitedChars,
20366
20397
  labelProps = _ref.labelProps,
20398
+ rejectCharsRegex = _ref.rejectCharsRegex,
20367
20399
  otherProps = _objectWithoutProperties$1(_ref, _excluded$p);
20368
20400
  var _useState = React$5.useState(otherProps.value),
20369
20401
  _useState2 = _slicedToArray$2(_useState, 2),
@@ -20381,6 +20413,12 @@ var Input$1 = /*#__PURE__*/React$5.forwardRef(function (_ref, ref) {
20381
20413
  };
20382
20414
  var onChange = otherProps.onChange || onChangeInternal;
20383
20415
  var isMaxLengthPresent = !!maxLength || maxLength === 0;
20416
+ var handleRegexChange = function handleRegexChange(e) {
20417
+ var globalRegex = new RegExp(rejectCharsRegex, "g");
20418
+ e.target.value = replace$2(globalRegex, "", e.target.value);
20419
+ onChange(e);
20420
+ };
20421
+ var handleChange = rejectCharsRegex ? handleRegexChange : onChange;
20384
20422
  return /*#__PURE__*/React__default["default"].createElement("div", {
20385
20423
  className: classnames$1(["neeto-ui-input__wrapper", className])
20386
20424
  }, /*#__PURE__*/React__default["default"].createElement("div", {
@@ -20419,7 +20457,7 @@ var Input$1 = /*#__PURE__*/React$5.forwardRef(function (_ref, ref) {
20419
20457
  maxLength: maxLength
20420
20458
  }, otherProps, {
20421
20459
  value: value,
20422
- onChange: onChange
20460
+ onChange: handleChange
20423
20461
  })), suffix && /*#__PURE__*/React__default["default"].createElement("div", {
20424
20462
  className: "neeto-ui-input__suffix"
20425
20463
  }, suffix)), !!error && /*#__PURE__*/React__default["default"].createElement(Typography, {