@dreamcommerce/aurora 2.12.1-23 → 2.12.1-24
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/build/cjs/packages/aurora/src/components/color_picker_new/components/color-picker-footer.js +5 -4
- package/build/cjs/packages/aurora/src/components/color_picker_new/components/color-picker-footer.js.map +1 -1
- package/build/cjs/packages/aurora/src/components/color_picker_new/components/color-picker-header.js +11 -2
- package/build/cjs/packages/aurora/src/components/color_picker_new/components/color-picker-header.js.map +1 -1
- package/build/cjs/packages/aurora/src/components/color_picker_new/components/color-picker-inputs/color-picker-inputs.js +1 -4
- package/build/cjs/packages/aurora/src/components/color_picker_new/components/color-picker-inputs/color-picker-inputs.js.map +1 -1
- package/build/cjs/packages/aurora/src/components/color_picker_new/components/color-picker-swatch.js +1 -1
- package/build/cjs/packages/aurora/src/components/color_picker_new/components/color-picker-swatches.js +1 -1
- package/build/cjs/packages/aurora/src/components/color_picker_new/constants.js +1 -3
- package/build/cjs/packages/aurora/src/components/color_picker_new/constants.js.map +1 -1
- package/build/cjs/packages/aurora/src/components/color_picker_new/hooks/use_color_picker.js +2 -2
- package/build/cjs/packages/aurora/src/components/color_picker_new/utilities.js +21 -0
- package/build/cjs/packages/aurora/src/components/color_picker_new/utilities.js.map +1 -1
- package/build/cjs/packages/aurora/src/css/color_picker_new/main.module.less.js +1 -1
- package/build/esm/packages/aurora/src/components/color_picker_new/components/color-picker-footer.js +5 -4
- package/build/esm/packages/aurora/src/components/color_picker_new/components/color-picker-footer.js.map +1 -1
- package/build/esm/packages/aurora/src/components/color_picker_new/components/color-picker-header.js +12 -3
- package/build/esm/packages/aurora/src/components/color_picker_new/components/color-picker-header.js.map +1 -1
- package/build/esm/packages/aurora/src/components/color_picker_new/components/color-picker-inputs/color-picker-inputs.js +2 -5
- package/build/esm/packages/aurora/src/components/color_picker_new/components/color-picker-inputs/color-picker-inputs.js.map +1 -1
- package/build/esm/packages/aurora/src/components/color_picker_new/components/color-picker-swatch.js +1 -1
- package/build/esm/packages/aurora/src/components/color_picker_new/components/color-picker-swatches.js +1 -1
- package/build/esm/packages/aurora/src/components/color_picker_new/constants.js +2 -3
- package/build/esm/packages/aurora/src/components/color_picker_new/constants.js.map +1 -1
- package/build/esm/packages/aurora/src/components/color_picker_new/hooks/use_color_picker.d.ts +3 -3
- package/build/esm/packages/aurora/src/components/color_picker_new/hooks/use_color_picker.js +3 -3
- package/build/esm/packages/aurora/src/components/color_picker_new/types.d.ts +10 -7
- package/build/esm/packages/aurora/src/components/color_picker_new/utilities.d.ts +3 -1
- package/build/esm/packages/aurora/src/components/color_picker_new/utilities.js +20 -1
- package/build/esm/packages/aurora/src/components/color_picker_new/utilities.js.map +1 -1
- package/build/esm/packages/aurora/src/css/color_picker_new/main.module.less.js +1 -1
- package/package.json +1 -1
- package/build/cjs/packages/aurora/src/components/color_picker_new/components/color-picker-inputs/color-picker-inputs-hsl.js +0 -39
- package/build/cjs/packages/aurora/src/components/color_picker_new/components/color-picker-inputs/color-picker-inputs-hsl.js.map +0 -1
- package/build/esm/packages/aurora/src/components/color_picker_new/components/color-picker-inputs/color-picker-inputs-hsl.d.ts +0 -1
- package/build/esm/packages/aurora/src/components/color_picker_new/components/color-picker-inputs/color-picker-inputs-hsl.js +0 -31
- package/build/esm/packages/aurora/src/components/color_picker_new/components/color-picker-inputs/color-picker-inputs-hsl.js.map +0 -1
package/build/cjs/packages/aurora/src/components/color_picker_new/components/color-picker-footer.js
CHANGED
|
@@ -8,6 +8,7 @@ var index$1 = require('../../button/index.js');
|
|
|
8
8
|
var index = require('../../dropdown/context/index.js');
|
|
9
9
|
var css_classes = require('../css_classes.js');
|
|
10
10
|
var context = require('../context.js');
|
|
11
|
+
var utilities = require('../utilities.js');
|
|
11
12
|
var main_module = require('../../../css/color_picker_new/main.module.less.js');
|
|
12
13
|
|
|
13
14
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -15,16 +16,16 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
15
16
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
16
17
|
|
|
17
18
|
const ColorPickerFooter = () => {
|
|
18
|
-
const {
|
|
19
|
+
const { closeDropdown } = React.useContext(index.DropdownContext);
|
|
19
20
|
const { color, handleCancel, handleSave } = React.useContext(context.ColorPickerNewContext);
|
|
20
21
|
const [t] = useTranslation.useTranslation();
|
|
21
22
|
const handleCancelButton = () => {
|
|
22
|
-
|
|
23
|
+
closeDropdown === null || closeDropdown === void 0 ? void 0 : closeDropdown();
|
|
23
24
|
handleCancel === null || handleCancel === void 0 ? void 0 : handleCancel();
|
|
24
25
|
};
|
|
25
26
|
const handleSaveButton = () => {
|
|
26
|
-
|
|
27
|
-
handleSave(color);
|
|
27
|
+
closeDropdown === null || closeDropdown === void 0 ? void 0 : closeDropdown();
|
|
28
|
+
handleSave(utilities.getAllColorTypes(color));
|
|
28
29
|
};
|
|
29
30
|
return (React__default['default'].createElement("div", { className: `${main_module['default'][css_classes.cssColorPickerFooter]}` },
|
|
30
31
|
React__default['default'].createElement(index$1['default'], { size: "small", variant: "outline", onClick: handleCancelButton }, t('cancel')),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,6BAA6B,oEAAwE;AACrG;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,6BAA6B,oEAAwE;AACrG;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/build/cjs/packages/aurora/src/components/color_picker_new/components/color-picker-header.js
CHANGED
|
@@ -17,11 +17,20 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
17
17
|
const ColorPickerHeader = () => {
|
|
18
18
|
const { handleCancel } = React.useContext(context.ColorPickerNewContext);
|
|
19
19
|
const [t] = useTranslation.useTranslation();
|
|
20
|
-
const {
|
|
20
|
+
const { closeDropdown, isOpen } = React.useContext(index.DropdownContext);
|
|
21
21
|
const handleCancelButton = () => {
|
|
22
|
-
|
|
22
|
+
closePicker();
|
|
23
|
+
};
|
|
24
|
+
const closePicker = () => {
|
|
25
|
+
closeDropdown === null || closeDropdown === void 0 ? void 0 : closeDropdown();
|
|
23
26
|
handleCancel === null || handleCancel === void 0 ? void 0 : handleCancel();
|
|
24
27
|
};
|
|
28
|
+
React.useEffect(() => {
|
|
29
|
+
if (!isOpen)
|
|
30
|
+
return;
|
|
31
|
+
document.addEventListener('visibilitychange', closePicker);
|
|
32
|
+
return () => document.removeEventListener('visibilitychange', closePicker);
|
|
33
|
+
}, [isOpen]);
|
|
25
34
|
return (React__default['default'].createElement("div", { className: `${main_module['default'][css_classes.cssColorPickerHeader]}` },
|
|
26
35
|
t('Select color'),
|
|
27
36
|
React__default['default'].createElement("button", { onClick: handleCancelButton, className: `${main_module['default'][css_classes.cssColorPickerCloseIcon]}` },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,6BAA6B,oEAAwE;AACrG;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,6BAA6B,oEAAwE;AACrG;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;"}
|
|
@@ -7,7 +7,6 @@ var constants = require('../../constants.js');
|
|
|
7
7
|
var css_classes = require('../../css_classes.js');
|
|
8
8
|
var main_module = require('../../../../css/color_picker_new/main.module.less.js');
|
|
9
9
|
var colorPickerInputsHex = require('./color-picker-inputs-hex.js');
|
|
10
|
-
var colorPickerInputsHsl = require('./color-picker-inputs-hsl.js');
|
|
11
10
|
var colorPickerInputsRgba = require('./color-picker-inputs-rgba.js');
|
|
12
11
|
|
|
13
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -15,7 +14,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
15
14
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
16
15
|
|
|
17
16
|
const ColorPickerInputs = () => {
|
|
18
|
-
const [type, setType] = React.useState(constants.
|
|
17
|
+
const [type, setType] = React.useState(constants.COLOR_PICKER_TYPE_HEX);
|
|
19
18
|
const handleSelectType = (e) => {
|
|
20
19
|
setType(e.target.value);
|
|
21
20
|
};
|
|
@@ -25,8 +24,6 @@ const ColorPickerInputs = () => {
|
|
|
25
24
|
return React__default['default'].createElement(colorPickerInputsHex.ColorPickerInputsHex, null);
|
|
26
25
|
case constants.COLOR_PICKER_TYPE_RGB:
|
|
27
26
|
return React__default['default'].createElement(colorPickerInputsRgba.ColorPickerInputsRgba, null);
|
|
28
|
-
case constants.COLOR_PICKER_TYPE_HSL:
|
|
29
|
-
return React__default['default'].createElement(colorPickerInputsHsl.ColorPickerInputsHsl, null);
|
|
30
27
|
default:
|
|
31
28
|
return false;
|
|
32
29
|
}
|
|
@@ -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;
|
|
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;"}
|
package/build/cjs/packages/aurora/src/components/color_picker_new/components/color-picker-swatch.js
CHANGED
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var classnames = require('classnames');
|
|
7
7
|
var css_classes = require('../css_classes.js');
|
|
8
|
-
var main_module = require('../../../css/color_picker_new/main.module.less.js');
|
|
9
8
|
var utilities = require('../utilities.js');
|
|
9
|
+
var main_module = require('../../../css/color_picker_new/main.module.less.js');
|
|
10
10
|
|
|
11
11
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
12
|
|
|
@@ -6,8 +6,8 @@ var React = require('react');
|
|
|
6
6
|
var useTranslation = require('../../../../../../external/react-i18next/dist/es/useTranslation.js');
|
|
7
7
|
var css_classes = require('../css_classes.js');
|
|
8
8
|
var context = require('../context.js');
|
|
9
|
-
var main_module = require('../../../css/color_picker_new/main.module.less.js');
|
|
10
9
|
var utilities = require('../utilities.js');
|
|
10
|
+
var main_module = require('../../../css/color_picker_new/main.module.less.js');
|
|
11
11
|
var colorPickerSwatch = require('./color-picker-swatch.js');
|
|
12
12
|
|
|
13
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -6,13 +6,11 @@ const COLOR_PICKER_INITIAL_STATE = '000000';
|
|
|
6
6
|
const COLOR_PICKER_WIDTH = 220;
|
|
7
7
|
const COLOR_PICKER_HEIGHT = 200;
|
|
8
8
|
const COLOR_PICKER_TYPE_HEX = 'hex';
|
|
9
|
-
const COLOR_PICKER_TYPE_RGB = 'rgb';
|
|
10
|
-
const COLOR_PICKER_TYPE_HSL = 'hsl';
|
|
9
|
+
const COLOR_PICKER_TYPE_RGB = 'rgb';
|
|
11
10
|
|
|
12
11
|
exports.COLOR_PICKER_HEIGHT = COLOR_PICKER_HEIGHT;
|
|
13
12
|
exports.COLOR_PICKER_INITIAL_STATE = COLOR_PICKER_INITIAL_STATE;
|
|
14
13
|
exports.COLOR_PICKER_TYPE_HEX = COLOR_PICKER_TYPE_HEX;
|
|
15
|
-
exports.COLOR_PICKER_TYPE_HSL = COLOR_PICKER_TYPE_HSL;
|
|
16
14
|
exports.COLOR_PICKER_TYPE_RGB = COLOR_PICKER_TYPE_RGB;
|
|
17
15
|
exports.COLOR_PICKER_WIDTH = COLOR_PICKER_WIDTH;
|
|
18
16
|
//# sourceMappingURL=constants.js.map
|
|
@@ -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;
|
|
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;"}
|
|
@@ -29,7 +29,7 @@ const useColorPicker = ({ initialColor, onChange, onCancel, onSave }) => {
|
|
|
29
29
|
setAlphaValue(`${Math.round(rgbaArr[3] * 100)}`);
|
|
30
30
|
}, [rgbaArr[3]]);
|
|
31
31
|
React.useEffect(() => {
|
|
32
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(
|
|
32
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(utilities.getAllColorTypes(color));
|
|
33
33
|
}, [color]);
|
|
34
34
|
const handleCancel = () => {
|
|
35
35
|
setColor(choosenColor);
|
|
@@ -37,7 +37,7 @@ const useColorPicker = ({ initialColor, onChange, onCancel, onSave }) => {
|
|
|
37
37
|
};
|
|
38
38
|
const handleSave = () => {
|
|
39
39
|
setChoosenColor(color);
|
|
40
|
-
onSave === null || onSave === void 0 ? void 0 : onSave(
|
|
40
|
+
onSave === null || onSave === void 0 ? void 0 : onSave(utilities.getAllColorTypes(color));
|
|
41
41
|
};
|
|
42
42
|
const handlePickSwatch = (color) => {
|
|
43
43
|
setColor(color);
|
|
@@ -7,6 +7,9 @@ var tinycolor = require('../../../../../external/tinycolor2/esm/tinycolor.js');
|
|
|
7
7
|
const getTinyColorInstance = (color) => {
|
|
8
8
|
return tinycolor['default'](color);
|
|
9
9
|
};
|
|
10
|
+
const getRgbaValue = (colorSet) => {
|
|
11
|
+
return colorSet.toRgb();
|
|
12
|
+
};
|
|
10
13
|
const getHexValue = (colorSet) => {
|
|
11
14
|
const alphaValue = colorSet.getAlpha();
|
|
12
15
|
return alphaValue < 1 ? colorSet.toHex8() : colorSet.toHex();
|
|
@@ -17,10 +20,28 @@ const getHexValueString = (colorSet) => {
|
|
|
17
20
|
const isHexChar = (value) => {
|
|
18
21
|
const hexRegEx = /^$|[0-9a-fA-F]+$/;
|
|
19
22
|
return hexRegEx.test(value);
|
|
23
|
+
};
|
|
24
|
+
const getAllColorTypes = (color) => {
|
|
25
|
+
const tinyColor = getTinyColorInstance(color);
|
|
26
|
+
const rgba = getRgbaValue(tinyColor);
|
|
27
|
+
const hex = getHexValue(tinyColor);
|
|
28
|
+
const hexString = getHexValueString(tinyColor);
|
|
29
|
+
return {
|
|
30
|
+
rgba: {
|
|
31
|
+
r: rgba.r,
|
|
32
|
+
g: rgba.g,
|
|
33
|
+
b: rgba.b,
|
|
34
|
+
a: rgba.a
|
|
35
|
+
},
|
|
36
|
+
hex: hex,
|
|
37
|
+
hexString: hexString
|
|
38
|
+
};
|
|
20
39
|
};
|
|
21
40
|
|
|
41
|
+
exports.getAllColorTypes = getAllColorTypes;
|
|
22
42
|
exports.getHexValue = getHexValue;
|
|
23
43
|
exports.getHexValueString = getHexValueString;
|
|
44
|
+
exports.getRgbaValue = getRgbaValue;
|
|
24
45
|
exports.getTinyColorInstance = getTinyColorInstance;
|
|
25
46
|
exports.isHexChar = isHexChar;
|
|
26
47
|
//# sourceMappingURL=utilities.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,wBAAwB,qDAAyD;AACjF;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,wBAAwB,qDAAyD;AACjF;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;"}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var styleInject_es = require('../../../../../external/style-inject/dist/style-inject.es.js');
|
|
6
6
|
|
|
7
|
-
var css_248z = "/* font colors */\n/* actions */\n/* background */\n/* errors */\n/* borders */\n/* grid */\n/* scrollBar */\n/* sizes */\n.main-module_color-picker__container__14ccI {\n display: flex;\n flex-direction: column;\n max-width: 250px;\n padding: 9px 16px;\n}\n.main-module_color-picker__rbgcp__2FKdw canvas {\n border-radius: 4px;\n overflow: hidden;\n}\n.main-module_color-picker__rbgcp__2FKdw > div {\n display: flex;\n flex-direction: column;\n}\n.main-module_color-picker__rbgcp__2FKdw > div > div:nth-child(2) {\n order: -1;\n padding: 0 !important;\n margin-bottom: 10px;\n}\n.main-module_color-picker__rbgcp__2FKdw > div > div:nth-child(4) {\n margin-top:
|
|
7
|
+
var css_248z = "/* font colors */\n/* actions */\n/* background */\n/* errors */\n/* borders */\n/* grid */\n/* scrollBar */\n/* sizes */\n.main-module_color-picker__container__14ccI {\n display: flex;\n flex-direction: column;\n max-width: 250px;\n padding: 9px 16px;\n}\n.main-module_color-picker__rbgcp__2FKdw canvas {\n border-radius: 4px;\n overflow: hidden;\n}\n.main-module_color-picker__rbgcp__2FKdw > div {\n display: flex;\n flex-direction: column;\n}\n.main-module_color-picker__rbgcp__2FKdw > div > div:nth-child(2) {\n order: -1;\n padding: 0 !important;\n margin-bottom: 10px;\n}\n.main-module_color-picker__rbgcp__2FKdw > div > div:nth-child(2) div > div {\n background-color: #F3F4F8;\n}\n.main-module_color-picker__rbgcp__2FKdw > div > div:nth-child(2) div > div div:nth-child(1) div {\n width: 24px;\n height: 24px;\n background: no-repeat url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIHZpZXdCb3g9IjAgMCAxMiAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMS43NTc5IDIuNTgwMjFMMTAuNTg4OCAzLjc0OTI1TDExLjc1NzkgNC45MTgzTDEwLjU4ODggNi4wODczNEwxMC4wMDQzIDUuNTAyODJMMy43NDkyNSAxMS43NTc5QzMuNTg5OCAxMS45MTczIDMuMzcyMTMgMTIuMDA0NyAzLjE0NjY5IDExLjk5OThMMC44NTg1NTUgMTEuOTQ5OEMwLjQxNjE1MiAxMS45NDAyIDAuMDU5ODE2MiAxMS41ODM4IDAuMDUwMTU2OCAxMS4xNDE0TDAuMDAwMTk3MjMxIDguODUzMzJDLTAuMDA0NzI1MDIgOC42Mjc4NyAwLjA4MjY2NTkgOC40MTAyIDAuMjQyMTE4IDguMjUwNzVMNi40OTcxOCAxLjk5NTY5TDUuOTEyNjYgMS40MTExNkw3LjA4MTcgMC4yNDIxMTlMOC4yNTA3NSAxLjQxMTE2TDkuNDE5NzkgMC4yNDIxMTdDOS43NDI2MSAtMC4wODA3MDU3IDEwLjI2NiAtMC4wODA3MDU3IDEwLjU4ODggMC4yNDIxMTdMMTEuNzU3OSAxLjQxMTE2QzEyLjA4MDcgMS43MzM5OCAxMi4wODA3IDIuMjU3MzggMTEuNzU3OSAyLjU4MDIxWk03LjY2NjIzIDMuMTY0NzNMMi4wNzc3IDguNzUzMjZMMy4yNDY3NCA5LjkyMjNMOC44MzUyNyA0LjMzMzc4TDcuNjY2MjMgMy4xNjQ3M1oiIGZpbGw9IiM1QzY1N0UiLz4KPC9zdmc+Cg==) center;\n cursor: pointer;\n}\n.main-module_color-picker__rbgcp__2FKdw > div > div:nth-child(2) div > div svg {\n display: none;\n}\n.main-module_color-picker__rbgcp__2FKdw > div > div:nth-child(4) {\n margin-top: 10px !important;\n}\n.main-module_color-picker__header__NFjKK {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 4px 16px 9px 16px;\n border-bottom: 1px solid #f3f4f8;\n color: #2d3748;\n}\n.main-module_color-picker__footer__3JvEl {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 8px;\n margin-top: 8px;\n padding: 6px 16px 0 16px;\n border-top: 1px solid #f3f4f8;\n}\n.main-module_color-picker__swatches__1s2pY {\n margin-top: 16px;\n}\n.main-module_color-picker__swatches-header__187FL {\n margin-bottom: 4px;\n color: #2d3748;\n}\n.main-module_color-picker__swatches-content__3EFZR {\n display: flex;\n justify-content: space-between;\n gap: 4px;\n}\n.main-module_color-picker__swatch__2IbgR {\n position: relative;\n width: 26px;\n height: 26px;\n border-radius: 3px;\n background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAADFJREFUOE9jZGBgEGHAD97gk2YcNYBhmIQBgWSAP52AwoAQwJvQRg1gACckQoC2gQgAIF8IscwEtKYAAAAASUVORK5CYII=) left center;\n overflow: hidden;\n}\n.main-module_color-picker__swatch_small__3Z0pq {\n width: 16px;\n height: 16px;\n}\n.main-module_color-picker__swatch_big__2tsQC {\n width: 30px;\n height: 30px;\n}\n.main-module_color-picker__swatch-fill__3D88w {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n border-radius: 3px;\n box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);\n}\n.main-module_color-picker__input-container__1cC2e {\n position: relative;\n}\n.main-module_color-picker__input-container__1cC2e input {\n padding-left: 41px;\n}\n.main-module_color-picker__input-color-swatch-container__3WX9B {\n position: absolute;\n top: 7px;\n left: 10px;\n}\n.main-module_color-picker__inputs__3Cmmw {\n display: flex;\n align-items: center;\n gap: 8px;\n margin-top: 15px;\n}\n.main-module_color-picker__inputs-type__1loVJ select {\n font-size: 12px;\n color: #2d3748;\n text-transform: uppercase;\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='4' viewBox='0 0 6 4' fill='none'%3E%3Cpath d='M3.28615 3.86114C3.12455 4.04629 2.87545 4.04629 2.71385 3.86114L0.136577 0.908383C-0.145619 0.585074 0.0386869 -4.16709e-08 0.422729 0L5.57727 5.59302e-07C5.96131 6.00973e-07 6.14562 0.585074 5.86342 0.908383L3.28615 3.86114Z' fill='%235C657E'/%3E%3C/svg%3E\");\n background-repeat: no-repeat;\n background-position: center right;\n padding-right: 10px;\n -moz-appearance: none;\n -webkit-appearance: none;\n appearance: none;\n}\n.main-module_color-picker__inputs-value-container__3ErVj {\n display: flex;\n border: 1px solid #ececec;\n border-radius: 4px;\n overflow: hidden;\n}\n.main-module_color-picker__inputs-value-container__3ErVj input {\n border-color: transparent;\n border-radius: 0;\n}\n.main-module_color-picker__inputs-value-container__3ErVj input:hover {\n border-color: transparent;\n}\n.main-module_color-picker__inputs-value-container__3ErVj input:not(:last-child) {\n border-right: 1px solid #ececec;\n}\n.main-module_color-picker__inputs-value-container__3ErVj input:not(:last-child):hover {\n border-right: 1px solid #ececec;\n}\n.main-module_color-picker__inputs-value-container__3ErVj input:last-child {\n width: 44px;\n}\n.main-module_color-picker__close-icon__JcWAL {\n display: flex;\n background-color: transparent;\n cursor: pointer;\n}\n.main-module_color-picker__close-icon__JcWAL svg {\n fill: #2d3748;\n}\n";
|
|
8
8
|
var styles = {"color-picker__container":"main-module_color-picker__container__14ccI","color-picker__rbgcp":"main-module_color-picker__rbgcp__2FKdw","color-picker__header":"main-module_color-picker__header__NFjKK","color-picker__footer":"main-module_color-picker__footer__3JvEl","color-picker__swatches":"main-module_color-picker__swatches__1s2pY","color-picker__swatches-header":"main-module_color-picker__swatches-header__187FL","color-picker__swatches-content":"main-module_color-picker__swatches-content__3EFZR","color-picker__swatch":"main-module_color-picker__swatch__2IbgR","color-picker__swatch_small":"main-module_color-picker__swatch_small__3Z0pq","color-picker__swatch_big":"main-module_color-picker__swatch_big__2tsQC","color-picker__swatch-fill":"main-module_color-picker__swatch-fill__3D88w","color-picker__input-container":"main-module_color-picker__input-container__1cC2e","color-picker__input-color-swatch-container":"main-module_color-picker__input-color-swatch-container__3WX9B","color-picker__inputs":"main-module_color-picker__inputs__3Cmmw","color-picker__inputs-type":"main-module_color-picker__inputs-type__1loVJ","color-picker__inputs-value-container":"main-module_color-picker__inputs-value-container__3ErVj","color-picker__close-icon":"main-module_color-picker__close-icon__JcWAL"};
|
|
9
9
|
styleInject_es['default'](css_248z);
|
|
10
10
|
|
package/build/esm/packages/aurora/src/components/color_picker_new/components/color-picker-footer.js
CHANGED
|
@@ -4,19 +4,20 @@ import Button from '../../button/index.js';
|
|
|
4
4
|
import { DropdownContext } from '../../dropdown/context/index.js';
|
|
5
5
|
import { cssColorPickerFooter } from '../css_classes.js';
|
|
6
6
|
import { ColorPickerNewContext } from '../context.js';
|
|
7
|
+
import { getAllColorTypes } from '../utilities.js';
|
|
7
8
|
import styles from '../../../css/color_picker_new/main.module.less.js';
|
|
8
9
|
|
|
9
10
|
const ColorPickerFooter = () => {
|
|
10
|
-
const {
|
|
11
|
+
const { closeDropdown } = useContext(DropdownContext);
|
|
11
12
|
const { color, handleCancel, handleSave } = useContext(ColorPickerNewContext);
|
|
12
13
|
const [t] = useTranslation();
|
|
13
14
|
const handleCancelButton = () => {
|
|
14
|
-
|
|
15
|
+
closeDropdown === null || closeDropdown === void 0 ? void 0 : closeDropdown();
|
|
15
16
|
handleCancel === null || handleCancel === void 0 ? void 0 : handleCancel();
|
|
16
17
|
};
|
|
17
18
|
const handleSaveButton = () => {
|
|
18
|
-
|
|
19
|
-
handleSave(color);
|
|
19
|
+
closeDropdown === null || closeDropdown === void 0 ? void 0 : closeDropdown();
|
|
20
|
+
handleSave(getAllColorTypes(color));
|
|
20
21
|
};
|
|
21
22
|
return (React.createElement("div", { className: `${styles[cssColorPickerFooter]}` },
|
|
22
23
|
React.createElement(Button, { size: "small", variant: "outline", onClick: handleCancelButton }, t('cancel')),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA,+BAA+B,oEAAwE;AACvG;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,+BAA+B,oEAAwE;AACvG;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/build/esm/packages/aurora/src/components/color_picker_new/components/color-picker-header.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
1
|
+
import React, { useContext, useEffect } from 'react';
|
|
2
2
|
import { useTranslation } from '../../../../../../external/react-i18next/dist/es/useTranslation.js';
|
|
3
3
|
import { DropdownContext } from '../../dropdown/context/index.js';
|
|
4
4
|
import { cssColorPickerHeader, cssColorPickerCloseIcon } from '../css_classes.js';
|
|
@@ -9,11 +9,20 @@ import IconClose from '../../../assets/icon_close.js';
|
|
|
9
9
|
const ColorPickerHeader = () => {
|
|
10
10
|
const { handleCancel } = useContext(ColorPickerNewContext);
|
|
11
11
|
const [t] = useTranslation();
|
|
12
|
-
const {
|
|
12
|
+
const { closeDropdown, isOpen } = useContext(DropdownContext);
|
|
13
13
|
const handleCancelButton = () => {
|
|
14
|
-
|
|
14
|
+
closePicker();
|
|
15
|
+
};
|
|
16
|
+
const closePicker = () => {
|
|
17
|
+
closeDropdown === null || closeDropdown === void 0 ? void 0 : closeDropdown();
|
|
15
18
|
handleCancel === null || handleCancel === void 0 ? void 0 : handleCancel();
|
|
16
19
|
};
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (!isOpen)
|
|
22
|
+
return;
|
|
23
|
+
document.addEventListener('visibilitychange', closePicker);
|
|
24
|
+
return () => document.removeEventListener('visibilitychange', closePicker);
|
|
25
|
+
}, [isOpen]);
|
|
17
26
|
return (React.createElement("div", { className: `${styles[cssColorPickerHeader]}` },
|
|
18
27
|
t('Select color'),
|
|
19
28
|
React.createElement("button", { onClick: handleCancelButton, className: `${styles[cssColorPickerCloseIcon]}` },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA,+BAA+B,oEAAwE;AACvG;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,+BAA+B,oEAAwE;AACvG;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,13 +1,12 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { COLOR_PICKER_TYPE_HEX, COLOR_PICKER_TYPE_RGB } from '../../constants.js';
|
|
3
3
|
import { cssColorPickerInputs, cssColorPickerInputsType, cssColorPickerInputsValue, cssColorPickerInputsValueContainer } from '../../css_classes.js';
|
|
4
4
|
import styles from '../../../../css/color_picker_new/main.module.less.js';
|
|
5
5
|
import { ColorPickerInputsHex } from './color-picker-inputs-hex.js';
|
|
6
|
-
import { ColorPickerInputsHsl } from './color-picker-inputs-hsl.js';
|
|
7
6
|
import { ColorPickerInputsRgba } from './color-picker-inputs-rgba.js';
|
|
8
7
|
|
|
9
8
|
const ColorPickerInputs = () => {
|
|
10
|
-
const [type, setType] = useState(
|
|
9
|
+
const [type, setType] = useState(COLOR_PICKER_TYPE_HEX);
|
|
11
10
|
const handleSelectType = (e) => {
|
|
12
11
|
setType(e.target.value);
|
|
13
12
|
};
|
|
@@ -17,8 +16,6 @@ const ColorPickerInputs = () => {
|
|
|
17
16
|
return React.createElement(ColorPickerInputsHex, null);
|
|
18
17
|
case COLOR_PICKER_TYPE_RGB:
|
|
19
18
|
return React.createElement(ColorPickerInputsRgba, null);
|
|
20
|
-
case COLOR_PICKER_TYPE_HSL:
|
|
21
|
-
return React.createElement(ColorPickerInputsHsl, null);
|
|
22
19
|
default:
|
|
23
20
|
return false;
|
|
24
21
|
}
|
|
@@ -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;
|
|
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;"}
|
package/build/esm/packages/aurora/src/components/color_picker_new/components/color-picker-swatch.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import { cssColorPickerSwatch, cssColorPickerSwatchSmall, cssColorPickerSwatchBig, cssColorPickerSwatchFill } from '../css_classes.js';
|
|
4
|
-
import styles from '../../../css/color_picker_new/main.module.less.js';
|
|
5
4
|
import { getTinyColorInstance, getHexValueString } from '../utilities.js';
|
|
5
|
+
import styles from '../../../css/color_picker_new/main.module.less.js';
|
|
6
6
|
|
|
7
7
|
const ColorPickerSwatch = ({ color, size, onClick }) => {
|
|
8
8
|
const colorTiny = getTinyColorInstance(color);
|
|
@@ -2,8 +2,8 @@ import React, { useContext } from 'react';
|
|
|
2
2
|
import { useTranslation } from '../../../../../../external/react-i18next/dist/es/useTranslation.js';
|
|
3
3
|
import { cssColorPickerSwatches, cssColorPickerSwatchesHeader, cssColorPickerSwatchesContent } from '../css_classes.js';
|
|
4
4
|
import { ColorPickerNewContext } from '../context.js';
|
|
5
|
-
import styles from '../../../css/color_picker_new/main.module.less.js';
|
|
6
5
|
import { getTinyColorInstance, getHexValue } from '../utilities.js';
|
|
6
|
+
import styles from '../../../css/color_picker_new/main.module.less.js';
|
|
7
7
|
import { ColorPickerSwatch } from './color-picker-swatch.js';
|
|
8
8
|
|
|
9
9
|
const ColorPickerSwatches = () => {
|
|
@@ -2,8 +2,7 @@ const COLOR_PICKER_INITIAL_STATE = '000000';
|
|
|
2
2
|
const COLOR_PICKER_WIDTH = 220;
|
|
3
3
|
const COLOR_PICKER_HEIGHT = 200;
|
|
4
4
|
const COLOR_PICKER_TYPE_HEX = 'hex';
|
|
5
|
-
const COLOR_PICKER_TYPE_RGB = 'rgb';
|
|
6
|
-
const COLOR_PICKER_TYPE_HSL = 'hsl';
|
|
5
|
+
const COLOR_PICKER_TYPE_RGB = 'rgb';
|
|
7
6
|
|
|
8
|
-
export { COLOR_PICKER_HEIGHT, COLOR_PICKER_INITIAL_STATE, COLOR_PICKER_TYPE_HEX,
|
|
7
|
+
export { COLOR_PICKER_HEIGHT, COLOR_PICKER_INITIAL_STATE, COLOR_PICKER_TYPE_HEX, COLOR_PICKER_TYPE_RGB, COLOR_PICKER_WIDTH };
|
|
9
8
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
package/build/esm/packages/aurora/src/components/color_picker_new/hooks/use_color_picker.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ColorPickerColorTypes } from '../types';
|
|
2
|
+
import { ColorPickerColorTypes, IColorPickerColor } from '../types';
|
|
3
3
|
export declare type ColorPickerHookProps = {
|
|
4
4
|
initialColor?: ColorPickerColorTypes['hex'];
|
|
5
|
-
onChange?: (color:
|
|
5
|
+
onChange?: (color: IColorPickerColor) => void;
|
|
6
6
|
onCancel?: () => void;
|
|
7
|
-
onSave?: (color:
|
|
7
|
+
onSave?: (color: IColorPickerColor) => void;
|
|
8
8
|
};
|
|
9
9
|
declare const useColorPicker: ({ initialColor, onChange, onCancel, onSave }: ColorPickerHookProps) => {
|
|
10
10
|
color: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState, useEffect } from 'react';
|
|
2
2
|
import { COLOR_PICKER_INITIAL_STATE } from '../constants.js';
|
|
3
3
|
import { useColorPicker as useColorPicker$1 } from '../../../../../../external/react-best-gradient-color-picker/dist/esm/hooks/useColorPicker.js';
|
|
4
|
-
import { getTinyColorInstance, getHexValue, getHexValueString } from '../utilities.js';
|
|
4
|
+
import { getTinyColorInstance, getHexValue, getHexValueString, getAllColorTypes } from '../utilities.js';
|
|
5
5
|
|
|
6
6
|
const useColorPicker = ({ initialColor, onChange, onCancel, onSave }) => {
|
|
7
7
|
const [choosenColor, setChoosenColor] = useState(initialColor ? initialColor : COLOR_PICKER_INITIAL_STATE);
|
|
@@ -25,7 +25,7 @@ const useColorPicker = ({ initialColor, onChange, onCancel, onSave }) => {
|
|
|
25
25
|
setAlphaValue(`${Math.round(rgbaArr[3] * 100)}`);
|
|
26
26
|
}, [rgbaArr[3]]);
|
|
27
27
|
useEffect(() => {
|
|
28
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(
|
|
28
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(getAllColorTypes(color));
|
|
29
29
|
}, [color]);
|
|
30
30
|
const handleCancel = () => {
|
|
31
31
|
setColor(choosenColor);
|
|
@@ -33,7 +33,7 @@ const useColorPicker = ({ initialColor, onChange, onCancel, onSave }) => {
|
|
|
33
33
|
};
|
|
34
34
|
const handleSave = () => {
|
|
35
35
|
setChoosenColor(color);
|
|
36
|
-
onSave === null || onSave === void 0 ? void 0 : onSave(
|
|
36
|
+
onSave === null || onSave === void 0 ? void 0 : onSave(getAllColorTypes(color));
|
|
37
37
|
};
|
|
38
38
|
const handlePickSwatch = (color) => {
|
|
39
39
|
setColor(color);
|
|
@@ -6,10 +6,10 @@ export interface IColorPickerNewPureProps {
|
|
|
6
6
|
export interface IColorPickerNewProps {
|
|
7
7
|
id: string;
|
|
8
8
|
name?: string;
|
|
9
|
-
initialColor?:
|
|
10
|
-
onChange?: (color: IColorPickerColor
|
|
9
|
+
initialColor?: ColorPickerColorTypes['hex'] | undefined;
|
|
10
|
+
onChange?: (color: IColorPickerColor) => void;
|
|
11
11
|
onCancel?: () => void;
|
|
12
|
-
onSave?: (color: IColorPickerColor
|
|
12
|
+
onSave?: (color: IColorPickerColor) => void;
|
|
13
13
|
}
|
|
14
14
|
export interface IColorPickerNewContextProps {
|
|
15
15
|
color: string;
|
|
@@ -27,7 +27,7 @@ export interface IColorPickerNewContextProps {
|
|
|
27
27
|
setG: (newG: number) => void;
|
|
28
28
|
setB: (newB: number) => void;
|
|
29
29
|
handleCancel: () => void;
|
|
30
|
-
handleSave: (color: IColorPickerColor
|
|
30
|
+
handleSave: (color: IColorPickerColor) => void;
|
|
31
31
|
handlePickSwatch: (color: string) => void;
|
|
32
32
|
}
|
|
33
33
|
export declare type ColorPickerColorTypes = {
|
|
@@ -37,13 +37,16 @@ export declare type ColorPickerColorTypes = {
|
|
|
37
37
|
s: number;
|
|
38
38
|
l: number;
|
|
39
39
|
};
|
|
40
|
-
|
|
40
|
+
rgba: {
|
|
41
41
|
r: number;
|
|
42
42
|
g: number;
|
|
43
43
|
b: number;
|
|
44
|
+
a?: number;
|
|
44
45
|
};
|
|
45
46
|
};
|
|
46
47
|
export declare type IColorPickerColor = {
|
|
47
|
-
|
|
48
|
+
rgba: ColorPickerColorTypes['rgba'];
|
|
49
|
+
hex: string;
|
|
50
|
+
hexString: string;
|
|
48
51
|
};
|
|
49
|
-
export declare type ColorPickerColors = ColorPickerColorTypes['hex'] | ColorPickerColorTypes['hsl'] | ColorPickerColorTypes['
|
|
52
|
+
export declare type ColorPickerColors = ColorPickerColorTypes['hex'] | ColorPickerColorTypes['hsl'] | ColorPickerColorTypes['rgba'];
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { ColorPickerColors } from './types';
|
|
1
|
+
import { ColorPickerColors, IColorPickerColor } from './types';
|
|
2
2
|
import tinycolor from 'tinycolor2';
|
|
3
3
|
export declare const getTinyColorInstance: (color: ColorPickerColors) => tinycolor.Instance;
|
|
4
|
+
export declare const getRgbaValue: (colorSet: tinycolor.Instance) => tinycolor.ColorFormats.RGBA;
|
|
4
5
|
export declare const getHexValue: (colorSet: tinycolor.Instance) => string;
|
|
5
6
|
export declare const getHexValueString: (colorSet: tinycolor.Instance) => string;
|
|
6
7
|
export declare const isHexChar: (value: string) => boolean;
|
|
8
|
+
export declare const getAllColorTypes: (color: string) => IColorPickerColor;
|
|
@@ -3,6 +3,9 @@ import tinycolor from '../../../../../external/tinycolor2/esm/tinycolor.js';
|
|
|
3
3
|
const getTinyColorInstance = (color) => {
|
|
4
4
|
return tinycolor(color);
|
|
5
5
|
};
|
|
6
|
+
const getRgbaValue = (colorSet) => {
|
|
7
|
+
return colorSet.toRgb();
|
|
8
|
+
};
|
|
6
9
|
const getHexValue = (colorSet) => {
|
|
7
10
|
const alphaValue = colorSet.getAlpha();
|
|
8
11
|
return alphaValue < 1 ? colorSet.toHex8() : colorSet.toHex();
|
|
@@ -13,7 +16,23 @@ const getHexValueString = (colorSet) => {
|
|
|
13
16
|
const isHexChar = (value) => {
|
|
14
17
|
const hexRegEx = /^$|[0-9a-fA-F]+$/;
|
|
15
18
|
return hexRegEx.test(value);
|
|
19
|
+
};
|
|
20
|
+
const getAllColorTypes = (color) => {
|
|
21
|
+
const tinyColor = getTinyColorInstance(color);
|
|
22
|
+
const rgba = getRgbaValue(tinyColor);
|
|
23
|
+
const hex = getHexValue(tinyColor);
|
|
24
|
+
const hexString = getHexValueString(tinyColor);
|
|
25
|
+
return {
|
|
26
|
+
rgba: {
|
|
27
|
+
r: rgba.r,
|
|
28
|
+
g: rgba.g,
|
|
29
|
+
b: rgba.b,
|
|
30
|
+
a: rgba.a
|
|
31
|
+
},
|
|
32
|
+
hex: hex,
|
|
33
|
+
hexString: hexString
|
|
34
|
+
};
|
|
16
35
|
};
|
|
17
36
|
|
|
18
|
-
export { getHexValue, getHexValueString, getTinyColorInstance, isHexChar };
|
|
37
|
+
export { getAllColorTypes, getHexValue, getHexValueString, getRgbaValue, getTinyColorInstance, isHexChar };
|
|
19
38
|
//# sourceMappingURL=utilities.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,sBAAsB,qDAAyD;AAC/E;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,sBAAsB,qDAAyD;AAC/E;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,6 +1,6 @@
|
|
|
1
1
|
import styleInject from '../../../../../external/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = "/* font colors */\n/* actions */\n/* background */\n/* errors */\n/* borders */\n/* grid */\n/* scrollBar */\n/* sizes */\n.main-module_color-picker__container__14ccI {\n display: flex;\n flex-direction: column;\n max-width: 250px;\n padding: 9px 16px;\n}\n.main-module_color-picker__rbgcp__2FKdw canvas {\n border-radius: 4px;\n overflow: hidden;\n}\n.main-module_color-picker__rbgcp__2FKdw > div {\n display: flex;\n flex-direction: column;\n}\n.main-module_color-picker__rbgcp__2FKdw > div > div:nth-child(2) {\n order: -1;\n padding: 0 !important;\n margin-bottom: 10px;\n}\n.main-module_color-picker__rbgcp__2FKdw > div > div:nth-child(4) {\n margin-top:
|
|
3
|
+
var css_248z = "/* font colors */\n/* actions */\n/* background */\n/* errors */\n/* borders */\n/* grid */\n/* scrollBar */\n/* sizes */\n.main-module_color-picker__container__14ccI {\n display: flex;\n flex-direction: column;\n max-width: 250px;\n padding: 9px 16px;\n}\n.main-module_color-picker__rbgcp__2FKdw canvas {\n border-radius: 4px;\n overflow: hidden;\n}\n.main-module_color-picker__rbgcp__2FKdw > div {\n display: flex;\n flex-direction: column;\n}\n.main-module_color-picker__rbgcp__2FKdw > div > div:nth-child(2) {\n order: -1;\n padding: 0 !important;\n margin-bottom: 10px;\n}\n.main-module_color-picker__rbgcp__2FKdw > div > div:nth-child(2) div > div {\n background-color: #F3F4F8;\n}\n.main-module_color-picker__rbgcp__2FKdw > div > div:nth-child(2) div > div div:nth-child(1) div {\n width: 24px;\n height: 24px;\n background: no-repeat url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIHZpZXdCb3g9IjAgMCAxMiAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMS43NTc5IDIuNTgwMjFMMTAuNTg4OCAzLjc0OTI1TDExLjc1NzkgNC45MTgzTDEwLjU4ODggNi4wODczNEwxMC4wMDQzIDUuNTAyODJMMy43NDkyNSAxMS43NTc5QzMuNTg5OCAxMS45MTczIDMuMzcyMTMgMTIuMDA0NyAzLjE0NjY5IDExLjk5OThMMC44NTg1NTUgMTEuOTQ5OEMwLjQxNjE1MiAxMS45NDAyIDAuMDU5ODE2MiAxMS41ODM4IDAuMDUwMTU2OCAxMS4xNDE0TDAuMDAwMTk3MjMxIDguODUzMzJDLTAuMDA0NzI1MDIgOC42Mjc4NyAwLjA4MjY2NTkgOC40MTAyIDAuMjQyMTE4IDguMjUwNzVMNi40OTcxOCAxLjk5NTY5TDUuOTEyNjYgMS40MTExNkw3LjA4MTcgMC4yNDIxMTlMOC4yNTA3NSAxLjQxMTE2TDkuNDE5NzkgMC4yNDIxMTdDOS43NDI2MSAtMC4wODA3MDU3IDEwLjI2NiAtMC4wODA3MDU3IDEwLjU4ODggMC4yNDIxMTdMMTEuNzU3OSAxLjQxMTE2QzEyLjA4MDcgMS43MzM5OCAxMi4wODA3IDIuMjU3MzggMTEuNzU3OSAyLjU4MDIxWk03LjY2NjIzIDMuMTY0NzNMMi4wNzc3IDguNzUzMjZMMy4yNDY3NCA5LjkyMjNMOC44MzUyNyA0LjMzMzc4TDcuNjY2MjMgMy4xNjQ3M1oiIGZpbGw9IiM1QzY1N0UiLz4KPC9zdmc+Cg==) center;\n cursor: pointer;\n}\n.main-module_color-picker__rbgcp__2FKdw > div > div:nth-child(2) div > div svg {\n display: none;\n}\n.main-module_color-picker__rbgcp__2FKdw > div > div:nth-child(4) {\n margin-top: 10px !important;\n}\n.main-module_color-picker__header__NFjKK {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 4px 16px 9px 16px;\n border-bottom: 1px solid #f3f4f8;\n color: #2d3748;\n}\n.main-module_color-picker__footer__3JvEl {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 8px;\n margin-top: 8px;\n padding: 6px 16px 0 16px;\n border-top: 1px solid #f3f4f8;\n}\n.main-module_color-picker__swatches__1s2pY {\n margin-top: 16px;\n}\n.main-module_color-picker__swatches-header__187FL {\n margin-bottom: 4px;\n color: #2d3748;\n}\n.main-module_color-picker__swatches-content__3EFZR {\n display: flex;\n justify-content: space-between;\n gap: 4px;\n}\n.main-module_color-picker__swatch__2IbgR {\n position: relative;\n width: 26px;\n height: 26px;\n border-radius: 3px;\n background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAADFJREFUOE9jZGBgEGHAD97gk2YcNYBhmIQBgWSAP52AwoAQwJvQRg1gACckQoC2gQgAIF8IscwEtKYAAAAASUVORK5CYII=) left center;\n overflow: hidden;\n}\n.main-module_color-picker__swatch_small__3Z0pq {\n width: 16px;\n height: 16px;\n}\n.main-module_color-picker__swatch_big__2tsQC {\n width: 30px;\n height: 30px;\n}\n.main-module_color-picker__swatch-fill__3D88w {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n border-radius: 3px;\n box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);\n}\n.main-module_color-picker__input-container__1cC2e {\n position: relative;\n}\n.main-module_color-picker__input-container__1cC2e input {\n padding-left: 41px;\n}\n.main-module_color-picker__input-color-swatch-container__3WX9B {\n position: absolute;\n top: 7px;\n left: 10px;\n}\n.main-module_color-picker__inputs__3Cmmw {\n display: flex;\n align-items: center;\n gap: 8px;\n margin-top: 15px;\n}\n.main-module_color-picker__inputs-type__1loVJ select {\n font-size: 12px;\n color: #2d3748;\n text-transform: uppercase;\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='4' viewBox='0 0 6 4' fill='none'%3E%3Cpath d='M3.28615 3.86114C3.12455 4.04629 2.87545 4.04629 2.71385 3.86114L0.136577 0.908383C-0.145619 0.585074 0.0386869 -4.16709e-08 0.422729 0L5.57727 5.59302e-07C5.96131 6.00973e-07 6.14562 0.585074 5.86342 0.908383L3.28615 3.86114Z' fill='%235C657E'/%3E%3C/svg%3E\");\n background-repeat: no-repeat;\n background-position: center right;\n padding-right: 10px;\n -moz-appearance: none;\n -webkit-appearance: none;\n appearance: none;\n}\n.main-module_color-picker__inputs-value-container__3ErVj {\n display: flex;\n border: 1px solid #ececec;\n border-radius: 4px;\n overflow: hidden;\n}\n.main-module_color-picker__inputs-value-container__3ErVj input {\n border-color: transparent;\n border-radius: 0;\n}\n.main-module_color-picker__inputs-value-container__3ErVj input:hover {\n border-color: transparent;\n}\n.main-module_color-picker__inputs-value-container__3ErVj input:not(:last-child) {\n border-right: 1px solid #ececec;\n}\n.main-module_color-picker__inputs-value-container__3ErVj input:not(:last-child):hover {\n border-right: 1px solid #ececec;\n}\n.main-module_color-picker__inputs-value-container__3ErVj input:last-child {\n width: 44px;\n}\n.main-module_color-picker__close-icon__JcWAL {\n display: flex;\n background-color: transparent;\n cursor: pointer;\n}\n.main-module_color-picker__close-icon__JcWAL svg {\n fill: #2d3748;\n}\n";
|
|
4
4
|
var styles = {"color-picker__container":"main-module_color-picker__container__14ccI","color-picker__rbgcp":"main-module_color-picker__rbgcp__2FKdw","color-picker__header":"main-module_color-picker__header__NFjKK","color-picker__footer":"main-module_color-picker__footer__3JvEl","color-picker__swatches":"main-module_color-picker__swatches__1s2pY","color-picker__swatches-header":"main-module_color-picker__swatches-header__187FL","color-picker__swatches-content":"main-module_color-picker__swatches-content__3EFZR","color-picker__swatch":"main-module_color-picker__swatch__2IbgR","color-picker__swatch_small":"main-module_color-picker__swatch_small__3Z0pq","color-picker__swatch_big":"main-module_color-picker__swatch_big__2tsQC","color-picker__swatch-fill":"main-module_color-picker__swatch-fill__3D88w","color-picker__input-container":"main-module_color-picker__input-container__1cC2e","color-picker__input-color-swatch-container":"main-module_color-picker__input-color-swatch-container__3WX9B","color-picker__inputs":"main-module_color-picker__inputs__3Cmmw","color-picker__inputs-type":"main-module_color-picker__inputs-type__1loVJ","color-picker__inputs-value-container":"main-module_color-picker__inputs-value-container__3ErVj","color-picker__close-icon":"main-module_color-picker__close-icon__JcWAL"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
package/package.json
CHANGED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var React = require('react');
|
|
6
|
-
var utilities = require('@dreamcommerce/utilities');
|
|
7
|
-
var input = require('../../../controls/components/input.js');
|
|
8
|
-
var context = require('../../context.js');
|
|
9
|
-
|
|
10
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
|
-
|
|
12
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
13
|
-
|
|
14
|
-
const ColorPickerInputsHsl = () => {
|
|
15
|
-
const { setHue, setSaturation, setLightness, hslArr, handleOnChangeAlpha, alphaValue } = React.useContext(context.ColorPickerNewContext);
|
|
16
|
-
const handleChangeHue = (event) => {
|
|
17
|
-
const value = Number(event.target.value);
|
|
18
|
-
console.log('value - h', value);
|
|
19
|
-
setHue(value);
|
|
20
|
-
};
|
|
21
|
-
const handleChangeSaturation = (event) => {
|
|
22
|
-
const value = Number(event.target.value);
|
|
23
|
-
console.log('value - s', value);
|
|
24
|
-
setSaturation(value);
|
|
25
|
-
};
|
|
26
|
-
const handleChangeLightness = (event) => {
|
|
27
|
-
const value = Number(event.target.value);
|
|
28
|
-
console.log('value - l', value);
|
|
29
|
-
setLightness(value);
|
|
30
|
-
};
|
|
31
|
-
return (React__default['default'].createElement(React__default['default'].Fragment, null,
|
|
32
|
-
React__default['default'].createElement(input['default'], { padding: "small", type: "text", value: Math.round(hslArr[0]), onChange: handleChangeHue, onKeyPress: utilities.InputUtils.preventTypingLetters }),
|
|
33
|
-
React__default['default'].createElement(input['default'], { padding: "small", type: "text", value: Math.round(hslArr[1] * 100), onChange: handleChangeSaturation, onKeyPress: utilities.InputUtils.preventTypingLetters }),
|
|
34
|
-
React__default['default'].createElement(input['default'], { padding: "small", type: "text", value: Math.round(hslArr[2] * 100), onChange: handleChangeLightness, onKeyPress: utilities.InputUtils.preventTypingLetters }),
|
|
35
|
-
React__default['default'].createElement(input['default'], { padding: "small", type: "text", value: alphaValue, onChange: handleOnChangeAlpha, onKeyPress: utilities.InputUtils.preventTypingLetters })));
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
exports.ColorPickerInputsHsl = ColorPickerInputsHsl;
|
|
39
|
-
//# sourceMappingURL=color-picker-inputs-hsl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const ColorPickerInputsHsl: () => JSX.Element;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
2
|
-
import { InputUtils } from '@dreamcommerce/utilities';
|
|
3
|
-
import Input from '../../../controls/components/input.js';
|
|
4
|
-
import { ColorPickerNewContext } from '../../context.js';
|
|
5
|
-
|
|
6
|
-
const ColorPickerInputsHsl = () => {
|
|
7
|
-
const { setHue, setSaturation, setLightness, hslArr, handleOnChangeAlpha, alphaValue } = useContext(ColorPickerNewContext);
|
|
8
|
-
const handleChangeHue = (event) => {
|
|
9
|
-
const value = Number(event.target.value);
|
|
10
|
-
console.log('value - h', value);
|
|
11
|
-
setHue(value);
|
|
12
|
-
};
|
|
13
|
-
const handleChangeSaturation = (event) => {
|
|
14
|
-
const value = Number(event.target.value);
|
|
15
|
-
console.log('value - s', value);
|
|
16
|
-
setSaturation(value);
|
|
17
|
-
};
|
|
18
|
-
const handleChangeLightness = (event) => {
|
|
19
|
-
const value = Number(event.target.value);
|
|
20
|
-
console.log('value - l', value);
|
|
21
|
-
setLightness(value);
|
|
22
|
-
};
|
|
23
|
-
return (React.createElement(React.Fragment, null,
|
|
24
|
-
React.createElement(Input, { padding: "small", type: "text", value: Math.round(hslArr[0]), onChange: handleChangeHue, onKeyPress: InputUtils.preventTypingLetters }),
|
|
25
|
-
React.createElement(Input, { padding: "small", type: "text", value: Math.round(hslArr[1] * 100), onChange: handleChangeSaturation, onKeyPress: InputUtils.preventTypingLetters }),
|
|
26
|
-
React.createElement(Input, { padding: "small", type: "text", value: Math.round(hslArr[2] * 100), onChange: handleChangeLightness, onKeyPress: InputUtils.preventTypingLetters }),
|
|
27
|
-
React.createElement(Input, { padding: "small", type: "text", value: alphaValue, onChange: handleOnChangeAlpha, onKeyPress: InputUtils.preventTypingLetters })));
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export { ColorPickerInputsHsl };
|
|
31
|
-
//# sourceMappingURL=color-picker-inputs-hsl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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;"}
|