react-iro-gradient-picker 2.0.2 → 2.0.4
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 +4 -79
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +4 -79
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6885,7 +6885,6 @@ var IroColorPicker = React.forwardRef(function (_a, ref) {
|
|
|
6885
6885
|
var theme = detectedTheme;
|
|
6886
6886
|
var isUpdatingColor = React.useRef(false);
|
|
6887
6887
|
var _o = __read(React.useState(width || 200), 2), containerWidth = _o[0], setContainerWidth = _o[1];
|
|
6888
|
-
var _p = __read(React.useState(true), 2), isLoading = _p[0], setIsLoading = _p[1];
|
|
6889
6888
|
// Set up ResizeObserver to make the color picker responsive
|
|
6890
6889
|
// Only when width prop is NOT provided (parent doesn't control width)
|
|
6891
6890
|
React.useEffect(function () {
|
|
@@ -7044,15 +7043,12 @@ var IroColorPicker = React.forwardRef(function (_a, ref) {
|
|
|
7044
7043
|
if (!colorPickerRef.current || !colorPickerRef.current.color) {
|
|
7045
7044
|
throw new Error('ColorPicker was not created properly');
|
|
7046
7045
|
}
|
|
7047
|
-
// Update picker ready state and notify parent
|
|
7048
|
-
setIsLoading(false);
|
|
7049
7046
|
// Force update of imperative handle by calling onMount callback
|
|
7050
7047
|
if (onMount) {
|
|
7051
7048
|
setTimeout(function () { return onMount(colorPickerRef.current); }, 0);
|
|
7052
7049
|
}
|
|
7053
7050
|
}
|
|
7054
7051
|
catch (error) {
|
|
7055
|
-
setIsLoading(false);
|
|
7056
7052
|
colorPickerRef.current = null;
|
|
7057
7053
|
return null; // Return null to indicate failure
|
|
7058
7054
|
}
|
|
@@ -7207,69 +7203,13 @@ var IroColorPicker = React.forwardRef(function (_a, ref) {
|
|
|
7207
7203
|
React.useEffect(function () {
|
|
7208
7204
|
if (!width)
|
|
7209
7205
|
return;
|
|
7210
|
-
|
|
7211
|
-
var maxRetries = 3;
|
|
7212
|
-
var createWithRetry = function () {
|
|
7213
|
-
// Longer initial delay to ensure DOM is completely ready
|
|
7214
|
-
var timeoutId = setTimeout(function () {
|
|
7215
|
-
try {
|
|
7216
|
-
var result = createColorPicker(width);
|
|
7217
|
-
if (!result &&
|
|
7218
|
-
colorPickerRef.current === null &&
|
|
7219
|
-
retryCount < maxRetries) {
|
|
7220
|
-
retryCount++;
|
|
7221
|
-
// Exponential backoff: 100ms, 200ms, 400ms
|
|
7222
|
-
setTimeout(createWithRetry, 100 * Math.pow(2, retryCount - 1));
|
|
7223
|
-
}
|
|
7224
|
-
}
|
|
7225
|
-
catch (error) {
|
|
7226
|
-
if (retryCount < maxRetries) {
|
|
7227
|
-
retryCount++;
|
|
7228
|
-
setTimeout(createWithRetry, 100 * Math.pow(2, retryCount - 1));
|
|
7229
|
-
}
|
|
7230
|
-
}
|
|
7231
|
-
}, 100); // Increased from 50ms to 100ms
|
|
7232
|
-
return function () { return clearTimeout(timeoutId); };
|
|
7233
|
-
};
|
|
7234
|
-
var cleanupFn = createWithRetry();
|
|
7235
|
-
return function () {
|
|
7236
|
-
if (cleanupFn)
|
|
7237
|
-
cleanupFn();
|
|
7238
|
-
};
|
|
7206
|
+
createColorPicker(width);
|
|
7239
7207
|
}, [width, theme, createColorPicker]);
|
|
7240
7208
|
// useEffect for when containerWidth is used (internal ResizeObserver)
|
|
7241
7209
|
React.useEffect(function () {
|
|
7242
7210
|
if (width)
|
|
7243
7211
|
return; // Don't run if width prop is provided
|
|
7244
|
-
|
|
7245
|
-
var maxRetries = 3;
|
|
7246
|
-
var createWithRetry = function () {
|
|
7247
|
-
// Longer initial delay to ensure DOM is completely ready
|
|
7248
|
-
var timeoutId = setTimeout(function () {
|
|
7249
|
-
try {
|
|
7250
|
-
var result = createColorPicker(containerWidth);
|
|
7251
|
-
if (!result &&
|
|
7252
|
-
colorPickerRef.current === null &&
|
|
7253
|
-
retryCount < maxRetries) {
|
|
7254
|
-
retryCount++;
|
|
7255
|
-
// Exponential backoff: 100ms, 200ms, 400ms
|
|
7256
|
-
setTimeout(createWithRetry, 100 * Math.pow(2, retryCount - 1));
|
|
7257
|
-
}
|
|
7258
|
-
}
|
|
7259
|
-
catch (error) {
|
|
7260
|
-
if (retryCount < maxRetries) {
|
|
7261
|
-
retryCount++;
|
|
7262
|
-
setTimeout(createWithRetry, 100 * Math.pow(2, retryCount - 1));
|
|
7263
|
-
}
|
|
7264
|
-
}
|
|
7265
|
-
}, 100); // Increased from 50ms to 100ms
|
|
7266
|
-
return function () { return clearTimeout(timeoutId); };
|
|
7267
|
-
};
|
|
7268
|
-
var cleanupFn = createWithRetry();
|
|
7269
|
-
return function () {
|
|
7270
|
-
if (cleanupFn)
|
|
7271
|
-
cleanupFn();
|
|
7272
|
-
};
|
|
7212
|
+
createColorPicker(containerWidth);
|
|
7273
7213
|
}, [containerWidth, theme, createColorPicker, width]);
|
|
7274
7214
|
// Update color when prop changes
|
|
7275
7215
|
React.useEffect(function () {
|
|
@@ -7373,25 +7313,10 @@ var IroColorPicker = React.forwardRef(function (_a, ref) {
|
|
|
7373
7313
|
minWidth: 0,
|
|
7374
7314
|
overflow: 'hidden',
|
|
7375
7315
|
justifyContent: 'center',
|
|
7376
|
-
minHeight:
|
|
7316
|
+
minHeight: 'auto',
|
|
7377
7317
|
position: 'relative',
|
|
7378
7318
|
backgroundColor: 'transparent'
|
|
7379
|
-
} }
|
|
7380
|
-
position: 'absolute',
|
|
7381
|
-
inset: 0,
|
|
7382
|
-
display: 'flex',
|
|
7383
|
-
alignItems: 'center',
|
|
7384
|
-
justifyContent: 'center',
|
|
7385
|
-
background: 'var(--colorpicker-panel-bg, #1e293b)'
|
|
7386
|
-
} },
|
|
7387
|
-
React__default["default"].createElement("div", { style: {
|
|
7388
|
-
width: '32px',
|
|
7389
|
-
height: '32px',
|
|
7390
|
-
border: '3px solid rgba(59, 130, 246, 0.3)',
|
|
7391
|
-
borderTop: '3px solid rgb(59, 130, 246)',
|
|
7392
|
-
borderRadius: '50%',
|
|
7393
|
-
animation: 'spin 0.8s linear infinite'
|
|
7394
|
-
} })))));
|
|
7319
|
+
} }));
|
|
7395
7320
|
});
|
|
7396
7321
|
IroColorPicker.displayName = 'IroColorPicker';
|
|
7397
7322
|
|