@digitalc/dxp-ui 0.0.5-alpha.15 → 0.0.5-alpha.17
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 +81 -47
- package/es/assets/token.json +128 -102
- package/es/components/Accordion/designTokens.d.ts +3 -3
- package/es/components/Accordion/designTokens.js +22 -14
- package/es/components/Accordion/index.js +8 -4
- package/es/components/Amount/designTokens.d.ts +2 -2
- package/es/components/Amount/designTokens.js +12 -8
- package/es/components/Amount/index.d.ts +3 -10
- package/es/components/Amount/index.js +122 -136
- package/es/components/Button/designTokens.d.ts +18 -3
- package/es/components/Button/designTokens.js +136 -122
- package/es/components/Button/index.d.ts +16 -5
- package/es/components/Button/index.js +89 -94
- package/es/components/Button/style/index.less +1 -1
- package/es/components/Card/designTokens.d.ts +9 -0
- package/es/components/Card/designTokens.js +14 -0
- package/es/components/Card/index.d.ts +15 -0
- package/es/components/Card/index.js +66 -0
- package/es/components/Card/style/index.less +45 -0
- package/es/components/Card/style/variables.less +4 -0
- package/es/components/Chip/designTokens.d.ts +2 -2
- package/es/components/Chip/designTokens.js +25 -21
- package/es/components/Chip/index.js +9 -8
- package/es/components/Divider/designTokens.d.ts +4 -0
- package/es/components/Divider/designTokens.js +9 -0
- package/es/components/Divider/index.d.ts +3 -8
- package/es/components/Divider/index.js +31 -49
- package/es/components/Drawer/designTokens.d.ts +2 -2
- package/es/components/Drawer/designTokens.js +30 -26
- package/es/components/Drawer/index.d.ts +6 -2
- package/es/components/Drawer/index.js +71 -68
- package/es/components/Drawer/style/index.less +13 -7
- package/es/components/GlobalTokenProvider/index.d.ts +11 -0
- package/es/components/GlobalTokenProvider/index.js +16 -0
- package/es/components/Icon/designTokens.d.ts +3 -3
- package/es/components/Icon/designTokens.js +11 -6
- package/es/components/Icon/index.js +6 -2
- package/es/components/IconButton/designTokens.d.ts +3 -4
- package/es/components/IconButton/designTokens.js +38 -32
- package/es/components/IconButton/index.d.ts +1 -1
- package/es/components/IconButton/index.js +7 -7
- package/es/components/Image/index.d.ts +1 -1
- package/es/components/Image/index.js +4 -3
- package/es/components/ListItem/designTokens.d.ts +4 -2
- package/es/components/ListItem/designTokens.js +36 -30
- package/es/components/ListItem/index.d.ts +12 -2
- package/es/components/ListItem/index.js +95 -30
- package/es/components/ListItem/style/index.less +42 -9
- package/es/components/Modal/designTokens.d.ts +11 -20
- package/es/components/Modal/designTokens.js +39 -30
- package/es/components/Modal/index.js +24 -11
- package/es/components/Navigation/designTokens.d.ts +9 -8
- package/es/components/Navigation/designTokens.js +24 -18
- package/es/components/Navigation/index.d.ts +1 -0
- package/es/components/Navigation/index.js +14 -10
- package/es/components/Notification/designTokens.d.ts +9 -0
- package/es/components/Notification/designTokens.js +14 -0
- package/es/components/Notification/index.d.ts +12 -0
- package/es/components/Notification/index.js +54 -0
- package/es/components/Notification/style/index.less +45 -0
- package/es/components/Notification/style/variables.less +4 -0
- package/es/components/Search/designTokens.d.ts +4 -4
- package/es/components/Search/designTokens.js +57 -46
- package/es/components/Search/index.js +15 -9
- package/es/components/Stepper/designTokens.d.ts +4 -5
- package/es/components/Stepper/designTokens.js +48 -40
- package/es/components/Stepper/index.d.ts +9 -10
- package/es/components/Stepper/index.js +139 -135
- package/es/components/Stepper/style/index.less +27 -12
- package/es/components/StickyFooter/designTokens.d.ts +2 -2
- package/es/components/StickyFooter/designTokens.js +20 -16
- package/es/components/StickyFooter/index.d.ts +2 -2
- package/es/components/StickyFooter/index.js +68 -39
- package/es/components/StickyFooter/style/index.less +5 -3
- package/es/components/Tabs/designTokens.d.ts +6 -6
- package/es/components/Tabs/designTokens.js +77 -60
- package/es/components/Tabs/index.js +11 -6
- package/es/components/Tag/designTokens.d.ts +42 -42
- package/es/components/Tag/designTokens.js +139 -95
- package/es/components/Tag/index.d.ts +1 -1
- package/es/components/Tag/index.js +16 -3
- package/es/components/Text/designTokens.d.ts +19 -10
- package/es/components/Text/designTokens.js +65 -51
- package/es/components/Text/index.d.ts +2 -1
- package/es/components/Text/index.js +42 -12
- package/es/components/TextInputInside/designTokens.d.ts +3 -12
- package/es/components/TextInputInside/designTokens.js +59 -57
- package/es/components/TextInputInside/index.js +10 -7
- package/es/components/TextInputOutside/designTokens.d.ts +5 -5
- package/es/components/TextInputOutside/designTokens.js +77 -61
- package/es/components/TextInputOutside/index.js +12 -7
- package/es/components/TextLink/designTokens.d.ts +2 -2
- package/es/components/TextLink/designTokens.js +14 -10
- package/es/components/TextLink/index.js +2 -1
- package/es/components/Toast/designTokens.d.ts +2 -2
- package/es/components/Toast/designTokens.js +20 -19
- package/es/components/Toast/index.js +2 -1
- package/es/components/Toggle/designTokens.d.ts +2 -2
- package/es/components/Toggle/designTokens.js +16 -12
- package/es/components/Toggle/index.js +2 -1
- package/es/components/index.d.ts +7 -1
- package/es/components/index.js +6 -2
- package/es/constants/index.d.ts +4 -1
- package/es/constants/index.js +5 -1
- package/es/index.d.ts +2 -0
- package/es/index.js +4 -0
- package/es/tokens/DXPGlobal.d.ts +27 -19
- package/es/tokens/DXPGlobal.js +3 -2
- package/es/utils/TokenContext.d.ts +14 -0
- package/es/utils/TokenContext.js +91 -0
- package/es/utils/deviceType.d.ts +14 -0
- package/es/utils/deviceType.js +65 -0
- package/es/utils/index.d.ts +9 -0
- package/es/utils/index.js +9 -0
- package/es/utils/tokenHelper.js +2 -5
- package/es/utils/tokenManager.d.ts +82 -20
- package/es/utils/tokenManager.js +857 -779
- package/lib/assets/token.json +128 -102
- package/lib/components/Accordion/designTokens.d.ts +3 -3
- package/lib/components/Accordion/designTokens.js +25 -17
- package/lib/components/Accordion/index.js +8 -4
- package/lib/components/Amount/designTokens.d.ts +2 -2
- package/lib/components/Amount/designTokens.js +13 -9
- package/lib/components/Amount/index.d.ts +3 -10
- package/lib/components/Amount/index.js +84 -90
- package/lib/components/Button/designTokens.d.ts +18 -3
- package/lib/components/Button/designTokens.js +120 -114
- package/lib/components/Button/index.d.ts +16 -5
- package/lib/components/Button/index.js +59 -51
- package/lib/components/Button/style/index.less +1 -1
- package/lib/components/Card/designTokens.d.ts +9 -0
- package/lib/components/Card/designTokens.js +37 -0
- package/lib/components/Card/index.d.ts +15 -0
- package/lib/components/Card/index.js +156 -0
- package/lib/components/Card/style/index.less +45 -0
- package/lib/components/Card/style/variables.less +4 -0
- package/lib/components/Chip/designTokens.d.ts +2 -2
- package/lib/components/Chip/designTokens.js +25 -21
- package/lib/components/Chip/index.js +8 -5
- package/lib/components/Divider/designTokens.d.ts +4 -0
- package/lib/components/Divider/designTokens.js +32 -0
- package/lib/components/Divider/index.d.ts +3 -8
- package/lib/components/Divider/index.js +41 -43
- package/lib/components/Drawer/designTokens.d.ts +2 -2
- package/lib/components/Drawer/designTokens.js +31 -38
- package/lib/components/Drawer/index.d.ts +6 -2
- package/lib/components/Drawer/index.js +80 -53
- package/lib/components/Drawer/style/index.less +13 -7
- package/lib/components/GlobalTokenProvider/index.d.ts +11 -0
- package/lib/components/GlobalTokenProvider/index.js +40 -0
- package/lib/components/Icon/designTokens.d.ts +3 -3
- package/lib/components/Icon/designTokens.js +11 -17
- package/lib/components/Icon/index.js +5 -4
- package/lib/components/IconButton/designTokens.d.ts +3 -4
- package/lib/components/IconButton/designTokens.js +41 -34
- package/lib/components/IconButton/index.d.ts +1 -1
- package/lib/components/IconButton/index.js +25 -23
- package/lib/components/Image/index.d.ts +1 -1
- package/lib/components/Image/index.js +4 -4
- package/lib/components/ListItem/designTokens.d.ts +4 -2
- package/lib/components/ListItem/designTokens.js +36 -41
- package/lib/components/ListItem/index.d.ts +12 -2
- package/lib/components/ListItem/index.js +115 -46
- package/lib/components/ListItem/style/index.less +42 -9
- package/lib/components/Modal/designTokens.d.ts +11 -20
- package/lib/components/Modal/designTokens.js +44 -60
- package/lib/components/Modal/index.js +63 -16
- package/lib/components/Navigation/designTokens.d.ts +9 -8
- package/lib/components/Navigation/designTokens.js +24 -29
- package/lib/components/Navigation/index.d.ts +1 -0
- package/lib/components/Navigation/index.js +13 -12
- package/lib/components/Notification/designTokens.d.ts +9 -0
- package/lib/components/Notification/designTokens.js +37 -0
- package/lib/components/Notification/index.d.ts +12 -0
- package/lib/components/Notification/index.js +110 -0
- package/lib/components/Notification/style/index.less +45 -0
- package/lib/components/Notification/style/variables.less +4 -0
- package/lib/components/Search/designTokens.d.ts +4 -4
- package/lib/components/Search/designTokens.js +61 -49
- package/lib/components/Search/index.js +31 -9
- package/lib/components/Stepper/designTokens.d.ts +4 -5
- package/lib/components/Stepper/designTokens.js +70 -62
- package/lib/components/Stepper/index.d.ts +9 -10
- package/lib/components/Stepper/index.js +104 -53
- package/lib/components/Stepper/style/index.less +27 -12
- package/lib/components/StickyFooter/designTokens.d.ts +2 -2
- package/lib/components/StickyFooter/designTokens.js +21 -17
- package/lib/components/StickyFooter/index.d.ts +2 -2
- package/lib/components/StickyFooter/index.js +50 -18
- package/lib/components/StickyFooter/style/index.less +5 -3
- package/lib/components/Tabs/designTokens.d.ts +6 -6
- package/lib/components/Tabs/designTokens.js +80 -63
- package/lib/components/Tabs/index.js +19 -12
- package/lib/components/Tag/designTokens.d.ts +42 -42
- package/lib/components/Tag/designTokens.js +159 -115
- package/lib/components/Tag/index.d.ts +1 -1
- package/lib/components/Tag/index.js +27 -14
- package/lib/components/Text/designTokens.d.ts +19 -10
- package/lib/components/Text/designTokens.js +65 -51
- package/lib/components/Text/index.d.ts +2 -1
- package/lib/components/Text/index.js +407 -297
- package/lib/components/TextInputInside/designTokens.d.ts +3 -12
- package/lib/components/TextInputInside/designTokens.js +62 -75
- package/lib/components/TextInputInside/index.js +10 -7
- package/lib/components/TextInputOutside/designTokens.d.ts +5 -5
- package/lib/components/TextInputOutside/designTokens.js +82 -66
- package/lib/components/TextInputOutside/index.js +12 -8
- package/lib/components/TextLink/designTokens.d.ts +2 -2
- package/lib/components/TextLink/designTokens.js +14 -21
- package/lib/components/TextLink/index.js +3 -2
- package/lib/components/Toast/designTokens.d.ts +2 -2
- package/lib/components/Toast/designTokens.js +20 -16
- package/lib/components/Toast/index.js +7 -6
- package/lib/components/Toggle/designTokens.d.ts +2 -2
- package/lib/components/Toggle/designTokens.js +16 -23
- package/lib/components/Toggle/index.js +3 -2
- package/lib/components/index.d.ts +7 -1
- package/lib/components/index.js +10 -2
- package/lib/constants/index.d.ts +4 -1
- package/lib/constants/index.js +5 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +22 -0
- package/lib/tokens/DXPGlobal.d.ts +27 -19
- package/lib/tokens/DXPGlobal.js +1 -1
- package/lib/utils/TokenContext.d.ts +14 -0
- package/lib/utils/TokenContext.js +85 -0
- package/lib/utils/deviceType.d.ts +14 -0
- package/lib/utils/deviceType.js +56 -0
- package/lib/utils/index.d.ts +9 -0
- package/lib/utils/index.js +44 -0
- package/lib/utils/tokenHelper.js +2 -12
- package/lib/utils/tokenManager.d.ts +82 -20
- package/lib/utils/tokenManager.js +840 -777
- package/package.json +14 -11
- package/umd/dxp-ui.min.css +1 -1
- package/umd/dxp-ui.min.js +1 -1
- package/lib/components/Button/demo/index.d.ts +0 -3
- package/lib/components/Button/demo/index.js +0 -138
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
declare const useDesignTokens: () => {
|
|
2
2
|
headerBg: string;
|
|
3
3
|
headerPadding: string;
|
|
4
4
|
contentPadding: string;
|
|
5
5
|
};
|
|
6
|
-
declare const
|
|
6
|
+
declare const useDesignBorderTokens: () => {
|
|
7
7
|
headerBg: string;
|
|
8
8
|
headerPadding: string;
|
|
9
9
|
contentPadding: string;
|
|
10
10
|
};
|
|
11
|
-
export {
|
|
11
|
+
export { useDesignTokens, useDesignBorderTokens };
|
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { useDynamicTokens } from "../../utils";
|
|
2
|
+
var useDesignTokens = function useDesignTokens() {
|
|
3
|
+
var getToken = useDynamicTokens();
|
|
4
|
+
var designTokens = {
|
|
5
|
+
headerBg: 'transparent',
|
|
6
|
+
// header背景色
|
|
7
|
+
headerPadding: "".concat(getToken('spacingAccordionTitlePaddingVertical'), "px 0"),
|
|
8
|
+
// header边距
|
|
9
|
+
contentPadding: "".concat(getToken('spacingAccordionBodyPaddingBottom'), "px 0") // content边距
|
|
10
|
+
};
|
|
11
|
+
return designTokens;
|
|
8
12
|
};
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
var useDesignBorderTokens = function useDesignBorderTokens() {
|
|
14
|
+
var getToken = useDynamicTokens();
|
|
15
|
+
var designBorderTokens = {
|
|
16
|
+
headerBg: '#F5F5F8',
|
|
17
|
+
// header背景色
|
|
18
|
+
headerPadding: "".concat(getToken('spacingAccordionTitlePaddingVertical'), "px 16px"),
|
|
19
|
+
// header边距
|
|
20
|
+
contentPadding: "".concat(getToken('spacingAccordionBodyPaddingBottom'), "px 16px") // content边距
|
|
21
|
+
};
|
|
22
|
+
return designBorderTokens;
|
|
15
23
|
};
|
|
16
|
-
export {
|
|
24
|
+
export { useDesignTokens, useDesignBorderTokens };
|
|
@@ -4,11 +4,11 @@ import "antd/es/collapse/style";
|
|
|
4
4
|
import _Collapse from "antd/es/collapse";
|
|
5
5
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
6
6
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
7
|
-
var _excluded = ["prefixCls", "bordered", "items"];
|
|
7
|
+
var _excluded = ["prefixCls", "bordered", "items", "className"];
|
|
8
8
|
import React from 'react';
|
|
9
9
|
// import { useStyleRegister } from '@ant-design/cssinjs';
|
|
10
10
|
// import { theme } from '../../utils/theme';
|
|
11
|
-
import {
|
|
11
|
+
import { useDesignTokens, useDesignBorderTokens } from "./designTokens";
|
|
12
12
|
import { BASE_CLASS_PREFIX } from "../../constants";
|
|
13
13
|
import Text from "../Text";
|
|
14
14
|
import "./style/index.less";
|
|
@@ -20,11 +20,13 @@ var Accordion = function Accordion(props) {
|
|
|
20
20
|
bordered = _props$bordered === void 0 ? true : _props$bordered,
|
|
21
21
|
_props$items = props.items,
|
|
22
22
|
items = _props$items === void 0 ? [] : _props$items,
|
|
23
|
+
_props$className = props.className,
|
|
24
|
+
className = _props$className === void 0 ? '' : _props$className,
|
|
23
25
|
attr = _objectWithoutProperties(props, _excluded);
|
|
24
26
|
// const useCustomButtonStyle = () => {
|
|
25
27
|
// const hashId = useStyleRegister({
|
|
26
28
|
// theme: theme,
|
|
27
|
-
// token: {
|
|
29
|
+
// token: {},
|
|
28
30
|
// path: [`${prefixCls}`],
|
|
29
31
|
// }, () => `
|
|
30
32
|
// .${prefixCls}-header {
|
|
@@ -58,6 +60,8 @@ var Accordion = function Accordion(props) {
|
|
|
58
60
|
})
|
|
59
61
|
};
|
|
60
62
|
});
|
|
63
|
+
var designTokens = useDesignTokens();
|
|
64
|
+
var designBorderTokens = useDesignBorderTokens();
|
|
61
65
|
var showBorder = bordered ? designBorderTokens : designTokens;
|
|
62
66
|
return /*#__PURE__*/_jsx(_ConfigProvider, {
|
|
63
67
|
prefixCls: BASE_CLASS_PREFIX,
|
|
@@ -68,7 +72,7 @@ var Accordion = function Accordion(props) {
|
|
|
68
72
|
},
|
|
69
73
|
children: /*#__PURE__*/_jsx(_Collapse, _objectSpread({
|
|
70
74
|
items: newItems,
|
|
71
|
-
className: "".concat(prefixCls),
|
|
75
|
+
className: "".concat(prefixCls, " ").concat(className),
|
|
72
76
|
showArrow: false,
|
|
73
77
|
bordered: bordered
|
|
74
78
|
}, attr))
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { useDynamicTokens } from "../../utils";
|
|
2
|
+
var useDesignTokens = function useDesignTokens() {
|
|
3
|
+
var getToken = useDynamicTokens();
|
|
4
|
+
var designTokens = {
|
|
5
|
+
colorCardTextTitle: getToken('colorCardTextTitle'),
|
|
6
|
+
// title颜色
|
|
7
|
+
colorCardTextPriceStrikethrough: getToken('colorCardTextPriceStrikethrough'),
|
|
8
|
+
// 划线价颜色
|
|
9
|
+
colorCardTextPrice: getToken('colorCardTextPrice') // 金额颜色
|
|
10
|
+
};
|
|
11
|
+
return designTokens;
|
|
8
12
|
};
|
|
9
|
-
export {
|
|
13
|
+
export { useDesignTokens };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import './style/index.less';
|
|
3
3
|
export type Size = 'XS' | 'S' | 'M' | 'L' | 'LG';
|
|
4
4
|
export type Position = 'up' | 'right' | 'down' | 'left';
|
|
@@ -12,12 +12,5 @@ export interface AmountProps {
|
|
|
12
12
|
onDropDownClick?: React.MouseEventHandler;
|
|
13
13
|
[key: string]: any;
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
size: string;
|
|
18
|
-
title: string;
|
|
19
|
-
position: string;
|
|
20
|
-
prefixCls: string;
|
|
21
|
-
};
|
|
22
|
-
render(): React.JSX.Element;
|
|
23
|
-
}
|
|
15
|
+
declare const Amount: (props: AmountProps) => React.JSX.Element;
|
|
16
|
+
export default Amount;
|
|
@@ -1,144 +1,130 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
7
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["children", "className", "size", "title", "position", "prefixCls", "priceStrikethrough", "style", "priceColor", "textColor", "strikethroughColor", "onDropDownClick", "showIcon", "iconType", "onClick", "onMouseDown"];
|
|
5
|
+
import React from 'react';
|
|
10
6
|
import { default as classNames } from 'classnames';
|
|
11
|
-
import {
|
|
7
|
+
import { useDesignTokens } from "./designTokens";
|
|
12
8
|
import { cssClasses } from "../../constants";
|
|
13
9
|
import { Text, Icon } from "../index";
|
|
14
10
|
import "./style/index.less";
|
|
15
11
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
16
|
-
var Amount =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return 'ContentC12Bold';
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
var TitleDom = function TitleDom() {
|
|
65
|
-
return /*#__PURE__*/_jsx(_Fragment, {
|
|
66
|
-
children: title === 'discount' ? /*#__PURE__*/_jsx(Text, {
|
|
67
|
-
size: "ContentC12Bold",
|
|
68
|
-
style: {
|
|
69
|
-
color: textColor || '#D01660'
|
|
70
|
-
},
|
|
71
|
-
children: "Discount"
|
|
72
|
-
}) : /*#__PURE__*/_jsxs(Text, {
|
|
73
|
-
size: "ContentC12Regular",
|
|
74
|
-
style: {
|
|
75
|
-
color: textColor || colorCardTextTitle
|
|
76
|
-
},
|
|
77
|
-
children: [title, showIcon && /*#__PURE__*/_jsx(Icon, {
|
|
78
|
-
size: 12,
|
|
79
|
-
name: iconType,
|
|
80
|
-
onClick: onDropDownClick
|
|
81
|
-
})]
|
|
82
|
-
})
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
var PriceDom = function PriceDom() {
|
|
86
|
-
return /*#__PURE__*/_jsx(Text, {
|
|
87
|
-
size: getSize(size),
|
|
88
|
-
style: {
|
|
89
|
-
color: priceColor || colorCardTextPrice
|
|
90
|
-
},
|
|
91
|
-
children: children
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
|
-
var PriceStrikethroughDom = function PriceStrikethroughDom() {
|
|
95
|
-
return /*#__PURE__*/_jsx(Text, {
|
|
96
|
-
size: "ContentC12Strikethrough",
|
|
97
|
-
style: {
|
|
98
|
-
color: colorStrikethrough || colorCardTextPriceStrikethrough
|
|
99
|
-
},
|
|
100
|
-
children: priceStrikethrough
|
|
101
|
-
});
|
|
102
|
-
};
|
|
103
|
-
var positionLeft = function positionLeft() {
|
|
104
|
-
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
105
|
-
children: [/*#__PURE__*/_jsx(TitleDom, {}), /*#__PURE__*/_jsxs("div", {
|
|
106
|
-
children: [/*#__PURE__*/_jsx(PriceStrikethroughDom, {}), /*#__PURE__*/_jsx(PriceDom, {})]
|
|
107
|
-
})]
|
|
108
|
-
});
|
|
109
|
-
};
|
|
110
|
-
var positionRight = function positionRight() {
|
|
111
|
-
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
112
|
-
children: [/*#__PURE__*/_jsx(TitleDom, {}), /*#__PURE__*/_jsxs("div", {
|
|
113
|
-
children: [/*#__PURE__*/_jsx(PriceDom, {}), /*#__PURE__*/_jsx(PriceStrikethroughDom, {})]
|
|
114
|
-
})]
|
|
115
|
-
});
|
|
116
|
-
};
|
|
117
|
-
var positionUp = function positionUp() {
|
|
118
|
-
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
119
|
-
children: [/*#__PURE__*/_jsx(TitleDom, {}), /*#__PURE__*/_jsx(PriceStrikethroughDom, {}), /*#__PURE__*/_jsx(PriceDom, {})]
|
|
120
|
-
});
|
|
121
|
-
};
|
|
122
|
-
var positionDown = function positionDown() {
|
|
123
|
-
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
124
|
-
children: [/*#__PURE__*/_jsx(TitleDom, {}), /*#__PURE__*/_jsx(PriceDom, {}), /*#__PURE__*/_jsx(PriceStrikethroughDom, {})]
|
|
125
|
-
});
|
|
126
|
-
};
|
|
127
|
-
return /*#__PURE__*/_jsxs("span", _objectSpread(_objectSpread(_objectSpread({
|
|
128
|
-
onClick: this.props.onClick
|
|
129
|
-
}, baseProps), {}, {
|
|
130
|
-
onMouseDown: this.props.onMouseDown
|
|
131
|
-
}, attr), {}, {
|
|
132
|
-
children: [position === 'left' && positionLeft(), position === 'right' && positionRight(), position === 'up' && positionUp(), position === 'down' && positionDown()]
|
|
133
|
-
}));
|
|
12
|
+
var Amount = function Amount(props) {
|
|
13
|
+
var children = props.children,
|
|
14
|
+
_props$className = props.className,
|
|
15
|
+
className = _props$className === void 0 ? '' : _props$className,
|
|
16
|
+
_props$size = props.size,
|
|
17
|
+
size = _props$size === void 0 ? 'L' : _props$size,
|
|
18
|
+
_props$title = props.title,
|
|
19
|
+
title = _props$title === void 0 ? 'Total' : _props$title,
|
|
20
|
+
_props$position = props.position,
|
|
21
|
+
position = _props$position === void 0 ? 'down' : _props$position,
|
|
22
|
+
_props$prefixCls = props.prefixCls,
|
|
23
|
+
prefixCls = _props$prefixCls === void 0 ? "".concat(cssClasses.PREFIX, "-amount") : _props$prefixCls,
|
|
24
|
+
priceStrikethrough = props.priceStrikethrough,
|
|
25
|
+
style = props.style,
|
|
26
|
+
priceColor = props.priceColor,
|
|
27
|
+
textColor = props.textColor,
|
|
28
|
+
strikethroughColor = props.strikethroughColor,
|
|
29
|
+
onDropDownClick = props.onDropDownClick,
|
|
30
|
+
_props$showIcon = props.showIcon,
|
|
31
|
+
showIcon = _props$showIcon === void 0 ? true : _props$showIcon,
|
|
32
|
+
_props$iconType = props.iconType,
|
|
33
|
+
iconType = _props$iconType === void 0 ? 'icon-a-Arrow-Down' : _props$iconType,
|
|
34
|
+
onClick = props.onClick,
|
|
35
|
+
onMouseDown = props.onMouseDown,
|
|
36
|
+
attr = _objectWithoutProperties(props, _excluded);
|
|
37
|
+
var designTokens = useDesignTokens();
|
|
38
|
+
var colorCardTextPrice = designTokens.colorCardTextPrice,
|
|
39
|
+
colorCardTextPriceStrikethrough = designTokens.colorCardTextPriceStrikethrough,
|
|
40
|
+
colorCardTextTitle = designTokens.colorCardTextTitle;
|
|
41
|
+
var baseProps = {
|
|
42
|
+
className: classNames(prefixCls, _defineProperty(_defineProperty({}, "".concat(prefixCls, "-size-").concat(size), size), "".concat(prefixCls, "-position-").concat(position), position), className),
|
|
43
|
+
style: style
|
|
44
|
+
};
|
|
45
|
+
var getSize = function getSize(fontSize) {
|
|
46
|
+
switch (fontSize) {
|
|
47
|
+
case 'S':
|
|
48
|
+
return 'ContentC14Bold';
|
|
49
|
+
case 'M':
|
|
50
|
+
return 'ContentC15Bold';
|
|
51
|
+
case 'L':
|
|
52
|
+
return 'ContentC21Bold';
|
|
53
|
+
case 'LG':
|
|
54
|
+
return 'ContentC23Bold';
|
|
55
|
+
default:
|
|
56
|
+
return 'ContentC12Bold';
|
|
134
57
|
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
58
|
+
};
|
|
59
|
+
var TitleDom = function TitleDom() {
|
|
60
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
61
|
+
children: title === 'discount' ? /*#__PURE__*/_jsx(Text, {
|
|
62
|
+
size: "ContentC12Bold",
|
|
63
|
+
style: {
|
|
64
|
+
color: textColor || '#D01660'
|
|
65
|
+
},
|
|
66
|
+
children: "Discount"
|
|
67
|
+
}) : /*#__PURE__*/_jsxs(Text, {
|
|
68
|
+
size: "ContentC12Regular",
|
|
69
|
+
style: {
|
|
70
|
+
color: textColor || colorCardTextTitle
|
|
71
|
+
},
|
|
72
|
+
children: [title, showIcon && /*#__PURE__*/_jsx(Icon, {
|
|
73
|
+
size: 12,
|
|
74
|
+
name: iconType,
|
|
75
|
+
onClick: onDropDownClick
|
|
76
|
+
})]
|
|
77
|
+
})
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
var PriceDom = function PriceDom() {
|
|
81
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
82
|
+
size: getSize(size),
|
|
83
|
+
style: {
|
|
84
|
+
color: priceColor || colorCardTextPrice
|
|
85
|
+
},
|
|
86
|
+
children: children
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
var PriceStrikethroughDom = function PriceStrikethroughDom() {
|
|
90
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
91
|
+
size: "ContentC12Strikethrough",
|
|
92
|
+
style: {
|
|
93
|
+
color: strikethroughColor || colorCardTextPriceStrikethrough
|
|
94
|
+
},
|
|
95
|
+
children: priceStrikethrough
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
var positionLeft = function positionLeft() {
|
|
99
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
100
|
+
children: [/*#__PURE__*/_jsx(TitleDom, {}), /*#__PURE__*/_jsxs("div", {
|
|
101
|
+
children: [/*#__PURE__*/_jsx(PriceStrikethroughDom, {}), /*#__PURE__*/_jsx(PriceDom, {})]
|
|
102
|
+
})]
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
var positionRight = function positionRight() {
|
|
106
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
107
|
+
children: [/*#__PURE__*/_jsx(TitleDom, {}), /*#__PURE__*/_jsxs("div", {
|
|
108
|
+
children: [/*#__PURE__*/_jsx(PriceDom, {}), /*#__PURE__*/_jsx(PriceStrikethroughDom, {})]
|
|
109
|
+
})]
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
var positionUp = function positionUp() {
|
|
113
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
114
|
+
children: [/*#__PURE__*/_jsx(TitleDom, {}), /*#__PURE__*/_jsx(PriceStrikethroughDom, {}), /*#__PURE__*/_jsx(PriceDom, {})]
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
var positionDown = function positionDown() {
|
|
118
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
119
|
+
children: [/*#__PURE__*/_jsx(TitleDom, {}), /*#__PURE__*/_jsx(PriceDom, {}), /*#__PURE__*/_jsx(PriceStrikethroughDom, {})]
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
return /*#__PURE__*/_jsxs("span", _objectSpread(_objectSpread(_objectSpread({
|
|
123
|
+
onClick: onClick
|
|
124
|
+
}, baseProps), {}, {
|
|
125
|
+
onMouseDown: onMouseDown
|
|
126
|
+
}, attr), {}, {
|
|
127
|
+
children: [position === 'left' && positionLeft(), position === 'right' && positionRight(), position === 'up' && positionUp(), position === 'down' && positionDown()]
|
|
128
|
+
}));
|
|
129
|
+
};
|
|
130
|
+
export default Amount;
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Button组件的设计Token系统
|
|
3
|
+
*
|
|
4
|
+
* 这里是dxp的UI token,缓存在本地的内置变量;
|
|
5
|
+
* 通过antd提供的ConfigProvider注入组件级token变量来实现gomo风格的UI组件。
|
|
6
|
+
*
|
|
7
|
+
* 样式定制实现方式(理论上可以通过2种方式来实现):
|
|
8
|
+
* 1. 通过ConfigProvider注入组件级别的token变量(当前采用)
|
|
9
|
+
* - 优点:不需要编写less文件,只需对齐变量值
|
|
10
|
+
* - 缺点:可控细节较少,受限于antd提供的token
|
|
11
|
+
*
|
|
12
|
+
* 2. 直接编写less文件覆盖antd样式
|
|
13
|
+
* - 优点:可控细节更多(相当于把 dxp 的 UI token 通过 less 的方式覆盖antd的样式)
|
|
14
|
+
* - 缺点:需要了解组件DOM结构,维护成本高,优先选择第1种
|
|
15
|
+
*/
|
|
16
|
+
declare const useDesignTokens: () => {
|
|
2
17
|
colorPrimary: any;
|
|
3
18
|
colorPrimaryHover: any;
|
|
4
19
|
colorPrimaryActive: any;
|
|
@@ -29,7 +44,7 @@ declare const designTokens: {
|
|
|
29
44
|
paddingBlockSM: any;
|
|
30
45
|
paddingBlockLG: any;
|
|
31
46
|
};
|
|
32
|
-
declare const
|
|
47
|
+
declare const useInverseDesignTokens: () => {
|
|
33
48
|
colorPrimary: any;
|
|
34
49
|
colorPrimaryHover: any;
|
|
35
50
|
colorPrimaryActive: any;
|
|
@@ -63,4 +78,4 @@ declare const inverseDesignTokens: {
|
|
|
63
78
|
paddingBlockSM: any;
|
|
64
79
|
paddingBlockLG: any;
|
|
65
80
|
};
|
|
66
|
-
export {
|
|
81
|
+
export { useDesignTokens, useInverseDesignTokens };
|