@dreamcommerce/aurora 2.12.1-12 → 2.12.1-3

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.
@@ -8,30 +8,29 @@ var constants = require('../constants.js');
8
8
 
9
9
  const useColorPicker = ({ initialColor, onChange, onCancel, onSave }) => {
10
10
  const [choosenColor, setChoosenColor] = React.useState(initialColor);
11
- const [color, setColor] = React.useState(initialColor ? utilities.getAllColorFormats(initialColor) : constants.COLOR_PICKER_INITIAL_STATE);
11
+ const [color, setColor] = React.useState(constants.COLOR_PICKER_INITIAL_STATE);
12
+ React.useEffect(() => {
13
+ setColors(initialColor);
14
+ }, [initialColor]);
12
15
  React.useEffect(() => {
13
16
  onChange === null || onChange === void 0 ? void 0 : onChange(color);
14
17
  }, [color]);
15
18
  const handleChangeSaturation = (hsva) => {
16
19
  setColors(hsva);
17
- // onChange?.(color);
18
20
  };
19
21
  const handleChangeHue = (hsls) => {
20
22
  const hueColorSet = utilities.getColorFormatsWithoutHsv(hsls);
21
23
  setColor({ ...color, ...hueColorSet });
22
- // onChange?.(color);
23
24
  };
24
25
  const handleChangeAlpha = (hsls) => {
25
26
  const hueColorSet = utilities.getColorFormatsWithoutHsv(hsls);
26
27
  setColor({ ...color, ...hueColorSet });
27
- // onChange?.(color);
28
28
  };
29
29
  const handlePickSwatch = (rgba) => {
30
30
  setColors(rgba);
31
31
  };
32
32
  const handleCancel = () => {
33
33
  setColors(choosenColor);
34
- // onChange?.(color);
35
34
  onCancel === null || onCancel === void 0 ? void 0 : onCancel();
36
35
  };
37
36
  const handleSave = () => {
@@ -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;"}
@@ -34,7 +34,7 @@ const ColorPickerNew = ({ initialColor = '#fff', pickerText, onChange, onCancel,
34
34
  React__default['default'].createElement("div", { className: `${main_module['default'][css_classes.cssColorPickerInputContainer]}` },
35
35
  React__default['default'].createElement("div", { className: `${main_module['default'][css_classes.cssColorPickerInputColorSwatchContainer]}` },
36
36
  React__default['default'].createElement(colorPickerSwatch.ColorPickerSwatch, { color: color === null || color === void 0 ? void 0 : color.rgba })),
37
- React__default['default'].createElement(input['default'], { value: `# ${(_a = color === null || color === void 0 ? void 0 : color.hex) === null || _a === void 0 ? void 0 : _a.toUpperCase()}`, readOnly: true }))),
37
+ React__default['default'].createElement(input['default'], { value: (_a = color === null || color === void 0 ? void 0 : color.hex) === null || _a === void 0 ? void 0 : _a.toUpperCase(), readOnly: true }))),
38
38
  React__default['default'].createElement(index['default'].Content, { onClickOutside: handleCancel },
39
39
  React__default['default'].createElement(colorPickerHeader.ColorPickerHeader, { text: pickerText, onCancel: handleCancel }),
40
40
  React__default['default'].createElement("div", { className: `${main_module['default'][css_classes.cssColorPickerContainer]}` },
@@ -10,7 +10,7 @@ const getAllColorFormats = (color) => {
10
10
  hsla: colorSet.toHsl(),
11
11
  hsva: colorSet.toHsv(),
12
12
  rgba: colorSet.toRgb(),
13
- hex: getHexValue(colorSet)
13
+ hex: `#${getHexValue(colorSet)}`
14
14
  };
15
15
  };
16
16
  const getColorFormatsWithoutHsv = (hue) => {
@@ -18,7 +18,7 @@ const getColorFormatsWithoutHsv = (hue) => {
18
18
  return {
19
19
  hsla: hue,
20
20
  rgba: colorSet.toRgb(),
21
- hex: getHexValue(colorSet)
21
+ hex: `#${getHexValue(colorSet)}`
22
22
  };
23
23
  };
24
24
  const getHexValue = (colorSet) => {
@@ -1,33 +1,32 @@
1
1
  import { useState, useEffect } from 'react';
2
- import { getAllColorFormats, getColorFormatsWithoutHsv } from '../utilities.js';
2
+ 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
6
  const [choosenColor, setChoosenColor] = useState(initialColor);
7
- const [color, setColor] = useState(initialColor ? getAllColorFormats(initialColor) : COLOR_PICKER_INITIAL_STATE);
7
+ const [color, setColor] = useState(COLOR_PICKER_INITIAL_STATE);
8
+ useEffect(() => {
9
+ setColors(initialColor);
10
+ }, [initialColor]);
8
11
  useEffect(() => {
9
12
  onChange === null || onChange === void 0 ? void 0 : onChange(color);
10
13
  }, [color]);
11
14
  const handleChangeSaturation = (hsva) => {
12
15
  setColors(hsva);
13
- // onChange?.(color);
14
16
  };
15
17
  const handleChangeHue = (hsls) => {
16
18
  const hueColorSet = getColorFormatsWithoutHsv(hsls);
17
19
  setColor({ ...color, ...hueColorSet });
18
- // onChange?.(color);
19
20
  };
20
21
  const handleChangeAlpha = (hsls) => {
21
22
  const hueColorSet = getColorFormatsWithoutHsv(hsls);
22
23
  setColor({ ...color, ...hueColorSet });
23
- // onChange?.(color);
24
24
  };
25
25
  const handlePickSwatch = (rgba) => {
26
26
  setColors(rgba);
27
27
  };
28
28
  const handleCancel = () => {
29
29
  setColors(choosenColor);
30
- // onChange?.(color);
31
30
  onCancel === null || onCancel === void 0 ? void 0 : onCancel();
32
31
  };
33
32
  const handleSave = () => {
@@ -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;"}
@@ -26,7 +26,7 @@ const ColorPickerNew = ({ initialColor = '#fff', pickerText, onChange, onCancel,
26
26
  React.createElement("div", { className: `${styles[cssColorPickerInputContainer]}` },
27
27
  React.createElement("div", { className: `${styles[cssColorPickerInputColorSwatchContainer]}` },
28
28
  React.createElement(ColorPickerSwatch, { color: color === null || color === void 0 ? void 0 : color.rgba })),
29
- React.createElement(Input, { value: `# ${(_a = color === null || color === void 0 ? void 0 : color.hex) === null || _a === void 0 ? void 0 : _a.toUpperCase()}`, readOnly: true }))),
29
+ React.createElement(Input, { value: (_a = color === null || color === void 0 ? void 0 : color.hex) === null || _a === void 0 ? void 0 : _a.toUpperCase(), readOnly: true }))),
30
30
  React.createElement(Dropdown.Content, { onClickOutside: handleCancel },
31
31
  React.createElement(ColorPickerHeader, { text: pickerText, onCancel: handleCancel }),
32
32
  React.createElement("div", { className: `${styles[cssColorPickerContainer]}` },
@@ -6,7 +6,7 @@ const getAllColorFormats = (color) => {
6
6
  hsla: colorSet.toHsl(),
7
7
  hsva: colorSet.toHsv(),
8
8
  rgba: colorSet.toRgb(),
9
- hex: getHexValue(colorSet)
9
+ hex: `#${getHexValue(colorSet)}`
10
10
  };
11
11
  };
12
12
  const getColorFormatsWithoutHsv = (hue) => {
@@ -14,7 +14,7 @@ const getColorFormatsWithoutHsv = (hue) => {
14
14
  return {
15
15
  hsla: hue,
16
16
  rgba: colorSet.toRgb(),
17
- hex: getHexValue(colorSet)
17
+ hex: `#${getHexValue(colorSet)}`
18
18
  };
19
19
  };
20
20
  const getHexValue = (colorSet) => {
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-12",
5
+ "version": "2.12.1-3",
6
6
  "description": "aurora",
7
7
  "author": "k0ssak",
8
8
  "license": "MIT",