@dreamcommerce/aurora 2.12.1-13 → 2.12.1-15

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.
@@ -25,8 +25,8 @@ const ColorPickerFooter = ({ onCancel, onSave, color }) => {
25
25
  onSave(color);
26
26
  };
27
27
  return (React__default['default'].createElement("div", { className: `${main_module['default'][css_classes.cssColorPickerFooter]}` },
28
- React__default['default'].createElement(index$1['default'], { size: "small", variant: "outline", onClick: handleCancelButton }, t('cancel')),
29
- React__default['default'].createElement(index$1['default'], { size: "small", onClick: handleSaveButton }, t('save'))));
28
+ React__default['default'].createElement(index$1['default'], { size: "small", variant: "outline", onClick: handleCancelButton }, t('Cancel')),
29
+ React__default['default'].createElement(index$1['default'], { size: "small", onClick: handleSaveButton }, t('Save'))));
30
30
  };
31
31
 
32
32
  exports.ColorPickerFooter = ColorPickerFooter;
@@ -7,22 +7,22 @@ const COLOR_PICKER_INITIAL_STATE = {
7
7
  h: 0,
8
8
  s: 0,
9
9
  l: 0,
10
- a: 0
10
+ a: 1
11
11
  },
12
12
  hsva: {
13
13
  h: 0,
14
14
  s: 0,
15
15
  v: 0,
16
- a: 0
16
+ a: 1
17
17
  },
18
18
  rgba: {
19
19
  r: 0,
20
20
  g: 0,
21
21
  b: 0,
22
- a: 0
22
+ a: 1
23
23
  },
24
- hex: '',
25
- hexWithPrefix: ''
24
+ hex: '000000',
25
+ hexWithPrefix: '#000000'
26
26
  };
27
27
 
28
28
  exports.COLOR_PICKER_INITIAL_STATE = COLOR_PICKER_INITIAL_STATE;
@@ -7,7 +7,7 @@ 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
+ const [choosenColor, setChoosenColor] = React.useState(initialColor !== null && initialColor !== void 0 ? initialColor : constants.COLOR_PICKER_INITIAL_STATE.hex);
11
11
  const [color, setColor] = React.useState(initialColor ? utilities.getAllColorFormats(initialColor) : constants.COLOR_PICKER_INITIAL_STATE);
12
12
  React.useEffect(() => {
13
13
  onChange === null || onChange === void 0 ? void 0 : onChange(color);
@@ -20,7 +20,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
20
20
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
21
21
 
22
22
  // @ts-ignore
23
- const ColorPickerNew = ({ initialColor = '#fff', pickerText, onChange, onCancel, onSave }) => {
23
+ const ColorPickerNew = ({ initialColor, pickerText, onChange, onCancel, onSave }) => {
24
24
  var _a;
25
25
  const { color, handleChangeSaturation, handleChangeHue, handleChangeAlpha, handlePickSwatch, handleCancel, handleSave } = use_color_picker['default']({
26
26
  initialColor,
@@ -17,8 +17,8 @@ const ColorPickerFooter = ({ onCancel, onSave, color }) => {
17
17
  onSave(color);
18
18
  };
19
19
  return (React.createElement("div", { className: `${styles[cssColorPickerFooter]}` },
20
- React.createElement(Button, { size: "small", variant: "outline", onClick: handleCancelButton }, t('cancel')),
21
- React.createElement(Button, { size: "small", onClick: handleSaveButton }, t('save'))));
20
+ React.createElement(Button, { size: "small", variant: "outline", onClick: handleCancelButton }, t('Cancel')),
21
+ React.createElement(Button, { size: "small", onClick: handleSaveButton }, t('Save'))));
22
22
  };
23
23
 
24
24
  export { ColorPickerFooter };
@@ -3,22 +3,22 @@ const COLOR_PICKER_INITIAL_STATE = {
3
3
  h: 0,
4
4
  s: 0,
5
5
  l: 0,
6
- a: 0
6
+ a: 1
7
7
  },
8
8
  hsva: {
9
9
  h: 0,
10
10
  s: 0,
11
11
  v: 0,
12
- a: 0
12
+ a: 1
13
13
  },
14
14
  rgba: {
15
15
  r: 0,
16
16
  g: 0,
17
17
  b: 0,
18
- a: 0
18
+ a: 1
19
19
  },
20
- hex: '',
21
- hexWithPrefix: ''
20
+ hex: '000000',
21
+ hexWithPrefix: '#000000'
22
22
  };
23
23
 
24
24
  export { COLOR_PICKER_INITIAL_STATE };
@@ -1,6 +1,6 @@
1
1
  import { ColorPickerColorFormats } from '../types';
2
2
  export declare type ColorPickerHookProps = {
3
- initialColor: ColorPickerColorFormats['hex'];
3
+ initialColor?: ColorPickerColorFormats['hex'];
4
4
  onChange?: (color: ColorPickerColorFormats) => void;
5
5
  onCancel?: () => void;
6
6
  onSave?: (color: ColorPickerColorFormats) => void;
@@ -3,7 +3,7 @@ import { getAllColorFormats, getColorFormatsWithoutHsv } 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
+ const [choosenColor, setChoosenColor] = useState(initialColor !== null && initialColor !== void 0 ? initialColor : COLOR_PICKER_INITIAL_STATE.hex);
7
7
  const [color, setColor] = useState(initialColor ? getAllColorFormats(initialColor) : COLOR_PICKER_INITIAL_STATE);
8
8
  useEffect(() => {
9
9
  onChange === null || onChange === void 0 ? void 0 : onChange(color);
@@ -12,7 +12,7 @@ import Dropdown from '../dropdown/index.js';
12
12
  import useColorPicker from './hooks/use_color_picker.js';
13
13
 
14
14
  // @ts-ignore
15
- const ColorPickerNew = ({ initialColor = '#fff', pickerText, onChange, onCancel, onSave }) => {
15
+ const ColorPickerNew = ({ initialColor, pickerText, onChange, onCancel, onSave }) => {
16
16
  var _a;
17
17
  const { color, handleChangeSaturation, handleChangeHue, handleChangeAlpha, handlePickSwatch, handleCancel, handleSave } = useColorPicker({
18
18
  initialColor,
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-13",
5
+ "version": "2.12.1-15",
6
6
  "description": "aurora",
7
7
  "author": "k0ssak",
8
8
  "license": "MIT",