react-iro-gradient-picker 2.0.3 → 2.0.5

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 CHANGED
@@ -6877,6 +6877,7 @@ var IroColorPicker = forwardRef(function (_a, ref) {
6877
6877
  var theme = detectedTheme;
6878
6878
  var isUpdatingColor = useRef(false);
6879
6879
  var _o = __read(useState(width || 200), 2), containerWidth = _o[0], setContainerWidth = _o[1];
6880
+ var _p = __read(useState(true), 2), isLoading = _p[0], setIsLoading = _p[1];
6880
6881
  // Set up ResizeObserver to make the color picker responsive
6881
6882
  // Only when width prop is NOT provided (parent doesn't control width)
6882
6883
  useEffect(function () {
@@ -7035,12 +7036,15 @@ var IroColorPicker = forwardRef(function (_a, ref) {
7035
7036
  if (!colorPickerRef.current || !colorPickerRef.current.color) {
7036
7037
  throw new Error('ColorPicker was not created properly');
7037
7038
  }
7039
+ // Update picker ready state and notify parent
7040
+ setIsLoading(false);
7038
7041
  // Force update of imperative handle by calling onMount callback
7039
7042
  if (onMount) {
7040
7043
  setTimeout(function () { return onMount(colorPickerRef.current); }, 0);
7041
7044
  }
7042
7045
  }
7043
7046
  catch (error) {
7047
+ setIsLoading(false);
7044
7048
  colorPickerRef.current = null;
7045
7049
  return null; // Return null to indicate failure
7046
7050
  }
@@ -7361,10 +7365,25 @@ var IroColorPicker = forwardRef(function (_a, ref) {
7361
7365
  minWidth: 0,
7362
7366
  overflow: 'hidden',
7363
7367
  justifyContent: 'center',
7364
- minHeight: 'auto',
7368
+ minHeight: isLoading ? width || containerWidth : 'auto',
7365
7369
  position: 'relative',
7366
7370
  backgroundColor: 'transparent'
7367
- } }));
7371
+ } }, isLoading && (React.createElement("div", { style: {
7372
+ position: 'absolute',
7373
+ inset: 0,
7374
+ display: 'flex',
7375
+ alignItems: 'center',
7376
+ justifyContent: 'center',
7377
+ background: 'var(--colorpicker-panel-bg, #1e293b)'
7378
+ } },
7379
+ React.createElement("div", { style: {
7380
+ width: '32px',
7381
+ height: '32px',
7382
+ border: '3px solid rgba(59, 130, 246, 0.3)',
7383
+ borderTop: '3px solid rgb(59, 130, 246)',
7384
+ borderRadius: '50%',
7385
+ animation: 'spin 0.8s linear infinite'
7386
+ } })))));
7368
7387
  });
7369
7388
  IroColorPicker.displayName = 'IroColorPicker';
7370
7389