@easyv/react-components 0.2.4 → 0.2.6

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.
@@ -23,20 +23,23 @@ export default function LinearColorInput(_ref) {
23
23
  };
24
24
  return /*#__PURE__*/_jsxs("div", {
25
25
  className: "pure-color-picker",
26
- children: [/*#__PURE__*/_jsx("div", {
27
- className: "pure-color-picker-preview",
28
- onClick: onTrigger,
29
- children: /*#__PURE__*/_jsx(Preview, {
30
- type: "linear",
31
- shape: "square",
32
- color: value,
33
- size: 12
34
- })
35
- }), /*#__PURE__*/_jsx(Input, {
36
- size: "small",
37
- prefix: "#",
38
- value: '线性渐变',
39
- disabled: true
26
+ children: [/*#__PURE__*/_jsxs("div", {
27
+ className: "pure-color-picker-input-wrap",
28
+ children: [/*#__PURE__*/_jsx("div", {
29
+ className: "pure-color-picker-preview",
30
+ onClick: onTrigger,
31
+ children: /*#__PURE__*/_jsx(Preview, {
32
+ type: "linear",
33
+ shape: "square",
34
+ color: value,
35
+ size: 12
36
+ })
37
+ }), /*#__PURE__*/_jsx(Input, {
38
+ size: "small",
39
+ prefix: "#",
40
+ value: '线性渐变',
41
+ disabled: true
42
+ })]
40
43
  }), !disabledOutAlpha && /*#__PURE__*/_jsx(BlurInput, {
41
44
  size: "small",
42
45
  suffix: "%",
@@ -14,13 +14,12 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
14
14
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
15
15
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
16
16
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
- import { useState } from 'react';
17
+ import { useEffect, useRef, useState } from 'react';
18
18
  import Panel from "../Panel";
19
19
  import History from "../History";
20
20
  import LinearPointsBar from "./LinearPointsBar";
21
21
  import useHistory from "./useHistory";
22
22
  import { jsx as _jsx } from "react/jsx-runtime";
23
- import { Fragment as _Fragment } from "react/jsx-runtime";
24
23
  import { jsxs as _jsxs } from "react/jsx-runtime";
25
24
  export default function LinearColorPanel(_ref) {
26
25
  var _value$stops$currentI;
@@ -38,6 +37,11 @@ export default function LinearColorPanel(_ref) {
38
37
  useHistory({
39
38
  value: value
40
39
  });
40
+ var panelRef = useRef(null);
41
+ useEffect(function () {
42
+ var _panelRef$current;
43
+ (_panelRef$current = panelRef.current) === null || _panelRef$current === void 0 ? void 0 : _panelRef$current.focus();
44
+ }, []);
41
45
  var handleChange = function handleChange(color, complete) {
42
46
  var newStops = _toConsumableArray(value.stops);
43
47
  newStops[currentIndex].color = color;
@@ -68,7 +72,10 @@ export default function LinearColorPanel(_ref) {
68
72
  return prev + 1;
69
73
  });
70
74
  };
71
- return /*#__PURE__*/_jsxs(_Fragment, {
75
+ return /*#__PURE__*/_jsxs("div", {
76
+ tabIndex: 0,
77
+ id: "linear-colors-panel",
78
+ ref: panelRef,
72
79
  children: [/*#__PURE__*/_jsx(LinearPointsBar, {
73
80
  active: currentIndex,
74
81
  value: value,
@@ -26,25 +26,28 @@ export default function PureColorInput(_ref) {
26
26
  };
27
27
  return /*#__PURE__*/_jsxs("div", {
28
28
  className: "pure-color-picker",
29
- children: [/*#__PURE__*/_jsx("div", {
30
- className: "pure-color-picker-preview",
31
- onClick: onTrigger,
32
- children: /*#__PURE__*/_jsx(Preview, {
33
- type: "pure",
34
- shape: "square",
35
- color: value,
36
- size: 12
37
- })
38
- }), /*#__PURE__*/_jsx(BlurInput, {
39
- className: 'pure-color-picker-hex',
40
- size: "small",
41
- ref: hexRef,
42
- prefix: "#",
43
- value: hexString.slice(1).toUpperCase(),
44
- validate: function validate(val) {
45
- return /^#?([0-9a-fA-F])+/.test(val);
46
- },
47
- onChange: handleHexChange
29
+ children: [/*#__PURE__*/_jsxs("div", {
30
+ className: "pure-color-picker-input-wrap",
31
+ children: [/*#__PURE__*/_jsx("div", {
32
+ className: "pure-color-picker-preview",
33
+ onClick: onTrigger,
34
+ children: /*#__PURE__*/_jsx(Preview, {
35
+ type: "pure",
36
+ shape: "square",
37
+ color: value,
38
+ size: 12
39
+ })
40
+ }), /*#__PURE__*/_jsx(BlurInput, {
41
+ className: 'pure-color-picker-hex',
42
+ size: "small",
43
+ ref: hexRef,
44
+ prefix: "#",
45
+ value: hexString.slice(1).toUpperCase(),
46
+ validate: function validate(val) {
47
+ return /^#?([0-9a-fA-F])+/.test(val);
48
+ },
49
+ onChange: handleHexChange
50
+ })]
48
51
  }), /*#__PURE__*/_jsx(BlurInput, {
49
52
  size: "small",
50
53
  suffix: "%",
@@ -8,13 +8,12 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
8
8
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
9
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
10
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
- import { useState } from 'react';
11
+ import { useEffect, useRef, useState } from 'react';
12
12
  import Panel from "../Panel";
13
13
  import History from "../History";
14
14
  import PuresCards from "./PuresCards";
15
15
  import useHistory from "./useHistory";
16
16
  import { jsx as _jsx } from "react/jsx-runtime";
17
- import { Fragment as _Fragment } from "react/jsx-runtime";
18
17
  import { jsxs as _jsxs } from "react/jsx-runtime";
19
18
  export default function PuresColorPanel(_ref) {
20
19
  var value = _ref.value,
@@ -28,6 +27,11 @@ export default function PuresColorPanel(_ref) {
28
27
  _useState4 = _slicedToArray(_useState3, 2),
29
28
  updateKey = _useState4[0],
30
29
  setUpdateKey = _useState4[1];
30
+ var panelRef = useRef(null);
31
+ useEffect(function () {
32
+ var _panelRef$current;
33
+ (_panelRef$current = panelRef.current) === null || _panelRef$current === void 0 ? void 0 : _panelRef$current.focus();
34
+ }, []);
31
35
  useHistory({
32
36
  value: value,
33
37
  active: currentIndex
@@ -71,7 +75,10 @@ export default function PuresColorPanel(_ref) {
71
75
  onChangeComplete === null || onChangeComplete === void 0 ? void 0 : onChangeComplete(newValue);
72
76
  setUpdateKey(updateKey + 1);
73
77
  };
74
- return /*#__PURE__*/_jsxs(_Fragment, {
78
+ return /*#__PURE__*/_jsxs("div", {
79
+ tabIndex: 1,
80
+ id: "pures-colors-panel",
81
+ ref: panelRef,
75
82
  children: [/*#__PURE__*/_jsx(PuresCards, {
76
83
  active: currentIndex,
77
84
  value: value,
@@ -318,8 +318,14 @@
318
318
  font-size: 12px;
319
319
  }
320
320
 
321
+ .pure-color-picker-input-wrap {
322
+ display: flex;
323
+ gap: 8px;
324
+ flex: 2;
325
+ }
326
+
321
327
  .pure-color-picker-alpha {
322
- width: 64px;
328
+ flex: 1;
323
329
  flex-shrink: 0;
324
330
  font-size: 12px;
325
331
  }
@@ -36,18 +36,6 @@
36
36
  // 添加选中的样式后面的勾
37
37
  li.arco-select-option-selected {
38
38
  padding-right: 34px;
39
-
40
- &::before {
41
- content: '';
42
- position: absolute;
43
- right: 8px;
44
- width: 24px;
45
- height: 100%;
46
- transform: scale(0.5);
47
- mask: url('./check.svg') no-repeat center center;
48
- mask-size: cover;
49
- background-color: var(--color-text-1);
50
- }
51
39
  }
52
40
 
53
41
  // 修改多选状态下的背景色
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easyv/react-components",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "a react component library base on arco design",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",
@@ -1,10 +0,0 @@
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 {};
@@ -1,6 +0,0 @@
1
- import { ReactNode } from 'react';
2
- interface PanelContainerProps {
3
- children: ReactNode;
4
- }
5
- export default function PanelContainer({ children }: PanelContainerProps): import("react/jsx-runtime").JSX.Element;
6
- export {};
@@ -1,10 +0,0 @@
1
- import { ColorValueMap } from '../interface';
2
- interface PuresCardsProps {
3
- active: number;
4
- value: ColorValueMap['pures'];
5
- onAdd: () => void;
6
- onDelete: () => void;
7
- onSelect: (current: number) => void;
8
- }
9
- export default function PuresCards({ active, value, onAdd, onDelete, onSelect, }: PuresCardsProps): import("react/jsx-runtime").JSX.Element;
10
- export {};