@easyv/react-components 0.0.2 → 0.0.5

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.
@@ -1,4 +1,10 @@
1
- import { Collapse } from '@arco-design/web-react';
1
+ import React, { PropsWithChildren } from 'react';
2
+ import type { CollapseProps } from '@arco-design/web-react';
2
3
  import './index.less';
3
- export default Collapse;
4
- export type * from './interface';
4
+ declare function XCollapse(props: PropsWithChildren<CollapseProps>): import("react/jsx-runtime").JSX.Element;
5
+ declare namespace XCollapse {
6
+ var Item: React.ForwardRefExoticComponent<import("@arco-design/web-react").CollapseItemProps & {
7
+ children?: any;
8
+ } & React.RefAttributes<unknown>>;
9
+ }
10
+ export default XCollapse;
@@ -1,3 +1,17 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
+ import React from 'react';
1
8
  import { Collapse } from '@arco-design/web-react';
9
+ import { RightOutlined } from '@easyv/react-icons';
2
10
  import "./index.less";
3
- export default Collapse;
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ export default function XCollapse(props) {
13
+ return /*#__PURE__*/_jsx(Collapse, _objectSpread({
14
+ expandIcon: /*#__PURE__*/_jsx(RightOutlined, {})
15
+ }, props));
16
+ }
17
+ XCollapse.Item = Collapse.Item;
@@ -0,0 +1,5 @@
1
+ .arco-collapse-item-active
2
+ > .arco-collapse-item-header
3
+ .arco-collapse-item-header-title {
4
+ font-weight: normal;
5
+ }
@@ -0,0 +1,19 @@
1
+ import './ColorPreview.less';
2
+ declare type ColorPreviewProps = PureColorProps | LinearColorProps;
3
+ interface PureColorProps {
4
+ type: 'pure';
5
+ value: string;
6
+ }
7
+ interface LinearColorProps {
8
+ type: 'linear';
9
+ value: {
10
+ stops: {
11
+ color: string;
12
+ offset: number;
13
+ }[];
14
+ angle: number;
15
+ opacity: number;
16
+ };
17
+ }
18
+ export default function ColorPreview({ type, value }: ColorPreviewProps): import("react/jsx-runtime").JSX.Element | null;
19
+ export {};
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import "./ColorPreview.less";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ export default function ColorPreview(_ref) {
5
+ var type = _ref.type,
6
+ value = _ref.value;
7
+ switch (type) {
8
+ case 'pure':
9
+ {
10
+ return /*#__PURE__*/_jsx("div", {
11
+ className: "arco-color-picker-preview",
12
+ style: {
13
+ backgroundColor: value
14
+ }
15
+ });
16
+ }
17
+ case 'linear':
18
+ {
19
+ return /*#__PURE__*/_jsx("div", {
20
+ children: "\u6E10\u53D8"
21
+ });
22
+ }
23
+ default:
24
+ console.error('未知的颜色类型' + type);
25
+ return null;
26
+ }
27
+ }
@@ -0,0 +1,5 @@
1
+ .arco-color-picker-preview {
2
+ width: 28px;
3
+ height: 28px;
4
+ border-radius: 4px;
5
+ }
@@ -0,0 +1,2 @@
1
+ import './Points.less';
2
+ export default function Points(props: any): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,79 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
+ import React, { useRef, useCallback } from 'react';
8
+ import classNames from 'classnames';
9
+ import { useEventListener } from 'ahooks';
10
+ import { getBackgroundAccordingColor, getMiddleColor } from "./utils";
11
+ import "./Points.less";
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ export default function Points(props) {
14
+ var _props$dots = props.dots,
15
+ dots = _props$dots === void 0 ? [] : _props$dots,
16
+ active = props.active,
17
+ setActive = props.setActive,
18
+ onChange = props.onChange;
19
+ var mouseDownRef = useRef(false);
20
+ var containerRect = useRef({});
21
+ var containerRef = useRef(null);
22
+ var handleMouseDown = function handleMouseDown(index, e) {
23
+ e.stopPropagation();
24
+ mouseDownRef.current = true;
25
+ containerRect.current = containerRef.current.getBoundingClientRect();
26
+ setActive(index);
27
+ };
28
+ var handleMouseMove = function handleMouseMove(e) {
29
+ e.stopPropagation();
30
+ if (mouseDownRef.current) {
31
+ var newOffset = (e.clientX - containerRect.current.x) / containerRect.current.width * 100;
32
+ newOffset = newOffset > 100 ? 100 : newOffset < 0 ? 0 : newOffset;
33
+ var newDots = dots.map(function (d, i) {
34
+ return i === active ? _objectSpread(_objectSpread({}, d), {}, {
35
+ offset: newOffset
36
+ }) : d;
37
+ });
38
+ onChange(newDots);
39
+ }
40
+ };
41
+ var handleMouseUp = useCallback(function (e) {
42
+ e.stopPropagation();
43
+ mouseDownRef.current = false;
44
+ }, []);
45
+ useEventListener('mousemove', handleMouseMove);
46
+ useEventListener('mouseup', handleMouseUp);
47
+ var handleAddColor = function handleAddColor(e) {
48
+ if (mouseDownRef.current) {
49
+ return;
50
+ }
51
+ var offset = Math.floor(e.nativeEvent.offsetX / e.target.offsetWidth * 100);
52
+ var newColor = getMiddleColor(dots, offset);
53
+ onChange(dots.concat({
54
+ color: newColor,
55
+ offset: offset
56
+ }));
57
+ setActive(dots.length);
58
+ };
59
+ return /*#__PURE__*/_jsx("div", {
60
+ className: 'arco-color-picker-points-bar',
61
+ style: getBackgroundAccordingColor(dots, 90),
62
+ onMouseDown: handleAddColor,
63
+ ref: containerRef,
64
+ children: dots.map(function (dot, i) {
65
+ return /*#__PURE__*/_jsx("span", {
66
+ className: classNames('arco-color-picker-points-dot', {
67
+ 'arco-color-picker-points-dot-active': active === i
68
+ }),
69
+ style: {
70
+ backgroundColor: dot.color,
71
+ left: "".concat(dot.offset, "%")
72
+ },
73
+ onMouseDown: function onMouseDown(e) {
74
+ return handleMouseDown(i, e);
75
+ }
76
+ }, i);
77
+ })
78
+ });
79
+ }
@@ -0,0 +1,51 @@
1
+ .arco-color-picker-points-bar {
2
+ position: relative;
3
+ width: 150px;
4
+ height: 6px;
5
+ margin-right: 16px;
6
+ border-radius: 4px;
7
+
8
+ &::before {
9
+ content: '';
10
+ position: relative;
11
+ z-index: -1;
12
+ display: block;
13
+ width: 100%;
14
+ height: 100%;
15
+ border-radius: 4px;
16
+ background-image: linear-gradient(
17
+ 45deg,
18
+ #404040 25%,
19
+ transparent 0,
20
+ transparent 75%,
21
+ #404040 0
22
+ ),
23
+ linear-gradient(
24
+ 45deg,
25
+ #404040 25%,
26
+ transparent 0,
27
+ transparent 75%,
28
+ #404040 0
29
+ );
30
+ background-color: #4a4a4a;
31
+ background-size: 10px 10px;
32
+ background-position: 0 0, 5px 5px;
33
+ }
34
+
35
+ .arco-color-picker-points-dot {
36
+ position: absolute;
37
+ top: -2px;
38
+ width: 10px;
39
+ height: 10px;
40
+ border-radius: 50%;
41
+ transform: translateX(-50%);
42
+ border: 2px solid #ffffff;
43
+ cursor: pointer;
44
+
45
+ &.arco-color-picker-points-dot-active {
46
+ width: 12px;
47
+ height: 12px;
48
+ box-shadow: 0 0 0 3px rgba(36, 145, 247, 0.6);
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,4 @@
1
+ import 'rc-color-picker/assets/index.css';
2
+ import { ColorPickerProps } from './interface';
3
+ import './index.less';
4
+ export default function ColorPicker({ value, onChange, }: ColorPickerProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,57 @@
1
+ import React from 'react';
2
+ import { Panel as ColorPickerPanel } from 'rc-color-picker';
3
+ import 'rc-color-picker/assets/index.css';
4
+ import Color from 'rc-color-picker/lib/helpers/color';
5
+ import { useDebounceFn } from 'ahooks';
6
+ import "./index.less";
7
+ import ColorPreview from "./ColorPreview";
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ import { Fragment as _Fragment } from "react/jsx-runtime";
10
+ import { jsxs as _jsxs } from "react/jsx-runtime";
11
+ export default function ColorPicker(_ref) {
12
+ var _ref$value = _ref.value,
13
+ value = _ref$value === void 0 ? 'rgba(255,0,255,0.5)' : _ref$value,
14
+ onChange = _ref.onChange;
15
+ var colorObj = new Color(value);
16
+ var _useDebounceFn = useDebounceFn(function (_ref2) {
17
+ var color = _ref2.color,
18
+ alpha = _ref2.alpha;
19
+ var newColor;
20
+ var rgbColor;
21
+ if (alpha === 100) {
22
+ newColor = color;
23
+ } else {
24
+ rgbColor = new Color(color).RGB;
25
+ newColor = "RGBA(".concat(rgbColor[0], ",").concat(rgbColor[1], ",").concat(rgbColor[2], ",").concat(alpha / 100, ")");
26
+ }
27
+ onChange === null || onChange === void 0 ? void 0 : onChange(newColor);
28
+ }, {
29
+ wait: 100,
30
+ leading: true,
31
+ trailing: false
32
+ }),
33
+ run = _useDebounceFn.run;
34
+ var linearValue = {
35
+ stops: [{
36
+ offset: 0,
37
+ color: '#fff'
38
+ }, {
39
+ offset: 100,
40
+ color: '#000'
41
+ }],
42
+ angle: 0,
43
+ opacity: 100
44
+ };
45
+ return /*#__PURE__*/_jsxs(_Fragment, {
46
+ children: [/*#__PURE__*/_jsx(ColorPreview, {
47
+ type: "linear",
48
+ value: linearValue
49
+ }), /*#__PURE__*/_jsx(ColorPickerPanel, {
50
+ className: "arco-color-picker",
51
+ mode: "RGB",
52
+ color: colorObj.toHexString(),
53
+ alpha: colorObj.alpha,
54
+ onChange: run
55
+ })]
56
+ });
57
+ }
@@ -0,0 +1,160 @@
1
+ .arco-color-picker {
2
+ border: 1px solid var(--color-border-3);
3
+ background-color: var(--color-bg-white);
4
+ width: 238px;
5
+
6
+ .rc-color-picker-panel-board {
7
+ margin: 11px 11px 0;
8
+ }
9
+
10
+ .rc-color-picker-panel-board-hsv {
11
+ width: 216px;
12
+ }
13
+
14
+ .rc-color-picker-panel-ribbon,
15
+ .rc-color-picker-panel-alpha {
16
+ border-radius: 0;
17
+ box-shadow: none;
18
+
19
+ span {
20
+ width: 12px;
21
+ height: 12px;
22
+ border-radius: 6px;
23
+ border: 2px solid #fff;
24
+ background-color: transparent;
25
+ margin-left: -6px;
26
+ margin-top: -3px;
27
+ }
28
+ }
29
+
30
+ .rc-color-picker-panel-wrap {
31
+ margin-top: 16px;
32
+ }
33
+
34
+ // rgb滑块
35
+ .rc-color-picker-panel-wrap-ribbon {
36
+ top: 3px;
37
+ left: 11px;
38
+ right: 50px;
39
+ height: 6px;
40
+ padding: 0 6px;
41
+ border-radius: 3px;
42
+ background-image: linear-gradient(
43
+ to right,
44
+ #ff0000 0%,
45
+ #ff9900 10%,
46
+ #cdff00 20%,
47
+ #35ff00 30%,
48
+ #00ff66 40%,
49
+ #00fffd 50%,
50
+ #0066ff 60%,
51
+ #3200ff 70%,
52
+ #cd00ff 80%,
53
+ #ff0099 90%,
54
+ #ff0000 100%
55
+ );
56
+ }
57
+
58
+ .rc-color-picker-panel-ribbon {
59
+ background-image: none;
60
+ }
61
+
62
+ // alpha 滑块
63
+ .rc-color-picker-panel-wrap-alpha {
64
+ bottom: 3px;
65
+ left: 11px;
66
+ right: 50px;
67
+ height: 6px;
68
+ padding: 0 6px;
69
+ border-radius: 3px;
70
+ background-image: linear-gradient(
71
+ 45deg,
72
+ #b9b8c1 25%,
73
+ transparent 0,
74
+ transparent 75%,
75
+ #b9b8c1 0
76
+ ),
77
+ linear-gradient(
78
+ 45deg,
79
+ #b9b8c1 25%,
80
+ transparent 0,
81
+ transparent 75%,
82
+ #b9b8c1 0
83
+ );
84
+ background-color: #e1e1ea;
85
+ background-size: 6px 6px;
86
+ background-position: 0 0, 3px 3px;
87
+ }
88
+
89
+ .rc-color-picker-panel-alpha {
90
+ width: auto;
91
+ background-image: none;
92
+ }
93
+
94
+ .rc-color-picker-panel-alpha-bg {
95
+ width: 177px;
96
+ border-radius: 3px;
97
+ margin-left: -6px;
98
+ }
99
+
100
+ .rc-color-picker-panel-params-input {
101
+ padding: 2px 11px;
102
+
103
+ input {
104
+ outline: none;
105
+ height: 24px;
106
+ border-color: var(--color-border-3);
107
+ background-color: var(--color-bg-white);
108
+ color: #bfbfbf;
109
+
110
+ &[type='number'] {
111
+ margin-left: 4px;
112
+ }
113
+ }
114
+ }
115
+
116
+ .rc-color-picker-panel-wrap-preview {
117
+ right: 11px;
118
+ border-radius: 50%;
119
+ overflow: hidden;
120
+
121
+ input {
122
+ display: none;
123
+ }
124
+ }
125
+
126
+ .rc-color-picker-panel-params-lable {
127
+ color: var(--easyv-text-color);
128
+ }
129
+
130
+ .rc-color-picker-panel-params-lable-number:hover {
131
+ border-radius: 0;
132
+ box-shadow: none;
133
+ background-color: transparent;
134
+ cursor: initial;
135
+ }
136
+
137
+ // 颜色板的圈
138
+ .rc-color-picker-panel-board span {
139
+ width: 12px;
140
+ height: 12px;
141
+ border-radius: 6px;
142
+ border-width: 2px;
143
+ margin: -6px 0 0 -6px;
144
+ }
145
+
146
+ .rc-color-picker-panel-params-hex {
147
+ width: 70px;
148
+ }
149
+
150
+ .rc-color-picker-panel-params-lable-hex {
151
+ width: 70px;
152
+ }
153
+
154
+ .rc-color-picker-panel-inner {
155
+ box-shadow: none;
156
+ border: none;
157
+ border-radius: 0;
158
+ overflow: hidden;
159
+ }
160
+ }
@@ -0,0 +1,4 @@
1
+ export interface ColorPickerProps {
2
+ value?: string;
3
+ onChange?: (value: string) => void;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ export declare function toHex(x: any): string;
2
+ export declare function transformColor(color: string, a: number): any;
3
+ export declare function getBackgroundAccordingColor(color: any, fixedAngle: any): {
4
+ backgroundImage: string;
5
+ background?: undefined;
6
+ } | {
7
+ background: any;
8
+ backgroundImage?: undefined;
9
+ } | undefined;
10
+ export declare function getMiddleColor(colors: {
11
+ color: string;
12
+ offset: number;
13
+ }[], offset: number): string;
@@ -0,0 +1,156 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ import Color from 'rc-color-picker/lib/helpers/color';
3
+ export function toHex(x) {
4
+ return ('0' + parseInt(x).toString(16)).slice(-2);
5
+ }
6
+ export function transformColor(color, a) {
7
+ var _Color = new Color(color),
8
+ r = _Color.redValue,
9
+ g = _Color.greenValue,
10
+ b = _Color.blueValue,
11
+ toHexString = _Color.toHexString;
12
+ return a === 1 ? toHexString() : "RGBA(".concat(r, ",").concat(g, ",").concat(b, ",").concat(a, ")");
13
+ }
14
+ export function getBackgroundAccordingColor(color, fixedAngle) {
15
+ if (typeof color === 'string') {
16
+ return {
17
+ background: color
18
+ };
19
+ } else if (Array.isArray(color)) {
20
+ var rebaseStops = color.concat();
21
+ rebaseStops.sort(function (a, b) {
22
+ return a.offset - b.offset;
23
+ });
24
+ var colors = rebaseStops.map(function (item, index) {
25
+ var _Color2 = new Color(item.color),
26
+ r = _Color2.r,
27
+ g = _Color2.g,
28
+ b = _Color2.b,
29
+ a = _Color2.a;
30
+ if (a === 1 || index === rebaseStops.length - 1) {
31
+ return "".concat(item.color, " ").concat(item.offset, "%");
32
+ } else {
33
+ var _Color3 = new Color(rebaseStops[index + 1].color),
34
+ nextR = _Color3.r,
35
+ nextG = _Color3.g,
36
+ nextB = _Color3.b,
37
+ nextA = _Color3.a;
38
+ var stepOpacity = (nextA - a) / 5;
39
+ var stepOffset = (rebaseStops[index + 1].offset - item.offset) / 5;
40
+ var stepR = (nextR - r) / 5;
41
+ var stepG = (nextG - g) / 5;
42
+ var stepB = (nextB - b) / 5;
43
+ return Array.from({
44
+ length: 5
45
+ }).map(function (d, i) {
46
+ return "".concat(transformColor("rgb(".concat(Math.round(r + stepR * i), ",").concat(Math.round(g + stepG * i), ",").concat(Math.round(b + stepB * i), ")"), a + stepOpacity * i), " ").concat(item.offset + stepOffset * i, "%");
47
+ }).join(',');
48
+ }
49
+ });
50
+ return {
51
+ backgroundImage: "linear-gradient(".concat(fixedAngle || 0, "deg, ").concat(colors.join(','), ")")
52
+ };
53
+ } else if (_typeof(color) === 'object') {
54
+ var _color$type = color.type,
55
+ type = _color$type === void 0 ? 'pure' : _color$type,
56
+ _color$linear = color.linear,
57
+ _color$linear2 = _color$linear === void 0 ? {
58
+ stops: [{
59
+ offset: 0,
60
+ color: '#000'
61
+ }, {
62
+ offset: 100,
63
+ color: '#fff'
64
+ }],
65
+ angle: 0,
66
+ opacity: 1
67
+ } : _color$linear,
68
+ stops = _color$linear2.stops,
69
+ angle = _color$linear2.angle,
70
+ opacity = _color$linear2.opacity,
71
+ _color$pure = color.pure,
72
+ pureColor = _color$pure === void 0 ? '#000' : _color$pure;
73
+ if (type === 'linear') {
74
+ var _rebaseStops = stops.concat();
75
+ _rebaseStops.sort(function (a, b) {
76
+ return a.offset - b.offset;
77
+ });
78
+ var _colors = _rebaseStops.map(function (item, index) {
79
+ var _Color4 = new Color(item.color),
80
+ r = _Color4.redValue,
81
+ g = _Color4.greenValue,
82
+ b = _Color4.blueValue,
83
+ a = _Color4.alphaValue;
84
+ if (a === 1 || index === _rebaseStops.length - 1) {
85
+ return "".concat(transformColor(item.color, a * opacity), " ").concat(item.offset, "%");
86
+ } else {
87
+ var _Color5 = new Color(_rebaseStops[index + 1].color),
88
+ nextR = _Color5.redValue,
89
+ nextG = _Color5.greenValue,
90
+ nextB = _Color5.blueValue,
91
+ nextA = _Color5.alphaValue;
92
+ var stepOpacity = (nextA - a) / 5;
93
+ var stepOffset = (_rebaseStops[index + 1].offset - item.offset) / 5;
94
+ var stepR = (nextR - r) / 5;
95
+ var stepG = (nextG - g) / 5;
96
+ var stepB = (nextB - b) / 5;
97
+ return Array.from({
98
+ length: 5
99
+ }).map(function (d, i) {
100
+ return "".concat(transformColor("rgb(".concat(Math.round(r + stepR * i), ",").concat(Math.round(g + stepG * i), ",").concat(Math.round(b + stepB * i), ")"), (a + stepOpacity * i) * opacity), " ").concat(item.offset + stepOffset * i, "%");
101
+ }).join(',');
102
+ }
103
+ });
104
+ return {
105
+ backgroundImage: "linear-gradient(".concat(fixedAngle !== undefined ? fixedAngle : angle, "deg, ").concat(_colors.join(','), ")")
106
+ };
107
+ } else {
108
+ return {
109
+ background: pureColor
110
+ };
111
+ }
112
+ }
113
+ }
114
+ export function getMiddleColor(colors, offset) {
115
+ var leftColor;
116
+ var rightColor;
117
+ var leftColors = colors.filter(function (d) {
118
+ return d.offset < offset;
119
+ });
120
+ var rightColors = colors.filter(function (d) {
121
+ return d.offset > offset;
122
+ });
123
+ if (leftColors.length) {
124
+ leftColors.sort(function (a, b) {
125
+ return b.offset - a.offset;
126
+ });
127
+ leftColor = leftColors[0];
128
+ }
129
+ if (rightColors.length) {
130
+ rightColors.sort(function (a, b) {
131
+ return a.offset - b.offset;
132
+ });
133
+ rightColor = rightColors[0];
134
+ }
135
+ if (!leftColor) {
136
+ return rightColor.color;
137
+ }
138
+ if (!rightColor) {
139
+ return leftColor.color;
140
+ }
141
+ var _Color6 = new Color(leftColor.color),
142
+ leftR = _Color6.redValue,
143
+ leftG = _Color6.greenValue,
144
+ leftB = _Color6.blueValue,
145
+ leftA = _Color6.alphaValue;
146
+ var _Color7 = new Color(rightColor.color),
147
+ rightR = _Color7.redValue,
148
+ rightG = _Color7.greenValue,
149
+ rightB = _Color7.blueValue,
150
+ rightA = _Color7.alphaValue;
151
+ var newR = Math.round((rightR - leftR) / (rightColor.offset - leftColor.offset) * (offset - leftColor.offset) + leftR);
152
+ var newG = Math.round((rightG - leftG) / (rightColor.offset - leftColor.offset) * (offset - leftColor.offset) + leftG);
153
+ var newB = Math.round((rightB - leftB) / (rightColor.offset - leftColor.offset) * (offset - leftColor.offset) + leftB);
154
+ var newA = (rightA - leftA) / (rightColor.offset - leftColor.offset) * (offset - leftColor.offset) + leftA;
155
+ return newA === 1 ? "#".concat(toHex(newR)).concat(toHex(newG)).concat(toHex(newB)) : "RGBA(".concat(newR, ",").concat(newG, ",").concat(newB, ",").concat(newA, ")");
156
+ }
@@ -23,7 +23,10 @@ var XInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
23
23
  ref: ref,
24
24
  className: classNames(className, {
25
25
  'arco-input-borderless': !bordered
26
- })
26
+ }),
27
+ onPressEnter: function onPressEnter(e) {
28
+ e.target.blur();
29
+ }
27
30
  }, restProps));
28
31
  });
29
32
  var InputSearch = /*#__PURE__*/forwardRef(function (_ref2, ref) {
@@ -1,10 +1,4 @@
1
1
  div.arco-select {
2
- &:not(.arco-select-disabled) {
3
- .arco-select-view {
4
- background-color: transparent;
5
- }
6
- }
7
-
8
2
  .arco-select-view {
9
3
  border-color: var(--color-border-2);
10
4
 
package/dist/index.d.ts CHANGED
@@ -131,3 +131,4 @@ export { default as Space } from './Space';
131
131
  export type { SpaceProps } from './Space/interface';
132
132
  export { default as Tag } from './Tag';
133
133
  export type { TagProps } from './Tag/interface';
134
+ export { default as ColorPicker } from './ColorPicker';
package/dist/index.js CHANGED
@@ -64,4 +64,5 @@ export { default as Modal } from "./Modal";
64
64
  export { default as Radio } from "./Radio";
65
65
  export { default as Select } from "./Select";
66
66
  export { default as Space } from "./Space";
67
- export { default as Tag } from "./Tag";
67
+ export { default as Tag } from "./Tag";
68
+ export { default as ColorPicker } from "./ColorPicker";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easyv/react-components",
3
- "version": "0.0.2",
3
+ "version": "0.0.5",
4
4
  "description": "a react component library base on arco design",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",
@@ -48,11 +48,13 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "@easyv/react-icons": "4.0.0",
51
- "classnames": "^2.3.2"
51
+ "ahooks": "^3.7.8",
52
+ "classnames": "^2.3.2",
53
+ "rc-color-picker": "^1.2.6"
52
54
  },
53
55
  "devDependencies": {
54
- "@arco-design/web-react": "2.52.0",
55
- "@arco-themes/react-dtable": "0.0.29",
56
+ "@arco-design/web-react": "2.55.1",
57
+ "@arco-themes/react-dtable": "0.0.31",
56
58
  "@commitlint/cli": "^17.1.2",
57
59
  "@commitlint/config-conventional": "^17.1.0",
58
60
  "@easyv/sync-to-mirror": "^0.0.2",
@@ -95,6 +97,6 @@
95
97
  "registry": "https://registry.npmjs.org"
96
98
  },
97
99
  "authors": [
98
- "xiaoyaoliu@dtstack.com"
100
+ "xiaoyao@dtstack.com"
99
101
  ]
100
102
  }