@arcblock/ux 2.9.51 → 2.9.53

Sign up to get free protection for your applications and to get access to all the features.
@@ -45,7 +45,8 @@ export default function Confirm({
45
45
  if (['backdropClick', 'escapeKeyDown'].includes(reason)) {
46
46
  return;
47
47
  }
48
- onCancel();
48
+ e.stopPropagation();
49
+ onCancel(e, reason);
49
50
  });
50
51
  return /*#__PURE__*/_jsx(Dialog, {
51
52
  title: title,
@@ -69,12 +70,18 @@ export default function Confirm({
69
70
  },
70
71
  actions: /*#__PURE__*/_jsxs(_Fragment, {
71
72
  children: [showCancelButton && /*#__PURE__*/_jsx(Button, {
72
- onClick: e => onCancel(e, 'closeButton'),
73
+ onClick: e => {
74
+ e.stopPropagation();
75
+ onCancel(e, 'closeButton');
76
+ },
73
77
  color: "primary",
74
78
  ...cancelButton.props,
75
79
  children: cancelButton.text
76
80
  }), /*#__PURE__*/_jsx(Button, {
77
- onClick: () => onConfirm(),
81
+ onClick: e => {
82
+ e.stopPropagation();
83
+ onConfirm(e);
84
+ },
78
85
  color: "primary",
79
86
  autoFocus: true,
80
87
  ...confirmButton.props,
@@ -44,14 +44,14 @@ const ConfirmHolder = /*#__PURE__*/forwardRef((props, ref) => {
44
44
  reset();
45
45
  }, 300);
46
46
  });
47
- const onCancel = useMemoizedFn(() => {
47
+ const onCancel = useMemoizedFn((e, reason) => {
48
48
  close();
49
- state?.onCancel();
49
+ state?.onCancel(e, reason);
50
50
  }, []);
51
- const onConfirm = useMemoizedFn(async () => {
51
+ const onConfirm = useMemoizedFn(async e => {
52
52
  state.loading = true;
53
53
  try {
54
- await state?.onConfirm(close);
54
+ await state?.onConfirm(close, e);
55
55
  } finally {
56
56
  state.loading = false;
57
57
  }
@@ -132,7 +132,7 @@ export default function SessionBlocklet({
132
132
  textAlign: 'center',
133
133
  lineHeight: 'normal'
134
134
  },
135
- children: item.title?.zh || item.title
135
+ children: item.title?.[locale] || item.title
136
136
  })]
137
137
  })
138
138
  }, item.id))
@@ -57,7 +57,8 @@ function Confirm(_ref) {
57
57
  if (['backdropClick', 'escapeKeyDown'].includes(reason)) {
58
58
  return;
59
59
  }
60
- onCancel();
60
+ e.stopPropagation();
61
+ onCancel(e, reason);
61
62
  });
62
63
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_dialog.default, _objectSpread(_objectSpread({
63
64
  title: title,
@@ -81,12 +82,18 @@ function Confirm(_ref) {
81
82
  },
82
83
  actions: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
83
84
  children: [showCancelButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, _objectSpread(_objectSpread({
84
- onClick: e => onCancel(e, 'closeButton'),
85
+ onClick: e => {
86
+ e.stopPropagation();
87
+ onCancel(e, 'closeButton');
88
+ },
85
89
  color: "primary"
86
90
  }, cancelButton.props), {}, {
87
91
  children: cancelButton.text
88
92
  })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, _objectSpread(_objectSpread({
89
- onClick: () => onConfirm(),
93
+ onClick: e => {
94
+ e.stopPropagation();
95
+ onConfirm(e);
96
+ },
90
97
  color: "primary",
91
98
  autoFocus: true
92
99
  }, confirmButton.props), {}, {
@@ -58,14 +58,14 @@ const ConfirmHolder = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
58
58
  reset();
59
59
  }, 300);
60
60
  });
61
- const onCancel = (0, _ahooks.useMemoizedFn)(() => {
61
+ const onCancel = (0, _ahooks.useMemoizedFn)((e, reason) => {
62
62
  close();
63
- state === null || state === void 0 ? void 0 : state.onCancel();
63
+ state === null || state === void 0 ? void 0 : state.onCancel(e, reason);
64
64
  }, []);
65
- const onConfirm = (0, _ahooks.useMemoizedFn)(async () => {
65
+ const onConfirm = (0, _ahooks.useMemoizedFn)(async e => {
66
66
  state.loading = true;
67
67
  try {
68
- await (state === null || state === void 0 ? void 0 : state.onConfirm(close));
68
+ await (state === null || state === void 0 ? void 0 : state.onConfirm(close, e));
69
69
  } finally {
70
70
  state.loading = false;
71
71
  }
@@ -148,7 +148,7 @@ function SessionBlocklet(_ref) {
148
148
  textAlign: 'center',
149
149
  lineHeight: 'normal'
150
150
  },
151
- children: ((_item$title = item.title) === null || _item$title === void 0 ? void 0 : _item$title.zh) || item.title
151
+ children: ((_item$title = item.title) === null || _item$title === void 0 ? void 0 : _item$title[locale]) || item.title
152
152
  })]
153
153
  })
154
154
  }, item.id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "2.9.51",
3
+ "version": "2.9.53",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -358,12 +358,12 @@
358
358
  "@mui/material": "^5.15.0",
359
359
  "react": ">=18.2.0"
360
360
  },
361
- "gitHead": "e89e3c3f37f0891ef91d1f9f6f864f29806c22b7",
361
+ "gitHead": "bf54e5b6fe510e2340ae87d1561d38d04dc25363",
362
362
  "dependencies": {
363
363
  "@arcblock/did-motif": "^1.1.13",
364
- "@arcblock/icons": "^2.9.51",
365
- "@arcblock/nft-display": "^2.9.51",
366
- "@arcblock/react-hooks": "^2.9.51",
364
+ "@arcblock/icons": "^2.9.53",
365
+ "@arcblock/nft-display": "^2.9.53",
366
+ "@arcblock/react-hooks": "^2.9.53",
367
367
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
368
368
  "@emotion/react": "^11.10.4",
369
369
  "@emotion/styled": "^11.10.4",
@@ -47,7 +47,8 @@ export default function Confirm({
47
47
  if (['backdropClick', 'escapeKeyDown'].includes(reason)) {
48
48
  return;
49
49
  }
50
- onCancel();
50
+ e.stopPropagation();
51
+ onCancel(e, reason);
51
52
  });
52
53
 
53
54
  return (
@@ -72,11 +73,24 @@ export default function Confirm({
72
73
  actions={
73
74
  <>
74
75
  {showCancelButton && (
75
- <Button onClick={(e) => onCancel(e, 'closeButton')} color="primary" {...cancelButton.props}>
76
+ <Button
77
+ onClick={(e) => {
78
+ e.stopPropagation();
79
+ onCancel(e, 'closeButton');
80
+ }}
81
+ color="primary"
82
+ {...cancelButton.props}>
76
83
  {cancelButton.text}
77
84
  </Button>
78
85
  )}
79
- <Button onClick={() => onConfirm()} color="primary" autoFocus {...confirmButton.props}>
86
+ <Button
87
+ onClick={(e) => {
88
+ e.stopPropagation();
89
+ onConfirm(e);
90
+ }}
91
+ color="primary"
92
+ autoFocus
93
+ {...confirmButton.props}>
80
94
  {confirmButton.text}
81
95
  </Button>
82
96
  </>
@@ -46,14 +46,14 @@ const ConfirmHolder = forwardRef((props, ref) => {
46
46
  reset();
47
47
  }, 300);
48
48
  });
49
- const onCancel = useMemoizedFn(() => {
49
+ const onCancel = useMemoizedFn((e, reason) => {
50
50
  close();
51
- state?.onCancel();
51
+ state?.onCancel(e, reason);
52
52
  }, []);
53
- const onConfirm = useMemoizedFn(async () => {
53
+ const onConfirm = useMemoizedFn(async (e) => {
54
54
  state.loading = true;
55
55
  try {
56
- await state?.onConfirm(close);
56
+ await state?.onConfirm(close, e);
57
57
  } finally {
58
58
  state.loading = false;
59
59
  }
@@ -136,7 +136,7 @@ export default function SessionBlocklet({ session, locale, size }) {
136
136
  textAlign: 'center',
137
137
  lineHeight: 'normal',
138
138
  }}>
139
- {item.title?.zh || item.title}
139
+ {item.title?.[locale] || item.title}
140
140
  </Typography>
141
141
  </ListItemButton>
142
142
  </ListItem>