@easyv/react-components 0.2.4 → 0.2.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.
|
@@ -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(
|
|
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,
|
package/package.json
CHANGED
|
@@ -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 {};
|