@dreamcommerce/aurora 2.12.1-10 → 2.12.1-11

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.
@@ -7,35 +7,38 @@ var utilities = require('../utilities.js');
7
7
  var constants = require('../constants.js');
8
8
 
9
9
  const useColorPicker = ({ initialColor, onChange, onCancel, onSave }) => {
10
+ const [choosenColor, setChoosenColor] = React.useState(initialColor);
10
11
  const [color, setColor] = React.useState(constants.COLOR_PICKER_INITIAL_STATE);
11
12
  React.useEffect(() => {
12
13
  setColors(initialColor);
13
14
  }, [initialColor]);
14
- // useEffect(() => {
15
- // onChange?.(color);
16
- // }, [color]);
15
+ React.useEffect(() => {
16
+ onChange === null || onChange === void 0 ? void 0 : onChange(color);
17
+ }, [color]);
17
18
  const handleChangeSaturation = (hsva) => {
18
19
  setColors(hsva);
19
- onChange === null || onChange === void 0 ? void 0 : onChange(color);
20
+ // onChange?.(color);
20
21
  };
21
22
  const handleChangeHue = (hsls) => {
22
23
  const hueColorSet = utilities.getColorFormatsWithoutHsv(hsls);
23
24
  setColor({ ...color, ...hueColorSet });
24
- onChange === null || onChange === void 0 ? void 0 : onChange(color);
25
+ // onChange?.(color);
25
26
  };
26
27
  const handleChangeAlpha = (hsls) => {
27
28
  const hueColorSet = utilities.getColorFormatsWithoutHsv(hsls);
28
29
  setColor({ ...color, ...hueColorSet });
29
- onChange === null || onChange === void 0 ? void 0 : onChange(color);
30
+ // onChange?.(color);
30
31
  };
31
32
  const handlePickSwatch = (rgba) => {
32
33
  setColors(rgba);
33
34
  };
34
35
  const handleCancel = () => {
35
- onChange === null || onChange === void 0 ? void 0 : onChange(color);
36
- onCancel === null || onCancel === void 0 ? void 0 : onCancel(color);
36
+ setColors(choosenColor);
37
+ // onChange?.(color);
38
+ onCancel === null || onCancel === void 0 ? void 0 : onCancel();
37
39
  };
38
40
  const handleSave = () => {
41
+ setChoosenColor(color.hex);
39
42
  onSave === null || onSave === void 0 ? void 0 : onSave(color);
40
43
  };
41
44
  const setColors = (color) => {
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -2,7 +2,7 @@ import { ColorPickerColorFormats } from '../types';
2
2
  export declare type ColorPickerHookProps = {
3
3
  initialColor: ColorPickerColorFormats['hex'];
4
4
  onChange?: (color: ColorPickerColorFormats) => void;
5
- onCancel?: (color: ColorPickerColorFormats) => void;
5
+ onCancel?: () => void;
6
6
  onSave?: (color: ColorPickerColorFormats) => void;
7
7
  };
8
8
  declare const useColorPicker: ({ initialColor, onChange, onCancel, onSave }: ColorPickerHookProps) => {
@@ -3,35 +3,38 @@ import { getColorFormatsWithoutHsv, getAllColorFormats } from '../utilities.js';
3
3
  import { COLOR_PICKER_INITIAL_STATE } from '../constants.js';
4
4
 
5
5
  const useColorPicker = ({ initialColor, onChange, onCancel, onSave }) => {
6
+ const [choosenColor, setChoosenColor] = useState(initialColor);
6
7
  const [color, setColor] = useState(COLOR_PICKER_INITIAL_STATE);
7
8
  useEffect(() => {
8
9
  setColors(initialColor);
9
10
  }, [initialColor]);
10
- // useEffect(() => {
11
- // onChange?.(color);
12
- // }, [color]);
11
+ useEffect(() => {
12
+ onChange === null || onChange === void 0 ? void 0 : onChange(color);
13
+ }, [color]);
13
14
  const handleChangeSaturation = (hsva) => {
14
15
  setColors(hsva);
15
- onChange === null || onChange === void 0 ? void 0 : onChange(color);
16
+ // onChange?.(color);
16
17
  };
17
18
  const handleChangeHue = (hsls) => {
18
19
  const hueColorSet = getColorFormatsWithoutHsv(hsls);
19
20
  setColor({ ...color, ...hueColorSet });
20
- onChange === null || onChange === void 0 ? void 0 : onChange(color);
21
+ // onChange?.(color);
21
22
  };
22
23
  const handleChangeAlpha = (hsls) => {
23
24
  const hueColorSet = getColorFormatsWithoutHsv(hsls);
24
25
  setColor({ ...color, ...hueColorSet });
25
- onChange === null || onChange === void 0 ? void 0 : onChange(color);
26
+ // onChange?.(color);
26
27
  };
27
28
  const handlePickSwatch = (rgba) => {
28
29
  setColors(rgba);
29
30
  };
30
31
  const handleCancel = () => {
31
- onChange === null || onChange === void 0 ? void 0 : onChange(color);
32
- onCancel === null || onCancel === void 0 ? void 0 : onCancel(color);
32
+ setColors(choosenColor);
33
+ // onChange?.(color);
34
+ onCancel === null || onCancel === void 0 ? void 0 : onCancel();
33
35
  };
34
36
  const handleSave = () => {
37
+ setChoosenColor(color.hex);
35
38
  onSave === null || onSave === void 0 ? void 0 : onSave(color);
36
39
  };
37
40
  const setColors = (color) => {
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
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.12.1-10",
5
+ "version": "2.12.1-11",
6
6
  "description": "aurora",
7
7
  "author": "k0ssak",
8
8
  "license": "MIT",