@easyv/react-components 0.2.2 → 0.2.4

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,8 +1,9 @@
1
1
  import { ColorValueMap } from '../interface';
2
2
  interface LinearColorInputProps {
3
3
  value: ColorValueMap['linear'];
4
+ disabledOutAlpha?: boolean;
4
5
  onTrigger: () => void;
5
6
  onChange: (val: ColorValueMap['linear']) => void;
6
7
  }
7
- export default function LinearColorInput({ value, onChange, onTrigger, }: LinearColorInputProps): import("react/jsx-runtime").JSX.Element;
8
+ export default function LinearColorInput({ value, disabledOutAlpha, onChange, onTrigger, }: LinearColorInputProps): import("react/jsx-runtime").JSX.Element;
8
9
  export {};
@@ -11,8 +11,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
11
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
12
12
  export default function LinearColorInput(_ref) {
13
13
  var value = _ref.value,
14
+ disabledOutAlpha = _ref.disabledOutAlpha,
14
15
  onChange = _ref.onChange,
15
16
  onTrigger = _ref.onTrigger;
17
+ var _value$opacity = value.opacity,
18
+ opacity = _value$opacity === void 0 ? 1 : _value$opacity;
16
19
  var handleAlphaChange = function handleAlphaChange(val) {
17
20
  onChange(_objectSpread(_objectSpread({}, value), {}, {
18
21
  opacity: val
@@ -34,11 +37,11 @@ export default function LinearColorInput(_ref) {
34
37
  prefix: "#",
35
38
  value: '线性渐变',
36
39
  disabled: true
37
- }), /*#__PURE__*/_jsx(BlurInput, {
40
+ }), !disabledOutAlpha && /*#__PURE__*/_jsx(BlurInput, {
38
41
  size: "small",
39
42
  suffix: "%",
40
43
  className: 'pure-color-picker-alpha',
41
- value: (value.opacity * 100).toFixed(0),
44
+ value: (opacity * 100).toFixed(0),
42
45
  validate: function validate(val) {
43
46
  return +val >= 0 && +val <= 100;
44
47
  },
@@ -25,6 +25,7 @@ function ColorsPicker(props) {
25
25
  var _useColorsPicker = useColorsPicker(props),
26
26
  type = _useColorsPicker.type,
27
27
  value = _useColorsPicker.value,
28
+ disabledOutAlpha = _useColorsPicker.disabledOutAlpha,
28
29
  onChange = _useColorsPicker.onChange,
29
30
  onChangeComplete = _useColorsPicker.onChangeComplete;
30
31
  var _useState = useState(false),
@@ -63,6 +64,7 @@ function ColorsPicker(props) {
63
64
  onChangeComplete === null || onChangeComplete === void 0 ? void 0 : onChangeComplete(val);
64
65
  };
65
66
  return /*#__PURE__*/_jsx(LinearColorInput, {
67
+ disabledOutAlpha: disabledOutAlpha,
66
68
  value: value,
67
69
  onChange: _handleChange,
68
70
  onTrigger: function onTrigger() {
@@ -108,6 +110,7 @@ function ColorsPicker(props) {
108
110
  });
109
111
  } else if (val.type === 'linear') {
110
112
  return /*#__PURE__*/_jsx(LinearColorInput, {
113
+ disabledOutAlpha: disabledOutAlpha,
111
114
  value: val.linear,
112
115
  onChange: function onChange(newValue) {
113
116
  return onValueChange(_objectSpread(_objectSpread({}, val), {}, {
@@ -19,8 +19,8 @@ interface StopItem {
19
19
  }
20
20
  export interface GradientColorValue {
21
21
  stops: StopItem[];
22
- angle: number;
23
- opacity: number;
22
+ angle?: number;
23
+ opacity?: number;
24
24
  }
25
25
  export interface ColorValueObj {
26
26
  type: ColorType;
@@ -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
+ disabledOutAlpha?: boolean;
36
37
  onChange?: (value: T extends ColorType ? ColorValueMap[T] : ColorValueObj) => void;
37
38
  onChangeComplete?: (value: T extends ColorType ? ColorValueMap[T] : ColorValueObj) => void;
38
39
  }
@@ -218,8 +218,10 @@ export function getHexValue(hex) {
218
218
  }
219
219
  export function getLinearGradientStyle(color) {
220
220
  var stops = color.stops,
221
- angle = color.angle,
222
- opacity = color.opacity;
221
+ _color$angle = color.angle,
222
+ angle = _color$angle === void 0 ? 0 : _color$angle,
223
+ _color$opacity = color.opacity,
224
+ opacity = _color$opacity === void 0 ? 1 : _color$opacity;
223
225
  var sortedColors = stops.concat().sort(function (a, b) {
224
226
  return a.offset - b.offset;
225
227
  });
@@ -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, block, ...props }: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
8
+ declare function XRadioGroup({ buttonStyle, block, className, ...props }: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
9
9
  export type * from './interface';
@@ -1,4 +1,4 @@
1
- var _excluded = ["buttonStyle", "block"];
1
+ var _excluded = ["buttonStyle", "block", "className"];
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; }
@@ -19,9 +19,10 @@ function XRadioGroup(_ref) {
19
19
  var _ref$buttonStyle = _ref.buttonStyle,
20
20
  buttonStyle = _ref$buttonStyle === void 0 ? 'transparent' : _ref$buttonStyle,
21
21
  block = _ref.block,
22
+ className = _ref.className,
22
23
  props = _objectWithoutProperties(_ref, _excluded);
23
24
  return /*#__PURE__*/_jsx(Radio.Group, _objectSpread({
24
- className: classNames(props.className, "arco-radio-button-".concat(buttonStyle), {
25
+ className: classNames(className, "arco-radio-button-".concat(buttonStyle), {
25
26
  'arco-radio-button-block': block
26
27
  })
27
28
  }, props));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easyv/react-components",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "a react component library base on arco design",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",