@easyv/react-components 0.2.10 → 0.3.0
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/dist/ColorsPicker/LinearColorPicker/LinearColorInput.d.ts +2 -1
- package/dist/ColorsPicker/LinearColorPicker/LinearColorInput.js +2 -1
- package/dist/ColorsPicker/LinearColorPicker/LinearColorPanel.d.ts +2 -1
- package/dist/ColorsPicker/LinearColorPicker/LinearColorPanel.js +20 -4
- package/dist/ColorsPicker/LinearColorPicker/LinearPointsBar.d.ts +10 -0
- package/dist/ColorsPicker/MixedColorPicker/MixedPanel.d.ts +2 -1
- package/dist/ColorsPicker/MixedColorPicker/MixedPanel.js +4 -0
- package/dist/ColorsPicker/Panel.d.ts +2 -1
- package/dist/ColorsPicker/Panel.js +4 -3
- package/dist/ColorsPicker/PureColorPicker/PureColorInput.d.ts +2 -1
- package/dist/ColorsPicker/PureColorPicker/PureColorInput.js +4 -3
- package/dist/ColorsPicker/PureColorPicker/PureColorPanel.d.ts +2 -1
- package/dist/ColorsPicker/PureColorPicker/PureColorPanel.js +10 -3
- package/dist/ColorsPicker/PuresColorPicker/PuresColorInput.d.ts +1 -0
- package/dist/ColorsPicker/PuresColorPicker/PuresColorPanel.d.ts +2 -1
- package/dist/ColorsPicker/PuresColorPicker/PuresColorPanel.js +9 -2
- package/dist/ColorsPicker/RangeColorPicker/RangeColorPanel.d.ts +2 -1
- package/dist/ColorsPicker/RangeColorPicker/RangeColorPanel.js +8 -1
- package/dist/ColorsPicker/index.js +12 -0
- package/dist/ColorsPicker/interface.d.ts +1 -0
- package/dist/ColorsPicker/style/index.less +6 -0
- package/package.json +1 -1
|
@@ -2,8 +2,9 @@ import { ColorValueMap } from '../interface';
|
|
|
2
2
|
interface LinearColorInputProps {
|
|
3
3
|
value: ColorValueMap['linear'];
|
|
4
4
|
disabledOutAlpha?: boolean;
|
|
5
|
+
disabledAlpha?: boolean;
|
|
5
6
|
onTrigger: () => void;
|
|
6
7
|
onChange: (val: ColorValueMap['linear']) => void;
|
|
7
8
|
}
|
|
8
|
-
export default function LinearColorInput({ value, disabledOutAlpha, onChange, onTrigger, }: LinearColorInputProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default function LinearColorInput({ value, disabledOutAlpha, disabledAlpha, onChange, onTrigger, }: LinearColorInputProps): import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
export {};
|
|
@@ -12,6 +12,7 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
12
12
|
export default function LinearColorInput(_ref) {
|
|
13
13
|
var value = _ref.value,
|
|
14
14
|
disabledOutAlpha = _ref.disabledOutAlpha,
|
|
15
|
+
disabledAlpha = _ref.disabledAlpha,
|
|
15
16
|
onChange = _ref.onChange,
|
|
16
17
|
onTrigger = _ref.onTrigger;
|
|
17
18
|
var _value$opacity = value.opacity,
|
|
@@ -40,7 +41,7 @@ export default function LinearColorInput(_ref) {
|
|
|
40
41
|
value: '线性渐变',
|
|
41
42
|
disabled: true
|
|
42
43
|
})]
|
|
43
|
-
}), !disabledOutAlpha && /*#__PURE__*/_jsx(BlurInput, {
|
|
44
|
+
}), !disabledAlpha && !disabledOutAlpha && /*#__PURE__*/_jsx(BlurInput, {
|
|
44
45
|
size: "small",
|
|
45
46
|
suffix: "%",
|
|
46
47
|
className: 'pure-color-picker-alpha',
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ColorValueMap } from '../interface';
|
|
2
2
|
interface LinearColorPanelProps {
|
|
3
3
|
value: ColorValueMap['linear'];
|
|
4
|
+
disabledAlpha?: boolean;
|
|
4
5
|
onChange?: (value: ColorValueMap['linear']) => void;
|
|
5
6
|
onChangeComplete?: (value: ColorValueMap['linear']) => void;
|
|
6
7
|
}
|
|
7
|
-
export default function LinearColorPanel({ value, onChange, onChangeComplete, }: LinearColorPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default function LinearColorPanel({ value, disabledAlpha, onChange, onChangeComplete, }: LinearColorPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
export {};
|
|
@@ -19,11 +19,13 @@ import Panel from "../Panel";
|
|
|
19
19
|
import History from "../History";
|
|
20
20
|
import LinearPointsBar from "./LinearPointsBar";
|
|
21
21
|
import useHistory from "./useHistory";
|
|
22
|
+
import tinycolor from 'tinycolor2';
|
|
22
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
24
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
25
|
export default function LinearColorPanel(_ref) {
|
|
25
26
|
var _value$stops$currentI;
|
|
26
27
|
var value = _ref.value,
|
|
28
|
+
disabledAlpha = _ref.disabledAlpha,
|
|
27
29
|
onChange = _ref.onChange,
|
|
28
30
|
onChangeComplete = _ref.onChangeComplete;
|
|
29
31
|
var _useState = useState(0),
|
|
@@ -62,11 +64,24 @@ export default function LinearColorPanel(_ref) {
|
|
|
62
64
|
});
|
|
63
65
|
};
|
|
64
66
|
var handleSelect = function handleSelect(val) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
var newValue = val;
|
|
68
|
+
if (typeof newValue === 'string') {
|
|
69
|
+
if (disabledAlpha) {
|
|
70
|
+
newValue = tinycolor(newValue).setAlpha(1).toHexString();
|
|
71
|
+
}
|
|
72
|
+
handleChange(newValue, true);
|
|
67
73
|
} else {
|
|
68
|
-
|
|
69
|
-
|
|
74
|
+
if (disabledAlpha) {
|
|
75
|
+
newValue = _objectSpread(_objectSpread({}, newValue), {}, {
|
|
76
|
+
stops: newValue.stops.map(function (stop) {
|
|
77
|
+
return _objectSpread(_objectSpread({}, stop), {}, {
|
|
78
|
+
color: tinycolor(stop.color).setAlpha(1).toHexString()
|
|
79
|
+
});
|
|
80
|
+
})
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
84
|
+
onChangeComplete === null || onChangeComplete === void 0 ? void 0 : onChangeComplete(newValue);
|
|
70
85
|
}
|
|
71
86
|
setUpdateKey(function (prev) {
|
|
72
87
|
return prev + 1;
|
|
@@ -83,6 +98,7 @@ export default function LinearColorPanel(_ref) {
|
|
|
83
98
|
onChange: onChange,
|
|
84
99
|
onChangeComplete: onChangeComplete
|
|
85
100
|
}), /*#__PURE__*/_jsx(Panel, {
|
|
101
|
+
disabledAlpha: disabledAlpha,
|
|
86
102
|
color: (_value$stops$currentI = value.stops[currentIndex]) === null || _value$stops$currentI === void 0 ? void 0 : _value$stops$currentI.color,
|
|
87
103
|
onChange: handleChange,
|
|
88
104
|
onChangeComplete: function onChangeComplete(val) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ColorValueMap } from '../interface';
|
|
2
|
+
interface LinearPointsBarProps {
|
|
3
|
+
active: number;
|
|
4
|
+
value: ColorValueMap['linear'];
|
|
5
|
+
onSelect: (current: number) => void;
|
|
6
|
+
onChange?: (value: ColorValueMap['linear']) => void;
|
|
7
|
+
onChangeComplete?: (value: ColorValueMap['linear']) => void;
|
|
8
|
+
}
|
|
9
|
+
export default function LinearPointsBar({ active, value, onSelect, onChange, onChangeComplete, }: LinearPointsBarProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -2,8 +2,9 @@ import { ColorType, ColorValueObj } from '../interface';
|
|
|
2
2
|
interface MixedPanelProps {
|
|
3
3
|
type: ColorType[];
|
|
4
4
|
value: ColorValueObj;
|
|
5
|
+
disabledAlpha?: boolean;
|
|
5
6
|
onChange?: (value: ColorValueObj) => void;
|
|
6
7
|
onChangeComplete?: (value: ColorValueObj) => void;
|
|
7
8
|
}
|
|
8
|
-
export default function MixedPanel({ type, value, onChange, onChangeComplete, }: MixedPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default function MixedPanel({ type, value, disabledAlpha, onChange, onChangeComplete, }: MixedPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
export {};
|
|
@@ -14,6 +14,7 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
14
14
|
export default function MixedPanel(_ref) {
|
|
15
15
|
var type = _ref.type,
|
|
16
16
|
value = _ref.value,
|
|
17
|
+
disabledAlpha = _ref.disabledAlpha,
|
|
17
18
|
onChange = _ref.onChange,
|
|
18
19
|
onChangeComplete = _ref.onChangeComplete;
|
|
19
20
|
var handleChange = function handleChange(type) {
|
|
@@ -40,6 +41,7 @@ export default function MixedPanel(_ref) {
|
|
|
40
41
|
{
|
|
41
42
|
return /*#__PURE__*/_jsx(PureColorPanel, {
|
|
42
43
|
value: value['pure'],
|
|
44
|
+
disabledAlpha: disabledAlpha,
|
|
43
45
|
onChange: handleChange('pure'),
|
|
44
46
|
onChangeComplete: handleChangeComplete('pure')
|
|
45
47
|
});
|
|
@@ -48,6 +50,7 @@ export default function MixedPanel(_ref) {
|
|
|
48
50
|
{
|
|
49
51
|
return /*#__PURE__*/_jsx(PuresColorPanel, {
|
|
50
52
|
value: value['pures'],
|
|
53
|
+
disabledAlpha: disabledAlpha,
|
|
51
54
|
onChange: handleChange('pures'),
|
|
52
55
|
onChangeComplete: handleChangeComplete('pures')
|
|
53
56
|
});
|
|
@@ -56,6 +59,7 @@ export default function MixedPanel(_ref) {
|
|
|
56
59
|
{
|
|
57
60
|
return /*#__PURE__*/_jsx(LinearColorPanel, {
|
|
58
61
|
value: value['linear'],
|
|
62
|
+
disabledAlpha: disabledAlpha,
|
|
59
63
|
onChange: handleChange('linear'),
|
|
60
64
|
onChangeComplete: handleChangeComplete('linear')
|
|
61
65
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
interface PanelProps {
|
|
2
|
+
disabledAlpha?: boolean;
|
|
2
3
|
color: string;
|
|
3
4
|
onChange?: (color: string) => void;
|
|
4
5
|
onChangeComplete?: (color: string) => void;
|
|
5
6
|
}
|
|
6
|
-
export default function Panel({ color: propsColor, onChange, onChangeComplete, }: PanelProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default function Panel({ disabledAlpha, color: propsColor, onChange, onChangeComplete, }: PanelProps): import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
export {};
|
|
@@ -21,7 +21,8 @@ import { PipetteOutlined } from '@easyv/react-icons';
|
|
|
21
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
22
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
23
|
export default function Panel(_ref) {
|
|
24
|
-
var
|
|
24
|
+
var disabledAlpha = _ref.disabledAlpha,
|
|
25
|
+
propsColor = _ref.color,
|
|
25
26
|
onChange = _ref.onChange,
|
|
26
27
|
onChangeComplete = _ref.onChangeComplete;
|
|
27
28
|
var _useState = useState(function () {
|
|
@@ -157,7 +158,7 @@ export default function Panel(_ref) {
|
|
|
157
158
|
v: v
|
|
158
159
|
}, true);
|
|
159
160
|
}
|
|
160
|
-
}), /*#__PURE__*/_jsx(ControlBar, {
|
|
161
|
+
}), !disabledAlpha && /*#__PURE__*/_jsx(ControlBar, {
|
|
161
162
|
type: "alpha",
|
|
162
163
|
color: color,
|
|
163
164
|
onChange: handleAlphaChange,
|
|
@@ -237,7 +238,7 @@ export default function Panel(_ref) {
|
|
|
237
238
|
className: "colors-picker-input-label",
|
|
238
239
|
children: "B"
|
|
239
240
|
})]
|
|
240
|
-
}), /*#__PURE__*/_jsxs("div", {
|
|
241
|
+
}), !disabledAlpha && /*#__PURE__*/_jsxs("div", {
|
|
241
242
|
className: "colors-picker-input colors-picker-input-a",
|
|
242
243
|
children: [/*#__PURE__*/_jsx(BlurInput, {
|
|
243
244
|
size: "small",
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
interface PureColorInputProps {
|
|
2
|
+
disabledAlpha?: boolean;
|
|
2
3
|
value: string;
|
|
3
4
|
onTrigger: () => void;
|
|
4
5
|
onChange?: (val: string) => void;
|
|
5
6
|
}
|
|
6
|
-
export default function PureColorInput({ value, onChange, onTrigger, }: PureColorInputProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default function PureColorInput({ disabledAlpha, value, onChange, onTrigger, }: PureColorInputProps): import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
export {};
|
|
@@ -6,12 +6,13 @@ import Preview from "../common/Preview";
|
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
8
|
export default function PureColorInput(_ref) {
|
|
9
|
-
var
|
|
9
|
+
var disabledAlpha = _ref.disabledAlpha,
|
|
10
|
+
value = _ref.value,
|
|
10
11
|
onChange = _ref.onChange,
|
|
11
12
|
onTrigger = _ref.onTrigger;
|
|
12
13
|
var hexRef = useRef(null);
|
|
13
14
|
var hexString = tinycolor(value).toHexString();
|
|
14
|
-
var alpha = tinycolor(value).getAlpha();
|
|
15
|
+
var alpha = disabledAlpha ? 1 : tinycolor(value).getAlpha();
|
|
15
16
|
var handleHexChange = function handleHexChange(val) {
|
|
16
17
|
var hexVal = getHexValue(val);
|
|
17
18
|
var hsv = tinycolor(hexVal).toHsv();
|
|
@@ -48,7 +49,7 @@ export default function PureColorInput(_ref) {
|
|
|
48
49
|
},
|
|
49
50
|
onChange: handleHexChange
|
|
50
51
|
})]
|
|
51
|
-
}), /*#__PURE__*/_jsx(BlurInput, {
|
|
52
|
+
}), !disabledAlpha && /*#__PURE__*/_jsx(BlurInput, {
|
|
52
53
|
size: "small",
|
|
53
54
|
suffix: "%",
|
|
54
55
|
className: 'pure-color-picker-alpha',
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ColorValueMap } from '../interface';
|
|
2
2
|
interface PureColorPanelProps {
|
|
3
|
+
disabledAlpha?: boolean;
|
|
3
4
|
value: ColorValueMap['pure'];
|
|
4
5
|
onChange?: (value: ColorValueMap['pure']) => void;
|
|
5
6
|
onChangeComplete?: (value: ColorValueMap['pure']) => void;
|
|
6
7
|
}
|
|
7
|
-
export default function PureColorPanel({ value, onChange, onChangeComplete, }: PureColorPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default function PureColorPanel({ disabledAlpha, value, onChange, onChangeComplete, }: PureColorPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
export {};
|
|
@@ -8,11 +8,13 @@ import Panel from "../Panel";
|
|
|
8
8
|
import History from "../History";
|
|
9
9
|
import { useState } from 'react';
|
|
10
10
|
import useHistory from "./useHistory";
|
|
11
|
+
import tinycolor from 'tinycolor2';
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
15
|
export default function PureColorPanel(_ref) {
|
|
15
|
-
var
|
|
16
|
+
var disabledAlpha = _ref.disabledAlpha,
|
|
17
|
+
value = _ref.value,
|
|
16
18
|
onChange = _ref.onChange,
|
|
17
19
|
onChangeComplete = _ref.onChangeComplete;
|
|
18
20
|
var _useState = useState(0),
|
|
@@ -20,8 +22,12 @@ export default function PureColorPanel(_ref) {
|
|
|
20
22
|
updateKey = _useState2[0],
|
|
21
23
|
setUpdateKey = _useState2[1];
|
|
22
24
|
var handleSelect = function handleSelect(val) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
var newValue = val;
|
|
26
|
+
if (disabledAlpha) {
|
|
27
|
+
newValue = tinycolor(newValue).setAlpha(1).toHex();
|
|
28
|
+
}
|
|
29
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
30
|
+
onChangeComplete === null || onChangeComplete === void 0 ? void 0 : onChangeComplete(newValue);
|
|
25
31
|
setUpdateKey(function (prev) {
|
|
26
32
|
return prev + 1;
|
|
27
33
|
});
|
|
@@ -31,6 +37,7 @@ export default function PureColorPanel(_ref) {
|
|
|
31
37
|
});
|
|
32
38
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
33
39
|
children: [/*#__PURE__*/_jsx(Panel, {
|
|
40
|
+
disabledAlpha: disabledAlpha,
|
|
34
41
|
color: value,
|
|
35
42
|
onChange: onChange,
|
|
36
43
|
onChangeComplete: onChangeComplete
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ColorValueMap } from '../interface';
|
|
2
2
|
interface PuresColorPanelProps {
|
|
3
|
+
disabledAlpha?: boolean;
|
|
3
4
|
value: ColorValueMap['pures'];
|
|
4
5
|
onChange?: (value: ColorValueMap['pures']) => void;
|
|
5
6
|
onChangeComplete?: (value: ColorValueMap['pures']) => void;
|
|
6
7
|
}
|
|
7
|
-
export default function PuresColorPanel({ value, onChange, onChangeComplete, }: PuresColorPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default function PuresColorPanel({ disabledAlpha, value, onChange, onChangeComplete, }: PuresColorPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
export {};
|
|
@@ -13,10 +13,12 @@ import Panel from "../Panel";
|
|
|
13
13
|
import History from "../History";
|
|
14
14
|
import PuresCards from "./PuresCards";
|
|
15
15
|
import useHistory from "./useHistory";
|
|
16
|
+
import tinycolor from 'tinycolor2';
|
|
16
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
18
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
19
|
export default function PuresColorPanel(_ref) {
|
|
19
|
-
var
|
|
20
|
+
var disabledAlpha = _ref.disabledAlpha,
|
|
21
|
+
value = _ref.value,
|
|
20
22
|
onChange = _ref.onChange,
|
|
21
23
|
onChangeComplete = _ref.onChangeComplete;
|
|
22
24
|
var _useState = useState(0),
|
|
@@ -69,8 +71,12 @@ export default function PuresColorPanel(_ref) {
|
|
|
69
71
|
setUpdateKey(updateKey + 1);
|
|
70
72
|
};
|
|
71
73
|
var handleHistorySelect = function handleHistorySelect(val) {
|
|
74
|
+
var newVal = val;
|
|
75
|
+
if (disabledAlpha) {
|
|
76
|
+
newVal = tinycolor(newVal).setAlpha(1).toHexString();
|
|
77
|
+
}
|
|
72
78
|
var newValue = _toConsumableArray(value);
|
|
73
|
-
newValue[currentIndex] =
|
|
79
|
+
newValue[currentIndex] = newVal;
|
|
74
80
|
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
75
81
|
onChangeComplete === null || onChangeComplete === void 0 ? void 0 : onChangeComplete(newValue);
|
|
76
82
|
setUpdateKey(updateKey + 1);
|
|
@@ -86,6 +92,7 @@ export default function PuresColorPanel(_ref) {
|
|
|
86
92
|
onDelete: handleDelete,
|
|
87
93
|
onSelect: handleSelect
|
|
88
94
|
}), /*#__PURE__*/_jsx(Panel, {
|
|
95
|
+
disabledAlpha: disabledAlpha,
|
|
89
96
|
color: value[currentIndex],
|
|
90
97
|
onChange: handleChange,
|
|
91
98
|
onChangeComplete: handleChangeComplete
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ColorValueMap } from '../interface';
|
|
2
2
|
interface RangeColorPanelProps {
|
|
3
3
|
value: ColorValueMap['range'];
|
|
4
|
+
disabledAlpha?: boolean;
|
|
4
5
|
onChange?: (value: ColorValueMap['range']) => void;
|
|
5
6
|
onChangeComplete?: (value: ColorValueMap['range']) => void;
|
|
6
7
|
}
|
|
7
|
-
export default function RangeColorPanel({ value, onChange, onChangeComplete, }: RangeColorPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default function RangeColorPanel({ value, disabledAlpha, onChange, onChangeComplete, }: RangeColorPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
export {};
|
|
@@ -12,11 +12,13 @@ import { useState } from 'react';
|
|
|
12
12
|
import Panel from "../Panel";
|
|
13
13
|
import History from "../History";
|
|
14
14
|
import RangePointsBar from "./RangePointBar";
|
|
15
|
+
import tinycolor from 'tinycolor2';
|
|
15
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
17
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
17
18
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
19
|
export default function RangeColorPanel(_ref) {
|
|
19
20
|
var value = _ref.value,
|
|
21
|
+
disabledAlpha = _ref.disabledAlpha,
|
|
20
22
|
onChange = _ref.onChange,
|
|
21
23
|
onChangeComplete = _ref.onChangeComplete;
|
|
22
24
|
var _useState = useState(0),
|
|
@@ -37,7 +39,11 @@ export default function RangeColorPanel(_ref) {
|
|
|
37
39
|
}
|
|
38
40
|
};
|
|
39
41
|
var handleSelect = function handleSelect(val) {
|
|
40
|
-
|
|
42
|
+
var newValue = val;
|
|
43
|
+
if (disabledAlpha) {
|
|
44
|
+
newValue = tinycolor(newValue).setAlpha(1).toHexString();
|
|
45
|
+
}
|
|
46
|
+
handleChange(newValue, true);
|
|
41
47
|
setUpdateKey(function (prev) {
|
|
42
48
|
return prev + 1;
|
|
43
49
|
});
|
|
@@ -54,6 +60,7 @@ export default function RangeColorPanel(_ref) {
|
|
|
54
60
|
value: value,
|
|
55
61
|
onSelect: handleIndexSelect
|
|
56
62
|
}), /*#__PURE__*/_jsx(Panel, {
|
|
63
|
+
disabledAlpha: disabledAlpha,
|
|
57
64
|
color: value[currentIndex],
|
|
58
65
|
onChange: handleChange,
|
|
59
66
|
onChangeComplete: function onChangeComplete(val) {
|
|
@@ -25,6 +25,7 @@ function ColorsPicker(props) {
|
|
|
25
25
|
var _useColorsPicker = useColorsPicker(props),
|
|
26
26
|
type = _useColorsPicker.type,
|
|
27
27
|
value = _useColorsPicker.value,
|
|
28
|
+
disabledAlpha = _useColorsPicker.disabledAlpha,
|
|
28
29
|
disabledOutAlpha = _useColorsPicker.disabledOutAlpha,
|
|
29
30
|
onChange = _useColorsPicker.onChange,
|
|
30
31
|
onChangeComplete = _useColorsPicker.onChangeComplete;
|
|
@@ -41,6 +42,7 @@ function ColorsPicker(props) {
|
|
|
41
42
|
onChangeComplete === null || onChangeComplete === void 0 ? void 0 : onChangeComplete(val);
|
|
42
43
|
};
|
|
43
44
|
return /*#__PURE__*/_jsx(PureColorInput, {
|
|
45
|
+
disabledAlpha: disabledAlpha,
|
|
44
46
|
value: value,
|
|
45
47
|
onChange: handleChange,
|
|
46
48
|
onTrigger: function onTrigger() {
|
|
@@ -51,6 +53,7 @@ function ColorsPicker(props) {
|
|
|
51
53
|
case 'pures':
|
|
52
54
|
{
|
|
53
55
|
return /*#__PURE__*/_jsx(PuresColorInput, {
|
|
56
|
+
disabledAlpha: disabledAlpha,
|
|
54
57
|
value: value,
|
|
55
58
|
onTrigger: function onTrigger() {
|
|
56
59
|
return setVisible(!visible);
|
|
@@ -64,6 +67,7 @@ function ColorsPicker(props) {
|
|
|
64
67
|
onChangeComplete === null || onChangeComplete === void 0 ? void 0 : onChangeComplete(val);
|
|
65
68
|
};
|
|
66
69
|
return /*#__PURE__*/_jsx(LinearColorInput, {
|
|
70
|
+
disabledAlpha: disabledAlpha,
|
|
67
71
|
disabledOutAlpha: disabledOutAlpha,
|
|
68
72
|
value: value,
|
|
69
73
|
onChange: _handleChange,
|
|
@@ -91,6 +95,7 @@ function ColorsPicker(props) {
|
|
|
91
95
|
};
|
|
92
96
|
if (val.type === 'pure') {
|
|
93
97
|
return /*#__PURE__*/_jsx(PureColorInput, {
|
|
98
|
+
disabledAlpha: disabledAlpha,
|
|
94
99
|
value: val.pure,
|
|
95
100
|
onChange: function onChange(newValue) {
|
|
96
101
|
return onValueChange(_objectSpread(_objectSpread({}, val), {}, {
|
|
@@ -103,6 +108,7 @@ function ColorsPicker(props) {
|
|
|
103
108
|
});
|
|
104
109
|
} else if (val.type === 'pures') {
|
|
105
110
|
return /*#__PURE__*/_jsx(PuresColorInput, {
|
|
111
|
+
disabledAlpha: disabledAlpha,
|
|
106
112
|
value: val.pures,
|
|
107
113
|
onTrigger: function onTrigger() {
|
|
108
114
|
return setVisible(!visible);
|
|
@@ -111,6 +117,7 @@ function ColorsPicker(props) {
|
|
|
111
117
|
} else if (val.type === 'linear') {
|
|
112
118
|
return /*#__PURE__*/_jsx(LinearColorInput, {
|
|
113
119
|
disabledOutAlpha: disabledOutAlpha,
|
|
120
|
+
disabledAlpha: disabledAlpha,
|
|
114
121
|
value: val.linear,
|
|
115
122
|
onChange: function onChange(newValue) {
|
|
116
123
|
return onValueChange(_objectSpread(_objectSpread({}, val), {}, {
|
|
@@ -140,6 +147,7 @@ function ColorsPicker(props) {
|
|
|
140
147
|
case 'pure':
|
|
141
148
|
{
|
|
142
149
|
return /*#__PURE__*/_jsx(PureColorPanel, {
|
|
150
|
+
disabledAlpha: disabledAlpha,
|
|
143
151
|
value: value,
|
|
144
152
|
onChange: onChange,
|
|
145
153
|
onChangeComplete: onChangeComplete
|
|
@@ -148,6 +156,7 @@ function ColorsPicker(props) {
|
|
|
148
156
|
case 'pures':
|
|
149
157
|
{
|
|
150
158
|
return /*#__PURE__*/_jsx(PuresColorPanel, {
|
|
159
|
+
disabledAlpha: disabledAlpha,
|
|
151
160
|
value: value,
|
|
152
161
|
onChange: onChange,
|
|
153
162
|
onChangeComplete: onChangeComplete
|
|
@@ -156,6 +165,7 @@ function ColorsPicker(props) {
|
|
|
156
165
|
case 'linear':
|
|
157
166
|
{
|
|
158
167
|
return /*#__PURE__*/_jsx(LinearColorPanel, {
|
|
168
|
+
disabledAlpha: disabledAlpha,
|
|
159
169
|
value: value,
|
|
160
170
|
onChange: onChange,
|
|
161
171
|
onChangeComplete: onChangeComplete
|
|
@@ -164,6 +174,7 @@ function ColorsPicker(props) {
|
|
|
164
174
|
case 'range':
|
|
165
175
|
{
|
|
166
176
|
return /*#__PURE__*/_jsx(RangeColorPanel, {
|
|
177
|
+
disabledAlpha: disabledAlpha,
|
|
167
178
|
value: value,
|
|
168
179
|
onChange: onChange,
|
|
169
180
|
onChangeComplete: onChangeComplete
|
|
@@ -174,6 +185,7 @@ function ColorsPicker(props) {
|
|
|
174
185
|
if (Array.isArray(type)) {
|
|
175
186
|
return /*#__PURE__*/_jsx(MixedPanel, {
|
|
176
187
|
type: type,
|
|
188
|
+
disabledAlpha: disabledAlpha,
|
|
177
189
|
value: value,
|
|
178
190
|
onChange: onChange,
|
|
179
191
|
onChangeComplete: onChangeComplete
|
|
@@ -33,6 +33,7 @@ export declare type ColorsPickerType = ColorType | ColorType[];
|
|
|
33
33
|
export interface ColorsPickerProps<T extends ColorsPickerType> {
|
|
34
34
|
type: T;
|
|
35
35
|
value: T extends ColorType ? ColorValueMap[T] : ColorValueObj;
|
|
36
|
+
disabledAlpha?: boolean;
|
|
36
37
|
disabledOutAlpha?: boolean;
|
|
37
38
|
onChange?: (value: T extends ColorType ? ColorValueMap[T] : ColorValueObj) => void;
|
|
38
39
|
onChangeComplete?: (value: T extends ColorType ? ColorValueMap[T] : ColorValueObj) => void;
|