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.js CHANGED
@@ -6885,6 +6885,7 @@ 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];
6888
6889
  // Set up ResizeObserver to make the color picker responsive
6889
6890
  // Only when width prop is NOT provided (parent doesn't control width)
6890
6891
  React.useEffect(function () {
@@ -7043,12 +7044,15 @@ var IroColorPicker = React.forwardRef(function (_a, ref) {
7043
7044
  if (!colorPickerRef.current || !colorPickerRef.current.color) {
7044
7045
  throw new Error('ColorPicker was not created properly');
7045
7046
  }
7047
+ // Update picker ready state and notify parent
7048
+ setIsLoading(false);
7046
7049
  // Force update of imperative handle by calling onMount callback
7047
7050
  if (onMount) {
7048
7051
  setTimeout(function () { return onMount(colorPickerRef.current); }, 0);
7049
7052
  }
7050
7053
  }
7051
7054
  catch (error) {
7055
+ setIsLoading(false);
7052
7056
  colorPickerRef.current = null;
7053
7057
  return null; // Return null to indicate failure
7054
7058
  }
@@ -7369,10 +7373,25 @@ var IroColorPicker = React.forwardRef(function (_a, ref) {
7369
7373
  minWidth: 0,
7370
7374
  overflow: 'hidden',
7371
7375
  justifyContent: 'center',
7372
- minHeight: 'auto',
7376
+ minHeight: isLoading ? width || containerWidth : 'auto',
7373
7377
  position: 'relative',
7374
7378
  backgroundColor: 'transparent'
7375
- } }));
7379
+ } }, isLoading && (React__default["default"].createElement("div", { style: {
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
+ } })))));
7376
7395
  });
7377
7396
  IroColorPicker.displayName = 'IroColorPicker';
7378
7397