@arcblock/ux 2.13.63 → 2.13.65

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/DID/index.js CHANGED
@@ -7,6 +7,7 @@ import IconQrCode from '@iconify-icons/material-symbols/qr-code-rounded';
7
7
  import { Box, Dialog, DialogContent, Typography } from '@mui/material';
8
8
  import { useCreation, useMemoizedFn } from 'ahooks';
9
9
  import { forwardRef, useImperativeHandle, useRef, useState } from 'react';
10
+ import { toAddress } from '@arcblock/did';
10
11
  import Address from '../Address';
11
12
  import Avatar from '../Avatar';
12
13
  import { DID_PREFIX } from '../Util/constant';
@@ -100,7 +101,10 @@ function useDIDInfo({
100
101
  marginRight: 4
101
102
  },
102
103
  blockiesPadding: false,
103
- className: "did-address-avatar"
104
+ className: "did-address-avatar",
105
+ sx: {
106
+ flexShrink: 0
107
+ }
104
108
  }, `${keyPrefix}-avatar-${avatarSize}`)]);
105
109
  return {
106
110
  isEthDid,
@@ -111,7 +115,7 @@ function useDIDInfo({
111
115
  }
112
116
  export const DID = /*#__PURE__*/forwardRef((props, ref) => {
113
117
  const {
114
- did,
118
+ did: didAddress,
115
119
  chainId,
116
120
  roleType,
117
121
  showAvatar = true,
@@ -131,6 +135,7 @@ export const DID = /*#__PURE__*/forwardRef((props, ref) => {
131
135
  className,
132
136
  sx
133
137
  } = props;
138
+ const did = toAddress(didAddress);
134
139
  const rest = {
135
140
  size,
136
141
  component,
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  /* eslint-disable react/jsx-no-bind */
3
3
  import React, { useState, useContext, useRef, useMemo } from 'react';
4
- import { Button, Typography, IconButton, Popper, MenuItem, MenuList, Box, ClickAwayListener } from '@mui/material';
4
+ import { Button, Typography, IconButton, Popper, MenuItem, MenuList, Box, ClickAwayListener, Paper } from '@mui/material';
5
5
  import { Icon as IconifyIcon } from '@iconify/react';
6
6
  import CheckIcon from '@iconify-icons/material-symbols/check';
7
7
  import LanguageIcon from 'iconify-icons-material-symbols-400/language';
@@ -95,11 +95,10 @@ export default function LocaleSelector(props) {
95
95
  },
96
96
  // @ts-ignore
97
97
  popperProps?.sx),
98
- children: /*#__PURE__*/_jsx(Box, {
98
+ children: /*#__PURE__*/_jsx(Paper, {
99
+ variant: "outlined",
99
100
  className: "locales",
100
101
  sx: {
101
- backgroundColor: 'background.paper',
102
- boxShadow: 2,
103
102
  borderRadius: 1
104
103
  },
105
104
  children: /*#__PURE__*/_jsx(ClickAwayListener, {
@@ -93,9 +93,7 @@ export default function SessionBlocklet({
93
93
  borderRadius: 1.5,
94
94
  width: 350,
95
95
  maxWidth: '90vw',
96
- p: 2,
97
- border: '0 !important',
98
- boxShadow: 2
96
+ p: 2
99
97
  },
100
98
  children: [/*#__PURE__*/_jsx(List, {
101
99
  sx: {
@@ -182,10 +182,7 @@ export default function LoggedIn({
182
182
  transition: true,
183
183
  placement: "bottom-end",
184
184
  sx: {
185
- zIndex: 1600,
186
- '> div': {
187
- boxShadow: theme => theme.palette.mode === 'dark' ? `${theme.shadows[2]}, inset 0 0 0 1px rgba(255, 255, 255, 0.05)` : theme.shadows[2]
188
- }
185
+ zIndex: 1600
189
186
  },
190
187
  children: ({
191
188
  TransitionProps
@@ -203,9 +200,7 @@ export default function LoggedIn({
203
200
  sx: {
204
201
  borderRadius: 1.5,
205
202
  width: 350,
206
- maxWidth: '90vw',
207
- border: '0 !important',
208
- boxShadow: 2
203
+ maxWidth: '90vw'
209
204
  },
210
205
  children: [/*#__PURE__*/_jsx(UserInfo, {
211
206
  locale: locale,
@@ -4,7 +4,7 @@
4
4
  import { createTheme as _createTheme, responsiveFontSizes } from '@mui/material/styles';
5
5
  import { deepmerge } from '@mui/utils';
6
6
  import webfontloader from 'webfontloader';
7
- import { BLOCKLET_THEME_LIGHT, BLOCKLET_THEME_DARK, DEFAULT_FONTS, getDefaultThemePrefer } from '@blocklet/theme';
7
+ import { BLOCKLET_THEME_LIGHT, BLOCKLET_THEME_DARK, DEFAULT_FONTS, getDefaultThemePrefer, getBlockletThemeOptions } from '@blocklet/theme';
8
8
  import { cleanedObj, deepmergeAll } from '../Util';
9
9
 
10
10
  // 默认只加载最基本的 roboto latin 字体
@@ -82,7 +82,7 @@ export function lazyCreateDefaultTheme(mode) {
82
82
  let theme = null;
83
83
  return () => {
84
84
  if (theme) return theme;
85
- const options = deepmerge(createDefaultThemeOptions(mode), window.blocklet?.theme?.[mode] ?? {});
85
+ const options = deepmerge(createDefaultThemeOptions(mode), getBlockletThemeOptions(mode));
86
86
  theme = _createTheme(options);
87
87
  return theme;
88
88
  };
@@ -138,7 +138,7 @@ export const create = (...args) => {
138
138
  const createBaseTheme = lazyCreateDefaultTheme(defaultPrefer);
139
139
  const userThemeOptions = args.reduce((acc, curr) => deepmerge(acc, normalizeUserThemeOptions(typeof curr === 'function' ? curr(createBaseTheme()) : curr)), normalizeUserThemeOptions(defaultUxThemeOptions));
140
140
  const prefer = userThemeOptions.mode || userThemeOptions.palette?.mode || defaultPrefer;
141
- const blockletThemeOptions = window.blocklet?.theme?.[prefer] ?? {};
141
+ const blockletThemeOptions = getBlockletThemeOptions(prefer);
142
142
  const defaultThemeOptions = createDefaultThemeOptions(prefer);
143
143
  const {
144
144
  disableBlockletTheme
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "2.13.63",
3
+ "version": "2.13.65",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -71,14 +71,14 @@
71
71
  "react": ">=18.2.0",
72
72
  "react-router-dom": ">=6.22.3"
73
73
  },
74
- "gitHead": "3ba664fa67f707517df7ba1958bc13870c253ac0",
74
+ "gitHead": "2b6e52f793163511cdf6aabf5b1382f8aa68e5f8",
75
75
  "dependencies": {
76
76
  "@arcblock/did-motif": "^1.1.13",
77
- "@arcblock/icons": "^2.13.63",
78
- "@arcblock/nft-display": "^2.13.63",
79
- "@arcblock/react-hooks": "^2.13.63",
77
+ "@arcblock/icons": "^2.13.65",
78
+ "@arcblock/nft-display": "^2.13.65",
79
+ "@arcblock/react-hooks": "^2.13.65",
80
80
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
81
- "@blocklet/theme": "^2.13.63",
81
+ "@blocklet/theme": "^2.13.65",
82
82
  "@fontsource/roboto": "~5.1.1",
83
83
  "@fontsource/ubuntu-mono": "^5.0.18",
84
84
  "@iconify-icons/logos": "^1.2.36",
package/src/DID/index.tsx CHANGED
@@ -6,6 +6,7 @@ import IconQrCode from '@iconify-icons/material-symbols/qr-code-rounded';
6
6
  import { Box, Dialog, DialogContent, ModalProps, Typography } from '@mui/material';
7
7
  import { useCreation, useMemoizedFn } from 'ahooks';
8
8
  import { forwardRef, useImperativeHandle, useRef, useState } from 'react';
9
+ import { toAddress } from '@arcblock/did';
9
10
 
10
11
  import Address, { IDidAddressWrapper } from '../Address';
11
12
  import Avatar from '../Avatar';
@@ -107,6 +108,7 @@ function useDIDInfo({ did, showAvatar }: { did: string; showAvatar?: boolean })
107
108
  style={{ display: 'inline-flex', alignItems: 'center', marginLeft: 2, marginRight: 4 }}
108
109
  blockiesPadding={false}
109
110
  className="did-address-avatar"
111
+ sx={{ flexShrink: 0 }}
110
112
  />
111
113
  ),
112
114
  ]);
@@ -136,7 +138,7 @@ export interface HTMLDIDElement extends HTMLDidAddressElement {
136
138
 
137
139
  export const DID = forwardRef<HTMLDIDElement, DIDProps>((props, ref) => {
138
140
  const {
139
- did,
141
+ did: didAddress,
140
142
  chainId,
141
143
  roleType,
142
144
  showAvatar = true,
@@ -156,6 +158,7 @@ export const DID = forwardRef<HTMLDIDElement, DIDProps>((props, ref) => {
156
158
  className,
157
159
  sx,
158
160
  } = props;
161
+ const did = toAddress(didAddress);
159
162
 
160
163
  const rest = {
161
164
  size,
@@ -1,6 +1,16 @@
1
1
  /* eslint-disable react/jsx-no-bind */
2
2
  import React, { useState, useContext, useRef, useMemo } from 'react';
3
- import { Button, Typography, IconButton, Popper, MenuItem, MenuList, Box, ClickAwayListener } from '@mui/material';
3
+ import {
4
+ Button,
5
+ Typography,
6
+ IconButton,
7
+ Popper,
8
+ MenuItem,
9
+ MenuList,
10
+ Box,
11
+ ClickAwayListener,
12
+ Paper,
13
+ } from '@mui/material';
4
14
  import { Icon as IconifyIcon } from '@iconify/react';
5
15
  import CheckIcon from '@iconify-icons/material-symbols/check';
6
16
  import LanguageIcon from 'iconify-icons-material-symbols-400/language';
@@ -104,11 +114,10 @@ export default function LocaleSelector(props: LocaleSelectorProps) {
104
114
  // @ts-ignore
105
115
  popperProps?.sx
106
116
  )}>
107
- <Box
117
+ <Paper
118
+ variant="outlined"
108
119
  className="locales"
109
120
  sx={{
110
- backgroundColor: 'background.paper',
111
- boxShadow: 2,
112
121
  borderRadius: 1,
113
122
  }}>
114
123
  <ClickAwayListener onClickAway={onClose}>
@@ -147,7 +156,7 @@ export default function LocaleSelector(props: LocaleSelectorProps) {
147
156
  })}
148
157
  </MenuList>
149
158
  </ClickAwayListener>
150
- </Box>
159
+ </Paper>
151
160
  </Popper>
152
161
  </Wrapper>
153
162
  );
@@ -102,8 +102,6 @@ export default function SessionBlocklet({
102
102
  width: 350,
103
103
  maxWidth: '90vw',
104
104
  p: 2,
105
- border: '0 !important',
106
- boxShadow: 2,
107
105
  }}>
108
106
  <List
109
107
  sx={{
@@ -201,12 +201,6 @@ export default function LoggedIn({
201
201
  placement="bottom-end"
202
202
  sx={{
203
203
  zIndex: 1600,
204
- '> div': {
205
- boxShadow: (theme) =>
206
- theme.palette.mode === 'dark'
207
- ? `${theme.shadows[2]}, inset 0 0 0 1px rgba(255, 255, 255, 0.05)`
208
- : theme.shadows[2],
209
- },
210
204
  }}>
211
205
  {({ TransitionProps }) => (
212
206
  <ClickAwayListener
@@ -222,8 +216,6 @@ export default function LoggedIn({
222
216
  borderRadius: 1.5,
223
217
  width: 350,
224
218
  maxWidth: '90vw',
225
- border: '0 !important',
226
- boxShadow: 2,
227
219
  }}>
228
220
  <UserInfo
229
221
  locale={locale}
@@ -4,7 +4,13 @@ import type { PaletteMode, Theme } from '@mui/material';
4
4
  import { createTheme as _createTheme, responsiveFontSizes, type ThemeOptions } from '@mui/material/styles';
5
5
  import { deepmerge } from '@mui/utils';
6
6
  import webfontloader from 'webfontloader';
7
- import { BLOCKLET_THEME_LIGHT, BLOCKLET_THEME_DARK, DEFAULT_FONTS, getDefaultThemePrefer } from '@blocklet/theme';
7
+ import {
8
+ BLOCKLET_THEME_LIGHT,
9
+ BLOCKLET_THEME_DARK,
10
+ DEFAULT_FONTS,
11
+ getDefaultThemePrefer,
12
+ getBlockletThemeOptions,
13
+ } from '@blocklet/theme';
8
14
  import { cleanedObj, deepmergeAll } from '../Util';
9
15
 
10
16
  // 默认只加载最基本的 roboto latin 字体
@@ -99,7 +105,7 @@ export function lazyCreateDefaultTheme(mode: PaletteMode) {
99
105
  return () => {
100
106
  if (theme) return theme;
101
107
 
102
- const options = deepmerge(createDefaultThemeOptions(mode), window.blocklet?.theme?.[mode] ?? {});
108
+ const options = deepmerge(createDefaultThemeOptions(mode), getBlockletThemeOptions(mode));
103
109
 
104
110
  theme = _createTheme(options);
105
111
  return theme;
@@ -157,7 +163,7 @@ export const create = (...args: Array<UxThemeOptions | ((baseTheme: Theme) => Ux
157
163
  normalizeUserThemeOptions(defaultUxThemeOptions)
158
164
  );
159
165
  const prefer = userThemeOptions.mode || userThemeOptions.palette?.mode || defaultPrefer;
160
- const blockletThemeOptions = window.blocklet?.theme?.[prefer] ?? {};
166
+ const blockletThemeOptions = getBlockletThemeOptions(prefer);
161
167
  const defaultThemeOptions = createDefaultThemeOptions(prefer);
162
168
  const { disableBlockletTheme } = userThemeOptions;
163
169