@arcblock/ux 3.0.4 → 3.0.6
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/lib/Dialog/types.d.ts +20 -0
- package/lib/Tag/index.d.ts +26 -6
- package/lib/Tag/index.js +16 -19
- package/lib/global.d.ts +28 -0
- package/lib/type.d.ts +44 -0
- package/package.json +9 -9
- package/src/Tag/index.jsx +3 -10
- package/vite.config.mjs +1 -1
@@ -0,0 +1,20 @@
|
|
1
|
+
import type { ReactNode } from 'react';
|
2
|
+
import type { ButtonProps } from '@mui/material';
|
3
|
+
|
4
|
+
export interface OpenConfirmProps {
|
5
|
+
title: ReactNode;
|
6
|
+
content: ReactNode;
|
7
|
+
onConfirm?: (close: () => void) => void;
|
8
|
+
onCancel?: () => void;
|
9
|
+
showCancelButton?: true | false;
|
10
|
+
confirmButtonText?: string;
|
11
|
+
cancelButtonText?: string;
|
12
|
+
confirmButtonProps?: ButtonProps;
|
13
|
+
cancelButtonProps?: ButtonProps;
|
14
|
+
}
|
15
|
+
|
16
|
+
export type UpdateConfirmProps = Partial<Pick<OpenConfirmProps, 'title' | 'content'>>;
|
17
|
+
|
18
|
+
export type OpenConfirm = (params: OpenConfirmProps) => void;
|
19
|
+
export type CloseConfirm = () => void;
|
20
|
+
export type UpdateConfirm = (params: UpdateConfirmProps) => void;
|
package/lib/Tag/index.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
import { default as PropTypes } from 'prop-types';
|
2
|
+
export default Tag;
|
2
3
|
export type TypographyProps = import('@mui/material/Typography').TypographyProps;
|
3
4
|
export type TagOwnProps = {
|
4
5
|
type?: "error" | "warning" | "success" | "primary" | "reverse";
|
@@ -9,9 +10,28 @@ export type TagOwnProps = {
|
|
9
10
|
};
|
10
11
|
export type TagProps = TypographyProps & TagOwnProps;
|
11
12
|
/**
|
12
|
-
* @
|
13
|
+
* @typedef {import('@mui/material/Typography').TypographyProps} TypographyProps
|
14
|
+
* @typedef {{
|
15
|
+
* type?: 'error' | 'warning' | 'success' | 'primary' | 'reverse',
|
16
|
+
* content?: string,
|
17
|
+
* className?: string;
|
18
|
+
* children: import('react').ReactNode,
|
19
|
+
* style?: import('react').CSSProperties
|
20
|
+
* }} TagOwnProps
|
21
|
+
* @typedef { TypographyProps & TagOwnProps} TagProps
|
13
22
|
*/
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
23
|
+
/**
|
24
|
+
* @description
|
25
|
+
* @param {TagProps} props
|
26
|
+
* @return {import('react').ReactNode}
|
27
|
+
*/
|
28
|
+
declare function Tag(rawProps: any): import('react').ReactNode;
|
29
|
+
declare namespace Tag {
|
30
|
+
namespace propTypes {
|
31
|
+
let children: PropTypes.Validator<any>;
|
32
|
+
let type: PropTypes.Requireable<string>;
|
33
|
+
let content: PropTypes.Requireable<string>;
|
34
|
+
let className: PropTypes.Requireable<string>;
|
35
|
+
let style: PropTypes.Requireable<NonNullable<string | object | null | undefined>>;
|
36
|
+
}
|
37
|
+
}
|
package/lib/Tag/index.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
import { jsx as
|
1
|
+
import { jsx as h } from "react/jsx-runtime";
|
2
2
|
import r from "prop-types";
|
3
|
-
import { Typography as
|
4
|
-
import
|
3
|
+
import { Typography as u, useTheme as b } from "@mui/material";
|
4
|
+
import n from "lodash/isUndefined";
|
5
5
|
import { mergeProps as x } from "../Util/index.js";
|
6
6
|
import e from "../Colors/themes/default.js";
|
7
|
-
import { styled as
|
8
|
-
const
|
7
|
+
import { styled as w } from "../Theme/index.js";
|
8
|
+
const i = {
|
9
9
|
error: {
|
10
10
|
color: e.common.white,
|
11
11
|
backgroundColor: e.error.main
|
@@ -27,26 +27,23 @@ const c = {
|
|
27
27
|
backgroundColor: "#222"
|
28
28
|
}
|
29
29
|
};
|
30
|
-
function a(
|
31
|
-
const o = Object.assign({},
|
32
|
-
|
33
|
-
const
|
34
|
-
return
|
35
|
-
color:
|
36
|
-
backgroundColor:
|
37
|
-
}), /* @__PURE__ */
|
30
|
+
function a(m) {
|
31
|
+
const o = Object.assign({}, m);
|
32
|
+
n(o.type) && (o.type = "primary"), n(o.content) && (o.content = ""), n(o.style) && (o.style = {}), n(o.className) && (o.className = "");
|
33
|
+
const p = x(o, a, ["style"]), { type: t, content: l, children: y, style: f, className: g, ...d } = p, { palette: s } = b(), c = Object.assign({}, i[t] || i.primary, f);
|
34
|
+
return s[t] && Object.assign(c, {
|
35
|
+
color: s[t].contrastText || e.common.white,
|
36
|
+
backgroundColor: s[t].main
|
37
|
+
}), /* @__PURE__ */ h(j, { component: "span", className: g, style: c, ...d, children: l || y });
|
38
38
|
}
|
39
39
|
a.propTypes = {
|
40
40
|
children: r.any.isRequired,
|
41
|
-
type: r.oneOf(Object.keys(
|
41
|
+
type: r.oneOf(Object.keys(i)),
|
42
42
|
content: r.string,
|
43
43
|
className: r.string,
|
44
44
|
style: r.oneOfType([r.object, r.string])
|
45
45
|
};
|
46
|
-
|
47
|
-
return /* @__PURE__ */ p(a, { ...o, forwardedRef: s });
|
48
|
-
}
|
49
|
-
const j = T(b)`
|
46
|
+
const j = w(u)`
|
50
47
|
&& {
|
51
48
|
display: inline-flex;
|
52
49
|
justify-content: center;
|
@@ -60,5 +57,5 @@ const j = T(b)`
|
|
60
57
|
}
|
61
58
|
`;
|
62
59
|
export {
|
63
|
-
|
60
|
+
a as default
|
64
61
|
};
|
package/lib/global.d.ts
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
declare module '@arcblock/did-motif';
|
2
|
+
declare module 'd3-geo';
|
3
|
+
declare module 'topojson-client';
|
4
|
+
declare module 'versor';
|
5
|
+
declare module 'axios/*';
|
6
|
+
|
7
|
+
// ux svg 由 babel-plugin-inline-react-svg 处理
|
8
|
+
declare module '*.svg?react' {
|
9
|
+
import React from 'react';
|
10
|
+
const SVG: React.FC<React.SVGProps<SVGSVGElement>>;
|
11
|
+
export default SVG;
|
12
|
+
}
|
13
|
+
|
14
|
+
declare module '*.png' {
|
15
|
+
export default string;
|
16
|
+
}
|
17
|
+
|
18
|
+
type Blocklet = import('./type').Blocklet;
|
19
|
+
|
20
|
+
interface Window {
|
21
|
+
blocklet?: Blocklet;
|
22
|
+
env?: Blocklet;
|
23
|
+
}
|
24
|
+
|
25
|
+
declare module globalThis {
|
26
|
+
var blocklet: Blocklet;
|
27
|
+
var env: Blocklet;
|
28
|
+
}
|
package/lib/type.d.ts
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
import type { Theme } from '@mui/material';
|
2
|
+
import type { LiteralUnion } from 'type-fest';
|
3
|
+
|
4
|
+
export type $TSFixMe = any;
|
5
|
+
export type Translations = Record<string, Record<string, any>>;
|
6
|
+
export type Locale = LiteralUnion<'en' | 'zh', string>;
|
7
|
+
|
8
|
+
// TODO: 以下为 blocklet 应用专属的全局对象类型,可以更加具体
|
9
|
+
export type User = Record<string, any>;
|
10
|
+
export type Session = Record<string, any>;
|
11
|
+
export type Passport = Record<string, any>;
|
12
|
+
export type Blocklet = {
|
13
|
+
appId: string;
|
14
|
+
appIds: string[];
|
15
|
+
appPid: string;
|
16
|
+
appName: string;
|
17
|
+
appDescription: string;
|
18
|
+
appLogo: string;
|
19
|
+
appLogoRect: string;
|
20
|
+
appUrl: string;
|
21
|
+
isComponent: boolean;
|
22
|
+
prefix: string;
|
23
|
+
groupPrefix: string;
|
24
|
+
pageGroup: string;
|
25
|
+
version: string;
|
26
|
+
mode: string;
|
27
|
+
tenantMode: 'single' | 'multiple';
|
28
|
+
theme: {
|
29
|
+
prefer?: 'light' | 'dark' | 'system';
|
30
|
+
light: Theme;
|
31
|
+
dark: Theme;
|
32
|
+
};
|
33
|
+
navigation: $TSFixMe[];
|
34
|
+
preferences: Record<string, any>;
|
35
|
+
languages: {
|
36
|
+
code: string;
|
37
|
+
name: string;
|
38
|
+
}[];
|
39
|
+
passportColor: string;
|
40
|
+
componentMountPoints: $TSFixMe[];
|
41
|
+
alsoKnownAs: string[];
|
42
|
+
trustedFactories: string[];
|
43
|
+
[x: string]: any;
|
44
|
+
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arcblock/ux",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.6",
|
4
4
|
"description": "Common used react components for arcblock products",
|
5
5
|
"keywords": [
|
6
6
|
"react",
|
@@ -60,16 +60,16 @@
|
|
60
60
|
"react": ">=19.0.0",
|
61
61
|
"react-router-dom": ">=6.22.3"
|
62
62
|
},
|
63
|
-
"gitHead": "
|
63
|
+
"gitHead": "b985886f6650c3df0f48665c71d7a8ce0d9bdb93",
|
64
64
|
"dependencies": {
|
65
|
-
"@arcblock/bridge": "3.0.
|
66
|
-
"@arcblock/did": "^1.20.
|
65
|
+
"@arcblock/bridge": "3.0.6",
|
66
|
+
"@arcblock/did": "^1.20.15",
|
67
67
|
"@arcblock/did-motif": "^1.1.13",
|
68
|
-
"@arcblock/icons": "3.0.
|
69
|
-
"@arcblock/nft-display": "3.0.
|
70
|
-
"@arcblock/react-hooks": "3.0.
|
68
|
+
"@arcblock/icons": "3.0.6",
|
69
|
+
"@arcblock/nft-display": "3.0.6",
|
70
|
+
"@arcblock/react-hooks": "3.0.6",
|
71
71
|
"@blocklet/js-sdk": "^1.16.44",
|
72
|
-
"@blocklet/theme": "3.0.
|
72
|
+
"@blocklet/theme": "3.0.6",
|
73
73
|
"@fontsource/roboto": "~5.1.1",
|
74
74
|
"@fontsource/ubuntu-mono": "^5.2.6",
|
75
75
|
"@iconify-icons/logos": "^1.2.36",
|
@@ -77,7 +77,7 @@
|
|
77
77
|
"@iconify-icons/mdi": "^1.2.48",
|
78
78
|
"@iconify-icons/tabler": "^1.2.95",
|
79
79
|
"@iconify/react": "^5.2.1",
|
80
|
-
"@ocap/mcrypto": "^1.20.
|
80
|
+
"@ocap/mcrypto": "^1.20.15",
|
81
81
|
"@solana/qr-code-styling": "^1.6.0",
|
82
82
|
"@testing-library/react": "^14.3.1",
|
83
83
|
"@types/dompurify": "^3.2.0",
|
package/src/Tag/index.jsx
CHANGED
@@ -61,7 +61,7 @@ function Tag(rawProps) {
|
|
61
61
|
props.className = '';
|
62
62
|
}
|
63
63
|
const newProps = mergeProps(props, Tag, ['style']);
|
64
|
-
const { type, content, children, style, className,
|
64
|
+
const { type, content, children, style, className, ...rest } = newProps;
|
65
65
|
|
66
66
|
const { palette } = useTheme();
|
67
67
|
|
@@ -75,7 +75,7 @@ function Tag(rawProps) {
|
|
75
75
|
}
|
76
76
|
|
77
77
|
return (
|
78
|
-
<Span
|
78
|
+
<Span component="span" className={className} style={styles} {...rest}>
|
79
79
|
{content || children}
|
80
80
|
</Span>
|
81
81
|
);
|
@@ -89,14 +89,7 @@ Tag.propTypes = {
|
|
89
89
|
style: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
90
90
|
};
|
91
91
|
|
92
|
-
|
93
|
-
* @type {React.ForwardRefExoticComponent<React.PropsWithoutRef<TagProps> & React.RefAttributes<HTMLSpanElement>>}
|
94
|
-
*/
|
95
|
-
// eslint-disable-next-line react/prop-types
|
96
|
-
function TagComponent({ ref, ...props }) {
|
97
|
-
return <Tag {...props} forwardedRef={ref} />;
|
98
|
-
}
|
99
|
-
export default TagComponent;
|
92
|
+
export default Tag;
|
100
93
|
|
101
94
|
const Span = styled(Typography)`
|
102
95
|
&& {
|
package/vite.config.mjs
CHANGED