@dreamcommerce/aurora 2.1.15-9 → 2.1.16

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.
@@ -24,7 +24,7 @@ const ColorPickerLabel = ({ name, isRequired, id }) => {
24
24
  const { isOpen } = React.useContext(index.DropdownContext);
25
25
  const classes = useStyles({ color });
26
26
  React.useEffect(() => {
27
- if (isOpen) {
27
+ if (isOpen && color.hex) {
28
28
  setInitialColor(color);
29
29
  }
30
30
  // eslint-disable-next-line
@@ -48,7 +48,7 @@ const PureColorPicker = ({ hideChooseCancelButtons }) => {
48
48
  const hueSliderRef = React.useRef(null);
49
49
  const classes = useStyles({ color, saturationLightnessPointer, hueSliderPointer, screenName });
50
50
  React.useEffect(() => {
51
- const initialColor = utilities.getColorFromHex(color.hex);
51
+ const initialColor = utilities.getColorFromHex(color.hex || '#ffffff');
52
52
  setNewColorPickerPositions(initialColor);
53
53
  // eslint-disable-next-line react-hooks/exhaustive-deps
54
54
  }, []);
@@ -1,4 +1,4 @@
1
- import React from 'react';
2
1
  import { IColorPickerLabelProps } from '../types';
2
+ import React from 'react';
3
3
  declare const ColorPickerLabel: React.FC<IColorPickerLabelProps>;
4
4
  export default ColorPickerLabel;
@@ -16,7 +16,7 @@ const ColorPickerLabel = ({ name, isRequired, id }) => {
16
16
  const { isOpen } = useContext(DropdownContext);
17
17
  const classes = useStyles({ color });
18
18
  useEffect(() => {
19
- if (isOpen) {
19
+ if (isOpen && color.hex) {
20
20
  setInitialColor(color);
21
21
  }
22
22
  // eslint-disable-next-line
@@ -40,7 +40,7 @@ const PureColorPicker = ({ hideChooseCancelButtons }) => {
40
40
  const hueSliderRef = useRef(null);
41
41
  const classes = useStyles({ color, saturationLightnessPointer, hueSliderPointer, screenName });
42
42
  useEffect(() => {
43
- const initialColor = getColorFromHex(color.hex);
43
+ const initialColor = getColorFromHex(color.hex || '#ffffff');
44
44
  setNewColorPickerPositions(initialColor);
45
45
  // eslint-disable-next-line react-hooks/exhaustive-deps
46
46
  }, []);
@@ -25,7 +25,7 @@ export interface IColorPickerProps extends IPureColorPickerProps {
25
25
  name?: string;
26
26
  }
27
27
  export interface IColorPickerContextProps {
28
- color: IColor;
28
+ color: Omit<IColor, 'hex'> & Pick<Partial<IColor>, 'hex'>;
29
29
  screenName: string;
30
30
  initialColor: IColor;
31
31
  setInitialColor: Dispatch<SetStateAction<IColor | undefined>>;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@dreamcommerce/aurora",
3
3
  "packageManager": "yarn@3.2.0",
4
4
  "sideEffects": false,
5
- "version": "2.1.15-9",
5
+ "version": "2.1.16",
6
6
  "description": "aurora",
7
7
  "author": "k0ssak",
8
8
  "license": "MIT",