@arcblock/ux 2.9.79 → 2.9.81

Sign up to get free protection for your applications and to get access to all the features.
package/es/DID/index.js CHANGED
@@ -171,16 +171,18 @@ const DID = /*#__PURE__*/forwardRef(({
171
171
  content: `${DID_PREFIX}${did}`,
172
172
  ...rest,
173
173
  prepend: prepend,
174
- append: showQrcode ? /*#__PURE__*/_jsx(Box, {
175
- component: Icon,
176
- icon: IconQrCode,
177
- onClick: openQrCode,
178
- sx: {
179
- cursor: 'pointer',
180
- ml: rest.copyable ? 0.5 : 0,
181
- color: 'grey.500'
182
- }
183
- }) : null,
174
+ append: /*#__PURE__*/_jsxs(_Fragment, {
175
+ children: [showQrcode ? /*#__PURE__*/_jsx(Box, {
176
+ component: Icon,
177
+ icon: IconQrCode,
178
+ onClick: openQrCode,
179
+ sx: {
180
+ cursor: 'pointer',
181
+ ml: rest.copyable ? 0.5 : 0,
182
+ color: 'grey.500'
183
+ }
184
+ }) : null, rest.append]
185
+ }),
184
186
  children: did
185
187
  }), /*#__PURE__*/_jsxs(Dialog, {
186
188
  open: open,
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable no-prototype-builtins */
2
- import { createContext, useState, useEffect, useContext, useRef } from 'react';
2
+ import { createContext, useState, useEffect, useContext, useRef, useCallback } from 'react';
3
3
  import get from 'lodash/get';
4
4
  import PropTypes from 'prop-types';
5
5
  import Cookie from 'js-cookie';
@@ -102,7 +102,7 @@ function LocaleProvider({
102
102
  } else {
103
103
  lastCurrentLocale.current = currentLocale;
104
104
  }
105
- const t = (key, data) => translate(translations, key, currentLocale, fallbackLocale, data);
105
+ const t = useCallback((key, data) => translate(translations, key, currentLocale, fallbackLocale, data), [translations, currentLocale, fallbackLocale]);
106
106
  return /*#__PURE__*/_jsx(Provider, {
107
107
  value: {
108
108
  locale: currentLocale,
package/lib/DID/index.js CHANGED
@@ -187,16 +187,18 @@ const DID = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
187
187
  content: "".concat(_constant.DID_PREFIX).concat(did)
188
188
  }, rest), {}, {
189
189
  prepend: prepend,
190
- append: showQrcode ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
191
- component: _react2.Icon,
192
- icon: _qrCodeRounded.default,
193
- onClick: openQrCode,
194
- sx: {
195
- cursor: 'pointer',
196
- ml: rest.copyable ? 0.5 : 0,
197
- color: 'grey.500'
198
- }
199
- }) : null,
190
+ append: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
191
+ children: [showQrcode ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
192
+ component: _react2.Icon,
193
+ icon: _qrCodeRounded.default,
194
+ onClick: openQrCode,
195
+ sx: {
196
+ cursor: 'pointer',
197
+ ml: rest.copyable ? 0.5 : 0,
198
+ color: 'grey.500'
199
+ }
200
+ }) : null, rest.append]
201
+ }),
200
202
  children: did
201
203
  })), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Dialog, {
202
204
  open: open,
@@ -127,7 +127,7 @@ function LocaleProvider(_ref) {
127
127
  } else {
128
128
  lastCurrentLocale.current = currentLocale;
129
129
  }
130
- const t = (key, data) => (0, _util.translate)(translations, key, currentLocale, fallbackLocale, data);
130
+ const t = (0, _react.useCallback)((key, data) => (0, _util.translate)(translations, key, currentLocale, fallbackLocale, data), [translations, currentLocale, fallbackLocale]);
131
131
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Provider, {
132
132
  value: _objectSpread({
133
133
  locale: currentLocale,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "2.9.79",
3
+ "version": "2.9.81",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -354,20 +354,20 @@
354
354
  "moment-timezone": "^0.5.37"
355
355
  },
356
356
  "peerDependencies": {
357
+ "@emotion/react": "^11.10.4",
358
+ "@emotion/styled": "^11.10.4",
357
359
  "@mui/icons-material": ">=5.15.0",
358
360
  "@mui/material": ">=5.15.0",
359
361
  "react": ">=18.2.0",
360
362
  "react-router-dom": ">=6.22.3"
361
363
  },
362
- "gitHead": "4cb71ea9e86341cb263ab127a831b3ca2db9571a",
364
+ "gitHead": "7e514618898ec98f3c2c062f76d3808f9c0eee14",
363
365
  "dependencies": {
364
366
  "@arcblock/did-motif": "^1.1.13",
365
- "@arcblock/icons": "^2.9.79",
366
- "@arcblock/nft-display": "^2.9.79",
367
- "@arcblock/react-hooks": "^2.9.79",
367
+ "@arcblock/icons": "^2.9.81",
368
+ "@arcblock/nft-display": "^2.9.81",
369
+ "@arcblock/react-hooks": "^2.9.81",
368
370
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
369
- "@emotion/react": "^11.10.4",
370
- "@emotion/styled": "^11.10.4",
371
371
  "@fontsource/inter": "^5.0.16",
372
372
  "@fontsource/ubuntu-mono": "^5.0.18",
373
373
  "@iconify-icons/logos": "^1.2.36",
package/src/DID/index.jsx CHANGED
@@ -171,18 +171,21 @@ const DID = forwardRef(({ did, showAvatar, showQrcode, chainId, locale, ...rest
171
171
  {...rest}
172
172
  prepend={prepend}
173
173
  append={
174
- showQrcode ? (
175
- <Box
176
- component={Icon}
177
- icon={IconQrCode}
178
- onClick={openQrCode}
179
- sx={{
180
- cursor: 'pointer',
181
- ml: rest.copyable ? 0.5 : 0,
182
- color: 'grey.500',
183
- }}
184
- />
185
- ) : null
174
+ <>
175
+ {showQrcode ? (
176
+ <Box
177
+ component={Icon}
178
+ icon={IconQrCode}
179
+ onClick={openQrCode}
180
+ sx={{
181
+ cursor: 'pointer',
182
+ ml: rest.copyable ? 0.5 : 0,
183
+ color: 'grey.500',
184
+ }}
185
+ />
186
+ ) : null}
187
+ {rest.append}
188
+ </>
186
189
  }>
187
190
  {did}
188
191
  </Address>
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable no-prototype-builtins */
2
- import { createContext, useState, useEffect, useContext, useRef } from 'react';
2
+ import { createContext, useState, useEffect, useContext, useRef, useCallback } from 'react';
3
3
  import get from 'lodash/get';
4
4
  import PropTypes from 'prop-types';
5
5
  import Cookie from 'js-cookie';
@@ -101,7 +101,10 @@ function LocaleProvider({ children, locale, fallbackLocale, translations, onLoad
101
101
  lastCurrentLocale.current = currentLocale;
102
102
  }
103
103
 
104
- const t = (key, data) => translate(translations, key, currentLocale, fallbackLocale, data);
104
+ const t = useCallback(
105
+ (key, data) => translate(translations, key, currentLocale, fallbackLocale, data),
106
+ [translations, currentLocale, fallbackLocale]
107
+ );
105
108
 
106
109
  return <Provider value={{ locale: currentLocale, changeLocale, t, languages: langs, ...rest }}>{children}</Provider>;
107
110
  }