@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
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import React, { createContext, useContext, useState, useEffect, useMemo, useCallback } from 'react';
|
|
3
|
+
import { TokenManager } from "./";
|
|
4
|
+
|
|
5
|
+
// 定义TokenContext的类型
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
// 创建默认值,使用TokenManager.tokenKey作为默认的token获取方法
|
|
8
|
+
var defaultValue = {
|
|
9
|
+
getToken: function getToken(tokenName) {
|
|
10
|
+
return TokenManager.tokenKey(tokenName);
|
|
11
|
+
},
|
|
12
|
+
tokenVersion: 0
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// 创建TokenContext
|
|
16
|
+
export var TokenContext = /*#__PURE__*/createContext(defaultValue);
|
|
17
|
+
|
|
18
|
+
// 创建一个全局的token版本号,用于跟踪token更新
|
|
19
|
+
var globalTokenVersion = 0;
|
|
20
|
+
|
|
21
|
+
// 添加一个更新token的方法,当token更新时调用
|
|
22
|
+
export var updateTokenVersion = function updateTokenVersion() {
|
|
23
|
+
globalTokenVersion++;
|
|
24
|
+
return globalTokenVersion;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// TokenProvider组件,用于提供自定义的token获取方法
|
|
28
|
+
|
|
29
|
+
export var TokenProvider = function TokenProvider(_ref) {
|
|
30
|
+
var children = _ref.children,
|
|
31
|
+
getToken = _ref.getToken;
|
|
32
|
+
// 使用state来跟踪token版本,当版本变化时会触发重新渲染
|
|
33
|
+
var _useState = useState(globalTokenVersion),
|
|
34
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
35
|
+
tokenVersion = _useState2[0],
|
|
36
|
+
setTokenVersion = _useState2[1];
|
|
37
|
+
|
|
38
|
+
// 监听全局token版本变化
|
|
39
|
+
useEffect(function () {
|
|
40
|
+
// 监听自定义事件,当token更新时更新版本号
|
|
41
|
+
var handleTokenUpdate = function handleTokenUpdate() {
|
|
42
|
+
globalTokenVersion++;
|
|
43
|
+
setTokenVersion(globalTokenVersion);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// 添加事件监听
|
|
47
|
+
if (typeof window !== 'undefined') {
|
|
48
|
+
window.addEventListener('dxp-token-updated', handleTokenUpdate);
|
|
49
|
+
}
|
|
50
|
+
return function () {
|
|
51
|
+
// 移除事件监听
|
|
52
|
+
if (typeof window !== 'undefined') {
|
|
53
|
+
window.removeEventListener('dxp-token-updated', handleTokenUpdate);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}, []);
|
|
57
|
+
|
|
58
|
+
// 使用useMemo缓存value,避免不必要的重新渲染
|
|
59
|
+
var value = useMemo(function () {
|
|
60
|
+
return {
|
|
61
|
+
getToken: getToken || defaultValue.getToken,
|
|
62
|
+
tokenVersion: tokenVersion
|
|
63
|
+
};
|
|
64
|
+
}, [getToken, tokenVersion]);
|
|
65
|
+
return /*#__PURE__*/_jsx(TokenContext.Provider, {
|
|
66
|
+
value: value,
|
|
67
|
+
children: children
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// 自定义钩子,实现 token 响应式获取,支持 token 变更时组件自动刷新。用于在组件中获取token
|
|
72
|
+
export var useDynamicTokens = function useDynamicTokens() {
|
|
73
|
+
var context = useContext(TokenContext);
|
|
74
|
+
if (!context) {
|
|
75
|
+
throw new Error('useDynamicTokens must be used within a TokenProvider');
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// 使用tokenVersion作为依赖,当tokenVersion变化时,会触发使用此钩子的组件重新渲染
|
|
79
|
+
var getToken = context.getToken,
|
|
80
|
+
tokenVersion = context.tokenVersion;
|
|
81
|
+
|
|
82
|
+
// 返回一个新的函数,调用此函数会获取最新的token值
|
|
83
|
+
return useCallback(function (tokenName) {
|
|
84
|
+
var value = getToken(tokenName);
|
|
85
|
+
// 如果getToken返回undefined或空字符串,则尝试从TokenManager直接获取
|
|
86
|
+
if (value === undefined || value === '') {
|
|
87
|
+
return TokenManager.tokenKey(tokenName);
|
|
88
|
+
}
|
|
89
|
+
return value;
|
|
90
|
+
}, [getToken, tokenVersion]);
|
|
91
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { strings } from "../constants";
|
|
2
|
+
/**
|
|
3
|
+
* Checks if the current environment is likely a mobile device.
|
|
4
|
+
* This function should ideally run only on the client-side.
|
|
5
|
+
* @returns {boolean} True if likely a mobile device, false otherwise.
|
|
6
|
+
*/
|
|
7
|
+
export declare const checkIsMobile: () => boolean;
|
|
8
|
+
/**
|
|
9
|
+
* React Hook to detect if the current device is mobile.
|
|
10
|
+
* Ensures the check runs only on the client-side after hydration.
|
|
11
|
+
* @returns {boolean} True if likely a mobile device, false otherwise.
|
|
12
|
+
*/
|
|
13
|
+
export declare const useIsMobile: () => boolean;
|
|
14
|
+
export declare const useBreakPoint: () => "desktop" | "mobile" | null;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import { strings } from "../constants";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Checks if the current environment is likely a mobile device.
|
|
7
|
+
* This function should ideally run only on the client-side.
|
|
8
|
+
* @returns {boolean} True if likely a mobile device, false otherwise.
|
|
9
|
+
*/
|
|
10
|
+
export var checkIsMobile = function checkIsMobile() {
|
|
11
|
+
if (typeof window === 'undefined') {
|
|
12
|
+
// Cannot detect on server-side, assume desktop
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Check for touch points (more reliable for modern devices)
|
|
17
|
+
if (navigator.maxTouchPoints > 0) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Fallback to User Agent sniffing (less reliable but common)
|
|
22
|
+
var userAgent = navigator.userAgent || navigator.vendor || window.opera;
|
|
23
|
+
if (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent.toLowerCase())) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Optional: Check via media query (can be influenced by browser window size)
|
|
28
|
+
// if (window.matchMedia('(pointer: coarse)').matches) {
|
|
29
|
+
// return true;
|
|
30
|
+
// }
|
|
31
|
+
|
|
32
|
+
return false;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* React Hook to detect if the current device is mobile.
|
|
37
|
+
* Ensures the check runs only on the client-side after hydration.
|
|
38
|
+
* @returns {boolean} True if likely a mobile device, false otherwise.
|
|
39
|
+
*/
|
|
40
|
+
export var useIsMobile = function useIsMobile() {
|
|
41
|
+
var _useState = useState(false),
|
|
42
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
43
|
+
isMobile = _useState2[0],
|
|
44
|
+
setIsMobile = _useState2[1];
|
|
45
|
+
useEffect(function () {
|
|
46
|
+
// Perform check only after component mounts on the client
|
|
47
|
+
setIsMobile(checkIsMobile());
|
|
48
|
+
}, []); // Empty dependency array ensures this runs only once
|
|
49
|
+
|
|
50
|
+
return isMobile;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// Example usage:
|
|
54
|
+
// const breakpoint = useBreakPoint(); = 'mobile' : 'desktop'
|
|
55
|
+
export var useBreakPoint = function useBreakPoint() {
|
|
56
|
+
var _useState3 = useState(null),
|
|
57
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
58
|
+
breakpoint = _useState4[0],
|
|
59
|
+
setBreakpoint = _useState4[1];
|
|
60
|
+
useEffect(function () {
|
|
61
|
+
var autoBreakPoint = checkIsMobile() ? strings.breakpoint.MOBILE : strings.breakpoint.DESKTOP;
|
|
62
|
+
setBreakpoint(autoBreakPoint);
|
|
63
|
+
}, []);
|
|
64
|
+
return breakpoint;
|
|
65
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './TokenContext';
|
|
2
|
+
export * from './deviceType';
|
|
3
|
+
export * from './noop';
|
|
4
|
+
export * from './scaleTool';
|
|
5
|
+
export * from './theme';
|
|
6
|
+
export * from './themeContext';
|
|
7
|
+
export * from './tokenHelper';
|
|
8
|
+
export * from './tokenManager';
|
|
9
|
+
export { default as TokenManager } from './tokenManager';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./TokenContext";
|
|
2
|
+
export * from "./deviceType";
|
|
3
|
+
export * from "./noop";
|
|
4
|
+
export * from "./scaleTool";
|
|
5
|
+
export * from "./theme";
|
|
6
|
+
export * from "./themeContext";
|
|
7
|
+
export * from "./tokenHelper";
|
|
8
|
+
export * from "./tokenManager";
|
|
9
|
+
export { default as TokenManager } from "./tokenManager";
|
package/es/utils/tokenHelper.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import TokenManager from "./
|
|
1
|
+
import { TokenManager } from "./";
|
|
2
2
|
export var getToken = function getToken(tokenName) {
|
|
3
3
|
return TokenManager.tokenKey(tokenName);
|
|
4
|
-
};
|
|
5
|
-
// export const getDesignToken = (tokenName: string) => {
|
|
6
|
-
// return TokenManager.designTokenKey(tokenName);
|
|
7
|
-
// };
|
|
4
|
+
};
|
|
@@ -14,28 +14,52 @@ interface TokenRef {
|
|
|
14
14
|
[key: string]: TokenValue | Record<string, TokenValue> | null;
|
|
15
15
|
}
|
|
16
16
|
export declare const getComponentToken: () => {
|
|
17
|
+
colorTagTextGreen: TokenValue;
|
|
18
|
+
colorTagTextYellow: TokenValue;
|
|
19
|
+
colorTagTextGrey: TokenValue;
|
|
20
|
+
colorTagTextRed: TokenValue;
|
|
21
|
+
colorTagTextOrange: TokenValue;
|
|
22
|
+
colorTagTextLakeBlue: TokenValue;
|
|
23
|
+
colorTagBackGroundPrimaryLight: TokenValue;
|
|
24
|
+
colorTagBackGroundSecondaryLight: TokenValue;
|
|
25
|
+
colorTagBackGroundGreen: TokenValue;
|
|
26
|
+
colorTagBackGroundYellow: TokenValue;
|
|
27
|
+
colorTagBackGroundGrey: TokenValue;
|
|
28
|
+
colorTagBackGroundRed: TokenValue;
|
|
29
|
+
colorTagBackGroundOrange: TokenValue;
|
|
30
|
+
colorTagBackGroundLakeBlue: TokenValue;
|
|
31
|
+
colorTagGreyLight: TokenValue;
|
|
32
|
+
colorTagRedLight: TokenValue;
|
|
33
|
+
colorTagYellowLight: TokenValue;
|
|
34
|
+
colorTagGreenLight: TokenValue;
|
|
35
|
+
colorTagOrangeLight: TokenValue;
|
|
36
|
+
colorTagLakeBlueLight: TokenValue;
|
|
37
|
+
colorTextAmount: TokenValue;
|
|
38
|
+
fontSizeMobileContentC23: TokenValue;
|
|
39
|
+
fontSizeDesktopContentC23: TokenValue;
|
|
40
|
+
spacingListItemTextVerticalGapMd: TokenValue;
|
|
41
|
+
spacingListItemTextVerticalGapSm: TokenValue;
|
|
42
|
+
colorBackgroundSubtle2: TokenValue;
|
|
43
|
+
colorDividerHorizontal: TokenValue;
|
|
17
44
|
spacinginputpaddingVerticalM: number;
|
|
18
45
|
fontSizeDesktopTitleT23: TokenValue;
|
|
19
46
|
fontSizeDesktopContentC15: TokenValue;
|
|
20
47
|
fontSizeDesktopContentC21: TokenValue;
|
|
21
48
|
fontSizeDesktopTitleT21: TokenValue;
|
|
49
|
+
fontSizeDesktopTitleT12: TokenValue;
|
|
50
|
+
fontSizeDesktopTitleT13: TokenValue;
|
|
51
|
+
fontSizeDesktopTitleT14: TokenValue;
|
|
22
52
|
fontSizeDesktopTitleT15: TokenValue;
|
|
53
|
+
fontSizeDesktopTitleT16: TokenValue;
|
|
23
54
|
fontSizeDesktopContentC13: TokenValue;
|
|
24
55
|
fontSizeDesktopContentC11: TokenValue;
|
|
25
56
|
fontSizeDesktopContentC12: TokenValue;
|
|
26
57
|
fontSizeDesktopContentC14: TokenValue;
|
|
27
|
-
|
|
58
|
+
fontSizeDesktopTitleT34: TokenValue;
|
|
28
59
|
fontSizeDesktopTitleT32: TokenValue;
|
|
29
60
|
fontSizeDesktopTitleT41: TokenValue;
|
|
30
61
|
fontSizeDesktopContentC05: TokenValue;
|
|
31
62
|
fontSizeDesktopContentC04: TokenValue;
|
|
32
|
-
fontSizeDesktopTitleT7: TokenValue;
|
|
33
|
-
fontSizeDesktopTitleT8: TokenValue;
|
|
34
|
-
fontSizeDesktopTitleT2: TokenValue;
|
|
35
|
-
fontSizeDesktopTitleT5: TokenValue;
|
|
36
|
-
fontSizeDesktopTitleT3: TokenValue;
|
|
37
|
-
fontSizeDesktopTitleT4: TokenValue;
|
|
38
|
-
fontSizeDesktopTitleT10: TokenValue;
|
|
39
63
|
fontSizeMobileContentC04: TokenValue;
|
|
40
64
|
fontSizeMobileContentC05: TokenValue;
|
|
41
65
|
fontSizeMobileContentC11: TokenValue;
|
|
@@ -272,6 +296,7 @@ export declare const getComponentToken: () => {
|
|
|
272
296
|
spacingNotificationTextLinkPaddingTop: TokenValue;
|
|
273
297
|
spacingTopNavigationPaddingHorizontal: TokenValue;
|
|
274
298
|
spacingTopNavigationPaddingBottom: TokenValue;
|
|
299
|
+
spacingTopNavigationPaddingTop: TokenValue;
|
|
275
300
|
spacingTopNavigationHorizontalGap: TokenValue;
|
|
276
301
|
spacingTopNavigationIconButtonHorizontalGap: TokenValue;
|
|
277
302
|
spacingTopNavigationTextLinkPaddingRight: TokenValue;
|
|
@@ -585,7 +610,7 @@ export declare const getComponentToken: () => {
|
|
|
585
610
|
colorNumberedListText: TokenValue;
|
|
586
611
|
colorTopNavigationTitleStandard: TokenValue;
|
|
587
612
|
colorTopNavigationTitleInverse: TokenValue;
|
|
588
|
-
colorTopNavigationGradient:
|
|
613
|
+
colorTopNavigationGradient: string;
|
|
589
614
|
colorTopNavigationBackground: TokenValue;
|
|
590
615
|
colorTopNavigationBackgroundHaze: TokenValue;
|
|
591
616
|
colorTopNavigationBackgroundInverse: TokenValue;
|
|
@@ -769,6 +794,7 @@ export declare const getComponentToken: () => {
|
|
|
769
794
|
borderRadiusVoucher: TokenValue;
|
|
770
795
|
borderRadiusChip: TokenValue;
|
|
771
796
|
borderRadiusCardSm: TokenValue;
|
|
797
|
+
borderRadiusCardMd: TokenValue;
|
|
772
798
|
borderRadiusListItem: TokenValue;
|
|
773
799
|
borderRadiusDatetimepicker: TokenValue;
|
|
774
800
|
borderFileInput: TokenValue;
|
|
@@ -788,34 +814,67 @@ export declare const getComponentToken: () => {
|
|
|
788
814
|
fontFamilySecondaryRegular: TokenValue;
|
|
789
815
|
fontFamilySecondarySemiBold: TokenValue;
|
|
790
816
|
};
|
|
791
|
-
|
|
817
|
+
/**
|
|
818
|
+
* token 全局管理器
|
|
819
|
+
* @property {TokenRef} tokenRef - token引用对象
|
|
820
|
+
* @property {Function} tokenKey - 获取组件token值
|
|
821
|
+
* @property {Function} designTokenKey - 获取设计token值
|
|
822
|
+
* @property {Function} setTokenRef - 设置token引用
|
|
823
|
+
* @property {Function} getComponentToken - 获取组件token配置
|
|
824
|
+
* @property {Function} loadExternalToken - 加载外部token 动态注入
|
|
825
|
+
*/
|
|
826
|
+
declare const tokenManager: {
|
|
792
827
|
tokenRef: TokenRef;
|
|
793
828
|
tokenKey: (key: string) => any;
|
|
794
829
|
designTokenKey: (key: string | number) => string | number | true | ShadowStyle;
|
|
795
830
|
setTokenRef: (value: Record<string, TokenValue>) => void;
|
|
796
831
|
getComponentToken: () => {
|
|
832
|
+
colorTagTextGreen: TokenValue;
|
|
833
|
+
colorTagTextYellow: TokenValue;
|
|
834
|
+
colorTagTextGrey: TokenValue;
|
|
835
|
+
colorTagTextRed: TokenValue;
|
|
836
|
+
colorTagTextOrange: TokenValue;
|
|
837
|
+
colorTagTextLakeBlue: TokenValue;
|
|
838
|
+
colorTagBackGroundPrimaryLight: TokenValue;
|
|
839
|
+
colorTagBackGroundSecondaryLight: TokenValue;
|
|
840
|
+
colorTagBackGroundGreen: TokenValue;
|
|
841
|
+
colorTagBackGroundYellow: TokenValue;
|
|
842
|
+
colorTagBackGroundGrey: TokenValue;
|
|
843
|
+
colorTagBackGroundRed: TokenValue;
|
|
844
|
+
colorTagBackGroundOrange: TokenValue;
|
|
845
|
+
colorTagBackGroundLakeBlue: TokenValue;
|
|
846
|
+
colorTagGreyLight: TokenValue;
|
|
847
|
+
colorTagRedLight: TokenValue;
|
|
848
|
+
colorTagYellowLight: TokenValue;
|
|
849
|
+
colorTagGreenLight: TokenValue;
|
|
850
|
+
colorTagOrangeLight: TokenValue;
|
|
851
|
+
colorTagLakeBlueLight: TokenValue;
|
|
852
|
+
colorTextAmount: TokenValue;
|
|
853
|
+
fontSizeMobileContentC23: TokenValue;
|
|
854
|
+
fontSizeDesktopContentC23: TokenValue;
|
|
855
|
+
spacingListItemTextVerticalGapMd: TokenValue;
|
|
856
|
+
spacingListItemTextVerticalGapSm: TokenValue;
|
|
857
|
+
colorBackgroundSubtle2: TokenValue;
|
|
858
|
+
colorDividerHorizontal: TokenValue;
|
|
797
859
|
spacinginputpaddingVerticalM: number;
|
|
798
860
|
fontSizeDesktopTitleT23: TokenValue;
|
|
799
861
|
fontSizeDesktopContentC15: TokenValue;
|
|
800
862
|
fontSizeDesktopContentC21: TokenValue;
|
|
801
863
|
fontSizeDesktopTitleT21: TokenValue;
|
|
864
|
+
fontSizeDesktopTitleT12: TokenValue;
|
|
865
|
+
fontSizeDesktopTitleT13: TokenValue;
|
|
866
|
+
fontSizeDesktopTitleT14: TokenValue;
|
|
802
867
|
fontSizeDesktopTitleT15: TokenValue;
|
|
868
|
+
fontSizeDesktopTitleT16: TokenValue;
|
|
803
869
|
fontSizeDesktopContentC13: TokenValue;
|
|
804
870
|
fontSizeDesktopContentC11: TokenValue;
|
|
805
871
|
fontSizeDesktopContentC12: TokenValue;
|
|
806
872
|
fontSizeDesktopContentC14: TokenValue;
|
|
807
|
-
|
|
873
|
+
fontSizeDesktopTitleT34: TokenValue;
|
|
808
874
|
fontSizeDesktopTitleT32: TokenValue;
|
|
809
875
|
fontSizeDesktopTitleT41: TokenValue;
|
|
810
876
|
fontSizeDesktopContentC05: TokenValue;
|
|
811
877
|
fontSizeDesktopContentC04: TokenValue;
|
|
812
|
-
fontSizeDesktopTitleT7: TokenValue;
|
|
813
|
-
fontSizeDesktopTitleT8: TokenValue;
|
|
814
|
-
fontSizeDesktopTitleT2: TokenValue;
|
|
815
|
-
fontSizeDesktopTitleT5: TokenValue;
|
|
816
|
-
fontSizeDesktopTitleT3: TokenValue;
|
|
817
|
-
fontSizeDesktopTitleT4: TokenValue;
|
|
818
|
-
fontSizeDesktopTitleT10: TokenValue;
|
|
819
878
|
fontSizeMobileContentC04: TokenValue;
|
|
820
879
|
fontSizeMobileContentC05: TokenValue;
|
|
821
880
|
fontSizeMobileContentC11: TokenValue;
|
|
@@ -1052,6 +1111,7 @@ declare const TokenManager: {
|
|
|
1052
1111
|
spacingNotificationTextLinkPaddingTop: TokenValue;
|
|
1053
1112
|
spacingTopNavigationPaddingHorizontal: TokenValue;
|
|
1054
1113
|
spacingTopNavigationPaddingBottom: TokenValue;
|
|
1114
|
+
spacingTopNavigationPaddingTop: TokenValue;
|
|
1055
1115
|
spacingTopNavigationHorizontalGap: TokenValue;
|
|
1056
1116
|
spacingTopNavigationIconButtonHorizontalGap: TokenValue;
|
|
1057
1117
|
spacingTopNavigationTextLinkPaddingRight: TokenValue;
|
|
@@ -1365,7 +1425,7 @@ declare const TokenManager: {
|
|
|
1365
1425
|
colorNumberedListText: TokenValue;
|
|
1366
1426
|
colorTopNavigationTitleStandard: TokenValue;
|
|
1367
1427
|
colorTopNavigationTitleInverse: TokenValue;
|
|
1368
|
-
colorTopNavigationGradient:
|
|
1428
|
+
colorTopNavigationGradient: string;
|
|
1369
1429
|
colorTopNavigationBackground: TokenValue;
|
|
1370
1430
|
colorTopNavigationBackgroundHaze: TokenValue;
|
|
1371
1431
|
colorTopNavigationBackgroundInverse: TokenValue;
|
|
@@ -1549,6 +1609,7 @@ declare const TokenManager: {
|
|
|
1549
1609
|
borderRadiusVoucher: TokenValue;
|
|
1550
1610
|
borderRadiusChip: TokenValue;
|
|
1551
1611
|
borderRadiusCardSm: TokenValue;
|
|
1612
|
+
borderRadiusCardMd: TokenValue;
|
|
1552
1613
|
borderRadiusListItem: TokenValue;
|
|
1553
1614
|
borderRadiusDatetimepicker: TokenValue;
|
|
1554
1615
|
borderFileInput: TokenValue;
|
|
@@ -1568,5 +1629,6 @@ declare const TokenManager: {
|
|
|
1568
1629
|
fontFamilySecondaryRegular: TokenValue;
|
|
1569
1630
|
fontFamilySecondarySemiBold: TokenValue;
|
|
1570
1631
|
};
|
|
1632
|
+
loadExternalToken: (externalToken: Record<string, TokenValue>) => boolean;
|
|
1571
1633
|
};
|
|
1572
|
-
export default
|
|
1634
|
+
export default tokenManager;
|