@digitalc/dxp-ui 0.0.5-alpha.10 → 0.0.5-alpha.12
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/README.md +1 -1
- package/es/assets/token.json +4 -1
- package/es/components/Amount/index.d.ts +1 -0
- package/es/components/Amount/index.js +4 -2
- package/es/components/Button/index.d.ts +14 -18
- package/es/components/Button/index.js +82 -36
- package/es/components/Icon/index.d.ts +1 -1
- package/es/components/Image/index.d.ts +2 -0
- package/es/components/Image/index.js +11 -2
- package/es/components/ListItem/designTokens.d.ts +30 -0
- package/es/components/ListItem/designTokens.js +31 -0
- package/es/components/ListItem/index.d.ts +60 -0
- package/es/components/ListItem/index.js +227 -0
- package/es/components/ListItem/style/index.less +77 -0
- package/es/components/ListItem/style/variables.less +1 -0
- package/es/components/Navigation/index.d.ts +1 -0
- package/es/components/Navigation/index.js +8 -4
- package/es/components/Navigation/style/index.less +7 -0
- package/es/components/StickyFooter/index.d.ts +3 -0
- package/es/components/StickyFooter/index.js +7 -1
- package/es/components/Tabs/index.js +1 -1
- package/es/components/Text/designTokens.d.ts +6 -0
- package/es/components/Text/designTokens.js +7 -1
- package/es/components/Text/index.js +14 -2
- package/es/components/TextLink/index.d.ts +1 -1
- package/es/components/index.d.ts +3 -0
- package/es/components/index.js +4 -1
- package/es/fonts/SF/SF-Pro-Display-BlackItalic.otf +0 -0
- package/es/fonts/SF/SF-Pro-Text-Bold.otf +0 -0
- package/es/fonts/SF/SF-Pro-Text-Medium.eot +0 -0
- package/es/fonts/SF/SF-Pro-Text-Medium.otf +0 -0
- package/es/fonts/SF/SF-Pro-Text-Medium.svg +40549 -0
- package/es/fonts/SF/SF-Pro-Text-Medium.ttf +0 -0
- package/es/fonts/SF/SF-Pro-Text-Medium.woff +0 -0
- package/es/fonts/SF/SF-Pro-Text-Medium.woff2 +0 -0
- package/es/fonts/SF/SF-Pro-Text-Regular.otf +0 -0
- package/es/fonts/SF/SF-Pro-Text-Regular.ttf +0 -0
- package/es/fonts/SF/SF-Pro-Text-Semibold.otf +0 -0
- package/es/fonts/SF/SF-Pro-Text-SemiboldItalic.otf +0 -0
- package/es/style/variables.less +53 -27
- package/es/tokens/DXPGlobal.d.ts +1 -1
- package/es/tokens/DXPGlobal.js +3 -2
- package/es/utils/tokenManager.d.ts +12 -0
- package/es/utils/tokenManager.js +11 -5
- package/lib/assets/token.json +4 -1
- package/lib/components/Amount/index.d.ts +1 -0
- package/lib/components/Amount/index.js +5 -3
- package/lib/components/Button/demo/index.d.ts +3 -0
- package/lib/components/Button/demo/index.js +138 -0
- package/lib/components/Button/index.d.ts +14 -18
- package/lib/components/Button/index.js +46 -15
- package/lib/components/Icon/index.d.ts +1 -1
- package/lib/components/Image/index.d.ts +2 -0
- package/lib/components/Image/index.js +23 -3
- package/lib/components/ListItem/designTokens.d.ts +30 -0
- package/lib/components/ListItem/designTokens.js +65 -0
- package/lib/components/ListItem/index.d.ts +60 -0
- package/lib/components/ListItem/index.js +348 -0
- package/lib/components/ListItem/style/index.less +77 -0
- package/lib/components/ListItem/style/variables.less +1 -0
- package/lib/components/Navigation/index.d.ts +1 -0
- package/lib/components/Navigation/index.js +18 -5
- package/lib/components/Navigation/style/index.less +7 -0
- package/lib/components/StickyFooter/index.d.ts +3 -0
- package/lib/components/StickyFooter/index.js +12 -5
- package/lib/components/Tabs/index.js +1 -1
- package/lib/components/Text/designTokens.d.ts +6 -0
- package/lib/components/Text/designTokens.js +7 -1
- package/lib/components/Text/index.js +52 -37
- package/lib/components/TextLink/index.d.ts +1 -1
- package/lib/components/index.d.ts +3 -0
- package/lib/components/index.js +7 -0
- package/lib/fonts/SF/SF-Pro-Display-BlackItalic.otf +0 -0
- package/lib/fonts/SF/SF-Pro-Text-Bold.otf +0 -0
- package/lib/fonts/SF/SF-Pro-Text-Medium.eot +0 -0
- package/lib/fonts/SF/SF-Pro-Text-Medium.otf +0 -0
- package/lib/fonts/SF/SF-Pro-Text-Medium.svg +40549 -0
- package/lib/fonts/SF/SF-Pro-Text-Medium.ttf +0 -0
- package/lib/fonts/SF/SF-Pro-Text-Medium.woff +0 -0
- package/lib/fonts/SF/SF-Pro-Text-Medium.woff2 +0 -0
- package/lib/fonts/SF/SF-Pro-Text-Regular.otf +0 -0
- package/lib/fonts/SF/SF-Pro-Text-Regular.ttf +0 -0
- package/lib/fonts/SF/SF-Pro-Text-Semibold.otf +0 -0
- package/lib/fonts/SF/SF-Pro-Text-SemiboldItalic.otf +0 -0
- package/lib/style/variables.less +53 -27
- package/lib/tokens/DXPGlobal.d.ts +1 -1
- package/lib/tokens/DXPGlobal.js +1 -1
- package/lib/utils/tokenManager.d.ts +12 -0
- package/lib/utils/tokenManager.js +9 -3
- package/package.json +2 -2
- package/umd/dxp-ui.min.css +1 -1
- package/umd/dxp-ui.min.js +1 -1
- package/umd/static/SF-Pro-Text-Bold.89d66db4.otf +0 -0
- package/umd/static/SF-Pro-Text-Regular.e042d171.ttf +0 -0
- package/umd/static/SF-Pro-Text-Regular.f09e811b.otf +0 -0
- package/umd/static/SF-Pro-Text-Semibold.a5a4b4bc.otf +0 -0
- package/umd/static/SF-Pro-Text-SemiboldItalic.ed8f4a28.otf +0 -0
package/README.md
CHANGED
|
@@ -146,7 +146,7 @@ import { Button, IconButton, IconButtonGroup, Toast, Stepper } from '@digitalc/d
|
|
|
146
146
|
|
|
147
147
|
原因是使用的 Umi4、Vite 5 和 Turbopack 将原生支持智能样式编译的(:内置各种语言预处理工具),可以直接引用即可。
|
|
148
148
|
|
|
149
|
-
但如果是使用的 webpack 或 umi3 脚手架的前端项目,需要在内部的 webpack 配置less编译。(因为包是esm
|
|
149
|
+
但如果是使用的 webpack 或 umi3 脚手架的前端项目,需要在内部的 webpack 配置less编译。(因为包是esm格式,并支持了按需加载, 基于 ES modules 的 tree shaking,未编译less文件),具体是通过 webpack-chain 添加指定的包,并进行构建。
|
|
150
150
|
|
|
151
151
|
```bash
|
|
152
152
|
chainWebpack(memo, { webpack, env }) {
|
package/es/assets/token.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"gomo": {
|
|
3
|
+
"colorGradientNeutral": "linear-gradient(180deg, rgba(0, 0, 0, 0.80) 0%, rgba(0, 0, 0, 0.00) 100%)",
|
|
3
4
|
"spacingGapXs": 4,
|
|
4
5
|
"spacingGapSm": 8,
|
|
5
6
|
"spacingGapLg": 24,
|
|
@@ -300,6 +301,7 @@
|
|
|
300
301
|
"colorTextCta2": "#4d28e8"
|
|
301
302
|
},
|
|
302
303
|
"eSales": {
|
|
304
|
+
"colorGradientNeutral": "linear-gradient(180deg, rgba(0, 0, 0, 0.80) 0%, rgba(0, 0, 0, 0.00) 100%)",
|
|
303
305
|
"spacingGapXs": 4,
|
|
304
306
|
"spacingGapSm": 8,
|
|
305
307
|
"spacingGapLg": 24,
|
|
@@ -599,6 +601,7 @@
|
|
|
599
601
|
"colorTextCta2": "#180c8e"
|
|
600
602
|
},
|
|
601
603
|
"tm": {
|
|
604
|
+
"colorGradientNeutral": "linear-gradient(180deg, rgba(0, 0, 0, 0.80) 0%, rgba(0, 0, 0, 0.00) 100%)",
|
|
602
605
|
"spacingGapXs": 4,
|
|
603
606
|
"spacingGapSm": 8,
|
|
604
607
|
"spacingGapLg": 24,
|
|
@@ -897,4 +900,4 @@
|
|
|
897
900
|
"colorIconCta2": "#ff5e00",
|
|
898
901
|
"colorTextCta2": "#ff5e00"
|
|
899
902
|
}
|
|
900
|
-
}
|
|
903
|
+
}
|
|
@@ -9,6 +9,7 @@ export interface AmountProps {
|
|
|
9
9
|
position?: Position;
|
|
10
10
|
style?: React.CSSProperties;
|
|
11
11
|
onClick?: React.MouseEventHandler;
|
|
12
|
+
onDropDownClick?: React.MouseEventHandler;
|
|
12
13
|
[key: string]: any;
|
|
13
14
|
}
|
|
14
15
|
export default class Amount extends PureComponent<AmountProps> {
|
|
@@ -5,7 +5,7 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
|
5
5
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
6
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
-
var _excluded = ["children", "className", "size", "title", "position", "prefixCls", "priceStrikethrough", "style", "priceColor", "textColor", "colorStrikethrough"];
|
|
8
|
+
var _excluded = ["children", "className", "size", "title", "position", "prefixCls", "priceStrikethrough", "style", "priceColor", "textColor", "colorStrikethrough", "onDropDownClick"];
|
|
9
9
|
import React, { PureComponent } from 'react';
|
|
10
10
|
import { default as classNames } from 'classnames';
|
|
11
11
|
import { designTokens } from "./designTokens";
|
|
@@ -35,6 +35,7 @@ var Amount = /*#__PURE__*/function (_PureComponent) {
|
|
|
35
35
|
priceColor = _this$props.priceColor,
|
|
36
36
|
textColor = _this$props.textColor,
|
|
37
37
|
colorStrikethrough = _this$props.colorStrikethrough,
|
|
38
|
+
onDropDownClick = _this$props.onDropDownClick,
|
|
38
39
|
attr = _objectWithoutProperties(_this$props, _excluded);
|
|
39
40
|
var colorCardTextPrice = designTokens.colorCardTextPrice,
|
|
40
41
|
colorCardTextPriceStrikethrough = designTokens.colorCardTextPriceStrikethrough,
|
|
@@ -72,7 +73,8 @@ var Amount = /*#__PURE__*/function (_PureComponent) {
|
|
|
72
73
|
},
|
|
73
74
|
children: [title, /*#__PURE__*/_jsx(Icon, {
|
|
74
75
|
size: 12,
|
|
75
|
-
name: "icon-a-Arrow-Down"
|
|
76
|
+
name: "icon-a-Arrow-Down",
|
|
77
|
+
onClick: onDropDownClick
|
|
76
78
|
})]
|
|
77
79
|
})
|
|
78
80
|
});
|
|
@@ -1,11 +1,20 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import type { TextProps } from "../Text";
|
|
3
|
-
import { noop } from '../../utils/noop';
|
|
4
3
|
import './style/index.less';
|
|
5
4
|
export type HtmlType = 'button' | 'reset' | 'submit';
|
|
6
5
|
export type Size = 'middle' | 'small' | 'large';
|
|
7
6
|
export type ButtonType = 'primary' | 'default' | 'dashed' | 'link' | 'text';
|
|
8
7
|
export type ButtonColorType = 'default' | 'primary' | 'danger' | 'blue' | 'purple' | 'cyan' | 'green' | 'magenta' | 'pink' | 'red' | 'orange' | 'yellow' | 'volcano' | 'geekblue' | 'lime' | 'gold';
|
|
8
|
+
export interface ButtonThemeConfig {
|
|
9
|
+
token?: Record<string, any>;
|
|
10
|
+
components?: {
|
|
11
|
+
Button?: Record<string, any>;
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
};
|
|
14
|
+
cssVar?: boolean;
|
|
15
|
+
hashed?: boolean;
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}
|
|
9
18
|
export interface xDXpProps {
|
|
10
19
|
'x-dxp-prop'?: string;
|
|
11
20
|
}
|
|
@@ -20,24 +29,11 @@ export interface ButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonE
|
|
|
20
29
|
disabled?: boolean;
|
|
21
30
|
block?: boolean;
|
|
22
31
|
style?: React.CSSProperties;
|
|
23
|
-
theme?: string;
|
|
32
|
+
theme?: string | ButtonThemeConfig;
|
|
24
33
|
prefixCls?: string;
|
|
25
34
|
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
26
35
|
contentClassName?: string;
|
|
27
36
|
[key: string]: any;
|
|
28
37
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
disabled: boolean;
|
|
32
|
-
size: string;
|
|
33
|
-
type: string;
|
|
34
|
-
theme: string;
|
|
35
|
-
htmlType: string;
|
|
36
|
-
onMouseDown: typeof noop;
|
|
37
|
-
onClick: typeof noop;
|
|
38
|
-
onMouseEnter: typeof noop;
|
|
39
|
-
onMouseLeave: typeof noop;
|
|
40
|
-
prefixCls: string;
|
|
41
|
-
};
|
|
42
|
-
render(): React.JSX.Element;
|
|
43
|
-
}
|
|
38
|
+
declare const ButtonWithContext: React.FC<ButtonProps>;
|
|
39
|
+
export default ButtonWithContext;
|
|
@@ -2,6 +2,7 @@ import "antd/es/config-provider/style";
|
|
|
2
2
|
import _ConfigProvider from "antd/es/config-provider";
|
|
3
3
|
import "antd/es/button/style";
|
|
4
4
|
import _Button from "antd/es/button";
|
|
5
|
+
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
5
6
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
6
7
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
7
8
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
@@ -9,7 +10,7 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
|
9
10
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
10
11
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
11
12
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
12
|
-
var _excluded = ["fontSize", "theme", "inverse"];
|
|
13
|
+
var _excluded = ["fontSize", "theme", "inverse", "parentTheme"];
|
|
13
14
|
import React, { PureComponent } from 'react';
|
|
14
15
|
import Text from "../Text";
|
|
15
16
|
import { cssClasses } from "../../constants";
|
|
@@ -22,56 +23,91 @@ import "./style/index.less";
|
|
|
22
23
|
// const { htmlTypes, btnTypes, sizes } = strings;
|
|
23
24
|
|
|
24
25
|
// export type Theme = 'solid' | 'borderless' | 'light' | 'outline';
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
|
|
27
|
+
// 复用antd的Theme配置接口
|
|
28
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
29
|
+
// 实际的 Button 组件实现
|
|
30
|
+
var ButtonComponent = /*#__PURE__*/function (_PureComponent) {
|
|
31
|
+
_inherits(ButtonComponent, _PureComponent);
|
|
32
|
+
var _super = _createSuper(ButtonComponent);
|
|
33
|
+
function ButtonComponent() {
|
|
34
|
+
_classCallCheck(this, ButtonComponent);
|
|
31
35
|
return _super.apply(this, arguments);
|
|
32
36
|
}
|
|
33
|
-
_createClass(
|
|
37
|
+
_createClass(ButtonComponent, [{
|
|
34
38
|
key: "render",
|
|
35
39
|
value: function render() {
|
|
36
40
|
var _this$props = this.props,
|
|
37
41
|
children = _this$props.children,
|
|
38
42
|
inverse = _this$props.inverse,
|
|
39
|
-
fontSize = _this$props.fontSize
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
fontSize = _this$props.fontSize,
|
|
44
|
+
theme = _this$props.theme,
|
|
45
|
+
parentTheme = _this$props.parentTheme;
|
|
42
46
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
43
47
|
var _this$props2 = this.props,
|
|
44
48
|
_ = _this$props2.fontSize,
|
|
45
49
|
__ = _this$props2.theme,
|
|
46
50
|
___ = _this$props2.inverse,
|
|
51
|
+
____ = _this$props2.parentTheme,
|
|
47
52
|
filteredProps = _objectWithoutProperties(_this$props2, _excluded);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
53
|
+
|
|
54
|
+
// 获取基础token
|
|
55
|
+
var baseTokens = inverse ? inverseDesignTokens : designTokens;
|
|
56
|
+
|
|
57
|
+
// 处理theme属性 - 如果是对象格式,则按antd的Theme配置处理
|
|
58
|
+
var themeConfig = {
|
|
59
|
+
components: {
|
|
60
|
+
Button: baseTokens
|
|
61
|
+
},
|
|
62
|
+
token: {},
|
|
63
|
+
cssVar: true,
|
|
64
|
+
hashed: false
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// 如果有父级配置,则与基础token合并
|
|
68
|
+
if (parentTheme) {
|
|
69
|
+
var _parentTheme$componen;
|
|
70
|
+
var parentButtonTokens = ((_parentTheme$componen = parentTheme.components) === null || _parentTheme$componen === void 0 ? void 0 : _parentTheme$componen.Button) || {};
|
|
71
|
+
var parentGlobalTokens = parentTheme.token || {};
|
|
72
|
+
themeConfig = _objectSpread(_objectSpread(_objectSpread({}, themeConfig), parentTheme), {}, {
|
|
73
|
+
token: _objectSpread(_objectSpread({}, themeConfig.token || {}), parentGlobalTokens),
|
|
74
|
+
components: _objectSpread(_objectSpread({}, parentTheme.components), {}, {
|
|
75
|
+
Button: _objectSpread(_objectSpread({}, baseTokens), parentButtonTokens)
|
|
76
|
+
})
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// 如果用户传入了自定义theme配置(对象),则合并处理
|
|
81
|
+
if (theme && _typeof(theme) === 'object') {
|
|
82
|
+
var _theme$components, _parentTheme$componen2;
|
|
83
|
+
// 获取用户自定义的Button token
|
|
84
|
+
var userButtonTokens = ((_theme$components = theme.components) === null || _theme$components === void 0 ? void 0 : _theme$components.Button) || {};
|
|
85
|
+
var userGlobalTokens = theme.token || {};
|
|
86
|
+
themeConfig = _objectSpread(_objectSpread(_objectSpread({}, themeConfig), theme), {}, {
|
|
87
|
+
token: _objectSpread(_objectSpread({}, themeConfig.token || {}), userGlobalTokens),
|
|
88
|
+
components: _objectSpread(_objectSpread(_objectSpread({}, themeConfig.components), theme.components), {}, {
|
|
89
|
+
Button: _objectSpread(_objectSpread(_objectSpread({}, baseTokens), (parentTheme === null || parentTheme === void 0 || (_parentTheme$componen2 = parentTheme.components) === null || _parentTheme$componen2 === void 0 ? void 0 : _parentTheme$componen2.Button) || {}), userButtonTokens)
|
|
90
|
+
})
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return /*#__PURE__*/_jsx(_ConfigProvider, {
|
|
94
|
+
wave: {
|
|
95
|
+
disabled: true
|
|
96
|
+
},
|
|
97
|
+
prefixCls: cssClasses.PREFIX,
|
|
98
|
+
theme: themeConfig,
|
|
99
|
+
children: /*#__PURE__*/_jsx(_Button, _objectSpread(_objectSpread({}, filteredProps), {}, {
|
|
100
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
101
|
+
size: fontSize,
|
|
102
|
+
children: children
|
|
103
|
+
})
|
|
104
|
+
}))
|
|
69
105
|
});
|
|
70
106
|
}
|
|
71
107
|
}]);
|
|
72
|
-
return
|
|
73
|
-
}(PureComponent);
|
|
74
|
-
_defineProperty(
|
|
108
|
+
return ButtonComponent;
|
|
109
|
+
}(PureComponent); // 包装器函数组件,用于获取 ConfigProvider 上下文
|
|
110
|
+
_defineProperty(ButtonComponent, "defaultProps", {
|
|
75
111
|
disabled: false,
|
|
76
112
|
size: 'large',
|
|
77
113
|
type: 'default',
|
|
@@ -83,4 +119,14 @@ _defineProperty(Button, "defaultProps", {
|
|
|
83
119
|
onMouseLeave: noop,
|
|
84
120
|
prefixCls: cssClasses.PREFIX + '-button'
|
|
85
121
|
});
|
|
86
|
-
|
|
122
|
+
var ButtonWithContext = function ButtonWithContext(props) {
|
|
123
|
+
// 使用 React 的 useContext 获取 ConfigProvider 上下文
|
|
124
|
+
var _React$useContext = React.useContext(_ConfigProvider.ConfigContext),
|
|
125
|
+
parentTheme = _React$useContext.theme;
|
|
126
|
+
return /*#__PURE__*/_jsx(ButtonComponent, _objectSpread(_objectSpread({}, props), {}, {
|
|
127
|
+
parentTheme: parentTheme
|
|
128
|
+
}));
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
// 导出包装后的组件
|
|
132
|
+
export default ButtonWithContext;
|
|
@@ -6,7 +6,7 @@ export interface IIconProps {
|
|
|
6
6
|
style?: React.CSSProperties;
|
|
7
7
|
inverse?: boolean;
|
|
8
8
|
className?: string;
|
|
9
|
-
onClick?: () => void;
|
|
9
|
+
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
10
10
|
}
|
|
11
11
|
declare const Icon: (props: IIconProps) => React.JSX.Element;
|
|
12
12
|
export default Icon;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export type backImageRadio = 1 | 2 | 0.68;
|
|
3
|
+
export declare const BackImageEunm: Record<string, backImageRadio>;
|
|
3
4
|
export interface IImageProps {
|
|
4
5
|
src?: string;
|
|
5
6
|
radio?: backImageRadio;
|
|
6
7
|
imageSize?: number | string;
|
|
7
8
|
style?: React.CSSProperties;
|
|
9
|
+
className?: string;
|
|
8
10
|
}
|
|
9
11
|
declare const Image: (props: IImageProps) => React.JSX.Element;
|
|
10
12
|
export default Image;
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["src", "style", "imageSize", "radio"];
|
|
3
|
+
var _excluded = ["src", "style", "imageSize", "radio", "className"];
|
|
4
4
|
import React from 'react';
|
|
5
|
+
import { default as classNames } from 'classnames';
|
|
6
|
+
import { cssClasses } from "../../constants";
|
|
5
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
export var BackImageEunm = {
|
|
9
|
+
whRadio1: 1,
|
|
10
|
+
whRadio2: 2,
|
|
11
|
+
whRadio3: 0.68
|
|
12
|
+
};
|
|
6
13
|
var Image = function Image(props) {
|
|
7
14
|
var src = props.src,
|
|
8
15
|
style = props.style,
|
|
9
16
|
imageSize = props.imageSize,
|
|
10
17
|
_props$radio = props.radio,
|
|
11
|
-
radio = _props$radio === void 0 ?
|
|
18
|
+
radio = _props$radio === void 0 ? BackImageEunm.whRadio2 : _props$radio,
|
|
19
|
+
className = props.className,
|
|
12
20
|
otherProps = _objectWithoutProperties(props, _excluded);
|
|
13
21
|
var mergedStyle = imageSize ? _objectSpread({
|
|
14
22
|
width: imageSize,
|
|
@@ -17,6 +25,7 @@ var Image = function Image(props) {
|
|
|
17
25
|
objectFit: 'cover'
|
|
18
26
|
}, style) : _objectSpread({}, style);
|
|
19
27
|
return /*#__PURE__*/_jsx("img", _objectSpread({
|
|
28
|
+
className: classNames("".concat(cssClasses.PREFIX, "-image}"), className),
|
|
20
29
|
src: src,
|
|
21
30
|
style: mergedStyle
|
|
22
31
|
}, otherProps));
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
declare const designTokens: {
|
|
2
|
+
sizingListItemIconImage: any;
|
|
3
|
+
sizingListItemIconIcon: any;
|
|
4
|
+
sizingListItemIconIconStatus: any;
|
|
5
|
+
sizingListItemImageImage: any;
|
|
6
|
+
sizingListItemImageIcon: any;
|
|
7
|
+
sizingListItemImageIconLg: any;
|
|
8
|
+
sizingListItemImageThumbnail: any;
|
|
9
|
+
sizingListItemIcon: any;
|
|
10
|
+
sizingListItemIconLg: any;
|
|
11
|
+
spacingListItemIconStatusPaddingRight: any;
|
|
12
|
+
spacingListItemIconPaddingLeft: any;
|
|
13
|
+
spacingListItemImagePaddingRight: any;
|
|
14
|
+
spacingListItemIconImagePaddingVertical: any;
|
|
15
|
+
spacingListItemIconImagePaddingHorizontal: any;
|
|
16
|
+
spacingListItemIconIconPaddingVertical: any;
|
|
17
|
+
spacingListItemIconIconPaddingHorizontal: any;
|
|
18
|
+
spacingListItemImageIconPaddingRight: any;
|
|
19
|
+
spacingListItemImagePointsPaddingTop: any;
|
|
20
|
+
colorListItemIconBackground: any;
|
|
21
|
+
colorListItemIconSubtle: any;
|
|
22
|
+
colorListItemIcon: any;
|
|
23
|
+
borderRadiusListItem: any;
|
|
24
|
+
colorListItemBackground: any;
|
|
25
|
+
spacingListItemTextPaddingHorizontal: any;
|
|
26
|
+
colorListItemTextTitle: any;
|
|
27
|
+
colorListItemTextSubtitle: any;
|
|
28
|
+
colorListItemTextPoints: any;
|
|
29
|
+
};
|
|
30
|
+
export default designTokens;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import TokenManager from "../../utils/tokenManager";
|
|
2
|
+
var designTokens = {
|
|
3
|
+
sizingListItemIconImage: TokenManager.tokenKey('sizingListItemIconImage'),
|
|
4
|
+
sizingListItemIconIcon: TokenManager.tokenKey('sizingListItemIconIcon'),
|
|
5
|
+
sizingListItemIconIconStatus: TokenManager.tokenKey('sizingListItemIconIconStatus'),
|
|
6
|
+
sizingListItemImageImage: TokenManager.tokenKey('sizingListItemImageImage'),
|
|
7
|
+
sizingListItemImageIcon: TokenManager.tokenKey('sizingListItemImageIcon'),
|
|
8
|
+
sizingListItemImageIconLg: TokenManager.tokenKey('sizingListItemImageIconLg'),
|
|
9
|
+
sizingListItemImageThumbnail: TokenManager.tokenKey('sizingListItemImageThumbnail'),
|
|
10
|
+
sizingListItemIcon: TokenManager.tokenKey('sizingListItemIcon'),
|
|
11
|
+
sizingListItemIconLg: TokenManager.tokenKey('sizingListItemIconLg'),
|
|
12
|
+
spacingListItemIconStatusPaddingRight: TokenManager.tokenKey('spacingListItemIconStatusPaddingRight'),
|
|
13
|
+
spacingListItemIconPaddingLeft: TokenManager.tokenKey('spacingListItemIconPaddingLeft'),
|
|
14
|
+
spacingListItemImagePaddingRight: TokenManager.tokenKey('spacingListItemImagePaddingRight'),
|
|
15
|
+
spacingListItemIconImagePaddingVertical: TokenManager.tokenKey('spacingListItemIconImagePaddingVertical'),
|
|
16
|
+
spacingListItemIconImagePaddingHorizontal: TokenManager.tokenKey('spacingListItemIconImagePaddingHorizontal'),
|
|
17
|
+
spacingListItemIconIconPaddingVertical: TokenManager.tokenKey('spacingListItemIconIconPaddingVertical'),
|
|
18
|
+
spacingListItemIconIconPaddingHorizontal: TokenManager.tokenKey('spacingListItemIconIconPaddingHorizontal'),
|
|
19
|
+
spacingListItemImageIconPaddingRight: TokenManager.tokenKey('spacingListItemImageIconPaddingRight'),
|
|
20
|
+
spacingListItemImagePointsPaddingTop: TokenManager.tokenKey('spacingListItemImagePointsPaddingTop'),
|
|
21
|
+
colorListItemIconBackground: TokenManager.tokenKey('colorListItemIconBackground'),
|
|
22
|
+
colorListItemIconSubtle: TokenManager.tokenKey('colorListItemIconSubtle'),
|
|
23
|
+
colorListItemIcon: TokenManager.tokenKey('colorListItemIcon'),
|
|
24
|
+
borderRadiusListItem: TokenManager.tokenKey('borderRadiusListItem'),
|
|
25
|
+
colorListItemBackground: TokenManager.tokenKey('colorListItemBackground'),
|
|
26
|
+
spacingListItemTextPaddingHorizontal: TokenManager.tokenKey('spacingListItemTextPaddingHorizontal'),
|
|
27
|
+
colorListItemTextTitle: TokenManager.tokenKey('colorListItemTextTitle'),
|
|
28
|
+
colorListItemTextSubtitle: TokenManager.tokenKey('colorListItemTextSubtitle'),
|
|
29
|
+
colorListItemTextPoints: TokenManager.tokenKey('colorListItemTextPoints')
|
|
30
|
+
};
|
|
31
|
+
export default designTokens;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './style/index.less';
|
|
3
|
+
export declare const ListItemTypes: {
|
|
4
|
+
readonly ListItemIcon: "ListItemIcon";
|
|
5
|
+
readonly ListItemImage: "ListItemImage";
|
|
6
|
+
readonly ListItemOther: "ListItemOther";
|
|
7
|
+
};
|
|
8
|
+
export declare const TAPPABLE_AREAS: {
|
|
9
|
+
readonly ALL: "ALL";
|
|
10
|
+
readonly EXPECT_IMAGE: "EXPECT_IMAGE";
|
|
11
|
+
};
|
|
12
|
+
export declare const ListItemRightTypes: {
|
|
13
|
+
readonly Toggle: "Toggle";
|
|
14
|
+
readonly Link: "Link";
|
|
15
|
+
readonly Status: "Status";
|
|
16
|
+
readonly Default: "Default";
|
|
17
|
+
};
|
|
18
|
+
export type ListItemType = typeof ListItemTypes[keyof typeof ListItemTypes];
|
|
19
|
+
export type ListItemRightType = typeof ListItemRightTypes[keyof typeof ListItemRightTypes];
|
|
20
|
+
export type TappableAreaType = typeof TAPPABLE_AREAS[keyof typeof TAPPABLE_AREAS];
|
|
21
|
+
export interface IIconConfig {
|
|
22
|
+
iconStyle: React.CSSProperties;
|
|
23
|
+
iconName: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ISubIconValueConfig {
|
|
26
|
+
value: string;
|
|
27
|
+
iconName: string;
|
|
28
|
+
}
|
|
29
|
+
export interface IListItemProps {
|
|
30
|
+
listType: ListItemType;
|
|
31
|
+
leftIcon?: IIconConfig;
|
|
32
|
+
leftImageSrc?: string;
|
|
33
|
+
title: string;
|
|
34
|
+
subTitle?: string;
|
|
35
|
+
listItemRightType?: ListItemRightType;
|
|
36
|
+
showToggle?: boolean;
|
|
37
|
+
toggleChecked?: boolean;
|
|
38
|
+
onToggleChange?: (checked: boolean, event: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement>) => void;
|
|
39
|
+
showLink?: boolean;
|
|
40
|
+
LinkName?: string;
|
|
41
|
+
onLinkClick?: () => void;
|
|
42
|
+
showStatus?: boolean;
|
|
43
|
+
statusIconName?: string;
|
|
44
|
+
statusIconColor?: string;
|
|
45
|
+
subTitleUp?: boolean;
|
|
46
|
+
tagName?: string;
|
|
47
|
+
showTag?: boolean;
|
|
48
|
+
subIconObj?: ISubIconValueConfig;
|
|
49
|
+
leftThumbnail?: string;
|
|
50
|
+
showRightBtn?: boolean;
|
|
51
|
+
onRightBtnClick?: () => void;
|
|
52
|
+
rightBtnTxt?: string;
|
|
53
|
+
showRightIcon?: boolean;
|
|
54
|
+
rightIconName?: string;
|
|
55
|
+
onRightIconClick?: () => void;
|
|
56
|
+
tappableArea?: TappableAreaType;
|
|
57
|
+
tappableAreaClick?: () => void;
|
|
58
|
+
}
|
|
59
|
+
declare const ListItem: React.FC<IListItemProps>;
|
|
60
|
+
export default ListItem;
|