@yuntijs/ui 1.0.0-beta.64 → 1.0.0-beta.66

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.
@@ -3,12 +3,13 @@ import React from 'react';
3
3
  type RawValue = string | number;
4
4
  type Value = RawValue | RawValue[];
5
5
  export interface SelectCardOption {
6
- className?: string;
7
6
  value: RawValue;
8
- img?: string;
7
+ img?: React.ReactNode;
8
+ icon?: React.ReactNode;
9
+ iconStyle?: React.CSSProperties;
9
10
  label?: React.ReactNode;
10
11
  description?: React.ReactNode;
11
- [name: string]: any;
12
+ style?: React.CSSProperties;
12
13
  }
13
14
  export interface SelectCardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'value' | 'defaultValue' | 'onChange'> {
14
15
  defaultValue?: Value;
@@ -21,9 +22,11 @@ export interface SelectCardProps extends Omit<React.HTMLAttributes<HTMLDivElemen
21
22
  optionRender?: (Option: React.ReactNode, option: SelectCardOption, index: number) => React.ReactNode;
22
23
  classNames?: {
23
24
  card?: string;
25
+ icon?: string;
24
26
  };
25
27
  styles?: {
26
28
  card?: React.CSSProperties;
29
+ icon?: React.CSSProperties;
27
30
  };
28
31
  }
29
32
  export declare const SelectCard: React.ForwardRefExoticComponent<SelectCardProps & React.RefAttributes<HTMLDivElement>>;
@@ -33,7 +33,7 @@ export var SelectCard = /*#__PURE__*/React.forwardRef(function (props, ref) {
33
33
  otherProps = _objectWithoutProperties(props, _excluded);
34
34
  var isImg = useMemo(function () {
35
35
  return options.some(function (o) {
36
- return !!o.img;
36
+ return !!o.img || !!o.icon;
37
37
  });
38
38
  }, [options]);
39
39
  var _useStyles = useStyles({
@@ -86,17 +86,20 @@ export var SelectCard = /*#__PURE__*/React.forwardRef(function (props, ref) {
86
86
  var selected = isSelected(o.value);
87
87
  var Option = /*#__PURE__*/_jsxs(Flex, {
88
88
  align: isImg ? 'center' : 'flex-start',
89
- className: cx(styles.option, selected && styles.optionSelected, classNames === null || classNames === void 0 ? void 0 : classNames.card, o.className),
89
+ className: cx(styles.option, selected && styles.optionSelected, classNames === null || classNames === void 0 ? void 0 : classNames.card),
90
90
  gap: "small",
91
91
  onClick: function onClick() {
92
92
  return onSelect(o.value);
93
93
  },
94
- style: stylesFromProps === null || stylesFromProps === void 0 ? void 0 : stylesFromProps.card,
94
+ style: _objectSpread(_objectSpread({}, stylesFromProps === null || stylesFromProps === void 0 ? void 0 : stylesFromProps.card), o.style),
95
95
  vertical: true,
96
96
  children: [isImg && /*#__PURE__*/_jsx(Avatar, {
97
+ className: classNames === null || classNames === void 0 ? void 0 : classNames.icon,
98
+ icon: o.icon,
97
99
  shape: "square",
98
100
  size: imgHeight,
99
- src: o.img
101
+ src: o.img,
102
+ style: _objectSpread(_objectSpread({}, stylesFromProps === null || stylesFromProps === void 0 ? void 0 : stylesFromProps.icon), o.iconStyle)
100
103
  }), o.label && /*#__PURE__*/_jsx(Text, {
101
104
  ellipsis: true,
102
105
  strong: true,
@@ -113,7 +116,7 @@ export var SelectCard = /*#__PURE__*/React.forwardRef(function (props, ref) {
113
116
  })]
114
117
  }, o.value);
115
118
  return optionRender ? optionRender(Option, o, index) : Option;
116
- }, [classNames === null || classNames === void 0 ? void 0 : classNames.card, cx, imgHeight, isImg, isSelected, multiple, onSelect, optionRender, styles.check, styles.option, styles.optionSelected, stylesFromProps === null || stylesFromProps === void 0 ? void 0 : stylesFromProps.card]);
119
+ }, [classNames === null || classNames === void 0 ? void 0 : classNames.card, classNames === null || classNames === void 0 ? void 0 : classNames.icon, cx, imgHeight, isImg, isSelected, multiple, onSelect, optionRender, styles.check, styles.option, styles.optionSelected, stylesFromProps === null || stylesFromProps === void 0 ? void 0 : stylesFromProps.card, stylesFromProps === null || stylesFromProps === void 0 ? void 0 : stylesFromProps.icon]);
117
120
  return /*#__PURE__*/_jsx(Flex, _objectSpread(_objectSpread({
118
121
  gap: "large",
119
122
  ref: ref,
@@ -35,7 +35,7 @@ export var useStyles = createStyles(function (_ref, _ref2) {
35
35
  var _getNumberBySize = getNumberBySize(size),
36
36
  cardWidth = _getNumberBySize.cardWidth;
37
37
  return {
38
- option: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n\n border: 1px solid ", ";\n border-radius: ", "px;\n\n cursor: ", ";\n\n padding: ", "px;\n\n transition: all ", ";\n\n width: ", "px;\n min-height: 108px;\n\n ", "\n\n ", "\n\n div.", "-typography {\n margin-bottom: 0;\n }\n "])), token.colorBorderSecondary, token.borderRadius, disabled ? 'not-allowed' : 'pointer', token.padding, token.motionDurationFast, cardWidth, disabled && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background-color: ", ";\n .", "-typography {\n color: ", ";\n &.", "-typography-secondary {\n color: ", ";\n }\n }\n "])), token.colorBgContainerDisabled, prefixCls, token.colorTextDisabled, prefixCls, token.colorTextDisabled), !disabled && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n &:hover {\n border-color: ", ";\n }\n "])), token.colorPrimaryBorderHover), prefixCls),
38
+ option: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n\n border: 1px solid ", ";\n border-radius: ", "px;\n\n cursor: ", ";\n\n padding: ", "px;\n\n transition: all ", ";\n\n width: ", "px;\n min-height: 108px;\n\n ", "\n\n ", "\n\n div.", "-typography {\n margin-bottom: 0;\n }\n "])), token.colorBorder, token.borderRadius, disabled ? 'not-allowed' : 'pointer', token.padding, token.motionDurationFast, cardWidth, disabled && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background-color: ", ";\n .", "-typography {\n color: ", ";\n &.", "-typography-secondary {\n color: ", ";\n }\n }\n "])), token.colorBgContainerDisabled, prefixCls, token.colorTextDisabled, prefixCls, token.colorTextDisabled), !disabled && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n &:hover {\n border-color: ", ";\n }\n "])), token.colorPrimaryBorderHover), prefixCls),
39
39
  optionSelected: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n border-color: ", ";\n &:hover {\n border-color: ", ";\n }\n "])), token.colorPrimary, token.colorPrimaryActive),
40
40
  check: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n position: absolute;\n right: ", "px;\n bottom: ", "px;\n color: ", ";\n "])), token.marginXS, token.marginXS, token.colorPrimary)
41
41
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuntijs/ui",
3
- "version": "1.0.0-beta.64",
3
+ "version": "1.0.0-beta.66",
4
4
  "description": "☁️ Yunti UI - an open-source UI component library for building Cloud Native web apps",
5
5
  "keywords": [
6
6
  "yuntijs",