@arcblock/ux 2.10.28 → 2.10.30

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,8 @@
1
- declare function AvatarWithErrorBoundary(props: any): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
1
+ /**
2
+ * @param {AvatarProps} props
3
+ * @returns {JSX.Element}
4
+ */
5
+ declare function AvatarWithErrorBoundary(props: AvatarProps): JSX.Element;
2
6
  declare namespace AvatarWithErrorBoundary {
3
7
  import propTypes = Avatar.propTypes;
4
8
  export { propTypes };
@@ -8,28 +12,27 @@ export default AvatarWithErrorBoundary;
8
12
  * Avatar component
9
13
  */
10
14
  export type AvatarProps = {
11
- did: string;
15
+ did?: string;
12
16
  size?: number;
13
17
  variant?: "circle" | "rounded" | "default";
14
18
  animation?: boolean;
15
19
  shape?: "" | "rectangle" | "square" | "hexagon" | "circle";
16
- src?: string;
20
+ blockiesPadding?: boolean;
17
21
  responsive?: boolean;
18
- };
22
+ } & Omit<import("../Img").ImgProps, "size">;
19
23
  /**
20
24
  * Avatar component
21
25
  * @typedef {{
22
- * did: string;
26
+ * did?: string;
23
27
  * size?: number;
24
28
  * variant?: 'circle' | 'rounded' | 'default';
25
29
  * animation?: boolean;
26
30
  * shape?: '' | 'rectangle' | 'square' | 'hexagon' | 'circle';
27
- * src?: string;
31
+ * blockiesPadding?: boolean;
28
32
  * responsive?: boolean;
29
- * }} AvatarProps
33
+ * } & Omit<import('../Img').ImgProps, 'size'>} AvatarProps
30
34
  */
31
35
  /**
32
- * Avatar component
33
36
  * @see 参考: https://github.com/blocklet/block-explorer/issues/478#issuecomment-1038954976
34
37
  * @param {AvatarProps} props
35
38
  * @returns {JSX.Element}
@@ -37,7 +40,7 @@ export type AvatarProps = {
37
40
  declare function Avatar(props: AvatarProps): JSX.Element;
38
41
  declare namespace Avatar {
39
42
  export namespace propTypes_1 {
40
- let did: PropTypes.Validator<string>;
43
+ let did: PropTypes.Requireable<string>;
41
44
  let size: PropTypes.Requireable<number>;
42
45
  let variant: PropTypes.Requireable<string>;
43
46
  let animation: PropTypes.Requireable<boolean>;
@@ -47,16 +50,18 @@ declare namespace Avatar {
47
50
  }
48
51
  export { propTypes_1 as propTypes };
49
52
  export namespace defaultProps {
53
+ let did_1: string;
54
+ export { did_1 as did };
50
55
  let size_1: number;
51
56
  export { size_1 as size };
52
57
  let variant_1: string;
53
58
  export { variant_1 as variant };
54
59
  let animation_1: boolean;
55
60
  export { animation_1 as animation };
56
- let blockiesPadding_1: boolean;
57
- export { blockiesPadding_1 as blockiesPadding };
58
61
  let shape_1: string;
59
62
  export { shape_1 as shape };
63
+ let blockiesPadding_1: boolean;
64
+ export { blockiesPadding_1 as blockiesPadding };
60
65
  let responsive_1: boolean;
61
66
  export { responsive_1 as responsive };
62
67
  }
@@ -14,18 +14,17 @@ import { DID_PREFIX } from '../Util/constant';
14
14
  /**
15
15
  * Avatar component
16
16
  * @typedef {{
17
- * did: string;
17
+ * did?: string;
18
18
  * size?: number;
19
19
  * variant?: 'circle' | 'rounded' | 'default';
20
20
  * animation?: boolean;
21
21
  * shape?: '' | 'rectangle' | 'square' | 'hexagon' | 'circle';
22
- * src?: string;
22
+ * blockiesPadding?: boolean;
23
23
  * responsive?: boolean;
24
- * }} AvatarProps
24
+ * } & Omit<import('../Img').ImgProps, 'size'>} AvatarProps
25
25
  */
26
26
 
27
27
  /**
28
- * Avatar component
29
28
  * @see 参考: https://github.com/blocklet/block-explorer/issues/478#issuecomment-1038954976
30
29
  * @param {AvatarProps} props
31
30
  * @returns {JSX.Element}
@@ -138,7 +137,7 @@ function Avatar(props) {
138
137
  throw new Error(`Invalid DID: ${did}`);
139
138
  }
140
139
  Avatar.propTypes = {
141
- did: PropTypes.string.isRequired,
140
+ did: PropTypes.string,
142
141
  size: PropTypes.number,
143
142
  variant: PropTypes.oneOf(['circle', 'rounded', 'default']),
144
143
  // animation 仅对 did motif 有效
@@ -149,13 +148,19 @@ Avatar.propTypes = {
149
148
  responsive: PropTypes.bool
150
149
  };
151
150
  Avatar.defaultProps = {
151
+ did: '',
152
152
  size: 36,
153
153
  variant: 'default',
154
154
  animation: false,
155
- blockiesPadding: true,
156
155
  shape: '',
156
+ blockiesPadding: true,
157
157
  responsive: false
158
158
  };
159
+
160
+ /**
161
+ * @param {AvatarProps} props
162
+ * @returns {JSX.Element}
163
+ */
159
164
  export default function AvatarWithErrorBoundary(props) {
160
165
  const size = props.size || 36;
161
166
  const borderRadius = {
@@ -15,6 +15,7 @@ export type DataTableColumn = {
15
15
  name: string;
16
16
  label: string;
17
17
  width?: number;
18
+ align?: "left" | "center" | "right";
18
19
  options?: {
19
20
  filter?: boolean;
20
21
  sort?: boolean;
@@ -24,20 +25,15 @@ export type DataTableColumn = {
24
25
  } & import("mui-datatables").MUIDataTableColumnDef;
25
26
  export type DataTableState = Pick<import("mui-datatables").MUIDataTableState, "count" | "page" | "rowsPerPage" | "searchText" | "sortOrder" | "filterList">;
26
27
  export type ModifiedMUIDataTableProps = {
27
- /**
28
- * - The title of the table (optional).
29
- */
30
28
  title?: string;
31
- /**
32
- * - Other props from MUIDataTableProps.
33
- */
34
- rest?: import("mui-datatables").MUIDataTableProps[];
35
- };
29
+ } & Omit<import("mui-datatables").MUIDataTableProps, "title">;
36
30
  export type DataTableProps = {
37
31
  data: Array<object | number[] | string[]>;
38
32
  columns: Array<DataTableColumn>;
39
33
  locale?: string;
40
- options?: import("mui-datatables").MUIDataTableOptions;
34
+ options?: {
35
+ searchDebounceTime?: number;
36
+ } & import("mui-datatables").MUIDataTableOptions;
41
37
  style?: import("react").CSSProperties;
42
38
  customButtons?: Array<DataTableCustomButton>;
43
39
  onChange?: (state: DataTableState, action: string) => void | Promise<void>;
@@ -46,7 +42,7 @@ export type DataTableProps = {
46
42
  stripped?: boolean;
47
43
  verticalKeyWidth?: number | string;
48
44
  hideTableHeader?: boolean;
49
- components?: import("react").ReactElement;
45
+ components?: ModifiedMUIDataTableProps["components"];
50
46
  emptyNode?: import("react").ReactNode;
51
47
  durable?: string;
52
48
  durableKeys?: "page" | "rowsPerPage" | "searchText" | "sortOrder";
@@ -27,6 +27,7 @@ import { styled } from '../Theme';
27
27
  * name: string,
28
28
  * label: string,
29
29
  * width?: number,
30
+ * align?: 'left' | 'center' | 'right',
30
31
  * options?: {
31
32
  * filter?: boolean,
32
33
  * sort?: boolean,
@@ -41,9 +42,9 @@ import { styled } from '../Theme';
41
42
  */
42
43
 
43
44
  /**
44
- * @typedef {Object} ModifiedMUIDataTableProps
45
- * @property {string} [title] - The title of the table (optional).
46
- * @property {...import('mui-datatables').MUIDataTableProps} [rest] - Other props from MUIDataTableProps.
45
+ * @typedef {{
46
+ * title?: string, // The title of the table (optional)
47
+ * } & Omit<import('mui-datatables').MUIDataTableProps, 'title'>} ModifiedMUIDataTableProps
47
48
  */
48
49
 
49
50
  /**
@@ -51,7 +52,7 @@ import { styled } from '../Theme';
51
52
  * data: Array<object | number[] | string[]>,
52
53
  * columns: Array<DataTableColumn>,
53
54
  * locale?: string,
54
- * options?: import('mui-datatables').MUIDataTableOptions,
55
+ * options?: { searchDebounceTime?: number } & import('mui-datatables').MUIDataTableOptions,
55
56
  * style?: import('react').CSSProperties,
56
57
  * customButtons?: Array<DataTableCustomButton>,
57
58
  * onChange?: (state: DataTableState, action: string) => void | Promise<void>,
@@ -60,7 +61,7 @@ import { styled } from '../Theme';
60
61
  * stripped?: boolean,
61
62
  * verticalKeyWidth?: number | string,
62
63
  * hideTableHeader?: boolean,
63
- * components?: import('react').ReactElement,
64
+ * components?: ModifiedMUIDataTableProps['components'],
64
65
  * emptyNode?: import('react').ReactNode,
65
66
  * durable?: string,
66
67
  * durableKeys?: 'page' | 'rowsPerPage' | 'searchText' | 'sortOrder'
@@ -37,12 +37,16 @@ export type UxDialogProps = {
37
37
  * - Props to be passed down to the dialog paper.
38
38
  */
39
39
  PaperProps?: PaperStyle;
40
+ slotProps?: {
41
+ content: object;
42
+ content: object;
43
+ };
40
44
  /**
41
45
  * - Callback function fired when the dialog is closed.
42
46
  */
43
47
  onClose?: (event: React.SyntheticEvent, reason: string) => void;
44
48
  };
45
- export type DialogProps = MuiDialogProps & UxDialogProps;
49
+ export type DialogProps = Omit<MuiDialogProps, "title" | "children" | "onClose" | "PaperProps" | "slotProps"> & UxDialogProps;
46
50
  /**
47
51
  * @typedef {import('@mui/material').DialogProps} MuiDialogProps
48
52
  * @typedef {import('@mui/material').PaperProps & {
@@ -60,10 +64,11 @@ export type DialogProps = MuiDialogProps & UxDialogProps;
60
64
  @property {boolean} [showCloseButton=true] - Whether or not to show the close button.
61
65
  @property {'left'|'center'|'right'} [actionsPosition='right'] - The position of the actions toolbar.
62
66
  @property {PaperStyle} [PaperProps] - Props to be passed down to the dialog paper.
67
+ @property {{content: object, content: object}} [slotProps]
63
68
  @property {(event: React.SyntheticEvent, reason: string) => void} [onClose] - Callback function fired when the dialog is closed.
64
69
  */
65
70
  /**
66
- * @typedef {MuiDialogProps & UxDialogProps} DialogProps
71
+ * @typedef {Omit<MuiDialogProps, 'title' | 'children' | 'onClose' | 'PaperProps' | 'slotProps'> & UxDialogProps} DialogProps
67
72
  */
68
73
  /**
69
74
  * Dialog
@@ -92,10 +97,9 @@ declare namespace Dialog {
92
97
  content: PropTypes.Requireable<object>;
93
98
  header: PropTypes.Requireable<object>;
94
99
  }>>;
100
+ let onClose: PropTypes.Requireable<(...args: any[]) => any>;
95
101
  }
96
102
  namespace defaultProps {
97
- let showCloseButton_1: boolean;
98
- export { showCloseButton_1 as showCloseButton };
99
103
  let title_1: string;
100
104
  export { title_1 as title };
101
105
  let prepend_1: any;
@@ -104,12 +108,16 @@ declare namespace Dialog {
104
108
  export { toolbar_1 as toolbar };
105
109
  let actions_1: any;
106
110
  export { actions_1 as actions };
111
+ let showCloseButton_1: boolean;
112
+ export { showCloseButton_1 as showCloseButton };
107
113
  let actionsPosition_1: string;
108
114
  export { actionsPosition_1 as actionsPosition };
109
115
  let PaperProps_1: {};
110
116
  export { PaperProps_1 as PaperProps };
111
117
  let slotProps_1: {};
112
118
  export { slotProps_1 as slotProps };
119
+ let onClose_1: any;
120
+ export { onClose_1 as onClose };
113
121
  }
114
122
  }
115
123
  import PropTypes from 'prop-types';
@@ -22,11 +22,12 @@ import { styled, useTheme } from '../Theme';
22
22
  @property {boolean} [showCloseButton=true] - Whether or not to show the close button.
23
23
  @property {'left'|'center'|'right'} [actionsPosition='right'] - The position of the actions toolbar.
24
24
  @property {PaperStyle} [PaperProps] - Props to be passed down to the dialog paper.
25
+ @property {{content: object, content: object}} [slotProps]
25
26
  @property {(event: React.SyntheticEvent, reason: string) => void} [onClose] - Callback function fired when the dialog is closed.
26
27
  */
27
28
 
28
29
  /**
29
- * @typedef {MuiDialogProps & UxDialogProps} DialogProps
30
+ * @typedef {Omit<MuiDialogProps, 'title' | 'children' | 'onClose' | 'PaperProps' | 'slotProps'> & UxDialogProps} DialogProps
30
31
  */
31
32
 
32
33
  /**
@@ -125,17 +126,19 @@ Dialog.propTypes = {
125
126
  slotProps: PropTypes.shape({
126
127
  content: PropTypes.object,
127
128
  header: PropTypes.object
128
- })
129
+ }),
130
+ onClose: PropTypes.func
129
131
  };
130
132
  Dialog.defaultProps = {
131
- showCloseButton: true,
132
133
  title: '',
133
134
  prepend: null,
134
135
  toolbar: null,
135
136
  actions: null,
137
+ showCloseButton: true,
136
138
  actionsPosition: 'right',
137
139
  PaperProps: {},
138
- slotProps: {}
140
+ slotProps: {},
141
+ onClose: undefined
139
142
  };
140
143
  /**
141
144
  * @type {import('@emotion/styled').StyledComponent<import('@mui/material').DialogProps, {}, { ref?: React.Ref<any> | undefined;}>}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "2.10.28",
3
+ "version": "2.10.30",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -59,12 +59,12 @@
59
59
  "react": ">=18.2.0",
60
60
  "react-router-dom": ">=6.22.3"
61
61
  },
62
- "gitHead": "71cb15e455bd2f3bdf906c14ae4ef87f9da9c271",
62
+ "gitHead": "fc513c9d7b90fecd65844cc562b41f3c5dd5f398",
63
63
  "dependencies": {
64
64
  "@arcblock/did-motif": "^1.1.13",
65
- "@arcblock/icons": "^2.10.28",
66
- "@arcblock/nft-display": "^2.10.28",
67
- "@arcblock/react-hooks": "^2.10.28",
65
+ "@arcblock/icons": "^2.10.30",
66
+ "@arcblock/nft-display": "^2.10.30",
67
+ "@arcblock/react-hooks": "^2.10.30",
68
68
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
69
69
  "@fontsource/inter": "^5.0.16",
70
70
  "@fontsource/ubuntu-mono": "^5.0.18",
@@ -13,18 +13,17 @@ import { DID_PREFIX } from '../Util/constant';
13
13
  /**
14
14
  * Avatar component
15
15
  * @typedef {{
16
- * did: string;
16
+ * did?: string;
17
17
  * size?: number;
18
18
  * variant?: 'circle' | 'rounded' | 'default';
19
19
  * animation?: boolean;
20
20
  * shape?: '' | 'rectangle' | 'square' | 'hexagon' | 'circle';
21
- * src?: string;
21
+ * blockiesPadding?: boolean;
22
22
  * responsive?: boolean;
23
- * }} AvatarProps
23
+ * } & Omit<import('../Img').ImgProps, 'size'>} AvatarProps
24
24
  */
25
25
 
26
26
  /**
27
- * Avatar component
28
27
  * @see 参考: https://github.com/blocklet/block-explorer/issues/478#issuecomment-1038954976
29
28
  * @param {AvatarProps} props
30
29
  * @returns {JSX.Element}
@@ -125,7 +124,7 @@ function Avatar(props) {
125
124
  }
126
125
 
127
126
  Avatar.propTypes = {
128
- did: PropTypes.string.isRequired,
127
+ did: PropTypes.string,
129
128
  size: PropTypes.number,
130
129
  variant: PropTypes.oneOf(['circle', 'rounded', 'default']),
131
130
  // animation 仅对 did motif 有效
@@ -137,14 +136,19 @@ Avatar.propTypes = {
137
136
  };
138
137
 
139
138
  Avatar.defaultProps = {
139
+ did: '',
140
140
  size: 36,
141
141
  variant: 'default',
142
142
  animation: false,
143
- blockiesPadding: true,
144
143
  shape: '',
144
+ blockiesPadding: true,
145
145
  responsive: false,
146
146
  };
147
147
 
148
+ /**
149
+ * @param {AvatarProps} props
150
+ * @returns {JSX.Element}
151
+ */
148
152
  export default function AvatarWithErrorBoundary(props) {
149
153
  const size = props.size || 36;
150
154
  const borderRadius = { rounded: '4px', circle: '100%' }[props.variant] || 0;
@@ -26,6 +26,7 @@ import { styled } from '../Theme';
26
26
  * name: string,
27
27
  * label: string,
28
28
  * width?: number,
29
+ * align?: 'left' | 'center' | 'right',
29
30
  * options?: {
30
31
  * filter?: boolean,
31
32
  * sort?: boolean,
@@ -40,9 +41,9 @@ import { styled } from '../Theme';
40
41
  */
41
42
 
42
43
  /**
43
- * @typedef {Object} ModifiedMUIDataTableProps
44
- * @property {string} [title] - The title of the table (optional).
45
- * @property {...import('mui-datatables').MUIDataTableProps} [rest] - Other props from MUIDataTableProps.
44
+ * @typedef {{
45
+ * title?: string, // The title of the table (optional)
46
+ * } & Omit<import('mui-datatables').MUIDataTableProps, 'title'>} ModifiedMUIDataTableProps
46
47
  */
47
48
 
48
49
  /**
@@ -50,7 +51,7 @@ import { styled } from '../Theme';
50
51
  * data: Array<object | number[] | string[]>,
51
52
  * columns: Array<DataTableColumn>,
52
53
  * locale?: string,
53
- * options?: import('mui-datatables').MUIDataTableOptions,
54
+ * options?: { searchDebounceTime?: number } & import('mui-datatables').MUIDataTableOptions,
54
55
  * style?: import('react').CSSProperties,
55
56
  * customButtons?: Array<DataTableCustomButton>,
56
57
  * onChange?: (state: DataTableState, action: string) => void | Promise<void>,
@@ -59,7 +60,7 @@ import { styled } from '../Theme';
59
60
  * stripped?: boolean,
60
61
  * verticalKeyWidth?: number | string,
61
62
  * hideTableHeader?: boolean,
62
- * components?: import('react').ReactElement,
63
+ * components?: ModifiedMUIDataTableProps['components'],
63
64
  * emptyNode?: import('react').ReactNode,
64
65
  * durable?: string,
65
66
  * durableKeys?: 'page' | 'rowsPerPage' | 'searchText' | 'sortOrder'
@@ -30,11 +30,12 @@ import { styled, useTheme } from '../Theme';
30
30
  @property {boolean} [showCloseButton=true] - Whether or not to show the close button.
31
31
  @property {'left'|'center'|'right'} [actionsPosition='right'] - The position of the actions toolbar.
32
32
  @property {PaperStyle} [PaperProps] - Props to be passed down to the dialog paper.
33
+ @property {{content: object, content: object}} [slotProps]
33
34
  @property {(event: React.SyntheticEvent, reason: string) => void} [onClose] - Callback function fired when the dialog is closed.
34
35
  */
35
36
 
36
37
  /**
37
- * @typedef {MuiDialogProps & UxDialogProps} DialogProps
38
+ * @typedef {Omit<MuiDialogProps, 'title' | 'children' | 'onClose' | 'PaperProps' | 'slotProps'> & UxDialogProps} DialogProps
38
39
  */
39
40
 
40
41
  /**
@@ -128,17 +129,19 @@ Dialog.propTypes = {
128
129
  content: PropTypes.object,
129
130
  header: PropTypes.object,
130
131
  }),
132
+ onClose: PropTypes.func,
131
133
  };
132
134
 
133
135
  Dialog.defaultProps = {
134
- showCloseButton: true,
135
136
  title: '',
136
137
  prepend: null,
137
138
  toolbar: null,
138
139
  actions: null,
140
+ showCloseButton: true,
139
141
  actionsPosition: 'right',
140
142
  PaperProps: {},
141
143
  slotProps: {},
144
+ onClose: undefined,
142
145
  };
143
146
  /**
144
147
  * @type {import('@emotion/styled').StyledComponent<import('@mui/material').DialogProps, {}, { ref?: React.Ref<any> | undefined;}>}