@easy-editor/materials-dashboard-number-flip 0.0.2 → 0.0.4

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.
@@ -1,167 +0,0 @@
1
- /* @easy-editor/materials-dashboard-statistic-number v0.0.1 (component, esm) */
2
- import { jsxs, jsx } from 'react/jsx-runtime';
3
-
4
- function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
5
-
6
- function cn(...inputs) {
7
- return clsx(inputs);
8
- }
9
-
10
- function styleInject(css, ref) {
11
- if (ref === void 0) ref = {};
12
- var insertAt = ref.insertAt;
13
- if (typeof document === 'undefined') {
14
- return;
15
- }
16
- var head = document.head || document.getElementsByTagName('head')[0];
17
- var style = document.createElement('style');
18
- style.type = 'text/css';
19
- if (insertAt === 'top') {
20
- if (head.firstChild) {
21
- head.insertBefore(style, head.firstChild);
22
- } else {
23
- head.appendChild(style);
24
- }
25
- } else {
26
- head.appendChild(style);
27
- }
28
- if (style.styleSheet) {
29
- style.styleSheet.cssText = css;
30
- } else {
31
- style.appendChild(document.createTextNode(css));
32
- }
33
- }
34
-
35
- var css_248z = ".component-module__container___VbZSk{align-items:center;box-sizing:border-box;display:flex;flex-direction:column;gap:8px;height:100%;justify-content:center;width:100%}.component-module__content___344U8{align-items:baseline;display:flex;gap:4px}.component-module__prefix___RIPOo{font-weight:600;opacity:.8}.component-module__prefixDigital___Q-IGu{font-family:Courier New,Courier,monospace}.component-module__value___Fg70k{font-weight:700}.component-module__valueDigital___saOYz{font-family:Courier New,Courier,monospace;letter-spacing:.05em}.component-module__suffix___9U3yv{font-weight:500;margin-left:4px;opacity:.7}.component-module__suffixDigital___WiYn4{font-family:Courier New,Courier,monospace}.component-module__trend___fgbi4{align-items:center;display:flex;font-weight:500;gap:4px}";
36
- var styles = {"container":"component-module__container___VbZSk","content":"component-module__content___344U8","prefix":"component-module__prefix___RIPOo","prefixDigital":"component-module__prefixDigital___Q-IGu","value":"component-module__value___Fg70k","valueDigital":"component-module__valueDigital___saOYz","suffix":"component-module__suffix___9U3yv","suffixDigital":"component-module__suffixDigital___WiYn4","trend":"component-module__trend___fgbi4"};
37
- styleInject(css_248z);
38
-
39
- /**
40
- * Number Flip Component
41
- * 数字翻牌组件 - 用于展示 KPI、统计数字等
42
- */
43
-
44
- const formatNumber = (value, decimals, separator) => {
45
- const fixed = value.toFixed(decimals);
46
- if (!separator) {
47
- return fixed;
48
- }
49
- const [intPart, decPart] = fixed.split('.');
50
- const formattedInt = intPart.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
51
- return decPart ? `${formattedInt}.${decPart}` : formattedInt;
52
- };
53
- const TrendIndicator = ({
54
- type,
55
- value,
56
- suffix,
57
- upColor,
58
- downColor,
59
- size
60
- }) => {
61
- let color = '#8899aa';
62
- if (type === 'up') {
63
- color = upColor;
64
- } else if (type === 'down') {
65
- color = downColor;
66
- }
67
- return /*#__PURE__*/jsxs("div", {
68
- className: styles.trend,
69
- style: {
70
- fontSize: size * 0.35
71
- },
72
- children: [type !== 'flat' && /*#__PURE__*/jsxs("svg", {
73
- "aria-label": `Trend ${type}`,
74
- fill: "none",
75
- height: size * 0.3,
76
- role: "img",
77
- style: {
78
- transform: type === 'down' ? 'rotate(180deg)' : undefined
79
- },
80
- viewBox: "0 0 24 24",
81
- width: size * 0.3,
82
- children: [/*#__PURE__*/jsxs("title", {
83
- children: ["Trend arrow ", type]
84
- }), /*#__PURE__*/jsx("path", {
85
- d: "M12 4L20 14H4L12 4Z",
86
- fill: color
87
- })]
88
- }), type === 'flat' && /*#__PURE__*/jsx("span", {
89
- style: {
90
- color,
91
- marginRight: 4
92
- },
93
- children: "\u2014"
94
- }), /*#__PURE__*/jsxs("span", {
95
- style: {
96
- color
97
- },
98
- children: [value, suffix]
99
- })]
100
- });
101
- };
102
- const NumberFlip = ({
103
- ref,
104
- value = 0,
105
- decimals = 0,
106
- separator = true,
107
- prefix = '',
108
- suffix = '',
109
- fontSize = 48,
110
- fontFamily = 'digital',
111
- color = '#00d4ff',
112
- glowIntensity = 0.5,
113
- trendEnable = false,
114
- trendValue = 0,
115
- trendType = 'up',
116
- trendSuffix = '%',
117
- trendUpColor = '#52c41a',
118
- trendDownColor = '#ff4d4f',
119
- style: externalStyle
120
- }) => {
121
- const isDigital = fontFamily === 'digital';
122
- const formattedValue = formatNumber(value, decimals, separator);
123
-
124
- // 计算发光效果的 text-shadow
125
- const glowShadow = glowIntensity > 0 ? `0 0 ${10 * glowIntensity}px ${color}, 0 0 ${20 * glowIntensity}px ${color}40, 0 0 ${30 * glowIntensity}px ${color}20` : 'none';
126
- return /*#__PURE__*/jsxs("div", {
127
- className: styles.container,
128
- ref: ref,
129
- style: externalStyle,
130
- children: [/*#__PURE__*/jsxs("div", {
131
- className: styles.content,
132
- children: [prefix ? /*#__PURE__*/jsx("span", {
133
- className: cn(styles.prefix, isDigital && styles.prefixDigital),
134
- style: {
135
- fontSize: `${fontSize * 0.5}px`,
136
- color
137
- },
138
- children: prefix
139
- }) : null, /*#__PURE__*/jsx("span", {
140
- className: cn(styles.value, isDigital && styles.valueDigital),
141
- style: {
142
- fontSize: `${fontSize}px`,
143
- color,
144
- textShadow: glowShadow
145
- },
146
- children: formattedValue
147
- }), suffix ? /*#__PURE__*/jsx("span", {
148
- className: cn(styles.suffix, isDigital && styles.suffixDigital),
149
- style: {
150
- fontSize: `${fontSize * 0.4}px`,
151
- color
152
- },
153
- children: suffix
154
- }) : null]
155
- }), trendEnable ? /*#__PURE__*/jsx(TrendIndicator, {
156
- downColor: trendDownColor,
157
- size: fontSize,
158
- suffix: trendSuffix,
159
- type: trendType,
160
- upColor: trendUpColor,
161
- value: trendValue
162
- }) : null]
163
- });
164
- };
165
-
166
- export { NumberFlip, NumberFlip as default };
167
- //# sourceMappingURL=component.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"component.esm.js","sources":["../../../../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs","../../../../shared/src/lib/utils.ts","../../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../src/component.tsx"],"sourcesContent":["function r(e){var t,f,n=\"\";if(\"string\"==typeof e||\"number\"==typeof e)n+=e;else if(\"object\"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=\" \"),n+=f)}else for(f in e)e[f]&&(n&&(n+=\" \"),n+=f);return n}export function clsx(){for(var e,t,f=0,n=\"\",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=\" \"),n+=t);return n}export default clsx;","import { clsx, type ClassValue } from 'clsx'\n\nexport function cn(...inputs: ClassValue[]) {\n return clsx(inputs)\n}\n","function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","/**\n * Number Flip Component\n * 数字翻牌组件 - 用于展示 KPI、统计数字等\n */\n\nimport type { CSSProperties, Ref } from 'react'\nimport { cn } from '@easy-editor/materials-shared'\nimport styles from './component.module.css'\n\nexport type TrendType = 'up' | 'down' | 'flat'\n\nexport interface NumberFlipProps {\n ref?: Ref<HTMLDivElement>\n /** 数值 */\n value?: number\n /** 小数位数 */\n decimals?: number\n /** 是否显示千分位分隔符 */\n separator?: boolean\n /** 前缀 */\n prefix?: string\n /** 后缀 */\n suffix?: string\n /** 字体大小 */\n fontSize?: number\n /** 字体类型 */\n fontFamily?: 'digital' | 'default'\n /** 颜色 */\n color?: string\n /** 发光强度 (0-2) */\n glowIntensity?: number\n /** 是否显示趋势 */\n trendEnable?: boolean\n /** 趋势值 */\n trendValue?: number\n /** 趋势类型 */\n trendType?: TrendType\n /** 趋势后缀 */\n trendSuffix?: string\n /** 趋势上升颜色 */\n trendUpColor?: string\n /** 趋势下降颜色 */\n trendDownColor?: string\n /** 外部样式 */\n style?: CSSProperties\n}\n\nconst formatNumber = (value: number, decimals: number, separator: boolean): string => {\n const fixed = value.toFixed(decimals)\n if (!separator) {\n return fixed\n }\n\n const [intPart, decPart] = fixed.split('.')\n const formattedInt = intPart.replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',')\n return decPart ? `${formattedInt}.${decPart}` : formattedInt\n}\n\nconst TrendIndicator: React.FC<{\n type: TrendType\n value: number\n suffix: string\n upColor: string\n downColor: string\n size: number\n}> = ({ type, value, suffix, upColor, downColor, size }) => {\n let color = '#8899aa'\n if (type === 'up') {\n color = upColor\n } else if (type === 'down') {\n color = downColor\n }\n\n return (\n <div className={styles.trend} style={{ fontSize: size * 0.35 }}>\n {type !== 'flat' && (\n <svg\n aria-label={`Trend ${type}`}\n fill='none'\n height={size * 0.3}\n role='img'\n style={{\n transform: type === 'down' ? 'rotate(180deg)' : undefined,\n }}\n viewBox='0 0 24 24'\n width={size * 0.3}\n >\n <title>Trend arrow {type}</title>\n <path d='M12 4L20 14H4L12 4Z' fill={color} />\n </svg>\n )}\n {type === 'flat' && <span style={{ color, marginRight: 4 }}>—</span>}\n <span style={{ color }}>\n {value}\n {suffix}\n </span>\n </div>\n )\n}\n\nexport const NumberFlip: React.FC<NumberFlipProps> = ({\n ref,\n value = 0,\n decimals = 0,\n separator = true,\n prefix = '',\n suffix = '',\n fontSize = 48,\n fontFamily = 'digital',\n color = '#00d4ff',\n glowIntensity = 0.5,\n trendEnable = false,\n trendValue = 0,\n trendType = 'up',\n trendSuffix = '%',\n trendUpColor = '#52c41a',\n trendDownColor = '#ff4d4f',\n style: externalStyle,\n}) => {\n const isDigital = fontFamily === 'digital'\n const formattedValue = formatNumber(value, decimals, separator)\n\n // 计算发光效果的 text-shadow\n const glowShadow =\n glowIntensity > 0\n ? `0 0 ${10 * glowIntensity}px ${color}, 0 0 ${20 * glowIntensity}px ${color}40, 0 0 ${30 * glowIntensity}px ${color}20`\n : 'none'\n\n return (\n <div className={styles.container} ref={ref} style={externalStyle}>\n <div className={styles.content}>\n {prefix ? (\n <span\n className={cn(styles.prefix, isDigital && styles.prefixDigital)}\n style={{\n fontSize: `${fontSize * 0.5}px`,\n color,\n }}\n >\n {prefix}\n </span>\n ) : null}\n <span\n className={cn(styles.value, isDigital && styles.valueDigital)}\n style={{\n fontSize: `${fontSize}px`,\n color,\n textShadow: glowShadow,\n }}\n >\n {formattedValue}\n </span>\n {suffix ? (\n <span\n className={cn(styles.suffix, isDigital && styles.suffixDigital)}\n style={{\n fontSize: `${fontSize * 0.4}px`,\n color,\n }}\n >\n {suffix}\n </span>\n ) : null}\n </div>\n {trendEnable ? (\n <TrendIndicator\n downColor={trendDownColor}\n size={fontSize}\n suffix={trendSuffix}\n type={trendType}\n upColor={trendUpColor}\n value={trendValue}\n />\n ) : null}\n </div>\n )\n}\n\nexport default NumberFlip\n"],"names":["cn","inputs","clsx","styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","formatNumber","value","decimals","separator","fixed","toFixed","intPart","decPart","split","formattedInt","replace","TrendIndicator","suffix","upColor","downColor","size","color","_jsxs","className","styles","trend","fontSize","children","fill","height","role","transform","undefined","viewBox","width","_jsx","d","marginRight","NumberFlip","prefix","fontFamily","glowIntensity","trendEnable","trendValue","trendType","trendSuffix","trendUpColor","trendDownColor","externalStyle","isDigital","formattedValue","glowShadow","container","content","prefixDigital","valueDigital","textShadow","suffixDigital"],"mappings":";;;AAAA,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,QAAQ,EAAE,OAAO,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,GAAG,QAAQ,EAAE,OAAO,CAAC,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAC,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAQ,SAAS,IAAI,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;;ACExW,SAASA,EAAEA,CAAC,GAAGC,MAAoB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AAAA,QAAA,EAEDuB;AAAc,OACX,CAAC,EACNjC,MAAM,gBACLkB,GAAA,CAAA,MAAA,EAAA;AACEZ,QAAAA,SAAS,EAAErC,EAAE,CAACsC,MAAM,CAACP,MAAM,EAAEgC,SAAS,IAAIzB,MAAM,CAACiC,aAAa,CAAE;AAChE7D,QAAAA,KAAK,EAAE;AACL8B,UAAAA,QAAQ,EAAE,CAAA,EAAGA,QAAQ,GAAG,GAAG,CAAA,EAAA,CAAI;AAC/BL,UAAAA;SACA;AAAAM,QAAAA,QAAA,EAEDV;OACG,CAAC,GACL,IAAI;AAAA,KACL,CAAC,EACLyB,WAAW,gBACVP,GAAA,CAACnB,cAAc,EAAA;AACbG,MAAAA,SAAS,EAAE4B,cAAe;AAC1B3B,MAAAA,IAAI,EAAEM,QAAS;AACfT,MAAAA,MAAM,EAAE4B,WAAY;AACpB/C,MAAAA,IAAI,EAAE8C,SAAU;AAChB1B,MAAAA,OAAO,EAAE4B,YAAa;AACtBxC,MAAAA,KAAK,EAAEqC;KACR,CAAC,GACA,IAAI;AAAA,GACL,CAAC;AAEV;;;;","x_google_ignoreList":[0,2]}
package/dist/component.js DELETED
@@ -1,176 +0,0 @@
1
- /* @easy-editor/materials-dashboard-statistic-number v0.0.1 (component) */
2
- (function (global, factory) {
3
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime')) :
4
- typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime'], factory) :
5
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.EasyEditorMaterialsStatisticNumberComponent = {}, global.jsxRuntime));
6
- })(this, (function (exports, jsxRuntime) { 'use strict';
7
-
8
- function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
9
-
10
- function cn(...inputs) {
11
- return clsx(inputs);
12
- }
13
-
14
- function styleInject(css, ref) {
15
- if (ref === void 0) ref = {};
16
- var insertAt = ref.insertAt;
17
- if (typeof document === 'undefined') {
18
- return;
19
- }
20
- var head = document.head || document.getElementsByTagName('head')[0];
21
- var style = document.createElement('style');
22
- style.type = 'text/css';
23
- if (insertAt === 'top') {
24
- if (head.firstChild) {
25
- head.insertBefore(style, head.firstChild);
26
- } else {
27
- head.appendChild(style);
28
- }
29
- } else {
30
- head.appendChild(style);
31
- }
32
- if (style.styleSheet) {
33
- style.styleSheet.cssText = css;
34
- } else {
35
- style.appendChild(document.createTextNode(css));
36
- }
37
- }
38
-
39
- var css_248z = ".component-module__container___VbZSk{align-items:center;box-sizing:border-box;display:flex;flex-direction:column;gap:8px;height:100%;justify-content:center;width:100%}.component-module__content___344U8{align-items:baseline;display:flex;gap:4px}.component-module__prefix___RIPOo{font-weight:600;opacity:.8}.component-module__prefixDigital___Q-IGu{font-family:Courier New,Courier,monospace}.component-module__value___Fg70k{font-weight:700}.component-module__valueDigital___saOYz{font-family:Courier New,Courier,monospace;letter-spacing:.05em}.component-module__suffix___9U3yv{font-weight:500;margin-left:4px;opacity:.7}.component-module__suffixDigital___WiYn4{font-family:Courier New,Courier,monospace}.component-module__trend___fgbi4{align-items:center;display:flex;font-weight:500;gap:4px}";
40
- var styles = {"container":"component-module__container___VbZSk","content":"component-module__content___344U8","prefix":"component-module__prefix___RIPOo","prefixDigital":"component-module__prefixDigital___Q-IGu","value":"component-module__value___Fg70k","valueDigital":"component-module__valueDigital___saOYz","suffix":"component-module__suffix___9U3yv","suffixDigital":"component-module__suffixDigital___WiYn4","trend":"component-module__trend___fgbi4"};
41
- styleInject(css_248z);
42
-
43
- /**
44
- * Number Flip Component
45
- * 数字翻牌组件 - 用于展示 KPI、统计数字等
46
- */
47
-
48
- const formatNumber = (value, decimals, separator) => {
49
- const fixed = value.toFixed(decimals);
50
- if (!separator) {
51
- return fixed;
52
- }
53
- const [intPart, decPart] = fixed.split('.');
54
- const formattedInt = intPart.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
55
- return decPart ? `${formattedInt}.${decPart}` : formattedInt;
56
- };
57
- const TrendIndicator = ({
58
- type,
59
- value,
60
- suffix,
61
- upColor,
62
- downColor,
63
- size
64
- }) => {
65
- let color = '#8899aa';
66
- if (type === 'up') {
67
- color = upColor;
68
- } else if (type === 'down') {
69
- color = downColor;
70
- }
71
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
72
- className: styles.trend,
73
- style: {
74
- fontSize: size * 0.35
75
- },
76
- children: [type !== 'flat' && /*#__PURE__*/jsxRuntime.jsxs("svg", {
77
- "aria-label": `Trend ${type}`,
78
- fill: "none",
79
- height: size * 0.3,
80
- role: "img",
81
- style: {
82
- transform: type === 'down' ? 'rotate(180deg)' : undefined
83
- },
84
- viewBox: "0 0 24 24",
85
- width: size * 0.3,
86
- children: [/*#__PURE__*/jsxRuntime.jsxs("title", {
87
- children: ["Trend arrow ", type]
88
- }), /*#__PURE__*/jsxRuntime.jsx("path", {
89
- d: "M12 4L20 14H4L12 4Z",
90
- fill: color
91
- })]
92
- }), type === 'flat' && /*#__PURE__*/jsxRuntime.jsx("span", {
93
- style: {
94
- color,
95
- marginRight: 4
96
- },
97
- children: "\u2014"
98
- }), /*#__PURE__*/jsxRuntime.jsxs("span", {
99
- style: {
100
- color
101
- },
102
- children: [value, suffix]
103
- })]
104
- });
105
- };
106
- const NumberFlip = ({
107
- ref,
108
- value = 0,
109
- decimals = 0,
110
- separator = true,
111
- prefix = '',
112
- suffix = '',
113
- fontSize = 48,
114
- fontFamily = 'digital',
115
- color = '#00d4ff',
116
- glowIntensity = 0.5,
117
- trendEnable = false,
118
- trendValue = 0,
119
- trendType = 'up',
120
- trendSuffix = '%',
121
- trendUpColor = '#52c41a',
122
- trendDownColor = '#ff4d4f',
123
- style: externalStyle
124
- }) => {
125
- const isDigital = fontFamily === 'digital';
126
- const formattedValue = formatNumber(value, decimals, separator);
127
-
128
- // 计算发光效果的 text-shadow
129
- const glowShadow = glowIntensity > 0 ? `0 0 ${10 * glowIntensity}px ${color}, 0 0 ${20 * glowIntensity}px ${color}40, 0 0 ${30 * glowIntensity}px ${color}20` : 'none';
130
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
131
- className: styles.container,
132
- ref: ref,
133
- style: externalStyle,
134
- children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
135
- className: styles.content,
136
- children: [prefix ? /*#__PURE__*/jsxRuntime.jsx("span", {
137
- className: cn(styles.prefix, isDigital && styles.prefixDigital),
138
- style: {
139
- fontSize: `${fontSize * 0.5}px`,
140
- color
141
- },
142
- children: prefix
143
- }) : null, /*#__PURE__*/jsxRuntime.jsx("span", {
144
- className: cn(styles.value, isDigital && styles.valueDigital),
145
- style: {
146
- fontSize: `${fontSize}px`,
147
- color,
148
- textShadow: glowShadow
149
- },
150
- children: formattedValue
151
- }), suffix ? /*#__PURE__*/jsxRuntime.jsx("span", {
152
- className: cn(styles.suffix, isDigital && styles.suffixDigital),
153
- style: {
154
- fontSize: `${fontSize * 0.4}px`,
155
- color
156
- },
157
- children: suffix
158
- }) : null]
159
- }), trendEnable ? /*#__PURE__*/jsxRuntime.jsx(TrendIndicator, {
160
- downColor: trendDownColor,
161
- size: fontSize,
162
- suffix: trendSuffix,
163
- type: trendType,
164
- upColor: trendUpColor,
165
- value: trendValue
166
- }) : null]
167
- });
168
- };
169
-
170
- exports.NumberFlip = NumberFlip;
171
- exports.default = NumberFlip;
172
-
173
- Object.defineProperty(exports, '__esModule', { value: true });
174
-
175
- }));
176
- //# sourceMappingURL=component.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"component.js","sources":["../../../../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs","../../../../shared/src/lib/utils.ts","../../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../src/component.tsx"],"sourcesContent":["function r(e){var t,f,n=\"\";if(\"string\"==typeof e||\"number\"==typeof e)n+=e;else if(\"object\"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=\" \"),n+=f)}else for(f in e)e[f]&&(n&&(n+=\" \"),n+=f);return n}export function clsx(){for(var e,t,f=0,n=\"\",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=\" \"),n+=t);return n}export default clsx;","import { clsx, type ClassValue } from 'clsx'\n\nexport function cn(...inputs: ClassValue[]) {\n return clsx(inputs)\n}\n","function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","/**\n * Number Flip Component\n * 数字翻牌组件 - 用于展示 KPI、统计数字等\n */\n\nimport type { CSSProperties, Ref } from 'react'\nimport { cn } from '@easy-editor/materials-shared'\nimport styles from './component.module.css'\n\nexport type TrendType = 'up' | 'down' | 'flat'\n\nexport interface NumberFlipProps {\n ref?: Ref<HTMLDivElement>\n /** 数值 */\n value?: number\n /** 小数位数 */\n decimals?: number\n /** 是否显示千分位分隔符 */\n separator?: boolean\n /** 前缀 */\n prefix?: string\n /** 后缀 */\n suffix?: string\n /** 字体大小 */\n fontSize?: number\n /** 字体类型 */\n fontFamily?: 'digital' | 'default'\n /** 颜色 */\n color?: string\n /** 发光强度 (0-2) */\n glowIntensity?: number\n /** 是否显示趋势 */\n trendEnable?: boolean\n /** 趋势值 */\n trendValue?: number\n /** 趋势类型 */\n trendType?: TrendType\n /** 趋势后缀 */\n trendSuffix?: string\n /** 趋势上升颜色 */\n trendUpColor?: string\n /** 趋势下降颜色 */\n trendDownColor?: string\n /** 外部样式 */\n style?: CSSProperties\n}\n\nconst formatNumber = (value: number, decimals: number, separator: boolean): string => {\n const fixed = value.toFixed(decimals)\n if (!separator) {\n return fixed\n }\n\n const [intPart, decPart] = fixed.split('.')\n const formattedInt = intPart.replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',')\n return decPart ? `${formattedInt}.${decPart}` : formattedInt\n}\n\nconst TrendIndicator: React.FC<{\n type: TrendType\n value: number\n suffix: string\n upColor: string\n downColor: string\n size: number\n}> = ({ type, value, suffix, upColor, downColor, size }) => {\n let color = '#8899aa'\n if (type === 'up') {\n color = upColor\n } else if (type === 'down') {\n color = downColor\n }\n\n return (\n <div className={styles.trend} style={{ fontSize: size * 0.35 }}>\n {type !== 'flat' && (\n <svg\n aria-label={`Trend ${type}`}\n fill='none'\n height={size * 0.3}\n role='img'\n style={{\n transform: type === 'down' ? 'rotate(180deg)' : undefined,\n }}\n viewBox='0 0 24 24'\n width={size * 0.3}\n >\n <title>Trend arrow {type}</title>\n <path d='M12 4L20 14H4L12 4Z' fill={color} />\n </svg>\n )}\n {type === 'flat' && <span style={{ color, marginRight: 4 }}>—</span>}\n <span style={{ color }}>\n {value}\n {suffix}\n </span>\n </div>\n )\n}\n\nexport const NumberFlip: React.FC<NumberFlipProps> = ({\n ref,\n value = 0,\n decimals = 0,\n separator = true,\n prefix = '',\n suffix = '',\n fontSize = 48,\n fontFamily = 'digital',\n color = '#00d4ff',\n glowIntensity = 0.5,\n trendEnable = false,\n trendValue = 0,\n trendType = 'up',\n trendSuffix = '%',\n trendUpColor = '#52c41a',\n trendDownColor = '#ff4d4f',\n style: externalStyle,\n}) => {\n const isDigital = fontFamily === 'digital'\n const formattedValue = formatNumber(value, decimals, separator)\n\n // 计算发光效果的 text-shadow\n const glowShadow =\n glowIntensity > 0\n ? `0 0 ${10 * glowIntensity}px ${color}, 0 0 ${20 * glowIntensity}px ${color}40, 0 0 ${30 * glowIntensity}px ${color}20`\n : 'none'\n\n return (\n <div className={styles.container} ref={ref} style={externalStyle}>\n <div className={styles.content}>\n {prefix ? (\n <span\n className={cn(styles.prefix, isDigital && styles.prefixDigital)}\n style={{\n fontSize: `${fontSize * 0.5}px`,\n color,\n }}\n >\n {prefix}\n </span>\n ) : null}\n <span\n className={cn(styles.value, isDigital && styles.valueDigital)}\n style={{\n fontSize: `${fontSize}px`,\n color,\n textShadow: glowShadow,\n }}\n >\n {formattedValue}\n </span>\n {suffix ? (\n <span\n className={cn(styles.suffix, isDigital && styles.suffixDigital)}\n style={{\n fontSize: `${fontSize * 0.4}px`,\n color,\n }}\n >\n {suffix}\n </span>\n ) : null}\n </div>\n {trendEnable ? (\n <TrendIndicator\n downColor={trendDownColor}\n size={fontSize}\n suffix={trendSuffix}\n type={trendType}\n upColor={trendUpColor}\n value={trendValue}\n />\n ) : null}\n </div>\n )\n}\n\nexport default NumberFlip\n"],"names":["cn","inputs","clsx","styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","formatNumber","value","decimals","separator","fixed","toFixed","intPart","decPart","split","formattedInt","replace","TrendIndicator","suffix","upColor","downColor","size","color","_jsxs","className","styles","trend","fontSize","children","fill","height","role","transform","undefined","viewBox","width","_jsx","d","marginRight","NumberFlip","prefix","fontFamily","glowIntensity","trendEnable","trendValue","trendType","trendSuffix","trendUpColor","trendDownColor","externalStyle","isDigital","formattedValue","glowShadow","container","content","prefixDigital","valueDigital","textShadow","suffixDigital"],"mappings":";;;;;;;EAAA,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,QAAQ,EAAE,OAAO,CAAC,EAAE,QAAQ,EAAE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,CAAA,EAAGA,QAAQ,GAAG,GAAG,CAAA,EAAA,CAAI;EAC/BL,UAAAA;WACA;EAAAM,QAAAA,QAAA,EAEDV;SACG,CAAC,GACL,IAAI;EAAA,KACL,CAAC,EACLyB,WAAW,gBACVP,cAAA,CAACnB,cAAc,EAAA;EACbG,MAAAA,SAAS,EAAE4B,cAAe;EAC1B3B,MAAAA,IAAI,EAAEM,QAAS;EACfT,MAAAA,MAAM,EAAE4B,WAAY;EACpB/C,MAAAA,IAAI,EAAE8C,SAAU;EAChB1B,MAAAA,OAAO,EAAE4B,YAAa;EACtBxC,MAAAA,KAAK,EAAEqC;OACR,CAAC,GACA,IAAI;EAAA,GACL,CAAC;EAEV;;;;;;;;;;;","x_google_ignoreList":[0,2]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"component.min.js","sources":["../../../../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs","../../../../shared/src/lib/utils.ts","../../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../src/component.tsx"],"sourcesContent":["function r(e){var t,f,n=\"\";if(\"string\"==typeof e||\"number\"==typeof e)n+=e;else if(\"object\"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=\" \"),n+=f)}else for(f in e)e[f]&&(n&&(n+=\" \"),n+=f);return n}export function clsx(){for(var e,t,f=0,n=\"\",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=\" \"),n+=t);return n}export default clsx;","import { clsx, type ClassValue } from 'clsx'\n\nexport function cn(...inputs: ClassValue[]) {\n return clsx(inputs)\n}\n","function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","/**\n * Number Flip Component\n * 数字翻牌组件 - 用于展示 KPI、统计数字等\n */\n\nimport type { CSSProperties, Ref } from 'react'\nimport { cn } from '@easy-editor/materials-shared'\nimport styles from './component.module.css'\n\nexport type TrendType = 'up' | 'down' | 'flat'\n\nexport interface NumberFlipProps {\n ref?: Ref<HTMLDivElement>\n /** 数值 */\n value?: number\n /** 小数位数 */\n decimals?: number\n /** 是否显示千分位分隔符 */\n separator?: boolean\n /** 前缀 */\n prefix?: string\n /** 后缀 */\n suffix?: string\n /** 字体大小 */\n fontSize?: number\n /** 字体类型 */\n fontFamily?: 'digital' | 'default'\n /** 颜色 */\n color?: string\n /** 发光强度 (0-2) */\n glowIntensity?: number\n /** 是否显示趋势 */\n trendEnable?: boolean\n /** 趋势值 */\n trendValue?: number\n /** 趋势类型 */\n trendType?: TrendType\n /** 趋势后缀 */\n trendSuffix?: string\n /** 趋势上升颜色 */\n trendUpColor?: string\n /** 趋势下降颜色 */\n trendDownColor?: string\n /** 外部样式 */\n style?: CSSProperties\n}\n\nconst formatNumber = (value: number, decimals: number, separator: boolean): string => {\n const fixed = value.toFixed(decimals)\n if (!separator) {\n return fixed\n }\n\n const [intPart, decPart] = fixed.split('.')\n const formattedInt = intPart.replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',')\n return decPart ? `${formattedInt}.${decPart}` : formattedInt\n}\n\nconst TrendIndicator: React.FC<{\n type: TrendType\n value: number\n suffix: string\n upColor: string\n downColor: string\n size: number\n}> = ({ type, value, suffix, upColor, downColor, size }) => {\n let color = '#8899aa'\n if (type === 'up') {\n color = upColor\n } else if (type === 'down') {\n color = downColor\n }\n\n return (\n <div className={styles.trend} style={{ fontSize: size * 0.35 }}>\n {type !== 'flat' && (\n <svg\n aria-label={`Trend ${type}`}\n fill='none'\n height={size * 0.3}\n role='img'\n style={{\n transform: type === 'down' ? 'rotate(180deg)' : undefined,\n }}\n viewBox='0 0 24 24'\n width={size * 0.3}\n >\n <title>Trend arrow {type}</title>\n <path d='M12 4L20 14H4L12 4Z' fill={color} />\n </svg>\n )}\n {type === 'flat' && <span style={{ color, marginRight: 4 }}>—</span>}\n <span style={{ color }}>\n {value}\n {suffix}\n </span>\n </div>\n )\n}\n\nexport const NumberFlip: React.FC<NumberFlipProps> = ({\n ref,\n value = 0,\n decimals = 0,\n separator = true,\n prefix = '',\n suffix = '',\n fontSize = 48,\n fontFamily = 'digital',\n color = '#00d4ff',\n glowIntensity = 0.5,\n trendEnable = false,\n trendValue = 0,\n trendType = 'up',\n trendSuffix = '%',\n trendUpColor = '#52c41a',\n trendDownColor = '#ff4d4f',\n style: externalStyle,\n}) => {\n const isDigital = fontFamily === 'digital'\n const formattedValue = formatNumber(value, decimals, separator)\n\n // 计算发光效果的 text-shadow\n const glowShadow =\n glowIntensity > 0\n ? `0 0 ${10 * glowIntensity}px ${color}, 0 0 ${20 * glowIntensity}px ${color}40, 0 0 ${30 * glowIntensity}px ${color}20`\n : 'none'\n\n return (\n <div className={styles.container} ref={ref} style={externalStyle}>\n <div className={styles.content}>\n {prefix ? (\n <span\n className={cn(styles.prefix, isDigital && styles.prefixDigital)}\n style={{\n fontSize: `${fontSize * 0.5}px`,\n color,\n }}\n >\n {prefix}\n </span>\n ) : null}\n <span\n className={cn(styles.value, isDigital && styles.valueDigital)}\n style={{\n fontSize: `${fontSize}px`,\n color,\n textShadow: glowShadow,\n }}\n >\n {formattedValue}\n </span>\n {suffix ? (\n <span\n className={cn(styles.suffix, isDigital && styles.suffixDigital)}\n style={{\n fontSize: `${fontSize * 0.4}px`,\n color,\n }}\n >\n {suffix}\n </span>\n ) : null}\n </div>\n {trendEnable ? (\n <TrendIndicator\n downColor={trendDownColor}\n size={fontSize}\n suffix={trendSuffix}\n type={trendType}\n upColor={trendUpColor}\n value={trendValue}\n />\n ) : null}\n </div>\n )\n}\n\nexport default NumberFlip\n"],"names":["r","e","t","f","n","Array","isArray","o","length","cn","inputs","arguments","clsx","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","TrendIndicator","value","suffix","upColor","downColor","size","color","_jsxs","className","styles","fontSize","children","fill","height","role","transform","undefined","viewBox","width","_jsx","d","marginRight","NumberFlip","decimals","separator","prefix","fontFamily","glowIntensity","trendEnable","trendValue","trendType","trendSuffix","trendUpColor","trendDownColor","externalStyle","isDigital","formattedValue","formatNumber","fixed","toFixed","intPart","decPart","split","formattedInt","replace","glowShadow","textShadow"],"mappings":"kVAAA,SAASA,EAAEC,GAAG,IAAIC,EAAEC,EAAEC,EAAE,GAAG,GAAG,iBAAiBH,GAAG,iBAAiBA,EAAEG,GAAGH,OAAO,GAAG,iBAAiBA,EAAE,GAAGI,MAAMC,QAAQL,GAAG,CAAC,IAAIM,EAAEN,EAAEO,OAAO,IAAIN,EAAE,EAAEA,EAAEK,EAAEL,IAAID,EAAEC,KAAKC,EAAEH,EAAEC,EAAEC,OAAOE,IAAIA,GAAG,KAAKA,GAAGD,EAAE,MAAM,IAAIA,KAAKF,EAAEA,EAAEE,KAAKC,IAAIA,GAAG,KAAKA,GAAGD,GAAG,OAAOC,CAAC,CCEzO,SAASK,KAAMC,GACpB,ODHsP,WAAgB,IAAI,IAAIT,EAAEC,EAAEC,EAAE,EAAEC,EAAE,GAAGG,EAAEI,UAAUH,OAAOL,EAAEI,EAAEJ,KAAKF,EAAEU,UAAUR,MAAMD,EAAEF,EAAEC,MAAMG,IAAIA,GAAG,KAAKA,GAAGF,GAAG,OAAOE,CAAC,CCGtWQ,CAAKF,EACd,yWCJA,SAAqBG,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAgC,oBAAbC,SAAnB,CAEA,IAAIC,EAAOD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