@arcblock/ux 3.0.3 → 3.0.5

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,4 +1,5 @@
1
- export default TagComponent;
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
- * @type {React.ForwardRefExoticComponent<React.PropsWithoutRef<TagProps> & React.RefAttributes<HTMLSpanElement>>}
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
- declare function TagComponent({ ref, ...props }: {
15
- [x: string]: any;
16
- ref: any;
17
- }): import("react/jsx-runtime").JSX.Element;
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 p } from "react/jsx-runtime";
1
+ import { jsx as h } from "react/jsx-runtime";
2
2
  import r from "prop-types";
3
- import { Typography as b, useTheme as w } from "@mui/material";
4
- import t from "lodash/isUndefined";
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 T } from "../Theme/index.js";
8
- const c = {
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(s) {
31
- const o = Object.assign({}, s);
32
- t(o.type) && (o.type = "primary"), t(o.content) && (o.content = ""), t(o.style) && (o.style = {}), t(o.className) && (o.className = "");
33
- const l = x(o, a, ["style"]), { type: n, content: f, children: y, style: d, className: g, forwardedRef: u, ...h } = l, { palette: i } = w(), m = Object.assign({}, c[n] || c.primary, d);
34
- return i[n] && Object.assign(m, {
35
- color: i[n].contrastText || e.common.white,
36
- backgroundColor: i[n].main
37
- }), /* @__PURE__ */ p(j, { ref: u, component: "span", className: g, style: m, ...h, children: f || y });
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(c)),
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
- function v({ ref: s, ...o }) {
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
- v as default
60
+ a as default
64
61
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "3.0.3",
3
+ "version": "3.0.5",
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": "2eebd00eee1be90587baa3847167f25d92643fa9",
63
+ "gitHead": "1a7bd7691bda12a5d117eb57fe63e8a6486105d6",
64
64
  "dependencies": {
65
- "@arcblock/bridge": "3.0.3",
66
- "@arcblock/did": "^1.20.14",
65
+ "@arcblock/bridge": "3.0.5",
66
+ "@arcblock/did": "^1.20.15",
67
67
  "@arcblock/did-motif": "^1.1.13",
68
- "@arcblock/icons": "3.0.3",
69
- "@arcblock/nft-display": "3.0.3",
70
- "@arcblock/react-hooks": "3.0.3",
68
+ "@arcblock/icons": "3.0.5",
69
+ "@arcblock/nft-display": "3.0.5",
70
+ "@arcblock/react-hooks": "3.0.5",
71
71
  "@blocklet/js-sdk": "^1.16.44",
72
- "@blocklet/theme": "3.0.3",
72
+ "@blocklet/theme": "3.0.5",
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.14",
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, forwardedRef, ...rest } = newProps;
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 ref={forwardedRef} component="span" className={className} style={styles} {...rest}>
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
  && {