@dreamcommerce/aurora 2.12.1-33 → 2.12.1-35
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 +36 -0
- package/build/cjs/packages/aurora/src/components/color_picker_new/components/color-picker-footer.js.map +1 -0
- package/build/cjs/packages/aurora/src/components/color_picker_new/components/color-picker-header.js +41 -0
- package/build/cjs/packages/aurora/src/components/color_picker_new/components/color-picker-header.js.map +1 -0
- package/build/cjs/packages/aurora/src/components/color_picker_new/components/color-picker-inputs/color-picker-inputs-hex.js +43 -0
- package/build/cjs/packages/aurora/src/components/color_picker_new/components/color-picker-inputs/color-picker-inputs-hex.js.map +1 -0
- package/build/cjs/packages/aurora/src/components/color_picker_new/components/color-picker-inputs/color-picker-inputs-rgba.js +24 -0
- package/build/cjs/packages/aurora/src/components/color_picker_new/components/color-picker-inputs/color-picker-inputs-rgba.js.map +1 -0
- package/build/cjs/packages/aurora/src/components/color_picker_new/components/color-picker-inputs/color-picker-inputs.js +41 -0
- package/build/cjs/packages/aurora/src/components/color_picker_new/components/color-picker-inputs/color-picker-inputs.js.map +1 -0
- package/build/cjs/packages/aurora/src/components/color_picker_new/components/color-picker-swatches.js +48 -0
- package/build/cjs/packages/aurora/src/components/color_picker_new/components/color-picker-swatches.js.map +1 -0
- package/build/cjs/packages/aurora/src/components/color_picker_new/constants.js +5 -1
- 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/css_classes.js +21 -1
- package/build/cjs/packages/aurora/src/components/color_picker_new/css_classes.js.map +1 -1
- package/build/cjs/packages/aurora/src/components/color_picker_new/index.js +9 -1
- package/build/cjs/packages/aurora/src/components/color_picker_new/index.js.map +1 -1
- package/build/cjs/packages/aurora/src/components/color_picker_new/utilities.js +5 -0
- package/build/cjs/packages/aurora/src/components/color_picker_new/utilities.js.map +1 -1
- package/build/esm/packages/aurora/src/components/color_picker_new/components/color-picker-footer.js +26 -25
- 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 +31 -30
- 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-hex.js +33 -31
- package/build/esm/packages/aurora/src/components/color_picker_new/components/color-picker-inputs/color-picker-inputs-hex.js.map +1 -1
- package/build/esm/packages/aurora/src/components/color_picker_new/components/color-picker-inputs/color-picker-inputs-rgba.js +13 -11
- package/build/esm/packages/aurora/src/components/color_picker_new/components/color-picker-inputs/color-picker-inputs-rgba.js.map +1 -1
- package/build/esm/packages/aurora/src/components/color_picker_new/components/color-picker-inputs/color-picker-inputs.js +31 -28
- 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-swatches.js +38 -36
- package/build/esm/packages/aurora/src/components/color_picker_new/components/color-picker-swatches.js.map +1 -1
- package/build/esm/packages/aurora/src/components/color_picker_new/constants.js +4 -2
- 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/css_classes.js +12 -2
- package/build/esm/packages/aurora/src/components/color_picker_new/css_classes.js.map +1 -1
- package/build/esm/packages/aurora/src/components/color_picker_new/index.js +9 -1
- package/build/esm/packages/aurora/src/components/color_picker_new/index.js.map +1 -1
- package/build/esm/packages/aurora/src/components/color_picker_new/utilities.js +5 -1
- package/build/esm/packages/aurora/src/components/color_picker_new/utilities.js.map +1 -1
- package/package.json +1 -1
package/build/cjs/packages/aurora/src/components/color_picker_new/components/color-picker-footer.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var useTranslation = require('../../../../../../external/react-i18next/dist/es/useTranslation.js');
|
|
7
|
+
var index$1 = require('../../button/index.js');
|
|
8
|
+
var index = require('../../dropdown/context/index.js');
|
|
9
|
+
var css_classes = require('../css_classes.js');
|
|
10
|
+
var context = require('../context.js');
|
|
11
|
+
var utilities = require('../utilities.js');
|
|
12
|
+
var main_module = require('../../../css/color_picker_new/main.module.less.js');
|
|
13
|
+
|
|
14
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
|
+
|
|
16
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
17
|
+
|
|
18
|
+
const ColorPickerFooter = () => {
|
|
19
|
+
const { closeDropdown } = React.useContext(index.DropdownContext);
|
|
20
|
+
const { color, handleCancel, handleSave } = React.useContext(context.ColorPickerNewContext);
|
|
21
|
+
const [t] = useTranslation.useTranslation();
|
|
22
|
+
const handleCancelButton = () => {
|
|
23
|
+
closeDropdown === null || closeDropdown === void 0 ? void 0 : closeDropdown();
|
|
24
|
+
handleCancel === null || handleCancel === void 0 ? void 0 : handleCancel();
|
|
25
|
+
};
|
|
26
|
+
const handleSaveButton = () => {
|
|
27
|
+
closeDropdown === null || closeDropdown === void 0 ? void 0 : closeDropdown();
|
|
28
|
+
handleSave(utilities.getAllColorTypes(color));
|
|
29
|
+
};
|
|
30
|
+
return (React__default['default'].createElement("div", { className: `${main_module['default'][css_classes.cssColorPickerFooter]}` },
|
|
31
|
+
React__default['default'].createElement(index$1['default'], { size: "small", variant: "outline", onClick: handleCancelButton }, t('cancel')),
|
|
32
|
+
React__default['default'].createElement(index$1['default'], { size: "small", onClick: handleSaveButton }, t('save'))));
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
exports.ColorPickerFooter = ColorPickerFooter;
|
|
36
|
+
//# sourceMappingURL=color-picker-footer.js.map
|
|
@@ -0,0 +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;AACA;"}
|
package/build/cjs/packages/aurora/src/components/color_picker_new/components/color-picker-header.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var useTranslation = require('../../../../../../external/react-i18next/dist/es/useTranslation.js');
|
|
7
|
+
var index = require('../../dropdown/context/index.js');
|
|
8
|
+
var css_classes = require('../css_classes.js');
|
|
9
|
+
var context = require('../context.js');
|
|
10
|
+
var main_module = require('../../../css/color_picker_new/main.module.less.js');
|
|
11
|
+
var icon_close = require('../../../assets/icon_close.js');
|
|
12
|
+
|
|
13
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
|
+
|
|
15
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
16
|
+
|
|
17
|
+
const ColorPickerHeader = () => {
|
|
18
|
+
const { handleCancel } = React.useContext(context.ColorPickerNewContext);
|
|
19
|
+
const [t] = useTranslation.useTranslation();
|
|
20
|
+
const { closeDropdown, isOpen } = React.useContext(index.DropdownContext);
|
|
21
|
+
const handleCancelButton = () => {
|
|
22
|
+
closePicker();
|
|
23
|
+
};
|
|
24
|
+
const closePicker = () => {
|
|
25
|
+
closeDropdown === null || closeDropdown === void 0 ? void 0 : closeDropdown();
|
|
26
|
+
handleCancel === null || handleCancel === void 0 ? void 0 : handleCancel();
|
|
27
|
+
};
|
|
28
|
+
React.useEffect(() => {
|
|
29
|
+
if (!isOpen)
|
|
30
|
+
return;
|
|
31
|
+
document.addEventListener('visibilitychange', closePicker);
|
|
32
|
+
return () => document.removeEventListener('visibilitychange', closePicker);
|
|
33
|
+
}, [isOpen]);
|
|
34
|
+
return (React__default['default'].createElement("div", { className: `${main_module['default'][css_classes.cssColorPickerHeader]}` },
|
|
35
|
+
t('Select color'),
|
|
36
|
+
React__default['default'].createElement("button", { onClick: handleCancelButton, className: `${main_module['default'][css_classes.cssColorPickerCloseIcon]}` },
|
|
37
|
+
React__default['default'].createElement(icon_close['default'], { size: "m" }))));
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
exports.ColorPickerHeader = ColorPickerHeader;
|
|
41
|
+
//# sourceMappingURL=color-picker-header.js.map
|
|
@@ -0,0 +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;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
var utilities$1 = require('../../utilities.js');
|
|
10
|
+
|
|
11
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
|
+
|
|
13
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
14
|
+
|
|
15
|
+
const ColorPickerInputsHex = () => {
|
|
16
|
+
const { setColor, hex, handleOnChangeAlpha, alphaValue } = React.useContext(context.ColorPickerNewContext);
|
|
17
|
+
const [value, setValue] = React.useState(hex);
|
|
18
|
+
const [disable, setDisable] = React.useState(false);
|
|
19
|
+
const handleOnChange = (event) => {
|
|
20
|
+
const inputValue = event.target.value.replace('%', '');
|
|
21
|
+
if (utilities$1.isHexChar(inputValue)) {
|
|
22
|
+
setValue(inputValue);
|
|
23
|
+
setColor(inputValue);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const hexFocus = () => {
|
|
27
|
+
setDisable(true);
|
|
28
|
+
};
|
|
29
|
+
const hexBlur = () => {
|
|
30
|
+
setDisable(false);
|
|
31
|
+
};
|
|
32
|
+
React.useEffect(() => {
|
|
33
|
+
if (!disable) {
|
|
34
|
+
setValue(hex);
|
|
35
|
+
}
|
|
36
|
+
}, [hex, disable]);
|
|
37
|
+
return (React__default['default'].createElement(React__default['default'].Fragment, null,
|
|
38
|
+
React__default['default'].createElement(input['default'], { padding: "small", type: "text", maxLength: 8, value: value.toUpperCase(), onChange: handleOnChange, onBlur: hexBlur, onFocus: hexFocus }),
|
|
39
|
+
React__default['default'].createElement(input['default'], { padding: "small", type: "text", value: alphaValue, onChange: handleOnChangeAlpha, onKeyPress: utilities.InputUtils.preventTypingLetters })));
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
exports.ColorPickerInputsHex = ColorPickerInputsHex;
|
|
43
|
+
//# sourceMappingURL=color-picker-inputs-hex.js.map
|
|
@@ -0,0 +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;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
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 ColorPickerInputsRgba = () => {
|
|
15
|
+
const { setR, setG, setB, handleOnChangeAlpha, alphaValue, rgbaArr } = React.useContext(context.ColorPickerNewContext);
|
|
16
|
+
return (React__default['default'].createElement(React__default['default'].Fragment, null,
|
|
17
|
+
React__default['default'].createElement(input['default'], { padding: "small", type: "text", value: rgbaArr[0], onChange: (e) => setR(Number(e.target.value)), onKeyPress: utilities.InputUtils.preventTypingLetters }),
|
|
18
|
+
React__default['default'].createElement(input['default'], { padding: "small", type: "text", value: rgbaArr[1], onChange: (e) => setG(Number(e.target.value)), onKeyPress: utilities.InputUtils.preventTypingLetters }),
|
|
19
|
+
React__default['default'].createElement(input['default'], { padding: "small", type: "text", value: rgbaArr[2], onChange: (e) => setB(Number(e.target.value)), onKeyPress: utilities.InputUtils.preventTypingLetters }),
|
|
20
|
+
React__default['default'].createElement(input['default'], { padding: "small", type: "text", value: alphaValue, onChange: handleOnChangeAlpha, onKeyPress: utilities.InputUtils.preventTypingLetters })));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
exports.ColorPickerInputsRgba = ColorPickerInputsRgba;
|
|
24
|
+
//# sourceMappingURL=color-picker-inputs-rgba.js.map
|
|
@@ -0,0 +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;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var constants = require('../../constants.js');
|
|
7
|
+
var css_classes = require('../../css_classes.js');
|
|
8
|
+
var main_module = require('../../../../css/color_picker_new/main.module.less.js');
|
|
9
|
+
var colorPickerInputsHex = require('./color-picker-inputs-hex.js');
|
|
10
|
+
var colorPickerInputsRgba = require('./color-picker-inputs-rgba.js');
|
|
11
|
+
|
|
12
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
|
+
|
|
14
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
15
|
+
|
|
16
|
+
const ColorPickerInputs = () => {
|
|
17
|
+
const [type, setType] = React.useState(constants.COLOR_PICKER_TYPE_HEX);
|
|
18
|
+
const handleSelectType = (e) => {
|
|
19
|
+
setType(e.target.value);
|
|
20
|
+
};
|
|
21
|
+
const inputs = () => {
|
|
22
|
+
switch (type) {
|
|
23
|
+
case constants.COLOR_PICKER_TYPE_HEX:
|
|
24
|
+
return React__default['default'].createElement(colorPickerInputsHex.ColorPickerInputsHex, null);
|
|
25
|
+
case constants.COLOR_PICKER_TYPE_RGB:
|
|
26
|
+
return React__default['default'].createElement(colorPickerInputsRgba.ColorPickerInputsRgba, null);
|
|
27
|
+
default:
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
return (React__default['default'].createElement("div", { className: `${main_module['default'][css_classes.cssColorPickerInputs]}` },
|
|
32
|
+
React__default['default'].createElement("div", { className: `${main_module['default'][css_classes.cssColorPickerInputsType]}` },
|
|
33
|
+
React__default['default'].createElement("select", { value: type, onChange: handleSelectType },
|
|
34
|
+
React__default['default'].createElement("option", { value: constants.COLOR_PICKER_TYPE_HEX }, constants.COLOR_PICKER_TYPE_HEX),
|
|
35
|
+
React__default['default'].createElement("option", { value: constants.COLOR_PICKER_TYPE_RGB }, constants.COLOR_PICKER_TYPE_RGB))),
|
|
36
|
+
React__default['default'].createElement("div", { className: `${main_module['default'][css_classes.cssColorPickerInputsValue]}` },
|
|
37
|
+
React__default['default'].createElement("div", { className: `${main_module['default'][css_classes.cssColorPickerInputsValueContainer]}` }, inputs()))));
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
exports.ColorPickerInputs = ColorPickerInputs;
|
|
41
|
+
//# sourceMappingURL=color-picker-inputs.js.map
|
|
@@ -0,0 +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;"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var useTranslation = require('../../../../../../external/react-i18next/dist/es/useTranslation.js');
|
|
7
|
+
var css_classes = require('../css_classes.js');
|
|
8
|
+
var context = require('../context.js');
|
|
9
|
+
var utilities = require('../utilities.js');
|
|
10
|
+
var main_module = require('../../../css/color_picker_new/main.module.less.js');
|
|
11
|
+
var colorPickerSwatch = require('./color-picker-swatch.js');
|
|
12
|
+
|
|
13
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
|
+
|
|
15
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
16
|
+
|
|
17
|
+
const ColorPickerSwatches = () => {
|
|
18
|
+
const { hslArr, handlePickSwatch } = React.useContext(context.ColorPickerNewContext);
|
|
19
|
+
const [t] = useTranslation.useTranslation();
|
|
20
|
+
const [h, s] = hslArr;
|
|
21
|
+
const shades = [
|
|
22
|
+
{ h, s, l: 95 },
|
|
23
|
+
{ h, s, l: 90 },
|
|
24
|
+
{ h, s, l: 80 },
|
|
25
|
+
{ h, s, l: 70 },
|
|
26
|
+
{ h, s, l: 60 },
|
|
27
|
+
{ h, s, l: 50 },
|
|
28
|
+
{ h, s, l: 40 },
|
|
29
|
+
{ h, s, l: 30 },
|
|
30
|
+
{ h, s, l: 20 },
|
|
31
|
+
{ h, s, l: 10 },
|
|
32
|
+
{ h, s, l: 5 }
|
|
33
|
+
];
|
|
34
|
+
return (React__default['default'].createElement("div", { className: main_module['default'][css_classes.cssColorPickerSwatches] },
|
|
35
|
+
React__default['default'].createElement("div", { className: main_module['default'][css_classes.cssColorPickerSwatchesHeader] },
|
|
36
|
+
React__default['default'].createElement("p", null, t('Shades of color'))),
|
|
37
|
+
React__default['default'].createElement("div", { className: main_module['default'][css_classes.cssColorPickerSwatchesContent] }, shades.map((shade, index) => {
|
|
38
|
+
const colorTiny = utilities.getTinyColorInstance(shade);
|
|
39
|
+
const colorHex = utilities.getHexValue(colorTiny);
|
|
40
|
+
const handleOnClick = () => {
|
|
41
|
+
handlePickSwatch === null || handlePickSwatch === void 0 ? void 0 : handlePickSwatch(colorHex);
|
|
42
|
+
};
|
|
43
|
+
return React__default['default'].createElement(colorPickerSwatch.ColorPickerSwatch, { size: "small", onClick: handleOnClick, key: `${shade}-${index}`, color: colorHex });
|
|
44
|
+
}))));
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
exports.ColorPickerSwatches = ColorPickerSwatches;
|
|
48
|
+
//# sourceMappingURL=color-picker-swatches.js.map
|
|
@@ -0,0 +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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -4,9 +4,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const COLOR_PICKER_INITIAL_STATE = '#000000';
|
|
6
6
|
const COLOR_PICKER_WIDTH = 220;
|
|
7
|
-
const COLOR_PICKER_HEIGHT = 200;
|
|
7
|
+
const COLOR_PICKER_HEIGHT = 200;
|
|
8
|
+
const COLOR_PICKER_TYPE_HEX = 'hex';
|
|
9
|
+
const COLOR_PICKER_TYPE_RGB = 'rgb';
|
|
8
10
|
|
|
9
11
|
exports.COLOR_PICKER_HEIGHT = COLOR_PICKER_HEIGHT;
|
|
10
12
|
exports.COLOR_PICKER_INITIAL_STATE = COLOR_PICKER_INITIAL_STATE;
|
|
13
|
+
exports.COLOR_PICKER_TYPE_HEX = COLOR_PICKER_TYPE_HEX;
|
|
14
|
+
exports.COLOR_PICKER_TYPE_RGB = COLOR_PICKER_TYPE_RGB;
|
|
11
15
|
exports.COLOR_PICKER_WIDTH = COLOR_PICKER_WIDTH;
|
|
12
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;"}
|
|
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;"}
|
|
@@ -5,20 +5,40 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const cssColorPicker = 'color-picker';
|
|
6
6
|
const cssColorPickerContainer = 'color-picker__container';
|
|
7
7
|
const cssColorPickerRbgcp = 'color-picker__rbgcp';
|
|
8
|
+
const cssColorPickerHeader = 'color-picker__header';
|
|
9
|
+
const cssColorPickerCloseIcon = 'color-picker__close-icon';
|
|
10
|
+
const cssColorPickerSwatches = 'color-picker__swatches';
|
|
11
|
+
const cssColorPickerSwatchesHeader = 'color-picker__swatches-header';
|
|
12
|
+
const cssColorPickerSwatchesContent = 'color-picker__swatches-content';
|
|
8
13
|
const cssColorPickerSwatch = 'color-picker__swatch';
|
|
9
14
|
const cssColorPickerSwatchSmall = 'color-picker__swatch_small';
|
|
10
15
|
const cssColorPickerSwatchBig = 'color-picker__swatch_big';
|
|
11
16
|
const cssColorPickerSwatchFill = 'color-picker__swatch-fill';
|
|
12
17
|
const cssColorPickerInputColorSwatchContainer = 'color-picker__input-color-swatch-container';
|
|
13
|
-
const cssColorPickerInputContainer = 'color-picker__input-container';
|
|
18
|
+
const cssColorPickerInputContainer = 'color-picker__input-container';
|
|
19
|
+
const cssColorPickerInputs = 'color-picker__inputs';
|
|
20
|
+
const cssColorPickerInputsType = 'color-picker__inputs-type';
|
|
21
|
+
const cssColorPickerInputsValue = 'color-picker__inputs-value';
|
|
22
|
+
const cssColorPickerInputsValueContainer = 'color-picker__inputs-value-container';
|
|
23
|
+
const cssColorPickerFooter = 'color-picker__footer';
|
|
14
24
|
|
|
15
25
|
exports.cssColorPicker = cssColorPicker;
|
|
26
|
+
exports.cssColorPickerCloseIcon = cssColorPickerCloseIcon;
|
|
16
27
|
exports.cssColorPickerContainer = cssColorPickerContainer;
|
|
28
|
+
exports.cssColorPickerFooter = cssColorPickerFooter;
|
|
29
|
+
exports.cssColorPickerHeader = cssColorPickerHeader;
|
|
17
30
|
exports.cssColorPickerInputColorSwatchContainer = cssColorPickerInputColorSwatchContainer;
|
|
18
31
|
exports.cssColorPickerInputContainer = cssColorPickerInputContainer;
|
|
32
|
+
exports.cssColorPickerInputs = cssColorPickerInputs;
|
|
33
|
+
exports.cssColorPickerInputsType = cssColorPickerInputsType;
|
|
34
|
+
exports.cssColorPickerInputsValue = cssColorPickerInputsValue;
|
|
35
|
+
exports.cssColorPickerInputsValueContainer = cssColorPickerInputsValueContainer;
|
|
19
36
|
exports.cssColorPickerRbgcp = cssColorPickerRbgcp;
|
|
20
37
|
exports.cssColorPickerSwatch = cssColorPickerSwatch;
|
|
21
38
|
exports.cssColorPickerSwatchBig = cssColorPickerSwatchBig;
|
|
22
39
|
exports.cssColorPickerSwatchFill = cssColorPickerSwatchFill;
|
|
23
40
|
exports.cssColorPickerSwatchSmall = cssColorPickerSwatchSmall;
|
|
41
|
+
exports.cssColorPickerSwatches = cssColorPickerSwatches;
|
|
42
|
+
exports.cssColorPickerSwatchesContent = cssColorPickerSwatchesContent;
|
|
43
|
+
exports.cssColorPickerSwatchesHeader = cssColorPickerSwatchesHeader;
|
|
24
44
|
//# sourceMappingURL=css_classes.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;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;"}
|
|
@@ -9,7 +9,11 @@ var css_classes = require('./css_classes.js');
|
|
|
9
9
|
var index$1 = require('../../../../../external/react-best-gradient-color-picker/dist/esm/components/index.js');
|
|
10
10
|
var context = require('./context.js');
|
|
11
11
|
var main_module = require('../../css/color_picker_new/main.module.less.js');
|
|
12
|
+
var colorPickerFooter = require('./components/color-picker-footer.js');
|
|
13
|
+
var colorPickerHeader = require('./components/color-picker-header.js');
|
|
14
|
+
var colorPickerInputs = require('./components/color-picker-inputs/color-picker-inputs.js');
|
|
12
15
|
var colorPickerSwatch = require('./components/color-picker-swatch.js');
|
|
16
|
+
var colorPickerSwatches = require('./components/color-picker-swatches.js');
|
|
13
17
|
var index = require('../dropdown/index.js');
|
|
14
18
|
var use_color_picker = require('./hooks/use_color_picker.js');
|
|
15
19
|
|
|
@@ -28,8 +32,12 @@ const ColorPickerNewPure = ({ id, name }) => {
|
|
|
28
32
|
React__default['default'].createElement(colorPickerSwatch.ColorPickerSwatch, { color: color })),
|
|
29
33
|
React__default['default'].createElement(input['default'], { type: "text", id: id, name: name, value: `# ${color === null || color === void 0 ? void 0 : color.toUpperCase()}`, readOnly: true }))),
|
|
30
34
|
React__default['default'].createElement(index['default'].Content, null,
|
|
35
|
+
React__default['default'].createElement(colorPickerHeader.ColorPickerHeader, null),
|
|
31
36
|
React__default['default'].createElement("div", { className: `${main_module['default'][css_classes.cssColorPickerContainer]}` },
|
|
32
|
-
React__default['default'].createElement(index$1.ColorPicker, { value: color, onChange: setColor, width: constants.COLOR_PICKER_WIDTH, height: constants.COLOR_PICKER_HEIGHT, hideColorTypeBtns: true, hideColorGuide: true, hideAdvancedSliders: true, hideInputType: true, hideInputs: true, hidePresets: true, className: `${main_module['default'][css_classes.cssColorPickerRbgcp]}` })
|
|
37
|
+
React__default['default'].createElement(index$1.ColorPicker, { value: color, onChange: setColor, width: constants.COLOR_PICKER_WIDTH, height: constants.COLOR_PICKER_HEIGHT, hideColorTypeBtns: true, hideColorGuide: true, hideAdvancedSliders: true, hideInputType: true, hideInputs: true, hidePresets: true, className: `${main_module['default'][css_classes.cssColorPickerRbgcp]}` }),
|
|
38
|
+
React__default['default'].createElement(colorPickerInputs.ColorPickerInputs, null),
|
|
39
|
+
React__default['default'].createElement(colorPickerSwatches.ColorPickerSwatches, null)),
|
|
40
|
+
React__default['default'].createElement(colorPickerFooter.ColorPickerFooter, null)))));
|
|
33
41
|
};
|
|
34
42
|
const ColorPickerNewWithContext = ({ id, name, initialColor, onChange, onCancel, onSave }) => {
|
|
35
43
|
const colorPickerNewContext = use_color_picker['default']({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,uFAA2F;AACjH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,sBAAsB,uFAA2F;AACjH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -17,6 +17,10 @@ const getHexValue = (colorSet) => {
|
|
|
17
17
|
const getHexValueString = (colorSet) => {
|
|
18
18
|
return `#${getHexValue(colorSet)}`;
|
|
19
19
|
};
|
|
20
|
+
const isHexChar = (value) => {
|
|
21
|
+
const hexRegEx = /^$|[0-9a-fA-F]+$/;
|
|
22
|
+
return hexRegEx.test(value);
|
|
23
|
+
};
|
|
20
24
|
const getAllColorTypes = (color) => {
|
|
21
25
|
const tinyColor = getTinyColorInstance(color);
|
|
22
26
|
const rgba = getRgbaValue(tinyColor);
|
|
@@ -39,4 +43,5 @@ exports.getHexValue = getHexValue;
|
|
|
39
43
|
exports.getHexValueString = getHexValueString;
|
|
40
44
|
exports.getRgbaValue = getRgbaValue;
|
|
41
45
|
exports.getTinyColorInstance = getTinyColorInstance;
|
|
46
|
+
exports.isHexChar = isHexChar;
|
|
42
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;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;"}
|
package/build/esm/packages/aurora/src/components/color_picker_new/components/color-picker-footer.js
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { DropdownContext } from '
|
|
5
|
-
import '../
|
|
6
|
-
import '
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const {
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
React.createElement(Button, { size: "small",
|
|
25
|
-
React.createElement(Button, { size: "small", onClick: handleSaveButton }, t('save'))));
|
|
2
|
+
import { useTranslation } from '../../../../../../external/react-i18next/dist/es/useTranslation.js';
|
|
3
|
+
import Button from '../../button/index.js';
|
|
4
|
+
import { DropdownContext } from '../../dropdown/context/index.js';
|
|
5
|
+
import { cssColorPickerFooter } from '../css_classes.js';
|
|
6
|
+
import { ColorPickerNewContext } from '../context.js';
|
|
7
|
+
import { getAllColorTypes } from '../utilities.js';
|
|
8
|
+
import styles from '../../../css/color_picker_new/main.module.less.js';
|
|
9
|
+
|
|
10
|
+
const ColorPickerFooter = () => {
|
|
11
|
+
const { closeDropdown } = useContext(DropdownContext);
|
|
12
|
+
const { color, handleCancel, handleSave } = useContext(ColorPickerNewContext);
|
|
13
|
+
const [t] = useTranslation();
|
|
14
|
+
const handleCancelButton = () => {
|
|
15
|
+
closeDropdown === null || closeDropdown === void 0 ? void 0 : closeDropdown();
|
|
16
|
+
handleCancel === null || handleCancel === void 0 ? void 0 : handleCancel();
|
|
17
|
+
};
|
|
18
|
+
const handleSaveButton = () => {
|
|
19
|
+
closeDropdown === null || closeDropdown === void 0 ? void 0 : closeDropdown();
|
|
20
|
+
handleSave(getAllColorTypes(color));
|
|
21
|
+
};
|
|
22
|
+
return (React.createElement("div", { className: `${styles[cssColorPickerFooter]}` },
|
|
23
|
+
React.createElement(Button, { size: "small", variant: "outline", onClick: handleCancelButton }, t('cancel')),
|
|
24
|
+
React.createElement(Button, { size: "small", onClick: handleSaveButton }, t('save'))));
|
|
26
25
|
};
|
|
27
|
-
|
|
26
|
+
|
|
27
|
+
export { ColorPickerFooter };
|
|
28
|
+
//# sourceMappingURL=color-picker-footer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":
|
|
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,32 +1,33 @@
|
|
|
1
1
|
import React, { useContext, useEffect } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import '../
|
|
6
|
-
import '
|
|
7
|
-
import IconClose from '
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
document.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
React.createElement(IconClose, { size: "m" }))));
|
|
2
|
+
import { useTranslation } from '../../../../../../external/react-i18next/dist/es/useTranslation.js';
|
|
3
|
+
import { DropdownContext } from '../../dropdown/context/index.js';
|
|
4
|
+
import { cssColorPickerHeader, cssColorPickerCloseIcon } from '../css_classes.js';
|
|
5
|
+
import { ColorPickerNewContext } from '../context.js';
|
|
6
|
+
import styles from '../../../css/color_picker_new/main.module.less.js';
|
|
7
|
+
import IconClose from '../../../assets/icon_close.js';
|
|
8
|
+
|
|
9
|
+
const ColorPickerHeader = () => {
|
|
10
|
+
const { handleCancel } = useContext(ColorPickerNewContext);
|
|
11
|
+
const [t] = useTranslation();
|
|
12
|
+
const { closeDropdown, isOpen } = useContext(DropdownContext);
|
|
13
|
+
const handleCancelButton = () => {
|
|
14
|
+
closePicker();
|
|
15
|
+
};
|
|
16
|
+
const closePicker = () => {
|
|
17
|
+
closeDropdown === null || closeDropdown === void 0 ? void 0 : closeDropdown();
|
|
18
|
+
handleCancel === null || handleCancel === void 0 ? void 0 : handleCancel();
|
|
19
|
+
};
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (!isOpen)
|
|
22
|
+
return;
|
|
23
|
+
document.addEventListener('visibilitychange', closePicker);
|
|
24
|
+
return () => document.removeEventListener('visibilitychange', closePicker);
|
|
25
|
+
}, [isOpen]);
|
|
26
|
+
return (React.createElement("div", { className: `${styles[cssColorPickerHeader]}` },
|
|
27
|
+
t('Select color'),
|
|
28
|
+
React.createElement("button", { onClick: handleCancelButton, className: `${styles[cssColorPickerCloseIcon]}` },
|
|
29
|
+
React.createElement(IconClose, { size: "m" }))));
|
|
31
30
|
};
|
|
32
|
-
|
|
31
|
+
|
|
32
|
+
export { ColorPickerHeader };
|
|
33
|
+
//# sourceMappingURL=color-picker-header.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":
|
|
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,33 +1,35 @@
|
|
|
1
|
-
import React, { useContext,
|
|
2
|
-
import { ColorPickerNewContext } from '@auroraComponents/color_picker_new/context';
|
|
3
|
-
import '@auroraComponents/color_picker_new/types';
|
|
4
|
-
import Input from '@auroraComponents/controls/components/input';
|
|
1
|
+
import React, { useContext, useState, useEffect } from 'react';
|
|
5
2
|
import { InputUtils } from '@dreamcommerce/utilities';
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
const
|
|
22
|
-
setDisable(
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
3
|
+
import Input from '../../../controls/components/input.js';
|
|
4
|
+
import { ColorPickerNewContext } from '../../context.js';
|
|
5
|
+
import { isHexChar } from '../../utilities.js';
|
|
6
|
+
|
|
7
|
+
const ColorPickerInputsHex = () => {
|
|
8
|
+
const { setColor, hex, handleOnChangeAlpha, alphaValue } = useContext(ColorPickerNewContext);
|
|
9
|
+
const [value, setValue] = useState(hex);
|
|
10
|
+
const [disable, setDisable] = useState(false);
|
|
11
|
+
const handleOnChange = (event) => {
|
|
12
|
+
const inputValue = event.target.value.replace('%', '');
|
|
13
|
+
if (isHexChar(inputValue)) {
|
|
14
|
+
setValue(inputValue);
|
|
15
|
+
setColor(inputValue);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const hexFocus = () => {
|
|
19
|
+
setDisable(true);
|
|
20
|
+
};
|
|
21
|
+
const hexBlur = () => {
|
|
22
|
+
setDisable(false);
|
|
23
|
+
};
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (!disable) {
|
|
26
|
+
setValue(hex);
|
|
27
|
+
}
|
|
28
|
+
}, [hex, disable]);
|
|
29
|
+
return (React.createElement(React.Fragment, null,
|
|
30
|
+
React.createElement(Input, { padding: "small", type: "text", maxLength: 8, value: value.toUpperCase(), onChange: handleOnChange, onBlur: hexBlur, onFocus: hexFocus }),
|
|
31
|
+
React.createElement(Input, { padding: "small", type: "text", value: alphaValue, onChange: handleOnChangeAlpha, onKeyPress: InputUtils.preventTypingLetters })));
|
|
32
32
|
};
|
|
33
|
-
|
|
33
|
+
|
|
34
|
+
export { ColorPickerInputsHex };
|
|
35
|
+
//# sourceMappingURL=color-picker-inputs-hex.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":
|
|
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;"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
|
-
import { ColorPickerNewContext } from '@auroraComponents/color_picker_new/context';
|
|
3
|
-
import '@auroraComponents/color_picker_new/types';
|
|
4
|
-
import Input from '@auroraComponents/controls/components/input';
|
|
5
2
|
import { InputUtils } from '@dreamcommerce/utilities';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
React.createElement(Input, { padding: "small", type: "text", value:
|
|
3
|
+
import Input from '../../../controls/components/input.js';
|
|
4
|
+
import { ColorPickerNewContext } from '../../context.js';
|
|
5
|
+
|
|
6
|
+
const ColorPickerInputsRgba = () => {
|
|
7
|
+
const { setR, setG, setB, handleOnChangeAlpha, alphaValue, rgbaArr } = useContext(ColorPickerNewContext);
|
|
8
|
+
return (React.createElement(React.Fragment, null,
|
|
9
|
+
React.createElement(Input, { padding: "small", type: "text", value: rgbaArr[0], onChange: (e) => setR(Number(e.target.value)), onKeyPress: InputUtils.preventTypingLetters }),
|
|
10
|
+
React.createElement(Input, { padding: "small", type: "text", value: rgbaArr[1], onChange: (e) => setG(Number(e.target.value)), onKeyPress: InputUtils.preventTypingLetters }),
|
|
11
|
+
React.createElement(Input, { padding: "small", type: "text", value: rgbaArr[2], onChange: (e) => setB(Number(e.target.value)), onKeyPress: InputUtils.preventTypingLetters }),
|
|
12
|
+
React.createElement(Input, { padding: "small", type: "text", value: alphaValue, onChange: handleOnChangeAlpha, onKeyPress: InputUtils.preventTypingLetters })));
|
|
13
13
|
};
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
export { ColorPickerInputsRgba };
|
|
16
|
+
//# sourceMappingURL=color-picker-inputs-rgba.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":
|
|
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,30 +1,33 @@
|
|
|
1
|
-
import { COLOR_PICKER_TYPE_HEX, COLOR_PICKER_TYPE_RGB } from '../../constants';
|
|
2
1
|
import React, { useState } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
case
|
|
17
|
-
return React.createElement(
|
|
18
|
-
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
2
|
+
import { COLOR_PICKER_TYPE_HEX, COLOR_PICKER_TYPE_RGB } from '../../constants.js';
|
|
3
|
+
import { cssColorPickerInputs, cssColorPickerInputsType, cssColorPickerInputsValue, cssColorPickerInputsValueContainer } from '../../css_classes.js';
|
|
4
|
+
import styles from '../../../../css/color_picker_new/main.module.less.js';
|
|
5
|
+
import { ColorPickerInputsHex } from './color-picker-inputs-hex.js';
|
|
6
|
+
import { ColorPickerInputsRgba } from './color-picker-inputs-rgba.js';
|
|
7
|
+
|
|
8
|
+
const ColorPickerInputs = () => {
|
|
9
|
+
const [type, setType] = useState(COLOR_PICKER_TYPE_HEX);
|
|
10
|
+
const handleSelectType = (e) => {
|
|
11
|
+
setType(e.target.value);
|
|
12
|
+
};
|
|
13
|
+
const inputs = () => {
|
|
14
|
+
switch (type) {
|
|
15
|
+
case COLOR_PICKER_TYPE_HEX:
|
|
16
|
+
return React.createElement(ColorPickerInputsHex, null);
|
|
17
|
+
case COLOR_PICKER_TYPE_RGB:
|
|
18
|
+
return React.createElement(ColorPickerInputsRgba, null);
|
|
19
|
+
default:
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
return (React.createElement("div", { className: `${styles[cssColorPickerInputs]}` },
|
|
24
|
+
React.createElement("div", { className: `${styles[cssColorPickerInputsType]}` },
|
|
25
|
+
React.createElement("select", { value: type, onChange: handleSelectType },
|
|
26
|
+
React.createElement("option", { value: COLOR_PICKER_TYPE_HEX }, COLOR_PICKER_TYPE_HEX),
|
|
27
|
+
React.createElement("option", { value: COLOR_PICKER_TYPE_RGB }, COLOR_PICKER_TYPE_RGB))),
|
|
28
|
+
React.createElement("div", { className: `${styles[cssColorPickerInputsValue]}` },
|
|
29
|
+
React.createElement("div", { className: `${styles[cssColorPickerInputsValueContainer]}` }, inputs()))));
|
|
29
30
|
};
|
|
30
|
-
|
|
31
|
+
|
|
32
|
+
export { ColorPickerInputs };
|
|
33
|
+
//# sourceMappingURL=color-picker-inputs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":
|
|
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,38 +1,40 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { ColorPickerNewContext } from '../context';
|
|
5
|
-
import {
|
|
6
|
-
import '
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const { hslArr, handlePickSwatch } = useContext(ColorPickerNewContext);
|
|
11
|
-
const [t] = useTranslation();
|
|
12
|
-
const [h, s] = hslArr;
|
|
13
|
-
const shades = [
|
|
14
|
-
{ h, s, l: 95 },
|
|
15
|
-
{ h, s, l: 90 },
|
|
16
|
-
{ h, s, l: 80 },
|
|
17
|
-
{ h, s, l: 70 },
|
|
18
|
-
{ h, s, l: 60 },
|
|
19
|
-
{ h, s, l: 50 },
|
|
20
|
-
{ h, s, l: 40 },
|
|
21
|
-
{ h, s, l: 30 },
|
|
22
|
-
{ h, s, l: 20 },
|
|
23
|
-
{ h, s, l: 10 },
|
|
24
|
-
{ h, s, l: 5 }
|
|
25
|
-
];
|
|
26
|
-
return (React.createElement("div", { className: styles[cssColorPickerSwatches] },
|
|
27
|
-
React.createElement("div", { className: styles[cssColorPickerSwatchesHeader] },
|
|
28
|
-
React.createElement("p", null, t('Shades of color'))),
|
|
29
|
-
React.createElement("div", { className: styles[cssColorPickerSwatchesContent] }, shades.map((shade, index) => {
|
|
30
|
-
const colorTiny = getTinyColorInstance(shade);
|
|
31
|
-
const colorHex = getHexValue(colorTiny);
|
|
32
|
-
const handleOnClick = () => {
|
|
33
|
-
handlePickSwatch === null || handlePickSwatch === void 0 ? void 0 : handlePickSwatch(colorHex);
|
|
34
|
-
};
|
|
35
|
-
return React.createElement(ColorPickerSwatch, { size: "small", onClick: handleOnClick, key: `${shade}-${index}`, color: colorHex });
|
|
36
|
-
}))));
|
|
2
|
+
import { useTranslation } from '../../../../../../external/react-i18next/dist/es/useTranslation.js';
|
|
3
|
+
import { cssColorPickerSwatches, cssColorPickerSwatchesHeader, cssColorPickerSwatchesContent } from '../css_classes.js';
|
|
4
|
+
import { ColorPickerNewContext } from '../context.js';
|
|
5
|
+
import { getTinyColorInstance, getHexValue } from '../utilities.js';
|
|
6
|
+
import styles from '../../../css/color_picker_new/main.module.less.js';
|
|
7
|
+
import { ColorPickerSwatch } from './color-picker-swatch.js';
|
|
8
|
+
|
|
9
|
+
const ColorPickerSwatches = () => {
|
|
10
|
+
const { hslArr, handlePickSwatch } = useContext(ColorPickerNewContext);
|
|
11
|
+
const [t] = useTranslation();
|
|
12
|
+
const [h, s] = hslArr;
|
|
13
|
+
const shades = [
|
|
14
|
+
{ h, s, l: 95 },
|
|
15
|
+
{ h, s, l: 90 },
|
|
16
|
+
{ h, s, l: 80 },
|
|
17
|
+
{ h, s, l: 70 },
|
|
18
|
+
{ h, s, l: 60 },
|
|
19
|
+
{ h, s, l: 50 },
|
|
20
|
+
{ h, s, l: 40 },
|
|
21
|
+
{ h, s, l: 30 },
|
|
22
|
+
{ h, s, l: 20 },
|
|
23
|
+
{ h, s, l: 10 },
|
|
24
|
+
{ h, s, l: 5 }
|
|
25
|
+
];
|
|
26
|
+
return (React.createElement("div", { className: styles[cssColorPickerSwatches] },
|
|
27
|
+
React.createElement("div", { className: styles[cssColorPickerSwatchesHeader] },
|
|
28
|
+
React.createElement("p", null, t('Shades of color'))),
|
|
29
|
+
React.createElement("div", { className: styles[cssColorPickerSwatchesContent] }, shades.map((shade, index) => {
|
|
30
|
+
const colorTiny = getTinyColorInstance(shade);
|
|
31
|
+
const colorHex = getHexValue(colorTiny);
|
|
32
|
+
const handleOnClick = () => {
|
|
33
|
+
handlePickSwatch === null || handlePickSwatch === void 0 ? void 0 : handlePickSwatch(colorHex);
|
|
34
|
+
};
|
|
35
|
+
return React.createElement(ColorPickerSwatch, { size: "small", onClick: handleOnClick, key: `${shade}-${index}`, color: colorHex });
|
|
36
|
+
}))));
|
|
37
37
|
};
|
|
38
|
-
|
|
38
|
+
|
|
39
|
+
export { ColorPickerSwatches };
|
|
40
|
+
//# sourceMappingURL=color-picker-swatches.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":
|
|
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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const COLOR_PICKER_INITIAL_STATE = '#000000';
|
|
2
2
|
const COLOR_PICKER_WIDTH = 220;
|
|
3
|
-
const COLOR_PICKER_HEIGHT = 200;
|
|
3
|
+
const COLOR_PICKER_HEIGHT = 200;
|
|
4
|
+
const COLOR_PICKER_TYPE_HEX = 'hex';
|
|
5
|
+
const COLOR_PICKER_TYPE_RGB = 'rgb';
|
|
4
6
|
|
|
5
|
-
export { COLOR_PICKER_HEIGHT, COLOR_PICKER_INITIAL_STATE, COLOR_PICKER_WIDTH };
|
|
7
|
+
export { COLOR_PICKER_HEIGHT, COLOR_PICKER_INITIAL_STATE, COLOR_PICKER_TYPE_HEX, COLOR_PICKER_TYPE_RGB, COLOR_PICKER_WIDTH };
|
|
6
8
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
const cssColorPicker = 'color-picker';
|
|
2
2
|
const cssColorPickerContainer = 'color-picker__container';
|
|
3
3
|
const cssColorPickerRbgcp = 'color-picker__rbgcp';
|
|
4
|
+
const cssColorPickerHeader = 'color-picker__header';
|
|
5
|
+
const cssColorPickerCloseIcon = 'color-picker__close-icon';
|
|
6
|
+
const cssColorPickerSwatches = 'color-picker__swatches';
|
|
7
|
+
const cssColorPickerSwatchesHeader = 'color-picker__swatches-header';
|
|
8
|
+
const cssColorPickerSwatchesContent = 'color-picker__swatches-content';
|
|
4
9
|
const cssColorPickerSwatch = 'color-picker__swatch';
|
|
5
10
|
const cssColorPickerSwatchSmall = 'color-picker__swatch_small';
|
|
6
11
|
const cssColorPickerSwatchBig = 'color-picker__swatch_big';
|
|
7
12
|
const cssColorPickerSwatchFill = 'color-picker__swatch-fill';
|
|
8
13
|
const cssColorPickerInputColorSwatchContainer = 'color-picker__input-color-swatch-container';
|
|
9
|
-
const cssColorPickerInputContainer = 'color-picker__input-container';
|
|
14
|
+
const cssColorPickerInputContainer = 'color-picker__input-container';
|
|
15
|
+
const cssColorPickerInputs = 'color-picker__inputs';
|
|
16
|
+
const cssColorPickerInputsType = 'color-picker__inputs-type';
|
|
17
|
+
const cssColorPickerInputsValue = 'color-picker__inputs-value';
|
|
18
|
+
const cssColorPickerInputsValueContainer = 'color-picker__inputs-value-container';
|
|
19
|
+
const cssColorPickerFooter = 'color-picker__footer';
|
|
10
20
|
|
|
11
|
-
export { cssColorPicker, cssColorPickerContainer, cssColorPickerInputColorSwatchContainer, cssColorPickerInputContainer, cssColorPickerRbgcp, cssColorPickerSwatch, cssColorPickerSwatchBig, cssColorPickerSwatchFill, cssColorPickerSwatchSmall };
|
|
21
|
+
export { cssColorPicker, cssColorPickerCloseIcon, cssColorPickerContainer, cssColorPickerFooter, cssColorPickerHeader, cssColorPickerInputColorSwatchContainer, cssColorPickerInputContainer, cssColorPickerInputs, cssColorPickerInputsType, cssColorPickerInputsValue, cssColorPickerInputsValueContainer, cssColorPickerRbgcp, cssColorPickerSwatch, cssColorPickerSwatchBig, cssColorPickerSwatchFill, cssColorPickerSwatchSmall, cssColorPickerSwatches, cssColorPickerSwatchesContent, cssColorPickerSwatchesHeader };
|
|
12
22
|
//# sourceMappingURL=css_classes.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;"}
|
|
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;"}
|
|
@@ -5,7 +5,11 @@ import { cssColorPicker, cssColorPickerInputContainer, cssColorPickerInputColorS
|
|
|
5
5
|
import { ColorPicker } from '../../../../../external/react-best-gradient-color-picker/dist/esm/components/index.js';
|
|
6
6
|
import { ColorPickerNewContext } from './context.js';
|
|
7
7
|
import styles from '../../css/color_picker_new/main.module.less.js';
|
|
8
|
+
import { ColorPickerFooter } from './components/color-picker-footer.js';
|
|
9
|
+
import { ColorPickerHeader } from './components/color-picker-header.js';
|
|
10
|
+
import { ColorPickerInputs } from './components/color-picker-inputs/color-picker-inputs.js';
|
|
8
11
|
import { ColorPickerSwatch } from './components/color-picker-swatch.js';
|
|
12
|
+
import { ColorPickerSwatches } from './components/color-picker-swatches.js';
|
|
9
13
|
import Dropdown from '../dropdown/index.js';
|
|
10
14
|
import useColorPicker from './hooks/use_color_picker.js';
|
|
11
15
|
|
|
@@ -20,8 +24,12 @@ const ColorPickerNewPure = ({ id, name }) => {
|
|
|
20
24
|
React.createElement(ColorPickerSwatch, { color: color })),
|
|
21
25
|
React.createElement(Input, { type: "text", id: id, name: name, value: `# ${color === null || color === void 0 ? void 0 : color.toUpperCase()}`, readOnly: true }))),
|
|
22
26
|
React.createElement(Dropdown.Content, null,
|
|
27
|
+
React.createElement(ColorPickerHeader, null),
|
|
23
28
|
React.createElement("div", { className: `${styles[cssColorPickerContainer]}` },
|
|
24
|
-
React.createElement(ColorPicker, { value: color, onChange: setColor, width: COLOR_PICKER_WIDTH, height: COLOR_PICKER_HEIGHT, hideColorTypeBtns: true, hideColorGuide: true, hideAdvancedSliders: true, hideInputType: true, hideInputs: true, hidePresets: true, className: `${styles[cssColorPickerRbgcp]}` })
|
|
29
|
+
React.createElement(ColorPicker, { value: color, onChange: setColor, width: COLOR_PICKER_WIDTH, height: COLOR_PICKER_HEIGHT, hideColorTypeBtns: true, hideColorGuide: true, hideAdvancedSliders: true, hideInputType: true, hideInputs: true, hidePresets: true, className: `${styles[cssColorPickerRbgcp]}` }),
|
|
30
|
+
React.createElement(ColorPickerInputs, null),
|
|
31
|
+
React.createElement(ColorPickerSwatches, null)),
|
|
32
|
+
React.createElement(ColorPickerFooter, null)))));
|
|
25
33
|
};
|
|
26
34
|
const ColorPickerNewWithContext = ({ id, name, initialColor, onChange, onCancel, onSave }) => {
|
|
27
35
|
const colorPickerNewContext = useColorPicker({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA,4BAA4B,uFAA2F;AACvH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,4BAA4B,uFAA2F;AACvH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -13,6 +13,10 @@ const getHexValue = (colorSet) => {
|
|
|
13
13
|
const getHexValueString = (colorSet) => {
|
|
14
14
|
return `#${getHexValue(colorSet)}`;
|
|
15
15
|
};
|
|
16
|
+
const isHexChar = (value) => {
|
|
17
|
+
const hexRegEx = /^$|[0-9a-fA-F]+$/;
|
|
18
|
+
return hexRegEx.test(value);
|
|
19
|
+
};
|
|
16
20
|
const getAllColorTypes = (color) => {
|
|
17
21
|
const tinyColor = getTinyColorInstance(color);
|
|
18
22
|
const rgba = getRgbaValue(tinyColor);
|
|
@@ -30,5 +34,5 @@ const getAllColorTypes = (color) => {
|
|
|
30
34
|
};
|
|
31
35
|
};
|
|
32
36
|
|
|
33
|
-
export { getAllColorTypes, getHexValue, getHexValueString, getRgbaValue, getTinyColorInstance };
|
|
37
|
+
export { getAllColorTypes, getHexValue, getHexValueString, getRgbaValue, getTinyColorInstance, isHexChar };
|
|
34
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;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;"}
|