@arcblock/ux 2.10.71 → 2.10.73

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.
@@ -20,7 +20,7 @@ interface LocaleProviderProps {
20
20
  export interface LocaleContextType {
21
21
  locale: Locale;
22
22
  changeLocale: (locale: Locale) => void;
23
- t: (key: string, data?: Record<string, string>) => string;
23
+ t: (key: string, data?: Record<string, string | number>) => string;
24
24
  languages: {
25
25
  code: string;
26
26
  name: string;
@@ -1,22 +1,17 @@
1
- export interface SparklineProps {
2
- svg: SVGElement;
3
- entries?: number[] | {
1
+ export default function sparkline(svg: SVGElement, rawEntries?: number[] | {
2
+ value: number;
3
+ }[], options?: {
4
+ fetch?: (entry: {
4
5
  value: number;
5
- }[];
6
- options?: {
7
- fetch?: (entry: {
8
- value: number;
9
- }) => number;
10
- interactive?: boolean;
11
- onmousemove?: (event: MouseEvent, currentDataPoint: {
12
- value: number;
13
- index: number;
14
- x: number;
15
- y: number;
16
- }) => void;
17
- onmouseout?: (event: MouseEvent) => void;
18
- spotRadius?: number;
19
- cursorWidth?: number;
20
- };
21
- }
22
- export default function sparkline({ svg, entries: _entries, options }: SparklineProps): void;
6
+ }) => number;
7
+ interactive?: boolean;
8
+ onmousemove?: (event: MouseEvent, currentDataPoint: {
9
+ value: number;
10
+ index: number;
11
+ x: number;
12
+ y: number;
13
+ }) => void;
14
+ onmouseout?: (event: MouseEvent) => void;
15
+ spotRadius?: number;
16
+ cursorWidth?: number;
17
+ }): void;
@@ -17,24 +17,20 @@ function buildElement(tag, attrs) {
17
17
  }
18
18
  return element;
19
19
  }
20
- export default function sparkline({
21
- svg,
22
- entries: _entries = [],
23
- options = {}
24
- }) {
20
+ export default function sparkline(svg, rawEntries = [], options = {}) {
25
21
  removeChildren(svg);
26
- if (_entries.length <= 1) {
22
+ if (rawEntries.length <= 1) {
27
23
  return;
28
24
  }
29
25
  let entries = [];
30
- if (typeof _entries[0] === 'number') {
31
- entries = _entries.map(entry => {
26
+ if (typeof rawEntries[0] === 'number') {
27
+ entries = rawEntries.map(entry => {
32
28
  return {
33
29
  value: entry
34
30
  };
35
31
  });
36
32
  } else {
37
- entries = _entries;
33
+ entries = rawEntries;
38
34
  }
39
35
 
40
36
  // This function will be called whenever the mouse moves
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "2.10.71",
3
+ "version": "2.10.73",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -67,12 +67,12 @@
67
67
  "react": ">=18.2.0",
68
68
  "react-router-dom": ">=6.22.3"
69
69
  },
70
- "gitHead": "65592faac533183e4e94e2e1f17eeb3852e2085f",
70
+ "gitHead": "ab1e258ff3ddcabdef0512d52baa75a5ad43a5ec",
71
71
  "dependencies": {
72
72
  "@arcblock/did-motif": "^1.1.13",
73
- "@arcblock/icons": "^2.10.71",
74
- "@arcblock/nft-display": "^2.10.71",
75
- "@arcblock/react-hooks": "^2.10.71",
73
+ "@arcblock/icons": "^2.10.73",
74
+ "@arcblock/nft-display": "^2.10.73",
75
+ "@arcblock/react-hooks": "^2.10.73",
76
76
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
77
77
  "@fontsource/inter": "^5.0.16",
78
78
  "@fontsource/ubuntu-mono": "^5.0.18",
@@ -74,7 +74,7 @@ interface LocaleProviderProps {
74
74
  export interface LocaleContextType {
75
75
  locale: Locale;
76
76
  changeLocale: (locale: Locale) => void;
77
- t: (key: string, data?: Record<string, string>) => string;
77
+ t: (key: string, data?: Record<string, string | number>) => string;
78
78
  languages: { code: string; name: string }[];
79
79
  }
80
80
 
@@ -22,33 +22,31 @@ function buildElement(tag: string, attrs: Record<string, any>) {
22
22
  return element;
23
23
  }
24
24
 
25
- export interface SparklineProps {
26
- svg: SVGElement;
27
- entries?: number[] | { value: number }[];
28
- options?: {
25
+ export default function sparkline(
26
+ svg: SVGElement,
27
+ rawEntries: number[] | { value: number }[] = [],
28
+ options: {
29
29
  fetch?: (entry: { value: number }) => number;
30
30
  interactive?: boolean;
31
31
  onmousemove?: (event: MouseEvent, currentDataPoint: { value: number; index: number; x: number; y: number }) => void;
32
32
  onmouseout?: (event: MouseEvent) => void;
33
33
  spotRadius?: number;
34
34
  cursorWidth?: number;
35
- };
36
- }
37
-
38
- export default function sparkline({ svg, entries: _entries = [], options = {} }: SparklineProps) {
35
+ } = {}
36
+ ) {
39
37
  removeChildren(svg);
40
38
 
41
- if (_entries.length <= 1) {
39
+ if (rawEntries.length <= 1) {
42
40
  return;
43
41
  }
44
42
 
45
43
  let entries: { value: number }[] = [];
46
- if (typeof _entries[0] === 'number') {
47
- entries = (_entries as number[]).map((entry) => {
44
+ if (typeof rawEntries[0] === 'number') {
45
+ entries = (rawEntries as number[]).map((entry) => {
48
46
  return { value: entry };
49
47
  });
50
48
  } else {
51
- entries = _entries as typeof entries;
49
+ entries = rawEntries as typeof entries;
52
50
  }
53
51
 
54
52
  // This function will be called whenever the mouse moves