react-iro-gradient-picker 1.1.6 → 1.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/dist/index.es.js +22 -15
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +22 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
@@ -7784,7 +7784,9 @@ var IroGradient = function (_a) {
|
|
7784
7784
|
useEffect(function () {
|
7785
7785
|
var initializeIroPicker = function () {
|
7786
7786
|
var _a, _b;
|
7787
|
-
if (((_b = (_a = iroPickerRef.current) === null || _a === void 0 ? void 0 : _a.colorPicker) === null || _b === void 0 ? void 0 : _b.color) &&
|
7787
|
+
if (((_b = (_a = iroPickerRef.current) === null || _a === void 0 ? void 0 : _a.colorPicker) === null || _b === void 0 ? void 0 : _b.color) &&
|
7788
|
+
activeColor.hex &&
|
7789
|
+
typeof activeColor.alpha === 'number') {
|
7788
7790
|
console.log('🚀 Initializing iro picker with activeColor:', activeColor);
|
7789
7791
|
// Wait a bit for the picker to be fully ready, then update
|
7790
7792
|
setTimeout(function () {
|
@@ -7805,13 +7807,19 @@ var IroGradient = function (_a) {
|
|
7805
7807
|
var handleSetActiveColor = useCallback(function (newActiveColor) {
|
7806
7808
|
console.log('🎯 Gradient stop clicked, setting active color:', newActiveColor);
|
7807
7809
|
setActiveColor(newActiveColor);
|
7808
|
-
//
|
7809
|
-
|
7810
|
-
|
7811
|
-
|
7812
|
-
|
7813
|
-
|
7814
|
-
|
7810
|
+
// Validate before updating iro picker
|
7811
|
+
if (newActiveColor.hex && typeof newActiveColor.alpha === 'number') {
|
7812
|
+
// Force immediate update of iro picker with longer delay for first-time reliability
|
7813
|
+
setTimeout(function () {
|
7814
|
+
updateIroPickerColor({
|
7815
|
+
hex: newActiveColor.hex,
|
7816
|
+
alpha: newActiveColor.alpha
|
7817
|
+
});
|
7818
|
+
}, 50); // Increased from 5ms to 50ms for better first-time success
|
7819
|
+
}
|
7820
|
+
else {
|
7821
|
+
console.log('⚠️ Skipping iro picker update in handleSetActiveColor - invalid data:', newActiveColor);
|
7822
|
+
}
|
7815
7823
|
}, [updateIroPickerColor]);
|
7816
7824
|
// Update iro picker when activeColor changes (e.g., clicking gradient stops)
|
7817
7825
|
useEffect(function () {
|
@@ -7821,18 +7829,17 @@ var IroGradient = function (_a) {
|
|
7821
7829
|
index: activeColor.index,
|
7822
7830
|
loc: activeColor.loc
|
7823
7831
|
});
|
7832
|
+
// Validate activeColor before proceeding
|
7833
|
+
if (!activeColor.hex || typeof activeColor.alpha !== 'number') {
|
7834
|
+
console.log('⚠️ Skipping iro picker update - invalid activeColor:', activeColor);
|
7835
|
+
return;
|
7836
|
+
}
|
7824
7837
|
// Add a small delay to ensure the activeColor state has fully updated
|
7825
7838
|
var timeoutId = setTimeout(function () {
|
7826
7839
|
updateIroPickerColor({ hex: activeColor.hex, alpha: activeColor.alpha });
|
7827
7840
|
}, 10);
|
7828
7841
|
return function () { return clearTimeout(timeoutId); };
|
7829
|
-
}, [
|
7830
|
-
activeColor.hex,
|
7831
|
-
activeColor.alpha,
|
7832
|
-
activeColor.index,
|
7833
|
-
activeColor.loc,
|
7834
|
-
updateIroPickerColor
|
7835
|
-
]);
|
7842
|
+
}, [activeColor, updateIroPickerColor]);
|
7836
7843
|
var updateGradient = useCallback(function (newColor) {
|
7837
7844
|
if (Array.isArray(newColor)) {
|
7838
7845
|
// Handle the case where it's called with stops array
|