@yuntijs/ui 1.0.0-beta.62 → 1.0.0-beta.64
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/Highlighter/index.d.ts +5 -0
- package/es/Highlighter/index.js +3 -2
- package/es/Highlighter/style.d.ts +1 -0
- package/es/Highlighter/style.js +5 -4
- package/es/LogViewer/index.js +10 -4
- package/es/LogViewer/style.d.ts +2 -1
- package/es/LogViewer/style.js +4 -3
- package/es/SelectCard/index.d.ts +30 -0
- package/es/SelectCard/index.js +126 -0
- package/es/SelectCard/style.d.ts +10 -0
- package/es/SelectCard/style.js +42 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/package.json +2 -1
- package/umd/index.min.js +1 -1
- package/umd/index.min.js.map +1 -1
|
@@ -39,6 +39,11 @@ export interface HighlighterProps extends DivProps {
|
|
|
39
39
|
* @description The style of the code content
|
|
40
40
|
*/
|
|
41
41
|
contentStyle?: React.CSSProperties;
|
|
42
|
+
/**
|
|
43
|
+
* @description Control text wrap
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
46
|
+
wrap?: boolean;
|
|
42
47
|
}
|
|
43
48
|
export declare const Highlighter: React.NamedExoticComponent<HighlighterProps>;
|
|
44
49
|
export * from './FullFeatured';
|
package/es/Highlighter/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["fullFeatured", "copyButtonSize", "children", "language", "className", "style", "copyable", "showLanguage", "type", "spotlight", "allowChangeLanguage", "fileName", "icon", "contentStyle"];
|
|
5
|
+
var _excluded = ["fullFeatured", "copyButtonSize", "children", "language", "className", "style", "copyable", "showLanguage", "type", "spotlight", "allowChangeLanguage", "fileName", "icon", "contentStyle", "wrap"];
|
|
6
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
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
8
|
import { CopyButton, Spotlight, Tag } from '@lobehub/ui';
|
|
@@ -31,11 +31,12 @@ export var Highlighter = /*#__PURE__*/memo(function (_ref) {
|
|
|
31
31
|
fileName = _ref.fileName,
|
|
32
32
|
icon = _ref.icon,
|
|
33
33
|
contentStyle = _ref.contentStyle,
|
|
34
|
+
wrap = _ref.wrap,
|
|
34
35
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
35
36
|
var _useStyles = useStyles(type),
|
|
36
37
|
styles = _useStyles.styles,
|
|
37
38
|
cx = _useStyles.cx;
|
|
38
|
-
var container = cx(styles.container, className);
|
|
39
|
+
var container = cx(styles.container, !wrap && styles.nowrap, className);
|
|
39
40
|
if (fullFeatured) return /*#__PURE__*/_jsx(FullFeaturedHighlighter, _objectSpread(_objectSpread({
|
|
40
41
|
allowChangeLanguage: allowChangeLanguage,
|
|
41
42
|
className: className,
|
|
@@ -3,6 +3,7 @@ export declare const useStyles: (props?: "ghost" | "block" | "pure" | undefined)
|
|
|
3
3
|
container: string;
|
|
4
4
|
header: import("antd-style").SerializedStyles;
|
|
5
5
|
lang: string;
|
|
6
|
+
nowrap: import("antd-style").SerializedStyles;
|
|
6
7
|
scroller: import("antd-style").SerializedStyles;
|
|
7
8
|
select: import("antd-style").SerializedStyles;
|
|
8
9
|
}>;
|
package/es/Highlighter/style.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
4
|
export var useStyles = createStyles(function (_ref, type) {
|
|
5
5
|
var token = _ref.token,
|
|
@@ -13,10 +13,11 @@ export var useStyles = createStyles(function (_ref, type) {
|
|
|
13
13
|
var typeStylish = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background-color: ", ";\n border: 1px solid ", ";\n\n &:hover {\n background-color: ", ";\n }\n "])), type === 'block' ? token.colorFillTertiary : 'transparent', type === 'block' ? 'transparent' : token.colorBorder, type === 'block' ? token.colorFillTertiary : token.colorFillQuaternary);
|
|
14
14
|
return {
|
|
15
15
|
button: cx(buttonHoverCls, css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 2;\n inset-block-start: ", ";\n inset-inline-end: ", ";\n\n opacity: 0;\n "])), type === 'pure' ? 0 : '12px', type === 'pure' ? 0 : '12px')),
|
|
16
|
-
container: cx(prefix, type !== 'pure' && typeStylish, css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n border-radius: ", "px;\n transition: background-color 100ms ", ";\n\n &:hover {\n .", " {\n opacity: 1;\n }\n\n .", " {\n opacity: 1;\n }\n }\n\n .prism-code {\n background: none !important;\n }\n\n pre {\n overflow: auto hidden;\n\n margin: 0 !important;\n padding: ", " !important;\n\n white-space: break-spaces;\n\n background: none !important;\n }\n\n code {\n
|
|
16
|
+
container: cx(prefix, type !== 'pure' && typeStylish, css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n border-radius: ", "px;\n transition: background-color 100ms ", ";\n\n &:hover {\n .", " {\n opacity: 1;\n }\n\n .", " {\n opacity: 1;\n }\n }\n\n .prism-code {\n background: none !important;\n }\n\n pre {\n overflow: auto hidden;\n\n margin: 0 !important;\n padding: ", " !important;\n\n white-space: break-spaces;\n\n background: none !important;\n }\n\n code {\n background: transparent !important;\n }\n "])), token.borderRadius, token.motionEaseOut, buttonHoverCls, langHoverCls, type === 'pure' ? 0 : "16px")),
|
|
17
17
|
header: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n padding-block: 4px;\n padding-inline: 8px;\n background: ", ";\n "])), token.colorFillQuaternary),
|
|
18
18
|
lang: cx(langHoverCls, stylish.blur, css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 2;\n inset-block-end: 12px;\n inset-inline-end: 4px;\n\n font-family: ", ";\n color: ", ";\n\n opacity: 0;\n\n transition: opacity 0.1s;\n "])), token.fontFamilyCode, token.colorTextSecondary)),
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
nowrap: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n code {\n text-wrap: nowrap !important;\n }\n "]))),
|
|
20
|
+
scroller: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n overflow: auto;\n width: 100%;\n height: 100%;\n "]))),
|
|
21
|
+
select: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n user-select: none;\n font-size: 14px;\n color: ", ";\n .", "-select-selection-item {\n min-width: 100px;\n padding-inline-end: 0 !important;\n color: ", ";\n text-align: center;\n }\n "])), token.colorTextDescription, prefixCls, token.colorTextDescription)
|
|
21
22
|
};
|
|
22
23
|
});
|
package/es/LogViewer/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import { ArrowDown, ArrowUp, LoaderCircle, TextSearch } from 'lucide-react';
|
|
|
10
10
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
11
11
|
import { useStyles } from "./style";
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
15
|
export var LogViewer = function LogViewer(_ref) {
|
|
15
16
|
var className = _ref.className,
|
|
@@ -106,10 +107,15 @@ export var LogViewer = function LogViewer(_ref) {
|
|
|
106
107
|
}));
|
|
107
108
|
},
|
|
108
109
|
startFollowing: true
|
|
109
|
-
}), loading && /*#__PURE__*/
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
}), loading && /*#__PURE__*/_jsxs(_Fragment, {
|
|
111
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
112
|
+
className: styles.loaderText,
|
|
113
|
+
children: "loading ..."
|
|
114
|
+
}), /*#__PURE__*/_jsx(Icon, {
|
|
115
|
+
className: styles.loaderIcon,
|
|
116
|
+
icon: LoaderCircle,
|
|
117
|
+
spin: true
|
|
118
|
+
})]
|
|
113
119
|
})]
|
|
114
120
|
});
|
|
115
121
|
};
|
package/es/LogViewer/style.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
|
|
2
2
|
root: import("antd-style").SerializedStyles;
|
|
3
3
|
searchBarIcon: import("antd-style").SerializedStyles;
|
|
4
|
-
|
|
4
|
+
loaderText: import("antd-style").SerializedStyles;
|
|
5
|
+
loaderIcon: import("antd-style").SerializedStyles;
|
|
5
6
|
}>;
|
package/es/LogViewer/style.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
4
|
export var useStyles = createStyles(function (_ref) {
|
|
5
5
|
var css = _ref.css,
|
|
6
6
|
token = _ref.token;
|
|
7
7
|
var bgColor = '#222222';
|
|
8
8
|
return {
|
|
9
|
-
root: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n background-color: ", ";\n border-radius: ", "px;\n\n .react-lazylog-searchbar {\n margin-bottom: ", "px;\n padding: ", "px;\n\n background-color: ", ";\n border-bottom: 1px solid #2d2d2d;\n border-top-left-radius: ", "px;\n border-top-right-radius: ", "px;\n & > input {\n border-radius: ", "px;\n }\n & > button {\n cursor: pointer;\n padding: 2px 6px;\n border-radius: ", "px;\n }\n &-up-arrow {\n margin-right: 0;\n }\n }\n .react-lazylog {\n scrollbar-color: rgba(255, 255, 255, 0.2) transparent;\n scrollbar-width: auto;\n background-color: ", ";\n border-radius: ", "px;\n\n .log-number {\n margin-right: 0;\n }\n .log-content {\n margin-left: 15px;\n }\n }\n "])), bgColor, token.borderRadiusLG, token.marginXXS, token.paddingXS, bgColor, token.borderRadiusLG, token.borderRadiusLG, token.borderRadius, token.borderRadius, bgColor, token.borderRadiusLG),
|
|
9
|
+
root: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n background-color: ", ";\n border-radius: ", "px;\n\n .react-lazylog-searchbar {\n margin-bottom: ", "px;\n padding: ", "px;\n\n background-color: ", ";\n border-bottom: 1px solid #2d2d2d;\n border-top-left-radius: ", "px;\n border-top-right-radius: ", "px;\n & > input {\n border-radius: ", "px;\n }\n & > button {\n cursor: pointer;\n padding: 2px 6px;\n border-radius: ", "px;\n }\n &-up-arrow {\n margin-right: 0;\n }\n }\n .react-lazylog {\n scrollbar-color: rgba(255, 255, 255, 0.2) transparent;\n scrollbar-width: auto;\n background-color: ", ";\n border-radius: ", "px;\n\n .log-number {\n margin-right: 0;\n }\n .log-content {\n margin-left: 15px;\n font-family: ", ";\n }\n }\n "])), bgColor, token.borderRadiusLG, token.marginXXS, token.paddingXS, bgColor, token.borderRadiusLG, token.borderRadiusLG, token.borderRadius, token.borderRadius, bgColor, token.borderRadiusLG, token.fontFamilyCode),
|
|
10
10
|
searchBarIcon: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n font-size: 16px;\n "]))),
|
|
11
|
-
|
|
11
|
+
loaderText: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: absolute;\n top: 44px;\n left: 15px;\n\n font-family: ", ";\n font-size: 12px;\n color: #fff;\n "])), token.fontFamilyCode),
|
|
12
|
+
loaderIcon: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: absolute;\n right: ", "px;\n bottom: ", "px;\n\n font-size: 18px;\n color: #999;\n "])), token.marginSM, token.marginSM)
|
|
12
13
|
};
|
|
13
14
|
}, {
|
|
14
15
|
hashPriority: 'low'
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
className?: string;
|
|
7
|
+
value: RawValue;
|
|
8
|
+
img?: string;
|
|
9
|
+
label?: React.ReactNode;
|
|
10
|
+
description?: React.ReactNode;
|
|
11
|
+
[name: string]: any;
|
|
12
|
+
}
|
|
13
|
+
export interface SelectCardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'value' | 'defaultValue' | 'onChange'> {
|
|
14
|
+
defaultValue?: Value;
|
|
15
|
+
value?: Value;
|
|
16
|
+
onChange?: (value: Value) => void;
|
|
17
|
+
multiple?: boolean;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
options: SelectCardOption[];
|
|
20
|
+
size?: SelectProps['size'];
|
|
21
|
+
optionRender?: (Option: React.ReactNode, option: SelectCardOption, index: number) => React.ReactNode;
|
|
22
|
+
classNames?: {
|
|
23
|
+
card?: string;
|
|
24
|
+
};
|
|
25
|
+
styles?: {
|
|
26
|
+
card?: React.CSSProperties;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export declare const SelectCard: React.ForwardRefExoticComponent<SelectCardProps & React.RefAttributes<HTMLDivElement>>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,126 @@
|
|
|
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;
|
|
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, o.className),
|
|
90
|
+
gap: "small",
|
|
91
|
+
onClick: function onClick() {
|
|
92
|
+
return onSelect(o.value);
|
|
93
|
+
},
|
|
94
|
+
style: stylesFromProps === null || stylesFromProps === void 0 ? void 0 : stylesFromProps.card,
|
|
95
|
+
vertical: true,
|
|
96
|
+
children: [isImg && /*#__PURE__*/_jsx(Avatar, {
|
|
97
|
+
shape: "square",
|
|
98
|
+
size: imgHeight,
|
|
99
|
+
src: o.img
|
|
100
|
+
}), o.label && /*#__PURE__*/_jsx(Text, {
|
|
101
|
+
ellipsis: true,
|
|
102
|
+
strong: true,
|
|
103
|
+
children: o.label
|
|
104
|
+
}), !isImg && o.description && /*#__PURE__*/_jsx(Paragraph, {
|
|
105
|
+
ellipsis: {
|
|
106
|
+
rows: 2
|
|
107
|
+
},
|
|
108
|
+
type: "secondary",
|
|
109
|
+
children: o.description
|
|
110
|
+
}), multiple && selected && /*#__PURE__*/_jsx(Icon, {
|
|
111
|
+
className: styles.check,
|
|
112
|
+
icon: Check
|
|
113
|
+
})]
|
|
114
|
+
}, o.value);
|
|
115
|
+
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]);
|
|
117
|
+
return /*#__PURE__*/_jsx(Flex, _objectSpread(_objectSpread({
|
|
118
|
+
gap: "large",
|
|
119
|
+
ref: ref,
|
|
120
|
+
wrap: true
|
|
121
|
+
}, otherProps), {}, {
|
|
122
|
+
children: options.map(function (o, index) {
|
|
123
|
+
return renderOption(o, index);
|
|
124
|
+
})
|
|
125
|
+
}));
|
|
126
|
+
});
|
|
@@ -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, "size" | "disabled"> | undefined) => import("antd-style").ReturnStyles<{
|
|
7
|
+
option: import("antd-style").SerializedStyles;
|
|
8
|
+
optionSelected: import("antd-style").SerializedStyles;
|
|
9
|
+
check: import("antd-style").SerializedStyles;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,42 @@
|
|
|
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 getNumberBySize = function getNumberBySize(size) {
|
|
5
|
+
switch (size) {
|
|
6
|
+
case 'small':
|
|
7
|
+
{
|
|
8
|
+
return {
|
|
9
|
+
cardWidth: 144,
|
|
10
|
+
imgHeight: 32
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
case 'large':
|
|
14
|
+
{
|
|
15
|
+
return {
|
|
16
|
+
cardWidth: 200,
|
|
17
|
+
imgHeight: 64
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
default:
|
|
21
|
+
{
|
|
22
|
+
return {
|
|
23
|
+
cardWidth: 168,
|
|
24
|
+
imgHeight: 40
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
export var useStyles = createStyles(function (_ref, _ref2) {
|
|
30
|
+
var css = _ref.css,
|
|
31
|
+
token = _ref.token,
|
|
32
|
+
prefixCls = _ref.prefixCls;
|
|
33
|
+
var disabled = _ref2.disabled,
|
|
34
|
+
size = _ref2.size;
|
|
35
|
+
var _getNumberBySize = getNumberBySize(size),
|
|
36
|
+
cardWidth = _getNumberBySize.cardWidth;
|
|
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),
|
|
39
|
+
optionSelected: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n border-color: ", ";\n &:hover {\n border-color: ", ";\n }\n "])), token.colorPrimary, token.colorPrimaryActive),
|
|
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
|
+
};
|
|
42
|
+
});
|
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yuntijs/ui",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.64",
|
|
4
4
|
"description": "☁️ Yunti UI - an open-source UI component library for building Cloud Native web apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"yuntijs",
|
|
@@ -95,6 +95,7 @@
|
|
|
95
95
|
"lodash-es": "^4",
|
|
96
96
|
"lucide-react": "latest",
|
|
97
97
|
"query-string": "^8",
|
|
98
|
+
"rc-util": "^5.43.0",
|
|
98
99
|
"react-draggable": "^4.4.6",
|
|
99
100
|
"react-error-boundary": "^4",
|
|
100
101
|
"react-layout-kit": "^1",
|