@yuntijs/ui 1.0.0-beta.8 → 1.0.0-beta.80
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.
- package/es/Alert/index.d.ts +13 -0
- package/es/Alert/index.js +25 -0
- package/es/Alert/style.d.ts +4 -0
- package/es/Alert/style.js +13 -0
- package/es/App/index.d.ts +7 -0
- package/es/App/index.js +19 -0
- package/es/ButtonGroup/index.d.ts +24 -0
- package/es/ButtonGroup/index.js +66 -0
- package/es/Card/index.d.ts +1 -0
- package/es/Card/index.js +1 -0
- package/es/CardList/Item/index.d.ts +4 -0
- package/es/CardList/Item/index.js +43 -0
- package/es/CardList/Item/style.d.ts +0 -0
- package/es/CardList/Item/style.js +0 -0
- package/es/CardList/index.d.ts +2 -0
- package/es/CardList/index.js +39 -0
- package/es/ChatInputArea/desktop/ChatInputArea.d.ts +19 -0
- package/es/ChatInputArea/desktop/ChatInputArea.js +72 -0
- package/es/ChatInputArea/index.d.ts +6 -0
- package/es/ChatInputArea/index.js +6 -0
- package/es/ChatItem/components/MessageContent.d.ts +21 -0
- package/es/ChatItem/components/MessageContent.js +59 -0
- package/es/ChatItem/index.d.ts +4 -0
- package/es/ChatItem/index.js +120 -0
- package/es/ChatItem/style.d.ts +24 -0
- package/es/ChatItem/style.js +38 -0
- package/es/ChatItem/type.d.ts +82 -0
- package/es/ChatItem/type.js +1 -0
- package/es/CollapseGroup/index.d.ts +4 -0
- package/es/CollapseGroup/index.js +23 -0
- package/es/CollapseGroup/style.d.ts +3 -0
- package/es/CollapseGroup/style.js +11 -0
- package/es/ConfigProvider/index.d.ts +3 -0
- package/es/ConfigProvider/index.js +17 -11
- package/es/Descriptions/index.d.ts +14 -0
- package/es/Descriptions/index.js +31 -0
- package/es/Descriptions/style.d.ts +4 -0
- package/es/Descriptions/style.js +24 -0
- package/es/Divider/index.d.ts +38 -0
- package/es/Divider/index.js +66 -0
- package/es/Divider/style.d.ts +3 -0
- package/es/Divider/style.js +12 -0
- package/es/DragPanel/index.d.ts +10 -0
- package/es/DragPanel/index.js +97 -0
- package/es/DragPanel/style.d.ts +7 -0
- package/es/DragPanel/style.js +15 -0
- package/es/Drawer/index.d.ts +13 -0
- package/es/Drawer/index.js +20 -0
- package/es/Drawer/style.d.ts +4 -0
- package/es/Drawer/style.js +16 -0
- package/es/Dropdown/index.d.ts +14 -0
- package/es/Dropdown/index.js +59 -0
- package/es/Dropdown/style.d.ts +7 -0
- package/es/Dropdown/style.js +13 -0
- package/es/EditableMessage/index.d.ts +75 -0
- package/es/EditableMessage/index.js +99 -0
- package/es/Form/collapse-list/index.d.ts +40 -0
- package/es/Form/collapse-list/index.js +209 -0
- package/es/Form/collapse-list/style.d.ts +5 -0
- package/es/Form/collapse-list/style.js +13 -0
- package/es/Form/index.d.ts +8 -0
- package/es/Form/index.js +5 -0
- package/es/FormHelper/autoFocus.d.ts +10 -0
- package/es/FormHelper/autoFocus.js +38 -0
- package/es/FormHelper/index.d.ts +13 -0
- package/es/FormHelper/index.js +41 -0
- package/es/Highlighter/FullFeatured.d.ts +18 -0
- package/es/Highlighter/FullFeatured.js +102 -0
- package/es/Highlighter/SyntaxHighlighter/index.d.ts +7 -0
- package/es/Highlighter/SyntaxHighlighter/index.js +51 -0
- package/es/Highlighter/SyntaxHighlighter/style.d.ts +5 -0
- package/es/Highlighter/SyntaxHighlighter/style.js +16 -0
- package/es/Highlighter/index.d.ts +50 -0
- package/es/Highlighter/index.js +77 -0
- package/es/Highlighter/style.d.ts +9 -0
- package/es/Highlighter/style.js +23 -0
- package/es/Highlighter/theme.d.ts +1 -0
- package/es/Highlighter/theme.js +1661 -0
- package/es/LogViewer/index.d.ts +10 -0
- package/es/LogViewer/index.js +141 -0
- package/es/LogViewer/style.d.ts +6 -0
- package/es/LogViewer/style.js +16 -0
- package/es/LogViewer/types.d.ts +235 -0
- package/es/LogViewer/types.js +1 -0
- package/es/Mentions/constants.d.ts +6 -0
- package/es/Mentions/constants.js +28 -0
- package/es/Mentions/hooks.d.ts +20 -0
- package/es/Mentions/hooks.js +133 -0
- package/es/Mentions/index.d.ts +19 -0
- package/es/Mentions/index.js +136 -0
- package/es/Mentions/plugins/custom-text/node.d.ts +11 -0
- package/es/Mentions/plugins/custom-text/node.js +72 -0
- package/es/Mentions/plugins/mention-node/component.d.ts +6 -0
- package/es/Mentions/plugins/mention-node/component.js +64 -0
- package/es/Mentions/plugins/mention-node/index.d.ts +9 -0
- package/es/Mentions/plugins/mention-node/index.js +32 -0
- package/es/Mentions/plugins/mention-node/node.d.ts +23 -0
- package/es/Mentions/plugins/mention-node/node.js +97 -0
- package/es/Mentions/plugins/mention-node/replacement.d.ts +5 -0
- package/es/Mentions/plugins/mention-node/replacement.js +42 -0
- package/es/Mentions/plugins/mention-node/style.d.ts +8 -0
- package/es/Mentions/plugins/mention-node/style.js +47 -0
- package/es/Mentions/plugins/mention-node/utils.d.ts +4 -0
- package/es/Mentions/plugins/mention-node/utils.js +5 -0
- package/es/Mentions/plugins/mention-picker/hooks.d.ts +5 -0
- package/es/Mentions/plugins/mention-picker/hooks.js +39 -0
- package/es/Mentions/plugins/mention-picker/index.d.ts +36 -0
- package/es/Mentions/plugins/mention-picker/index.js +87 -0
- package/es/Mentions/plugins/mention-picker/menu-item.d.ts +11 -0
- package/es/Mentions/plugins/mention-picker/menu-item.js +71 -0
- package/es/Mentions/plugins/mention-picker/menu.d.ts +9 -0
- package/es/Mentions/plugins/mention-picker/menu.js +30 -0
- package/es/Mentions/plugins/mention-picker/style.d.ts +11 -0
- package/es/Mentions/plugins/mention-picker/style.js +19 -0
- package/es/Mentions/plugins/mention-picker/utils.d.ts +22 -0
- package/es/Mentions/plugins/mention-picker/utils.js +39 -0
- package/es/Mentions/plugins/on-blur-or-focus-block.d.ts +7 -0
- package/es/Mentions/plugins/on-blur-or-focus-block.js +36 -0
- package/es/Mentions/provider.d.ts +12 -0
- package/es/Mentions/provider.js +15 -0
- package/es/Mentions/style.d.ts +11 -0
- package/es/Mentions/style.js +22 -0
- package/es/Mentions/types.d.ts +17 -0
- package/es/Mentions/types.js +1 -0
- package/es/Mentions/utils.d.ts +9 -0
- package/es/Mentions/utils.js +95 -0
- package/es/Modal/index.d.ts +19 -0
- package/es/Modal/index.js +36 -0
- package/es/Modal/style.d.ts +4 -0
- package/es/Modal/style.js +17 -0
- package/es/MonacoEditor/base/controller.d.ts +17 -0
- package/es/MonacoEditor/base/controller.js +49 -0
- package/es/MonacoEditor/base/helper.d.ts +65 -0
- package/es/MonacoEditor/base/helper.js +324 -0
- package/es/MonacoEditor/base/index.d.ts +35 -0
- package/es/MonacoEditor/base/index.js +236 -0
- package/es/MonacoEditor/base/monaco.d.ts +6 -0
- package/es/MonacoEditor/base/monaco.js +64 -0
- package/es/MonacoEditor/base/style.d.ts +12 -0
- package/es/MonacoEditor/base/style.js +26 -0
- package/es/MonacoEditor/index.d.ts +2 -4
- package/es/MonacoEditor/index.js +26 -62
- package/es/MonacoEditor/style.js +3 -2
- package/es/Page/Breadcrumb/index.d.ts +9 -0
- package/es/Page/Breadcrumb/index.js +56 -0
- package/es/Page/Content/index.d.ts +4 -0
- package/es/Page/Content/index.js +59 -0
- package/es/Page/Content/style.d.ts +3 -0
- package/es/Page/Content/style.js +12 -0
- package/es/Page/Footer/index.d.ts +2 -0
- package/es/Page/Footer/index.js +6 -0
- package/es/Page/Header/Icon.d.ts +17 -0
- package/es/Page/Header/Icon.js +42 -0
- package/es/Page/Header/index.d.ts +43 -0
- package/es/Page/Header/index.js +202 -0
- package/es/Page/Header/style.d.ts +12 -0
- package/es/Page/Header/style.js +21 -0
- package/es/Page/Page.d.ts +9 -0
- package/es/Page/Page.js +49 -0
- package/es/Page/PageContext.d.ts +15 -0
- package/es/Page/PageContext.js +21 -0
- package/es/Page/Title/index.d.ts +5 -0
- package/es/Page/Title/index.js +18 -0
- package/es/Page/Title/style.d.ts +3 -0
- package/es/Page/Title/style.js +10 -0
- package/es/Page/index.d.ts +18 -0
- package/es/Page/index.js +15 -0
- package/es/Page/style.d.ts +3 -0
- package/es/Page/style.js +10 -0
- package/es/ProCard/Card/index.d.ts +6 -0
- package/es/ProCard/Card/index.js +25 -0
- package/es/ProCard/Card/style.d.ts +7 -0
- package/es/ProCard/Card/style.js +15 -0
- package/es/ProCard/Content/index.d.ts +4 -0
- package/es/ProCard/Content/index.js +24 -0
- package/es/ProCard/Content/style.d.ts +3 -0
- package/es/ProCard/Content/style.js +10 -0
- package/es/ProCard/Descriptions/index.d.ts +4 -0
- package/es/ProCard/Descriptions/index.js +28 -0
- package/es/ProCard/Descriptions/style.d.ts +3 -0
- package/es/ProCard/Descriptions/style.js +12 -0
- package/es/ProCard/Header/index.d.ts +15 -0
- package/es/ProCard/Header/index.js +86 -0
- package/es/ProCard/Header/style.d.ts +12 -0
- package/es/ProCard/Header/style.js +21 -0
- package/es/ProCard/index.d.ts +13 -0
- package/es/ProCard/index.js +8 -0
- package/es/Radio/index.d.ts +36 -0
- package/es/Radio/index.js +26 -0
- package/es/Radio/style.d.ts +4 -0
- package/es/Radio/style.js +66 -0
- package/es/SelectCard/index.d.ts +33 -0
- package/es/SelectCard/index.js +132 -0
- package/es/SelectCard/style.d.ts +10 -0
- package/es/SelectCard/style.js +42 -0
- package/es/SliderInput/index.js +2 -2
- package/es/Status/index.d.ts +7 -0
- package/es/Status/index.js +39 -0
- package/es/Status/style.d.ts +4 -0
- package/es/Status/style.js +14 -0
- package/es/Table/collapse/index.d.ts +8 -0
- package/es/Table/collapse/index.js +39 -0
- package/es/Table/collapse/style.d.ts +3 -0
- package/es/Table/collapse/style.js +11 -0
- package/es/Table/index.d.ts +20 -0
- package/es/Table/index.js +56 -0
- package/es/Typography/index.d.ts +32 -0
- package/es/Typography/index.js +77 -0
- package/es/WaveformIcon/index.d.ts +9 -0
- package/es/WaveformIcon/index.js +51 -0
- package/es/hooks/languageMap.d.ts +1 -0
- package/es/hooks/languageMap.js +1 -0
- package/es/hooks/useHighlight.d.ts +5 -0
- package/es/hooks/useHighlight.js +78 -0
- package/es/index.d.ts +38 -1
- package/es/index.js +52 -1
- package/es/notification/index.d.ts +24 -0
- package/es/notification/index.js +237 -0
- package/es/notification/style.d.ts +2 -0
- package/es/notification/style.js +28 -0
- package/es/styles/colors/colors.d.ts +39 -0
- package/es/styles/colors/colors.js +86 -0
- package/es/styles/colors/generateColorPalette.d.ts +11 -0
- package/es/styles/colors/generateColorPalette.js +31 -0
- package/es/styles/colors/neutralColors.d.ts +9 -0
- package/es/styles/colors/neutralColors.js +32 -0
- package/es/styles/index.d.ts +4 -0
- package/es/styles/index.js +4 -0
- package/es/useSpeechSynthes/const/polyfill.d.ts +3 -0
- package/es/useSpeechSynthes/const/polyfill.js +21 -0
- package/es/useSpeechSynthes/index.d.ts +13 -0
- package/es/useSpeechSynthes/index.js +69 -0
- package/es/utils/constants.d.ts +1 -0
- package/es/utils/constants.js +1 -0
- package/es/utils/tools.d.ts +1 -0
- package/es/utils/tools.js +1 -0
- package/package.json +30 -9
- package/umd/index.min.js +1 -1
- package/umd/index.min.js.map +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["className", "bordered", "hoverable", "children"];
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { useStyles } from "./style";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
export var ProCard = function ProCard(_ref) {
|
|
10
|
+
var className = _ref.className,
|
|
11
|
+
_ref$bordered = _ref.bordered,
|
|
12
|
+
bordered = _ref$bordered === void 0 ? false : _ref$bordered,
|
|
13
|
+
_ref$hoverable = _ref.hoverable,
|
|
14
|
+
hoverable = _ref$hoverable === void 0 ? true : _ref$hoverable,
|
|
15
|
+
children = _ref.children,
|
|
16
|
+
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
17
|
+
var _useStyles = useStyles(),
|
|
18
|
+
cx = _useStyles.cx,
|
|
19
|
+
styles = _useStyles.styles;
|
|
20
|
+
return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
|
|
21
|
+
className: cx(styles.root, bordered && styles.bordered, hoverable && styles.hoverable, className)
|
|
22
|
+
}, otherProps), {}, {
|
|
23
|
+
children: children
|
|
24
|
+
}));
|
|
25
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
|
|
2
|
+
root: import("antd-style").SerializedStyles;
|
|
3
|
+
bordered: import("antd-style").SerializedStyles;
|
|
4
|
+
hoverable: import("antd-style").SerializedStyles;
|
|
5
|
+
text: import("antd-style").SerializedStyles;
|
|
6
|
+
error: import("antd-style").SerializedStyles;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
|
+
export var useStyles = createStyles(function (_ref) {
|
|
5
|
+
var css = _ref.css,
|
|
6
|
+
token = _ref.token,
|
|
7
|
+
prefixCls = _ref.prefixCls;
|
|
8
|
+
return {
|
|
9
|
+
root: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n\n overflow: hidden;\n\n margin: 0;\n padding: 0;\n\n font-family: ", ";\n color: ", ";\n\n background: ", ";\n border-radius: ", "px;\n box-shadow: ", ";\n "])), token.fontFamily, token.colorText, token.colorBgContainer, token.borderRadius * 2, token.boxShadowTertiary),
|
|
10
|
+
bordered: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n box-shadow: none;\n "])), token.colorBorder),
|
|
11
|
+
hoverable: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n cursor: pointer;\n transition:\n box-shadow ", ",\n border-color ", ";\n &:hover {\n border-color: transparent;\n box-shadow: ", ";\n }\n "])), token.motionDurationMid, token.motionDurationMid, token.boxShadow),
|
|
12
|
+
text: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n overflow: hidden;\n display: inline-block;\n\n max-width: 200px;\n\n color: ", ";\n text-overflow: ellipsis;\n white-space: nowrap;\n "])), token.colorTextSecondary),
|
|
13
|
+
error: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n color: ", ";\n "])), token.colorErrorText)
|
|
14
|
+
};
|
|
15
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["className", "children"];
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
import { Flex } from 'antd';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { useStyles } from "./style";
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
export var ProCardContent = function ProCardContent(props) {
|
|
11
|
+
var className = props.className,
|
|
12
|
+
children = props.children,
|
|
13
|
+
otherProps = _objectWithoutProperties(props, _excluded);
|
|
14
|
+
var _useStyles = useStyles(),
|
|
15
|
+
styles = _useStyles.styles,
|
|
16
|
+
cx = _useStyles.cx;
|
|
17
|
+
return /*#__PURE__*/_jsx(Flex, _objectSpread(_objectSpread({
|
|
18
|
+
className: cx(styles.root, className),
|
|
19
|
+
gap: 20,
|
|
20
|
+
vertical: true
|
|
21
|
+
}, otherProps), {}, {
|
|
22
|
+
children: children
|
|
23
|
+
}));
|
|
24
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject;
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
|
+
export var useStyles = createStyles(function (_ref) {
|
|
5
|
+
var css = _ref.css,
|
|
6
|
+
token = _ref.token;
|
|
7
|
+
return {
|
|
8
|
+
root: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 12px 24px 20px;\n "])))
|
|
9
|
+
};
|
|
10
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["className", "colon", "column", "size"];
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import Descriptions from "../../Descriptions";
|
|
8
|
+
import { useStyles } from "./style";
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
export var ProCardDescriptions = function ProCardDescriptions(_ref) {
|
|
11
|
+
var className = _ref.className,
|
|
12
|
+
_ref$colon = _ref.colon,
|
|
13
|
+
colon = _ref$colon === void 0 ? false : _ref$colon,
|
|
14
|
+
_ref$column = _ref.column,
|
|
15
|
+
column = _ref$column === void 0 ? 2 : _ref$column,
|
|
16
|
+
_ref$size = _ref.size,
|
|
17
|
+
size = _ref$size === void 0 ? 'small' : _ref$size,
|
|
18
|
+
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
19
|
+
var _useStyles = useStyles(),
|
|
20
|
+
cx = _useStyles.cx,
|
|
21
|
+
styles = _useStyles.styles;
|
|
22
|
+
return /*#__PURE__*/_jsx(Descriptions, _objectSpread({
|
|
23
|
+
className: cx(styles.root, className),
|
|
24
|
+
colon: colon,
|
|
25
|
+
column: column,
|
|
26
|
+
size: size
|
|
27
|
+
}, otherProps));
|
|
28
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject;
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
|
+
export var useStyles = createStyles(function (_ref) {
|
|
5
|
+
var css = _ref.css,
|
|
6
|
+
token = _ref.token,
|
|
7
|
+
prefixCls = _ref.prefixCls;
|
|
8
|
+
var lableWidth = 70;
|
|
9
|
+
return {
|
|
10
|
+
root: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &.", "-descriptions {\n .", "-descriptions-row {\n & > td {\n padding-top: 4px !important;\n padding-bottom: 4px !important;\n }\n .", "-descriptions-item {\n &-container {\n .", "-descriptions-item-label {\n overflow: hidden;\n width: ", "px;\n white-space: nowrap;\n }\n .", "-descriptions-item-content {\n overflow: hidden;\n display: inline-block;\n\n width: calc(100% - ", "px);\n\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n }\n }\n }\n }\n "])), prefixCls, prefixCls, prefixCls, prefixCls, lableWidth, prefixCls, lableWidth)
|
|
11
|
+
};
|
|
12
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AvatarProps, DropDownProps } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export interface ProCardHeaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
4
|
+
/** 图标 src 路径或者详细配置 */
|
|
5
|
+
icon?: AvatarProps;
|
|
6
|
+
/** 标题 */
|
|
7
|
+
title?: React.ReactNode;
|
|
8
|
+
/** 描述 */
|
|
9
|
+
description?: React.ReactNode;
|
|
10
|
+
/** 右侧扩展区域 */
|
|
11
|
+
extra?: DropDownProps;
|
|
12
|
+
/** 控制 header 与 content 的分割线 */
|
|
13
|
+
divider?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const ProCardHeader: React.FC<ProCardHeaderProps>;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["className", "icon", "title", "description", "extra", "divider"],
|
|
4
|
+
_excluded2 = ["className", "shape", "size"],
|
|
5
|
+
_excluded3 = ["children"];
|
|
6
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
+
import { Icon } from '@lobehub/ui';
|
|
9
|
+
import { Avatar, Button, Dropdown, Flex } from 'antd';
|
|
10
|
+
import { EllipsisVertical } from 'lucide-react';
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import Typography from "../../Typography";
|
|
13
|
+
import { useStyles } from "./style";
|
|
14
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
var Paragraph = Typography.Paragraph;
|
|
17
|
+
export var ProCardHeader = function ProCardHeader(props) {
|
|
18
|
+
var className = props.className,
|
|
19
|
+
icon = props.icon,
|
|
20
|
+
title = props.title,
|
|
21
|
+
description = props.description,
|
|
22
|
+
extra = props.extra,
|
|
23
|
+
divider = props.divider,
|
|
24
|
+
otherProps = _objectWithoutProperties(props, _excluded);
|
|
25
|
+
var _useStyles = useStyles({
|
|
26
|
+
divider: divider,
|
|
27
|
+
iconBg: !(icon !== null && icon !== void 0 && icon.src)
|
|
28
|
+
}),
|
|
29
|
+
styles = _useStyles.styles,
|
|
30
|
+
cx = _useStyles.cx;
|
|
31
|
+
var _ref = icon || {},
|
|
32
|
+
iconClassName = _ref.className,
|
|
33
|
+
_ref$shape = _ref.shape,
|
|
34
|
+
shape = _ref$shape === void 0 ? 'square' : _ref$shape,
|
|
35
|
+
_ref$size = _ref.size,
|
|
36
|
+
size = _ref$size === void 0 ? 72 : _ref$size,
|
|
37
|
+
otherIconProps = _objectWithoutProperties(_ref, _excluded2);
|
|
38
|
+
var _ref2 = extra || {},
|
|
39
|
+
extraChildren = _ref2.children,
|
|
40
|
+
otherExtraProps = _objectWithoutProperties(_ref2, _excluded3);
|
|
41
|
+
return /*#__PURE__*/_jsxs(Flex, _objectSpread(_objectSpread({
|
|
42
|
+
className: cx(styles.root, className),
|
|
43
|
+
gap: 20
|
|
44
|
+
}, otherProps), {}, {
|
|
45
|
+
children: [icon && /*#__PURE__*/_jsx(Flex, {
|
|
46
|
+
children: /*#__PURE__*/_jsx(Avatar, _objectSpread({
|
|
47
|
+
className: cx(styles.icon, iconClassName),
|
|
48
|
+
shape: shape,
|
|
49
|
+
size: size
|
|
50
|
+
}, otherIconProps))
|
|
51
|
+
}), /*#__PURE__*/_jsxs(Flex, {
|
|
52
|
+
flex: "1",
|
|
53
|
+
vertical: true,
|
|
54
|
+
children: [/*#__PURE__*/_jsxs(Flex, {
|
|
55
|
+
className: styles.titleBox,
|
|
56
|
+
gap: 4,
|
|
57
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
58
|
+
className: styles.title,
|
|
59
|
+
children: title
|
|
60
|
+
}), extra && /*#__PURE__*/_jsx(Flex, {
|
|
61
|
+
align: "flex-start",
|
|
62
|
+
className: styles.extra,
|
|
63
|
+
justify: "flex-end",
|
|
64
|
+
onClick: function onClick(e) {
|
|
65
|
+
return e.stopPropagation();
|
|
66
|
+
},
|
|
67
|
+
children: /*#__PURE__*/_jsx(Dropdown, _objectSpread(_objectSpread({}, otherExtraProps), {}, {
|
|
68
|
+
children: extraChildren || /*#__PURE__*/_jsx(Button, {
|
|
69
|
+
icon: /*#__PURE__*/_jsx(Icon, {
|
|
70
|
+
icon: EllipsisVertical
|
|
71
|
+
}),
|
|
72
|
+
size: "small",
|
|
73
|
+
type: "text"
|
|
74
|
+
})
|
|
75
|
+
}))
|
|
76
|
+
})]
|
|
77
|
+
}), description && /*#__PURE__*/_jsx(Paragraph, {
|
|
78
|
+
className: styles.description,
|
|
79
|
+
ellipsis: {
|
|
80
|
+
rows: 2
|
|
81
|
+
},
|
|
82
|
+
children: description
|
|
83
|
+
})]
|
|
84
|
+
})]
|
|
85
|
+
}));
|
|
86
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const useStyles: (props?: {
|
|
2
|
+
divider?: boolean | undefined;
|
|
3
|
+
iconBg?: boolean | undefined;
|
|
4
|
+
} | undefined) => import("antd-style").ReturnStyles<{
|
|
5
|
+
root: import("antd-style").SerializedStyles;
|
|
6
|
+
icon: import("antd-style").SerializedStyles;
|
|
7
|
+
titleBox: import("antd-style").SerializedStyles;
|
|
8
|
+
title: import("antd-style").SerializedStyles;
|
|
9
|
+
description: import("antd-style").SerializedStyles;
|
|
10
|
+
extra: import("antd-style").SerializedStyles;
|
|
11
|
+
rightButtons: import("antd-style").SerializedStyles;
|
|
12
|
+
}>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
|
+
export var useStyles = createStyles(function (_ref, _ref2) {
|
|
5
|
+
var css = _ref.css,
|
|
6
|
+
token = _ref.token,
|
|
7
|
+
prefixCls = _ref.prefixCls;
|
|
8
|
+
var _ref2$divider = _ref2.divider,
|
|
9
|
+
divider = _ref2$divider === void 0 ? true : _ref2$divider,
|
|
10
|
+
_ref2$iconBg = _ref2.iconBg,
|
|
11
|
+
iconBg = _ref2$iconBg === void 0 ? true : _ref2$iconBg;
|
|
12
|
+
return {
|
|
13
|
+
root: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 24px 20px ", "px 24px;\n ", "\n "])), divider ? 20 : 0, divider && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n border-bottom: 1px solid ", ";\n "])), token.colorSplit)),
|
|
14
|
+
icon: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n &.", "-avatar {\n color: ", ";\n ", "\n &.", "-avatar-square {\n border-radius: 10px;\n }\n .anticon {\n font-size: 40px;\n }\n }\n "])), prefixCls, token.colorPrimary, iconBg && css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), token.colorBgLayout), prefixCls),
|
|
15
|
+
titleBox: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin-right: 4px;\n margin-bottom: ", "px;\n "])), token.marginXXS),
|
|
16
|
+
title: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n overflow: hidden;\n display: inline-block;\n flex: 1;\n\n width: 100px;\n\n font-size: 16px;\n font-weight: ", ";\n text-overflow: ellipsis;\n white-space: nowrap;\n "])), token.fontWeightStrong),
|
|
17
|
+
description: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n margin-right: 4px;\n &.", "-typography {\n margin-bottom: 0 !important;\n font-size: 12px;\n color: ", ";\n }\n "])), prefixCls, token.colorTextSecondary),
|
|
18
|
+
extra: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n margin-top: -4px;\n "]))),
|
|
19
|
+
rightButtons: css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n justify-content: flex-end;\n "])))
|
|
20
|
+
};
|
|
21
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ProCardContent } from './Content';
|
|
3
|
+
import { ProCardDescriptions } from './Descriptions';
|
|
4
|
+
import { ProCardHeader } from './Header';
|
|
5
|
+
export type { ProCardProps } from './Card';
|
|
6
|
+
export type { ProCardContentProps } from './Content';
|
|
7
|
+
export type { ProCardDescriptionsProps } from './Descriptions';
|
|
8
|
+
export type { ProCardHeaderProps } from './Header';
|
|
9
|
+
export declare const ProCard: import("react").FC<import("./Card").ProCardProps> & {
|
|
10
|
+
Header: typeof ProCardHeader;
|
|
11
|
+
Descriptions: typeof ProCardDescriptions;
|
|
12
|
+
Content: typeof ProCardContent;
|
|
13
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ProCard as InternalProCard } from "./Card";
|
|
2
|
+
import { ProCardContent } from "./Content";
|
|
3
|
+
import { ProCardDescriptions } from "./Descriptions";
|
|
4
|
+
import { ProCardHeader } from "./Header";
|
|
5
|
+
export var ProCard = InternalProCard;
|
|
6
|
+
ProCard.Header = ProCardHeader;
|
|
7
|
+
ProCard.Content = ProCardContent;
|
|
8
|
+
ProCard.Descriptions = ProCardDescriptions;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Radio as AntdRadio, type RadioGroupProps as AntdRadioGroupProps, RadioProps } from 'antd';
|
|
2
|
+
import type { RadioRef } from 'antd/es/radio/interface';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export interface CustomRadioProps {
|
|
5
|
+
/**
|
|
6
|
+
* @description Set the button style is similar to the Segmented component
|
|
7
|
+
* @default 'false'
|
|
8
|
+
*/
|
|
9
|
+
segmented?: {
|
|
10
|
+
/**
|
|
11
|
+
* @description Set the spacing between buttons
|
|
12
|
+
* @default 'true'
|
|
13
|
+
*/
|
|
14
|
+
gap?: 'small' | 'middle' | 'large' | number | boolean;
|
|
15
|
+
/**
|
|
16
|
+
* @description Set border-radius of buttons
|
|
17
|
+
* @default 'true'
|
|
18
|
+
*/
|
|
19
|
+
borderRadius?: number | boolean;
|
|
20
|
+
/**
|
|
21
|
+
* @description Sets whether the button's border is displayed
|
|
22
|
+
* @default 'false'
|
|
23
|
+
*/
|
|
24
|
+
bordered?: boolean;
|
|
25
|
+
} | boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface RadioGroupProps extends AntdRadioGroupProps, CustomRadioProps {
|
|
28
|
+
}
|
|
29
|
+
type RadioType = React.ForwardRefExoticComponent<RadioProps & React.RefAttributes<RadioRef>> & {
|
|
30
|
+
Group: typeof Group;
|
|
31
|
+
Button: typeof AntdRadio.Button;
|
|
32
|
+
};
|
|
33
|
+
export declare const Radio: RadioType;
|
|
34
|
+
declare const Group: React.FC<RadioGroupProps>;
|
|
35
|
+
export default Radio;
|
|
36
|
+
export { type RadioChangeEvent, type RadioProps } from 'antd';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["className"];
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
import { Radio as AntdRadio } from 'antd';
|
|
7
|
+
import AntdGroup from 'antd/es/radio/group';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { useStyles } from "./style";
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
export var Radio = AntdRadio;
|
|
12
|
+
var Group = function Group(props) {
|
|
13
|
+
var className = props.className,
|
|
14
|
+
otherProps = _objectWithoutProperties(props, _excluded);
|
|
15
|
+
if (otherProps.segmented) {
|
|
16
|
+
otherProps.optionType = 'button';
|
|
17
|
+
}
|
|
18
|
+
var _useStyles = useStyles(otherProps),
|
|
19
|
+
styles = _useStyles.styles,
|
|
20
|
+
cx = _useStyles.cx;
|
|
21
|
+
return /*#__PURE__*/_jsx(AntdGroup, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
22
|
+
className: cx(styles.custom, className)
|
|
23
|
+
}));
|
|
24
|
+
};
|
|
25
|
+
Radio.Group = Group;
|
|
26
|
+
export default Radio;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
|
+
export var useStyles = createStyles(function (_ref, _ref2) {
|
|
5
|
+
var css = _ref.css,
|
|
6
|
+
token = _ref.token,
|
|
7
|
+
prefixCls = _ref.prefixCls;
|
|
8
|
+
var size = _ref2.size,
|
|
9
|
+
segmented = _ref2.segmented;
|
|
10
|
+
var gap = function () {
|
|
11
|
+
if (!segmented) {
|
|
12
|
+
return 0;
|
|
13
|
+
}
|
|
14
|
+
if (segmented !== true) {
|
|
15
|
+
return segmented.gap;
|
|
16
|
+
}
|
|
17
|
+
return true;
|
|
18
|
+
}();
|
|
19
|
+
var borderRadius = function () {
|
|
20
|
+
if (!segmented) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (segmented !== true) {
|
|
24
|
+
return segmented.borderRadius;
|
|
25
|
+
}
|
|
26
|
+
return true;
|
|
27
|
+
}();
|
|
28
|
+
var getGapSize = function getGapSize() {
|
|
29
|
+
var gapSizeMap = {
|
|
30
|
+
small: token.sizeSM,
|
|
31
|
+
middle: token.size,
|
|
32
|
+
large: token.sizeLG
|
|
33
|
+
};
|
|
34
|
+
if (typeof gap === 'string') {
|
|
35
|
+
return gapSizeMap[gap];
|
|
36
|
+
}
|
|
37
|
+
if (gap === true) {
|
|
38
|
+
return size ? gapSizeMap[size] : gapSizeMap['middle'];
|
|
39
|
+
}
|
|
40
|
+
if (!gap) {
|
|
41
|
+
return 0;
|
|
42
|
+
}
|
|
43
|
+
return gap;
|
|
44
|
+
};
|
|
45
|
+
var getBorderRadius = function getBorderRadius() {
|
|
46
|
+
var borderRadiusSizeMap = {
|
|
47
|
+
small: token.controlHeightSM,
|
|
48
|
+
middle: token.controlHeight,
|
|
49
|
+
large: token.controlHeightLG
|
|
50
|
+
};
|
|
51
|
+
if (borderRadius === true) {
|
|
52
|
+
return size ? borderRadiusSizeMap[size] : borderRadiusSizeMap['middle'];
|
|
53
|
+
}
|
|
54
|
+
if (borderRadius || borderRadius === 0) {
|
|
55
|
+
return borderRadius;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
var borderRadiusStyle = getBorderRadius() && css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n label {\n border-inline-start-width: 1px !important;\n border-radius: ", "px !important;\n }\n label::before {\n display: none !important;\n }\n "])), getBorderRadius());
|
|
59
|
+
var gapStyle = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n label {\n margin-right: ", "px !important;\n }\n label:last-child {\n margin-right: 0 !important;\n }\n "])), getGapSize());
|
|
60
|
+
var noBorderd = segmented === true || segmented && !segmented.bordered;
|
|
61
|
+
return {
|
|
62
|
+
custom: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", "\n ", "\n ", "\n "])), borderRadiusStyle, gapStyle, noBorderd && css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n .", "-radio-button-wrapper {\n border: none !important;\n }\n .", "-radio-button-wrapper-checked {\n border: 1px solid ", " !important;\n }\n "])), prefixCls, prefixCls, token.colorPrimary))
|
|
63
|
+
};
|
|
64
|
+
}, {
|
|
65
|
+
hashPriority: 'low'
|
|
66
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { SelectProps } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
type RawValue = string | number;
|
|
4
|
+
type Value = RawValue | RawValue[];
|
|
5
|
+
export interface SelectCardOption {
|
|
6
|
+
value: RawValue;
|
|
7
|
+
img?: React.ReactNode;
|
|
8
|
+
icon?: React.ReactNode;
|
|
9
|
+
iconStyle?: React.CSSProperties;
|
|
10
|
+
label?: React.ReactNode;
|
|
11
|
+
description?: React.ReactNode;
|
|
12
|
+
style?: React.CSSProperties;
|
|
13
|
+
}
|
|
14
|
+
export interface SelectCardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'value' | 'defaultValue' | 'onChange'> {
|
|
15
|
+
defaultValue?: Value;
|
|
16
|
+
value?: Value;
|
|
17
|
+
onChange?: (value: Value) => void;
|
|
18
|
+
multiple?: boolean;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
options: SelectCardOption[];
|
|
21
|
+
size?: SelectProps['size'];
|
|
22
|
+
optionRender?: (Option: React.ReactNode, option: SelectCardOption, index: number) => React.ReactNode;
|
|
23
|
+
classNames?: {
|
|
24
|
+
card?: string;
|
|
25
|
+
icon?: string;
|
|
26
|
+
};
|
|
27
|
+
styles?: {
|
|
28
|
+
card?: React.CSSProperties;
|
|
29
|
+
icon?: React.CSSProperties;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export declare const SelectCard: React.ForwardRefExoticComponent<SelectCardProps & React.RefAttributes<HTMLDivElement>>;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
+
var _excluded = ["defaultValue", "value", "onChange", "multiple", "disabled", "options", "classNames", "styles", "size", "optionRender"];
|
|
6
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
+
import { Icon } from '@lobehub/ui';
|
|
9
|
+
import { Avatar, Flex, Typography } from 'antd';
|
|
10
|
+
import { Check } from 'lucide-react';
|
|
11
|
+
import { useMergedState } from 'rc-util';
|
|
12
|
+
import React, { useCallback, useMemo } from 'react';
|
|
13
|
+
import { getNumberBySize, useStyles } from "./style";
|
|
14
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
var Text = Typography.Text,
|
|
17
|
+
Paragraph = Typography.Paragraph;
|
|
18
|
+
export var SelectCard = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
19
|
+
var defaultValue = props.defaultValue,
|
|
20
|
+
value = props.value,
|
|
21
|
+
onChange = props.onChange,
|
|
22
|
+
_props$multiple = props.multiple,
|
|
23
|
+
multiple = _props$multiple === void 0 ? false : _props$multiple,
|
|
24
|
+
_props$disabled = props.disabled,
|
|
25
|
+
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
26
|
+
_props$options = props.options,
|
|
27
|
+
options = _props$options === void 0 ? [] : _props$options,
|
|
28
|
+
classNames = props.classNames,
|
|
29
|
+
stylesFromProps = props.styles,
|
|
30
|
+
_props$size = props.size,
|
|
31
|
+
size = _props$size === void 0 ? 'middle' : _props$size,
|
|
32
|
+
optionRender = props.optionRender,
|
|
33
|
+
otherProps = _objectWithoutProperties(props, _excluded);
|
|
34
|
+
var isImg = useMemo(function () {
|
|
35
|
+
return options.some(function (o) {
|
|
36
|
+
return !!o.img || !!o.icon;
|
|
37
|
+
});
|
|
38
|
+
}, [options]);
|
|
39
|
+
var _useStyles = useStyles({
|
|
40
|
+
disabled: disabled,
|
|
41
|
+
size: size
|
|
42
|
+
}),
|
|
43
|
+
cx = _useStyles.cx,
|
|
44
|
+
styles = _useStyles.styles;
|
|
45
|
+
var _useMemo = useMemo(function () {
|
|
46
|
+
return getNumberBySize(size);
|
|
47
|
+
}, [size]),
|
|
48
|
+
imgHeight = _useMemo.imgHeight;
|
|
49
|
+
var formatValue = useCallback(function (v) {
|
|
50
|
+
if (!multiple) {
|
|
51
|
+
return v;
|
|
52
|
+
}
|
|
53
|
+
if (Array.isArray(v)) {
|
|
54
|
+
return v;
|
|
55
|
+
}
|
|
56
|
+
return v === undefined ? [] : [v];
|
|
57
|
+
}, [multiple]);
|
|
58
|
+
var _useMergedState = useMergedState(formatValue(defaultValue), {
|
|
59
|
+
defaultValue: formatValue(defaultValue),
|
|
60
|
+
value: value,
|
|
61
|
+
onChange: onChange
|
|
62
|
+
}),
|
|
63
|
+
_useMergedState2 = _slicedToArray(_useMergedState, 2),
|
|
64
|
+
currentValue = _useMergedState2[0],
|
|
65
|
+
setCurrentValue = _useMergedState2[1];
|
|
66
|
+
var onSelect = useCallback(function (v) {
|
|
67
|
+
if (disabled) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (!multiple) {
|
|
71
|
+
setCurrentValue(v);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (currentValue.includes(v)) {
|
|
75
|
+
setCurrentValue(currentValue.filter(function (cv) {
|
|
76
|
+
return cv !== v;
|
|
77
|
+
}));
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
setCurrentValue([].concat(_toConsumableArray(currentValue), [v]));
|
|
81
|
+
}, [currentValue, disabled, multiple, setCurrentValue]);
|
|
82
|
+
var isSelected = useCallback(function (v) {
|
|
83
|
+
return multiple ? currentValue.includes(v) : currentValue === v;
|
|
84
|
+
}, [currentValue, multiple]);
|
|
85
|
+
var renderOption = useCallback(function (o, index) {
|
|
86
|
+
var selected = isSelected(o.value);
|
|
87
|
+
var Option = /*#__PURE__*/_jsxs(Flex, {
|
|
88
|
+
align: isImg ? 'center' : 'flex-start',
|
|
89
|
+
className: cx(styles.option, selected && styles.optionSelected, classNames === null || classNames === void 0 ? void 0 : classNames.card),
|
|
90
|
+
gap: "small",
|
|
91
|
+
onClick: function onClick() {
|
|
92
|
+
return onSelect(o.value);
|
|
93
|
+
},
|
|
94
|
+
style: _objectSpread(_objectSpread({}, stylesFromProps === null || stylesFromProps === void 0 ? void 0 : stylesFromProps.card), o.style),
|
|
95
|
+
vertical: true,
|
|
96
|
+
children: [isImg && /*#__PURE__*/_jsx(Avatar, {
|
|
97
|
+
className: classNames === null || classNames === void 0 ? void 0 : classNames.icon,
|
|
98
|
+
icon: o.icon,
|
|
99
|
+
shape: "square",
|
|
100
|
+
size: imgHeight,
|
|
101
|
+
src: o.img,
|
|
102
|
+
style: _objectSpread(_objectSpread({}, stylesFromProps === null || stylesFromProps === void 0 ? void 0 : stylesFromProps.icon), o.iconStyle)
|
|
103
|
+
}), o.label && selected && /*#__PURE__*/_jsx(Text, {
|
|
104
|
+
ellipsis: true,
|
|
105
|
+
strong: true,
|
|
106
|
+
children: o.label
|
|
107
|
+
}), o.label && !selected && /*#__PURE__*/_jsx(Text, {
|
|
108
|
+
ellipsis: true,
|
|
109
|
+
children: o.label
|
|
110
|
+
}), !isImg && o.description && /*#__PURE__*/_jsx(Paragraph, {
|
|
111
|
+
ellipsis: {
|
|
112
|
+
rows: 2
|
|
113
|
+
},
|
|
114
|
+
type: "secondary",
|
|
115
|
+
children: o.description
|
|
116
|
+
}), selected && /*#__PURE__*/_jsx(Icon, {
|
|
117
|
+
className: styles.check,
|
|
118
|
+
icon: Check
|
|
119
|
+
})]
|
|
120
|
+
}, o.value);
|
|
121
|
+
return optionRender ? optionRender(Option, o, index) : Option;
|
|
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]);
|
|
123
|
+
return /*#__PURE__*/_jsx(Flex, _objectSpread(_objectSpread({
|
|
124
|
+
gap: "large",
|
|
125
|
+
ref: ref,
|
|
126
|
+
wrap: true
|
|
127
|
+
}, otherProps), {}, {
|
|
128
|
+
children: options.map(function (o, index) {
|
|
129
|
+
return renderOption(o, index);
|
|
130
|
+
})
|
|
131
|
+
}));
|
|
132
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SelectCardProps } from '.';
|
|
2
|
+
export declare const getNumberBySize: (size: SelectCardProps['size']) => {
|
|
3
|
+
cardWidth: number;
|
|
4
|
+
imgHeight: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const useStyles: (props?: Pick<SelectCardProps, "disabled" | "size"> | undefined) => import("antd-style").ReturnStyles<{
|
|
7
|
+
option: import("antd-style").SerializedStyles;
|
|
8
|
+
optionSelected: import("antd-style").SerializedStyles;
|
|
9
|
+
check: import("antd-style").SerializedStyles;
|
|
10
|
+
}>;
|