@bigbinary/neetoui 5.1.6 → 5.1.8

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.cjs.js CHANGED
@@ -1624,6 +1624,37 @@ _curry2(function mergeLeft(l, r) {
1624
1624
  return _objectAssign$1({}, r, l);
1625
1625
  });
1626
1626
 
1627
+ /**
1628
+ * Replace a substring or regex match in a string with a replacement.
1629
+ *
1630
+ * The first two parameters correspond to the parameters of the
1631
+ * `String.prototype.replace()` function, so the second parameter can also be a
1632
+ * function.
1633
+ *
1634
+ * @func
1635
+ * @memberOf R
1636
+ * @since v0.7.0
1637
+ * @category String
1638
+ * @sig RegExp|String -> String -> String -> String
1639
+ * @param {RegExp|String} pattern A regular expression or a substring to match.
1640
+ * @param {String} replacement The string to replace the matches with.
1641
+ * @param {String} str The String to do the search and replacement in.
1642
+ * @return {String} The result.
1643
+ * @example
1644
+ *
1645
+ * R.replace('foo', 'bar', 'foo foo foo'); //=> 'bar foo foo'
1646
+ * R.replace(/foo/, 'bar', 'foo foo foo'); //=> 'bar foo foo'
1647
+ *
1648
+ * // Use the "g" (global) flag to replace all occurrences:
1649
+ * R.replace(/foo/g, 'bar', 'foo foo foo'); //=> 'bar bar bar'
1650
+ */
1651
+
1652
+ var replace$1 =
1653
+ /*#__PURE__*/
1654
+ _curry3(function replace(regex, replacement, str) {
1655
+ return str.replace(regex, replacement);
1656
+ });
1657
+
1627
1658
  function _objectWithoutPropertiesLoose$3(source, excluded) {
1628
1659
  if (source == null) return {};
1629
1660
  var target = {};
@@ -17860,7 +17891,7 @@ Form.propTypes = {
17860
17891
  scrollToErrorField: propTypes.exports.bool
17861
17892
  };
17862
17893
 
17863
- var _excluded$i = ["size", "type", "label", "error", "suffix", "prefix", "disabled", "helpText", "className", "nakedInput", "contentSize", "required", "maxLength", "unlimitedChars", "labelProps"];
17894
+ var _excluded$i = ["size", "type", "label", "error", "suffix", "prefix", "disabled", "helpText", "className", "nakedInput", "contentSize", "required", "maxLength", "unlimitedChars", "labelProps", "rejectCharsRegex"];
17864
17895
  var SIZES$2 = {
17865
17896
  small: "small",
17866
17897
  medium: "medium",
@@ -17896,6 +17927,7 @@ var Input$1 = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
17896
17927
  _ref$unlimitedChars = _ref.unlimitedChars,
17897
17928
  unlimitedChars = _ref$unlimitedChars === void 0 ? false : _ref$unlimitedChars,
17898
17929
  labelProps = _ref.labelProps,
17930
+ rejectCharsRegex = _ref.rejectCharsRegex,
17899
17931
  otherProps = _objectWithoutProperties$1(_ref, _excluded$i);
17900
17932
  var _useState = React.useState(otherProps.value),
17901
17933
  _useState2 = _slicedToArray$1(_useState, 2),
@@ -17913,6 +17945,12 @@ var Input$1 = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
17913
17945
  };
17914
17946
  var onChange = otherProps.onChange || onChangeInternal;
17915
17947
  var isMaxLengthPresent = !!maxLength || maxLength === 0;
17948
+ var handleRegexChange = function handleRegexChange(e) {
17949
+ var globalRegex = new RegExp(rejectCharsRegex, "g");
17950
+ e.target.value = replace$1(globalRegex, "", e.target.value);
17951
+ onChange(e);
17952
+ };
17953
+ var handleChange = rejectCharsRegex ? handleRegexChange : onChange;
17916
17954
  return /*#__PURE__*/React__default["default"].createElement("div", {
17917
17955
  className: classnames$1(["neeto-ui-input__wrapper", className])
17918
17956
  }, /*#__PURE__*/React__default["default"].createElement("div", {
@@ -17951,7 +17989,7 @@ var Input$1 = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
17951
17989
  maxLength: maxLength
17952
17990
  }, otherProps, {
17953
17991
  value: value,
17954
- onChange: onChange
17992
+ onChange: handleChange
17955
17993
  })), suffix && /*#__PURE__*/React__default["default"].createElement("div", {
17956
17994
  className: "neeto-ui-input__suffix"
17957
17995
  }, suffix)), !!error && /*#__PURE__*/React__default["default"].createElement(Typography, {