@easyv/react-components 0.2.1 → 0.2.2

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.
@@ -9,6 +9,7 @@ import { DownOutlined } from '@easyv/react-icons';
9
9
  import classNames from 'classnames';
10
10
  import HistoryPure from "./HistoryPure";
11
11
  import HistoryLinear from "./HistoryLinear";
12
+ import { useLocalStorageState } from 'ahooks';
12
13
  import { jsx as _jsx } from "react/jsx-runtime";
13
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
14
15
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -19,6 +20,12 @@ export default function History(_ref) {
19
20
  _useState2 = _slicedToArray(_useState, 2),
20
21
  collapsed = _useState2[0],
21
22
  setCollapsed = _useState2[1];
23
+ var _useLocalStorageState = useLocalStorageState('usedLinearColors'),
24
+ _useLocalStorageState2 = _slicedToArray(_useLocalStorageState, 1),
25
+ usedLinearColors = _useLocalStorageState2[0];
26
+ var _useLocalStorageState3 = useLocalStorageState('usedColors'),
27
+ _useLocalStorageState4 = _slicedToArray(_useLocalStorageState3, 1),
28
+ usedPureColors = _useLocalStorageState4[0];
22
29
  var handleCollapse = function handleCollapse() {
23
30
  setCollapsed(function (prev) {
24
31
  return !prev;
@@ -36,18 +43,20 @@ export default function History(_ref) {
36
43
  'colors-picker-history-collapsed': collapsed
37
44
  })
38
45
  })]
39
- }), type === 'linear' && /*#__PURE__*/_jsxs(_Fragment, {
40
- children: [/*#__PURE__*/_jsx("div", {
41
- className: "colors-picker-history-type-title",
42
- children: "\u6E10\u53D8\u8272"
43
- }), /*#__PURE__*/_jsx(HistoryLinear, {
44
- onSelect: onSelect
45
- }), /*#__PURE__*/_jsx("div", {
46
+ }), !collapsed && /*#__PURE__*/_jsxs(_Fragment, {
47
+ children: [type === 'linear' && (usedPureColors === null || usedPureColors === void 0 ? void 0 : usedPureColors.length) && /*#__PURE__*/_jsx("div", {
46
48
  className: "colors-picker-history-type-title",
47
49
  children: "\u7EAF\u8272"
50
+ }), /*#__PURE__*/_jsx(HistoryPure, {
51
+ onSelect: onSelect
52
+ }), type === 'linear' && (usedLinearColors === null || usedLinearColors === void 0 ? void 0 : usedLinearColors.length) && /*#__PURE__*/_jsxs(_Fragment, {
53
+ children: [/*#__PURE__*/_jsx("div", {
54
+ className: "colors-picker-history-type-title",
55
+ children: "\u6E10\u53D8\u8272"
56
+ }), /*#__PURE__*/_jsx(HistoryLinear, {
57
+ onSelect: onSelect
58
+ })]
48
59
  })]
49
- }), /*#__PURE__*/_jsx(HistoryPure, {
50
- onSelect: onSelect
51
60
  })]
52
61
  });
53
62
  }
@@ -23,6 +23,11 @@ export default function useHistory(_ref) {
23
23
  return function () {
24
24
  if (lastValueRef.current) {
25
25
  var newColors = [lastValueRef.current.stops].concat(usedLinearColors.current || []);
26
+ newColors = Array.from(new Set(newColors.map(function (d) {
27
+ return JSON.stringify(d);
28
+ }))).map(function (d) {
29
+ return JSON.parse(d);
30
+ });
26
31
  newColors = newColors.slice(0, 16);
27
32
  setUsedLinearColors(newColors);
28
33
  }
@@ -312,7 +312,7 @@
312
312
  // 纯色输入框
313
313
  .pure-color-picker {
314
314
  display: flex;
315
- gap: 12px;
315
+ gap: 8px;
316
316
 
317
317
  .pure-color-picker-hex {
318
318
  font-size: 12px;
@@ -492,7 +492,7 @@
492
492
  transform: translateX(-50%);
493
493
 
494
494
  &.active {
495
- box-shadow: 0 0 0 2px rgba(var(--primary-6), 0.5);
495
+ box-shadow: 0 0 0 4px rgba(var(--primary-6), 0.6);
496
496
  }
497
497
  }
498
498
 
@@ -5,5 +5,5 @@ declare namespace XRadio {
5
5
  var Group: typeof XRadioGroup;
6
6
  }
7
7
  export default XRadio;
8
- declare function XRadioGroup({ buttonStyle, ...props }: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
8
+ declare function XRadioGroup({ buttonStyle, block, ...props }: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
9
9
  export type * from './interface';
@@ -1,4 +1,4 @@
1
- var _excluded = ["buttonStyle"];
1
+ var _excluded = ["buttonStyle", "block"];
2
2
  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); }
3
3
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
4
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -18,9 +18,12 @@ export default function XRadio(props) {
18
18
  function XRadioGroup(_ref) {
19
19
  var _ref$buttonStyle = _ref.buttonStyle,
20
20
  buttonStyle = _ref$buttonStyle === void 0 ? 'transparent' : _ref$buttonStyle,
21
+ block = _ref.block,
21
22
  props = _objectWithoutProperties(_ref, _excluded);
22
23
  return /*#__PURE__*/_jsx(Radio.Group, _objectSpread({
23
- className: classNames(props.className, "arco-radio-button-".concat(buttonStyle))
24
+ className: classNames(props.className, "arco-radio-button-".concat(buttonStyle), {
25
+ 'arco-radio-button-block': block
26
+ })
24
27
  }, props));
25
28
  }
26
29
  XRadio.Group = XRadioGroup;
@@ -49,6 +49,17 @@
49
49
  }
50
50
  }
51
51
  }
52
+
53
+ &.arco-radio-button-block {
54
+ width: 100%;
55
+ display: flex;
56
+
57
+ .arco-radio-button {
58
+ flex: 1;
59
+ flex-shrink: 0;
60
+ text-align: center;
61
+ }
62
+ }
52
63
  }
53
64
 
54
65
  &.arco-radio-button-solid {
@@ -2,5 +2,6 @@ import { PropsWithChildren } from 'react';
2
2
  import type { RadioProps, RadioGroupProps } from '@arco-design/web-react';
3
3
  interface XRadioGroupProps extends PropsWithChildren<RadioGroupProps> {
4
4
  buttonStyle?: 'solid' | 'semi' | 'transparent';
5
+ block?: boolean;
5
6
  }
6
7
  export type { RadioProps, XRadioGroupProps as RadioGroupProps };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easyv/react-components",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "a react component library base on arco design",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",