@yuntijs/ui 1.0.0-beta.73 → 1.0.0-beta.75

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,6 +1,7 @@
1
1
  import type { ButtonProps } from 'antd';
2
+ import type { ItemType } from 'antd/es/menu/interface';
2
3
  import React from 'react';
3
- export interface ButtonItem {
4
+ export type ButtonType = {
4
5
  key: string;
5
6
  label: string;
6
7
  icon?: React.ReactNode;
@@ -8,7 +9,8 @@ export interface ButtonItem {
8
9
  disabled?: boolean;
9
10
  loading?: boolean;
10
11
  type?: ButtonProps['type'];
11
- }
12
+ };
13
+ export type ButtonItem = ButtonType | ItemType;
12
14
  export interface HeaderButtonGroupProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'onClick'> {
13
15
  onClick?: (key: string, e: React.MouseEvent<HTMLElement, MouseEvent> | React.KeyboardEvent<HTMLElement>) => void;
14
16
  items?: ButtonItem[];
@@ -35,36 +35,24 @@ export var HeaderButtonGroup = function HeaderButtonGroup(props) {
35
35
  }));
36
36
  }
37
37
  var _items = _toArray(items),
38
- _items$ = _items[0],
39
- firstKey = _items$.key,
40
- firstLabel = _items$.label,
41
- btnProps = _objectWithoutProperties(_items$, _excluded3),
38
+ firstButton = _items[0],
42
39
  menuItems = _items.slice(1);
40
+ var _ref2 = firstButton,
41
+ firstKey = _ref2.key,
42
+ firstLabel = _ref2.label,
43
+ btnProps = _objectWithoutProperties(_ref2, _excluded3);
43
44
  return /*#__PURE__*/_jsx(Dropdown.Button, _objectSpread(_objectSpread(_objectSpread({
44
45
  onClick: function onClick(e) {
45
46
  return _onClick(firstKey, e);
46
47
  }
47
48
  }, btnProps), {}, {
48
49
  menu: {
49
- onClick: function onClick(_ref2) {
50
- var key = _ref2.key,
51
- domEvent = _ref2.domEvent;
50
+ onClick: function onClick(_ref3) {
51
+ var key = _ref3.key,
52
+ domEvent = _ref3.domEvent;
52
53
  return _onClick(key, domEvent);
53
54
  },
54
- items: menuItems.map(function (_ref3) {
55
- var key = _ref3.key,
56
- label = _ref3.label,
57
- icon = _ref3.icon,
58
- danger = _ref3.danger,
59
- disabled = _ref3.disabled;
60
- return {
61
- key: key,
62
- label: label,
63
- icon: icon,
64
- danger: danger,
65
- disabled: disabled
66
- };
67
- })
55
+ items: menuItems
68
56
  },
69
57
  overlayStyle: {
70
58
  minWidth: 100
@@ -100,23 +100,26 @@ export var SelectCard = /*#__PURE__*/React.forwardRef(function (props, ref) {
100
100
  size: imgHeight,
101
101
  src: o.img,
102
102
  style: _objectSpread(_objectSpread({}, stylesFromProps === null || stylesFromProps === void 0 ? void 0 : stylesFromProps.icon), o.iconStyle)
103
- }), o.label && /*#__PURE__*/_jsx(Text, {
103
+ }), o.label && selected && /*#__PURE__*/_jsx(Text, {
104
104
  ellipsis: true,
105
105
  strong: true,
106
106
  children: o.label
107
+ }), o.label && !selected && /*#__PURE__*/_jsx(Text, {
108
+ ellipsis: true,
109
+ children: o.label
107
110
  }), !isImg && o.description && /*#__PURE__*/_jsx(Paragraph, {
108
111
  ellipsis: {
109
112
  rows: 2
110
113
  },
111
114
  type: "secondary",
112
115
  children: o.description
113
- }), multiple && selected && /*#__PURE__*/_jsx(Icon, {
116
+ }), selected && /*#__PURE__*/_jsx(Icon, {
114
117
  className: styles.check,
115
118
  icon: Check
116
119
  })]
117
120
  }, o.value);
118
121
  return optionRender ? optionRender(Option, o, index) : Option;
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]);
122
+ }, [classNames === null || classNames === void 0 ? void 0 : classNames.card, classNames === null || classNames === void 0 ? void 0 : classNames.icon, cx, imgHeight, isImg, isSelected, 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]);
120
123
  return /*#__PURE__*/_jsx(Flex, _objectSpread(_objectSpread({
121
124
  gap: "large",
122
125
  ref: ref,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuntijs/ui",
3
- "version": "1.0.0-beta.73",
3
+ "version": "1.0.0-beta.75",
4
4
  "description": "☁️ Yunti UI - an open-source UI component library for building Cloud Native web apps",
5
5
  "keywords": [
6
6
  "yuntijs",