@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/formik.js CHANGED
@@ -1597,6 +1597,37 @@ _curry2(function mergeLeft(l, r) {
1597
1597
  return _objectAssign$1({}, r, l);
1598
1598
  });
1599
1599
 
1600
+ /**
1601
+ * Replace a substring or regex match in a string with a replacement.
1602
+ *
1603
+ * The first two parameters correspond to the parameters of the
1604
+ * `String.prototype.replace()` function, so the second parameter can also be a
1605
+ * function.
1606
+ *
1607
+ * @func
1608
+ * @memberOf R
1609
+ * @since v0.7.0
1610
+ * @category String
1611
+ * @sig RegExp|String -> String -> String -> String
1612
+ * @param {RegExp|String} pattern A regular expression or a substring to match.
1613
+ * @param {String} replacement The string to replace the matches with.
1614
+ * @param {String} str The String to do the search and replacement in.
1615
+ * @return {String} The result.
1616
+ * @example
1617
+ *
1618
+ * R.replace('foo', 'bar', 'foo foo foo'); //=> 'bar foo foo'
1619
+ * R.replace(/foo/, 'bar', 'foo foo foo'); //=> 'bar foo foo'
1620
+ *
1621
+ * // Use the "g" (global) flag to replace all occurrences:
1622
+ * R.replace(/foo/g, 'bar', 'foo foo foo'); //=> 'bar bar bar'
1623
+ */
1624
+
1625
+ var replace$1 =
1626
+ /*#__PURE__*/
1627
+ _curry3(function replace(regex, replacement, str) {
1628
+ return str.replace(regex, replacement);
1629
+ });
1630
+
1600
1631
  function _objectWithoutPropertiesLoose$3(source, excluded) {
1601
1632
  if (source == null) return {};
1602
1633
  var target = {};
@@ -17833,7 +17864,7 @@ Form.propTypes = {
17833
17864
  scrollToErrorField: propTypes.exports.bool
17834
17865
  };
17835
17866
 
17836
- var _excluded$i = ["size", "type", "label", "error", "suffix", "prefix", "disabled", "helpText", "className", "nakedInput", "contentSize", "required", "maxLength", "unlimitedChars", "labelProps"];
17867
+ var _excluded$i = ["size", "type", "label", "error", "suffix", "prefix", "disabled", "helpText", "className", "nakedInput", "contentSize", "required", "maxLength", "unlimitedChars", "labelProps", "rejectCharsRegex"];
17837
17868
  var SIZES$2 = {
17838
17869
  small: "small",
17839
17870
  medium: "medium",
@@ -17869,6 +17900,7 @@ var Input$1 = /*#__PURE__*/forwardRef$1(function (_ref, ref) {
17869
17900
  _ref$unlimitedChars = _ref.unlimitedChars,
17870
17901
  unlimitedChars = _ref$unlimitedChars === void 0 ? false : _ref$unlimitedChars,
17871
17902
  labelProps = _ref.labelProps,
17903
+ rejectCharsRegex = _ref.rejectCharsRegex,
17872
17904
  otherProps = _objectWithoutProperties$1(_ref, _excluded$i);
17873
17905
  var _useState = useState(otherProps.value),
17874
17906
  _useState2 = _slicedToArray$1(_useState, 2),
@@ -17886,6 +17918,12 @@ var Input$1 = /*#__PURE__*/forwardRef$1(function (_ref, ref) {
17886
17918
  };
17887
17919
  var onChange = otherProps.onChange || onChangeInternal;
17888
17920
  var isMaxLengthPresent = !!maxLength || maxLength === 0;
17921
+ var handleRegexChange = function handleRegexChange(e) {
17922
+ var globalRegex = new RegExp(rejectCharsRegex, "g");
17923
+ e.target.value = replace$1(globalRegex, "", e.target.value);
17924
+ onChange(e);
17925
+ };
17926
+ var handleChange = rejectCharsRegex ? handleRegexChange : onChange;
17889
17927
  return /*#__PURE__*/React__default.createElement("div", {
17890
17928
  className: classnames$1(["neeto-ui-input__wrapper", className])
17891
17929
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -17924,7 +17962,7 @@ var Input$1 = /*#__PURE__*/forwardRef$1(function (_ref, ref) {
17924
17962
  maxLength: maxLength
17925
17963
  }, otherProps, {
17926
17964
  value: value,
17927
- onChange: onChange
17965
+ onChange: handleChange
17928
17966
  })), suffix && /*#__PURE__*/React__default.createElement("div", {
17929
17967
  className: "neeto-ui-input__suffix"
17930
17968
  }, suffix)), !!error && /*#__PURE__*/React__default.createElement(Typography, {