@bigbinary/neetoui 5.1.15 → 5.1.17

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/README.md CHANGED
@@ -25,7 +25,7 @@ working, please import the neetoUI stylesheet to your main `scss` entry point.
25
25
  properly. Install the peer dependencies using the below command:
26
26
 
27
27
  ```
28
- yarn add react-toastify@9.0.1 formik@2.2.0 react-router-dom@5.2.0
28
+ yarn add react-toastify@9.0.1 formik@2.2.0 react-router-dom@5.2.0 @bigbinary/neeto-icons antd@4.24.3 i18next@21.7.0
29
29
  ```
30
30
 
31
31
  ### `react-toastify`
package/index.cjs.js CHANGED
@@ -19869,6 +19869,7 @@ var ColorPicker = function ColorPicker(_ref) {
19869
19869
  _useState2 = _slicedToArray$2(_useState, 2),
19870
19870
  colorInternal = _useState2[0],
19871
19871
  setColorInternal = _useState2[1];
19872
+ var isInputChanged = React$5.useRef(false);
19872
19873
  var _useEyeDropper = useEyeDropper({
19873
19874
  pickRadius: 3
19874
19875
  // cursorActive: CSS Cursors,
@@ -19882,15 +19883,31 @@ var ColorPicker = function ColorPicker(_ref) {
19882
19883
  var PickerComponent = showTransparencyControl ? ne : Z;
19883
19884
  var colorValue = (_ref2 = color !== null && color !== void 0 ? color : colorInternal) !== null && _ref2 !== void 0 ? _ref2 : "";
19884
19885
  var onChangeInternal = onChange || setColorInternal;
19885
- var onColorChange = function onColorChange(hex) {
19886
+ var getColor = function getColor(colorValue) {
19887
+ var color = tinycolor(colorValue);
19888
+ return {
19889
+ hex: showTransparencyControl ? color.toHex8String() : color.toHexString(),
19890
+ rgb: color.toRgb()
19891
+ };
19892
+ };
19893
+ var onColorInputChange = function onColorInputChange(hex) {
19886
19894
  var color = tinycolor(hex);
19887
19895
  var rgb = color.toRgb();
19888
- var hexValue = color.toHexString();
19896
+ isInputChanged.current = true;
19889
19897
  onChangeInternal({
19890
- hex: hexValue,
19898
+ hex: hex,
19891
19899
  rgb: rgb
19892
19900
  });
19893
19901
  };
19902
+ var onPickerChange = function onPickerChange(hex) {
19903
+ return onChangeInternal(getColor(hex));
19904
+ };
19905
+ var onBlur = function onBlur() {
19906
+ // If input is not changed, don't call onChange on blur
19907
+ if (!isInputChanged.current) return;
19908
+ isInputChanged.current = false;
19909
+ onChangeInternal(getColor(colorValue));
19910
+ };
19894
19911
  var pickColor = /*#__PURE__*/function () {
19895
19912
  var _ref3 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
19896
19913
  var colorResponse, colorHex;
@@ -19903,7 +19920,7 @@ var ColorPicker = function ColorPicker(_ref) {
19903
19920
  case 3:
19904
19921
  colorResponse = _context.sent;
19905
19922
  colorHex = tinycolor(colorResponse.sRGBHex).toHexString();
19906
- onColorChange(colorHex);
19923
+ onPickerChange(colorHex);
19907
19924
  _context.next = 10;
19908
19925
  break;
19909
19926
  case 8:
@@ -19959,7 +19976,7 @@ var ColorPicker = function ColorPicker(_ref) {
19959
19976
  className: "neeto-ui-colorpicker__pointer"
19960
19977
  }, /*#__PURE__*/React__default["default"].createElement(PickerComponent, {
19961
19978
  color: colorValue,
19962
- onChange: onColorChange
19979
+ onChange: onPickerChange
19963
19980
  })), /*#__PURE__*/React__default["default"].createElement("div", {
19964
19981
  className: "neeto-ui-flex neeto-ui-items-center neeto-ui-justify-center neeto-ui-mt-2 neeto-ui-gap-2"
19965
19982
  }, showEyeDropper && isSupported() && /*#__PURE__*/React__default["default"].createElement(Button, {
@@ -19977,7 +19994,8 @@ var ColorPicker = function ColorPicker(_ref) {
19977
19994
  }, /*#__PURE__*/React__default["default"].createElement(Oe, {
19978
19995
  alpha: !!showTransparencyControl,
19979
19996
  color: colorValue,
19980
- onChange: onColorChange
19997
+ onBlur: onBlur,
19998
+ onChange: onColorInputChange
19981
19999
  })))), colorPaletteProps && /*#__PURE__*/React__default["default"].createElement("div", {
19982
20000
  className: "neeto-ui-colorpicker__palette-wrapper",
19983
20001
  "data-testid": "color-palette"